mirror of
https://github.com/EricPlayZ/EGameTools.git
synced 2025-07-18 17:37:53 +08:00
- Fixed player dying from switching FreeCam off after flying to high altitudes/through walls with “Teleport Player to Camera” option
This commit is contained in:
@ -40,6 +40,7 @@
|
||||
<ClCompile Include="source\game\GamePH\LocalClientDI.cpp" />
|
||||
<ClCompile Include="source\game\GamePH\LogicalPlayer.cpp" />
|
||||
<ClCompile Include="source\game\GamePH\Other.cpp" />
|
||||
<ClCompile Include="source\game\GamePH\PlayerDI_PH.cpp" />
|
||||
<ClCompile Include="source\game\GamePH\PlayerHealthModule.cpp" />
|
||||
<ClCompile Include="source\game\GamePH\PlayerObjProperties.cpp" />
|
||||
<ClCompile Include="source\game\GamePH\PlayerState.cpp" />
|
||||
@ -129,6 +130,7 @@
|
||||
<ClInclude Include="source\game\GamePH\LocalClientDI.h" />
|
||||
<ClInclude Include="source\game\GamePH\LogicalPlayer.h" />
|
||||
<ClInclude Include="source\game\GamePH\Other.h" />
|
||||
<ClInclude Include="source\game\GamePH\PlayerDI_PH.h" />
|
||||
<ClInclude Include="source\game\GamePH\PlayerHealthModule.h" />
|
||||
<ClInclude Include="source\game\GamePH\PlayerObjProperties.h" />
|
||||
<ClInclude Include="source\game\GamePH\PlayerState.h" />
|
||||
|
@ -176,6 +176,9 @@
|
||||
<Filter>game\GamePH\TimeWeather</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch\pch.cpp" />
|
||||
<ClCompile Include="source\game\GamePH\PlayerDI_PH.cpp">
|
||||
<Filter>game\GamePH</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="source\kiero.h" />
|
||||
@ -378,6 +381,9 @@
|
||||
<Filter>game\Engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\changelog.h" />
|
||||
<ClInclude Include="source\game\GamePH\PlayerDI_PH.h">
|
||||
<Filter>game\GamePH</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="MinHook">
|
||||
|
@ -16,6 +16,7 @@ R"(- You can now load custom mod files from "EGameTools\UserModFiles"! Please re
|
||||
- Added "Game Speed" slider (World)
|
||||
- Added "Slow Motion" (World)
|
||||
|
||||
- Fixed having FreeCam enabled while in the Map view would cause a weird offset of the entire Map view)" }
|
||||
- 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 <EFBFBD>Teleport Player to Camera<EFBFBD> option)" }
|
||||
};
|
||||
}
|
@ -1,13 +1,20 @@
|
||||
#pragma once
|
||||
#include <WTypesbase.h>
|
||||
#include "..\buffer.h"
|
||||
|
||||
namespace GamePH {
|
||||
namespace TimeWeather {
|
||||
class CSystem;
|
||||
}
|
||||
|
||||
class PlayerDI_PH;
|
||||
|
||||
class LevelDI {
|
||||
public:
|
||||
union {
|
||||
buffer<0x160, PlayerDI_PH*> pPlayerDI_PH;
|
||||
};
|
||||
|
||||
bool IsLoading();
|
||||
bool IsLoaded();
|
||||
LPVOID GetViewCamera();
|
||||
|
30
DL2GameOverhaulScript/source/game/GamePH/PlayerDI_PH.cpp
Normal file
30
DL2GameOverhaulScript/source/game/GamePH/PlayerDI_PH.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <pch.h>
|
||||
#include "..\offsets.h"
|
||||
#include "LevelDI.h"
|
||||
#include "PlayerDI_PH.h"
|
||||
|
||||
namespace GamePH {
|
||||
bool PlayerDI_PH::IsInAir() {
|
||||
bool(*pIsInAir)(LPVOID instance) = (decltype(pIsInAir))Offsets::Get_IsInAir();
|
||||
if (!pIsInAir)
|
||||
return false;
|
||||
|
||||
return pIsInAir(this);
|
||||
}
|
||||
|
||||
PlayerDI_PH* PlayerDI_PH::Get() {
|
||||
__try {
|
||||
LevelDI* iLevel = LevelDI::Get();
|
||||
if (!iLevel)
|
||||
return nullptr;
|
||||
|
||||
PlayerDI_PH* ptr = iLevel->pPlayerDI_PH;
|
||||
if (!Utils::Memory::IsValidPtrMod(ptr, "gamedll_ph_x64_rwdi.dll"))
|
||||
return nullptr;
|
||||
|
||||
return ptr;
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
11
DL2GameOverhaulScript/source/game/GamePH/PlayerDI_PH.h
Normal file
11
DL2GameOverhaulScript/source/game/GamePH/PlayerDI_PH.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "..\buffer.h"
|
||||
|
||||
namespace GamePH {
|
||||
class PlayerDI_PH {
|
||||
public:
|
||||
bool IsInAir();
|
||||
|
||||
static PlayerDI_PH* Get();
|
||||
};
|
||||
}
|
@ -2,9 +2,12 @@
|
||||
#include "..\buffer.h"
|
||||
|
||||
namespace GamePH {
|
||||
class PlayerDI_PH;
|
||||
|
||||
class PlayerHealthModule {
|
||||
public:
|
||||
union {
|
||||
buffer<0x8, PlayerDI_PH*> pPlayerDI_PH;
|
||||
buffer<0x2C, float> health;
|
||||
buffer<0x3C, float> maxHealth;
|
||||
};
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "GameDI_PH2.h"
|
||||
#include "LevelDI.h"
|
||||
#include "PlayerHealthModule.h"
|
||||
#include "PlayerDI_PH.h"
|
||||
#include "gen_TPPModel.h"
|
||||
|
||||
namespace GamePH {
|
||||
@ -160,5 +161,21 @@ namespace GamePH {
|
||||
return PlaySoundEventHook.pOriginal(pCoAudioEventControl, name, a3);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CalculateFallHeight
|
||||
static DWORD64 detourCalculateFallHeight(LPVOID pInstance, float height);
|
||||
static Utils::Hook::MHook<LPVOID, DWORD64(*)(LPVOID, float)> CalculateFallHeightHook{ "CalculateFallHeight", &Offsets::Get_CalculateFallHeight, &detourCalculateFallHeight };
|
||||
|
||||
static DWORD64 detourCalculateFallHeight(LPVOID pInstance, float height) {
|
||||
static bool prevFreeCam = Menu::Camera::freeCam.GetPrevValue();
|
||||
prevFreeCam = Menu::Camera::freeCam.GetPrevValue();
|
||||
if (!Menu::Camera::freeCam.GetValue() && prevFreeCam) {
|
||||
prevFreeCam = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return CalculateFallHeightHook.pOriginal(pInstance, height);
|
||||
}
|
||||
#pragma endregion
|
||||
}
|
||||
}
|
@ -31,8 +31,8 @@ namespace Menu {
|
||||
KeyBindOption disablePhotoModeLimits{ VK_NONE };
|
||||
KeyBindOption disableSafezoneFOVReduction{ VK_NONE };
|
||||
|
||||
static const int baseFOV = 57;
|
||||
static const float baseSafezoneFOVReduction = -10.0f;
|
||||
static constexpr int baseFOV = 57;
|
||||
static constexpr float baseSafezoneFOVReduction = -10.0f;
|
||||
|
||||
static void UpdateFOV() {
|
||||
if (menuToggle.GetValue())
|
||||
@ -60,6 +60,7 @@ namespace Menu {
|
||||
if (!pFreeCam)
|
||||
return;
|
||||
|
||||
static bool prevFreeCam = freeCam.GetValue();
|
||||
if (freeCam.GetValue() && !iLevel->IsTimerFrozen()) {
|
||||
if (viewCam == pFreeCam) {
|
||||
pFreeCam->enableSpeedMultiplier1 = true;
|
||||
@ -91,12 +92,10 @@ namespace Menu {
|
||||
|
||||
pGameDI_PH->TogglePhotoMode();
|
||||
pFreeCam->AllowCameraMovement(2);
|
||||
|
||||
freeCam.SetPrevValue(true);
|
||||
} else {
|
||||
Engine::Hooks::switchedFreeCamByGamePause = freeCam.GetValue() && iLevel->IsTimerFrozen();
|
||||
|
||||
if (freeCam.GetPrevValue()) {
|
||||
if (prevFreeCam) {
|
||||
pFreeCam->enableSpeedMultiplier1 = false;
|
||||
pFreeCam->speedMultiplier = 0.1f;
|
||||
}
|
||||
@ -105,9 +104,9 @@ namespace Menu {
|
||||
|
||||
pGameDI_PH->TogglePhotoMode();
|
||||
pFreeCam->AllowCameraMovement(0);
|
||||
|
||||
freeCam.SetPrevValue(false);
|
||||
}
|
||||
|
||||
prevFreeCam = freeCam.GetValue();
|
||||
}
|
||||
static void UpdateTPPModel() {
|
||||
GamePH::LevelDI* iLevel = GamePH::LevelDI::Get();
|
||||
|
@ -106,20 +106,25 @@ namespace Menu {
|
||||
ImGui::SeparatorTextColored("Menu Sliders", IM_COL32(200, 0, 0, 255));
|
||||
ImGui::NewLine();
|
||||
ImGui::TextCentered("To manually change the value of a slider option, hold \"CTRL\" while clicking the slider.");
|
||||
ImGui::TextCentered("This will let you input a value manually into the slider, which can even surpass the option's slider limit, given I allowed the option to do so.");
|
||||
ImGui::TextCentered("This will let you input a value manually into the slider, which can also go beyond the option's slider limit, given I allow the option to do so.");
|
||||
|
||||
ImGui::SeparatorTextColored("Custom File Loading", IM_COL32(200, 0, 0, 255));
|
||||
ImGui::NewLine();
|
||||
ImGui::TextCentered("The mod always creates a folder \"EGameTools\\UserModFiles\" inside the same folder as the game executable (exe) or in the same folder as the mod file.");
|
||||
ImGui::TextCentered("This folder is used for custom file loading. This has only been tested with a few mods that change some .scr files, gpufx files, and other files included inside .pak game archives, or files like .rpack files.");
|
||||
ImGui::TextCentered("Files in this folder must have the same names as the ones from the game files, otherwise the game won't know it should load those files. Files in subfolders of the \"EGameTools\\UserModFiles\" folder will automatically be detected, so you can sort all your mods in different folders!");
|
||||
ImGui::Spacing(ImVec2(0.0f, 5.0f));
|
||||
ImGui::TextCentered("The game will reload a lot of the files upon a load of your savegame, so if you want to edit those files and reload them without having to restart the game, just reload your savegame and the game should automatically reload most of those files!");
|
||||
ImGui::TextCentered("Just make sure that if you add new, additional files while you're in-game, please wait AT LEAST 5 seconds before reloading your savegame, otherwise additional files will not get detected.");
|
||||
ImGui::TextCentered("Also, if there are multiple files of the same exact name, the game will pick the first instance of that file it finds in the folder.");
|
||||
ImGui::Spacing(ImVec2(0.0f, 5.0f));
|
||||
ImGui::TextCentered("The gist of it is, you now don't have to use dataX.pak mods anymore! You can open the pak files, extract their files in the \"EGameTools\\UserModFiles\" folder and start the game!");
|
||||
ImGui::Spacing(ImVec2(0.0f, 5.0f));
|
||||
ImGui::TextCentered("Please try not to touch \"EGameTools\\DefaultModFiles\"! Those are mods that come with EGameTools by default, and you should only ever touch those if I can't update them in time to make them work with the latest game version.");
|
||||
ImGui::TextCenteredColored("FOR MOD DEVELOPERS", IM_COL32(200, 0, 0, 255));
|
||||
ImGui::TextCentered("If you want to make mods for EGameTools to load, please try to use as few folders as you possibly can. For example, your mod should only have one folder, something like \"EGameTools\\UserModFiles\\2019 Weather Mod\".");
|
||||
ImGui::TextCentered("The reason is, my mod continuously checks for new files in the directory, and many folders can slow down the process, and therefore slow down game loading times. So just keep this in mind!");
|
||||
ImGui::Spacing(ImVec2(0.0f, 5.0f));
|
||||
ImGui::TextCentered("If you want to officially include one of your mods as part of EGameTools, please contact me on NexusMods or on Discord (@EricPlayZ).");
|
||||
|
||||
ImGui::SeparatorTextColored("Game Variables Reloading", IM_COL32(200, 0, 0, 255));
|
||||
ImGui::NewLine();
|
||||
|
@ -63,6 +63,10 @@ struct Offsets {
|
||||
AddOffset(IsNotOutOfBounds, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 4C 8B F9 48 85 D2", Utils::SigScan::PatternType::Address, LPVOID)
|
||||
AddOffset(ReloadJumps, "gamedll_ph_x64_rwdi.dll", "48 83 EC ?? E8 ?? ?? ?? ?? 48 8D 15", Utils::SigScan::PatternType::Address, LPVOID)
|
||||
AddOffset(PlaySoundEvent, "gamedll_ph_x64_rwdi.dll", "4C 8B DC 49 89 5B ?? 49 89 73 ?? 57 48 81 EC ?? ?? ?? ?? 4C 8B 4C 24 ?? 48 8B F9 4D 8B D0 66 C7 84 24 ?? ?? ?? ?? ?? ?? 49 8B C1 66 C7 84 24", Utils::SigScan::PatternType::Address, LPVOID)
|
||||
AddOffset(CalculateFallHeight, "gamedll_ph_x64_rwdi.dll", "40 55 56 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 44 0F 29 9C 24", Utils::SigScan::PatternType::Address, LPVOID)
|
||||
//AddOffset(HandleFallHeight, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 0F B6 FA 48 8B D9 0F B6 91", Utils::SigScan::PatternType::Address, LPVOID)
|
||||
//AddOffset(HandlePlayerFall, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 57 48 83 EC ?? 0F 29 74 24 ?? 48 8B FA 0F 28 F2", Utils::SigScan::PatternType::Address, LPVOID)
|
||||
AddOffset(IsInAir, "gamedll_ph_x64_rwdi.dll", "40 53 48 83 EC ?? 83 B9 ?? ?? ?? ?? ?? 48 8B D9 75 ?? 8B 15", Utils::SigScan::PatternType::Address, LPVOID)
|
||||
//AddOffset(GetTimeWeatherSystem, "engine_x64_rwdi.dll", "E8 [?? ?? ?? ?? 33 D2 48 8B C8 E8 ?? ?? ?? ?? 49 8D 4F 38", PatternType::RelativePointer, LPVOID)
|
||||
//AddOffset(SetForcedWeather, "engine_x64_rwdi.dll", "89 51 68 C3 CC CC CC CC CC CC CC CC CC CC CC CC", PatternType::Address, LPVOID)
|
||||
//AddOffset(GetCurrentWeather, "engine_x64_rwdi.dll", "48 8B 41 78 48 85 C0 75 0F", PatternType::Address, LPVOID)
|
||||
|
Reference in New Issue
Block a user