diff --git a/resource/VC/CheatMenu/json/peds.json b/resource/VC/CheatMenu/json/peds.json new file mode 100644 index 0000000..0ec1d0c --- /dev/null +++ b/resource/VC/CheatMenu/json/peds.json @@ -0,0 +1,48 @@ +{ + "Special" : + { + "Alex Shrub" : "IGalscb", + "Lance 1" : "IGbuddy", + "Lance Cop" : "IGBudy2", + "Lance Beaten Up" : "IGBudy3", + "Candy Suxxx" : "IGCandy", + "Colonel Cortez" : "IGColon", + "Ricardo Diaz" : "IGDiaz", + "Dick (Lovefist)" : "IGDick", + "Gonzalez" : "IGGonz", + "Hilary" : "IGHlary", + "Hilary (Bank Mission)" : "IGHlry2", + "Jezz Torrent" : "IGJezz", + "Ken Rosenberg" : "IGKen", + "Mercedes" : "IGMerc", + "Mercedes (purple dress)" : "IGMerc2", + "Cam Jones" : "IGmike", + "Cam Jones (Bank Mission)" : "IGMike2", + "Percy (Lovefist)" : "IGPercy", + "Phil Cassidy" : "IGPhil", + "Phil (Injured)" : "IGphil2", + "Phil (Bank Mission)" : "IGPhil3", + "Sonny Forelli" : "IGSonny" + }, + "Misc" : + { + "Fsfa" : "FSFA", + "Courier" : "COURIER", + "Chef" : "CHEF", + "Sgc" : "SGC", + "Psycho" : "PSYCHO", + "Striper" : "STRIPA" + }, + "Player" : + { + "Tommy Default" : "Player", + "Tommy Suit Plain" : "Player2", + "Tommy Worker" : "Player3", + "Tommy Golfer" : "Player4", + "Tommy Cuban" : "Player5", + "Tommy Cop" : "Player6", + "Tommy Bank" : "Player7", + "Tommy Simple" : "Player8", + "Tommy Suit Stripe" : "Player9" + } +} \ No newline at end of file diff --git a/src/Animation.cpp b/src/Animation.cpp index e670759..caacdde 100644 --- a/src/Animation.cpp +++ b/src/Animation.cpp @@ -85,7 +85,7 @@ void Animation::Draw() { ImGui::Spacing(); Ui::DrawJSON(m_AnimData.m_Json, m_AnimData.m_Categories, m_AnimData.m_Selected, m_AnimData.m_Filter, &PlayAnimation, - &RemoveAnimation); + &RemoveAnimation); ImGui::EndChild(); } ImGui::EndTabItem(); @@ -154,7 +154,7 @@ void Animation::Draw() { ImGui::Spacing(); Ui::DrawJSON(m_Cutscene::m_Data.m_Json, m_Cutscene::m_Data.m_Categories, m_Cutscene::m_Data.m_Selected, - m_Cutscene::m_Data.m_Filter, &PlayCutscene, nullptr); + m_Cutscene::m_Data.m_Filter, &PlayCutscene, nullptr); ImGui::EndChild(); } ImGui::EndTabItem(); diff --git a/src/Animation.h b/src/Animation.h index e342f75..2f42e8a 100644 --- a/src/Animation.h +++ b/src/Animation.h @@ -18,8 +18,8 @@ private: inline static bool m_Loop; inline static bool m_bSecondary; inline static std::string m_nWalkingStyle = "default"; - inline static std::vector m_FightingStyleList = {"Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick"}; - inline static std::vector m_WalkingStyleList = + inline static std::vector m_FightingStyleList = { "Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick" }; + inline static std::vector m_WalkingStyleList = { "default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman", diff --git a/src/CheatMenu.cpp b/src/CheatMenu.cpp index cbca69c..d63086d 100644 --- a/src/CheatMenu.cpp +++ b/src/CheatMenu.cpp @@ -9,11 +9,11 @@ void CheatMenu::DrawWindow() ImGuiIO& io = ImGui::GetIO(); static bool bRunning = true; - #ifdef GTASA +#ifdef GTASA if (FrontEndMenuManager.m_bMenuActive) - #elif GTAVC +#elif GTAVC if (FrontendMenuManager.m_bMenuVisible) - #endif +#endif { if (bRunning) { @@ -25,11 +25,11 @@ void CheatMenu::DrawWindow() else { bRunning = true; - #ifdef GTASA +#ifdef GTASA if (Globals::m_bShowMenu || m_Commands::m_bShowMenu) - #elif GTAVC +#elif GTAVC if (Globals::m_bShowMenu) - #endif +#endif { if (Globals::m_bShowMenu) { @@ -38,7 +38,7 @@ void CheatMenu::DrawWindow() { ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(250, 350)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, - ImVec2(ImGui::GetWindowWidth() / 85, ImGui::GetWindowHeight() / 200)); + ImVec2(ImGui::GetWindowWidth() / 85, ImGui::GetWindowHeight() / 200)); if (Updater::m_State == UPDATER_UPDATE_FOUND) Updater::ShowUpdateScreen(); @@ -53,12 +53,12 @@ void CheatMenu::DrawWindow() ImGui::End(); } } - #ifdef GTASA +#ifdef GTASA else { DrawShortcutsWindow(); } - #endif +#endif } } DrawOverlay(); @@ -77,12 +77,12 @@ CheatMenu::CheatMenu() Events::processScriptsEvent += []() { - if (Globals::m_bInit && - #ifdef GTASA + if (Globals::m_bInit && +#ifdef GTASA !FrontEndMenuManager.m_bMenuActive - #elif GTAVC +#elif GTAVC !FrontendMenuManager.m_bMenuVisible - #endif +#endif ) { if (Ui::HotKeyPressed(Menu::m_HotKeys::menuOpen)) @@ -196,11 +196,11 @@ void MenuThread(void* param) } static bool bGameInit = false; - #ifdef GTASA +#ifdef GTASA Hook::ApplyMouseFix(); - #endif +#endif - // Wait till the game is initialized +// Wait till the game is initialized Events::initRwEvent += [] { bGameInit = true; @@ -244,7 +244,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) if (nReason == DLL_PROCESS_ATTACH) { uint gameVersion = GetGameVersion(); - #ifdef GTASA +#ifdef GTASA if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT) { CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr); @@ -253,7 +253,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) { MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR); } - #elif GTAVC +#elif GTAVC if (gameVersion == GAME_10EN) { CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr); @@ -262,7 +262,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) { MessageBox(HWND_DESKTOP, "Unknown game version. GTA VC v1.0 EN is required.", "CheatMenu", MB_ICONERROR); } - #endif +#endif } return TRUE; diff --git a/src/CheatMenu.h b/src/CheatMenu.h index 7b6b847..1afdc35 100644 --- a/src/CheatMenu.h +++ b/src/CheatMenu.h @@ -1,5 +1,5 @@ /* - Author: Grinch_ + Author: Grinch_ Copyright GPLv3 2019-2021 Required: DirectX 9 SDK @@ -12,35 +12,35 @@ #include "Hook.h" #include "Menu.h" #include "Teleport.h" +#include "Player.h" #ifdef GTASA - #include "Animation.h" - #include "Game.h" - #include "Ped.h" - #include "Player.h" - #include "Vehicle.h" - #include "Visual.h" - #include "Weapon.h" - class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon +#include "Animation.h" +#include "Game.h" +#include "Ped.h" +#include "Vehicle.h" +#include "Visual.h" +#include "Weapon.h" +class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon #elif defined(GTAVC) - class CheatMenu : Hook, Menu, Teleport +class CheatMenu : Hook, Menu, Player, Teleport #endif { private: - #ifdef GTASA - inline static CallbackTable header - { - {"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw}, - {"Animation", &Animation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw}, - {"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw} - }; - #elif GTAVC - inline static CallbackTable header - { - {"Teleport", &Teleport::Draw}, {"Menu", &Menu::Draw} - }; - #endif +#ifdef GTASA + inline static CallbackTable header + { + {"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw}, + {"Animation", &Animation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw}, + {"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw} + }; +#elif GTAVC + inline static CallbackTable header + { + {"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Menu", &Menu::Draw} + }; +#endif static void ApplyStyle(); static void DrawWindow(); diff --git a/src/Game.cpp b/src/Game.cpp index cb0ae2c..21fdcc0 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -329,7 +329,7 @@ void Game::Draw() CPlayerPed* pPlayer = FindPlayerPed(); int hplayer = CPools::GetPedRef(pPlayer); - if (ImGui::Button("Save game (might cause game bugs)",Ui::GetSize())) + if (ImGui::Button("Save game (might cause game bugs)", Ui::GetSize())) { FrontEndMenuManager.m_bActivateMenuNextFrame = true; bSaveGameFlag = true; @@ -434,10 +434,10 @@ Lowers armour, health, stamina etc.")) Command(m_bKeepStuff); } Ui::CheckboxWithHint("Screenshot shortcut", &m_bScreenShot, - (("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::m_HotKeys::quickSceenShot) - + "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str()); + (("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::m_HotKeys::quickSceenShot) + + "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str()); if (Ui::CheckboxWithHint("Solid water", &m_bSolidWater, - "Player can walk on water\nTurn this off if you want to swim.")) + "Player can walk on water\nTurn this off if you want to swim.")) { if (!m_bSolidWater && m_nSolidWaterObj != 0) { @@ -588,7 +588,7 @@ It's recommanded not to save after using the mission loader. Use it at your own ImGui::Spacing(); Ui::DrawJSON(m_MissionData.m_Json, m_MissionData.m_Categories, m_MissionData.m_Selected, m_MissionData.m_Filter, - SetPlayerMission, nullptr); + SetPlayerMission, nullptr); } ImGui::EndTabItem(); } diff --git a/src/Game.h b/src/Game.h index 765a021..1c2a289 100644 --- a/src/Game.h +++ b/src/Game.h @@ -2,8 +2,8 @@ class Game { public: - inline static SSearchData m_MissionData{"mission"}; - inline static std::vector m_DayNames = + inline static SSearchData m_MissionData{ "mission" }; + inline static std::vector m_DayNames = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; diff --git a/src/Hook.cpp b/src/Hook.cpp index 9d605d2..4e47203 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -9,9 +9,9 @@ LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (ImGui::GetIO().WantTextInput) { - #ifdef GTASA +#ifdef GTASA Call<0x53F1E0>(); // CPad::ClearKeyboardHistory - #endif +#endif return 1; } @@ -113,10 +113,10 @@ void Hook::RenderFrame(void* ptr) ImGui_ImplWin32_Init(RsGlobal.ps->window); - #ifdef GTASA - // shift trigger fix +#ifdef GTASA +// shift trigger fix patch::Nop(0x00531155, 5); - #endif +#endif if (Globals::renderer == Render_DirectX9) { @@ -165,9 +165,9 @@ void Hook::ShowMouse(bool state) ImGui::GetIO().MouseDrawCursor = state; - #ifdef GTASA +#ifdef GTASA Hook::ApplyMouseFix(); // Reapply the patches - #elif GTAVC +#elif GTAVC if (m_bShowMouse) { patch::SetUChar(0x6020A0, 0xC3); // psSetMousePos @@ -178,7 +178,7 @@ void Hook::ShowMouse(bool state) patch::SetUChar(0x6020A0, 0x53); patch::SetRaw(0x4AB6CA, (char*)"\xE8\x51\x21\x00\x00", 5); } - #endif +#endif CPad::NewMouseControllerState.X = 0; CPad::NewMouseControllerState.Y = 0; diff --git a/src/Hook.h b/src/Hook.h index 2728be5..0b950cc 100644 --- a/src/Hook.h +++ b/src/Hook.h @@ -15,7 +15,7 @@ private: inline static f_EndScene oEndScene; inline static f_Reset oReset; inline static bool m_bMouseVisibility; - + static void CALLBACK RenderFrame(void* ptr); static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9* pDevice); static HRESULT CALLBACK Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags); @@ -26,10 +26,10 @@ private: public: inline static bool m_bShowMouse = false; inline static std::function windowCallback = nullptr; - - #ifdef GTASA + +#ifdef GTASA static void ApplyMouseFix(); - #endif +#endif Hook(); ~Hook(); diff --git a/src/MenuInfo.h b/src/MenuInfo.h index 847a57c..3984039 100644 --- a/src/MenuInfo.h +++ b/src/MenuInfo.h @@ -1,6 +1,6 @@ #pragma once #define MENU_NAME "Cheat Menu" -#define MENU_VERSION_NUMBER "2.8" +#define MENU_VERSION_NUMBER "2.9" #define MENU_VERSION MENU_VERSION_NUMBER"-beta" -#define BUILD_NUMBER "20210801" +#define BUILD_NUMBER "20210806" #define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")" diff --git a/src/Player.cpp b/src/Player.cpp index d877e05..86af25a 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -1,30 +1,32 @@ #include "pch.h" #include "Player.h" -#include "Ped.h" #include "Menu.h" #include "Ui.h" #include "Util.h" +#ifdef GTASA +#include "Ped.h" + // hardcoded cloth category names const char* cloth_category[18] = { - "Shirts", + "Shirts", "Heads", - "Trousers", - "Shoes", - "Tattoos left lower arm", - "Tattoos left upper arm", - "Tattoos right upper arm", - "Tattoos right lower arm", - "Tattoos back", - "Tattoos left chest", + "Trousers", + "Shoes", + "Tattoos left lower arm", + "Tattoos left upper arm", + "Tattoos right upper arm", + "Tattoos right lower arm", + "Tattoos back", + "Tattoos left chest", "Tattoos right chest", - "Tattoos stomach", + "Tattoos stomach", "Tattoos lower back", - "Necklaces", - "Watches", - "Glasses", - "Hats", + "Necklaces", + "Watches", + "Glasses", + "Hats", "Extras" }; @@ -35,17 +37,23 @@ inline static void PlayerModelBrokenFix() if (pPlayer->m_nModelIndex == 0) Call<0x5A81E0>(0, pPlayer->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false); } +#elif GTAVC +inline static SSearchData tempPedData{ "peds" }; +#endif Player::Player() { - // Fix player model being broken after rebuild +#ifdef GTASA +// Fix player model being broken after rebuild patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix); +#endif m_bAimSkinChanger = config.GetValue("aim_skin_changer", false); // Custom skins setup if (GetModuleHandle("modloader.asi")) { +#ifdef GTASA if (fs::is_directory(m_CustomSkins::m_Path)) { for (auto& p : fs::recursive_directory_iterator(m_CustomSkins::m_Path)) @@ -61,7 +69,11 @@ Player::Player() } } } - else fs::create_directory(m_CustomSkins::m_Path); + else + { + fs::create_directory(m_CustomSkins::m_Path); + } +#endif m_bModloaderInstalled = true; } @@ -69,17 +81,25 @@ Player::Player() Events::processScriptsEvent += [] { uint timer = CTimer::m_snTimeInMilliseconds; - static CPlayerPed* player = FindPlayerPed(); + CPlayerPed* player = FindPlayerPed(); + int hplayer = CPools::GetPedRef(player); + if (!m_bImagesLoaded) { - Util::LoadTextureDirectory(m_ClothData, PLUGIN_PATH((char*)"CheatMenu\\clothes.txd"), true); + #ifdef GTASA + Util::LoadTextureDirectory(m_ClothData, PLUGIN_PATH((char*)"CheatMenu\\clothes.txd"), true); + #elif GTAVC + tempPedData.m_Json.LoadData(tempPedData.m_Categories, tempPedData.m_Selected); + #endif + m_bImagesLoaded = true; } + if (m_KeepPosition::m_bEnabled) { - if (!player->IsAlive()) + if (Command(hplayer)) { m_KeepPosition::m_fPos = player->GetPosition(); } @@ -90,7 +110,8 @@ Player::Player() if (m_KeepPosition::m_fPos.x != 0 && m_KeepPosition::m_fPos.x != cur_pos.x && m_KeepPosition::m_fPos.y != 0 && m_KeepPosition::m_fPos.y != cur_pos.y) { - player->Teleport(m_KeepPosition::m_fPos, false); + BY_GAME(player->Teleport(m_KeepPosition::m_fPos, false) + , player->Teleport(m_KeepPosition::m_fPos)); m_KeepPosition::m_fPos = CVector(0, 0, 0); } } @@ -98,36 +119,53 @@ Player::Player() if (m_bGodMode) { +#ifdef GTASA patch::Set(0x96916D, 1, false); player->m_nPhysicalFlags.bBulletProof = 1; player->m_nPhysicalFlags.bCollisionProof = 1; player->m_nPhysicalFlags.bExplosionProof = 1; player->m_nPhysicalFlags.bFireProof = 1; - player->m_nPhysicalFlags.bMeeleProof = 1; + player->m_nPhysicalFlags.bMeeleProof = 1; +#elif GTAVC + player->m_nFlags.bBulletProof = 1; + player->m_nFlags.bCollisionProof = 1; + player->m_nFlags.bExplosionProof = 1; + player->m_nFlags.bFireProof = 1; + player->m_nFlags.bMeleeProof = 1; +#endif } +#ifdef GTASA if (m_bAimSkinChanger && Ui::HotKeyPressed(Menu::m_HotKeys::aimSkinChanger)) { - CPed* target_ped = player->m_pPlayerTargettedPed; - if (target_ped) + CPed* targetPed = player->m_pPlayerTargettedPed; + if (targetPed) { - player->SetModelIndex(target_ped->m_nModelIndex); + player->SetModelIndex(targetPed->m_nModelIndex); Util::ClearCharTasksVehCheck(player); } } +#endif if (Ui::HotKeyPressed(Menu::m_HotKeys::godMode)) { if (m_bGodMode) { SetHelpMessage("God mode disabled", false, false, false); - +#ifdef GTASA patch::Set(0x96916D, m_bGodMode, false); - player->m_nPhysicalFlags.bBulletProof = false; - player->m_nPhysicalFlags.bCollisionProof = false; - player->m_nPhysicalFlags.bExplosionProof = false; - player->m_nPhysicalFlags.bFireProof = false; - player->m_nPhysicalFlags.bMeeleProof = false; + player->m_nPhysicalFlags.bBulletProof = 0; + player->m_nPhysicalFlags.bCollisionProof = 0; + player->m_nPhysicalFlags.bExplosionProof = 0; + player->m_nPhysicalFlags.bFireProof = 0; + player->m_nPhysicalFlags.bMeeleProof = 0; +#elif GTAVC + player->m_nFlags.bBulletProof = 0; + player->m_nFlags.bCollisionProof = 0; + player->m_nFlags.bExplosionProof = 0; + player->m_nFlags.bFireProof = 0; + player->m_nFlags.bMeleeProof = 0; +#endif m_bGodMode = false; } else @@ -139,6 +177,7 @@ Player::Player() }; } +#ifdef GTASA void Player::ChangePlayerCloth(std::string& name) { std::stringstream ss(name); @@ -171,16 +210,19 @@ void Player::ChangePlayerCloth(std::string& name) player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(-1750049245, 1393983095, body_part); else player->m_pPlayerData->m_pPedClothesDesc-> - SetTextureAndModel(texture9.c_str(), model.c_str(), body_part); + SetTextureAndModel(texture9.c_str(), model.c_str(), body_part); } } CClothes::RebuildPlayer(player, false); } +#endif +#ifdef GTASA void Player::ChangePlayerModel(std::string& model) { bool custom_skin = std::find(m_CustomSkins::m_List.begin(), m_CustomSkins::m_List.end(), model) != m_CustomSkins::m_List.end(); + if (Ped::m_PedData.m_Json.m_Data.contains(model) || custom_skin) { CPlayerPed* player = FindPlayerPed(); @@ -210,12 +252,24 @@ void Player::ChangePlayerModel(std::string& model) } } } +#elif GTAVC +void Player::ChangePlayerModel(std::string& cat, std::string& name, std::string& id) +{ + CPlayerPed* player = FindPlayerPed(); + player->Undress(id.c_str()); + CStreaming::LoadAllRequestedModels(false); + player->Dress(); +} +#endif void Player::Draw() { CPlayerPed* pPlayer = FindPlayerPed(); int hplayer = CPools::GetPedRef(pPlayer); +#ifdef GTASA CPad* pad = pPlayer->GetPadFromPlayer(); +#endif + CPlayerInfo *pInfo = &CWorld::Players[CWorld::PlayerInFocus]; if (ImGui::Button("Copy coordinates", ImVec2(Ui::GetSize(2)))) { @@ -227,7 +281,9 @@ void Player::Draw() } ImGui::SameLine(); if (ImGui::Button("Suicide", ImVec2(Ui::GetSize(2)))) + { pPlayer->m_fHealth = 0.0; + } ImGui::Spacing(); @@ -241,36 +297,60 @@ void Player::Draw() ImGui::Columns(2, 0, false); - Ui::CheckboxAddress("Bounty on yourself", 0x96913F); +#ifdef GTASA + Ui::CheckboxAddress("Bounty on yourself", 0x96913F); +#endif + Ui::CheckboxAddress("Free healthcare", (int)&pInfo->m_bFreeHealthCare); + if (Ui::CheckboxWithHint("God mode", &m_bGodMode)) { +#ifdef GTASA patch::Set(0x96916D, m_bGodMode, false); pPlayer->m_nPhysicalFlags.bBulletProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bCollisionProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bExplosionProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bFireProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bMeeleProof = m_bGodMode; +#elif GTAVC + 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 } - +#ifdef GTASA Ui::CheckboxAddress("Higher cycle jumps", 0x969161); Ui::CheckboxAddress("Infinite oxygen", 0x96916E); Ui::CheckboxAddress("Infinite run", 0xB7CEE4); + if (Ui::CheckboxBitFlag("Invisible player", pPlayer->m_nPedFlags.bDontRender)) + { pPlayer->m_nPedFlags.bDontRender = (pPlayer->m_nPedFlags.bDontRender == 1) ? 0 : 1; + } +#elif GTAVC + Ui::CheckboxAddress("Infinite run", (int)&pInfo->m_bNeverGetsTired); +#endif ImGui::NextColumn(); Ui::CheckboxWithHint("Keep position", &m_KeepPosition::m_bEnabled, "Teleport to the position you died from"); +#ifdef GTASA if (Ui::CheckboxBitFlag("Lock control", pad->bPlayerSafe)) + { pad->bPlayerSafe = (pad->bPlayerSafe == 1) ? 0 : 1; - + } Ui::CheckboxAddress("Mega jump", 0x96916C); Ui::CheckboxAddress("Mega punch", 0x969173); Ui::CheckboxAddress("Never get hungry", 0x969174); bool never_wanted = patch::Get(0x969171, false); if (Ui::CheckboxWithHint("Never wanted", &never_wanted)) + { CCheat::NotWantedCheat(); + } +#endif + Ui::CheckboxAddress("No arrest fee", (int)&pInfo->m_bGetOutOfJailFree); ImGui::Columns(1); @@ -279,27 +359,37 @@ void Player::Draw() ImGui::Columns(2, 0, false); - bool state = pPlayer->m_nPhysicalFlags.bBulletProof; + bool state = BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof); if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, m_bGodMode)) - pPlayer->m_nPhysicalFlags.bBulletProof = state; + { + BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof) = state; + } - state = pPlayer->m_nPhysicalFlags.bCollisionProof; + state = BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof); if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, m_bGodMode)) - pPlayer->m_nPhysicalFlags.bCollisionProof = state; + { + BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof) = state; + } - state = pPlayer->m_nPhysicalFlags.bExplosionProof; + state = BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof); if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, m_bGodMode)) - pPlayer->m_nPhysicalFlags.bExplosionProof = state; + { + BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof) = state; + } ImGui::NextColumn(); - state = pPlayer->m_nPhysicalFlags.bFireProof; + state = BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof); if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, m_bGodMode)) - pPlayer->m_nPhysicalFlags.bFireProof = state; + { + BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof) = state; + } - state = pPlayer->m_nPhysicalFlags.bMeeleProof; + state = BY_GAME(pPlayer->m_nPhysicalFlags.bMeeleProof, pPlayer->m_nFlags.bMeleeProof); if (Ui::CheckboxWithHint("Meele proof", &state, nullptr, m_bGodMode)) - pPlayer->m_nPhysicalFlags.bMeeleProof = state; + { + BY_GAME(pPlayer->m_nPhysicalFlags.bMeeleProof, pPlayer->m_nFlags.bMeleeProof) = state; + } ImGui::EndChild(); ImGui::EndTabItem(); @@ -310,6 +400,7 @@ void Player::Draw() ImGui::BeginChild("PlayerMenus"); Ui::EditReference("Armour", pPlayer->m_fArmour, 0, 100, 150); +#ifdef GTASA if (ImGui::CollapsingHeader("Body")) { if (pPlayer->m_nModelIndex == 0) @@ -347,18 +438,35 @@ void Player::Draw() Ui::EditStat("Energy", STAT_ENERGY); Ui::EditStat("Fat", STAT_FAT); - Ui::EditReference("Health", pPlayer->m_fHealth, 0, 100, static_cast(pPlayer->m_fMaxHealth)); +#endif + Ui::EditReference("Health", pPlayer->m_fHealth, 0, 100, BY_GAME(static_cast(pPlayer->m_fMaxHealth), 100)); +#ifdef GTASA Ui::EditStat("Lung capacity", STAT_LUNG_CAPACITY); Ui::EditStat("Max health", STAT_MAX_HEALTH, 0, 569, 1450); Ui::EditAddress("Money", 0xB7CE50, -99999999, 0, 99999999); +#elif GTAVC + int money = pInfo->m_nMoney; + Ui::EditAddress("Money", (int)&money, -9999999, 0, 99999999); + pInfo->m_nMoney = money; + pInfo->m_nDisplayMoney = money; +#endif + + +#ifdef GTASA Ui::EditStat("Muscle", STAT_MUSCLE); Ui::EditStat("Respect", STAT_RESPECT); Ui::EditStat("Stamina", STAT_STAMINA); +#endif if (ImGui::CollapsingHeader("Wanted level")) { +#ifdef GTASA int val = pPlayer->m_pPlayerData->m_pWanted->m_nWantedLevel; int max_wl = pPlayer->m_pPlayerData->m_pWanted->MaximumWantedLevel; - max_wl = max_wl < 6 ? 6 : max_wl; + max_wl = max_wl < 6 ? 6 : max_wl; +#elif GTAVC + int val = pPlayer->m_pWanted->m_nWantedLevel; + int max_wl = 6; +#endif ImGui::Columns(3, 0, false); ImGui::Text("Min: 0"); @@ -371,21 +479,45 @@ void Player::Draw() ImGui::Spacing(); if (ImGui::InputInt("Set value##Wanted level", &val)) + { +#ifdef GTASA pPlayer->CheatWantedLevel(val); +#elif GTAVC + pPlayer->m_pWanted->CheatWantedLevel(val); +#endif + } ImGui::Spacing(); if (ImGui::Button("Minimum##Wanted level", Ui::GetSize(3))) + { +#ifdef GTASA pPlayer->CheatWantedLevel(0); +#elif GTAVC + pPlayer->m_pWanted->CheatWantedLevel(0); +#endif + } ImGui::SameLine(); if (ImGui::Button("Default##Wanted level", Ui::GetSize(3))) + { +#ifdef GTASA pPlayer->CheatWantedLevel(0); +#elif GTAVC + pPlayer->m_pWanted->CheatWantedLevel(0); +#endif + } ImGui::SameLine(); if (ImGui::Button("Maximum##Wanted level", Ui::GetSize(3))) + { +#ifdef GTASA pPlayer->CheatWantedLevel(max_wl); +#elif GTAVC + pPlayer->m_pWanted->CheatWantedLevel(max_wl); +#endif + } ImGui::Spacing(); ImGui::Separator(); @@ -395,14 +527,15 @@ void Player::Draw() ImGui::EndTabItem(); } +#ifdef GTASA if (ImGui::BeginTabItem("Appearance")) { ImGui::Spacing(); - if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger, - (("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with a weapon and press ") - + Ui::GetHotKeyNameString(Menu::m_HotKeys::aimSkinChanger)).c_str())) - config.SetValue("aim_skin_changer", m_bAimSkinChanger); + if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger, + (("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with a weapon and press ") + + Ui::GetHotKeyNameString(Menu::m_HotKeys::aimSkinChanger)).c_str())) + config.SetValue("aim_skin_changer", m_bAimSkinChanger); if (ImGui::BeginTabBar("AppearanceTabBar")) { if (ImGui::BeginTabItem("Clothes")) @@ -418,23 +551,23 @@ void Player::Draw() if (bClothOption == 0) { Ui::DrawImages(m_ClothData.m_ImagesList, ImVec2(70, 100), m_ClothData.m_Categories, m_ClothData.m_Selected, - m_ClothData.m_Filter, ChangePlayerCloth, nullptr, - [](std::string str) - { - std::stringstream ss(str); - std::string temp; + m_ClothData.m_Filter, ChangePlayerCloth, nullptr, + [](std::string str) + { + std::stringstream ss(str); + std::string temp; - getline(ss, temp, '$'); - getline(ss, temp, '$'); + getline(ss, temp, '$'); + getline(ss, temp, '$'); - return temp; - }, nullptr, cloth_category, sizeof(cloth_category)/ sizeof(const char*)); + return temp; + }, nullptr, cloth_category, sizeof(cloth_category) / sizeof(const char*)); } else { size_t count = 0; - if(ImGui::Button("Remove all", ImVec2(Ui::GetSize(2)))) + if (ImGui::Button("Remove all", ImVec2(Ui::GetSize(2)))) { CPlayerPed* player = FindPlayerPed(); for (uint i = 0; i < 18; i++) @@ -446,14 +579,14 @@ void Player::Draw() ImGui::SameLine(); for (const char* clothName : cloth_category) { - if(ImGui::Button(clothName, ImVec2(Ui::GetSize(2)))) + if (ImGui::Button(clothName, ImVec2(Ui::GetSize(2)))) { CPlayerPed* player = FindPlayerPed(); player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(0u, 0u, count); CClothes::RebuildPlayer(player, false); } - if (count %2 != 0) + if (count % 2 != 0) { ImGui::SameLine(); } @@ -480,8 +613,8 @@ void Player::Draw() if (ImGui::BeginTabItem("Ped skins")) { Ui::DrawImages(Ped::m_PedData.m_ImagesList, ImVec2(65, 110), Ped::m_PedData.m_Categories, - Ped::m_PedData.m_Selected, Ped::m_PedData.m_Filter, ChangePlayerModel, nullptr, - [](std::string str) { return Ped::m_PedData.m_Json.m_Data[str].get(); }); + Ped::m_PedData.m_Selected, Ped::m_PedData.m_Filter, ChangePlayerModel, nullptr, + [](std::string str) { return Ped::m_PedData.m_Json.m_Data[str].get(); }); ImGui::EndTabItem(); } if (ImGui::BeginTabItem("Custom skins")) @@ -491,8 +624,8 @@ void Player::Draw() if (m_bModloaderInstalled) { Ui::FilterWithHint("Search", m_ClothData.m_Filter, - std::string("Total skins: " + std::to_string(m_CustomSkins::m_List.size())) - .c_str()); + std::string("Total skins: " + std::to_string(m_CustomSkins::m_List.size())) + .c_str()); Ui::ShowTooltip("Place your dff & txd files inside 'modloader/Custom Skins'"); ImGui::Spacing(); ImGui::TextWrapped( @@ -525,7 +658,7 @@ Limitations:\n\ ImGui::Spacing(); if (ImGui::Button("Download Modloader", ImVec2(Ui::GetSize(1)))) ShellExecute(NULL, "open", "https://gtaforums.com/topic/669520-mod-loader/", NULL, NULL, - SW_SHOWNORMAL); + SW_SHOWNORMAL); } ImGui::EndTabItem(); } @@ -533,7 +666,16 @@ Limitations:\n\ } ImGui::EndTabItem(); } - +#elif GTAVC + if (ImGui::BeginTabItem("Skins")) + { + ImGui::Spacing(); + ImGui::Text("Info"); + Ui::ShowTooltip("Not all ped skins work. I've added the ones that works!"); + Ui::DrawJSON(tempPedData.m_Json, tempPedData.m_Categories, tempPedData.m_Selected, tempPedData.m_Filter, ChangePlayerModel, nullptr); + ImGui::EndTabItem(); + } +#endif ImGui::EndTabBar(); } } diff --git a/src/Player.h b/src/Player.h index 3347568..73cf8d4 100644 --- a/src/Player.h +++ b/src/Player.h @@ -1,11 +1,11 @@ #pragma once +#include "pch.h" + class Player { private: inline static bool m_bGodMode; - inline static int m_nUiBodyState; inline static bool m_bAimSkinChanger; - inline static SSearchData m_ClothData; inline static bool m_bImagesLoaded; inline static bool m_bModloaderInstalled; struct m_KeepPosition @@ -13,16 +13,29 @@ private: inline static bool m_bEnabled = false; inline static CVector m_fPos; }; + + #ifdef GTASA + inline static int m_nUiBodyState; + inline static SSearchData m_ClothData; struct m_CustomSkins { inline static std::string m_Path = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");; inline static ImGuiTextFilter m_Filter; inline static std::vector m_List; }; + #endif public: Player(); - static void ChangePlayerCloth(std::string& model); + +#ifdef GTASA static void ChangePlayerModel(std::string& model); +#elif GTAVC + static void ChangePlayerModel(std::string& cat, std::string& name, std::string& id); +#endif static void Draw(); + + #ifdef GTASA + static void ChangePlayerCloth(std::string& model); + #endif }; diff --git a/src/Teleport.cpp b/src/Teleport.cpp index 1199b55..93446ce 100644 --- a/src/Teleport.cpp +++ b/src/Teleport.cpp @@ -51,7 +51,7 @@ Teleport::Teleport() CPlayerPed* player = FindPlayerPed(); #ifdef GTASA - CEntity* player_entity = FindPlayerEntity(); + CEntity* player_entity = FindPlayerEntity(-1); m_Teleport::m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y, m_Teleport::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f; #elif GTAVC diff --git a/src/Teleport.h b/src/Teleport.h index 32dfa42..46b4894 100644 --- a/src/Teleport.h +++ b/src/Teleport.h @@ -8,29 +8,29 @@ private: inline static bool m_bInsertCoord; inline static bool m_bQuickTeleport; inline static char m_nInputBuffer[INPUT_BUFFER_SIZE]; - inline static SSearchData tp_data{"teleport"}; + inline static SSearchData tp_data{ "teleport" }; inline static char m_nLocationBuffer[INPUT_BUFFER_SIZE]; inline static uint m_nQuickTeleportTimer; - #ifdef GTASA +#ifdef GTASA inline static CJson m_SpriteJson = CJson("radar sprite"); - #endif +#endif struct m_Teleport { inline static bool m_bEnabled; - inline static CVector m_fPos = {-1, -1, -1}; + inline static CVector m_fPos = { -1, -1, -1 }; inline static uint m_nTimer; }; - #ifdef GTASA - /* - Generates radar sprite coordinates on the fly. - Shouldn't get saved in 'teleport.json', needs to be cleared at game shutdown. - */ +#ifdef GTASA +/* + Generates radar sprite coordinates on the fly. + Shouldn't get saved in 'teleport.json', needs to be cleared at game shutdown. +*/ static void FetchRadarSpriteData(); - #endif +#endif protected: Teleport(); diff --git a/src/Ui.cpp b/src/Ui.cpp index b4fc915..6a33e26 100644 --- a/src/Ui.cpp +++ b/src/Ui.cpp @@ -45,7 +45,7 @@ bool Ui::ListBoxStr(const char* label, std::vector& all_items, std: bool Ui::ListBoxCustomNames(const char* label, std::vector& all_items, std::string& selected, const char* custom_names[], size_t length) { bool rtn = false; - std::string display_selected = (selected == "All") ? selected: custom_names[std::stoi(selected)]; + std::string display_selected = (selected == "All") ? selected : custom_names[std::stoi(selected)]; if (ImGui::BeginCombo(label, display_selected.c_str())) { @@ -249,7 +249,7 @@ bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_ ImGui::InvisibleButton("?", ImGui::CalcTextSize("?", nullptr, true)); min = ImGui::GetItemRectMin(); drawlist->AddText(ImVec2(min.x, min.y + style.ItemInnerSpacing.y), ImGui::GetColorU32(ImGuiCol_TextDisabled), - "?"); + "?"); if (ImGui::IsItemHovered() && !is_disabled) { @@ -317,7 +317,7 @@ bool Ui::CheckboxAddressVar(const char* label, bool val, int addr, const char* h } bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val, - const char* hint) + const char* hint) { bool rtn = false; bool state = val; @@ -348,9 +348,9 @@ bool Ui::CheckboxBitFlag(const char* label, uint flag, const char* hint) } void Ui::DrawJSON(CJson& json, std::vector& combo_items, std::string& selected_item, - ImGuiTextFilter& filter, - std::function func_left_click, - std::function func_right_click) + ImGuiTextFilter& filter, + std::function func_left_click, + std::function func_right_click) { ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5); ListBoxStr("##Categories", combo_items, selected_item); @@ -485,10 +485,10 @@ void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* // clean up the code someday void Ui::DrawImages(std::vector>& img_vec, ImVec2 image_size, - std::vector& category_vec, std::string& selected_item, ImGuiTextFilter& filter, - std::function on_left_click, std::function on_right_click, - std::function get_name_func, - std::function verify_func, const char** custom_names, size_t length) + std::vector& category_vec, std::string& selected_item, ImGuiTextFilter& filter, + std::function on_left_click, std::function on_right_click, + std::function get_name_func, + std::function verify_func, const char** custom_names, size_t length) { // scale image size image_size.x *= screen::GetScreenWidth() / 1366.0f; @@ -540,13 +540,12 @@ void Ui::DrawImages(std::vector>& img_vec, Im } else { - IDirect3DTexture9* texture = (IDirect3DTexture9*)Util::GetTextureFromRaster(img_vec[i]->m_pRwTexture); - if (ImGui::ImageButton(texture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1),ImVec4(1, 1, 1, 1))) + if (ImGui::ImageButton(img_vec[i]->m_pTexture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1))) { on_left_click(text); } } - + if (ImGui::IsItemClicked(1) && on_right_click != nullptr) { @@ -769,7 +768,7 @@ void Ui::EditBits(const char* label, const int address, const std::vector& color, ImVec2 size) { ImDrawList* drawlist = ImGui::GetWindowDrawList(); drawlist->AddRectFilled(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), - ImGui::GetColorU32(ImGuiCol_ModalWindowDimBg)); + ImGui::GetColorU32(ImGuiCol_ModalWindowDimBg)); } return rtn; diff --git a/src/Ui.h b/src/Ui.h index dc6a178..c25229a 100644 --- a/src/Ui.h +++ b/src/Ui.h @@ -40,19 +40,19 @@ public: static bool ColorButton(int color_id, std::vector& color, ImVec2 size); static bool CheckboxAddress(const char* label, int addr = NULL, const char* hint = nullptr); static bool CheckboxAddressEx(const char* label, int addr = NULL, int enabled_val = 1, int disabled_val = 0, - const char* hint = nullptr); + const char* hint = nullptr); static bool CheckboxAddressVar(const char* label, bool val, int addr, const char* hint = nullptr); static bool CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val, - const char* hint = nullptr); + const char* hint = nullptr); static bool CheckboxBitFlag(const char* label, uint flag, const char* hint = nullptr); static bool CheckboxWithHint(const char* label, bool* state, const char* hint = nullptr, bool is_disabled = false); static void DrawHeaders(CallbackTable& data); static void DrawJSON(CJson& json, std::vector& combo_items, std::string& selected_item, - ImGuiTextFilter& filter, - std::function func_left_click, - std::function func_right_click); - static void DrawImages( std::vector>& img_vec, ImVec2 image_size, + ImGuiTextFilter& filter, + std::function func_left_click, + std::function func_right_click); + static void DrawImages(std::vector>& img_vec, ImVec2 image_size, std::vector& category_vec, std::string& selected_item, ImGuiTextFilter& filter, std::function on_left_click, std::function on_right_click, @@ -68,11 +68,11 @@ public: static void EditReference(const char* label, T& address, int min = 0, int def = 0, int max = 100); static void EditRadioButtonAddress(const char* label, std::vector& named_mem); static void EditRadioButtonAddressEx(const char* label, int addr, std::vector& named_val); - - #ifdef GTASA + +#ifdef GTASA static void EditStat(const char* label, int stat_id, int min = 0, int def = 0, int max = 1000); - #endif - +#endif + static void FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint); static ImVec2 GetSize(short count = 1, bool spacing = true); diff --git a/src/Util.cpp b/src/Util.cpp index a4b1b11..1b0c077 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -3,13 +3,14 @@ #include "psapi.h" #include "CFileLoader.h" -void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_name) +void Util::LoadTextureDirectory(SSearchData& data, char* path, bool pass_full_name) { RwTexDictionary* pRwTexDictionary = &data.txd; + // allow SA textures for VC pRwTexDictionary = CFileLoader::LoadTexDictionary(path); - if (pRwTexDictionary) + if (pRwTexDictionary) { // FIX ME if (pass_full_name) @@ -19,6 +20,7 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na SSearchData* sdata = reinterpret_cast(data); sdata->m_ImagesList.push_back(std::make_unique()); sdata->m_ImagesList.back().get()->m_pRwTexture = tex; + sdata->m_ImagesList.back().get()->m_pTexture = Util::GetTextureFromRaster(tex); std::stringstream ss(tex->name); std::string str; @@ -41,6 +43,7 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na SSearchData* sdata = reinterpret_cast(data); sdata->m_ImagesList.push_back(std::make_unique()); sdata->m_ImagesList.back().get()->m_pRwTexture = tex; + sdata->m_ImagesList.back().get()->m_pTexture = Util::GetTextureFromRaster(tex); std::stringstream ss(tex->name); std::string str; @@ -60,16 +63,17 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na } } -void* Util::GetTextureFromRaster(RwTexture *pTexture) + +void* Util::GetTextureFromRaster(RwTexture* pTexture) { RwRasterEx* raster = (RwRasterEx*)(&pTexture->raster->parent); - + return (&raster->renderResource->texture); } std::string Util::GetLocationName(CVector* pos) { - #ifdef GTASA +#ifdef GTASA int hplayer = CPools::GetPedRef(FindPlayerPed()); int interior = 0; @@ -81,27 +85,27 @@ std::string Util::GetLocationName(CVector* pos) switch (city) { - case 0: - town = "CS"; - break; - case 1: - town = "LS"; - break; - case 2: - town = "SF"; - break; - case 3: - town = "LV"; - break; + case 0: + town = "CS"; + break; + case 1: + town = "LS"; + break; + case 2: + town = "SF"; + break; + case 3: + town = "LV"; + break; } if (interior == 0) return CTheZones::FindSmallestZoneForPosition(*pos, true)->GetTranslatedName() + std::string(", ") + town; return std::string("Interior ") + std::to_string(interior) + ", " + town; - - #elif GTAVC + +#elif GTAVC return "Vice City"; - #endif +#endif } #ifdef GTASA @@ -165,7 +169,7 @@ int Util::GetLargestGangInZone() CZoneExtraInfo* zone_info = CTheZones::GetZoneInfo(&pos, nullptr); int density = zone_info->m_nGangDensity[i]; - + if (density > max_density) { max_density = density; diff --git a/src/Util.h b/src/Util.h index 334b256..afe81ae 100644 --- a/src/Util.h +++ b/src/Util.h @@ -12,15 +12,15 @@ class Util { public: - #ifdef GTASA +#ifdef GTASA static void ClearCharTasksVehCheck(CPed* ped); static CPed* GetClosestPed(); static CVehicle* GetClosestVehicle(); static int GetLargestGangInZone(); static bool IsOnCutscene(); static RwTexture* LoadTextureFromMemory(char* data, unsigned int size); - #endif - +#endif + static std::string GetLocationName(CVector* pos); static bool IsOnMission(); static void RainbowValues(int& r, int& g, int& b, float speed); diff --git a/src/Vehicle.cpp b/src/Vehicle.cpp index 4f33939..ae755ee 100644 --- a/src/Vehicle.cpp +++ b/src/Vehicle.cpp @@ -138,9 +138,9 @@ Vehicle::Vehicle() if (veh->m_nVehicleSubClass == VEHICLE_BIKE || veh->m_nVehicleSubClass == VEHICLE_BMX) { if (sqrt(veh->m_vecMoveSpeed.x * veh->m_vecMoveSpeed.x - + veh->m_vecMoveSpeed.y * veh->m_vecMoveSpeed.y - + veh->m_vecMoveSpeed.z * veh->m_vecMoveSpeed.z - ) > 0.0 + + veh->m_vecMoveSpeed.y * veh->m_vecMoveSpeed.y + + veh->m_vecMoveSpeed.z * veh->m_vecMoveSpeed.z + ) > 0.0 && CTimer::ms_fTimeStep > 0.0) { veh->FlyingControl(3, -9999.9902f, -9999.9902f, -9999.9902f, -9999.9902f); @@ -208,21 +208,21 @@ int Vehicle::GetRandomTrainIdForModel(int model) switch (model) { - case 449: - _start = 0; - _end = 1; - break; - case 537: - _start = 2; - _end = 7; - break; - case 538: - _start = 8; - _end = 10; - break; - default: - SetHelpMessage("Invalid train model", false, false, false); - return -1; + case 449: + _start = 0; + _end = 1; + break; + case 537: + _start = 2; + _end = 7; + break; + case 538: + _start = 8; + _end = 10; + break; + default: + SetHelpMessage("Invalid train model", false, false, false); + return -1; } int id = Random(_start, _end); return train_ids[id]; @@ -329,7 +329,7 @@ void Vehicle::ParseCarcolsDAT() getline(ss, temp, ','); int blue = std::stoi(temp); - std::vector color = {red / 255.0f, green / 255.0f, blue / 255.0f}; + std::vector color = { red / 255.0f, green / 255.0f, blue / 255.0f }; m_CarcolsColorData.push_back(color); ++count; @@ -437,7 +437,7 @@ void Vehicle::SpawnVehicle(std::string& smodel) int track = Random(0, 1); int node = CTrain::FindClosestTrackNode(pos, &track); CTrain::CreateMissionTrain(pos, (Random(0, 1)) == 1 ? true : false, train_id, &train, &carraige, node, - track, false); + track, false); veh = (CVehicle*)train; hveh = CPools::GetVehicleRef(veh); @@ -631,7 +631,7 @@ void Vehicle::Draw() Ui::CheckboxAddress("Cars fly", 0x969160); Ui::CheckboxWithHint("Cars heavy", &m_bVehHeavy); if (Ui::CheckboxWithHint("Damage proof", &m_bNoDamage, - "Every vehicle entered will be damage proof\nBullet, Collision, Explosion, Fire, Meele etc")) + "Every vehicle entered will be damage proof\nBullet, Collision, Explosion, Fire, Meele etc")) { if (pVeh && !m_bNoDamage) { @@ -779,7 +779,7 @@ void Vehicle::Draw() ImGui::SameLine(); if (ImGui::Button((std::string("Passenger ") + std::to_string(i + 1)).c_str(), - ImVec2(Ui::GetSize(2)))) + ImVec2(Ui::GetSize(2)))) Command(hplayer, veh, i); } } @@ -796,7 +796,7 @@ void Vehicle::Draw() if (ImGui::Button("Remove vehicles", Ui::GetSize(1))) { CPlayerPed* player = FindPlayerPed(); - for (CVehicle *pVeh : CPools::ms_pVehiclePool) + for (CVehicle* pVeh : CPools::ms_pVehiclePool) { if (DistanceBetweenPoints(pVeh->GetPosition(), player->GetPosition()) < m_nVehRemoveRadius && !(player->m_nPedFlags.bInVehicle && player->m_pVehicle == pVeh)) @@ -810,7 +810,7 @@ void Vehicle::Draw() } if (ImGui::CollapsingHeader("Traffic options")) { - static std::vector color{{"Black", 0x969151}, {"Pink", 0x969150}}; + static std::vector color{ {"Black", 0x969151}, {"Pink", 0x969150} }; static std::vector type{ {"Cheap", 0x96915E}, {"Country", 0x96917B}, {"Fast", 0x96915F} }; @@ -849,20 +849,20 @@ void Vehicle::Draw() { switch (m_nDoorMenuButton) { - case 0: - Command(hveh, i); - break; - case 1: - Command(hveh, i); - break; - case 2: - Command(hveh, i); - break; - case 3: - Command(hveh, i); - break; - default: - break; + case 0: + Command(hveh, i); + break; + case 1: + Command(hveh, i); + break; + case 2: + Command(hveh, i); + break; + case 3: + Command(hveh, i); + break; + default: + break; } } } @@ -873,20 +873,20 @@ void Vehicle::Draw() { switch (m_nDoorMenuButton) { - case 0: - Command(hveh, i); - break; - case 1: - Command(hveh, i); - break; - case 2: - Command(hveh, i); - break; - case 3: - Command(hveh, i); - break; - default: - break; + case 0: + Command(hveh, i); + break; + case 1: + Command(hveh, i); + break; + case 2: + Command(hveh, i); + break; + case 3: + Command(hveh, i); + break; + default: + break; } } @@ -935,11 +935,11 @@ void Vehicle::Draw() ImGui::InputTextWithHint("##LicenseText", "License plate text", m_Spawner::m_nLicenseText, 9); Ui::DrawImages(m_Spawner::m_VehData.m_ImagesList, ImVec2(100, 75), m_Spawner::m_VehData.m_Categories, - m_Spawner::m_VehData.m_Selected, m_Spawner::m_VehData.m_Filter, SpawnVehicle, nullptr, - [](std::string str) - { - return GetNameFromModel(std::stoi(str)); - }); + m_Spawner::m_VehData.m_Selected, m_Spawner::m_VehData.m_Filter, SpawnVehicle, nullptr, + [](std::string str) + { + return GetNameFromModel(std::stoi(str)); + }); ImGui::EndTabItem(); } @@ -966,7 +966,7 @@ void Vehicle::Draw() uchar r = m_Color::m_fColorPicker[0] * 255; uchar g = m_Color::m_fColorPicker[1] * 255; uchar b = m_Color::m_fColorPicker[2] * 255; - Paint::SetNodeColor(veh, Paint::veh_nodes::selected, {r, g, b, 255}, m_Color::m_bMatFilter); + Paint::SetNodeColor(veh, Paint::veh_nodes::selected, { r, g, b, 255 }, m_Color::m_bMatFilter); } ImGui::Spacing(); @@ -1012,7 +1012,7 @@ void Vehicle::Draw() for (int colorId : entry.second) { if (Ui::ColorButton(colorId, m_CarcolsColorData[colorId], - ImVec2(btnSize, btnSize))) + ImVec2(btnSize, btnSize))) *(uint8_replacement*)(int(veh) + 0x433 + m_Color::m_nRadioButton) = colorId; if (count % btnsInRow != 0) @@ -1131,7 +1131,7 @@ void Vehicle::Draw() m_Color::m_bMatFilter); }, nullptr, - [](std::string& str) + [](std::string& str) { return str; }); @@ -1143,14 +1143,14 @@ void Vehicle::Draw() { ImGui::Spacing(); Ui::DrawImages(m_TuneData.m_ImagesList, ImVec2(100, 80), m_TuneData.m_Categories, m_TuneData.m_Selected, - m_TuneData.m_Filter, - [](std::string& str) { AddComponent(str); }, - [](std::string& str) { RemoveComponent(str); }, - [](std::string& str) { return str; }, - [](std::string& str) - { - return ((bool(*)(int, CVehicle*))0x49B010)(std::stoi(str), player->m_pVehicle); - } + m_TuneData.m_Filter, + [](std::string& str) { AddComponent(str); }, + [](std::string& str) { RemoveComponent(str); }, + [](std::string& str) { return str; }, + [](std::string& str) + { + return ((bool(*)(int, CVehicle*))0x49B010)(std::stoi(str), player->m_pVehicle); + } ); ImGui::EndTabItem(); @@ -1182,13 +1182,13 @@ void Vehicle::Draw() if (ImGui::Button("Read more", ImVec2(Ui::GetSize(3)))) ShellExecute(NULL, "open", "https://projectcerbera.com/gta/sa/tutorials/handling", NULL, NULL, - SW_SHOWNORMAL); + SW_SHOWNORMAL); ImGui::Spacing(); ImGui::BeginChild("HandlingChild"); - static std::vector abs{{"On", 1}, {"Off", 0}}; + static std::vector abs{ {"On", 1}, {"Off", 0} }; Ui::EditRadioButtonAddressEx("Abs", pHandling + 0x9C, abs); Ui::EditFloat("Anti dive multiplier", pHandling + 0xC4, 0.0f, 0.0f, 1.0f); @@ -1209,10 +1209,10 @@ void Vehicle::Draw() Ui::EditFloat("Engine acceleration", pHandling + 0x7C, 0.0f, 0.0f, 49.0f, 12500.0f); Ui::EditFloat("Engine inertia", pHandling + 0x80, 0.0f, 0.0f, 400.0f); - static std::vector engine_type{{"Petrol", 80}, {"Diseal", 68}, {"Electric", 69}}; + static std::vector engine_type{ {"Petrol", 80}, {"Diseal", 68}, {"Electric", 69} }; Ui::EditRadioButtonAddressEx("Engine type", pHandling + 0x75, engine_type); - std::vector front_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}}; + std::vector front_lights{ {"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3} }; Ui::EditRadioButtonAddressEx("Front lights", pHandling + 0xDC, front_lights); Ui::EditFloat("Force level", pHandling + 0xAC, -10.0f, -10.0f, 10.0f); // test later @@ -1231,7 +1231,7 @@ void Vehicle::Draw() Ui::EditAddress("Number of gears", pHandling + 0x76, 1, 1, 10); Ui::EditAddress("Percent submerged", pHandling + 0x20, 10, 10, 120); - static std::vector rear_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}}; + static std::vector rear_lights{ {"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3} }; Ui::EditRadioButtonAddressEx("Rear lights", pHandling + 0xDD, rear_lights); Ui::EditFloat("Seat offset distance", pHandling + 0xD4, 0.0f, 0.0f, 1.0f); diff --git a/src/Vehicle.h b/src/Vehicle.h index 86a632e..05e8692 100644 --- a/src/Vehicle.h +++ b/src/Vehicle.h @@ -12,7 +12,7 @@ private: inline static bool m_bNoDamage; inline static int m_nDoorMenuButton; inline static std::string m_DoorNames[6] = - {"Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door"}; + { "Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door" }; inline static int m_nVehRemoveRadius; inline static bool m_bLockSpeed; inline static float m_fLockSpeed; @@ -24,11 +24,11 @@ private: inline static bool m_bMatFilter = true; inline static int m_nRadioButton = 1; inline static bool bShowAll; - inline static float m_fColorPicker[3]{0, 0, 0}; + inline static float m_fColorPicker[3]{ 0, 0, 0 }; }; struct m_Neon { - inline static float m_fColorPicker[3]{0, 0, 0}; + inline static float m_fColorPicker[3]{ 0, 0, 0 }; inline static bool m_bRainbowEffect; inline static uint m_nRainbowTimer; inline static bool m_bApplyOnTraffic; @@ -49,7 +49,7 @@ private: inline static bool m_bCompAdded; }; - inline static std::vector (m_HandlingFlagNames) = // 32 flags + inline static std::vector(m_HandlingFlagNames) = // 32 flags { "1G_BOOST", "2G_BOOST", "NPC_ANTI_ROLL", "NPC_NEUTRAL_HANDL", "NO_HANDBRAKE", "STEER_REARWHEELS", "HB_REARWHEEL_STEER", "ALT_STEER_OPT", @@ -61,7 +61,7 @@ private: "Unused 4" }; - inline static std::vector (m_ModelFlagNames) = // 32 flags + inline static std::vector(m_ModelFlagNames) = // 32 flags { "IS_VAN", "IS_BUS", "IS_LOW", "IS_BIG", "REVERSE_BONNET", "HANGING_BOOT", "TAILGATE_BOOT", "NOSWING_BOOT", "NO_DOORS", "TANDEM_SEATS", diff --git a/src/Visual.cpp b/src/Visual.cpp index 1a62d1d..18cee63 100644 --- a/src/Visual.cpp +++ b/src/Visual.cpp @@ -57,7 +57,7 @@ bool Visual::TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, auto green = static_cast(patch::GetPointer(int(g))); auto blue = static_cast(patch::GetPointer(int(b))); - float col[3]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f}; + float col[3]{ red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f }; if (ImGui::ColorEdit3(label, col, flags)) { @@ -80,7 +80,7 @@ bool Visual::TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, auto blue = static_cast(patch::GetPointer(int(b))); auto alpha = static_cast(patch::GetPointer(int(a))); - float col[4]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f}; + float col[4]{ red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f }; if (ImGui::ColorEdit4(label, col, flags)) { @@ -322,7 +322,7 @@ void Visual::Draw() {"No outline", 0}, {"Thin outline", 1}, {"Default outline", 2} }; Ui::EditRadioButtonAddressEx("Money font outline", 0x58F58D, font_outline); - static std::vector style{{"Style 1", 1}, {"Style 2", 2}, {"Default style", 3}}; + static std::vector style{ {"Style 1", 1}, {"Style 2", 2}, {"Default style", 3} }; Ui::EditRadioButtonAddressEx("Money font style", 0x58F57F, style); Ui::EditAddress("Radar Height", *(int*)0x5834F6, 0, 76, 999); Ui::EditAddress("Radar Width", *(int*)0x5834C2, 0, 94, 999); @@ -330,7 +330,7 @@ void Visual::Draw() Ui::EditAddress("Radar posY", *(int*)0x583500, -999, 104, 999); Ui::EditAddress("Radar zoom", 0xA444A3, 0, 0, 170); Ui::ColorPickerAddress("Radio station color", 0xBAB24C, ImVec4(150, 150, 150, 255)); - static std::vector star_border{{"No border", 0}, {"Default", 1}, {"Bold border", 2}}; + static std::vector star_border{ {"No border", 0}, {"Default", 1}, {"Bold border", 2} }; Ui::EditRadioButtonAddressEx("Wanted star border", 0x58DD41, star_border); Ui::EditAddress("Wanted posX", *(int*)0x58DD0F, -999, 29, 999); Ui::EditAddress("Wanted posY", *(int*)0x58DDFC, -999, 114, 999); @@ -400,6 +400,17 @@ void Visual::Draw() Ui::ShowTooltip("Sync system time is enabled.\n(Game/Sync system time)"); } + if (ImGui::Checkbox("Freeze game time", &Game::m_bFreezeTime)) + { + if (Game::m_bFreezeTime) + { + patch::SetRaw(0x52CF10, (char*)"\xEB\xEF", 2); + } + else + { + patch::SetRaw(0x52CF10, (char*)"\x56\x8B", 2); + } + } ImGui::Spacing(); if (ImGui::BeginTabBar("Timecyc subtab", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll)) { @@ -411,7 +422,7 @@ void Visual::Draw() TimeCycColorEdit3("Ambient", m_nAmbientRed, m_nAmbientGreen, m_nAmbientBlue); TimeCycColorEdit3("Ambient obj", m_nAmbientRed_Obj, m_nAmbientGreen_Obj, m_nAmbientBlue_Obj); TimeCycColorEdit3("Fluffy clouds", m_nFluffyCloudsBottomRed, m_nFluffyCloudsBottomGreen, - m_nFluffyCloudsBottomBlue); + m_nFluffyCloudsBottomBlue); TimeCycColorEdit3("Low clouds", m_nLowCloudsRed, m_nLowCloudsGreen, m_nLowCloudsBlue); TimeCycColorEdit4("Postfx 1", m_fPostFx1Red, m_fPostFx1Green, m_fPostFx1Blue, m_fPostFx1Alpha); diff --git a/src/Visual.h b/src/Visual.h index 3084e16..f7006de 100644 --- a/src/Visual.h +++ b/src/Visual.h @@ -20,7 +20,7 @@ private: static int GetCurrentHourTimeId(int hour = -1); static bool TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, ImGuiColorEditFlags flags = 0); static bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, - ImGuiColorEditFlags flags = 0); + ImGuiColorEditFlags flags = 0); template static void TimecycSlider(const char* label, T* data, int min, int max); public: diff --git a/src/Weapon.cpp b/src/Weapon.cpp index 7c931d2..bf846df 100644 --- a/src/Weapon.cpp +++ b/src/Weapon.cpp @@ -80,7 +80,7 @@ void Weapon::SetGangWeapon(std::string& weapon_type) { m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon] = std::stoi(weapon_type); CGangs::SetGangWeapons(m_nSelectedGang, m_nGangWeaponList[m_nSelectedGang][0], m_nGangWeaponList[m_nSelectedGang][1], - m_nGangWeaponList[m_nSelectedGang][2]); + m_nGangWeaponList[m_nSelectedGang][2]); } void Weapon::GiveWeaponToPlayer(std::string& weapon_type) @@ -153,7 +153,7 @@ void Weapon::Draw() } ImGui::Spacing(); - + if (ImGui::BeginTabBar("Ped", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll)) { @@ -165,7 +165,7 @@ void Weapon::Draw() Ui::CheckboxWithHint("Fast aim", &m_bAutoAim, "Enables aim assist on keyboard\n\nQ = left E = right\n\nPress Q and E to switch targets.\nMoving mouse removes the target!"); if (Ui::CheckboxWithHint("Dual wield", &m_bDualWeild, - "Dual wield pistol, shawoff, uzi, tec9\n(Other weapons don't work)")) + "Dual wield pistol, shawoff, uzi, tec9\n(Other weapons don't work)")) { if (!m_bDualWeild) { @@ -233,13 +233,13 @@ void Weapon::Draw() ImGui::Spacing(); ImGui::Text("Current weapon: %s", - m_WeaponData.m_Json.m_Data[std::to_string(m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon])].get< - std::string>().c_str()); + m_WeaponData.m_Json.m_Data[std::to_string(m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon])].get< + std::string>().c_str()); ImGui::Spacing(); Ui::DrawImages(m_WeaponData.m_ImagesList, ImVec2(65, 65), m_WeaponData.m_Categories, m_WeaponData.m_Selected, - m_WeaponData.m_Filter, SetGangWeapon, nullptr, - [](std::string str) { return m_WeaponData.m_Json.m_Data[str].get(); }, - [](std::string str) { return str != "-1"; /*Jetpack*/ } + m_WeaponData.m_Filter, SetGangWeapon, nullptr, + [](std::string str) { return m_WeaponData.m_Json.m_Data[str].get(); }, + [](std::string str) { return str != "-1"; /*Jetpack*/ } ); ImGui::EndTabItem(); } @@ -252,9 +252,9 @@ void Weapon::Draw() m_nAmmoCount = (m_nAmmoCount > 99999) ? 99999 : m_nAmmoCount; } Ui::DrawImages(m_WeaponData.m_ImagesList, ImVec2(65, 65), m_WeaponData.m_Categories, m_WeaponData.m_Selected, - m_WeaponData.m_Filter, GiveWeaponToPlayer, nullptr, - [](std::string str) { return m_WeaponData.m_Json.m_Data[str].get(); }, - [](std::string str) { return str != "0"; /*Unarmed*/ } + m_WeaponData.m_Filter, GiveWeaponToPlayer, nullptr, + [](std::string str) { return m_WeaponData.m_Json.m_Data[str].get(); }, + [](std::string str) { return str != "0"; /*Unarmed*/ } ); ImGui::EndTabItem(); } diff --git a/src/Weapon.h b/src/Weapon.h index 3a14ab4..f711843 100644 --- a/src/Weapon.h +++ b/src/Weapon.h @@ -3,7 +3,7 @@ class Weapon { public: - inline static SSearchData m_WeaponData{"weapon"}; + inline static SSearchData m_WeaponData{ "weapon" }; inline static bool m_bImagesLoaded; inline static bool m_bAutoAim; inline static bool m_bFastReload; diff --git a/src/pch.h b/src/pch.h index c08aaab..cfe6c9e 100644 --- a/src/pch.h +++ b/src/pch.h @@ -131,6 +131,7 @@ struct STextureStructure std::string m_FileName; std::string m_CategoryName; RwTexture *m_pRwTexture = nullptr; + void *m_pTexture = nullptr; }; struct SSearchData diff --git a/tools/premake5.lua b/tools/premake5.lua index 69c892c..08a460c 100644 --- a/tools/premake5.lua +++ b/tools/premake5.lua @@ -65,6 +65,8 @@ project "CheatMenuVC" "../src/Json.cpp", "../src/Teleport.h", "../src/Teleport.cpp", + "../src/Player.h", + "../src/Player.cpp", "../src/Ui.h", "../src/Ui.cpp", "../src/Util.h",