#include "supertux/gameconfig.hpp"
#include "supertux/levelintro.hpp"
#include "supertux/globals.hpp"
-#include "supertux/mainloop.hpp"
+#include "supertux/screen_manager.hpp"
#include "supertux/menu/menu_storage.hpp"
#include "supertux/menu/game_menu.hpp"
#include "supertux/menu/options_menu.hpp"
#include "util/gettext.hpp"
#include "worldmap/worldmap.hpp"
-GameSession::GameSession(const std::string& levelfile_, Statistics* statistics) :
+GameSession::GameSession(const std::string& levelfile_, PlayerStatus* player_status, Statistics* statistics) :
level(0),
statistics_backdrop(),
scripts(),
newsector(),
newspawnpoint(),
best_level_statistics(statistics),
+ player_status(player_status),
capture_demo_stream(0),
capture_file(),
playback_demo_stream(0),
currentsector = NULL;
game_pause = false;
- speed_before_pause = g_main_loop->get_speed();
+ speed_before_pause = g_screen_manager->get_speed();
- statistics_backdrop.reset(new Surface("images/engine/menu/score-backdrop.png"));
+ statistics_backdrop = Surface::create("images/engine/menu/score-backdrop.png");
restart_level();
}
} catch(std::exception& e) {
log_fatal << "Couldn't start level: " << e.what() << std::endl;
- g_main_loop->exit_screen();
+ g_screen_manager->exit_screen();
}
sound_manager->stop_music();
delete capture_demo_stream;
delete playback_demo_stream;
delete demo_controller;
- MenuStorage::free_options_menu();
}
void
{
// pause
if(!game_pause) {
- speed_before_pause = g_main_loop->get_speed();
- g_main_loop->set_speed(0);
+ speed_before_pause = g_screen_manager->get_speed();
+ g_screen_manager->set_speed(0);
MenuManager::set_current(game_menu.get());
game_menu->set_active_item(MNID_CONTINUE);
game_pause = true;
HSQUIRRELVM
GameSession::run_script(std::istream& in, const std::string& sourcename)
{
- using namespace Scripting;
+ using namespace scripting;
// garbage collect thread list
for(ScriptList::iterator i = scripts.begin();
break;
case MNID_ABORTLEVEL:
MenuManager::set_current(0);
- g_main_loop->exit_screen();
+ g_screen_manager->exit_screen();
break;
}
}
if (!levelintro_shown) {
levelintro_shown = true;
- g_main_loop->push_screen(new LevelIntro(level.get(), best_level_statistics));
+ g_screen_manager->push_screen(new LevelIntro(level.get(), best_level_statistics));
}
}
// Unpause the game if the menu has been closed
if (game_pause && !MenuManager::current()) {
- g_main_loop->set_speed(speed_before_pause);
+ g_screen_manager->set_speed(speed_before_pause);
game_pause = false;
}
void
GameSession::finish(bool win)
{
- using namespace WorldMapNS;
+ using namespace worldmap;
if (edit_mode) {
force_ghost_mode();
WorldMap::current()->finished_level(level.get());
}
- g_main_loop->exit_screen();
+ g_screen_manager->exit_screen();
}
void
}
/* slow down the game for end-sequence */
- g_main_loop->set_speed(0.5f);
+ g_screen_manager->set_speed(0.5f);
currentsector->add_object(end_sequence);
end_sequence->start();
// draw level stats while end_sequence is running
if (end_sequence) {
- level->stats.draw_endseq_panel(context, best_level_statistics, statistics_backdrop.get());
+ level->stats.draw_endseq_panel(context, best_level_statistics, statistics_backdrop);
}
}