diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index 1d8208c..bc855fd 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -264,6 +264,7 @@ AddPed = "Add ped" AddPedMSG = "Ped added" BigHead = "Big head effect" ConfigTab = "Config" +CurrentModels = "Current models" DownloadExGangWars = "Download ExGangWars" ElvisEverywhere = "Elvis everywhere" EndWar = "End gang war" @@ -273,6 +274,7 @@ ExGangWarsTip = "You'll need ExGangWars plugin to display some turf colors" GangsControl = "Gangs control streets" GangsEverywhere = "Gangs everywhere" Gangs = "Gangs" +GangModelEditor = "Gang model editor" GangWars = "Gang wars" GetPlayerModel = "Insert player model" Health = "Health" @@ -292,6 +294,7 @@ RecruitAnyone = "Recruit anyone" RemoveFrozen = "Remove frozen peds" RemovePeds = "Remove peds" RemovePedsRadius = "Remove peds in radius" +ResetModels = "Reset models" SelectedWeapon = "Selected weapon: %s" SelectWeapon = "Select weapon" SlutMagnet = "Slut magnet" @@ -783,6 +786,7 @@ MoveWhenFiring = "Move when firing" NoSpread = "No spread" RapidFire = "Rapid fire" SelectGang = "Select gang" +SelectMember = "Select member" Weapon1 = "Weapon 1" Weapon2 = "Weapon 2" Weapon3 = "Weapon 3" diff --git a/src/pages/ped.cpp b/src/pages/ped.cpp index ad54144..6d38784 100644 --- a/src/pages/ped.cpp +++ b/src/pages/ped.cpp @@ -121,6 +121,22 @@ void PedPage::AddNewPed() } } #ifdef GTASA + +unsigned int PedPage::GangStruct::GetModel(unsigned int gangId, unsigned int memberId) +{ + return CPopulation::m_PedGroups[42 + static_cast(gangId)][memberId]; +} + +void PedPage::GangStruct::SetModel(unsigned int gangId, unsigned int memberId, unsigned int model) +{ + CPopulation::m_PedGroups[42 + static_cast(gangId)][memberId] = model; +} + +void PedPage::GangStruct::ResetModels() +{ + CPopulation::LoadPedGroups(); +} + void PedPage::SpawnPed(std::string& model) #else void PedPage::SpawnPed(std::string& cat, std::string& name, std::string& model) @@ -413,64 +429,99 @@ void PedPage::Draw() } ImGui::EndTabItem(); } - #ifdef GTASA if (ImGui::BeginTabItem(TEXT("Ped.Gangs"))) { ImGui::Spacing(); - if (ImGui::Button(TEXT("Ped.StartWar"), ImVec2(Widget::CalcSize(2)))) - { - if (Util::GetLargestGangInZone() == 1) - { - CGangWars::StartDefensiveGangWar(); - } - else - { - CGangWars::StartOffensiveGangWar(); - } - CGangWars::bGangWarsActive = true; - } - ImGui::SameLine(); - if (ImGui::Button(TEXT("Ped.EndWar"), ImVec2(Widget::CalcSize(2)))) - { - CGangWars::EndGangWar(true); - } - ImGui::Dummy(ImVec2(0, 20)); - ImGui::TextWrapped(TEXT("Ped.ZoneDensity")); - ImGui::Spacing(); - - static const char* m_GangList[] = + if (ImGui::BeginTabBar("GANGGGG")) { - "Ballas", "Grove street families", "Los santos vagos", "San fierro rifa", - "Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10" - }; - ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 2); - for (int i = 0; i != 10; ++i) - { - CVector pos = FindPlayerPed()->GetPosition(); - CZoneInfo* info = CTheZones::GetZoneInfo(&pos, nullptr); - int density = info->m_nGangDensity[i]; - if (ImGui::SliderInt(m_GangList[i], &density, 0, 127)) + if (ImGui::BeginTabItem(TEXT("Ped.GangWars"))) { - info->m_nGangDensity[i] = static_cast(density); - Command(); - CGangWars::bGangWarsActive = true; - } - } - ImGui::PopItemWidth(); - static bool pluginRequired = (GetModuleHandle("ExGangWars.asi") == 0); - if (pluginRequired) - { - ImGui::Spacing(); - ImGui::TextWrapped(TEXT("Ped.ExGangWarsTip")); - ImGui::Spacing(); - if (ImGui::Button(TEXT("Ped.DownloadExGangWars"), Widget::CalcSize(1))) - { - OPEN_LINK("https://gtaforums.com/topic/682194-extended-gang-wars/"); - } - } + ImGui::Spacing(); + if (ImGui::Button(TEXT("Ped.StartWar"), ImVec2(Widget::CalcSize(2)))) + { + if (Util::GetLargestGangInZone() == 1) + { + CGangWars::StartDefensiveGangWar(); + } + else + { + CGangWars::StartOffensiveGangWar(); + } + CGangWars::bGangWarsActive = true; + } + ImGui::SameLine(); + if (ImGui::Button(TEXT("Ped.EndWar"), ImVec2(Widget::CalcSize(2)))) + { + CGangWars::EndGangWar(true); + } + ImGui::Dummy(ImVec2(0, 20)); + ImGui::TextWrapped(TEXT("Ped.ZoneDensity")); + ImGui::Spacing(); + + static const char* m_GangList[] = + { + "Ballas", "Grove street families", "Los santos vagos", "San fierro rifa", + "Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10" + }; + ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 2); + for (int i = 0; i != 10; ++i) + { + CVector pos = FindPlayerPed()->GetPosition(); + CZoneInfo* info = CTheZones::GetZoneInfo(&pos, nullptr); + int density = info->m_nGangDensity[i]; + if (ImGui::SliderInt(m_GangList[i], &density, 0, 127)) + { + info->m_nGangDensity[i] = static_cast(density); + Command(); + CGangWars::bGangWarsActive = true; + } + } + ImGui::PopItemWidth(); + static bool pluginRequired = (GetModuleHandle("ExGangWars.asi") == 0); + if (pluginRequired) + { + ImGui::Spacing(); + ImGui::TextWrapped(TEXT("Ped.ExGangWarsTip")); + ImGui::Spacing(); + if (ImGui::Button(TEXT("Ped.DownloadExGangWars"), Widget::CalcSize(1))) + { + OPEN_LINK("https://gtaforums.com/topic/682194-extended-gang-wars/"); + } + } + ImGui::EndTabItem(); + } + if (ImGui::BeginTabItem(TEXT("Ped.GangModelEditor"))) + { + ImGui::Spacing(); + if (ImGui::Button(TEXT("Ped.ResetModels"), Widget::CalcSize(1))) + { + m_Gang.ResetModels(); + } + ImGui::Spacing(); + ImGui::Combo(TEXT("Weapon.SelectGang"), &m_Gang.m_nSelected, pedPage.m_GangList); + ImGui::Combo(TEXT("Ped.SelectMember"), &m_Gang.m_nSelectedMember, "Member 1\0Member 2\0Member 3\0"); + ImGui::Spacing(); + + int mem1 = m_Gang.GetModel(m_Gang.m_nSelected, 0); + int mem2 = m_Gang.GetModel(m_Gang.m_nSelected, 1); + int mem3 = m_Gang.GetModel(m_Gang.m_nSelected, 2); + ImGui::Text("%s: %d, %d, %d", TEXT("Ped.CurrentModels"), mem1, mem2, mem3); + + ImGui::Spacing(); + + Widget::ImageList(m_PedData, [this](str &id){ + m_Gang.SetModel(m_Gang.m_nSelected, m_Gang.m_nSelectedMember, std::stoi(id)); + }, + [this](str &text){ + return m_PedData.m_pData->Get(text.c_str(), "Unknown"); + }); + ImGui::EndTabItem(); + } + ImGui::EndTabBar(); + } ImGui::EndTabItem(); } #endif diff --git a/src/pages/ped.h b/src/pages/ped.h index 504c82b..3b34af0 100644 --- a/src/pages/ped.h +++ b/src/pages/ped.h @@ -18,6 +18,16 @@ private: int m_nWeaponId; } m_Spawner; + struct GangStruct + { + int m_nSelected; + int m_nSelectedMember; + + unsigned int GetModel(unsigned int gangId, unsigned int memberId); + void SetModel(unsigned int gangId, unsigned int memberId, unsigned int model); + void ResetModels(); + } m_Gang; + friend class IFeature; PedPage(); @@ -37,6 +47,12 @@ public: #ifdef GTASA DataStore m_SpecialPedData {"special_peds"}; ResourceStore m_PedData{"peds", eResourceType::TYPE_IMAGE_TEXT, ImVec2(65, 110)}; + + const char* m_GangList = + { + "Ballas\0Grove street families\0Los santos vagos\0San fierro rifa\0Da nang boys\0" + "Mafia\0Mountain cloud triad\0Varrio los aztecas\0Gang9\0Gang10\0" + }; #else ResourceStore m_PedData {"peds", eResourceType::TYPE_TEXT}; #endif diff --git a/src/pages/player.cpp b/src/pages/player.cpp index 3100360..17fabc0 100644 --- a/src/pages/player.cpp +++ b/src/pages/player.cpp @@ -129,6 +129,7 @@ PlayerPage::PlayerPage() player->m_nFlags.bExplosionProof = 1; player->m_nFlags.bFireProof = 1; player->m_nFlags.bMeleeProof = 1; + player->m_nFlags.bImmuneToNonPlayerDamage = 1; #else player->m_nFlags.bBulletProof = 1; player->m_nFlags.bCollisionProof = 1; @@ -396,6 +397,7 @@ void PlayerPage::Draw() pPlayer->m_nFlags.bExplosionProof = m_bGodMode; pPlayer->m_nFlags.bFireProof = m_bGodMode; pPlayer->m_nFlags.bMeleeProof = m_bGodMode; + pPlayer->m_nFlags.bImmuneToNonPlayerDamage = m_bGodMode; #else pPlayer->m_nFlags.bBulletProof = m_bGodMode; pPlayer->m_nFlags.bCollisionProof = m_bGodMode; @@ -589,7 +591,7 @@ void PlayerPage::Draw() state = BY_GAME(pPlayer->m_nPhysicalFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof); - if (Widget::Checkbox(TEXT("Player.MeeleProof"), &state, nullptr, m_bGodMode)) + if (Widget::Checkbox(TEXT("Player.MeleeProof"), &state, nullptr, m_bGodMode)) { BY_GAME(pPlayer->m_nPhysicalFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof) = state; diff --git a/src/pages/weapon.cpp b/src/pages/weapon.cpp index 7f19c49..240b87a 100644 --- a/src/pages/weapon.cpp +++ b/src/pages/weapon.cpp @@ -3,6 +3,7 @@ #include "utils/widget.h" #include "utils/util.h" #include +#include "pages/ped.h" WeaponPage& weaponPage = WeaponPage::Get(); WeaponPage::WeaponPage() @@ -396,12 +397,7 @@ void WeaponPage::Draw() if (ImGui::BeginTabItem(TEXT("Weapon.GangWeaponEditor"))) { ImGui::Spacing(); - static const char* gangList = - { - "Ballas\0Grove street families\0Los santos vagos\0San fierro rifa\0Da nang boys\0" - "Mafia\0Mountain cloud triad\0Varrio los aztecas\0Gang9\0Gang10\0" - }; - ImGui::Combo(TEXT("Weapon.SelectGang"), &m_Gang.m_nSelected, gangList); + ImGui::Combo(TEXT("Weapon.SelectGang"), &m_Gang.m_nSelected, pedPage.m_GangList); ImGui::Combo(TEXT("Ped.SelectWeapon"), &m_Gang.m_nSelectedWeapon, "Weapon 1\0Weapon 2\0Weapon 3\0"); ImGui::Spacing(); diff --git a/src/utils/util.cpp b/src/utils/util.cpp index 47ff1a4..69d8026 100644 --- a/src/utils/util.cpp +++ b/src/utils/util.cpp @@ -2,6 +2,7 @@ #include #include #include "util.h" +#include ImVec2 Util::ConvertScreenToMap(ImVec2 pos, ImVec2 mapSz, ImVec2 screenSz) { diff --git a/src/utils/util.h b/src/utils/util.h index 9bc3c3a..9822e27 100644 --- a/src/utils/util.h +++ b/src/utils/util.h @@ -35,11 +35,12 @@ public: static bool IsInCar(CPed *pPed = FindPlayerPed()); static void UnFlipCar(CVehicle *pVeh); + static CPed* GetClosestPed(); + static void GetCPUUsageInit(); static double GetCurrentCPUUsage(); static float RoundFloat(float val); - static CPed* GetClosestPed(); static std::string GetLocationName(CVector* pos); static bool IsOnCutscene(); static void RainbowValues(int& r, int& g, int& b, float speed);