Add model editor, fix typo

This commit is contained in:
Grinch_ 2022-08-23 02:06:07 +06:00
parent 442c70a6e3
commit 3a5fbe3a7b
7 changed files with 129 additions and 58 deletions

View File

@ -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"

View File

@ -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<int>(gangId)][memberId];
}
void PedPage::GangStruct::SetModel(unsigned int gangId, unsigned int memberId, unsigned int model)
{
CPopulation::m_PedGroups[42 + static_cast<int>(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,9 +429,14 @@ void PedPage::Draw()
}
ImGui::EndTabItem();
}
#ifdef GTASA
if (ImGui::BeginTabItem(TEXT("Ped.Gangs")))
{
ImGui::Spacing();
if (ImGui::BeginTabBar("GANGGGG"))
{
if (ImGui::BeginTabItem(TEXT("Ped.GangWars")))
{
ImGui::Spacing();
if (ImGui::Button(TEXT("Ped.StartWar"), ImVec2(Widget::CalcSize(2))))
@ -470,7 +491,37 @@ void PedPage::Draw()
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

View File

@ -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

View File

@ -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;

View File

@ -3,6 +3,7 @@
#include "utils/widget.h"
#include "utils/util.h"
#include <CWeaponInfo.h>
#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();

View File

@ -2,6 +2,7 @@
#include <math.h>
#include <psapi.h>
#include "util.h"
#include <CPopulation.h>
ImVec2 Util::ConvertScreenToMap(ImVec2 pos, ImVec2 mapSz, ImVec2 screenSz)
{

View File

@ -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);