#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(),
newsector(),
newspawnpoint(),
best_level_statistics(statistics),
- m_world_state(world_state),
+ m_savegame(savegame),
capture_demo_stream(0),
capture_file(),
playback_demo_stream(0),
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;
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;
}
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();
if(win) {
if(WorldMap::current())
+ {
WorldMap::current()->finished_level(level.get());
+ }
+
+ if (LevelsetScreen::current())
+ {
+ LevelsetScreen::current()->finished_level(win);
+ }
}
g_screen_manager->pop_screen();
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) {