X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fgame_session.cpp;h=3ddedfcf7bd0dfc7aa282bd803efd2f349a05cd5;hb=1f40c3162dad16f31085234080f5fad3c4d7a8c7;hp=d0cc1271128c6c53422fc7311f8e957c9f9a7c7b;hpb=8bd7a82e3f24faa2a708acf1c10500098c6491db;p=supertux.git diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp index d0cc12711..3ddedfcf7 100644 --- a/src/supertux/game_session.cpp +++ b/src/supertux/game_session.cpp @@ -34,18 +34,19 @@ #include "supertux/gameconfig.hpp" #include "supertux/globals.hpp" #include "supertux/levelintro.hpp" +#include "supertux/levelset_screen.hpp" #include "supertux/menu/menu_storage.hpp" #include "supertux/menu/options_menu.hpp" #include "supertux/player_status.hpp" +#include "supertux/savegame.hpp" #include "supertux/screen_fade.hpp" #include "supertux/screen_manager.hpp" #include "supertux/sector.hpp" -#include "supertux/world_state.hpp" #include "util/file_system.hpp" #include "util/gettext.hpp" #include "worldmap/worldmap.hpp" -GameSession::GameSession(const std::string& levelfile_, WorldState& world_state, Statistics* statistics) : +GameSession::GameSession(const std::string& levelfile_, Savegame& savegame, Statistics* statistics) : level(), statistics_backdrop(Surface::create("images/engine/menu/score-backdrop.png")), scripts(), @@ -61,7 +62,7 @@ GameSession::GameSession(const std::string& levelfile_, WorldState& world_state, newsector(), newspawnpoint(), best_level_statistics(statistics), - m_world_state(world_state), + m_savegame(savegame), capture_demo_stream(0), capture_file(), playback_demo_stream(0), @@ -81,7 +82,7 @@ GameSession::GameSession(const std::string& levelfile_, WorldState& world_state, int GameSession::restart_level() { - PlayerStatus* currentStatus = m_world_state.get_player_status(); + PlayerStatus* currentStatus = m_savegame.get_player_status(); coins_at_start = currentStatus->coins; bonus_at_start = currentStatus->bonus; max_fire_bullets_at_start = currentStatus->max_fire_bullets; @@ -257,7 +258,7 @@ GameSession::abort_level() MenuManager::instance().clear_menu_stack(); g_screen_manager->pop_screen(); currentsector->player->set_bonus(bonus_at_start); - PlayerStatus *currentStatus = m_world_state.get_player_status(); + PlayerStatus *currentStatus = m_savegame.get_player_status(); currentStatus->coins = coins_at_start; currentStatus->max_fire_bullets = max_fire_bullets_at_start; currentStatus->max_ice_bullets = max_ice_bullets_at_start; @@ -407,11 +408,24 @@ GameSession::setup() } void +GameSession::leave() +{ +} + +void GameSession::update(float elapsed_time) { // handle controller if(g_input_manager->get_controller()->pressed(Controller::PAUSE_MENU)) + { on_escape_press(); + } + + if(g_input_manager->get_controller()->pressed(Controller::CHEAT_MENU)) + { + game_pause = true; + MenuManager::instance().set_menu(MenuStorage::CHEAT_MENU); + } process_events(); MenuManager::instance().check_menu(); @@ -488,7 +502,14 @@ GameSession::finish(bool win) if(win) { if(WorldMap::current()) + { WorldMap::current()->finished_level(level.get()); + } + + if (LevelsetScreen::current()) + { + LevelsetScreen::current()->finished_level(win); + } } g_screen_manager->pop_screen(); @@ -575,7 +596,7 @@ GameSession::start_sequence(const std::string& sequencename) void GameSession::drawstatus(DrawingContext& context) { - m_world_state.get_player_status()->draw(context); + m_savegame.get_player_status()->draw(context); // draw level stats while end_sequence is running if (end_sequence) {