diff --git a/hecl/include/hecl/CVarManager.hpp b/hecl/include/hecl/CVarManager.hpp index 292ef3179..b2026b562 100644 --- a/hecl/include/hecl/CVarManager.hpp +++ b/hecl/include/hecl/CVarManager.hpp @@ -16,6 +16,7 @@ extern CVar* com_developer; extern CVar* com_configfile; extern CVar* com_enableCheats; extern CVar* com_cubemaps; +extern CVar* com_variableDt; class CVarManager final { using CVarContainer = DNACVAR::CVarContainer; template @@ -105,6 +106,7 @@ public: void setDeveloperMode(bool v, bool setDeserialized = false); void setCheatsEnabled(bool v, bool setDeserialized = false); + void setVariableDtEnabled(bool v, bool setDeserialized = false); bool restartRequired() const; void parseCommandLine(const std::vector& args); diff --git a/hecl/lib/CVarManager.cpp b/hecl/lib/CVarManager.cpp index 860abcd37..5f52b1836 100644 --- a/hecl/lib/CVarManager.cpp +++ b/hecl/lib/CVarManager.cpp @@ -17,6 +17,7 @@ CVar* com_developer = nullptr; CVar* com_configfile = nullptr; CVar* com_enableCheats = nullptr; CVar* com_cubemaps = nullptr; +CVar* com_variableDt = nullptr; static const std::regex cmdLineRegex("\\+([\\w\\.]+)=([\\w\\.\\-]+)"); CVarManager* CVarManager::m_instance = nullptr; @@ -35,6 +36,8 @@ CVarManager::CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary) (CVar::EFlags::System | CVar::EFlags::ReadOnly | CVar::EFlags::Hidden | CVar::EFlags::InternalArchivable)); com_cubemaps = newCVar("cubemaps", "Enable cubemaps", false, (CVar::EFlags::Game | CVar::EFlags::ReadOnly | CVar::EFlags::InternalArchivable)); + com_variableDt = newCVar("variableDt", "Enable variable delta time (experimental)", false, + (CVar::EFlags::Game | CVar::EFlags::ReadOnly | CVar::EFlags::InternalArchivable)); } CVarManager::~CVarManager() {} @@ -276,6 +279,15 @@ void CVarManager::setCheatsEnabled(bool v, bool setDeserialized) { com_enableCheats->setModified(); } +void CVarManager::setVariableDtEnabled(bool v, bool setDeserialized) { + com_variableDt->unlock(); + com_variableDt->fromBoolean(v); + if (setDeserialized) + com_variableDt->m_wasDeserialized = true; + com_variableDt->lock(); + com_variableDt->setModified(); +} + bool CVarManager::restartRequired() const { return std::any_of(m_cvars.cbegin(), m_cvars.cend(), [](const auto& entry) { return entry.second->isModified() && entry.second->modificationRequiresRestart();