diff --git a/src/animation.cpp b/src/animation.cpp index 2b350ea..5cfda78 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -40,6 +40,36 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std: Command(pPlayer->m_nAreaCode); } +void Animation::PlayParticle(std::string& rootKey, std::string& particle, std::string& dummy) +{ + CPlayerPed* pPlayer = FindPlayerPed(); + if (!pPlayer) + { + return; + } + CVector pos = pPlayer->GetPosition(); + + int handle; + Command(particle.c_str(), pos.x, pos.y, pos.z, 1, &handle); + Command(handle); + m_Particle::m_nParticleList.push_back(handle); +} + + +void Animation::RemoveParticle(std::string& ifp, std::string& particle, std::string& dummy) +{ + if (ifp == "Custom") + { + m_Particle::m_Data.m_pJson->m_Data["Custom"].erase(particle); + m_Particle::m_Data.m_pJson->WriteToDisk(); + SetHelpMessage("Particle removed", false, false, false); + } + else + { + SetHelpMessage("You can only remove custom particles", false, false, false); + } +} + #elif GTAVC // Thanks to codenulls(https://github.com/codenulls/) @@ -269,7 +299,6 @@ void Animation::ShowPage() #endif } } - ImGui::Spacing(); ImGui::Columns(2, nullptr, false); @@ -288,6 +317,19 @@ void Animation::ShowPage() } else { + if (ImGui::CollapsingHeader("Add new")) + { + ImGui::InputTextWithHint("IFP name", "ped", m_nIfpBuffer, INPUT_BUFFER_SIZE); + ImGui::InputTextWithHint("Anim name", "cower", m_nAnimBuffer, INPUT_BUFFER_SIZE); + ImGui::Spacing(); + if (ImGui::Button("Add animation", Ui::GetSize())) + { + m_AnimData.m_pJson->m_Data["Custom"][m_nAnimBuffer] = ("0, " + std::string(m_nIfpBuffer)); + m_AnimData.m_pJson->WriteToDisk(); + } + } + ImGui::Spacing(); + if (ImGui::BeginChild("Anims Child")) { ImGui::Spacing(); @@ -295,49 +337,9 @@ void Animation::ShowPage() ImGui::EndChild(); } } - - ImGui::EndTabItem(); - } - if (ImGui::BeginTabItem("Custom")) - { - ImGui::InputTextWithHint("IFP name", "ped", m_nIfpBuffer, INPUT_BUFFER_SIZE); - ImGui::InputTextWithHint("Anim name", "cower", m_nAnimBuffer, INPUT_BUFFER_SIZE); - ImGui::Spacing(); - if (ImGui::Button("Add animation", Ui::GetSize())) - { - m_AnimData.m_pJson->m_Data["Custom"][m_nAnimBuffer] = ("0, " + std::string(m_nIfpBuffer)); - m_AnimData.m_pJson->WriteToDisk(); - } ImGui::EndTabItem(); } #ifdef GTASA - if (ImGui::BeginTabItem("Misc")) - { - ImGui::Spacing(); - if (Ui::ListBox("Fighting style", m_FightingStyleList, m_nFightingStyle)) - { - Command(hPlayer, m_nFightingStyle + 4, 6); - SetHelpMessage("Fighting anim set", false, false, false); - } - if (Ui::ListBoxStr("Walking style", m_WalkingStyleList, m_nWalkingStyle)) - { - if (m_nWalkingStyle == "default") - { - patch::Set(0x609A4E, 0x4D48689); - patch::Set(0x609A52, 0); - } - else - { - patch::Nop(0x609A4E, 6); - Command(m_nWalkingStyle.c_str()); - Command(); - Command(hPlayer, m_nWalkingStyle.c_str()); - Command(m_nWalkingStyle.c_str()); - } - SetHelpMessage("Walking anim set", false, false, false); - } - ImGui::EndTabItem(); - } if (ImGui::BeginTabItem("Cutscene")) { ImGui::Spacing(); @@ -365,6 +367,75 @@ void Animation::ShowPage() } ImGui::EndTabItem(); } + if (ImGui::BeginTabItem("Particle##TABBAR")) + { + ImGui::Spacing(); + if (ImGui::Button("Remove all", Ui::GetSize(2))) + { + for (int& p : m_Particle::m_nParticleList) + { + Command(p); + } + m_Particle::m_nParticleList.clear(); + } + ImGui::SameLine(); + if (ImGui::Button("Remove latest", Ui::GetSize(2))) + { + Command(m_Particle::m_nParticleList.back()); // stop if anything is running + m_Particle::m_nParticleList.pop_back(); + } + ImGui::Spacing(); + if (Ui::CheckboxBitFlag("Invisible player", pPlayer->m_nPedFlags.bDontRender)) + { + pPlayer->m_nPedFlags.bDontRender = (pPlayer->m_nPedFlags.bDontRender == 1) ? 0 : 1; + } + ImGui::Spacing(); + if (ImGui::CollapsingHeader("Add new")) + { + ImGui::InputTextWithHint("Particle name", "kkjj_on_fire", m_Particle::m_NameBuffer, INPUT_BUFFER_SIZE); + ImGui::Spacing(); + if (ImGui::Button("Add animation", Ui::GetSize())) + { + m_Particle::m_Data.m_pJson->m_Data["Custom"][m_Particle::m_NameBuffer] = "Dummy"; + m_Particle::m_Data.m_pJson->WriteToDisk(); + } + } + ImGui::Spacing(); + if (ImGui::BeginChild("Anims Child")) + { + ImGui::Spacing(); + Ui::DrawJSON(m_Particle::m_Data, PlayParticle, RemoveParticle); + ImGui::EndChild(); + } + ImGui::EndTabItem(); + } + if (ImGui::BeginTabItem("Style")) + { + ImGui::Spacing(); + if (Ui::ListBox("Fighting style", m_FightingStyleList, m_nFightingStyle)) + { + Command(hPlayer, m_nFightingStyle + 4, 6); + SetHelpMessage("Fighting anim set", false, false, false); + } + if (Ui::ListBoxStr("Walking style", m_WalkingStyleList, m_nWalkingStyle)) + { + if (m_nWalkingStyle == "default") + { + patch::Set(0x609A4E, 0x4D48689); + patch::Set(0x609A52, 0); + } + else + { + patch::Nop(0x609A4E, 6); + Command(m_nWalkingStyle.c_str()); + Command(); + Command(hPlayer, m_nWalkingStyle.c_str()); + Command(m_nWalkingStyle.c_str()); + } + SetHelpMessage("Walking anim set", false, false, false); + } + ImGui::EndTabItem(); + } #endif ImGui::EndTabBar(); } diff --git a/src/animation.h b/src/animation.h index 427c93b..1ba7044 100644 --- a/src/animation.h +++ b/src/animation.h @@ -33,12 +33,21 @@ private: "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman", "sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate" }; + + // Particle player + struct m_Particle + { + static inline ResourceStore m_Data{ "particle", eResourceType::TYPE_TEXT }; + static inline char m_NameBuffer[INPUT_BUFFER_SIZE]; + static inline std::vector m_nParticleList; + }; #endif static void PlayAnimation(std::string& rootKey, std::string& anim, std::string& ifp); static void RemoveAnimation(std::string& rootKey, std::string& anim, std::string& ifp); - + static void RemoveParticle(std::string& ifp, std::string& anim, std::string& ifpRepeat); #ifdef GTASA + static void PlayParticle(std::string& rootKey, std::string& particle, std::string& dummy); static void PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior); #elif GTAVC static bool _LoadAnimationBlock(const char* szBlockName); diff --git a/src/version.h b/src/version.h index 1e8505b..2f40cd7 100644 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,6 @@ #pragma once #define MENU_NAME "Cheat Menu" -#define MENU_VERSION_NUMBER "3.1" -#define MENU_VERSION MENU_VERSION_NUMBER +#define MENU_VERSION_NUMBER "3.2" +#define MENU_VERSION MENU_VERSION_NUMBER"-beta" #define BUILD_NUMBER "20220204" #define MENU_TITLE MENU_NAME " v" MENU_VERSION