diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index e84234f..0f9032e 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -4047,6 +4047,15 @@ bool DSQ::isDeveloperKeys() return developerKeys; } +bool DSQ::canOpenEditor() const +{ +#ifdef AQUARIA_BUILD_SCENEEDITOR + return dsq->isDeveloperKeys() || (dsq->mod.isActive() && !dsq->mod.isEditorBlocked()); +#else + return false; +#endif +} + bool DSQ::isQuitFlag() { return watchQuitFlag; diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 74c63c3..8b241ae 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -162,14 +162,6 @@ enum AquariaActions ACTION_TOGGLEHELPSCREEN }; -enum EditorLock -{ - EDITORLOCK_NONE = 0, - EDITORLOCK_USER = 1 -}; - -const EditorLock editorLock = EDITORLOCK_USER; - typedef std::list EntityList; typedef std::vector EntityContainer; @@ -262,6 +254,7 @@ public: bool isActive(); bool isDebugMenu(); bool hasWorldMap(); + bool isEditorBlocked(); std::string getPath(); std::string getName(); @@ -272,6 +265,7 @@ protected: bool shuttingDown; bool active; bool hasMap; + bool blockEditor; int doRecache; int debugMenu; int enqueueModStart; @@ -1418,6 +1412,7 @@ public: void toggleCursor(bool v, float t = -1); bool isDeveloperKeys(); + bool canOpenEditor() const; void loadElementEffects(); ElementEffect getElementEffectByIndex(int e); diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 13b128a..78ef675 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -2538,7 +2538,7 @@ void Game::loadEntityTypeList() entityGroups.clear(); std::string fn = "scripts/entities/entitygroups.txt"; - if (editorLock == EDITORLOCK_USER && dsq->mod.isActive()) + if (dsq->mod.isActive()) { fn = dsq->mod.getPath() + "entitygroups.txt"; } @@ -6644,7 +6644,7 @@ void Game::applyState() #ifdef AQUARIA_BUILD_SCENEEDITOR - if (dsq->isDeveloperKeys() || dsq->mod.isActive()) + if (dsq->canOpenEditor()) { sceneEditor.init(); } @@ -7141,7 +7141,7 @@ void Game::bindInput() #ifdef AQUARIA_BUILD_SCENEEDITOR - if (dsq->isDeveloperKeys() || dsq->mod.isActive()) + if (dsq->canOpenEditor()) { //addAction(MakeFunctionEvent(Game, toggleSceneEditor), KEY_TAB, 0); addAction(ACTION_TOGGLESCENEEDITOR, KEY_TAB); @@ -7185,7 +7185,7 @@ void Game::bindInput() dsq->user.control.actionSet.importAction(this, "FoodRight", ACTION_FOODRIGHT); dsq->user.control.actionSet.importAction(this, "FoodDrop", ACTION_FOODDROP); - if (dsq->isDeveloperKeys() || dsq->mod.isActive()) + if (dsq->canOpenEditor()) { //addAction(MakeFunctionEvent(Game, toggleMiniMapRender), KEY_M, 0); addAction(ACTION_TOGGLEGRID, KEY_F9); diff --git a/Aquaria/Mod.cpp b/Aquaria/Mod.cpp index 6daf2f8..02271c7 100644 --- a/Aquaria/Mod.cpp +++ b/Aquaria/Mod.cpp @@ -59,6 +59,7 @@ void Mod::clear() doRecache = 0; debugMenu = false; hasMap = false; + blockEditor = false; } bool Mod::isDebugMenu() @@ -71,6 +72,11 @@ bool Mod::hasWorldMap() return hasMap; } +bool Mod::isEditorBlocked() +{ + return blockEditor; +} + void Mod::loadModXML(TiXmlDocument *d, std::string modName) { d->LoadFile(baseModPath + modName + ".xml"); @@ -124,6 +130,11 @@ void Mod::load(const std::string &p) props->Attribute("hasWorldMap", &t); hasMap = t; } + if (props->Attribute("blockEditor")) { + int t; + props->Attribute("blockEditor", &t); + blockEditor = t; + } } } diff --git a/Aquaria/WorldMapRender.cpp b/Aquaria/WorldMapRender.cpp index bc0d99a..b49f2e6 100644 --- a/Aquaria/WorldMapRender.cpp +++ b/Aquaria/WorldMapRender.cpp @@ -1127,7 +1127,7 @@ void WorldMapRender::onUpdate(float dt) else if (-internalOffset.y > yMax + 150/scale.x) internalOffset.y = -(yMax + 150/scale.x); - if (dsq->isDeveloperKeys() || dsq->mod.isActive()) + if (dsq->canOpenEditor()) { if (editorActive) { @@ -1533,7 +1533,7 @@ void WorldMapRender::action (int id, int state) } if (id == ACTION_TOGGLEWORLDMAPEDITOR && !state) { - if (dsq->isDeveloperKeys() || dsq->mod.isActive()) + if (dsq->canOpenEditor()) { editorActive = !editorActive;