CTweakGame: Add CVar definitions in header

This commit is contained in:
Luke Street 2021-02-27 23:45:23 -05:00
parent 35f7615c0a
commit 1144df0ea8
3 changed files with 28 additions and 9 deletions

View File

@ -35,8 +35,7 @@
} }
namespace DataSpec::DNAMP1 { namespace DataSpec::DNAMP1 {
namespace {
constexpr hecl::CVar::EFlags skDefaultFlags = hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive;
DEFINE_CVAR_GLOBAL(WorldPrefix); DEFINE_CVAR_GLOBAL(WorldPrefix);
DEFINE_CVAR_GLOBAL(FieldOfView); DEFINE_CVAR_GLOBAL(FieldOfView);
DEFINE_CVAR_GLOBAL(SplashScreensDisabled); DEFINE_CVAR_GLOBAL(SplashScreensDisabled);
@ -54,7 +53,6 @@ DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceBase);
DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceRange); DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceRange);
DEFINE_CVAR_GLOBAL(HardModeDamageMult); DEFINE_CVAR_GLOBAL(HardModeDamageMult);
DEFINE_CVAR_GLOBAL(HardModeWeaponMult); DEFINE_CVAR_GLOBAL(HardModeWeaponMult);
} // anonymous namespace
void CTweakGame::_tweakListener(hecl::CVar* cv) { void CTweakGame::_tweakListener(hecl::CVar* cv) {
UPDATE_CVAR(WorldPrefix, cv, x4_worldPrefix); UPDATE_CVAR(WorldPrefix, cv, x4_worldPrefix);
@ -77,6 +75,7 @@ void CTweakGame::_tweakListener(hecl::CVar* cv) {
} }
void CTweakGame::initCVars(hecl::CVarManager* mgr) { void CTweakGame::initCVars(hecl::CVarManager* mgr) {
constexpr hecl::CVar::EFlags skDefaultFlags = hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive;
CREATE_CVAR(WorldPrefix, "", x4_worldPrefix, skDefaultFlags); CREATE_CVAR(WorldPrefix, "", x4_worldPrefix, skDefaultFlags);
CREATE_CVAR(FieldOfView, "", x24_fov, skDefaultFlags); CREATE_CVAR(FieldOfView, "", x24_fov, skDefaultFlags);
CREATE_CVAR(SplashScreensDisabled, "", x2b_splashScreensDisabled, CREATE_CVAR(SplashScreensDisabled, "", x2b_splashScreensDisabled,

View File

@ -4,10 +4,33 @@
namespace hecl { namespace hecl {
class CVar; class CVar;
} } // namespace hecl
namespace DataSpec::DNAMP1 { namespace DataSpec::DNAMP1 {
#define DEFINE_CVAR_GLOBAL(name) \
extern hecl::CVar* tw_##name;
DEFINE_CVAR_GLOBAL(WorldPrefix);
DEFINE_CVAR_GLOBAL(FieldOfView);
DEFINE_CVAR_GLOBAL(SplashScreensDisabled);
DEFINE_CVAR_GLOBAL(PressStartDelay);
DEFINE_CVAR_GLOBAL(WavecapIntensityNormal);
DEFINE_CVAR_GLOBAL(WavecapIntensityPoison);
DEFINE_CVAR_GLOBAL(WavecapIntensityLava);
DEFINE_CVAR_GLOBAL(RippleIntensityNormal);
DEFINE_CVAR_GLOBAL(RippleIntensityPoison);
DEFINE_CVAR_GLOBAL(RippleIntensityLava);
DEFINE_CVAR_GLOBAL(FluidEnvBumpScale);
DEFINE_CVAR_GLOBAL(WaterFogDistanceBase);
DEFINE_CVAR_GLOBAL(WaterFogDistanceRange);
DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceBase);
DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceRange);
DEFINE_CVAR_GLOBAL(HardModeDamageMult);
DEFINE_CVAR_GLOBAL(HardModeWeaponMult);
#undef DEFINE_CVAR_GLOBAL
struct CTweakGame final : ITweakGame { struct CTweakGame final : ITweakGame {
AT_DECL_DNA_YAML AT_DECL_DNA_YAML
String<-1> x4_worldPrefix; String<-1> x4_worldPrefix;
@ -60,6 +83,7 @@ struct CTweakGame final : ITweakGame {
} }
void initCVars(hecl::CVarManager* mgr) override; void initCVars(hecl::CVarManager* mgr) override;
private: private:
void _tweakListener(hecl::CVar* cv); void _tweakListener(hecl::CVar* cv);
}; };

View File

@ -8,10 +8,6 @@
#include "TCastTo.hpp" // Generated file, do not modify include path #include "TCastTo.hpp" // Generated file, do not modify include path
namespace DataSpec::DNAMP1 {
extern hecl::CVar* tw_fov;
}
namespace urde { namespace urde {
CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId watchedObj, CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId watchedObj,
@ -20,7 +16,7 @@ CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf
nearz, farz, aspect, watchedObj, false, 0) nearz, farz, aspect, watchedObj, false, 0)
, x188_orbitCameraSpeed(orbitCameraSpeed) , x188_orbitCameraSpeed(orbitCameraSpeed)
, x190_gunFollowXf(xf) { , x190_gunFollowXf(xf) {
DataSpec::DNAMP1::tw_fov->addListener([this](hecl::CVar* cv) { _fovListener(cv); }); DataSpec::DNAMP1::tw_FieldOfView->addListener([this](hecl::CVar* cv) { _fovListener(cv); });
} }
void CFirstPersonCamera::Accept(IVisitor& visitor) { visitor.Visit(this); } void CFirstPersonCamera::Accept(IVisitor& visitor) { visitor.Visit(this); }