From f732cdaf7374fde737b503ec6966fb8cd8f4c32b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 17 Mar 2015 23:53:55 -0400 Subject: Map editor can now define actions to occur when the player goes off a specified edge of the map --- tools/mapedit/src/map.h | 72 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 19 deletions(-) (limited to 'tools/mapedit/src/map.h') diff --git a/tools/mapedit/src/map.h b/tools/mapedit/src/map.h index 34dcb33..46e5790 100644 --- a/tools/mapedit/src/map.h +++ b/tools/mapedit/src/map.h @@ -1,28 +1,17 @@ #ifndef MAP_H #define MAP_H -class Map; - #include #include #include #include -#include "object.h" #include -#include "world.h" #include +class MapObject; +class World; class MapeditFrame; -const int TILE_WIDTH = 8; -const int TILE_HEIGHT = 8; -const int GAME_WIDTH = 320; -const int GAME_HEIGHT = 200; -const int MAP_WIDTH = GAME_WIDTH/TILE_WIDTH; -const int MAP_HEIGHT = GAME_HEIGHT/TILE_HEIGHT - 1; -const int PLAYER_WIDTH[5] = {10, 0, 0, 0, 0}; -const int PLAYER_HEIGHT[5] = {12, 0, 0, 0, 0}; - class MapLoadException: public std::exception { public: @@ -75,29 +64,54 @@ class Map { Map& operator= (Map other); friend void swap(Map& first, Map& second); + enum class MoveType { + Wall, + Wrap, + Warp, + ReverseWarp + }; + + static std::list listMoveTypes(); + static std::string stringForMoveType(MoveType type); + static bool moveTypeTakesMap(MoveType type); + static std::string shortForMoveType(MoveType type); + static MoveType moveTypeForShort(std::string str); + int getID() const; std::string getTitle() const; int getTileAt(int x, int y) const; const std::list>& getObjects() const; - std::shared_ptr getLeftmap() const; - std::shared_ptr getRightmap() const; wxTreeItemId getTreeItemId() const; std::list> getChildren() const; bool getExpanded() const; World* getWorld() const; bool getHidden() const; + MoveType getLeftMoveType() const; + MoveType getRightMoveType() const; + MoveType getUpMoveType() const; + MoveType getDownMoveType() const; + int getLeftMoveMapID() const; + int getRightMoveMapID() const; + int getUpMoveMapID() const; + int getDownMoveMapID() const; void setTitle(std::string title, bool dirty = true); void setTileAt(int x, int y, int tile, bool dirty = true); void setMapdata(int* mapdata, bool dirty = true); void addObject(std::shared_ptr obj, bool dirty = true); void removeObject(std::shared_ptr obj, bool dirty = true); - void setLeftmap(int id, bool dirty = true); - void setRightmap(int id, bool dirty = true); void setTreeItemId(wxTreeItemId id); void addChild(int id); void setExpanded(bool exp); void setHidden(bool hid); + void setLeftMoveType(MoveType move, bool dirty = true); + void setRightMoveType(MoveType move, bool dirty = true); + void setUpMoveType(MoveType move, bool dirty = true); + void setDownMoveType(MoveType move, bool dirty = true); + void setLeftMoveMapID(int id, bool dirty = true); + void setRightMoveMapID(int id, bool dirty = true); + void setUpMoveMapID(int id, bool dirty = true); + void setDownMoveMapID(int id, bool dirty = true); private: int id; @@ -106,11 +120,31 @@ class Map { int* mapdata; std::string title {"Untitled Map"}; std::list children; - int leftmap = -1; - int rightmap = -1; wxTreeItemId treeItemId; bool expanded = false; bool hidden = false; + MoveType leftType = MoveType::Wall; + MoveType rightType = MoveType::Wall; + MoveType upType = MoveType::Wall; + MoveType downType = MoveType::Wall; + int leftMap = 0; + int rightMap = 0; + int upMap = 0; + int downMap = 0; +}; + +class MapPtrCtr : public wxTreeItemData { + public: + Map* map; + + MapPtrCtr(Map* map) : map(map) {} +}; + +class MoveTypeCtr { + public: + Map::MoveType type; + + MoveTypeCtr(Map::MoveType type) : type(type) {} }; #endif -- cgit 1.4.1