X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fgame_session.hpp;h=3c5e5dbab5ce26cf80f98080cedf2ae5383c1c54;hb=339968d0eb222f5cad1397580631ab44acf40b10;hp=e41eb1e66bd95a92b3f0e949d6972488b440e327;hpb=53b4479f1e7e148ee0f8940de236359513bb4558;p=supertux.git diff --git a/src/game_session.hpp b/src/game_session.hpp index e41eb1e66..3c5e5dbab 100644 --- a/src/game_session.hpp +++ b/src/game_session.hpp @@ -28,27 +28,12 @@ #include "console.hpp" #include "video/surface.hpp" -/* GameLoop modes */ -enum GameSessionMode { - ST_GL_PLAY, - ST_GL_TEST, - ST_GL_LOAD_GAME, - ST_GL_LOAD_LEVEL_FILE, - ST_GL_DEMO_GAME -}; - -enum GameMenuIDs { - MNID_CONTINUE, - MNID_ABORTLEVEL -}; - -extern int game_started; - class Level; class Sector; class Statistics; class DrawingContext; class CodeController; +class Menu; /** * The GameSession class controlls the controll flow of the Game (the part @@ -57,11 +42,11 @@ class CodeController; class GameSession : public Screen { public: - GameSession(const std::string& levelfile, GameSessionMode mode, - Statistics* statistics = NULL); + GameSession(const std::string& levelfile, Statistics* statistics = NULL); ~GameSession(); void record_demo(const std::string& filename); + int get_demo_random_seed(const std::string& filename); void play_demo(const std::string& filename); void draw(DrawingContext& context); @@ -75,12 +60,16 @@ public: /// ends the current level void finish(bool win = true); - void respawn(const std::string& sectorname, - const std::string& spawnpointname); - void set_reset_point(const std::string& sectorname, - const Vector& pos); - void display_info_box(const std::string& text); + void respawn(const std::string& sectorname, const std::string& spawnpointname); + void set_reset_point(const std::string& sectorname, const Vector& pos); + std::string get_reset_point_sectorname() + { return reset_sector; } + Vector get_reset_point_pos() + { return reset_pos; } + + void display_info_box(const std::string& text); + Sector* get_current_sector() { return currentsector; } @@ -89,13 +78,16 @@ public: void start_sequence(const std::string& sequencename); - /** returns the "working directory" usually this is the directory where the + /** + * returns the "working directory" usually this is the directory where the * currently played level resides. This is used when locating additional * resources for the current level/world */ std::string get_working_directory(); void restart_level(bool fromBeginning = true); + void toggle_pause(); + private: void check_end_conditions(); void process_events(); @@ -105,6 +97,7 @@ private: void drawstatus(DrawingContext& context); void draw_pause(DrawingContext& context); + HSQUIRRELVM run_script(std::istream& in, const std::string& sourcename); void on_escape_press(); void process_menu(); @@ -112,11 +105,13 @@ private: std::auto_ptr level; std::auto_ptr statistics_backdrop; + // scripts + typedef std::vector ScriptList; + ScriptList scripts; + Sector* currentsector; - GameSessionMode mode; int levelnb; - float fps_fps; int pause_menu_frame; /** If true the end_sequence will be played, user input will be @@ -150,7 +145,10 @@ private: 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 */ }; #endif /*SUPERTUX_GAMELOOP_H*/ -