summary refs log tree commit diff stats
path: root/src/map.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-20 13:19:15 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-20 13:19:15 -0500
commitca4935cb65325edbd45d4a3aacc921ea9ed9483b (patch)
tree28376ffac0f817fc3f1f7290745e91d603fd59e8 /src/map.h
parent996076cf151a27a7a8d278aa4d15b28cfb196c46 (diff)
downloadtanetane-ca4935cb65325edbd45d4a3aacc921ea9ed9483b.tar.gz
tanetane-ca4935cb65325edbd45d4a3aacc921ea9ed9483b.tar.bz2
tanetane-ca4935cb65325edbd45d4a3aacc921ea9ed9483b.zip
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.
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h9
1 files changed, 9 insertions, 0 deletions
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 {
25 std::string interactionScript; 25 std::string interactionScript;
26 bool shadow = false; 26 bool shadow = false;
27 bool wander = false; 27 bool wander = false;
28 std::string enclosureZone;
28}; 29};
29 30
30struct Trigger { 31struct Trigger {
@@ -34,6 +35,11 @@ struct Trigger {
34 std::string script; 35 std::string script;
35}; 36};
36 37
38struct Zone {
39 vec2i ul;
40 vec2i dr;
41};
42
37class Map { 43class Map {
38public: 44public:
39 45
@@ -61,6 +67,8 @@ public:
61 67
62 const std::vector<Trigger>& getTriggers() const { return triggers_; } 68 const std::vector<Trigger>& getTriggers() const { return triggers_; }
63 69
70 const Zone& getZone(const std::string& name) const { return zones_.at(name); }
71
64private: 72private:
65 73
66 std::string name_; 74 std::string name_;
@@ -72,6 +80,7 @@ private:
72 std::vector<Prototype> prototypes_; 80 std::vector<Prototype> prototypes_;
73 std::map<std::string, vec2i> warpPoints_; 81 std::map<std::string, vec2i> warpPoints_;
74 std::vector<Trigger> triggers_; 82 std::vector<Trigger> triggers_;
83 std::map<std::string, Zone> zones_;
75}; 84};
76 85
77#endif /* end of include guard: MAP_H_D95D6D47 */ 86#endif /* end of include guard: MAP_H_D95D6D47 */