mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-08 23:30:06 +00:00
Added a blockEditor="1" property to a mod xml.
This commit is contained in:
parent
3f0be8c79e
commit
ea780f2ac9
5 changed files with 29 additions and 14 deletions
|
@ -4047,6 +4047,15 @@ bool DSQ::isDeveloperKeys()
|
||||||
return developerKeys;
|
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()
|
bool DSQ::isQuitFlag()
|
||||||
{
|
{
|
||||||
return watchQuitFlag;
|
return watchQuitFlag;
|
||||||
|
|
|
@ -162,14 +162,6 @@ enum AquariaActions
|
||||||
ACTION_TOGGLEHELPSCREEN
|
ACTION_TOGGLEHELPSCREEN
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EditorLock
|
|
||||||
{
|
|
||||||
EDITORLOCK_NONE = 0,
|
|
||||||
EDITORLOCK_USER = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
const EditorLock editorLock = EDITORLOCK_USER;
|
|
||||||
|
|
||||||
typedef std::list<Entity*> EntityList;
|
typedef std::list<Entity*> EntityList;
|
||||||
typedef std::vector<Entity*> EntityContainer;
|
typedef std::vector<Entity*> EntityContainer;
|
||||||
|
|
||||||
|
@ -262,6 +254,7 @@ public:
|
||||||
bool isActive();
|
bool isActive();
|
||||||
bool isDebugMenu();
|
bool isDebugMenu();
|
||||||
bool hasWorldMap();
|
bool hasWorldMap();
|
||||||
|
bool isEditorBlocked();
|
||||||
|
|
||||||
std::string getPath();
|
std::string getPath();
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
@ -272,6 +265,7 @@ protected:
|
||||||
bool shuttingDown;
|
bool shuttingDown;
|
||||||
bool active;
|
bool active;
|
||||||
bool hasMap;
|
bool hasMap;
|
||||||
|
bool blockEditor;
|
||||||
int doRecache;
|
int doRecache;
|
||||||
int debugMenu;
|
int debugMenu;
|
||||||
int enqueueModStart;
|
int enqueueModStart;
|
||||||
|
@ -1418,6 +1412,7 @@ public:
|
||||||
void toggleCursor(bool v, float t = -1);
|
void toggleCursor(bool v, float t = -1);
|
||||||
|
|
||||||
bool isDeveloperKeys();
|
bool isDeveloperKeys();
|
||||||
|
bool canOpenEditor() const;
|
||||||
|
|
||||||
void loadElementEffects();
|
void loadElementEffects();
|
||||||
ElementEffect getElementEffectByIndex(int e);
|
ElementEffect getElementEffectByIndex(int e);
|
||||||
|
|
|
@ -2538,7 +2538,7 @@ void Game::loadEntityTypeList()
|
||||||
entityGroups.clear();
|
entityGroups.clear();
|
||||||
|
|
||||||
std::string fn = "scripts/entities/entitygroups.txt";
|
std::string fn = "scripts/entities/entitygroups.txt";
|
||||||
if (editorLock == EDITORLOCK_USER && dsq->mod.isActive())
|
if (dsq->mod.isActive())
|
||||||
{
|
{
|
||||||
fn = dsq->mod.getPath() + "entitygroups.txt";
|
fn = dsq->mod.getPath() + "entitygroups.txt";
|
||||||
}
|
}
|
||||||
|
@ -6644,7 +6644,7 @@ void Game::applyState()
|
||||||
|
|
||||||
|
|
||||||
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
||||||
if (dsq->isDeveloperKeys() || dsq->mod.isActive())
|
if (dsq->canOpenEditor())
|
||||||
{
|
{
|
||||||
sceneEditor.init();
|
sceneEditor.init();
|
||||||
}
|
}
|
||||||
|
@ -7141,7 +7141,7 @@ void Game::bindInput()
|
||||||
|
|
||||||
|
|
||||||
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
||||||
if (dsq->isDeveloperKeys() || dsq->mod.isActive())
|
if (dsq->canOpenEditor())
|
||||||
{
|
{
|
||||||
//addAction(MakeFunctionEvent(Game, toggleSceneEditor), KEY_TAB, 0);
|
//addAction(MakeFunctionEvent(Game, toggleSceneEditor), KEY_TAB, 0);
|
||||||
addAction(ACTION_TOGGLESCENEEDITOR, KEY_TAB);
|
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, "FoodRight", ACTION_FOODRIGHT);
|
||||||
dsq->user.control.actionSet.importAction(this, "FoodDrop", ACTION_FOODDROP);
|
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(MakeFunctionEvent(Game, toggleMiniMapRender), KEY_M, 0);
|
||||||
addAction(ACTION_TOGGLEGRID, KEY_F9);
|
addAction(ACTION_TOGGLEGRID, KEY_F9);
|
||||||
|
|
|
@ -59,6 +59,7 @@ void Mod::clear()
|
||||||
doRecache = 0;
|
doRecache = 0;
|
||||||
debugMenu = false;
|
debugMenu = false;
|
||||||
hasMap = false;
|
hasMap = false;
|
||||||
|
blockEditor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::isDebugMenu()
|
bool Mod::isDebugMenu()
|
||||||
|
@ -71,6 +72,11 @@ bool Mod::hasWorldMap()
|
||||||
return hasMap;
|
return hasMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Mod::isEditorBlocked()
|
||||||
|
{
|
||||||
|
return blockEditor;
|
||||||
|
}
|
||||||
|
|
||||||
void Mod::loadModXML(TiXmlDocument *d, std::string modName)
|
void Mod::loadModXML(TiXmlDocument *d, std::string modName)
|
||||||
{
|
{
|
||||||
d->LoadFile(baseModPath + modName + ".xml");
|
d->LoadFile(baseModPath + modName + ".xml");
|
||||||
|
@ -124,6 +130,11 @@ void Mod::load(const std::string &p)
|
||||||
props->Attribute("hasWorldMap", &t);
|
props->Attribute("hasWorldMap", &t);
|
||||||
hasMap = t;
|
hasMap = t;
|
||||||
}
|
}
|
||||||
|
if (props->Attribute("blockEditor")) {
|
||||||
|
int t;
|
||||||
|
props->Attribute("blockEditor", &t);
|
||||||
|
blockEditor = t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ void WorldMapRender::onUpdate(float dt)
|
||||||
else if (-internalOffset.y > yMax + 150/scale.x)
|
else if (-internalOffset.y > yMax + 150/scale.x)
|
||||||
internalOffset.y = -(yMax + 150/scale.x);
|
internalOffset.y = -(yMax + 150/scale.x);
|
||||||
|
|
||||||
if (dsq->isDeveloperKeys() || dsq->mod.isActive())
|
if (dsq->canOpenEditor())
|
||||||
{
|
{
|
||||||
if (editorActive)
|
if (editorActive)
|
||||||
{
|
{
|
||||||
|
@ -1533,7 +1533,7 @@ void WorldMapRender::action (int id, int state)
|
||||||
}
|
}
|
||||||
if (id == ACTION_TOGGLEWORLDMAPEDITOR && !state)
|
if (id == ACTION_TOGGLEWORLDMAPEDITOR && !state)
|
||||||
{
|
{
|
||||||
if (dsq->isDeveloperKeys() || dsq->mod.isActive())
|
if (dsq->canOpenEditor())
|
||||||
{
|
{
|
||||||
editorActive = !editorActive;
|
editorActive = !editorActive;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue