activate_bad_guys();
activate_particle_systems();
get_level()->load_song();
+
+ apply_bonuses();
}
World::World(const std::string& subset, int level_nr)
activate_bad_guys();
activate_particle_systems();
get_level()->load_song();
+
+ apply_bonuses();
+}
+
+void
+World::apply_bonuses()
+{
+ std::cout << "Bonus: " << player_status.bonus << std::endl;
+
+ // Apply bonuses from former levels
+ switch (player_status.bonus)
+ {
+ case PlayerStatus::NO_BONUS:
+ break;
+
+ case PlayerStatus::FLOWER_BONUS:
+ tux.got_coffee = true;
+ // fall through
+
+ case PlayerStatus::GROWUP_BONUS:
+ // FIXME: Move this to Player class
+ tux.size = BIG;
+ tux.base.height = 64;
+ tux.base.y -= 32;
+ break;
+ }
}
World::~World()
/** Try to bumb a badguy that might we walking above Tux, thus shaking
the tile which the badguy is walking on an killing him this way */
void trybumpbadguy(float x, float y);
+
+ /** Apply bonuses active in the player status, used to reactivate
+ bonuses from former levels */
+ void apply_bonuses();
};
/** FIMXE: Workaround for the leveleditor mainly */
break;
case GameSession::GAME_OVER:
quit = true;
+ player_status.bonus = PlayerStatus::NO_BONUS;
break;
case GameSession::NONE:
// Should never be reached
{
Point p;
std::string back_str = "none";
+ std::string bonus_str = "none";
LispReader tux_reader(tux_cur);
tux_reader.read_int("x", &p.x);
tux_reader.read_int("y", &p.y);
tux_reader.read_string("back", &back_str);
+ tux_reader.read_string("bonus", &bonus_str);
+ player_status.bonus = string_to_bonus(bonus_str);
tux->back_direction = string_to_direction(back_str);
tux->set_tile_pos(p);
}