From d5b8c6276be3c772be24d84217511f04bf2845c6 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sun, 1 May 2022 16:43:24 +0600 Subject: [PATCH] [III]Add big head, fix issue with custom animation --- src/animation.cpp | 6 +++--- src/ped.cpp | 45 +++++++++++++++++++++++++++++++++++++-------- src/ped.h | 2 +- src/vehicle.cpp | 1 + src/version.h | 2 +- 5 files changed, 43 insertions(+), 13 deletions(-) diff --git a/src/animation.cpp b/src/animation.cpp index 8c17419..0ab94ff 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -178,7 +178,7 @@ void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float #endif -void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& value) +void Animation::PlayAnimation(std::string& root, std::string& anim, std::string& ifp) { CPed *pPed = m_PedAnim ? m_pTarget : FindPlayerPed(); @@ -215,7 +215,7 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& if (pPed) { int groupID, animID; - sscanf(value.c_str(), "%d$%d,", &groupID, &animID); + sscanf(ifp.c_str(), "%d$%d,", &groupID, &animID); _PlayAnimation(pPed->m_pRwClump, groupID, animID, 4.0f); } #endif @@ -324,7 +324,7 @@ void Animation::ShowPage() ImGui::Spacing(); if (ImGui::Button(TEXT("Animation.AddAnimation"), Ui::GetSize())) { - m_AnimData.m_pJson->m_Data["Custom"][m_nAnimBuffer] = ("0, " + std::string(m_nIfpBuffer)); + m_AnimData.m_pJson->m_Data["Custom"][m_nAnimBuffer] = std::string(m_nIfpBuffer); m_AnimData.m_pJson->WriteToDisk(); } } diff --git a/src/ped.cpp b/src/ped.cpp index 5a509d8..7de0008 100644 --- a/src/ped.cpp +++ b/src/ped.cpp @@ -16,25 +16,25 @@ void Ped::Init() { m_bExGangWarsInstalled = true; } +#endif /* - Taken from gta chaos mod by Lordmau5 - https://github.com/gta-chaos-mod/Trilogy-ASI-Script - + Taken from gta chaos mod by Lordmau5 & _AG TODO: Implement in VC too */ +#ifdef GTASA Events::pedRenderEvent += [](CPed *ped) { - if (m_bBigHead || m_bThinBody) + if (m_bBigHead)// || m_bThinBody) { - auto animHier = GetAnimHierarchyFromSkinClump (ped->m_pRwClump); + auto animHier = GetAnimHierarchyFromSkinClump(ped->m_pRwClump); auto matrices = RpHAnimHierarchyGetMatrixArray (animHier); RwV3d scale = {0.7f, 0.7f, 0.7f}; if (m_bThinBody) { - for (int i = 1; i <= 52; i++) + for (int i = 1; i <= 54; i++) { RwMatrixScale (&matrices[RpHAnimIDGetIndex (animHier, i)], &scale, rwCOMBINEPRECONCAT); } @@ -42,13 +42,40 @@ void Ped::Init() scale = {3.0f, 3.0f, 3.0f}; if (m_bBigHead) { - for (int i = BONE_NECK; i <= BONE_HEAD; i++) + for (int i = 5; i <= 8; i++) { RwMatrixScale (&matrices[RpHAnimIDGetIndex (animHier, i)], &scale, rwCOMBINEPRECONCAT); } } } }; +#elif GTA3 + CdeclEvent , PRIORITY_AFTER, ArgPickN, void(CPed*)> onPreRender; + + onPreRender += [](CPed* ped) + { + if (!m_bBigHead) + { + return; + } + + RwFrame* frame = ped->m_apFrames[2]->m_pFrame; + + if (frame) + { + RwMatrix* headMatrix = RwFrameGetMatrix(frame); + + if (headMatrix) + { + CMatrix mat; + mat.m_pAttachMatrix = NULL; + mat.Attach(headMatrix, false); + mat.SetScale(3.0f); + mat.SetTranslateOnly(0.4f, 0.0f, 0.0f); + mat.UpdateRW(); + } + } + }; #endif } @@ -166,8 +193,10 @@ void Ped::ShowPage() ImGui::Spacing(); ImGui::BeginChild("CheckboxesChild"); ImGui::Columns(2, 0, false); -#ifdef GTASA +#ifndef GTAVC Ui::CheckboxWithHint(TEXT("Ped.BigHead"), &m_bBigHead); +#endif +#ifdef GTASA Ui::CheckboxAddress(TEXT("Ped.ElvisEverywhere"), 0x969157); Ui::CheckboxAddress(TEXT("Ped.EveryoneArmed"), 0x969140); Ui::CheckboxAddress(TEXT("Ped.GangsControl"), 0x96915B); diff --git a/src/ped.h b/src/ped.h index 490ce5e..23bf079 100644 --- a/src/ped.h +++ b/src/ped.h @@ -4,9 +4,9 @@ class Ped { private: + static inline bool m_bBigHead; #ifdef GTASA static inline bool m_bExGangWarsInstalled; - static inline bool m_bBigHead; static inline bool m_bThinBody; static inline std::vector m_GangList = { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index cadfe47..84abf53 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -341,6 +341,7 @@ void Vehicle::SpawnVehicle(const std::string& rootkey, const std::string& vehNam } else { + Command(hveh); } #else diff --git a/src/version.h b/src/version.h index 3ed53a5..e932436 100644 --- a/src/version.h +++ b/src/version.h @@ -2,5 +2,5 @@ #define MENU_NAME "Cheat Menu" #define MENU_VERSION_NUMBER "3.3" #define MENU_VERSION MENU_VERSION_NUMBER"-beta" -#define BUILD_NUMBER "20220417" +#define BUILD_NUMBER "20220501" #define MENU_TITLE MENU_NAME " v" MENU_VERSION