mirror of https://github.com/AxioDL/metaforce.git
Update hecl
This commit is contained in:
parent
bb43821f31
commit
56b198838f
|
@ -1,10 +1,40 @@
|
|||
#include "CTweakGame.hpp"
|
||||
#include "hecl/CVarManager.hpp"
|
||||
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
|
||||
#include "Runtime/CStringExtras.hpp"
|
||||
|
||||
#include <hecl/CVar.hpp>
|
||||
#include <hecl/CVarManager.hpp>
|
||||
|
||||
namespace DataSpec::DNAMP1 {
|
||||
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;
|
||||
}
|
||||
void CTweakGame::_tweakGameListener(hecl::CVar* cv) {
|
||||
if (urde::CStringExtras::CompareCaseInsensitive(cv->name(), skFov)) {
|
||||
x24_fov = cv->toReal();
|
||||
} else if (urde::CStringExtras::CompareCaseInsensitive(cv->name(), skHardModeDamageMultName)) {
|
||||
x60_hardmodeDamageMult = cv->toReal();
|
||||
} else if (urde::CStringExtras::CompareCaseInsensitive(cv->name(), skHardModeWeaponMultName)) {
|
||||
x64_hardmodeWeaponMult = cv->toReal();
|
||||
}
|
||||
cv->clearModified();
|
||||
}
|
||||
|
||||
void CTweakGame::initCVars(hecl::CVarManager* mgr) {
|
||||
// mgr->findOrMakeCVar("tweaks.game.hardmodeDamageMult", "", x60_hardmodeDamageMult, hecl::CVar::EFlags::Game |
|
||||
// hecl::CVar::Archive | hecl::CVar::Cheat); mgr->findOrMakeCVar("tweaks.game.hardmodeWeaponMult", "",
|
||||
// x64_hardmodeWeaponMult, hecl::CVar::EFlags::Game | hecl::CVar::Archive | hecl::CVar::Cheat);
|
||||
auto assignRealValue = [this, mgr](std::string_view name, std::string_view desc, float& 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->toReal();
|
||||
cv->addListener([this](hecl::CVar* cv) { _tweakGameListener(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);
|
||||
}
|
||||
} // namespace DataSpec::DNAMP1
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../DNACommon/Tweaks/ITweakGame.hpp"
|
||||
#include "DataSpec/DNACommon/Tweaks/ITweakGame.hpp"
|
||||
|
||||
namespace hecl {
|
||||
class CVar;
|
||||
}
|
||||
|
||||
namespace DataSpec::DNAMP1 {
|
||||
|
||||
|
@ -56,5 +60,7 @@ struct CTweakGame final : ITweakGame {
|
|||
}
|
||||
|
||||
void initCVars(hecl::CVarManager* mgr) override;
|
||||
private:
|
||||
void _tweakGameListener(hecl::CVar* cv);
|
||||
};
|
||||
} // namespace DataSpec::DNAMP1
|
||||
|
|
|
@ -346,6 +346,7 @@ bool ViewManager::proc() {
|
|||
if (m_rootSpaceView && m_editorFrames <= 30)
|
||||
m_rootSpaceView->setMultiplyColor(zeus::CColor::lerp({1, 1, 1, 0}, {1, 1, 1, 1}, m_editorFrames / 30.0));
|
||||
|
||||
m_cvarManager.proc();
|
||||
m_projManager.mainUpdate();
|
||||
|
||||
if (m_testGameView)
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 9854cce19684f39b463621f99b8737ece93f3005
|
||||
Subproject commit c430ed66b3dfc27586554a30643d759a99e0a88f
|
Loading…
Reference in New Issue