diff --git a/README.md b/README.md index 770cd44..cb68a5a 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,6 @@ If you have those mentioned versions installed follow the steps below, ### For III & VC 3. Install [D3D8to9 wrapper](https://github.com/crosire/d3d8to9/releases). Sometimes the asi loader blocks **d3d8.dll** file. Just delete the **Globals.ini** file and you should be good to go. -Be sure to check [here](https://github.com/user-grinch/Cheat-Menu/issues/48) to know about incompatibilities with other mods. - ## Incompatible Mods ### GTA SA 1. **ENB/ SA_DirectX 2.0** **FIX:** Disable Effect/ Enable water diff --git a/src/animation.cpp b/src/animation.cpp index 1675ee9..c7af8cb 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -147,15 +147,15 @@ void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& value) { - CPlayerPed *pPlayer = FindPlayerPed(); + CPed *pPed = m_PedAnim ? m_pTarget : FindPlayerPed(); - if (!pPlayer) + if (!pPed) { return; } #ifdef GTASA - int hplayer = CPools::GetPedRef(pPlayer); + int hped = CPools::GetPedRef(pPed); if (ifp != "PED") { @@ -163,14 +163,14 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& Command(); } - Command(hplayer); + Command(hped); if (m_bSecondary) { - Command(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1); + Command(hped, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1); } else { - Command(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1); + Command(hped, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1); } if (ifp != "PED") @@ -179,11 +179,11 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& } #else - if (pPlayer) + if (pPed) { int groupID, animID; sscanf(value.c_str(), "%d$%d,", &groupID, &animID); - _PlayAnimation(pPlayer->m_pRwClump, groupID, animID, 4.0f); + _PlayAnimation(pPed->m_pRwClump, groupID, animID, 4.0f); } #endif } @@ -193,11 +193,11 @@ Animation::Animation() #ifdef GTASA Events::processScriptsEvent += [this] { + CPlayerPed* pPlayer = FindPlayerPed(); if (m_Cutscene::m_bRunning) { if (Command()) { - CPlayerPed* pPlayer = FindPlayerPed(); if (!pPlayer) { return; @@ -217,6 +217,16 @@ Animation::Animation() m_Cutscene::m_bRunning = true; } } + + if (pPlayer && pPlayer->m_pPlayerTargettedPed) + { + m_pTarget = pPlayer->m_pPlayerTargettedPed; + } + + if (m_pTarget && !m_pTarget->IsAlive()) + { + m_pTarget = nullptr; + } }; #elif GTAVC // mov al, 01 @@ -242,7 +252,7 @@ void Animation::Draw() ImGui::Spacing(); - if (ImGui::BeginTabItem("Anims")) + if (ImGui::BeginTabItem("Animation##TABBAR")) { ImGui::Spacing(); if (ImGui::Button("Stop animation", Ui::GetSize())) @@ -260,20 +270,29 @@ void Animation::Draw() ImGui::Spacing(); ImGui::Columns(2, nullptr, false); - ImGui::Checkbox("Loop", &m_Loop); - Ui::ShowTooltip("Keep playing the animation on repeat"); + Ui::CheckboxWithHint("Loop", &m_Loop, "Keep playing the animation on repeat"); + Ui::CheckboxWithHint("Secondary", &m_bSecondary, "Player can move while playing the animation"); ImGui::NextColumn(); - ImGui::Checkbox("Secondary", &m_bSecondary); - Ui::ShowTooltip("Player can move while playing the animation"); +#ifdef GTASA + Ui::CheckboxWithHint("Ped anim", &m_PedAnim, "Play animation on other peds.\nSelect with weapon target."); +#endif ImGui::Columns(1); ImGui::Spacing(); - if (ImGui::BeginChild("Anims Child")) + if (m_PedAnim && !m_pTarget) { - ImGui::Spacing(); - Ui::DrawJSON(m_AnimData, PlayAnimation, RemoveAnimation); - ImGui::EndChild(); + ImGui::TextWrapped("No player target found. Aim a ped with a weapon to select it for animation player."); } + else + { + if (ImGui::BeginChild("Anims Child")) + { + ImGui::Spacing(); + Ui::DrawJSON(m_AnimData, PlayAnimation, RemoveAnimation); + ImGui::EndChild(); + } + } + ImGui::EndTabItem(); } if (ImGui::BeginTabItem("Custom")) diff --git a/src/animation.h b/src/animation.h index ef77b02..7cce83a 100644 --- a/src/animation.h +++ b/src/animation.h @@ -11,7 +11,9 @@ private: static inline char m_nIfpBuffer[INPUT_BUFFER_SIZE]; static inline bool m_Loop; // loop animation static inline bool m_bSecondary; // play animation as secondary - + static inline bool m_PedAnim; + static inline CPed *m_pTarget = nullptr; + #ifdef GTASA // Cutscene player struct m_Cutscene diff --git a/src/ui.cpp b/src/ui.cpp index 13b7d3b..86ed619 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -327,7 +327,9 @@ bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_ } if (ImGui::IsItemHovered() && !is_disabled) + { color = ImGui::GetColorU32(ImGuiCol_FrameBgHovered); + } // draw the button ImVec2 min = ImGui::GetItemRectMin(); @@ -414,15 +416,17 @@ bool Ui::CheckboxAddressEx(const char* label, const int addr, int enabled_val, i int val = 0; patch::GetRaw(addr, &val, 1, false); - if (val == enabled_val) - state = true; - + state = (val == enabled_val); if (CheckboxWithHint(label, &state, hint) && addr != NULL) { if (state) + { patch::SetRaw(addr, &enabled_val, 1, false); + } else + { patch::SetRaw(addr, &disabled_val, 1, false); + } rtn = true; } @@ -450,9 +454,13 @@ bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled if (CheckboxWithHint(label, &state, hint)) { if (state) + { patch::SetRaw(addr, &enabled_val, 1, false); + } else + { patch::SetRaw(addr, &disabled_val, 1, false); + } rtn = true; } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 496af70..3c84def 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1105,9 +1105,9 @@ void Vehicle::Draw() ImGui::RadioButton("Tertiary", &m_Paint::m_nRadioButton, 3); ImGui::RadioButton("Quaternary", &m_Paint::m_nRadioButton, 4); #else - ImGui::RadioButton("Primary", &m_Color::m_nRadioButton, 1); + ImGui::RadioButton("Primary", &m_Paint::m_nRadioButton, 1); ImGui::NextColumn(); - ImGui::RadioButton("Secondary", &m_Color::m_nRadioButton, 2); + ImGui::RadioButton("Secondary", &m_Paint::m_nRadioButton, 2); #endif ImGui::Spacing(); ImGui::Columns(1);