mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 14:09: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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -162,14 +162,6 @@ enum AquariaActions
|
|||
ACTION_TOGGLEHELPSCREEN
|
||||
};
|
||||
|
||||
enum EditorLock
|
||||
{
|
||||
EDITORLOCK_NONE = 0,
|
||||
EDITORLOCK_USER = 1
|
||||
};
|
||||
|
||||
const EditorLock editorLock = EDITORLOCK_USER;
|
||||
|
||||
typedef std::list<Entity*> EntityList;
|
||||
typedef std::vector<Entity*> 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue