mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 16:24:55 +00:00
Add CVarValueReference
This commit is contained in:
@@ -216,9 +216,12 @@ CStateManager::CStateManager(const std::weak_ptr<CScriptMailbox>& mailbox, const
|
||||
x8f0_shadowTex = g_SimplePool->GetObj("DefaultShadow");
|
||||
g_StateManager = this;
|
||||
|
||||
sm_logScripting = hecl::CVarManager::instance()->findOrMakeCVar(
|
||||
"stateManager.logScripting"sv, "Prints object communication to the console", false,
|
||||
hecl::CVar::EFlags::ReadOnly | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Game);
|
||||
if (sm_logScripting == nullptr) {
|
||||
sm_logScripting = hecl::CVarManager::instance()->findOrMakeCVar(
|
||||
"stateManager.logScripting"sv, "Prints object communication to the console", false,
|
||||
hecl::CVar::EFlags::ReadOnly | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Game);
|
||||
}
|
||||
m_logScriptingReference.emplace(&m_logScripting, sm_logScripting);
|
||||
}
|
||||
|
||||
CStateManager::~CStateManager() {
|
||||
@@ -1326,7 +1329,7 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes
|
||||
return;
|
||||
}
|
||||
|
||||
if (sm_logScripting != nullptr && sm_logScripting->toBoolean()) {
|
||||
if (m_logScripting) {
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||
dest->GetName(), dest->GetUniqueId());
|
||||
}
|
||||
@@ -1345,7 +1348,7 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
|
||||
return;
|
||||
}
|
||||
|
||||
if (sm_logScripting != nullptr && sm_logScripting->toBoolean()) {
|
||||
if (m_logScripting) {
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||
dst->GetName(), dst->GetUniqueId());
|
||||
}
|
||||
@@ -1415,7 +1418,7 @@ void CStateManager::FreeScriptObject(TUniqueId id) {
|
||||
act->SetUseInSortedLists(false);
|
||||
}
|
||||
|
||||
if (sm_logScripting && sm_logScripting->toBoolean()) {
|
||||
if (m_logScripting) {
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Removed '{}'"), ent->GetName());
|
||||
}
|
||||
}
|
||||
@@ -2771,7 +2774,7 @@ void CStateManager::AddObject(CEntity& ent) {
|
||||
}
|
||||
}
|
||||
|
||||
if (sm_logScripting != nullptr && sm_logScripting->toBoolean()) {
|
||||
if (m_logScripting) {
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Added '{}'"), ent.GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +216,8 @@ private:
|
||||
bool m_warping = false;
|
||||
std::map<TEditorId, std::set<SConnection>> m_incomingConnections;
|
||||
|
||||
bool m_logScripting = false;
|
||||
std::optional<hecl::CVarValueReference<bool>> m_logScriptingReference;
|
||||
void UpdateThermalVisor();
|
||||
static void RendererDrawCallback(void*, void*, int);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user