17 #ifndef HEADER_SUPERTUX_SUPERTUX_SECTOR_HPP 18 #define HEADER_SUPERTUX_SUPERTUX_SECTOR_HPP 20 #include "supertux/sector_base.hpp" 25 #include "collision/collision_system.hpp" 26 #include "math/anchor_point.hpp" 27 #include "math/easing.hpp" 28 #include "math/fwd.hpp" 29 #include "supertux/d_scope.hpp" 30 #include "supertux/tile.hpp" 31 #include "video/color.hpp" 67 static void register_class(ssq::VM& vm);
74 static Sector&
get() { assert(s_current !=
nullptr);
return *s_current; }
75 static Sector* current() {
return s_current; }
81 void finish_construction(
bool editable)
override;
83 std::string get_exposed_class_name()
const override {
return "Sector"; }
85 Level& get_level()
const {
return m_level; }
86 TileSet* get_tileset()
const override;
87 bool in_worldmap()
const override;
90 void activate(
const std::string& spawnpoint);
91 void activate(
const Vector& player_pos);
95 void update(
float dt_sec)
override;
100 void stop_looping_sounds();
103 void pause_camera_interpolation();
106 void play_looping_sounds();
110 bool inside(
const Rectf& rectangle)
const;
114 bool is_free_of_tiles(
const Rectf& rect,
const bool ignoreUnisolid =
false, uint32_t tiletype =
Tile::SOLID)
const;
124 bool is_free_of_solid_tiles(
float left,
float top,
float right,
float bottom,
125 bool ignore_unisolid)
const;
131 bool is_free_of_statics(
const Rectf& rect,
const MovingObject* ignore_object =
nullptr,
const bool ignoreUnisolid =
false)
const;
144 bool is_free_of_statics(
float left,
float top,
float right,
float bottom,
145 bool ignore_unisolid)
const;
151 bool is_free_of_movingstatics(
const Rectf& rect,
const MovingObject* ignore_object =
nullptr)
const;
163 bool is_free_of_movingstatics(
float left,
float top,
float right,
float bottom)
const;
167 bool is_free_of_specifically_movingstatics(
const Rectf& rect,
const MovingObject* ignore_object =
nullptr)
const;
177 bool is_free_of_specifically_movingstatics(
float left,
float top,
float right,
float bottom)
const;
180 const Vector& line_end,
183 bool free_line_of_sight(
const Vector& line_start,
const Vector& line_end,
bool ignore_objects =
false,
const MovingObject* ignore_object =
nullptr)
const;
184 bool can_see_player(
const Vector& eye)
const;
186 Player* get_nearest_player (
const Vector& pos)
const;
187 Player* get_nearest_player (
const Rectf& pos)
const {
188 return (get_nearest_player (get_anchor_pos (pos, ANCHOR_MIDDLE)));
191 std::vector<MovingObject*> get_nearby_objects (
const Vector& center,
float max_distance)
const;
193 Rectf get_active_region()
const;
195 int get_foremost_opaque_layer()
const;
196 int get_foremost_layer()
const;
199 Size get_editor_size()
const;
202 void resize_sector(
const Size& old_size,
const Size& new_size,
const Size& resize_offset);
205 void change_solid_tiles(uint32_t old_tile_id, uint32_t new_tile_id);
213 void set_gravity(
float gravity);
220 float get_gravity()
const;
222 Camera& get_camera()
const;
223 std::vector<Player*> get_players()
const;
225 TextObject& get_text_object()
const {
return m_text_object; }
227 Vector get_spawn_point_position(
const std::string& spawnpoint);
230 uint32_t collision_tile_attributes(
const Rectf& dest,
const Vector& mov)
const;
232 virtual bool before_object_add(
GameObject&
object)
override;
233 virtual void before_object_remove(
GameObject&
object)
override;
235 int calculate_foremost_layer(
bool including_transparent =
true)
const;
239 void convert_tiles2gameobject();
246 bool m_fully_constructed;
247 int m_foremost_layer;
248 int m_foremost_opaque_layer;
256 std::unique_ptr<CollisionSystem> m_collision_system;
260 Vector m_last_translation;
solid tile that is indestructible by Tux
Definition: tile.hpp:41
Definition: collision_system.hpp:39
A text object intended for scripts that want to tell a story.
Definition: text_object.hpp:38
Definition: collision_system.hpp:36
Represents one of (potentially) multiple, separate parts of a Level.
Definition: sector.hpp:61
Definition: spawnpoint.hpp:28
Definition: collision.cpp:24
This class takes care of moving objects that have collided on top of other moving objects or on top o...
Definition: collision_movement_manager.hpp:32
""DisplayEffect"" is an interface for toying with the display.
Definition: display_effect.hpp:29
A base for sector classes.
Definition: sector_base.hpp:30
Represents a collection of Sectors running in a single GameSession.
Definition: level.hpp:30
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:35
Definition: collision_object.hpp:33
This class is responsible for managing an array of tiles.
Definition: tilemap.hpp:49
A ""Camera"" that was given a name can be manipulated by scripts.
Definition: camera.hpp:40
Definition: reader_mapping.hpp:32
Definition: tile_set.hpp:44
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
Definition: writer.cpp:23