CTweakGame: Add tweak.game.SplashScreensDisabled CVar

This commit is contained in:
Luke Street 2020-04-18 17:37:02 -04:00
parent 7f15390d4f
commit 81c2e5b03c
2 changed files with 16 additions and 3 deletions

View File

@ -8,10 +8,12 @@ namespace DataSpec::DNAMP1 {
hecl::CVar* tw_fov = nullptr;
hecl::CVar* tw_hardmodeDMult = nullptr;
hecl::CVar* tw_hardmodeWMult = nullptr;
hecl::CVar* tw_splashScreensDisabled = nullptr;
namespace {
constexpr std::string_view skFov = "tweak.game.FieldOfView"sv;
constexpr std::string_view skHardModeDamageMultName = "tweak.game.HardModeDamageMult"sv;
constexpr std::string_view skHardModeWeaponMultName = "tweak.game.HardModeWeaponMult"sv;
constexpr std::string_view skSplashScreensDisabled = "tweak.game.SplashScreensDisabled"sv;
} // anonymous namespace
void CTweakGame::_tweakGameListener(hecl::CVar* cv) {
@ -21,6 +23,8 @@ void CTweakGame::_tweakGameListener(hecl::CVar* cv) {
x60_hardmodeDamageMult = cv->toReal();
} else if (cv == tw_hardmodeWMult) {
x64_hardmodeWeaponMult = cv->toReal();
} else if (cv == tw_splashScreensDisabled) {
x2b_splashScreensDisabled = cv->toBoolean();
}
}
@ -33,14 +37,23 @@ void CTweakGame::initCVars(hecl::CVarManager* mgr) {
cv->addListener([this](hecl::CVar* cv) { _tweakGameListener(cv); });
return cv;
};
auto assignBoolValue = [this, mgr](std::string_view name, std::string_view desc, bool& v, hecl::CVar::EFlags flags) {
hecl::CVar* cv = mgr->findOrMakeCVar(name, desc, v, flags);
// Check if the CVar was deserialized, this avoid an unnecessary conversion
if (cv->wasDeserialized())
v = cv->toBoolean();
cv->addListener([this](hecl::CVar* cv) { _tweakGameListener(cv); });
return cv;
};
tw_fov = assignRealValue(skFov, "", x24_fov,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive);
tw_fov = assignRealValue(skFov, "", x24_fov, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive);
tw_hardmodeDMult =
assignRealValue(skHardModeDamageMultName, "", x60_hardmodeDamageMult,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Cheat);
tw_hardmodeWMult =
assignRealValue(skHardModeWeaponMultName, "", x64_hardmodeWeaponMult,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Cheat);
tw_splashScreensDisabled = assignBoolValue(skSplashScreensDisabled, "", x2b_splashScreensDisabled,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive);
}
} // namespace DataSpec::DNAMP1

@ -1 +1 @@
Subproject commit db38d19ac3ed624f4e55fb071c177db4feed3ce0
Subproject commit c66d33b0b2fca695c39d1c0c829489ba67a52f47