17 #ifndef HEADER_SUPERTUX_SUPERTUX_SECTOR_HPP 18 #define HEADER_SUPERTUX_SUPERTUX_SECTOR_HPP 23 #include "math/anchor_point.hpp" 24 #include "squirrel/squirrel_environment.hpp" 25 #include "supertux/d_scope.hpp" 26 #include "supertux/game_object_manager.hpp" 27 #include "video/color.hpp" 60 static Sector&
get() { assert(s_current !=
nullptr);
return *s_current; }
61 static Sector* current() {
return s_current; }
69 void finish_construction(
bool editable);
71 Level& get_level()
const;
74 void activate(
const std::string& spawnpoint);
75 void activate(
const Vector& player_pos);
78 void update(
float dt_sec);
85 void stop_looping_sounds();
88 void play_looping_sounds();
90 void set_name(
const std::string& name_) { m_name = name_; }
91 const std::string& get_name()
const {
return m_name; }
95 bool inside(
const Rectf& rectangle)
const;
99 bool is_free_of_tiles(
const Rectf& rect,
const bool ignoreUnisolid =
false)
const;
105 bool is_free_of_statics(
const Rectf& rect,
const MovingObject* ignore_object =
nullptr,
const bool ignoreUnisolid =
false)
const;
111 bool is_free_of_movingstatics(
const Rectf& rect,
const MovingObject* ignore_object =
nullptr)
const;
113 bool free_line_of_sight(
const Vector& line_start,
const Vector& line_end,
const MovingObject* ignore_object =
nullptr)
const;
114 bool can_see_player(
const Vector& eye)
const;
117 Player* get_nearest_player (
const Rectf& pos)
const {
118 return (get_nearest_player (get_anchor_pos (pos, ANCHOR_MIDDLE)));
121 std::vector<MovingObject*> get_nearby_objects (
const Vector& center,
float max_distance)
const;
123 Rectf get_active_region()
const;
125 int get_foremost_layer()
const;
128 Size get_editor_size()
const;
131 void resize_sector(
const Size& old_size,
const Size& new_size,
const Size& resize_offset);
134 void change_solid_tiles(uint32_t old_tile_id, uint32_t new_tile_id);
137 void set_gravity(
float gravity);
138 float get_gravity()
const;
140 void set_init_script(
const std::string& init_script) {
141 m_init_script = init_script;
144 void run_script(
const std::string& script,
const std::string& sourcename);
146 Camera& get_camera()
const;
147 Player& get_player()
const;
151 uint32_t collision_tile_attributes(
const Rectf& dest,
const Vector& mov)
const;
153 virtual bool before_object_add(
GameObject&
object)
override;
154 virtual void before_object_remove(
GameObject&
object)
override;
156 int calculate_foremost_layer()
const;
160 void convert_tiles2gameobject();
168 bool m_fully_constructed;
170 std::string m_init_script;
172 int m_foremost_layer;
174 std::unique_ptr<SquirrelEnvironment> m_squirrel_environment;
175 std::unique_ptr<CollisionSystem> m_collision_system;
Definition: writer.hpp:27
Simple two dimensional vector.
Definition: vector.hpp:24
Definition: game_object_manager.hpp:34
Definition: collision_system.hpp:32
Represents one of (potentially) multiple, separate parts of a Level.
Definition: sector.hpp:49
Definition: collision.cpp:24
Definition: display_effect.hpp:24
Represents a collection of Sectors running in a single GameSession.
Definition: level.hpp:29
Base class for all the things that make up Levels' Sectors.
Definition: game_object.hpp:46
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:31
This class is responsible for drawing the level tiles.
Definition: tilemap.hpp:39
Definition: camera.hpp:36
Definition: reader_mapping.hpp:31
Definition: player.hpp:39
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42