mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Adds utility function and method to be able to enact a load of subscenes at a specific world position
Adds loadIf conditional logic to evaluate if a subscene is 'allowed' to load when tested Adds isAlwaysActive to GameMode to be able to flag a gamemode as being defaulted to on and used automatically Updated GetGameModesList function to return an arrayObject of the gamemodes found Overhauled CallGameModeFunction to utilize the gamemodes list with active/alwaysActive modes being called against, rather than level-scanning Updated ChooseLevelMenu to be able to toggle on/off multiple gamemodes with an image indicator if it's active or not
This commit is contained in:
parent
20a01d9f02
commit
e4d07c7e8d
14 changed files with 259 additions and 198 deletions
|
|
@ -4,6 +4,8 @@
|
|||
#include "gui/containers/guiDynamicCtrlArrayCtrl.h"
|
||||
#endif
|
||||
|
||||
#include "console/arrayObject.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GameMode);
|
||||
|
||||
IMPLEMENT_CALLBACK(GameMode, onActivated, void, (), (),
|
||||
|
|
@ -47,7 +49,9 @@ ConsoleSetType(TypeGameModeList)
|
|||
|
||||
GameMode::GameMode() :
|
||||
mGameModeName(StringTable->EmptyString()),
|
||||
mGameModeDesc(StringTable->EmptyString())
|
||||
mGameModeDesc(StringTable->EmptyString()),
|
||||
mIsActive(false),
|
||||
mIsAlwaysActive(false)
|
||||
{
|
||||
INIT_ASSET(PreviewImage);
|
||||
}
|
||||
|
|
@ -62,6 +66,7 @@ void GameMode::initPersistFields()
|
|||
INITPERSISTFIELD_IMAGEASSET(PreviewImage, GameMode, "Preview Image");
|
||||
|
||||
addField("active", TypeBool, Offset(mIsActive, GameMode), "Is the gamemode active");
|
||||
addField("alwaysActive", TypeBool, Offset(mIsAlwaysActive, GameMode), "Is the gamemode always active");
|
||||
}
|
||||
|
||||
bool GameMode::onAdd()
|
||||
|
|
@ -110,6 +115,11 @@ void GameMode::setActive(const bool& active)
|
|||
onDeactivated_callback();
|
||||
}
|
||||
|
||||
void GameMode::setAlwaysActive(const bool& alwaysActive)
|
||||
{
|
||||
mIsAlwaysActive = alwaysActive;
|
||||
}
|
||||
|
||||
DefineEngineMethod(GameMode, isActive, bool, (), ,
|
||||
"Returns if the GameMode is currently active.\n"
|
||||
"@return The active status of the GameMode")
|
||||
|
|
@ -124,24 +134,38 @@ DefineEngineMethod(GameMode, setActive, void, (bool active), (true),
|
|||
object->setActive(active);
|
||||
}
|
||||
|
||||
DefineEngineFunction(getGameModesList, const char*, (), , "")
|
||||
DefineEngineMethod(GameMode, isALwaysActive, bool, (), ,
|
||||
"Returns if the GameMode is currently active.\n"
|
||||
"@return The active status of the GameMode")
|
||||
{
|
||||
char* returnBuffer = Con::getReturnBuffer(1024);
|
||||
return object->isActive();
|
||||
}
|
||||
|
||||
String formattedList;
|
||||
DefineEngineMethod(GameMode, setAlwaysActive, void, (bool alwaysActive), (true),
|
||||
"Sets the active state of the GameMode.\n"
|
||||
"@param active A bool of the state the GameMode should be set to")
|
||||
{
|
||||
object->setAlwaysActive(alwaysActive);
|
||||
}
|
||||
|
||||
DefineEngineFunction(getGameModesList, ArrayObject*, (), , "")
|
||||
{
|
||||
ArrayObject* dictionary = new ArrayObject();
|
||||
dictionary->registerObject();
|
||||
|
||||
char activeValBuffer[16];
|
||||
|
||||
for (SimGroup::iterator itr = Sim::getRootGroup()->begin(); itr != Sim::getRootGroup()->end(); itr++)
|
||||
{
|
||||
GameMode* gm = dynamic_cast<GameMode*>(*itr);
|
||||
if (gm)
|
||||
{
|
||||
formattedList += String(gm->getName()) + ";";
|
||||
dSprintf(activeValBuffer, 16, "%d", (gm->mIsActive || gm->mIsAlwaysActive));
|
||||
dictionary->push_back(gm->getName(), activeValBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
dSprintf(returnBuffer, 1024, "%s", formattedList.c_str());
|
||||
|
||||
return returnBuffer;
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue