17 #ifndef HEADER_SUPERTUX_SUPERTUX_GAME_SESSION_HPP 18 #define HEADER_SUPERTUX_SUPERTUX_GAME_SESSION_HPP 20 #include "supertux/screen.hpp" 21 #include "util/currenton.hpp" 24 #include <unordered_map> 27 #include <simplesquirrel/table.hpp> 29 #include "math/vector.hpp" 30 #include "squirrel/squirrel_scheduler.hpp" 31 #include "squirrel/squirrel_util.hpp" 32 #include "supertux/game_object.hpp" 33 #include "supertux/player_status.hpp" 34 #include "supertux/screen_fade.hpp" 35 #include "supertux/sequence.hpp" 36 #include "supertux/timer.hpp" 37 #include "video/surface_ptr.hpp" 56 SpawnPoint(
const std::string& sector_,
57 const Vector& position_,
58 bool is_checkpoint_ =
false) :
62 is_checkpoint(is_checkpoint_)
64 SpawnPoint(
const std::string& sector_,
65 const std::string& spawnpoint_,
66 bool is_checkpoint_ =
false) :
68 spawnpoint(spawnpoint_),
70 is_checkpoint(is_checkpoint_)
74 std::string spawnpoint;
81 bool preserve_music =
false);
85 virtual void setup()
override;
86 virtual void leave()
override;
90 void finish(
bool win =
true);
91 void respawn(
const std::string& sectorname,
const std::string& spawnpointname);
92 void respawn_with_fade(
const std::string& sectorname,
93 const std::string& spawnpointname,
94 const ScreenFade::FadeType fade_type,
95 const Vector &fade_point,
96 const bool make_invincible =
false);
99 void set_start_point(
const std::string& sectorname,
100 const std::string& spawnpointname);
101 void set_start_pos(
const std::string& sectorname,
const Vector& pos);
102 void set_respawn_point(
const std::string& sectorname,
103 const std::string& spawnpointname);
104 void set_respawn_pos(
const std::string& sectorname,
const Vector& pos);
105 void clear_respawn_points();
107 const SpawnPoint& get_last_spawnpoint()
const;
109 void set_checkpoint_pos(
const std::string& sectorname,
const Vector& pos);
110 const SpawnPoint* get_active_checkpoint_spawnpoint()
const;
112 Sector& get_current_sector()
const {
return *m_currentsector; }
113 Level& get_current_level()
const {
return *m_level; }
115 void start_sequence(
Player* caller, Sequence seq,
const SequenceData* data =
nullptr);
116 void set_target_timer_paused(
bool paused);
124 const std::string& get_level_file()
const {
return m_levelfile; }
125 bool has_active_sequence()
const;
126 int restart_level(
bool after_death =
false,
bool preserve_music =
false);
130 bool is_active()
const;
132 Savegame& get_savegame()
const {
return m_savegame; }
137 void check_end_conditions();
142 void on_escape_press(
bool force_quick_respawn);
144 Vector get_fade_point()
const;
145 Vector get_fade_point(
const Vector& position)
const;
149 bool reset_checkpoint_button;
154 std::unique_ptr<Level> m_level;
155 SurfacePtr m_statistics_backdrop;
157 ssq::Table m_data_table;
164 float m_speed_before_pause;
166 std::string m_levelfile;
169 std::vector<SpawnPoint> m_spawnpoints;
170 const SpawnPoint* m_activated_checkpoint;
173 std::string m_newsector;
174 std::string m_newspawnpoint;
175 ScreenFade::FadeType m_spawn_fade_type;
176 Timer m_spawn_fade_timer;
177 bool m_spawn_with_invincibility;
186 bool m_levelintro_shown;
188 int m_coins_at_start;
189 std::vector<BonusType> m_boni_at_start;
190 std::vector<int> m_max_fire_bullets_at_start;
191 std::vector<int> m_max_ice_bullets_at_start;
195 bool m_end_seq_started;
196 bool m_pause_target_timer;
198 std::unique_ptr<GameObject> m_current_cutscene_text;
200 Timer m_endsequence_timer;
bool m_prevent_death
true if players should enter ghost mode instead of dying
Definition: game_session.hpp:151
Definition: controller.hpp:57
void finish(bool win=true)
ends the current level
Definition: game_session.cpp:690
Abstract base class for code the MainLoop runs exclusively and full-screen.
Definition: screen.hpp:31
virtual void update(float dt_sec, const Controller &controller) override
gets called for once (per logical) frame.
Definition: game_session.cpp:496
Definition: sequence.hpp:33
This class is a layer between level and worldmap to keep track of stuff like scores, and minor, but funny things, like number of jumps and stuff.
Definition: statistics.hpp:36
std::string get_working_directory() const
returns the "working directory" usually this is the directory where the currently played level reside...
Definition: game_session.cpp:824
Represents one of (potentially) multiple, separate parts of a Level.
Definition: sector.hpp:61
This class keeps a list of squirrel threads that are scheduled for a certain time.
Definition: squirrel_scheduler.hpp:26
Definition: endsequence.hpp:25
virtual void draw(Compositor &compositor) override
gets called once per frame.
Definition: game_session.cpp:437
virtual void setup() override
gets called before this screen gets activated (which is at least once before the first draw or update...
Definition: game_session.cpp:462
A 'Currenton' allows access to the currently active instance of a class via the static current() func...
Definition: currenton.hpp:30
Represents a collection of Sectors running in a single GameSession.
Definition: level.hpp:30
virtual void leave() override
gets called when the current screen is temporarily suspended
Definition: game_session.cpp:490
Definition: compositor.hpp:29
Definition: integration.hpp:26
Definition: savegame.hpp:69
This is a dummy controller that doesn't react to any user input but should be controlled by code...
Definition: codecontroller.hpp:24
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
virtual IntegrationStatus get_status() const override
Gives details about what the user is doing right now.
Definition: game_session.cpp:677
This module contains methods controlling the player.
Definition: player.hpp:47
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
Screen that runs a Level, where Players run and jump through Sectors.
Definition: game_session.hpp:49