19 #ifndef HEADER_SUPERTUX_WORLDMAP_WORLDMAP_SECTOR_HPP 20 #define HEADER_SUPERTUX_WORLDMAP_WORLDMAP_SECTOR_HPP 22 #include "supertux/sector_base.hpp" 24 #include "worldmap/tux.hpp" 45 static void register_class(ssq::VM& vm);
56 std::string get_exposed_class_name()
const override {
return "WorldMapSector"; }
62 void update(
float dt_sec)
override;
64 Vector get_next_tile(
const Vector& pos,
const Direction& direction)
const;
76 size_t level_count()
const;
77 size_t solved_level_count()
const;
90 return at_object<T>(m_tux->get_tile_pos());
93 T* at_object(
const Vector& pos)
const 95 for (
auto& obj : get_objects_by_type<T>())
96 if (obj.get_tile_pos() == pos)
104 bool path_ok(
const Direction& direction,
const Vector& old_pos, Vector* new_pos)
const;
109 bool in_worldmap()
const override {
return true; }
135 void spawn(
const std::string& sector,
const std::string& spawnpoint);
157 TileSet* get_tileset()
const override;
158 WorldMap& get_worldmap()
const {
return m_parent; }
159 Camera& get_camera()
const {
return *m_camera; }
160 Tux& get_tux()
const {
return *m_tux; }
161 Vector get_tux_pos()
const;
165 const Vector& pos,
const std::string& direction,
166 const std::string& data)
override;
173 std::unique_ptr<Camera> m_camera;
175 std::vector<std::unique_ptr<SpawnPoint> > m_spawnpoints;
177 std::string m_initial_fade_tilemap;
178 int m_fade_direction;
int available_directions_at(const Vector &pos) const
gets a bitfield of Tile::WORLDMAP_NORTH | Tile::WORLDMAP_WEST | ...
Definition: worldmap_sector.cpp:421
Definition: worldmap_sector_parser.hpp:27
bool path_ok(const Direction &direction, const Vector &old_pos, Vector *new_pos) const
Check if it is possible to walk from pos into direction, if possible, write the new position to new_p...
Definition: worldmap_sector.cpp:534
Definition: spawn_point.hpp:30
MovingObject & add_object_scripting(const std::string &class_name, const std::string &name, const Vector &pos, const std::string &direction, const std::string &data) override
Add a MovingObject from scripting.
Definition: worldmap_sector.cpp:380
int tile_data_at(const Vector &pos) const
returns a bitfield representing the union of all Tile::WORLDMAP_XXX values of all solid tiles at the ...
Definition: worldmap_sector.cpp:427
Definition: worldmap_state.hpp:30
SpawnPoint * get_spawnpoint_by_name(const std::string &spawnpoint_name) const
Get a spawnpoint by its name.
Definition: worldmap_sector.cpp:524
float get_tux_x() const
Returns Tux's X position on the worldmap.
Definition: worldmap_sector.cpp:632
float get_tux_y() const
Returns Tux's Y position on the worldmap.
Definition: worldmap_sector.cpp:638
void move_to_spawnpoint(const std::string &spawnpoint)
Moves Tux to the specified spawnpoint.
Definition: worldmap_sector.cpp:586
void set_title_level(const std::string &filename)
Overrides the "Title Screen Level" property for the world with ""filename"".
Definition: worldmap_sector.cpp:650
std::string get_filename() const
Gets the path to the worldmap file.
Definition: worldmap_sector.cpp:644
Represents one of (potentially) multiple, separate parts of a WorldMap.
Definition: worldmap_sector.hpp:39
Definition: camera.hpp:27
Definition: object_settings.hpp:32
void finished_level(Level *level)
gets called from the GameSession when a level has been successfully finished
Definition: worldmap_sector.cpp:462
A base for sector classes.
Definition: sector_base.hpp:30
Represents a collection of Sectors running in a single GameSession.
Definition: level.hpp:30
void set_sector(const std::string §or)
Changes the current sector of the worldmap to a specified new sector.
Definition: worldmap_sector.cpp:574
void finish_construction(bool editable) override
Needs to be called after parsing to finish the construction of the Sector before using it...
Definition: worldmap_sector.cpp:87
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:35
void set_initial_fade_tilemap(const std::string &tilemap_name, int direction)
Sets the name of the tilemap that should fade when worldmap is set up.
Definition: worldmap_sector.cpp:612
void setup()
Definition: worldmap_sector.cpp:107
A ""Camera"" that was given a name can be manipulated by scripts.
Definition: camera.hpp:40
Definition: tile_set.hpp:44
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
void spawn(const std::string §or, const std::string &spawnpoint)
Changes the current sector of the worldmap to a specified new sector, moving Tux to the specified spa...
Definition: worldmap_sector.cpp:580
Definition: worldmap.hpp:33