merge previous master commits to dev, change config player_variables.scr, change changelog

This commit is contained in:
EricPlayZ
2024-11-03 18:24:33 +02:00
parent 0ee417db70
commit 8b4e3c4b75
17 changed files with 6843 additions and 4165 deletions

View File

@ -281,6 +281,9 @@
</IntrinsicFunctions> </IntrinsicFunctions>
<AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;source\memscan;</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;source\memscan;</AdditionalIncludeDirectories>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile> <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<MultiProcessorCompilation>
</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -292,6 +295,10 @@
<EnableCOMDATFolding> <EnableCOMDATFolding>
</EnableCOMDATFolding> </EnableCOMDATFolding>
<AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;</AdditionalLibraryDirectories>
<AssemblyDebug>true</AssemblyDebug>
<ImportLibrary />
<FixedBaseAddress>
</FixedBaseAddress>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"</Command> <Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"</Command>
@ -310,21 +317,23 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpplatest</LanguageStandard> <LanguageStandard>stdcpplatest</LanguageStandard>
<AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;source\memscan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>pch;source\spdlog\include;source\ImGui\freetype\include;source\ImGui;source\MinHook;source\memscan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat> <DebugInformationFormat>OldStyle</DebugInformationFormat>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile> <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_$(PlatformTarget).pch</PrecompiledHeaderOutputFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>source\spdlog\lib;source\ImGui\freetype\lib;source\MinHook\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>DbgHelp.lib;Version.lib;spdlog-mt.lib;freetype-mt.lib;libMinHook-x64-v141-mtd.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>DbgHelp.lib;Version.lib;spdlog-mt.lib;freetype-mt.lib;libMinHook-x64-v141-mtd.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<ImportLibrary /> <ImportLibrary />
<AdditionalOptions>/NOIMPLIB /NOEXP %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/NOIMPLIB /NOEXP %(AdditionalOptions)</AdditionalOptions>
<AssemblyDebug>true</AssemblyDebug>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"</Command> <Command>copy /Y "$(SolutionDir)Extra Files\Default Config\EGameTools.ini" "$(SolutionDir)$(PlatformShortName)\$(Configuration)\EGameTools.ini"</Command>

View File

@ -137,7 +137,18 @@ If anyone is looking to help with development, I'm all eyes and ears! Thank you!
R"(- Added compatibility with v1.17.2 Tower Raid update R"(- Added compatibility with v1.17.2 Tower Raid update
- Added a .PDB file included by default with the mod, for debugging purposes in case the game crashes, now I can more easily detect the cause of a game crash! - Added a .PDB file included by default with the mod, for debugging purposes in case the game crashes, now I can more easily detect the cause of a game crash!
- Added a crash handler which handles game crashes and generates a "EGameTools-dump.dmp" file in the game's exe directory for debugging purposes; if you encounter a crash and this file gets generated, please send it to me anywhere you can, for example on Discord, so I can try to find out the cause of the game crash! - Added a crash handler which handles game crashes and generates a "EGameTools-dump.dmp" file in the game's exe directory for debugging purposes; if you encounter a crash and this file gets generated, please send it to me anywhere you can, for example on Discord, so I can try to find out the cause of the game crash!
- Fixed "Game Speed" (World) not getting applied with the mod menu opened while having another tab selected other than the World tab - Fixed "Game Speed" (World) not getting applied with the mod menu opened while having another tab selected other than the World tab
I have some things planned for the next updates, but time will decide when I'll be able to work on the updates. I'm almost done with my exams!)" }
I have some things planned for the next updates, but time will decide when I'll be able to work on the updates. I'm almost done with my exams!)" },
{ "v1.2.2",
R"(- Added compatibility with v1.18.0 "Community QoL" update
- Fixed an issue with classes not always getting detected correctly for everyone (Debug tab; if you still run into issues, please open a bug report!))" },
{ "v1.2.3",
R"(- Fixed co-op issues related to Player and Weapon options, such as God Mode, Player Health, Player Immunity, Weapon Durability sliders not working (if you still run into issues, please open a bug report!))" },
{ "v1.2.4",
R"(- Added compatibility with v1.19 Tower Raid: Halloween Run update
- Improved CPU performance at game startup when using the mod, this should stop the system from freezing for some people when starting up the game
- Improved memory signature scanning, increasing reliability and performance; if you encounter issues with classses in the Debug menu being NULL, please open up a bug report!)" }
}; };
} }

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ namespace Core {
DWORD prev_mode = 0; DWORD prev_mode = 0;
const HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE); const HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(hInput, &prev_mode); GetConsoleMode(hInput, &prev_mode);
SetConsoleMode(hInput, prev_mode & ENABLE_EXTENDED_FLAGS); SetConsoleMode(hInput, prev_mode & ENABLE_EXTENDED_FLAGS);
} }
static FILE* f = nullptr; static FILE* f = nullptr;
@ -180,6 +180,7 @@ namespace Core {
return false; return false;
MINIDUMP_EXCEPTION_INFORMATION mdei{}; MINIDUMP_EXCEPTION_INFORMATION mdei{};
mdei.ThreadId = GetCurrentThreadId();
mdei.ExceptionPointers = pExceptionPointers; mdei.ExceptionPointers = pExceptionPointers;
mdei.ClientPointers = false; mdei.ClientPointers = false;
@ -187,7 +188,7 @@ namespace Core {
CloseHandle(hFile); CloseHandle(hFile);
return success; return success;
} }
static long WINAPI CrashHandler(PEXCEPTION_POINTERS ExceptionInfo) { static long WINAPI CrashHandler(PEXCEPTION_POINTERS ExceptionInfo) {
spdlog::error("Crash Handler threw an exception with code {}. Game is exiting, writing mini-dump in the mean time.", ExceptionInfo->ExceptionRecord->ExceptionCode); spdlog::error("Crash Handler threw an exception with code {}. Game is exiting, writing mini-dump in the mean time.", ExceptionInfo->ExceptionRecord->ExceptionCode);
std::string errorMsg = ""; std::string errorMsg = "";
@ -223,7 +224,7 @@ namespace Core {
InitLogger(); InitLogger();
#ifndef EXCP_HANDLER_DISABLE_DEBUG #ifndef EXCP_HANDLER_DISABLE_DEBUG
AddVectoredExceptionHandler(0, &VectoredExceptionHandler); SetUnhandledExceptionFilter(CrashHandler);
#endif #endif
spdlog::warn("Getting game version"); spdlog::warn("Getting game version");

View File

@ -11,10 +11,6 @@ namespace GamePH {
class LevelDI { class LevelDI {
public: public:
union {
buffer<0x160, PlayerDI_PH*> pPlayerDI_PH;
};
bool IsLoading(); bool IsLoading();
bool IsLoaded(); bool IsLoaded();
LPVOID GetViewCamera(); LPVOID GetViewCamera();

View File

@ -2,12 +2,12 @@
#include "..\buffer.h" #include "..\buffer.h"
namespace GamePH { namespace GamePH {
class PlayerObjProperties; class PlayerDI_PH;
class LocalClientDI { class LocalClientDI {
public: public:
union { union {
buffer<0x90, PlayerObjProperties*> pPlayerObjProperties; buffer<0x90, PlayerDI_PH*> pPlayerDI_PH;
}; };
static LocalClientDI* Get(); static LocalClientDI* Get();

View File

@ -2,17 +2,17 @@
#include "..\offsets.h" #include "..\offsets.h"
#include "InventoryContainerDI.h" #include "InventoryContainerDI.h"
#include "InventoryItem.h" #include "InventoryItem.h"
#include "LevelDI.h" #include "LocalClientDI.h"
#include "PlayerDI_PH.h" #include "PlayerDI_PH.h"
namespace GamePH { namespace GamePH {
PlayerDI_PH* PlayerDI_PH::Get() { PlayerDI_PH* PlayerDI_PH::Get() {
__try { __try {
LevelDI* iLevel = LevelDI::Get(); LocalClientDI* localClient = LocalClientDI::Get();
if (!iLevel) if (!localClient)
return nullptr; return nullptr;
PlayerDI_PH* ptr = iLevel->pPlayerDI_PH; PlayerDI_PH* ptr = localClient->pPlayerDI_PH;
if (!Utils::Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll")) if (!Utils::Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll"))
return nullptr; return nullptr;
if (*reinterpret_cast<DWORD64**>(ptr) != Offsets::GetVT_PlayerDI_PH()) if (*reinterpret_cast<DWORD64**>(ptr) != Offsets::GetVT_PlayerDI_PH())
@ -41,7 +41,6 @@ namespace GamePH {
return nullptr; return nullptr;
} }
} }
InventoryContainerDI* PlayerDI_PH::GetInventoryContainer() { InventoryContainerDI* PlayerDI_PH::GetInventoryContainer() {
__try { __try {
InventoryContainerDI* ptr = reinterpret_cast<InventoryContainerDI*>(*reinterpret_cast<DWORD64*>(reinterpret_cast<DWORD64>(this) + 0x470)); InventoryContainerDI* ptr = reinterpret_cast<InventoryContainerDI*>(*reinterpret_cast<DWORD64*>(reinterpret_cast<DWORD64>(this) + 0x470));

View File

@ -6,6 +6,11 @@
namespace GamePH { namespace GamePH {
class PlayerDI_PH { class PlayerDI_PH {
public: public:
union {
buffer<0x35E9, bool> enableTPPModel1;
buffer<0x35EA, bool> enableTPPModel2;
};
static PlayerDI_PH* Get(); static PlayerDI_PH* Get();
InventoryItem* GetCurrentWeapon(UINT indexMaybe); InventoryItem* GetCurrentWeapon(UINT indexMaybe);

View File

@ -1,5 +1,5 @@
#include <pch.h> #include <pch.h>
#include "LevelDI.h" #include "PlayerDI_PH.h"
#include "PlayerHealthModule.h" #include "PlayerHealthModule.h"
namespace GamePH { namespace GamePH {
@ -23,14 +23,14 @@ namespace GamePH {
void PlayerHealthModule::Set(LPVOID instance) { pPlayerHealthModule = reinterpret_cast<PlayerHealthModule*>(instance); } void PlayerHealthModule::Set(LPVOID instance) { pPlayerHealthModule = reinterpret_cast<PlayerHealthModule*>(instance); }
void PlayerHealthModule::UpdateClassAddr() { void PlayerHealthModule::UpdateClassAddr() {
LevelDI* iLevel = LevelDI::Get(); PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!iLevel) if (!pPlayerDI_PH)
return; return;
if (PlayerHealthModule::Get() && PlayerHealthModule::Get()->pPlayerDI_PH == iLevel->pPlayerDI_PH) if (PlayerHealthModule::Get() && PlayerHealthModule::Get()->pPlayerDI_PH == pPlayerDI_PH)
return; return;
for (auto& pPlayerHealthModule : PlayerHealthModule::playerHealthModulePtrList) { for (auto& pPlayerHealthModule : PlayerHealthModule::playerHealthModulePtrList) {
if (pPlayerHealthModule->pPlayerDI_PH == iLevel->pPlayerDI_PH) { if (pPlayerHealthModule->pPlayerDI_PH == pPlayerDI_PH) {
PlayerHealthModule::Set(pPlayerHealthModule); PlayerHealthModule::Set(pPlayerHealthModule);
PlayerHealthModule::playerHealthModulePtrList.clear(); PlayerHealthModule::playerHealthModulePtrList.clear();
PlayerHealthModule::playerHealthModulePtrList.emplace_back(pPlayerHealthModule); PlayerHealthModule::playerHealthModulePtrList.emplace_back(pPlayerHealthModule);

View File

@ -1,5 +1,5 @@
#include <pch.h> #include <pch.h>
#include "LevelDI.h" #include "PlayerDI_PH.h"
#include "PlayerInfectionModule.h" #include "PlayerInfectionModule.h"
namespace GamePH { namespace GamePH {
@ -23,14 +23,14 @@ namespace GamePH {
void PlayerInfectionModule::Set(LPVOID instance) { pPlayerInfectionModule = reinterpret_cast<PlayerInfectionModule*>(instance); } void PlayerInfectionModule::Set(LPVOID instance) { pPlayerInfectionModule = reinterpret_cast<PlayerInfectionModule*>(instance); }
void PlayerInfectionModule::UpdateClassAddr() { void PlayerInfectionModule::UpdateClassAddr() {
LevelDI* iLevel = LevelDI::Get(); PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!iLevel) if (!pPlayerDI_PH)
return; return;
if (PlayerInfectionModule::Get() && PlayerInfectionModule::Get()->pPlayerDI_PH == iLevel->pPlayerDI_PH) if (PlayerInfectionModule::Get() && PlayerInfectionModule::Get()->pPlayerDI_PH == pPlayerDI_PH)
return; return;
for (auto& pPlayerInfectionModule : PlayerInfectionModule::playerInfectionModulePtrList) { for (auto& pPlayerInfectionModule : PlayerInfectionModule::playerInfectionModulePtrList) {
if (pPlayerInfectionModule->pPlayerDI_PH == iLevel->pPlayerDI_PH) { if (pPlayerInfectionModule->pPlayerDI_PH == pPlayerDI_PH) {
PlayerInfectionModule::Set(pPlayerInfectionModule); PlayerInfectionModule::Set(pPlayerInfectionModule);
PlayerInfectionModule::playerInfectionModulePtrList.clear(); PlayerInfectionModule::playerInfectionModulePtrList.clear();
PlayerInfectionModule::playerInfectionModulePtrList.emplace_back(pPlayerInfectionModule); PlayerInfectionModule::playerInfectionModulePtrList.emplace_back(pPlayerInfectionModule);

View File

@ -12,8 +12,6 @@ namespace GamePH {
buffer<0xF0, Engine::CoPhysicsProperty*> pCoPhysicsProperty; buffer<0xF0, Engine::CoPhysicsProperty*> pCoPhysicsProperty;
//buffer<0x2E80, bool> isOutOfBounds; //buffer<0x2E80, bool> isOutOfBounds;
//buffer<0x2E84, float> outOfBoundsTimer; //buffer<0x2E84, float> outOfBoundsTimer;
buffer<0x35E9, bool> enableTPPModel1;
buffer<0x35EA, bool> enableTPPModel2;
}; };
static PlayerObjProperties* Get(); static PlayerObjProperties* Get();

View File

@ -101,7 +101,7 @@ namespace GamePH {
static const size_t MAX_FUNC_SIZE = 500000; static const size_t MAX_FUNC_SIZE = 500000;
static const size_t MAX_LOAD_VAR_FUNC_SIZE = 2000; static const size_t MAX_LOAD_VAR_FUNC_SIZE = 2000;
const char* getPlayerVarName(BYTE*& funcAddress, DWORD64 startOfFunc) { static const char* getPlayerVarName(BYTE*& funcAddress, DWORD64 startOfFunc) {
const char* playerVarName = nullptr; const char* playerVarName = nullptr;
while (!playerVarName && !isRetInstruction(funcAddress) && isBelowFuncSizeLimit(funcAddress, startOfFunc, MAX_FUNC_SIZE)) { while (!playerVarName && !isRetInstruction(funcAddress) && isBelowFuncSizeLimit(funcAddress, startOfFunc, MAX_FUNC_SIZE)) {
// lea r8, varNameString // lea r8, varNameString

View File

@ -37,6 +37,9 @@ namespace GamePH {
template <typename T> static T GetPlayerVar(const std::string& playerVar) { template <typename T> static T GetPlayerVar(const std::string& playerVar) {
static_assert(std::is_same<T, bool>::value || std::is_same<T, float>::value || std::is_same<T, std::string>::value, "Invalid type: value must be bool, float or string"); static_assert(std::is_same<T, bool>::value || std::is_same<T, float>::value || std::is_same<T, std::string>::value, "Invalid type: value must be bool, float or string");
if (!gotPlayerVars)
return getDefaultValue<T>();
auto it = std::find_if(PlayerVariables::playerVars.begin(), PlayerVariables::playerVars.end(), [&playerVar](const auto& pair) { auto it = std::find_if(PlayerVariables::playerVars.begin(), PlayerVariables::playerVars.end(), [&playerVar](const auto& pair) {
return pair.first == playerVar; return pair.first == playerVar;
}); });

View File

@ -11,7 +11,7 @@
#include "LevelDI.h" #include "LevelDI.h"
#include "PlayerHealthModule.h" #include "PlayerHealthModule.h"
#include "PlayerInfectionModule.h" #include "PlayerInfectionModule.h"
#include "PlayerObjProperties.h" #include "PlayerDI_PH.h"
namespace GamePH { namespace GamePH {
namespace Hooks { namespace Hooks {
@ -161,20 +161,20 @@ namespace GamePH {
static Utils::Hook::MHook<LPVOID, void(*)(DWORD64, bool)> ShowTPPModelFunc3Hook{ "ShowTPPModelFunc3", &Offsets::Get_ShowTPPModelFunc3, &detourShowTPPModelFunc3 }; static Utils::Hook::MHook<LPVOID, void(*)(DWORD64, bool)> ShowTPPModelFunc3Hook{ "ShowTPPModelFunc3", &Offsets::Get_ShowTPPModelFunc3, &detourShowTPPModelFunc3 };
static void detourShowTPPModelFunc3(DWORD64 tppFunc2Addr, bool showTPPModel) { static void detourShowTPPModelFunc3(DWORD64 tppFunc2Addr, bool showTPPModel) {
PlayerObjProperties* playerObjProperties = PlayerObjProperties::Get(); PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!playerObjProperties) { if (!pPlayerDI_PH) {
ShowTPPModelFunc3Hook.pOriginal(tppFunc2Addr, showTPPModel); ShowTPPModelFunc3Hook.pOriginal(tppFunc2Addr, showTPPModel);
return; return;
} }
if (!showTPPModel && prevUseTPPModel) { if (!showTPPModel && prevUseTPPModel) {
playerObjProperties->enableTPPModel2 = true; pPlayerDI_PH->enableTPPModel2 = true;
playerObjProperties->enableTPPModel1 = true; pPlayerDI_PH->enableTPPModel1 = true;
} }
ShowTPPModelFunc3Hook.pOriginal(tppFunc2Addr, showTPPModel); ShowTPPModelFunc3Hook.pOriginal(tppFunc2Addr, showTPPModel);
if (showTPPModel && prevUseTPPModel) { if (showTPPModel && prevUseTPPModel) {
playerObjProperties->enableTPPModel2 = false; pPlayerDI_PH->enableTPPModel2 = false;
playerObjProperties->enableTPPModel1 = false; pPlayerDI_PH->enableTPPModel1 = false;
} else } else
prevUseTPPModel = showTPPModel; prevUseTPPModel = showTPPModel;
} }

View File

@ -1,7 +1,7 @@
#include <pch.h> #include <pch.h>
#include "..\offsets.h" #include "..\offsets.h"
#include "GameDI_PH.h" #include "GameDI_PH.h"
#include "PlayerObjProperties.h" #include "PlayerDI_PH.h"
namespace GamePH { namespace GamePH {
const DWORD GetCurrentGameVersion() { const DWORD GetCurrentGameVersion() {
@ -59,8 +59,8 @@ namespace GamePH {
void(*pShowTPPModelFunc3)(DWORD64 tppFunc2Addr, bool showTPPModel) = (decltype(pShowTPPModelFunc3))Offsets::Get_ShowTPPModelFunc3(); void(*pShowTPPModelFunc3)(DWORD64 tppFunc2Addr, bool showTPPModel) = (decltype(pShowTPPModelFunc3))Offsets::Get_ShowTPPModelFunc3();
if (!pShowTPPModelFunc3) if (!pShowTPPModelFunc3)
return; return;
PlayerObjProperties* playerObjProperties = PlayerObjProperties::Get(); PlayerDI_PH* pPlayerDI_PH = PlayerDI_PH::Get();
if (!playerObjProperties) if (!pPlayerDI_PH)
return; return;
pShowTPPModelFunc3(tppFunc2Addr, showTPPModel); pShowTPPModelFunc3(tppFunc2Addr, showTPPModel);

View File

@ -180,7 +180,6 @@ namespace Menu {
lensDistortionJustEnabled = false; lensDistortionJustEnabled = false;
} }
GamePH::PlayerVariables::ChangePlayerVar("FOVCorrection", goProMode.GetValue() ? (altLensDistortion / 100.0f) : (lensDistortion / 100.0f)); GamePH::PlayerVariables::ChangePlayerVar("FOVCorrection", goProMode.GetValue() ? (altLensDistortion / 100.0f) : (lensDistortion / 100.0f));
GamePH::PlayerVariables::ManagePlayerVarOption("HeadBobFactor", 1.25f, 1.0f, &goProMode, true);
GamePH::PlayerVariables::ManagePlayerVarOption("SprintHeadCorrectionFactor", 0.0f, baseSprintHeadCorrectionFactor, goProMode.GetValue() ? &goProMode : &disableHeadCorrection, true); GamePH::PlayerVariables::ManagePlayerVarOption("SprintHeadCorrectionFactor", 0.0f, baseSprintHeadCorrectionFactor, goProMode.GetValue() ? &goProMode : &disableHeadCorrection, true);
} }

View File

@ -11,6 +11,7 @@ namespace Menu {
float time = 0.0f; float time = 0.0f;
static float timeBeforeFreeze = 0.0f; static float timeBeforeFreeze = 0.0f;
float gameSpeed = 1.0f; float gameSpeed = 1.0f;
static bool isModifyingGameSpeed = false;
static float actualGameSpeed = gameSpeed; static float actualGameSpeed = gameSpeed;
static float gameSpeedBeforeSlowMo = gameSpeed; static float gameSpeedBeforeSlowMo = gameSpeed;
KeyBindOption freezeTime{ VK_NONE }; KeyBindOption freezeTime{ VK_NONE };
@ -89,7 +90,7 @@ namespace Menu {
if (freezeTime.GetValue() && !Utils::Values::are_samef(time, timeBeforeFreeze, 0.0095f)) if (freezeTime.GetValue() && !Utils::Values::are_samef(time, timeBeforeFreeze, 0.0095f))
dayNightCycle->SetDaytime(timeBeforeFreeze); dayNightCycle->SetDaytime(timeBeforeFreeze);
if (!menuToggle.GetValue() || Menu::currentTabIndex != World::Tab::tabIndex) { if (!isModifyingGameSpeed) {
if (!slowMotion.GetValue() && !slowMotion.HasChanged() && !Utils::Values::are_samef(gameSpeed, 1.0f)) if (!slowMotion.GetValue() && !slowMotion.HasChanged() && !Utils::Values::are_samef(gameSpeed, 1.0f))
iLevel->TimerSetSpeedUp(gameSpeed); iLevel->TimerSetSpeedUp(gameSpeed);
actualGameSpeed = iLevel->TimerGetSpeedUp(); actualGameSpeed = iLevel->TimerGetSpeedUp();
@ -110,8 +111,7 @@ namespace Menu {
timeBeforeFreeze = time; timeBeforeFreeze = time;
dayNightCycle->SetDaytime(time); dayNightCycle->SetDaytime(time);
} } else if (iLevel && iLevel->IsLoaded() && dayNightCycle) {
else if (iLevel && iLevel->IsLoaded() && dayNightCycle) {
if (!haveResetAntizinDrainBlocked) { if (!haveResetAntizinDrainBlocked) {
GamePH::PlayerVariables::ChangePlayerVar("AntizinDrainBlocked", previousAntizinDrainBlocked); GamePH::PlayerVariables::ChangePlayerVar("AntizinDrainBlocked", previousAntizinDrainBlocked);
haveResetAntizinDrainBlocked = true; haveResetAntizinDrainBlocked = true;
@ -119,13 +119,9 @@ namespace Menu {
} }
ImGui::BeginDisabled(slowMotion.GetValue()); { ImGui::BeginDisabled(slowMotion.GetValue()); {
if (ImGui::SliderFloat("Game Speed", &gameSpeed, 0.0f, 2.0f, "%.2fx")) isModifyingGameSpeed = ImGui::SliderFloat("Game Speed", &gameSpeed, 0.0f, 2.0f, "%.2fx");
if (isModifyingGameSpeed)
iLevel->TimerSetSpeedUp(gameSpeed); iLevel->TimerSetSpeedUp(gameSpeed);
else if (iLevel && iLevel->IsLoaded()) {
if (!slowMotion.GetValue() && !slowMotion.HasChanged() && !Utils::Values::are_samef(gameSpeed, 1.0f))
iLevel->TimerSetSpeedUp(gameSpeed);
actualGameSpeed = iLevel->TimerGetSpeedUp();
}
ImGui::EndDisabled(); ImGui::EndDisabled();
} }