diff --git a/TempleWare-External/source/features/fov.cpp b/TempleWare-External/source/features/fov.cpp index 9ccf363..12fbc53 100644 --- a/TempleWare-External/source/features/fov.cpp +++ b/TempleWare-External/source/features/fov.cpp @@ -1,22 +1,32 @@ #include "fov.h" #include "../globals/globals.h" #include "../offsets/offsets.h" +#include + +namespace features +{ + void FOVManager::AdjustFOV(const Memory& memory) noexcept + { + if (globals::lastFOV != globals::FOV) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + globals::lastFOV = globals::FOV; -namespace features { - void FOVManager::AdjustFOV(const Memory& memory) noexcept { std::uintptr_t localPlayer = memory.Read(globals::client + offsets::dwLocalPlayerPawn); - if (!localPlayer) return; + if (!localPlayer) + return; std::uintptr_t cameraServices = memory.Read(localPlayer + offsets::m_pCameraServices); - if (!cameraServices) return; + if (!cameraServices) + return; std::uint16_t currentFov = memory.Read(cameraServices + offsets::m_iFOV); bool isScoped = memory.Read(localPlayer + offsets::m_bIsScoped); + std::uint16_t desiredFov = static_cast(globals::lastFOV); - std::uint16_t desiredFov = static_cast(globals::FOV); - - if (!isScoped && currentFov != desiredFov) { + if (!isScoped && currentFov != desiredFov) memory.Write(cameraServices + offsets::m_iFOV, desiredFov); - } } } diff --git a/TempleWare-External/source/features/glow.cpp b/TempleWare-External/source/features/glow.cpp index 5c5da8e..8092262 100644 --- a/TempleWare-External/source/features/glow.cpp +++ b/TempleWare-External/source/features/glow.cpp @@ -4,59 +4,50 @@ #include namespace features { - void Glow::Run(const Memory& memory) noexcept { - if (!globals::Glow) - return; + void Glow::Run(const Memory& memory) noexcept + { + if (!globals::Glow) return; const uintptr_t localPlayerController = memory.Read(globals::client + offsets::dwLocalPlayerController); - if (!localPlayerController) - return; - - int localTeam = memory.Read(localPlayerController + offsets::m_iTeamNum); - - for (int i = 1; i < 64; i++) { - uintptr_t entityList = memory.Read(globals::client + offsets::dwEntityList); - if (!entityList) - continue; - - uintptr_t listEntry = memory.Read(entityList + (8 * (i & 0x7FFF) >> 9) + 16); - if (!listEntry) - continue; - - uintptr_t player = memory.Read(listEntry + 120 * (i & 0x1FF)); - if (!player) - continue; - - int playerTeam = memory.Read(player + offsets::m_iTeamNum); - if (playerTeam == localTeam) - continue; - - uint32_t playerPawn = memory.Read(player + offsets::m_hPlayerPawn); - if (!playerPawn) - continue; - - uintptr_t listEntry2 = memory.Read(entityList + 0x8 * ((playerPawn & 0x7FFF) >> 9) + 16); - if (!listEntry2) - continue; - - uintptr_t playerCsPawn = memory.Read(listEntry2 + 120 * (playerPawn & 0x1FF)); - if (!playerCsPawn) - continue; - - int health = memory.Read(playerCsPawn + offsets::m_iHealth); - if (health < 1) - continue; - - ImVec4 color = globals::GlowColor; - DWORD colorArgb = ( - ((DWORD)(color.w * 255) << 24) | - ((DWORD)(color.z * 255) << 16) | - ((DWORD)(color.y * 255) << 8) | - (DWORD)(color.x * 255) + if (!localPlayerController) return; + + const int localTeam = memory.Read(localPlayerController + offsets::m_iTeamNum); + const uintptr_t entityList = memory.Read(globals::client + offsets::dwEntityList); + if (!entityList) return; + + for (int i = 1; i < 64; ++i) { + const uintptr_t listEntry = memory.Read(entityList + ((8 * (i & 0x7FFF)) >> 9) + 16); + if (!listEntry) continue; + + const uintptr_t player = memory.Read(listEntry + 120 * (i & 0x1FF)); + if (!player) continue; + + const int playerTeam = memory.Read(player + offsets::m_iTeamNum); + if (playerTeam == localTeam) continue; + + const uint32_t playerPawn = memory.Read(player + offsets::m_hPlayerPawn); + if (!playerPawn) continue; + + const uintptr_t listEntry2 = memory.Read(entityList + ((8 * (playerPawn & 0x7FFF)) >> 9) + 16); + if (!listEntry2) continue; + + const uintptr_t playerCsPawn = memory.Read(listEntry2 + 120 * (playerPawn & 0x1FF)); + if (!playerCsPawn) continue; + + const int health = memory.Read(playerCsPawn + offsets::m_iHealth); + if (health < 1) continue; + + const ImVec4& color = globals::GlowColor; + const DWORD colorArgb = ( + (static_cast(color.w * 255) << 24) | + (static_cast(color.z * 255) << 16) | + (static_cast(color.y * 255) << 8) | + static_cast(color.x * 255) ); - memory.Write(playerCsPawn + offsets::m_Glow + offsets::m_glowColorOverride, colorArgb); - memory.Write(playerCsPawn + offsets::m_Glow + offsets::m_bGlowing, 1); + const uintptr_t glowOffset = playerCsPawn + offsets::m_Glow; + memory.Write(glowOffset + offsets::m_glowColorOverride, colorArgb); + memory.Write(glowOffset + offsets::m_bGlowing, 1); } } -} \ No newline at end of file +} diff --git a/TempleWare-External/source/globals/globals.h b/TempleWare-External/source/globals/globals.h index 4a18c6b..73a48e1 100644 --- a/TempleWare-External/source/globals/globals.h +++ b/TempleWare-External/source/globals/globals.h @@ -19,7 +19,8 @@ namespace globals { inline bool TriggerBotIgnoreFlash = false; // Fov - inline int FOV = 90; + inline int FOV = 90; + inline int lastFOV = 90; // Glow inline bool Glow = false; diff --git a/TempleWare-External/source/main.cpp b/TempleWare-External/source/main.cpp index 8b4adc7..c1544dc 100644 --- a/TempleWare-External/source/main.cpp +++ b/TempleWare-External/source/main.cpp @@ -11,12 +11,8 @@ #include -int __stdcall wWinMain( - HINSTANCE instance, - HINSTANCE previousInstance, - PWSTR arguments, - int commandShow) { - +int __stdcall wWinMain(HINSTANCE instance, HINSTANCE previousInstance, PWSTR arguments, int commandShow) +{ if (!offsets::UpdateOffset()) return EXIT_FAILURE; @@ -34,21 +30,23 @@ int __stdcall wWinMain( bool windowVisible = true; - while (globals::isRunning) { - if (GetAsyncKeyState(VK_END) & 0x8000) { + while (globals::isRunning) + { + if (GetAsyncKeyState(VK_END) & 0x8000) + { windowVisible = !windowVisible; ShowWindow(gui::window, windowVisible ? SW_SHOW : SW_HIDE); std::this_thread::sleep_for(std::chrono::milliseconds(200)); } - if (windowVisible) { + if (windowVisible) + { gui::BeginRender(); gui::Render(); gui::EndRender(); } - else { + else std::this_thread::sleep_for(std::chrono::milliseconds(50)); - } } gui::DestroyImGui(); @@ -56,4 +54,4 @@ int __stdcall wWinMain( gui::DestroyHWindow(); return EXIT_SUCCESS; -} +} \ No newline at end of file diff --git a/TempleWare-External/source/menu/menu.cpp b/TempleWare-External/source/menu/menu.cpp index 4159bf0..b39a400 100644 --- a/TempleWare-External/source/menu/menu.cpp +++ b/TempleWare-External/source/menu/menu.cpp @@ -169,13 +169,19 @@ namespace gui IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); - io.IniFilename = NULL; - ImGui::StyleColorsDark(); + io.Fonts->AddFontDefault(); + (void)io; + + ImFontAtlas* fontAtlas = new ImFontAtlas(); + ImFontConfig arialConfig; + arialConfig.FontDataOwnedByAtlas = false; const char* fontPath = "C:\\Windows\\Fonts\\segoeui.ttf"; float fontSize = 18.0f; - if (!io.Fonts->AddFontFromFileTTF(fontPath, fontSize)) - io.Fonts->AddFontDefault(); + ImFont* arialFont = fontAtlas->AddFontFromFileTTF(fontPath,fontSize, &arialConfig); + io.Fonts = fontAtlas; + + ImGui::StyleColorsDark(); ImGui_ImplWin32_Init(window); ImGui_ImplDX9_Init(device);