diff --git a/EGameTools/source/game/GamePH/game_hooks.cpp b/EGameTools/source/game/GamePH/game_hooks.cpp index e321cfa..d67c5ae 100644 --- a/EGameTools/source/game/GamePH/game_hooks.cpp +++ b/EGameTools/source/game/GamePH/game_hooks.cpp @@ -219,6 +219,10 @@ namespace GamePH { prevFreeCam = false; return 0; } + if (Menu::Teleport::waypointIsSet && !*Menu::Teleport::waypointIsSet && Menu::Teleport::justTeleportedToWaypoint) { + Menu::Teleport::justTeleportedToWaypoint = false; + return 0; + } if (Menu::Player::godMode.GetValue()) return 0; @@ -278,7 +282,7 @@ namespace GamePH { DWORD64 result = SetNewWaypointLocationHook.pOriginal(pLogicalPlayer, a2, newWaypointLoc); Menu::Teleport::waypointCoords = *newWaypointLoc; if (Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr()) { - const UINT offset = *Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr(); + const DWORD offset = *Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr(); Menu::Teleport::waypointIsSet = reinterpret_cast(pLogicalPlayer + offset); } return result; diff --git a/EGameTools/source/menu/teleport.cpp b/EGameTools/source/menu/teleport.cpp index 9d37877..f5be212 100644 --- a/EGameTools/source/menu/teleport.cpp +++ b/EGameTools/source/menu/teleport.cpp @@ -16,6 +16,7 @@ namespace Menu { Vector3 waypointCoords{}; bool* waypointIsSet = nullptr; + bool justTeleportedToWaypoint = false; static Vector3 teleportCoords{}; KeyBindOption teleportToSelectedLocation{ VK_F9 }; @@ -130,38 +131,40 @@ namespace Menu { teleportCoords = playerCharacter->playerPos; } } - static void TeleportPlayerTo(const Vector3& pos) { + static bool TeleportPlayerTo(const Vector3& pos) { if (isTeleportationDisabled()) - return; + return false; if (pos.isDefault()) - return; + return false; Engine::CBulletPhysicsCharacter* playerCharacter = Engine::CBulletPhysicsCharacter::Get(); if (Player::freezePlayer.GetValue()) { if (!playerCharacter) - return; + return false; playerCharacter->posBeforeFreeze = pos; playerCharacter->MoveCharacter(pos); } else if (Camera::freeCam.GetValue()) { GamePH::FreeCamera* freeCam = GamePH::FreeCamera::Get(); if (!freeCam) - return; + return false; Vector3 camPos{}; freeCam->GetPosition(&camPos); if (camPos.isDefault()) - return; + return false; // need to implement camera teleportation here :( } else { if (!playerCharacter) - return; + return false; playerCharacter->MoveCharacter(pos); } + + return true; } static void UpdateTeleportPos() { @@ -202,7 +205,7 @@ namespace Menu { teleportToSelectedLocation.SetPrevValue(teleportToSelectedLocation.GetValue()); } if (teleportToWaypoint.HasChanged()) { - TeleportPlayerTo(waypointCoords); + justTeleportedToWaypoint = TeleportPlayerTo(waypointCoords); teleportToWaypoint.SetPrevValue(teleportToWaypoint.GetValue()); } if (teleportToCoords.HasChanged()) { @@ -391,7 +394,7 @@ namespace Menu { ImGui::PopItemWidth(); if (ImGui::ButtonHotkey("Teleport to Waypoint", &teleportToWaypoint, "Teleports player to waypoint.\nWARNING: If the waypoint is selected to track an object/item on the map, Teleport to Waypoint will not work, if so just set the waypoint nearby instead.\nWARNING: Your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation") && waypointIsSet && *waypointIsSet) - TeleportPlayerTo(waypointCoords); + justTeleportedToWaypoint = TeleportPlayerTo(waypointCoords); ImGui::SameLine(); if (ImGui::ButtonHotkey("Teleport to Coords", &teleportToCoords, "Teleports player to the coords specified in the input boxes above")) TeleportPlayerTo(teleportCoords); diff --git a/EGameTools/source/menu/teleport.h b/EGameTools/source/menu/teleport.h index 952f5a0..7c2e12d 100644 --- a/EGameTools/source/menu/teleport.h +++ b/EGameTools/source/menu/teleport.h @@ -11,11 +11,12 @@ namespace Menu { extern std::vector savedTeleportLocations; extern Vector3 waypointCoords; + extern bool* waypointIsSet; + extern bool justTeleportedToWaypoint; extern KeyBindOption teleportToSelectedLocation; extern KeyBindOption teleportToCoords; extern KeyBindOption teleportToWaypoint; - extern bool* waypointIsSet; extern void UpdateTeleportLocationVisualNames(); extern std::vector ParseTeleportLocations(const std::string& input); diff --git a/EGameTools/source/offsets.h b/EGameTools/source/offsets.h index 5d61189..f60f3e1 100644 --- a/EGameTools/source/offsets.h +++ b/EGameTools/source/offsets.h @@ -101,7 +101,7 @@ struct Offsets { AddOffset(PlayerGetInventoryMoney, "gamedll_ph_x64_rwdi.dll", "8B C2 48 8B 44 C1", Utils::SigScan::PatternType::Address, LPVOID) AddOffset(HandleInventoryItemsAmount, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 8B 29", Utils::SigScan::PatternType::Address, LPVOID) AddOffset(SetNewWaypointLocation, "gamedll_ph_x64_rwdi.dll", "85 D2 78 ?? 48 89 74 24 ?? 57 48 83 EC ?? 49 8B F8", Utils::SigScan::PatternType::Address, LPVOID) - AddOffset(SetNewWaypointLocationWaypointIsSetBoolInstr, "gamedll_ph_x64_rwdi.dll", "C6 84 33 [?? ?? ?? ?? 01 48 8B 5C 24", Utils::SigScan::PatternType::Address, DWORD64*) + AddOffset(SetNewWaypointLocationWaypointIsSetBoolInstr, "gamedll_ph_x64_rwdi.dll", "C6 84 33 [?? ?? ?? ?? 01 48 8B 5C 24", Utils::SigScan::PatternType::Address, DWORD*) //AddOffset(CompareAndUpdateFloat, "gamedll_ph_x64_rwdi.dll", "0F 2F C1 73 ?? 0F 28 C1 C3", Utils::SigScan::PatternType::Address, LPVOID) //AddOffset(HandlePlayerImmunity, "gamedll_ph_x64_rwdi.dll", "48 8B C4 53 56 57 41 56 41 57", Utils::SigScan::PatternType::Address, LPVOID) //AddOffset(HandlePlayerImmunity2, "gamedll_ph_x64_rwdi.dll", "40 55 56 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B F1 45 0F B6 F0", Utils::SigScan::PatternType::Address, LPVOID)