diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-29 08:47:21 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-29 08:47:21 -0400 |
commit | bf3a781ab8ea7c00bf18c960bcb23e72da99bc7b (patch) | |
tree | 0adb4cff5da5a4a05356278eb0d5ae4d9b9c6858 /include | |
parent | 62df9319f06bb52da8878522117ebe85fc5226b5 (diff) |
re-added arenas
Diffstat (limited to 'include')
-rw-r--r-- | include/world.hpp | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/include/world.hpp b/include/world.hpp index 9566184..daf8ae4 100644 --- a/include/world.hpp +++ b/include/world.hpp @@ -53,6 +53,8 @@ typedef struct { unsigned char groundColor; } WorldData; +typedef std::pair<World *, vec2> WorldSwitchInfo; + /* ---------------------------------------------------------------------------- ** Variables section ** --------------------------------------------------------------------------*/ @@ -72,6 +74,9 @@ extern const float PLAYER_SPEED_CONSTANT; // maximum pull of gravity in one game tick extern const float GRAVITY_CONSTANT; +// height of the floor in an indoor world +extern const unsigned int INDOOR_FLOOR_HEIGHT; + /* ---------------------------------------------------------------------------- ** Classes / function prototypes section ** --------------------------------------------------------------------------*/ @@ -215,14 +220,14 @@ public: std::string getToRight(void) const; // attempts to enter the left/right adjacent world, returning either that world or this - std::pair<World *, vec2> goWorldLeft(Player *p); - std::pair<World *, vec2> goWorldRight(Player *p); + WorldSwitchInfo goWorldLeft(Player *p); + WorldSwitchInfo goWorldRight(Player *p); // attempts to move an NPC to the left adjacent world, returning true on success bool goWorldLeft(NPC *e); // attempts to enter a structure that the player would be standing in front of - std::pair<World *, float> goInsideStructure(Player *p); + WorldSwitchInfo goInsideStructure(Player *p); // adds a hole at the specified start and end x-coordinates void addHole(unsigned int start,unsigned int end); @@ -235,8 +240,6 @@ public: void addMerchant(float x, float y, bool housed); - //void addMob(int type, float x, float y); - //void addMob(int type, float x, float y, void (*hey)(Mob *)); void addMob(Mob *m, vec2 coord); void addNPC(float x, float y); @@ -300,41 +303,24 @@ public: * transported to a temporary world with the player, and the Mob will be * killed upon exiting the arena. */ - class Arena : public World { private: - /** - * The mob that the player is fighting. - */ - + // the mob that the player is fighting Mob *mmob; public: - /** - * Creates a world with the player and mob, returning the player to the - * world `leave` upon exit. - */ - + // creates the arena with the world being left for it Arena(World *leave, Player *p, Mob *m); - /** - * Frees resources taken by the arena. - */ - + // frees memory ~Arena(void); - /** - * Attempts to exit the world, returning the player to the world they were - * last in. - */ - - World *exitArena(Player *p); + // attempts to exit the arena, returning what world the player should be in + WorldSwitchInfo exitArena(Player *p); }; -bool isCurrentWorldIndoors(void); -float getIndoorWorldFloorHeight(void); std::string getWorldWeatherStr(WorldWeather ww); |