From ca4935cb65325edbd45d4a3aacc921ea9ed9483b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 20 Feb 2021 13:19:15 -0500 Subject: Added enclosure zones A sprite with an enclosure zone will collide with it if it attempts to leave the area defined by the zone. This is used to make sure that wandering sprites don't end up in weird places. --- src/map.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index c5ecc64..e4096f4 100644 --- a/src/map.h +++ b/src/map.h @@ -25,6 +25,7 @@ struct Prototype { std::string interactionScript; bool shadow = false; bool wander = false; + std::string enclosureZone; }; struct Trigger { @@ -34,6 +35,11 @@ struct Trigger { std::string script; }; +struct Zone { + vec2i ul; + vec2i dr; +}; + class Map { public: @@ -61,6 +67,8 @@ public: const std::vector& getTriggers() const { return triggers_; } + const Zone& getZone(const std::string& name) const { return zones_.at(name); } + private: std::string name_; @@ -72,6 +80,7 @@ private: std::vector prototypes_; std::map warpPoints_; std::vector triggers_; + std::map zones_; }; #endif /* end of include guard: MAP_H_D95D6D47 */ -- cgit 1.4.1