diff --git a/resource/common/locale/English.json b/resource/common/locale/English.json index 26729ba..2e4757b 100644 --- a/resource/common/locale/English.json +++ b/resource/common/locale/English.json @@ -119,8 +119,11 @@ "CopyrightDisclaimer": "Copyright Grinch_ 2019-2022. All rights reserved.", "CPUUsage": "CPU usage: %.2f%%", "Credits": "Credits", + "CurrentVersion" : "Current version", "DiscordRPC": "Discord rich presence", "DiscordServer": "Discord server", + "DownloadPage" : "Download page", + "EnsureLatest" : "Please ensure you have the latest version from GitHub.", "FixVehKey": "Fix current vehicle", "FlipVehKey": "Flip current vehicle", "Frames": "Frames: %d", @@ -133,8 +136,10 @@ "InvalidValue": "Invalid value", "Language": "Language", "LanguageChangeFailed": "Failed to change language!", + "LatestVersion" : "Latest version", "Location": "Location: %s", "Name": "Name", + "NewVersion" : "A new version of the menu is available.", "NoBG": "No background", "OpenCMDKey": "Open/ close command window", "OpenCMDUsing": "Open or close command window using %s", @@ -168,6 +173,8 @@ "TeleportCMDText": "Teleports player to specified coordinates.\nExample: tp x y z", "TextColor": "Text color", "Usage": "Usage", + "UpdaterInfo1": "It's highly recommanded to update to the latest version. Newer version contains new features and bug fixes.", + "UpdaterInfo2": "To know what changes are made or to download, click on the 'Download page' button. Follow the instructions there. If you're still having issues, let me know on discord.", "UsageText": "Left-click selects hotkey.\nLeft clicking outside deselects.\nRight click disables hotkey.", "VehEngineKey": "Toggle vehicle engine", "VehHealth": "Veh Health: %.f", @@ -176,7 +183,8 @@ "VehStartKey": "Vehicle instant start", "VehStopKey": "Vehicle instant start", "Version": "Version", - "WeaponSpawned": "Weapon spawned" + "WeaponSpawned": "Weapon spawned", + "WelcomeMSG": "Welcome to Cheat Menu" }, "Ped": { "Accuracy": "Accuracy", diff --git a/src/cheatmenu.cpp b/src/cheatmenu.cpp index 1c3880c..caa1631 100644 --- a/src/cheatmenu.cpp +++ b/src/cheatmenu.cpp @@ -22,7 +22,7 @@ void CheatMenu::DrawWindow() ImGuiIO& io = ImGui::GetIO(); static bool bRunning = true; - if (BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive)) + if (FrontEndMenuManager.m_bMenuActive) { if (bRunning) { @@ -223,7 +223,7 @@ void CheatMenu::Init() Events::processScriptsEvent += []() { - if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive)) + if (!FrontEndMenuManager.m_bMenuActive) { if (menuOpen.Pressed()) { @@ -310,14 +310,12 @@ void CheatMenu::ShowAnniversaryPage() ImGui::TextWrapped("Feel free to star the GitHub repo or join the discord server and provide feedback, ideas, or suggestions."); ImGui::NewLine(); - if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(2)))) + if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Ui::GetSize(3)))) { ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL); } - ImGui::SameLine(); - - if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(2)))) + if (ImGui::Button(TEXT("Menu.GitHubRepo"), ImVec2(Ui::GetSize(3)))) { ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL); } @@ -332,51 +330,48 @@ void CheatMenu::ShowWelcomePage() { ImGui::NewLine(); - Ui::CenterdText("Welcome to Cheat Menu"); - Ui::CenterdText("Author: Grinch_"); + Ui::CenterdText(TEXT("Menu.WelcomeMSG")); + Ui::CenterdText(std::format("{}: Grinch_",TEXT("Menu.Author"))); ImGui::NewLine(); - ImGui::TextWrapped("Please ensure you have the latest version from GitHub."); + ImGui::TextWrapped(TEXT("Menu.EnsureLatest")); ImGui::NewLine(); - if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(2)))) + if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Ui::GetSize(2)))) { ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL); } - ImGui::SameLine(); - - if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(2)))) + if (ImGui::Button(TEXT("Menu.GitHubRepo"), ImVec2(Ui::GetSize(2)))) { ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL); } - ImGui::NewLine(); - ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know on discord :)"); + ImGui::TextWrapped(TEXT("Menu.BugDisclaimer")); ImGui::Dummy(ImVec2(0, 30)); - Ui::CenterdText("Copyright Grinch_ 2019-2022. All rights reserved."); + Ui::CenterdText(TEXT("Menu.CopyrightDisclaimer")); } void CheatMenu::ShowUpdatePage() { std::string ver = Updater::GetUpdateVersion(); ImGui::Dummy(ImVec2(0, 20)); - Ui::CenterdText("A new version of the menu is available."); - Ui::CenterdText(std::string("Current version: ") + MENU_VERSION); - Ui::CenterdText("Latest version: " + ver); + Ui::CenterdText(TEXT("Menu.NewVersion")); + Ui::CenterdText(std::format("{}: {}", TEXT("Menu.CurrentVersion"), MENU_VERSION)); + Ui::CenterdText(TEXT("Menu.LatestVersion") + ver); ImGui::Dummy(ImVec2(0, 10)); - ImGui::TextWrapped("It's highly recommanded to update to the latest version." - " Newer versions may contain new features and bug fixes."); + ImGui::TextWrapped(TEXT("Menu.UpdaterInfo1")); ImGui::Dummy(ImVec2(0, 10)); - ImGui::TextWrapped("To know what changes are made or to download, click on the 'Download page' button." - " Follow the instructions there. If you're still having issues, let me know on discord."); + ImGui::TextWrapped(TEXT("Menu.UpdaterInfo2")); ImGui::Dummy(ImVec2(0, 5)); - if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(2)))) - ShellExecute(NULL, "open", DISCORD_INVITE, NULL, NULL, SW_SHOWNORMAL); + if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Ui::GetSize(2)))) + { + ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL); + } ImGui::SameLine(); - if (ImGui::Button("Download page", Ui::GetSize(2))) + if (ImGui::Button(TEXT("Menu.DownloadPage"), Ui::GetSize(2))) { ShellExecute(NULL, "open", std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" + ver).c_str(), NULL, NULL, SW_SHOWNORMAL); diff --git a/src/d3dhook.cpp b/src/d3dhook.cpp index 1adb4f3..b302ed0 100644 --- a/src/d3dhook.cpp +++ b/src/d3dhook.cpp @@ -188,7 +188,7 @@ void D3dHook::ProcessMouse() { bMouseDisabled = true; #ifdef GTA3 - pad->m_bDisablePlayerControls = true; + pad->DisablePlayerControls = true; #else pad->DisablePlayerControls = true; #endif @@ -197,7 +197,7 @@ void D3dHook::ProcessMouse() { bMouseDisabled = false; #ifdef GTA3 - pad->m_bDisablePlayerControls = false; + pad->DisablePlayerControls = false; #else pad->DisablePlayerControls = false; #endif @@ -229,8 +229,8 @@ void D3dHook::ProcessMouse() #endif } - CPad::NewMouseControllerState.X = 0; - CPad::NewMouseControllerState.Y = 0; + CPad::NewMouseControllerState.x = 0; + CPad::NewMouseControllerState.y = 0; #ifdef GTA3 CPad::GetPad(0)->ClearMouseHistory(); #else diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 0ff1b9a..76a9fc7 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -12,7 +12,8 @@ void MenuThread(void* param) Doing it like this doesn't prevent from attaching a debugger */ static bool gameStarted = false; - Events::processScriptsEvent +=[]{ + Events::processScriptsEvent +=[] + { gameStarted = true; }; @@ -108,8 +109,8 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) } else { - gLog << "Error: Unknown game version. GTA " << BY_GAME("SA v1.0 US Hoodlum", "VC v1.0 EN", "III v1.0 EN") << " is required." << std::endl; - MessageBox(HWND_DESKTOP, "Unknown game version. GTA " BY_GAME("SA v1.0 US Hoodlum", "VC v1.0 EN", "III v1.0 EN") " is required.", "CheatMenu", MB_ICONERROR); + gLog << "Error: Unknown game version. GTA " << BY_GAME("SA v1.0 US Hoodlum or Compact", "VC v1.0 EN", "III v1.0 EN") << " is required." << std::endl; + MessageBox(HWND_DESKTOP, "Unknown game version. GTA " BY_GAME("SA v1.0 US Hoodlum or Compact", "VC v1.0 EN", "III v1.0 EN") " is required.", "CheatMenu", MB_ICONERROR); } } diff --git a/src/game.cpp b/src/game.cpp index 0930f61..de253e3 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -240,12 +240,7 @@ void Game::FreeCam() m_Freecam::m_bRadarState = patch::Get(BY_GAME(0xBA676C, 0xA10AB6, NULL)); // radar CVector playerPos = player->GetPosition(); - -#ifdef GTA3 - CPad::GetPad(0)->m_bDisablePlayerControls = true; -#else CPad::GetPad(0)->DisablePlayerControls = true; -#endif Command(playerPos.x, playerPos.y, playerPos.z, &m_Freecam::m_nPed); m_Freecam::m_pPed = CPools::GetPed(m_Freecam::m_nPed); @@ -270,8 +265,8 @@ void Game::FreeCam() m_Freecam::m_pPed->SetPosition(playerPos); patch::Set(0xA10AB6, 1); // disable radar #else - m_Freecam::m_pPed->m_nEntityFlags.bIsVisible = false; - m_Freecam::m_pPed->m_nEntityFlags.bUsesCollision = false; + m_Freecam::m_pPed->m_nFlags.bIsVisible = false; + m_Freecam::m_pPed->m_nFlags.bUsesCollision = false; m_Freecam::m_pPed->SetPosition(playerPos.x, playerPos.y, playerPos.z); #endif @@ -280,8 +275,8 @@ void Game::FreeCam() CVector pos = m_Freecam::m_pPed->GetPosition(); - m_Freecam::m_fMouse.x = CPad::NewMouseControllerState.X; - m_Freecam::m_fMouse.y = CPad::NewMouseControllerState.Y; + m_Freecam::m_fMouse.x = CPad::NewMouseControllerState.x; + m_Freecam::m_fMouse.y = CPad::NewMouseControllerState.y; m_Freecam::m_fTotalMouse.x = m_Freecam::m_fTotalMouse.x - m_Freecam::m_fMouse.x / 250; m_Freecam::m_fTotalMouse.y = m_Freecam::m_fTotalMouse.y + m_Freecam::m_fMouse.y / 3; @@ -398,11 +393,7 @@ void Game::ClearFreecamStuff() patch::Set(BY_GAME(0xBA6769, 0x86963A, NULL), m_Freecam::m_bHudState); // hud patch::Set(BY_GAME(0xBA676C, 0xA10AB6, NULL), m_Freecam::m_bRadarState); // radar -#ifdef GTA3 - CPad::GetPad(0)->m_bDisablePlayerControls = false; -#else CPad::GetPad(0)->DisablePlayerControls = false; -#endif Command(m_Freecam::m_nPed); m_Freecam::m_pPed = nullptr; @@ -481,14 +472,7 @@ void Game::ShowPage() #ifdef GTASA if (Ui::CheckboxWithHint(TEXT("Game.ForbiddenWantedLevel"), &m_bForbiddenArea, TEXT("Game.ForbiddenWantedLevelText"))) { - if (m_bForbiddenArea) - { - patch::Set(0x441770, 0x83, false); - } - else - { - patch::Set(0x441770, 0xC3, false); - } + patch::Set(0x441770, m_bForbiddenArea ? 0x83 : 0xC3, false); } Ui::CheckboxAddress(TEXT("Game.FreePNS"), 0x96C009); #endif @@ -589,7 +573,7 @@ void Game::ShowPage() } #endif Ui::EditAddress(TEXT("Game.DaysPassed"), BY_GAME(0xB79038, 0x97F1F4, 0x8F2BB8), 0, 9999); - Ui::EditReference(TEXT("Game.FPSLimit"), BY_GAME(RsGlobal.frameLimit, RsGlobal.maxFPS, RsGlobal.maxFPS), 1, 30, 60); + Ui::EditReference(TEXT("Game.FPSLimit"), RsGlobal.frameLimit, 1, 30, 60); #ifdef GTASA if (ImGui::CollapsingHeader(TEXT("Game.Freecam"))) { diff --git a/src/ped.cpp b/src/ped.cpp index 7de0008..f00f290 100644 --- a/src/ped.cpp +++ b/src/ped.cpp @@ -165,11 +165,7 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model) Command(hplayer); } ped->m_nPedFlags.bPedIsBleeding = m_SpawnPed::m_bPedBleed; -#ifdef GTA3 - ped->m_nWepAccuracy = m_SpawnPed::m_nAccuracy; -#else ped->m_nWeaponAccuracy = m_SpawnPed::m_nAccuracy; -#endif ped->m_fHealth = m_SpawnPed::m_nPedHealth; #ifdef GTASA if (m_SpawnPed::m_nWeaponId != 0) diff --git a/src/player.cpp b/src/player.cpp index ceb6a27..469d067 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -12,7 +12,9 @@ static inline void PlayerModelBrokenFix() CPlayerPed* pPlayer = FindPlayerPed(); if (pPlayer->m_nModelIndex == 0) + { Call<0x5A81E0>(0, pPlayer->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false); + } } /* @@ -181,7 +183,7 @@ void Player::Init() player->m_nPhysicalFlags.bCollisionProof = 1; player->m_nPhysicalFlags.bExplosionProof = 1; player->m_nPhysicalFlags.bFireProof = 1; - player->m_nPhysicalFlags.bMeeleProof = 1; + player->m_nPhysicalFlags.bMeleeProof = 1; #elif GTAVC player->m_nFlags.bBulletProof = 1; player->m_nFlags.bCollisionProof = 1; @@ -189,11 +191,11 @@ void Player::Init() player->m_nFlags.bFireProof = 1; player->m_nFlags.bMeleeProof = 1; #else - player->m_nEntityFlags.bBulletProof = m_bGodMode; - player->m_nEntityFlags.bCollisionProof = m_bGodMode; - player->m_nEntityFlags.bExplosionProof = m_bGodMode; - player->m_nEntityFlags.bFireProof = m_bGodMode; - player->m_nEntityFlags.bMeleeProof = m_bGodMode; + player->m_nFlags.bBulletProof = m_bGodMode; + player->m_nFlags.bCollisionProof = m_bGodMode; + player->m_nFlags.bExplosionProof = m_bGodMode; + player->m_nFlags.bFireProof = m_bGodMode; + player->m_nFlags.bMeleeProof = m_bGodMode; #endif } @@ -230,7 +232,7 @@ void Player::Init() player->m_nPhysicalFlags.bCollisionProof = 0; player->m_nPhysicalFlags.bExplosionProof = 0; player->m_nPhysicalFlags.bFireProof = 0; - player->m_nPhysicalFlags.bMeeleProof = 0; + player->m_nPhysicalFlags.bMeleeProof = 0; #elif GTAVC player->m_nFlags.bBulletProof = 0; player->m_nFlags.bCollisionProof = 0; @@ -238,11 +240,11 @@ void Player::Init() player->m_nFlags.bFireProof = 0; player->m_nFlags.bMeleeProof = 0; #else - player->m_nEntityFlags.bBulletProof = m_bGodMode; - player->m_nEntityFlags.bCollisionProof = m_bGodMode; - player->m_nEntityFlags.bExplosionProof = m_bGodMode; - player->m_nEntityFlags.bFireProof = m_bGodMode; - player->m_nEntityFlags.bMeleeProof = m_bGodMode; + player->m_nFlags.bBulletProof = m_bGodMode; + player->m_nFlags.bCollisionProof = m_bGodMode; + player->m_nFlags.bExplosionProof = m_bGodMode; + player->m_nFlags.bFireProof = m_bGodMode; + player->m_nFlags.bMeleeProof = m_bGodMode; #endif m_bGodMode = false; } @@ -417,8 +419,7 @@ void Player::ShowPage() } ImGui::EndDisabled(); #endif - Ui::CheckboxAddress(TEXT("Player.FreeHealthcare"), BY_GAME((int)&pInfo->m_bFreeHealthCare, - (int)&pInfo->m_bFreeHealthCare, (int)&pInfo->m_bGetOutOfHospitalFree)); + Ui::CheckboxAddress(TEXT("Player.FreeHealthcare"), (int)&pInfo->m_bFreeHealthCare); if (Ui::CheckboxWithHint(TEXT("Player.FreezeWL"), &m_bFreezeWantedLevel)) { @@ -451,7 +452,7 @@ void Player::ShowPage() pPlayer->m_nPhysicalFlags.bCollisionProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bExplosionProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bFireProof = m_bGodMode; - pPlayer->m_nPhysicalFlags.bMeeleProof = m_bGodMode; + pPlayer->m_nPhysicalFlags.bMeleeProof = m_bGodMode; #elif GTAVC pPlayer->m_nFlags.bBulletProof = m_bGodMode; pPlayer->m_nFlags.bCollisionProof = m_bGodMode; @@ -459,11 +460,11 @@ void Player::ShowPage() pPlayer->m_nFlags.bFireProof = m_bGodMode; pPlayer->m_nFlags.bMeleeProof = m_bGodMode; #else - pPlayer->m_nEntityFlags.bBulletProof = m_bGodMode; - pPlayer->m_nEntityFlags.bCollisionProof = m_bGodMode; - pPlayer->m_nEntityFlags.bExplosionProof = m_bGodMode; - pPlayer->m_nEntityFlags.bFireProof = m_bGodMode; - pPlayer->m_nEntityFlags.bMeleeProof = m_bGodMode; + pPlayer->m_nFlags.bBulletProof = m_bGodMode; + pPlayer->m_nFlags.bCollisionProof = m_bGodMode; + pPlayer->m_nFlags.bExplosionProof = m_bGodMode; + pPlayer->m_nFlags.bFireProof = m_bGodMode; + pPlayer->m_nFlags.bMeleeProof = m_bGodMode; #endif } Ui::CheckboxWithHint(TEXT("Player.HealthRegen"), &m_bHealthRegen, TEXT("Player.HealthRegenTip")); @@ -472,11 +473,11 @@ void Player::ShowPage() Ui::CheckboxAddress(TEXT("Player.InfO2"), 0x96916E); if (Ui::CheckboxBitFlag(TEXT("Player.InvisPlayer"), pPlayer->m_nPedFlags.bDontRender)) { - pPlayer->m_nPedFlags.bDontRender = (pPlayer->m_nPedFlags.bDontRender == 1) ? 0 : 1; + pPlayer->m_nPedFlags.bDontRender != pPlayer->m_nPedFlags.bDontRender; } Ui::CheckboxAddress(TEXT("Player.InfSprint"), 0xB7CEE4); #else - Ui::CheckboxAddress(TEXT("Player.InfSprint"), BY_GAME(NULL, (int)&pInfo->m_bNeverGetsTired, (int)&pInfo->m_bInfiniteSprint)); + Ui::CheckboxAddress(TEXT("Player.InfSprint"), (int)&pInfo->m_bInfiniteSprint); #endif ImGui::NextColumn(); @@ -484,7 +485,7 @@ void Player::ShowPage() #ifdef GTASA if (Ui::CheckboxBitFlag(TEXT("Player.LockControl"), pad->bPlayerSafe)) { - pad->bPlayerSafe = (pad->bPlayerSafe == 1) ? 0 : 1; + pad->bPlayerSafe != pad->bPlayerSafe; } Ui::CheckboxAddressEx(TEXT("Player.MaxAppeal"), 0x969180, 1, 0); Ui::CheckboxAddress(TEXT("Player.MegaJump"), 0x96916C); @@ -551,45 +552,45 @@ void Player::ShowPage() ImGui::Columns(2, 0, false); bool state = BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof, - pPlayer->m_nEntityFlags.bBulletProof); + pPlayer->m_nFlags.bBulletProof); if (Ui::CheckboxWithHint(TEXT("Player.BulletProof"), &state, nullptr, m_bGodMode)) { BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof, - pPlayer->m_nEntityFlags.bBulletProof) = state; + pPlayer->m_nFlags.bBulletProof) = state; } state = BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof, - pPlayer->m_nEntityFlags.bCollisionProof); + pPlayer->m_nFlags.bCollisionProof); if (Ui::CheckboxWithHint(TEXT("Player.CollisionProof"), &state, nullptr, m_bGodMode)) { BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof, - pPlayer->m_nEntityFlags.bCollisionProof) = state; + pPlayer->m_nFlags.bCollisionProof) = state; } state = BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof, - pPlayer->m_nEntityFlags.bExplosionProof); + pPlayer->m_nFlags.bExplosionProof); if (Ui::CheckboxWithHint(TEXT("Player.ExplosionProof"), &state, nullptr, m_bGodMode)) { BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof, - pPlayer->m_nEntityFlags.bExplosionProof) = state; + pPlayer->m_nFlags.bExplosionProof) = state; } ImGui::NextColumn(); state = BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof, - pPlayer->m_nEntityFlags.bFireProof); + pPlayer->m_nFlags.bFireProof); if (Ui::CheckboxWithHint(TEXT("Player.FireProof"), &state, nullptr, m_bGodMode)) { BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof, - pPlayer->m_nEntityFlags.bFireProof) = state; + pPlayer->m_nFlags.bFireProof) = state; } - state = BY_GAME(pPlayer->m_nPhysicalFlags.bMeeleProof, pPlayer->m_nFlags.bMeleeProof, - pPlayer->m_nEntityFlags.bMeleeProof); + state = BY_GAME(pPlayer->m_nPhysicalFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof, + pPlayer->m_nFlags.bMeleeProof); if (Ui::CheckboxWithHint(TEXT("Player.MeeleProof"), &state, nullptr, m_bGodMode)) { - BY_GAME(pPlayer->m_nPhysicalFlags.bMeeleProof, pPlayer->m_nFlags.bMeleeProof, - pPlayer->m_nEntityFlags.bMeleeProof) = state; + BY_GAME(pPlayer->m_nPhysicalFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof, + pPlayer->m_nFlags.bMeleeProof) = state; } ImGui::EndChild(); @@ -882,7 +883,7 @@ void Player::ShowPage() ImGui::Spacing(); #ifdef GTA3 ImGui::TextWrapped(TEXT("Player.SkinChangeFrozen")); - CPad::GetPad(0)->m_bDisablePlayerControls = true; + CPad::GetPad(0)->DisablePlayerControls = true; #else ImGui::TextWrapped(TEXT("Player.WorkSkinOnly")); #endif diff --git a/src/teleport.cpp b/src/teleport.cpp index d77d964..67c1946 100644 --- a/src/teleport.cpp +++ b/src/teleport.cpp @@ -23,7 +23,7 @@ void Teleport::FetchRadarSpriteData() m_tpData.m_pJson->m_Data.erase("Radar"); for (int i = 0; i != maxSprites; ++i) { - CVector pos = CRadar::ms_RadarTrace[i].m_vPosition; + CVector pos = CRadar::ms_RadarTrace[i].m_vecPos; uchar sprite = CRadar::ms_RadarTrace[i].m_nBlipSprite; auto sprite_name = m_SpriteJson.m_Data[std::to_string(sprite)].get(); std::string key_name = sprite_name + ", " + Util::GetLocationName(&pos); @@ -103,7 +103,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id) return; } CEntity* pPlayerEntity = FindPlayerEntity(-1); - pos = targetBlip.m_vPosition; + pos = targetBlip.m_vecPos; pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 500.f; m_Teleport::m_fPos = pos; @@ -163,7 +163,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id) if (pVeh && pPlayer->m_pVehicle) { #ifdef GTAVC - pPlayer->m_nInterior = interior_id; + pPlayer->m_nAreaCode = interior_id; #endif pVeh->Teleport(pos); } @@ -174,7 +174,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, int interior_id) #endif #if defined GTASA || defined GTAVC - BY_GAME(pPlayer->m_nAreaCode, pPlayer->m_nInterior, NULL) = interior_id; + pPlayer->m_nAreaCode = interior_id; Command(interior_id); #endif } diff --git a/src/util.cpp b/src/util.cpp index 76b30c4..d2c7575 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -63,10 +63,10 @@ void Util::SetCarForwardSpeed(CVehicle *pVeh, float speed) { #ifdef GTA3 CVector inVec = pVeh->m_matrix.up; - double speedFactor = speed * 0.016766668; - pVeh->m_vecMoveSpeed.x = speedFactor * inVec.x; - pVeh->m_vecMoveSpeed.y = speedFactor * inVec.y; - pVeh->m_vecMoveSpeed.z = speedFactor * inVec.z; + double factor = speed / 60.0; + pVeh->m_vecMoveSpeed.x = factor * inVec.x; + pVeh->m_vecMoveSpeed.y = factor * inVec.y; + pVeh->m_vecMoveSpeed.z = factor * inVec.z; #else Command(CPools::GetVehicleRef(pVeh), speed); #endif diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 84abf53..5ca708e 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -80,7 +80,7 @@ void Vehicle::Init() pVeh->m_nPhysicalFlags.bExplosionProof = true; pVeh->m_nPhysicalFlags.bFireProof = true; pVeh->m_nPhysicalFlags.bCollisionProof = true; - pVeh->m_nPhysicalFlags.bMeeleProof = true; + pVeh->m_nPhysicalFlags.bMeleeProof = true; pVeh->m_nVehicleFlags.bCanBeDamaged = true; #elif GTAVC pVeh->m_nFlags.bBulletProof = true; @@ -90,11 +90,11 @@ void Vehicle::Init() pVeh->m_nFlags.bMeleeProof = true; pVeh->m_nFlags.bImmuneToNonPlayerDamage = true; #else - pVeh->m_nEntityFlags.bBulletProof = true; - pVeh->m_nEntityFlags.bExplosionProof = true; - pVeh->m_nEntityFlags.bFireProof = true; - pVeh->m_nEntityFlags.bCollisionProof = true; - pVeh->m_nEntityFlags.bMeleeProof = true; + pVeh->m_nFlags.bBulletProof = true; + pVeh->m_nFlags.bExplosionProof = true; + pVeh->m_nFlags.bFireProof = true; + pVeh->m_nFlags.bCollisionProof = true; + pVeh->m_nFlags.bMeleeProof = true; #endif } @@ -107,9 +107,7 @@ void Vehicle::Init() } #ifdef GTASA - - if (m_UnlimitedNitro::m_bEnabled - && BY_GAME(pVeh->m_nVehicleSubClass, pVeh->m_nVehicleClass, NULL) == VEHICLE_AUTOMOBILE) + if (m_UnlimitedNitro::m_bEnabled && pVeh->m_nVehicleSubClass == VEHICLE_AUTOMOBILE) { patch::Set(0x969165, 0, true); // All cars have nitro patch::Set(0x96918B, 0, true); // All taxis have nitro @@ -207,7 +205,9 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess CStreaming::SetModelIsDeletable(icomp); if (display_message) + { SetHelpMessage("Component added"); + } } catch (...) { @@ -278,8 +278,8 @@ void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId) pPlayer->RegisterReference((CEntity**)&pPlayer->m_pVehicle); pPlayer->m_pObjectiveVehicle = pVeh; pPlayer->RegisterReference((CEntity**)&pPlayer->m_pObjectiveVehicle); - pPlayer->m_dwAction = ePedAction::Driving; - pPlayer->m_dwObjective = OBJECTIVE_NO_OBJ; + pPlayer->m_ePedState = ePedState::PEDSTATE_DRIVING; + pPlayer->m_nObjective = OBJECTIVE_NO_OBJ; patch::Set(0x7838CD, 1); // player got in car flag Call<0x41D370>(pVeh); // CCarCtrl::RegisterVehicleOfInterest @@ -317,8 +317,7 @@ void Vehicle::SpawnVehicle(const std::string& rootkey, const std::string& vehNam int imodel = std::stoi(smodel); CVehicle* veh = nullptr; - - int interior = BY_GAME(player->m_nAreaCode, player->m_nInterior, 0); + int interior = BY_GAME(player->m_nAreaCode, player->m_nAreaCode, NULL); CVector pos = player->GetPosition(); float speed = 0; @@ -331,7 +330,6 @@ void Vehicle::SpawnVehicle(const std::string& rootkey, const std::string& vehNam pos = pveh->GetPosition(); Command(hveh, &speed); - Command(hplayer, pos.x, pos.y, pos.z); #ifdef GTASA @@ -459,9 +457,9 @@ void Vehicle::SpawnVehicle(const std::string& rootkey, const std::string& vehNam veh->SetOrientation(x, y, z); #endif } - BY_GAME(veh->m_nDoorLock, veh->m_nLockStatus, veh->m_nDoorLock) = CARLOCK_UNLOCKED; + veh->m_nDoorLock = DOORLOCK_UNLOCKED; #ifndef GTA3 - BY_GAME(veh->m_nAreaCode, veh->m_nInterior, NULL) = interior; + BY_GAME(veh->m_nAreaCode, veh->m_nAreaCode, NULL) = interior; #endif Command(CPools::GetVehicleRef(veh)); CStreaming::SetModelIsDeletable(imodel); @@ -562,7 +560,7 @@ void Vehicle::ShowPage() pVeh->m_nPhysicalFlags.bExplosionProof = false; pVeh->m_nPhysicalFlags.bFireProof = false; pVeh->m_nPhysicalFlags.bCollisionProof = false; - pVeh->m_nPhysicalFlags.bMeeleProof = false; + pVeh->m_nPhysicalFlags.bMeleeProof = false; pVeh->m_nVehicleFlags.bCanBeDamaged = false; #elif GTAVC pVeh->m_nFlags.bBulletProof = false; @@ -572,11 +570,11 @@ void Vehicle::ShowPage() pVeh->m_nFlags.bMeleeProof = false; pVeh->m_nFlags.bImmuneToNonPlayerDamage = false; #else - pVeh->m_nEntityFlags.bBulletProof = false; - pVeh->m_nEntityFlags.bExplosionProof = false; - pVeh->m_nEntityFlags.bFireProof = false; - pVeh->m_nEntityFlags.bCollisionProof = false; - pVeh->m_nEntityFlags.bMeleeProof = false; + pVeh->m_nFlags.bBulletProof = false; + pVeh->m_nFlags.bExplosionProof = false; + pVeh->m_nFlags.bFireProof = false; + pVeh->m_nFlags.bCollisionProof = false; + pVeh->m_nFlags.bMeleeProof = false; #endif } } @@ -666,16 +664,16 @@ void Vehicle::ShowPage() pVeh->m_nVehicleFlags.bAlwaysSkidMarks = state; #endif - state = BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof, pVeh->m_nEntityFlags.bBulletProof); + state = BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof, pVeh->m_nFlags.bBulletProof); if (Ui::CheckboxWithHint(TEXT("Vehicle.BulletProof"), &state, nullptr, m_bNoDamage)) { - BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof, pVeh->m_nEntityFlags.bBulletProof) = state; + BY_GAME(pVeh->m_nPhysicalFlags.bBulletProof, pVeh->m_nFlags.bBulletProof, pVeh->m_nFlags.bBulletProof) = state; } - state = BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof, pVeh->m_nEntityFlags.bCollisionProof); + state = BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof); if (Ui::CheckboxWithHint(TEXT("Vehicle.ColProof"), &state, nullptr, m_bNoDamage)) { - BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof, pVeh->m_nEntityFlags.bCollisionProof) = state; + BY_GAME(pVeh->m_nPhysicalFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof, pVeh->m_nFlags.bCollisionProof) = state; } #ifdef GTASA @@ -701,16 +699,16 @@ void Vehicle::ShowPage() pVeh->m_nVehicleFlags.bEngineOn = state; } - state = BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof, pVeh->m_nEntityFlags.bExplosionProof); + state = BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof); if (Ui::CheckboxWithHint(TEXT("Vehicle.ExplosionProof"), &state, nullptr, m_bNoDamage)) { - BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof, pVeh->m_nEntityFlags.bExplosionProof) = state; + BY_GAME(pVeh->m_nPhysicalFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof, pVeh->m_nFlags.bExplosionProof) = state; } - state = BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof, pVeh->m_nEntityFlags.bFireProof); + state = BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof, pVeh->m_nFlags.bFireProof); if (Ui::CheckboxWithHint(TEXT("Vehicle.FireProof"), &state, nullptr, m_bNoDamage)) { - BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof, pVeh->m_nEntityFlags.bFireProof) = state; + BY_GAME(pVeh->m_nPhysicalFlags.bFireProof, pVeh->m_nFlags.bFireProof, pVeh->m_nFlags.bFireProof) = state; } ImGui::NextColumn(); @@ -723,10 +721,10 @@ void Vehicle::ShowPage() } #endif - state = !BY_GAME(pVeh->m_bIsVisible, pVeh->m_nFlags.bIsVisible, pVeh->m_nEntityFlags.bIsVisible); + state = !BY_GAME(pVeh->m_bIsVisible, pVeh->m_nFlags.bIsVisible, pVeh->m_nFlags.bIsVisible); if (Ui::CheckboxWithHint(TEXT("Vehicle.InvisCar"), &state, nullptr, !is_driver)) { - BY_GAME(pVeh->m_bIsVisible, pVeh->m_nFlags.bIsVisible, pVeh->m_nEntityFlags.bIsVisible) = !state; + BY_GAME(pVeh->m_bIsVisible, pVeh->m_nFlags.bIsVisible, pVeh->m_nFlags.bIsVisible) = !state; } state = BY_GAME(!pVeh->ms_forceVehicleLightsOff, pVeh->m_nVehicleFlags.bLightsOn, pVeh->m_nVehicleFlags.bLightsOn); @@ -735,23 +733,16 @@ void Vehicle::ShowPage() BY_GAME(pVeh->ms_forceVehicleLightsOff, pVeh->m_nVehicleFlags.bLightsOn, pVeh->m_nVehicleFlags.bLightsOn) = state; } - state = BY_GAME(pVeh->m_nDoorLock, pVeh->m_nLockStatus, pVeh->m_nDoorLock) == CARLOCK_LOCKED_PLAYER_INSIDE; + state = pVeh->m_nDoorLock == DOORLOCK_LOCKED_PLAYER_INSIDE; if (Ui::CheckboxWithHint(TEXT("Vehicle.LockDoor"), &state, nullptr, !is_driver)) { - if (state) - { - BY_GAME(pVeh->m_nDoorLock, pVeh->m_nLockStatus, pVeh->m_nDoorLock) = CARLOCK_LOCKED_PLAYER_INSIDE; - } - else - { - BY_GAME(pVeh->m_nDoorLock, pVeh->m_nLockStatus, pVeh->m_nDoorLock) = CARLOCK_UNLOCKED; - } + pVeh->m_nDoorLock = state ? DOORLOCK_LOCKED_PLAYER_INSIDE : DOORLOCK_UNLOCKED; } - state = BY_GAME(pVeh->m_nPhysicalFlags.bMeeleProof, pVeh->m_nFlags.bMeleeProof, pVeh->m_nEntityFlags.bMeleeProof); + state = BY_GAME(pVeh->m_nPhysicalFlags.bMeleeProof, pVeh->m_nFlags.bMeleeProof, pVeh->m_nFlags.bMeleeProof); if (Ui::CheckboxWithHint(TEXT("Vehicle.MeleeProof"), &state, nullptr, m_bNoDamage)) { - BY_GAME(pVeh->m_nPhysicalFlags.bMeeleProof, pVeh->m_nFlags.bMeleeProof, pVeh->m_nEntityFlags.bMeleeProof) = state; + BY_GAME(pVeh->m_nPhysicalFlags.bMeleeProof, pVeh->m_nFlags.bMeleeProof, pVeh->m_nFlags.bMeleeProof) = state; } #ifdef GTASA @@ -795,11 +786,8 @@ void Vehicle::ShowPage() if (pClosestVeh) { -#ifdef GTA3 - int seats = pClosestVeh->m_nNumMaxPassengers; -#else int seats = pClosestVeh->m_nMaxPassengers; -#endif + ImGui::Spacing(); ImGui::Columns(2, 0, false); diff --git a/src/weapon.cpp b/src/weapon.cpp index e6f7a01..42197a8 100644 --- a/src/weapon.cpp +++ b/src/weapon.cpp @@ -13,7 +13,7 @@ void Weapon::Init() #ifdef GTASA if (m_bAutoAim) { - if (CPad::NewMouseControllerState.X == 0 && CPad::NewMouseControllerState.Y == 0) + if (CPad::NewMouseControllerState.x == 0 && CPad::NewMouseControllerState.y == 0) { if (KeyPressed(2)) { @@ -28,15 +28,10 @@ void Weapon::Init() #endif - uchar slot = BY_GAME(player->m_nActiveWeaponSlot, player->m_nActiveWeaponSlot, player->m_nCurrentWeapon); + uchar slot = player->m_nCurrentWeapon; if (m_nCurrentWeaponSlot != slot) { - -#ifdef GTA3 eWeaponType weaponType = player->m_aWeapons[slot].m_eWeaponType; -#else - eWeaponType weaponType = player->m_aWeapons[slot].m_nType; -#endif #ifdef GTASA CWeaponInfo* pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType, player->GetWeaponSkill(weaponType)); @@ -116,29 +111,27 @@ static void ClearPlayerWeapon(eWeaponType weaponType) { CWeapon *pWeapon = &pPlayer->m_aWeapons[weaponSlot]; -#ifdef GTA3 + if (pWeapon->m_eWeaponType == weaponType) { if (pPlayer->m_nCurrentWeapon == weaponSlot) { +#ifdef GTA3 Command(0, WEAPONTYPE_UNARMED); - } - // This doesn't work for melee weapons aka bats, chainsaw etc - pWeapon->m_eWeaponState = WEAPONSTATE_OUT_OF_AMMO; - pWeapon->m_nAmmoTotal = 0; - pWeapon->m_nAmmoInClip = 0; - } #else - if (pWeapon->m_nType == weaponType) - { - if (pPlayer->m_nActiveWeaponSlot == weaponSlot) - { CWeaponInfo *pWeaponInfo = CWeaponInfo::GetWeaponInfo(WEAPONTYPE_UNARMED); pPlayer->SetCurrentWeapon(pWeaponInfo->m_WeaponSlot); - } - pWeapon->Shutdown(); - } #endif + } +#ifdef GTA3 + // This doesn't work for melee weapons aka bats, chainsaw etc + pWeapon->m_eWeaponState = WEAPONSTATE_OUT_OF_AMMO; + pWeapon->m_nAmmoTotal = 0; + pWeapon->m_nAmmoInClip = 0; +#else + pWeapon->Shutdown(); +#endif + } } } @@ -236,12 +229,7 @@ void Weapon::ShowPage() float x, y, z; Command(hplayer, 0.0, 3.0, 0.0, &x, &y, &z); -#ifdef GTA3 eWeaponType weaponType = pPlayer->m_aWeapons[pPlayer->m_nCurrentWeapon].m_eWeaponType; -#else - eWeaponType weaponType = pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_nType; -#endif - if (weaponType) { int model = 0, pickup = 0; @@ -269,9 +257,7 @@ void Weapon::ShowPage() if (ImGui::Button(TEXT("Weapon.DropCurrent"), Ui::GetSize(3))) { #ifdef GTASA - Command(hplayer, pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_nType); -#elif GTAVC - ClearPlayerWeapon(pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_nType); + Command(hplayer, pPlayer->m_aWeapons[pPlayer->m_nCurrentWeapon].m_eWeaponType); #else ClearPlayerWeapon(pPlayer->m_aWeapons[pPlayer->m_nCurrentWeapon].m_eWeaponType); #endif