GameSession::GameSession(const std::string& levelfile_, PlayerStatus* player_status, Statistics* statistics) :
level(),
- statistics_backdrop(),
+ statistics_backdrop(Surface::create("images/engine/menu/score-backdrop.png")),
scripts(),
- currentsector(0),
+ currentsector(nullptr),
levelnb(),
pause_menu_frame(),
end_sequence(0),
- game_pause(),
- speed_before_pause(),
+ game_pause(false),
+ speed_before_pause(g_screen_manager->get_speed()),
levelfile(levelfile_),
reset_sector(),
reset_pos(),
demo_controller(0),
play_time(0),
edit_mode(false),
- levelintro_shown(false)
+ levelintro_shown(false),
+ coins_at_start(),
+ bonus_at_start(),
+ max_fire_bullets_at_start(),
+ max_ice_bullets_at_start()
{
- currentsector = NULL;
-
- game_pause = false;
- speed_before_pause = g_screen_manager->get_speed();
-
- statistics_backdrop = Surface::create("images/engine/menu/score-backdrop.png");
-
if (restart_level() != 0)
throw std::runtime_error ("Initializing the level failed.");
}
if(!game_pause) {
speed_before_pause = g_screen_manager->get_speed();
g_screen_manager->set_speed(0);
- MenuManager::instance().set_current(MenuStorage::GAME_MENU);
+ MenuManager::instance().set_menu(MenuStorage::GAME_MENU);
game_pause = true;
}
void
GameSession::abort_level()
{
- MenuManager::instance().set_current(MenuStorage::NO_MENU);
+ MenuManager::instance().clear_menu_stack();
g_screen_manager->exit_screen();
currentsector->player->set_bonus(bonus_at_start);
PlayerStatus *currentStatus = get_player_status();
void
GameSession::process_events()
{
- // end of pause mode?
- // XXX this looks like a fail-safe to unpause the game if there's no menu
- // XXX having it enabled causes some unexpected problems
- // XXX hopefully disabling it won't...
- /*
- if(!Menu::current() && game_pause) {
- game_pause = false;
- }
- */
-
// playback a demo?
if(playback_demo_stream != 0) {
demo_controller->update();