X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fgame_session.hpp;h=fdae705546a705f8b47ad717c6c1cf49325ad532;hb=2b7cf1bf8c85a4df1d2a02ddcad8723b40f8efff;hp=33cdd2d5e40a5fefc092fe4171c725141a915c33;hpb=b4ffa23e2beb6d10f8f5f2fccd4b41fb3e344759;p=supertux.git diff --git a/src/supertux/game_session.hpp b/src/supertux/game_session.hpp index 33cdd2d5e..fdae70554 100644 --- a/src/supertux/game_session.hpp +++ b/src/supertux/game_session.hpp @@ -27,13 +27,14 @@ #include "util/currenton.hpp" #include "video/surface.hpp" +class CodeController; +class DrawingContext; class Level; +class Menu; +class PlayerStatus; class Sector; class Statistics; -class PlayerStatus; -class DrawingContext; -class CodeController; -class Menu; +class Savegame; /** * Screen that runs a Level, where Players run and jump through Sectors. @@ -42,7 +43,7 @@ class GameSession : public Screen, public Currenton { public: - GameSession(const std::string& levelfile, PlayerStatus* player_status, Statistics* statistics = NULL); + GameSession(const std::string& levelfile, Savegame& savegame, Statistics* statistics = NULL); ~GameSession(); void record_demo(const std::string& filename); @@ -51,7 +52,8 @@ public: void draw(DrawingContext& context); void update(float frame_ratio); - void setup(); + void setup() override; + void leave() override; /// ends the current level void finish(bool win = true); @@ -69,9 +71,6 @@ public: Level* get_current_level() { return level.get(); } - PlayerStatus* get_player_status() - { return player_status; } - void start_sequence(const std::string& sequencename); /** @@ -83,6 +82,7 @@ public: int restart_level(); void toggle_pause(); + void abort_level(); /** * Enters or leaves level editor mode @@ -94,6 +94,8 @@ public: */ void force_ghost_mode(); + Savegame& get_savegame() { return m_savegame; } + private: void check_end_conditions(); void process_events(); @@ -104,9 +106,8 @@ private: HSQUIRRELVM run_script(std::istream& in, const std::string& sourcename); void on_escape_press(); - void process_menu(); - std::auto_ptr level; + std::unique_ptr level; SurfacePtr statistics_backdrop; // scripts @@ -134,20 +135,18 @@ private: std::string newspawnpoint; Statistics* best_level_statistics; - PlayerStatus* player_status; + Savegame& m_savegame; std::ostream* capture_demo_stream; std::string capture_file; std::istream* playback_demo_stream; CodeController* demo_controller; - std::auto_ptr game_menu; - float play_time; /**< total time in seconds that this session ran interactively */ bool edit_mode; /**< true if GameSession runs in level editor mode */ bool levelintro_shown; /**< true if the LevelIntro screen was already shown */ - + int coins_at_start; /** How many coins does the player have at the start */ BonusType bonus_at_start; /** What bonuses does the player have at the start */ int max_fire_bullets_at_start; /** How many fire bullets does the player have */