From 311d6f724105d07ab9ec79a1206a44dfcece100c Mon Sep 17 00:00:00 2001 From: FutureRave Date: Sat, 18 Feb 2023 12:18:41 +0000 Subject: [PATCH] [Dvar]: Increase max value of dvar --- src/Components/Modules/Dvar.cpp | 8 ++++++++ src/Components/Modules/Dvar.hpp | 1 + src/Components/Modules/Maps.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Components/Modules/Dvar.cpp b/src/Components/Modules/Dvar.cpp index afc2acbd..04f10714 100644 --- a/src/Components/Modules/Dvar.cpp +++ b/src/Components/Modules/Dvar.cpp @@ -250,6 +250,11 @@ namespace Components return Game::Dvar_RegisterInt(dvarName, 1000, min, 1000, Game::DVAR_NONE, description); } + const Game::dvar_t* Dvar::Dvar_RegisterPerkExtendedMeleeRange(const char* dvarName, float value, float min, float /*max*/, std::uint16_t flags, const char* description) + { + return Game::Dvar_RegisterFloat(dvarName, value, min, 10000.0f, flags, description); + } + void Dvar::SetFromStringByNameSafeExternal(const char* dvarName, const char* string) { static std::array exceptions = @@ -415,6 +420,9 @@ namespace Components // Hook dvar 'sv_network_fps' registration Utils::Hook(0x4D3C7B, Dvar_RegisterSVNetworkFps, HOOK_CALL).install()->quick(); + // Hook dvar 'perk_extendedMeleeRange' and set a higher max, better than having people force this with external programs + Utils::Hook(0x492D2F, Dvar_RegisterPerkExtendedMeleeRange, HOOK_CALL).install()->quick(); + // un-cheat safeArea_* and add archive flags Utils::Hook::Xor(0x42E3F5, Game::DVAR_ROM | Game::DVAR_ARCHIVE); //safeArea_adjusted_horizontal Utils::Hook::Xor(0x42E423, Game::DVAR_ROM | Game::DVAR_ARCHIVE); //safeArea_adjusted_vertical diff --git a/src/Components/Modules/Dvar.hpp b/src/Components/Modules/Dvar.hpp index d77ca29b..9ad5215c 100644 --- a/src/Components/Modules/Dvar.hpp +++ b/src/Components/Modules/Dvar.hpp @@ -42,6 +42,7 @@ namespace Components static const Game::dvar_t* Dvar_RegisterName(const char* dvarName, const char* value, std::uint16_t flags, const char* description); static const Game::dvar_t* Dvar_RegisterSVNetworkFps(const char* dvarName, int value, int min, int max, std::uint16_t flags, const char* description); + static const Game::dvar_t* Dvar_RegisterPerkExtendedMeleeRange(const char* dvarName, float value, float min, float max, std::uint16_t flags, const char* description); static void SetFromStringByNameExternal(const char* dvarName, const char* string); static void SetFromStringByNameSafeExternal(const char* dvarName, const char* string); diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index e80f3984..00cf934a 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -800,7 +800,7 @@ namespace Components }, Scheduler::Pipeline::CLIENT, 10s); }); - if(Dedicated::IsEnabled()) + if (Dedicated::IsEnabled()) { Utils::Hook(0x4A7251, Maps::LoadNewMapCommand, HOOK_CALL).install()->quick(); }