- Fixed FOV slider not changing FOV while using FreeCam

This commit is contained in:
EricPlayZ
2024-02-18 03:44:54 +02:00
parent 695fe35e64
commit 94676926d5
9 changed files with 35 additions and 64 deletions

View File

@ -178,7 +178,6 @@
<ClInclude Include="source\utils\files.h" />
<ClInclude Include="source\utils\hook.h" />
<ClInclude Include="source\utils\memory.h" />
<ClInclude Include="source\utils\print.h" />
<ClInclude Include="source\utils\sigscan.h" />
<ClInclude Include="source\utils\texture.h" />
<ClInclude Include="source\utils\time.h" />

View File

@ -261,9 +261,6 @@
<ClInclude Include="source\utils\windows.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="source\utils\print.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="source\utils\time.h">
<Filter>utils</Filter>
</ClInclude>

View File

@ -71,7 +71,6 @@
#include "..\source\utils\files.h"
#include "..\source\utils\hook.h"
#include "..\source\utils\memory.h"
#include "..\source\utils\print.h"
#include "..\source\utils\sigscan.h"
#include "..\source\utils\texture.h"
#include "..\source\utils\time.h"

View File

@ -22,6 +22,7 @@ R"(- You can now load custom mod files from "EGameTools\UserModFiles"! Please re
- Changed "Menu Transparency" to "Menu Opacity"
- Fixed having a weird offset of the entire map view when FreeCam is enabled
- Fixed player dying from switching FreeCam off after flying to high altitudes/through walls with "Teleport Player to Camera" option
- Fixed FOV slider not changing FOV while using FreeCam
That's it for this update! The next few updates will include some more bug fixes rather than new, big features, so stay tuned!)" }
};

View File

@ -4129,14 +4129,14 @@ namespace Config {
inih::INIWriter writer{};
writer.write(configFileName, reader);
} catch (const std::runtime_error& e) {
Utils::PrintError("Error writing file {}: {}", configFileName, e.what());
spdlog::error("Error writing file {}: {}", configFileName, e.what());
}
}
static bool ConfigExists() {
return std::filesystem::exists(configFileName);
}
static void CreateConfig() {
Utils::PrintWarning("{} does not exist (will create now); using default config values", configFileName);
spdlog::warn("{} does not exist (will create now); using default config values", configFileName);
LoadAndWriteDefaultConfig();
}
static void ReadConfig(const bool configUpdate = false) {
@ -4196,9 +4196,9 @@ namespace Config {
}
}
Utils::PrintInfo(configUpdate ? "Successfully read updated config!" : "Successfully read config!");
spdlog::info(configUpdate ? "Successfully read updated config!" : "Successfully read config!");
} catch (const std::runtime_error& e) {
Utils::PrintError("Error writing file {}; using default config values: {}", configFileName, e.what());
spdlog::error("Error writing file {}; using default config values: {}", configFileName, e.what());
LoadDefaultConfig();
}
}
@ -4234,7 +4234,7 @@ namespace Config {
savedConfig = true;
} catch (const std::runtime_error& e) {
Utils::PrintError("Error saving to file {}: {}", configFileName, e.what());
spdlog::error("Error saving to file {}: {}", configFileName, e.what());
}
}
void InitConfig() {

View File

@ -76,9 +76,9 @@ namespace Core {
std::filesystem::remove(entry.path());
}
}
Utils::PrintWarning("Creating game shortcut for \"EGameTools\"");
spdlog::warn("Creating game shortcut for \"EGameTools\"");
std::filesystem::create_directory_symlink(Utils::Files::GetCurrentProcDirectory() + "\\EGameTools", "..\\..\\data\\EGameTools");
Utils::PrintInfo("Game shortcut created");
spdlog::info("Game shortcut created");
}
static void InitLogger() {
@ -112,28 +112,28 @@ namespace Core {
EnableConsole();
InitLogger();
Utils::PrintWarning("Initializing config");
spdlog::warn("Initializing config");
Config::InitConfig();
CreateSymlinkForLoadingFiles();
Utils::PrintWarning("Sorting Player Variables");
spdlog::warn("Sorting Player Variables");
GamePH::PlayerVariables::SortPlayerVars();
Utils::PrintInfo("Player Variables sorted");
spdlog::info("Player Variables sorted");
Utils::PrintWarning("Initializing MinHook");
spdlog::warn("Initializing MinHook");
MH_Initialize();
Utils::PrintInfo("Initialized MinHook");
spdlog::info("Initialized MinHook");
Utils::PrintWarning("Hooking DX11/DX12 renderer");
spdlog::warn("Hooking DX11/DX12 renderer");
std::thread([]() {
LoopHookRenderer();
Utils::PrintInfo("Hooked \"DX11/DX12 renderer\"!");
spdlog::info("Hooked \"DX11/DX12 renderer\"!");
}).detach();
for (auto& hook : *Utils::Hook::HookBase::GetInstances()) {
Utils::PrintWarning("Hooking \"{}\"", hook->name.data());
spdlog::warn("Hooking \"{}\"", hook->name.data());
std::thread([&hook]() {
hook->HookLoop();
Utils::PrintInfo("Hooked \"{}\"!", hook->name.data());
spdlog::info("Hooked \"{}\"!", hook->name.data());
}).detach();
}
@ -146,14 +146,14 @@ namespace Core {
void Cleanup() {
exiting = true;
Utils::PrintWarning("Game requested exit, running cleanup");
Utils::PrintWarning("Saving config to file");
spdlog::warn("Game requested exit, running cleanup");
spdlog::warn("Saving config to file");
Config::SaveConfig();
Utils::PrintInfo("Config saved to file");
spdlog::info("Config saved to file");
Utils::PrintWarning("Unhooking everything");
spdlog::warn("Unhooking everything");
MH_DisableHook(MH_ALL_HOOKS);
MH_Uninitialize();
Utils::PrintInfo("Unhooked everything");
spdlog::info("Unhooked everything");
}
}

View File

@ -75,7 +75,7 @@ namespace Engine {
static std::vector<std::string> cachedUserModDirs{};
static void CacheUserModDirs() {
Utils::PrintWarning("Recaching user mod directories");
spdlog::warn("Recaching user mod directories");
if (!cachedUserModDirs.empty())
cachedUserModDirs.clear();
@ -110,7 +110,7 @@ namespace Engine {
continue;
const char* filePath2 = finalPath.c_str();
Utils::PrintWarning("Loading user mod file \"{}\"", filePath2);
spdlog::warn("Loading user mod file \"{}\"", filePath2);
return FsOpenHook.pOriginal(firstByte != 0x0 ? (reinterpret_cast<DWORD64>(filePath2) | (firstByte << 56)) : reinterpret_cast<DWORD64>(filePath2), a2, a3); // restores first byte of addr if first byte was not 0
}

View File

@ -61,6 +61,9 @@ namespace Menu {
return;
static bool prevFreeCam = freeCam.GetValue();
static bool prevEanbleSpeedMultiplier = pFreeCam->enableSpeedMultiplier1;
static float prevSpeedMultiplier = pFreeCam->speedMultiplier;
static float prevFOV = pFreeCam->FOV;
if (freeCam.GetValue() && !iLevel->IsTimerFrozen()) {
if (viewCam == pFreeCam) {
pFreeCam->enableSpeedMultiplier1 = true;
@ -79,6 +82,7 @@ namespace Menu {
freeCamSpeed = 200.0f;
pFreeCam->speedMultiplier = freeCamSpeed;
pFreeCam->FOV = static_cast<float>(FOV);
if (ImGui::IsKeyDown(ImGuiKey_LeftShift))
pFreeCam->speedMultiplier *= 2.0f;
@ -90,14 +94,19 @@ namespace Menu {
return;
}
prevEanbleSpeedMultiplier = pFreeCam->enableSpeedMultiplier1;
prevSpeedMultiplier = pFreeCam->speedMultiplier;
prevFOV = pFreeCam->FOV;
pGameDI_PH->TogglePhotoMode();
pFreeCam->AllowCameraMovement(2);
} else {
Engine::Hooks::switchedFreeCamByGamePause = freeCam.GetValue() && iLevel->IsTimerFrozen();
if (prevFreeCam) {
pFreeCam->enableSpeedMultiplier1 = false;
pFreeCam->speedMultiplier = 0.1f;
pFreeCam->enableSpeedMultiplier1 = prevEanbleSpeedMultiplier;
pFreeCam->speedMultiplier = prevSpeedMultiplier;
pFreeCam->FOV = prevFOV;
}
if (viewCam != pFreeCam)
return;

View File

@ -1,34 +0,0 @@
#pragma once
#include <Windows.h>
#include <spdlog\logger.h>
namespace Utils {
enum ConsoleColors {
c_black,
c_blue,
c_green,
c_aqua,
c_red,
c_purple,
c_yellow,
c_white,
c_gray,
c_lightblue,
c_lightgreen,
c_lightaqua,
c_lightred,
c_lightpurple,
c_lightyellow,
c_brightwhite
};
template<typename... Args> void PrintError(const std::string f, Args... args) {
spdlog::error(fmt::runtime(f.c_str()), std::forward<Args>(args)...);
}
template<typename... Args> void PrintWarning(const std::string f, Args... args) {
spdlog::warn(fmt::runtime(f.c_str()), std::forward<Args>(args)...);
}
template<typename... Args> void PrintInfo(const std::string f, Args... args) {
spdlog::info(fmt::runtime(f.c_str()), std::forward<Args>(args)...);
}
}