summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp2
-rw-r--r--src/map.h3
-rw-r--r--src/menu_system.cpp15
3 files changed, 18 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp index a170288..c8bf18f 100644 --- a/src/map.cpp +++ b/src/map.cpp
@@ -179,6 +179,8 @@ Map::Map(std::string_view name) : name_(name) {
179 music_ = property.getStringValue(); 179 music_ = property.getStringValue();
180 } else if (property.getName() == "maskZone") { 180 } else if (property.getName() == "maskZone") {
181 maskZone_ = property.getStringValue(); 181 maskZone_ = property.getStringValue();
182 } else if (property.getName() == "exitArea") {
183 hasExitArea_ = property.getBoolValue();
182 } 184 }
183 } 185 }
184} 186}
diff --git a/src/map.h b/src/map.h index 7398d66..7300e76 100644 --- a/src/map.h +++ b/src/map.h
@@ -89,6 +89,8 @@ public:
89 89
90 const std::string& getMaskZone() const { return maskZone_; } 90 const std::string& getMaskZone() const { return maskZone_; }
91 91
92 bool hasExitArea() const { return hasExitArea_; }
93
92private: 94private:
93 95
94 std::string name_; 96 std::string name_;
@@ -104,6 +106,7 @@ private:
104 std::map<std::string, Zone> zones_; 106 std::map<std::string, Zone> zones_;
105 std::string music_; 107 std::string music_;
106 std::string maskZone_; 108 std::string maskZone_;
109 bool hasExitArea_ = false;
107}; 110};
108 111
109#endif /* end of include guard: MAP_H_D95D6D47 */ 112#endif /* end of include guard: MAP_H_D95D6D47 */
diff --git a/src/menu_system.cpp b/src/menu_system.cpp index 34616a6..468fa6e 100644 --- a/src/menu_system.cpp +++ b/src/menu_system.cpp
@@ -1,5 +1,6 @@
1#include "menu_system.h" 1#include "menu_system.h"
2#include "game.h" 2#include "game.h"
3#include "script_system.h"
3 4
4void MenuSystem::tick(double dt) { 5void MenuSystem::tick(double dt) {
5 pauseAnimation_.tick(dt); 6 pauseAnimation_.tick(dt);
@@ -38,7 +39,7 @@ void MenuSystem::openPauseMenu() {
38 39
39 game_.pauseGameplay(); 40 game_.pauseGameplay();
40 41
41 menu_ = CreateMenu({ 42 std::vector<MenuBuilder> builders = {
42 MenuBuilder().Command("Settings"), 43 MenuBuilder().Command("Settings"),
43 MenuBuilder().Command("Resume Game") 44 MenuBuilder().Command("Resume Game")
44 .ActivationFunction([] (Game& game) { 45 .ActivationFunction([] (Game& game) {
@@ -48,7 +49,17 @@ void MenuSystem::openPauseMenu() {
48 .ActivationFunction([] (Game& game) { 49 .ActivationFunction([] (Game& game) {
49 game.quit(); 50 game.quit();
50 }) 51 })
51 }); 52 };
53
54 if (game_.getMap().hasExitArea()) {
55 builders.push_back(MenuBuilder().Command("Exit Area")
56 .ActivationFunction([] (Game& game) {
57 game.getSystem<MenuSystem>().closePauseMenu();
58 game.getSystem<ScriptSystem>().runScript(game.getMap().getName(), "exit_area");
59 }));
60 }
61
62 menu_ = CreateMenu(builders);
52 63
53 cursor_ = 0; 64 cursor_ = 0;
54} 65}