![]() |
Peoplemon
0.1.0
Peoplemon 3 game source documentation
|
Wrapper over the core::Map class that is directly usable in a bl::gui::GUI. More...
#include <EditMap.hpp>
Public Types | |
enum class | RenderOverlay { None , Collisions , CatchTiles , Towns , Events , Spawns , LevelTransitions } |
Optional render overlays depending on editor state. More... | |
typedef std::shared_ptr< EditMap > | Ptr |
Pointer to an EditMap. More... | |
using | PositionCb = std::function< void(const sf::Vector2f &pixels, const sf::Vector2i &tiles)> |
Called when the map is clicked. More... | |
using | ActionCb = std::function< void()> |
Called on various event types. More... | |
Public Member Functions | |
virtual | ~EditMap () |
Destroy the Edit Map object. More... | |
bool | unsavedChanges () const |
Returns whether or not the map has been updated since last being saved. More... | |
const std::string & | currentFile () const |
Returns the current file the map is saving to. More... | |
void | newMap (const std::string &filename, const std::string &name, const std::string &tileset, unsigned int width, unsigned int height) |
Clears the current map and creates a new map with the given parameters. More... | |
bool | editorLoad (const std::string &filename) |
Loads the map contents from the given file. More... | |
bool | editorSave () |
Saves the map to the file it was loaded from or created with. More... | |
const char * | undoDescription () const |
Returns the description of what action will be undone if undo is called. More... | |
void | undo () |
Undoes the previous action in the edit history. More... | |
const char * | redoDescription () const |
Returns the description of what action will be redone if redo is called. More... | |
void | redo () |
Reapplies the next action in the edit history. More... | |
void | setControlsEnabled (bool enabled) |
Enables or disables the map camera and click controls. More... | |
void | setLevelVisible (unsigned int level, bool visible) |
Shows or hides the given level. More... | |
void | setLayerVisible (unsigned int level, unsigned int layer, bool visible) |
Shows or hides the given layer. More... | |
void | setRenderOverlay (RenderOverlay overlay, unsigned int level) |
Sets which overlay gets rendered on top of the map. More... | |
void | showGrid (bool show) |
Set whether or not to render a grid between tiles. More... | |
void | showSelection (const sf::IntRect &selection) |
Sets the tile selection to render. Set width or height to 0 to hide. Set width or height to negative values to show a single tile in blue (partial selection) More... | |
void | removeAllTiles (core::map::Tile::IdType id, bool isAnim) |
Removes all tiles that reference the given id in the tileset. This should be called before removing a tile from the tileset. More... | |
void | resize (unsigned int width, unsigned int height, bool modLeft, bool modTop) |
void | setName (const std::string &name) |
Set the name of the map. More... | |
void | setPlaylist (const std::string &playlist) |
Sets the playlist of the map. More... | |
void | setWeather (core::map::Weather::Type weather) |
Set the weather in the map. More... | |
void | setOnEnterScript (const std::string &script) |
Set the OnEnter script. More... | |
const std::string & | getOnEnterScript () const |
Get the OnEnter script. More... | |
void | setOnExitScript (const std::string &script) |
Set the OnExit script. More... | |
const std::string & | getOnExitScript () const |
Get the OnExit script. More... | |
void | setAmbientLight (std::uint8_t lower, std::uint8_t upper, bool sunlight) |
Set the maps default ambient light settings. More... | |
void | appendLevel () |
Creates a new level. More... | |
void | shiftLevel (unsigned int level, bool up) |
Shifts the given level up or down. More... | |
void | removeLevel (unsigned int level) |
Removes the given level. More... | |
void | appendBottomLayer (unsigned int level) |
Creates a new (empty) bottom layer. More... | |
void | appendYsortLayer (unsigned int level) |
Creates a new (empty) y-sort layer. More... | |
void | appendTopLayer (unsigned int level) |
Creates a new (empty) top layer. More... | |
void | shiftLayer (unsigned int level, unsigned int layer, bool up) |
Shifts a layer up or down in the render order. This will also move layers between bottom, y-sort, and top buckets. More... | |
void | removeLayer (unsigned int level, unsigned int layer) |
Deletes the given layer. More... | |
void | setTile (unsigned int level, unsigned int layer, const sf::Vector2i &position, core::map::Tile::IdType id, bool isAnim) |
Sets a single tile. More... | |
void | setTileArea (unsigned int level, unsigned int layer, const sf::IntRect &area, core::map::Tile::IdType id, bool isAnim) |
Sets a range of tiles to a given value. Tries to avoid overcrowding for large tiles. More... | |
void | fillTile (unsigned int level, unsigned int layer, const sf::Vector2i &position, core::map::Tile::IdType id, bool isAnim) |
Performs a bucket fill of tiles starting from the given position. More... | |
void | setCollision (unsigned int level, const sf::Vector2i &position, core::map::Collision id) |
Sets a single collision tile. More... | |
void | setCollisionArea (unsigned int level, const sf::IntRect &area, core::map::Collision id) |
Sets a range of collision tiles to a single value. More... | |
void | fillCollision (unsigned int level, const sf::Vector2i &position, core::map::Collision id) |
Performs a bucket fill of collisions from the given starting position. More... | |
void | setCatch (unsigned int level, const sf::Vector2i &position, std::uint8_t id) |
Sets a single catch tile. More... | |
void | setCatchArea (unsigned int level, const sf::IntRect &area, std::uint8_t id) |
Sets a range of catch tiles to a single value. More... | |
void | fillCatch (unsigned int level, const sf::Vector2i &position, std::uint8_t id) |
Performs a bucket fill of catch tiles from the given position. More... | |
bool | spawnIdUnused (unsigned int id) const |
Tells whether or not the given id is in use. More... | |
void | addSpawn (unsigned int level, const sf::Vector2i &tile, unsigned int id, bl::tmap::Direction dir) |
Adds a new player spawn to the map. More... | |
void | rotateSpawn (unsigned int level, const sf::Vector2i &tile) |
Rotates a player spawn. More... | |
void | removeSpawn (unsigned int level, const sf::Vector2i &position) |
Removes the spawn at the given position. More... | |
void | addNpcSpawn (const core::map::CharacterSpawn &spawn) |
Adds a character spawn to the map. More... | |
const core::map::CharacterSpawn * | getNpcSpawn (unsigned int level, const sf::Vector2i &position) const |
Get the Npc Spawn at the given position, if any. More... | |
void | editNpcSpawn (const core::map::CharacterSpawn *orig, const core::map::CharacterSpawn &spawn) |
Edits an existing character spawn. More... | |
void | removeNpcSpawn (const core::map::CharacterSpawn *spawn) |
Removes a character spawn. More... | |
std::pair< core::item::Id, bool > | getItem (unsigned int level, const sf::Vector2i &position) |
Returns spawn info the item at the given position, if any. More... | |
void | addOrEditItem (unsigned int level, const sf::Vector2i &position, core::item::Id item, bool visible) |
Spawns or modifies an item at the given position and level. More... | |
void | removeItem (unsigned int level, const sf::Vector2i &position) |
Removes the item from the given position if one is present. More... | |
void | setLight (const sf::Vector2i &positionPixels, unsigned int radius) |
Spawn or modify the light near the given position to the new size. More... | |
void | removeLight (const sf::Vector2i &positionPixels) |
Removes the light near the given position if one is there. More... | |
void | createEvent (const core::map::Event &event) |
Creates a new map event. More... | |
const core::map::Event * | getEvent (const sf::Vector2i &position) |
Returns a pointer to an event that overlaps the given position. More... | |
void | editEvent (const core::map::Event *orig, const core::map::Event &event) |
Alters the value of the given event. More... | |
void | removeEvent (const core::map::Event *event) |
Deletes the given event. More... | |
void | addCatchRegion () |
Adds a new catch region to the map. More... | |
const std::vector< core::map::CatchRegion > & | catchRegions () const |
Returns a reference to all catch regions. More... | |
void | editCatchRegion (std::uint8_t index, const core::map::CatchRegion &zone) |
Modifies the catch region at the given index. More... | |
void | removeCatchRegion (std::uint8_t index) |
Removes the catch region at the given index. More... | |
void | addTown () |
Adds a town. More... | |
void | editTown (std::uint8_t i, const core::map::Town &town) |
Modifies an existing town. More... | |
void | removeTown (std::uint8_t i) |
Removes a town. More... | |
void | setTownTile (const sf::Vector2i &position, std::uint8_t id) |
Sets the town tile at the given position. More... | |
void | setTownTileArea (const sf::IntRect &area, std::uint8_t id) |
Sets a region of town tiles to the given town. More... | |
void | fillTownTiles (const sf::Vector2i &position, std::uint8_t id) |
Performs a bucket fill of town tiles from the given position. More... | |
void | setLevelTile (const sf::Vector2i &position, core::map::LevelTransition lt) |
Sets the given level tile. More... | |
void | setLevelTileArea (const sf::IntRect &area, core::map::LevelTransition lt) |
Sets a selection of level tiles. More... | |
void | staticRender (const RenderMapWindow ¶ms) |
Renders the map contents. More... | |
bool | loadDev (std::istream &input) |
Loads the map from the given file. Will try to determine if the extension or path need to be added in order to support how map names used to be entered. Loads the json format. More... | |
bool | loadProd (bl::serial::binary::InputStream &input) |
Loads the map from the given file. Will try to determine if the extension or path need to be added in order to support how map names used to be entered. Loads the binary format. More... | |
bool | save (const std::string &file) |
Saves the map to the given file. The path should be relative to the maps directory and include the .map extension. More... | |
bool | saveBundle (bl::serial::binary::OutputStream &output, bl::resource::bundle::FileHandlerContext &ctx) const |
Saves the data from this object to the given bundle and registers dependency files. More... | |
bool | enter (system::Systems &systems, std::uint16_t spawnId, const std::string &prevMap, const bl::tmap::Position &prevPlayerPos) |
Initializes runtime data structures and spawns entities into the game. Also runs the on-load script. More... | |
void | exit (system::Systems &systems, const std::string &newMap) |
Removes spawned entities and runs the on-unload script. More... | |
void | setupCamera (system::Systems &systems) |
Configures the game camera for the player in the map. More... | |
const std::string & | name () const |
Returns the name of the map. More... | |
Weather & | weatherSystem () |
Returns a reference to the weather system in this map. More... | |
LightingSystem & | lightingSystem () |
Returns a reference to the lighting system in this map. More... | |
const sf::Vector2i & | sizeTiles () const |
Returns the size of the map in tiles. More... | |
sf::Vector2f | sizePixels () const |
Returns the size of the map in pixels. More... | |
std::uint8_t | levelCount () const |
Returns the number of levels in the map. More... | |
bool | contains (const bl::tmap::Position &position) const |
Returns whether or not the map contains the given position. More... | |
bl::tmap::Position | adjacentTile (const bl::tmap::Position &pos, bl::tmap::Direction dir) const |
Returns the adjacent position to the given position when moving in the given direction. Does not take into account collisions. More... | |
bool | movePossible (const bl::tmap::Position &position, bl::tmap::Direction dir) const |
Returns whether or not a particular movement is possible. Does not take into account entities blocking the way. More... | |
bool | isLedgeHop (const bl::tmap::Position &position, bl::tmap::Direction dir) const |
Test whether the given movement will be a ledge hop or not. More... | |
virtual void | observe (const event::EntityMoved &moveEvent) override |
Event listener for moving entities. Used to trigger map events. More... | |
bool | interact (bl::ecs::Entity interactor, const bl::tmap::Position &interactPos) |
Lets entities interact with the map itself. This is called by the Interaction system. More... | |
const CatchRegion * | getCatchRegion (const bl::tmap::Position &position) const |
Returns the catch region at the given position if the position is on a catch tile. More... | |
bool | canFlyFromHere () const |
Returns whether or not the player can fly from this map. More... | |
const bl::tmap::Position * | getSpawnPosition (unsigned int spawnId) const |
Returns the position of the given player spawn, or nullptr if not found. More... | |
const std::string & | getLocationName (const bl::tmap::Position &pos) const |
Returns the name of the town or route at the given position. More... | |
float | getDepthForPosition (unsigned int level, unsigned int y, int layer=-1) const |
Computes the depth to use at the given y position, taking into account the map size, layer count, and layer types. More... | |
float | getMinDepth () const |
Returns the maximum depth possible for this map. Maximum is always 0.f. Minimum is negative, so 'higher' positions will have lower depths than deeper positions. More... | |
bl::rc::SceneRef | getScene () |
Returns the scene for this map. More... | |
bl::rc::lgt::Scene2DLighting & | getSceneLighting () |
Returns the scene lighting for this map. Only valid after enter() is called. More... | |
void | setupEntityPosition (bl::ecs::Entity entity) |
Performs the final setup of the position components for the given entity. Must already have a bl::tmap::Position and bl::com::Transform2D component. More... | |
Static Public Member Functions | |
static Ptr | create (const PositionCb &clickCb, const PositionCb &moveCb, const ActionCb &actionCb, const ActionCb &syncCb, core::system::Systems &systems) |
Creates a new EditMap. More... | |
static std::string | getMapFile (const std::string &partialFile) |
Returns the full path to the map file from the given partial file. Accounts for missing extension. More... | |
static const std::vector< Town > & | FlyMapTowns () |
Returns the set of towns that can be flown to. More... | |
Protected Member Functions | |
void | clear () |
void | finishLoad () |
void | triggerAnimation (const bl::tmap::Position &position) |
Town * | getTown (const glm::i32vec2 &pos) |
void | enterTown (Town *town) |
void | prepareRender () |
void | cleanupRender () |
void | setupLevel (unsigned int level) |
void | setupLayer (unsigned int level, unsigned int layer) |
void | setupTile (unsigned int level, unsigned int layer, const sf::Vector2u &pos) |
Static Protected Member Functions | |
static void | loadFlymapTowns () |
Protected Attributes | |
std::string | nameField |
std::string | loadScriptField |
std::string | unloadScriptField |
std::string | playlistField |
Weather::Type | weatherField |
std::vector< LayerSet > | levels |
std::string | tilesetField |
std::unordered_map< std::uint16_t, Spawn > | spawns |
std::vector< CharacterSpawn > | characterField |
std::vector< Item > | itemsField |
std::vector< Event > | eventsField |
LightingSystem | lighting |
std::vector< CatchRegion > | catchRegionsField |
bl::ctr::Vector2D< LevelTransition > | transitionField |
std::vector< Town > | towns |
bl::ctr::Vector2D< std::uint8_t > | townTiles |
system::Systems * | systems |
Town | defaultTown |
Town * | currentTown |
sf::Vector2i | size |
bl::resource::Ref< Tileset > | tileset |
Weather | weather |
std::unique_ptr< bl::script::Script > | onEnterScript |
std::unique_ptr< bl::script::Script > | onExitScript |
bl::ctr::Grid< const Event * > | eventRegions |
bool | isWorldMap |
bl::audio::AudioSystem::Handle | playlistHandle |
bool | activated |
bl::rc::SceneRef | scene |
std::list< RenderLevel > | renderLevels |
Static Protected Attributes | |
static std::vector< Town > | flymapTowns |
Friends | |
class | page::Map |
class | page::Towns |
class | rdr::EditMapComponent |
Wrapper over the core::Map class that is directly usable in a bl::gui::GUI.
Definition at line 26 of file EditMap.hpp.
using editor::component::EditMap::ActionCb = std::function<void()> |
Called on various event types.
Definition at line 37 of file EditMap.hpp.
using editor::component::EditMap::PositionCb = std::function<void(const sf::Vector2f& pixels, const sf::Vector2i& tiles)> |
Called when the map is clicked.
Definition at line 34 of file EditMap.hpp.
typedef std::shared_ptr<EditMap> editor::component::EditMap::Ptr |
Pointer to an EditMap.
Definition at line 31 of file EditMap.hpp.
|
strong |
Optional render overlays depending on editor state.
Definition at line 42 of file EditMap.hpp.
|
virtual |
Destroy the Edit Map object.
Definition at line 119 of file EditMap.cpp.
void editor::component::EditMap::addCatchRegion | ( | ) |
Adds a new catch region to the map.
Definition at line 849 of file EditMap.cpp.
void editor::component::EditMap::addNpcSpawn | ( | const core::map::CharacterSpawn & | spawn | ) |
Adds a character spawn to the map.
spawn | The spawn to add |
Definition at line 665 of file EditMap.cpp.
void editor::component::EditMap::addOrEditItem | ( | unsigned int | level, |
const sf::Vector2i & | position, | ||
core::item::Id | item, | ||
bool | visible | ||
) |
Spawns or modifies an item at the given position and level.
level | The level for the item to be on |
position | The position to spawn at |
item | The item to spawn |
visible | True if the item should be visible, false for hidden |
Definition at line 798 of file EditMap.cpp.
void editor::component::EditMap::addSpawn | ( | unsigned int | level, |
const sf::Vector2i & | tile, | ||
unsigned int | id, | ||
bl::tmap::Direction | dir | ||
) |
Adds a new player spawn to the map.
level | The level to place the spawn on |
tile | The position the spawn is at |
id | The id of the spawn |
dir | The direction of the spawn |
Definition at line 638 of file EditMap.cpp.
void editor::component::EditMap::addTown | ( | ) |
Adds a town.
Definition at line 867 of file EditMap.cpp.
|
inherited |
Returns the adjacent position to the given position when moving in the given direction. Does not take into account collisions.
pos | The position that is being moved from |
dir | The direction that the movement is going |
void editor::component::EditMap::appendBottomLayer | ( | unsigned int | level | ) |
Creates a new (empty) bottom layer.
level | The level to create the layer on |
Definition at line 598 of file EditMap.cpp.
void editor::component::EditMap::appendLevel | ( | ) |
Creates a new level.
Definition at line 622 of file EditMap.cpp.
void editor::component::EditMap::appendTopLayer | ( | unsigned int | level | ) |
Creates a new (empty) top layer.
level | The level to create the layer on |
Definition at line 606 of file EditMap.cpp.
void editor::component::EditMap::appendYsortLayer | ( | unsigned int | level | ) |
Creates a new (empty) y-sort layer.
level | The level to create the layer on |
Definition at line 602 of file EditMap.cpp.
|
inherited |
const std::vector< core::map::CatchRegion > & editor::component::EditMap::catchRegions | ( | ) | const |
Returns a reference to all catch regions.
Definition at line 851 of file EditMap.cpp.
|
inherited |
|
static |
Creates a new EditMap.
clickCb | Called when the map is clicked |
moveCb | Called when the mouse is moved over a tile |
actionCb | Called when editor actions are performed |
syncCb | Called when map data has changed and the GUI should update |
systems | The primary systems object |
Definition at line 55 of file EditMap.cpp.
void editor::component::EditMap::createEvent | ( | const core::map::Event & | event | ) |
Creates a new map event.
event | The event to create |
Definition at line 774 of file EditMap.cpp.
const std::string & editor::component::EditMap::currentFile | ( | ) | const |
Returns the current file the map is saving to.
Definition at line 143 of file EditMap.cpp.
void editor::component::EditMap::editCatchRegion | ( | std::uint8_t | index, |
const core::map::CatchRegion & | zone | ||
) |
Modifies the catch region at the given index.
index | The index to modify |
zone | The new value |
Definition at line 855 of file EditMap.cpp.
void editor::component::EditMap::editEvent | ( | const core::map::Event * | orig, |
const core::map::Event & | event | ||
) |
Alters the value of the given event.
orig | Pointer to the event to update |
event | New value to set |
Definition at line 786 of file EditMap.cpp.
void editor::component::EditMap::editNpcSpawn | ( | const core::map::CharacterSpawn * | orig, |
const core::map::CharacterSpawn & | spawn | ||
) |
Edits an existing character spawn.
orig | The address of the existing spawn |
spawn | The new spawn value |
Definition at line 680 of file EditMap.cpp.
bool editor::component::EditMap::editorLoad | ( | const std::string & | filename | ) |
Loads the map contents from the given file.
filename | The map file to load from |
Definition at line 126 of file EditMap.cpp.
bool editor::component::EditMap::editorSave | ( | ) |
Saves the map to the file it was loaded from or created with.
Definition at line 135 of file EditMap.cpp.
void editor::component::EditMap::editTown | ( | std::uint8_t | i, |
const core::map::Town & | town | ||
) |
Modifies an existing town.
i | Index of the town to modify |
town | The new town value |
Definition at line 869 of file EditMap.cpp.
|
inherited |
Initializes runtime data structures and spawns entities into the game. Also runs the on-load script.
systems | The primary game systems |
spawnId | The spawn to place the player at |
prevMap | The name of the map coming from |
prevPlayerPos | Used to spawn the player when coming back from a map or loading save |
|
protectedinherited |
|
inherited |
void editor::component::EditMap::fillCatch | ( | unsigned int | level, |
const sf::Vector2i & | position, | ||
std::uint8_t | id | ||
) |
Performs a bucket fill of catch tiles from the given position.
level | The level to fill |
position | The position to fill from |
id | The id to fill with |
Definition at line 594 of file EditMap.cpp.
void editor::component::EditMap::fillCollision | ( | unsigned int | level, |
const sf::Vector2i & | position, | ||
core::map::Collision | id | ||
) |
Performs a bucket fill of collisions from the given starting position.
level | The level to fill on |
position | The position to fill from |
id | The collision to fill with |
Definition at line 582 of file EditMap.cpp.
void editor::component::EditMap::fillTile | ( | unsigned int | level, |
unsigned int | layer, | ||
const sf::Vector2i & | position, | ||
core::map::Tile::IdType | id, | ||
bool | isAnim | ||
) |
Performs a bucket fill of tiles starting from the given position.
level | The level to fill on |
layer | The layer to fill on |
position | The position to fill from |
id | The tile to fill with |
isAnim | True to fill with animations, false with sprites |
Definition at line 568 of file EditMap.cpp.
void editor::component::EditMap::fillTownTiles | ( | const sf::Vector2i & | position, |
std::uint8_t | id | ||
) |
Performs a bucket fill of town tiles from the given position.
position | The position to fill from |
id | The town to fill with |
Definition at line 883 of file EditMap.cpp.
|
staticinherited |
|
inherited |
|
inherited |
Computes the depth to use at the given y position, taking into account the map size, layer count, and layer types.
level | The level of the position to compute the depth for |
y | The y coordinate of the position to compute the depth for |
layer | The index of the layer to compute the depth for. -1 is for entities |
const core::map::Event * editor::component::EditMap::getEvent | ( | const sf::Vector2i & | position | ) |
Returns a pointer to an event that overlaps the given position.
position | The position to search |
Definition at line 778 of file EditMap.cpp.
std::pair< core::item::Id, bool > editor::component::EditMap::getItem | ( | unsigned int | level, |
const sf::Vector2i & | position | ||
) |
Returns spawn info the item at the given position, if any.
level | The level to search |
position | The position to check |
Definition at line 815 of file EditMap.cpp.
|
inherited |
|
staticinherited |
|
inherited |
const core::map::CharacterSpawn * editor::component::EditMap::getNpcSpawn | ( | unsigned int | level, |
const sf::Vector2i & | position | ||
) | const |
Get the Npc Spawn at the given position, if any.
The | level the spawn is on |
position | The position to get the spawn at |
Definition at line 669 of file EditMap.cpp.
const std::string & editor::component::EditMap::getOnEnterScript | ( | ) | const |
Get the OnEnter script.
Definition at line 628 of file EditMap.cpp.
const std::string & editor::component::EditMap::getOnExitScript | ( | ) | const |
Get the OnExit script.
Definition at line 634 of file EditMap.cpp.
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
protectedinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Loads the map from the given file. Will try to determine if the extension or path need to be added in order to support how map names used to be entered. Loads the json format.
input | Stream to load the map from |
|
staticprotectedinherited |
|
inherited |
Loads the map from the given file. Will try to determine if the extension or path need to be added in order to support how map names used to be entered. Loads the binary format.
input | Stream to load the map from |
|
inherited |
|
inherited |
void editor::component::EditMap::newMap | ( | const std::string & | filename, |
const std::string & | name, | ||
const std::string & | tileset, | ||
unsigned int | width, | ||
unsigned int | height | ||
) |
Clears the current map and creates a new map with the given parameters.
filename | The file to save the map into |
name | The name of the map |
tileset | The tileset to use |
width | The width of the map in tiles |
height | The height of the map in tiles |
Definition at line 145 of file EditMap.cpp.
|
overridevirtualinherited |
void editor::component::EditMap::redo | ( | ) |
Reapplies the next action in the edit history.
Definition at line 524 of file EditMap.cpp.
const char * editor::component::EditMap::redoDescription | ( | ) | const |
Returns the description of what action will be redone if redo is called.
Definition at line 532 of file EditMap.cpp.
void editor::component::EditMap::removeAllTiles | ( | core::map::Tile::IdType | id, |
bool | isAnim | ||
) |
Removes all tiles that reference the given id in the tileset. This should be called before removing a tile from the tileset.
id | The id of the tile in the tileset |
isAnim | True for an animation, false for a regular tile |
Definition at line 392 of file EditMap.cpp.
void editor::component::EditMap::removeCatchRegion | ( | std::uint8_t | index | ) |
Removes the catch region at the given index.
index | The catch region to remove |
Definition at line 859 of file EditMap.cpp.
void editor::component::EditMap::removeEvent | ( | const core::map::Event * | event | ) |
Deletes the given event.
event | Pointer to the event to delete |
Definition at line 792 of file EditMap.cpp.
void editor::component::EditMap::removeItem | ( | unsigned int | level, |
const sf::Vector2i & | position | ||
) |
Removes the item from the given position if one is present.
level | The level to search |
position | The position to clear |
Definition at line 824 of file EditMap.cpp.
void editor::component::EditMap::removeLayer | ( | unsigned int | level, |
unsigned int | layer | ||
) |
Deletes the given layer.
level | The level the layer is on |
layer | Index of the layer to remove |
Definition at line 610 of file EditMap.cpp.
void editor::component::EditMap::removeLevel | ( | unsigned int | level | ) |
Removes the given level.
level | The level to remove |
void editor::component::EditMap::removeLight | ( | const sf::Vector2i & | positionPixels | ) |
Removes the light near the given position if one is there.
positionPixels | The position of the light to remove, in pixels |
Definition at line 842 of file EditMap.cpp.
void editor::component::EditMap::removeNpcSpawn | ( | const core::map::CharacterSpawn * | spawn | ) |
Removes a character spawn.
spawn | The address of the spawn to remove |
Definition at line 692 of file EditMap.cpp.
void editor::component::EditMap::removeSpawn | ( | unsigned int | level, |
const sf::Vector2i & | position | ||
) |
Removes the spawn at the given position.
level | The level the spawn is on |
position | The position the spawn is at |
Definition at line 654 of file EditMap.cpp.
void editor::component::EditMap::removeTown | ( | std::uint8_t | i | ) |
void editor::component::EditMap::resize | ( | unsigned int | width, |
unsigned int | height, | ||
bool | modLeft, | ||
bool | modTop | ||
) |
void editor::component::EditMap::rotateSpawn | ( | unsigned int | level, |
const sf::Vector2i & | tile | ||
) |
Rotates a player spawn.
level | The level the spawn is on |
tile | The position the spawn is at |
Definition at line 643 of file EditMap.cpp.
|
inherited |
|
inherited |
void editor::component::EditMap::setAmbientLight | ( | std::uint8_t | lower, |
std::uint8_t | upper, | ||
bool | sunlight | ||
) |
Set the maps default ambient light settings.
lower | The lower light level at night |
upper | The upper light level during the day (or always if no sunlight) |
sunlight | True to adjust between lower and upper for time of day, false for upper only |
Definition at line 863 of file EditMap.cpp.
void editor::component::EditMap::setCatch | ( | unsigned int | level, |
const sf::Vector2i & | position, | ||
std::uint8_t | id | ||
) |
Sets a single catch tile.
level | The level to modify |
position | The position of the catch to set |
id | The new catch value |
Definition at line 586 of file EditMap.cpp.
void editor::component::EditMap::setCatchArea | ( | unsigned int | level, |
const sf::IntRect & | area, | ||
std::uint8_t | id | ||
) |
Sets a range of catch tiles to a single value.
level | The level to modify |
area | The region to set |
id | The value to set all tiles to |
Definition at line 590 of file EditMap.cpp.
void editor::component::EditMap::setCollision | ( | unsigned int | level, |
const sf::Vector2i & | position, | ||
core::map::Collision | id | ||
) |
Sets a single collision tile.
level | The level to modify |
position | The position of the collision to set |
id | The new collision value |
Definition at line 573 of file EditMap.cpp.
void editor::component::EditMap::setCollisionArea | ( | unsigned int | level, |
const sf::IntRect & | area, | ||
core::map::Collision | id | ||
) |
Sets a range of collision tiles to a single value.
level | The level to modify |
area | The region to set |
id | The value to set all tiles to |
Definition at line 577 of file EditMap.cpp.
void editor::component::EditMap::setControlsEnabled | ( | bool | enabled | ) |
Enables or disables the map camera and click controls.
Definition at line 292 of file EditMap.cpp.
void editor::component::EditMap::setLayerVisible | ( | unsigned int | level, |
unsigned int | layer, | ||
bool | visible | ||
) |
Shows or hides the given layer.
level | The level the layer is on |
layer | The index of the layer to show or hide |
visible | True to render, false to hide |
Definition at line 313 of file EditMap.cpp.
void editor::component::EditMap::setLevelTile | ( | const sf::Vector2i & | position, |
core::map::LevelTransition | lt | ||
) |
Sets the given level tile.
position | The position to set |
lt | The level transition to occur on that tile |
Definition at line 887 of file EditMap.cpp.
void editor::component::EditMap::setLevelTileArea | ( | const sf::IntRect & | area, |
core::map::LevelTransition | lt | ||
) |
Sets a selection of level tiles.
area | The region to update |
lt | The level transition to populate the region with |
Definition at line 891 of file EditMap.cpp.
void editor::component::EditMap::setLevelVisible | ( | unsigned int | level, |
bool | visible | ||
) |
Shows or hides the given level.
level | The level to show or hide |
visible | True to render, false to hide |
Definition at line 297 of file EditMap.cpp.
void editor::component::EditMap::setLight | ( | const sf::Vector2i & | positionPixels, |
unsigned int | radius | ||
) |
Spawn or modify the light near the given position to the new size.
positionPixels | The light radius in pixels |
radius | The position of the light in pixels |
Definition at line 835 of file EditMap.cpp.
void editor::component::EditMap::setName | ( | const std::string & | name | ) |
Set the name of the map.
name | The new name of the map |
Definition at line 548 of file EditMap.cpp.
void editor::component::EditMap::setOnEnterScript | ( | const std::string & | script | ) |
Set the OnEnter script.
script | The script to run when the map is entered |
Definition at line 624 of file EditMap.cpp.
void editor::component::EditMap::setOnExitScript | ( | const std::string & | script | ) |
Set the OnExit script.
script | The script to run when the map is left |
Definition at line 630 of file EditMap.cpp.
void editor::component::EditMap::setPlaylist | ( | const std::string & | playlist | ) |
Sets the playlist of the map.
playlist | Path to the playlist to set |
Definition at line 550 of file EditMap.cpp.
void editor::component::EditMap::setRenderOverlay | ( | RenderOverlay | overlay, |
unsigned int | level | ||
) |
Sets which overlay gets rendered on top of the map.
overlay | The overlay to render |
level | Which level to source the overlay from |
Definition at line 337 of file EditMap.cpp.
void editor::component::EditMap::setTile | ( | unsigned int | level, |
unsigned int | layer, | ||
const sf::Vector2i & | position, | ||
core::map::Tile::IdType | id, | ||
bool | isAnim | ||
) |
Sets a single tile.
level | The level to modify |
layer | The layer to modify |
position | The position of the tile to modify |
id | The new tile id |
isAnim | True for animation, false for texture |
Definition at line 558 of file EditMap.cpp.
void editor::component::EditMap::setTileArea | ( | unsigned int | level, |
unsigned int | layer, | ||
const sf::IntRect & | area, | ||
core::map::Tile::IdType | id, | ||
bool | isAnim | ||
) |
Sets a range of tiles to a given value. Tries to avoid overcrowding for large tiles.
level | The level to modify |
layer | The layer to modify |
area | Region of tiles to set |
id | New tile id |
isAnim | True for animation, false for texture |
Definition at line 563 of file EditMap.cpp.
void editor::component::EditMap::setTownTile | ( | const sf::Vector2i & | position, |
std::uint8_t | id | ||
) |
Sets the town tile at the given position.
position | The position of the tile to set |
id | The id of the town to set to |
Definition at line 875 of file EditMap.cpp.
void editor::component::EditMap::setTownTileArea | ( | const sf::IntRect & | area, |
std::uint8_t | id | ||
) |
Sets a region of town tiles to the given town.
area | The region to fill |
id | The town to fill with |
Definition at line 879 of file EditMap.cpp.
|
inherited |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
void editor::component::EditMap::setWeather | ( | core::map::Weather::Type | weather | ) |
Set the weather in the map.
weather | The weather to do |
Definition at line 554 of file EditMap.cpp.
void editor::component::EditMap::shiftLayer | ( | unsigned int | level, |
unsigned int | layer, | ||
bool | up | ||
) |
Shifts a layer up or down in the render order. This will also move layers between bottom, y-sort, and top buckets.
level | The level the layer is on |
layer | The layer to shift |
up | True to move up (render earlier), false to move down (render later) |
Definition at line 614 of file EditMap.cpp.
void editor::component::EditMap::shiftLevel | ( | unsigned int | level, |
bool | up | ||
) |
Shifts the given level up or down.
level | The level to move |
up | True for up, false for down |
Definition at line 618 of file EditMap.cpp.
void editor::component::EditMap::showGrid | ( | bool | show | ) |
Set whether or not to render a grid between tiles.
Definition at line 374 of file EditMap.cpp.
void editor::component::EditMap::showSelection | ( | const sf::IntRect & | selection | ) |
Sets the tile selection to render. Set width or height to 0 to hide. Set width or height to negative values to show a single tile in blue (partial selection)
selection | The selection to render, in tiles |
Definition at line 376 of file EditMap.cpp.
|
inherited |
|
inherited |
bool editor::component::EditMap::spawnIdUnused | ( | unsigned int | id | ) | const |
Tells whether or not the given id is in use.
id | The id to check |
Definition at line 636 of file EditMap.cpp.
void editor::component::EditMap::staticRender | ( | const RenderMapWindow & | params | ) |
Renders the map contents.
params | Parameters for the rendering |
Definition at line 705 of file EditMap.cpp.
|
protectedinherited |
void editor::component::EditMap::undo | ( | ) |
Undoes the previous action in the edit history.
Definition at line 511 of file EditMap.cpp.
const char * editor::component::EditMap::undoDescription | ( | ) | const |
Returns the description of what action will be undone if undo is called.
Definition at line 519 of file EditMap.cpp.
bool editor::component::EditMap::unsavedChanges | ( | ) | const |
Returns whether or not the map has been updated since last being saved.
Definition at line 221 of file EditMap.cpp.
|
inherited |
|
friend |
Definition at line 765 of file EditMap.hpp.
|
friend |
Definition at line 766 of file EditMap.hpp.
|
friend |
Definition at line 767 of file EditMap.hpp.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
staticprotectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |