Update hecl, more CVar imps

This commit is contained in:
Phillip Stephens 2019-09-29 08:17:47 -07:00
parent 56b198838f
commit 79ac5d76df
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
7 changed files with 61 additions and 16 deletions

View File

@ -61,6 +61,7 @@ set(DNAMP1_SOURCES
FRME.cpp
SCAN.cpp
DeafBabe.cpp
Tweaks/CTweakAutoMapper.cpp
Tweaks/CTweakPlayer.cpp
Tweaks/CTweakTargeting.cpp
Tweaks/CTweakBall.cpp

View File

@ -0,0 +1,18 @@
#include "DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp"
#include <hecl/CVar.hpp>
#include <hecl/CVarManager.hpp>
namespace DataSpec::DNAMP1 {
namespace {
}
void CTweakAutoMapper::_tweakListener(hecl::CVar* cv) {
}
void CTweakAutoMapper::initCVars(hecl::CVarManager* mgr) {
}
}

View File

@ -1,7 +1,12 @@
#pragma once
#include "../../DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp"
#include "zeus/CVector3f.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp"
#include <zeus/CVector3f.hpp>
namespace hecl {
class CVar;
}
namespace DataSpec::DNAMP1 {
struct CTweakAutoMapper final : public ITweakAutoMapper {
@ -132,5 +137,9 @@ struct CTweakAutoMapper final : public ITweakAutoMapper {
const zeus::CColor& GetAreaFlashPulseColor() const override { return xf4_areaFlashPulseColor; }
const zeus::CColor& GetDoorColor(int idx) const override { return x104_doorColors[idx]; }
const zeus::CColor& GetOpenDoorColor() const override { return x11c_openDoorColor; }
void initCVars(hecl::CVarManager*) override;
private:
void _tweakListener(hecl::CVar* cv);
};
} // namespace DataSpec::DNAMP1

View File

@ -1,24 +1,27 @@
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
#include "Runtime/CStringExtras.hpp"
#include "Runtime/Camera/CCameraManager.hpp"
#include <hecl/CVar.hpp>
#include <hecl/CVarManager.hpp>
namespace DataSpec::DNAMP1 {
hecl::CVar* tw_fov = nullptr;
hecl::CVar* tw_hardmodeDMult = nullptr;
hecl::CVar* tw_hardmodeWMult = nullptr;
namespace {
constexpr std::string_view skFov = "tweaks.game.FieldOfView"sv;
constexpr std::string_view skHardModeDamageMultName = "tweaks.game.HardModeDamageMult"sv;
constexpr std::string_view skHardModeWeaponMultName = "tweaks.game.HardModeWeaponMult"sv;
}
} // anonymous namespace
void CTweakGame::_tweakGameListener(hecl::CVar* cv) {
if (urde::CStringExtras::CompareCaseInsensitive(cv->name(), skFov)) {
if (cv == tw_fov) {
x24_fov = cv->toReal();
} else if (urde::CStringExtras::CompareCaseInsensitive(cv->name(), skHardModeDamageMultName)) {
} else if (cv == tw_hardmodeDMult) {
x60_hardmodeDamageMult = cv->toReal();
} else if (urde::CStringExtras::CompareCaseInsensitive(cv->name(), skHardModeWeaponMultName)) {
} else if (cv == tw_hardmodeWMult) {
x64_hardmodeWeaponMult = cv->toReal();
}
cv->clearModified();
}
void CTweakGame::initCVars(hecl::CVarManager* mgr) {
@ -28,13 +31,16 @@ void CTweakGame::initCVars(hecl::CVarManager* mgr) {
if (cv->wasDeserialized())
v = cv->toReal();
cv->addListener([this](hecl::CVar* cv) { _tweakGameListener(cv); });
return cv;
};
assignRealValue(skFov, "", x24_fov,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ModifyRestart);
assignRealValue(skHardModeDamageMultName, "", x60_hardmodeDamageMult,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Cheat);
assignRealValue(skHardModeWeaponMultName, "", x64_hardmodeWeaponMult,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Cheat);
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);
}
} // namespace DataSpec::DNAMP1

View File

@ -6,6 +6,10 @@
#include "World/CScriptCameraPitchVolume.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace DataSpec::DNAMP1 {
extern hecl::CVar* tw_fov;
}
namespace urde {
CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId watchedObj,
@ -15,6 +19,7 @@ CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf
, x188_orbitCameraSpeed(orbitCameraSpeed)
, x190_gunFollowXf(xf) {
x1c6_24_deferBallTransitionProcessing = false;
DataSpec::DNAMP1::tw_fov->addListener([this](hecl::CVar* cv) { _fovListener(cv); });
}
void CFirstPersonCamera::Accept(IVisitor& visitor) { visitor.Visit(this); }
@ -325,4 +330,10 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr) {
}
}
}
void CFirstPersonCamera::_fovListener(hecl::CVar* cv) {
x15c_currentFov = x180_perspInterpStartFov = x184_perspInterpEndFov = cv->toReal();
x170_24_perspDirty = true;
}
} // namespace urde

View File

@ -17,7 +17,7 @@ class CFirstPersonCamera : public CGameCamera {
bool x1c6_24_deferBallTransitionProcessing : 1;
zeus::CVector3f x1c8_closeInVec;
float x1d4_closeInTimer = 0.f;
void _fovListener(hecl::CVar* cv);
public:
CFirstPersonCamera(TUniqueId, const zeus::CTransform& xf, TUniqueId, float orbitCameraSpeed, float fov,
float nearplane, float farplane, float aspect);

2
hecl

@ -1 +1 @@
Subproject commit c430ed66b3dfc27586554a30643d759a99e0a88f
Subproject commit a8b2d5d64ea97d20aac4ae1b1b4af8655bf7507b