2021-10-24 18:08:00 -04:00
|
|
|
#include "pch.h"
|
2021-10-25 10:03:27 -04:00
|
|
|
#include "animation.h"
|
2022-06-29 19:56:53 -04:00
|
|
|
#include "widget.h"
|
2021-09-20 08:41:40 -04:00
|
|
|
#include "util.h"
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
#ifdef GTA3
|
|
|
|
#include <RpAnimBlend.h>
|
2021-12-22 13:13:10 -05:00
|
|
|
#include <CAnimationStyleDescriptor.h>
|
|
|
|
#include <CAnimManager.h>
|
|
|
|
#include "eAnimations.h"
|
|
|
|
#include <CAnimBlendAssociation.h>
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
#elif GTAVC
|
2021-12-22 13:13:10 -05:00
|
|
|
|
2022-01-10 12:43:09 -05:00
|
|
|
#include "../depend/kiero/minhook/MinHook.h"
|
2022-06-28 16:23:03 -04:00
|
|
|
#include <CAnimationStyleDescriptor.h>
|
|
|
|
#include <CAnimManager.h>
|
|
|
|
#include "eAnimations.h"
|
|
|
|
#include <CAnimBlendAssociation.h>
|
2022-01-10 12:43:09 -05:00
|
|
|
#endif
|
|
|
|
|
2021-12-22 13:13:10 -05:00
|
|
|
#ifdef GTASA
|
2022-06-28 16:23:03 -04:00
|
|
|
void Cutscene::Play(std::string& rootKey, std::string& cutsceneId, std::string& interior)
|
2021-12-22 13:13:10 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
if (Util::IsOnCutscene())
|
|
|
|
{
|
2022-03-18 03:23:43 -04:00
|
|
|
SetHelpMessage(TEXT("Animation.CutsceneRunning"));
|
2022-01-07 03:18:00 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CPlayerPed* pPlayer = FindPlayerPed();
|
2022-06-18 04:01:31 -04:00
|
|
|
if (pPlayer)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
m_SceneName = cutsceneId;
|
2022-06-18 04:01:31 -04:00
|
|
|
Command<Commands::LOAD_CUTSCENE>(cutsceneId.c_str());
|
2022-06-28 16:23:03 -04:00
|
|
|
m_nInterior = pPlayer->m_nAreaCode;
|
2022-06-18 04:01:31 -04:00
|
|
|
pPlayer->m_nAreaCode = std::stoi(interior);
|
|
|
|
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2021-12-22 13:13:10 -05:00
|
|
|
}
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
void Particle::Play(std::string& rootKey, std::string& particle, std::string& dummy)
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
|
|
|
CPlayerPed* pPlayer = FindPlayerPed();
|
2022-06-18 04:01:31 -04:00
|
|
|
if (pPlayer)
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-18 04:01:31 -04:00
|
|
|
CVector pos = pPlayer->GetPosition();
|
|
|
|
int handle;
|
|
|
|
Command<Commands::CREATE_FX_SYSTEM>(particle.c_str(), pos.x, pos.y, pos.z, 1, &handle);
|
|
|
|
Command<Commands::PLAY_FX_SYSTEM>(handle);
|
2022-06-28 16:23:03 -04:00
|
|
|
m_nParticleList.push_back(handle);
|
2022-02-06 18:16:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
void Particle::Remove(std::string& ifp, std::string& particle, std::string& dummy)
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
|
|
|
if (ifp == "Custom")
|
|
|
|
{
|
2022-06-26 08:08:55 -04:00
|
|
|
Particle::m_Data.m_pData->RemoveKey("Custom", particle.c_str());
|
|
|
|
Particle::m_Data.m_pData->Save();
|
2022-02-14 12:31:05 -05:00
|
|
|
SetHelpMessage(TEXT("Animation.ParticleRemoved"));
|
2022-02-06 18:16:04 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-14 12:31:05 -05:00
|
|
|
SetHelpMessage(TEXT("Animation.CustomParticlesOnly"));
|
2022-02-06 18:16:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-22 13:13:10 -05:00
|
|
|
#elif GTAVC
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
// Thanks to codenulls(https://github.com/codenulls/)
|
2021-12-22 13:13:10 -05:00
|
|
|
static auto OLD_CStreaming_RemoveModel = (bool(__cdecl*)(int))0x40D6E0;
|
|
|
|
static bool NEW_CStreaming_RemoveModel(int modelID)
|
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
// Check if it's IFP animation block
|
|
|
|
if (modelID >= 7916 && modelID <= 7950)
|
|
|
|
{
|
|
|
|
// Do not unload the animation block
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return OLD_CStreaming_RemoveModel(modelID);
|
2021-12-22 13:13:10 -05:00
|
|
|
}
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
bool _LoadAnimationBlock(const char* szBlockName)
|
|
|
|
{
|
|
|
|
CAnimBlock* pAnimBlock = CAnimManager::GetAnimationBlock(szBlockName);
|
|
|
|
if (pAnimBlock)
|
|
|
|
{
|
|
|
|
if (!pAnimBlock->bLoaded)
|
|
|
|
{
|
|
|
|
int animIndex = ((unsigned char*)pAnimBlock - (unsigned char*)CAnimManager::ms_aAnimBlocks) / 32;
|
|
|
|
CStreaming::RequestModel(7916 + animIndex, 0x20 | MISSION_REQUIRED | PRIORITY_REQUEST);
|
|
|
|
CStreaming::LoadAllRequestedModels(true);
|
|
|
|
if (pAnimBlock->bLoaded)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _PlayAnim(RpClump* pClump, int animGroup, int animID, float blend, bool loop, bool secondary)
|
2021-12-22 13:13:10 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
if (animGroup < CAnimManager::ms_numAnimAssocDefinitions)
|
|
|
|
{
|
|
|
|
CAnimationStyleDescriptor* pAnimDef = &CAnimManager::ms_aAnimAssocDefinitions[animGroup];
|
|
|
|
if (pAnimDef)
|
|
|
|
{
|
|
|
|
if (!_LoadAnimationBlock(pAnimDef->blockName))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation* pAnimAssoc = RpAnimBlendClumpGetFirstAssociation(pClump);
|
|
|
|
while (pAnimAssoc)
|
|
|
|
{
|
|
|
|
if (pAnimAssoc->m_nAnimId == animID && pAnimAssoc->m_nAnimGroup == animGroup)
|
|
|
|
{
|
|
|
|
// Destroy the animation
|
|
|
|
pAnimAssoc->~CAnimBlendAssociation();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pAnimAssoc = RpAnimBlendGetNextAssociation(pAnimAssoc);
|
|
|
|
}
|
|
|
|
pAnimAssoc = CAnimManager::BlendAnimation(pClump, animGroup, animID, blend);
|
|
|
|
pAnimAssoc->m_nFlags = ANIMATION_STARTED | ANIMATION_MOVEMENT;
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
if (loop)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
pAnimAssoc->m_nFlags |= ANIMATION_LOOPED;
|
|
|
|
}
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
if (secondary)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
pAnimAssoc->m_nFlags |= ANIMATION_PARTIAL;
|
|
|
|
}
|
2021-12-22 13:13:10 -05:00
|
|
|
}
|
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
#else
|
2021-12-22 13:13:10 -05:00
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
void _PlayAnim(RpClump* pClump, int animGroup, int animID, float blend, bool loop, bool secondary)
|
2021-12-22 13:13:10 -05:00
|
|
|
{
|
2022-05-23 07:45:31 -04:00
|
|
|
CAnimBlendAssociation* pAnimStaticAssoc = CAnimManager::GetAnimAssociation(animGroup, animID);
|
2022-01-07 03:18:00 -05:00
|
|
|
CAnimBlendAssociation* pAnimAssoc = RpAnimBlendClumpGetFirstAssociation(pClump);
|
|
|
|
while (pAnimAssoc)
|
|
|
|
{
|
|
|
|
if (pAnimAssoc->m_nAnimID == pAnimStaticAssoc->m_nAnimID && pAnimAssoc->m_pAnimBlendHierarchy == pAnimStaticAssoc->m_pAnimBlendHierarchy)
|
|
|
|
{
|
|
|
|
// Destroy the animation
|
|
|
|
pAnimAssoc->FreeAnimBlendNodeArray();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pAnimAssoc = RpAnimBlendGetNextAssociation(pAnimAssoc);
|
|
|
|
}
|
2022-05-23 07:45:31 -04:00
|
|
|
pAnimAssoc = CAnimManager::BlendAnimation(pClump, animGroup, animID, blend);
|
2022-01-07 03:18:00 -05:00
|
|
|
pAnimAssoc->m_nFlags = 0x1 | 0x20;
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
if (loop)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
pAnimAssoc->m_nFlags |= 0x2;
|
|
|
|
}
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
if (secondary)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
pAnimAssoc->m_nFlags |= 0x10;
|
|
|
|
}
|
2021-12-22 13:13:10 -05:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
void Animation::Play(std::string& ifp, std::string& anim, std::string& _)
|
2021-12-22 13:13:10 -05:00
|
|
|
{
|
2022-01-09 07:09:48 -05:00
|
|
|
CPed *pPed = m_PedAnim ? m_pTarget : FindPlayerPed();
|
|
|
|
if (!pPed)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2021-12-22 13:13:10 -05:00
|
|
|
|
|
|
|
#ifdef GTASA
|
2022-01-09 07:09:48 -05:00
|
|
|
int hped = CPools::GetPedRef(pPed);
|
2022-01-07 03:18:00 -05:00
|
|
|
|
|
|
|
if (ifp != "PED")
|
|
|
|
{
|
|
|
|
Command<Commands::REQUEST_ANIMATION>(ifp.c_str());
|
|
|
|
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
|
|
|
}
|
|
|
|
|
2022-01-09 07:09:48 -05:00
|
|
|
Command<Commands::CLEAR_CHAR_TASKS>(hped);
|
2022-01-07 03:18:00 -05:00
|
|
|
if (m_bSecondary)
|
|
|
|
{
|
2022-01-09 07:09:48 -05:00
|
|
|
Command<Commands::TASK_PLAY_ANIM_SECONDARY>(hped, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-09 07:09:48 -05:00
|
|
|
Command<Commands::TASK_PLAY_ANIM>(hped, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ifp != "PED")
|
|
|
|
{
|
|
|
|
Command<Commands::REMOVE_ANIMATION>(ifp.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2022-06-28 16:23:03 -04:00
|
|
|
int groupID, animID;
|
|
|
|
sscanf(ifp.c_str(), "%d$%d,", &groupID, &animID);
|
|
|
|
_PlayAnim(pPed->m_pRwClump, groupID, animID, 4.0f, m_Loop, m_bSecondary);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void Animation::Remove(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
|
|
|
{
|
|
|
|
if (ifp == "Custom")
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
m_AnimData.m_pData->RemoveKey("Custom", anim.c_str());
|
|
|
|
m_AnimData.m_pData->Save();
|
|
|
|
SetHelpMessage(TEXT("Animation.AnimationRemoved"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetHelpMessage(TEXT("Animation.CustomAnimsOnly"));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2021-12-22 13:13:10 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 03:33:57 -05:00
|
|
|
void Animation::Init()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2021-12-22 13:13:10 -05:00
|
|
|
#ifdef GTASA
|
2022-02-21 03:33:57 -05:00
|
|
|
Events::processScriptsEvent += []
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-01-09 07:09:48 -05:00
|
|
|
CPlayerPed* pPlayer = FindPlayerPed();
|
2022-06-26 08:08:55 -04:00
|
|
|
if (Cutscene::m_bRunning)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (Command<Commands::HAS_CUTSCENE_FINISHED>())
|
|
|
|
{
|
|
|
|
if (!pPlayer)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-06-26 08:08:55 -04:00
|
|
|
pPlayer->m_nAreaCode = Cutscene::m_nInterior;
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
|
2022-06-26 08:08:55 -04:00
|
|
|
Cutscene::m_nInterior = 0;
|
2022-01-07 03:18:00 -05:00
|
|
|
TheCamera.Fade(0, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-06-26 08:08:55 -04:00
|
|
|
if (Cutscene::m_SceneName != "" && Command<Commands::HAS_CUTSCENE_LOADED>())
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
Command<Commands::START_CUTSCENE>();
|
2022-06-26 08:08:55 -04:00
|
|
|
Cutscene::m_bRunning = true;
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
}
|
2022-01-09 07:09:48 -05:00
|
|
|
|
|
|
|
if (pPlayer && pPlayer->m_pPlayerTargettedPed)
|
|
|
|
{
|
|
|
|
m_pTarget = pPlayer->m_pPlayerTargettedPed;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_pTarget && !m_pTarget->IsAlive())
|
|
|
|
{
|
|
|
|
m_pTarget = nullptr;
|
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
};
|
2021-12-22 13:13:10 -05:00
|
|
|
#elif GTAVC
|
2022-01-07 03:18:00 -05:00
|
|
|
// mov al, 01
|
|
|
|
// ret
|
|
|
|
// nop (2x)
|
|
|
|
patch::SetRaw(0x40C9C0, (void*)"\xB0\x01\xC3\x90\x90", 5);
|
|
|
|
// // ret
|
|
|
|
// // nop (3x)
|
|
|
|
patch::SetRaw(0x404950, (void*)"\xC3\x90\x90\x90", 4);
|
|
|
|
|
|
|
|
MH_CreateHook((void*)0x40D6E0, NEW_CStreaming_RemoveModel, (void**)&OLD_CStreaming_RemoveModel);
|
|
|
|
MH_EnableHook((void*)0x40D6E0);
|
2021-12-22 13:13:10 -05:00
|
|
|
#endif
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2022-01-20 02:04:45 -05:00
|
|
|
void Animation::ShowPage()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
if (ImGui::BeginTabBar("Animation", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
|
|
|
CPlayerPed* pPlayer = FindPlayerPed();
|
|
|
|
int hPlayer = CPools::GetPedRef(pPlayer);
|
|
|
|
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
2022-02-14 12:31:05 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Animation.AnimationTab")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Animation.StopAnimation"), Widget::CalcSize()))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (hPlayer)
|
|
|
|
{
|
2021-12-22 13:13:10 -05:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::CLEAR_CHAR_TASKS>(hPlayer);
|
2021-12-22 13:13:10 -05:00
|
|
|
#else
|
2022-06-28 16:23:03 -04:00
|
|
|
_PlayAnim(pPlayer->m_pRwClump, ANIM_GROUP_MAN, ANIM_MAN_IDLE_STANCE, 4.0f, m_Loop, m_bSecondary);
|
2021-12-22 13:13:10 -05:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
|
|
|
ImGui::Columns(2, nullptr, false);
|
2022-07-01 04:06:34 -04:00
|
|
|
Widget::Checkbox(TEXT("Animation.LoopCheckbox"), &m_Loop, TEXT("Animation.LoopCheckboxText"));
|
|
|
|
Widget::Checkbox(TEXT("Animation.SecondaryCheckbox"), &m_bSecondary, TEXT("Animation.SecondaryCheckboxText"));
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::NextColumn();
|
2022-01-09 07:09:48 -05:00
|
|
|
#ifdef GTASA
|
2022-07-01 04:06:34 -04:00
|
|
|
Widget::Checkbox(TEXT("Animation.PedAnim"), &m_PedAnim, TEXT("Animation.PedAnimText"));
|
2022-01-09 07:09:48 -05:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Columns(1);
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
2022-01-09 07:09:48 -05:00
|
|
|
if (m_PedAnim && !m_pTarget)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-02-14 12:31:05 -05:00
|
|
|
ImGui::TextWrapped(TEXT("Animation.NoTarget"));
|
2022-01-09 07:09:48 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-14 12:31:05 -05:00
|
|
|
if (ImGui::CollapsingHeader(TEXT("Window.AddNew")))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
static char animBuf[INPUT_BUFFER_SIZE];
|
|
|
|
static char ifpBuf[INPUT_BUFFER_SIZE];
|
|
|
|
|
|
|
|
ImGui::InputTextWithHint(TEXT("Animation.IFPName"), "ped", ifpBuf, INPUT_BUFFER_SIZE);
|
|
|
|
ImGui::InputTextWithHint(TEXT("Animation.AnimName"), "cower", animBuf, INPUT_BUFFER_SIZE);
|
2022-02-06 18:16:04 -05:00
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Animation.AddAnimation"), Widget::CalcSize()))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
std::string key = std::string("Custom.") + animBuf;
|
|
|
|
m_AnimData.m_pData->Set(key.c_str(), std::string(ifpBuf));
|
2022-06-15 06:45:43 -04:00
|
|
|
m_AnimData.m_pData->Save();
|
2022-02-06 18:16:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
2022-01-09 07:09:48 -05:00
|
|
|
if (ImGui::BeginChild("Anims Child"))
|
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
Widget::DataList(m_AnimData, Play, Remove);
|
2022-01-09 07:09:48 -05:00
|
|
|
ImGui::EndChild();
|
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2022-02-06 18:16:04 -05:00
|
|
|
#ifdef GTASA
|
2022-02-14 12:31:05 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Animation.CutsceneTab")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Animation.StopCutscene"), Widget::CalcSize()))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-06-26 08:08:55 -04:00
|
|
|
if (Cutscene::m_bRunning)
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
|
|
|
Command<Commands::CLEAR_CUTSCENE>();
|
2022-06-26 08:08:55 -04:00
|
|
|
Cutscene::m_bRunning = false;
|
|
|
|
Cutscene::m_SceneName = "";
|
2022-02-06 18:16:04 -05:00
|
|
|
CPlayerPed* player = FindPlayerPed();
|
2022-06-26 08:08:55 -04:00
|
|
|
player->m_nAreaCode = Cutscene::m_nInterior;
|
2022-02-06 18:16:04 -05:00
|
|
|
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
|
2022-06-26 08:08:55 -04:00
|
|
|
Cutscene::m_nInterior = 0;
|
2022-02-06 18:16:04 -05:00
|
|
|
TheCamera.Fade(0, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
|
|
|
if (ImGui::BeginChild("Cutscene Child"))
|
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
Widget::DataList(Cutscene::m_Data, Cutscene::Play, nullptr);
|
2022-02-06 18:16:04 -05:00
|
|
|
ImGui::EndChild();
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2022-02-14 12:31:05 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Animation.ParticleTab")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Animation.RemoveAll"), Widget::CalcSize(2)))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-26 08:08:55 -04:00
|
|
|
for (int& p : Particle::m_nParticleList)
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
|
|
|
Command<Commands::KILL_FX_SYSTEM>(p);
|
|
|
|
}
|
2022-06-26 08:08:55 -04:00
|
|
|
Particle::m_nParticleList.clear();
|
2022-02-06 18:16:04 -05:00
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Animation.RemoveLatest"), Widget::CalcSize(2)))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-26 08:08:55 -04:00
|
|
|
Command<Commands::KILL_FX_SYSTEM>(Particle::m_nParticleList.back()); // stop if anything is running
|
|
|
|
Particle::m_nParticleList.pop_back();
|
2022-02-06 18:16:04 -05:00
|
|
|
}
|
|
|
|
ImGui::Spacing();
|
2022-07-01 04:06:34 -04:00
|
|
|
if (Widget::CheckboxBits(TEXT("Animation.InvisiblePlayer"), pPlayer->m_nPedFlags.bDontRender))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
|
|
|
pPlayer->m_nPedFlags.bDontRender = (pPlayer->m_nPedFlags.bDontRender == 1) ? 0 : 1;
|
|
|
|
}
|
|
|
|
ImGui::Spacing();
|
2022-02-14 12:31:05 -05:00
|
|
|
if (ImGui::CollapsingHeader(TEXT("Window.AddNew")))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
static char buf[INPUT_BUFFER_SIZE];
|
|
|
|
ImGui::InputTextWithHint(TEXT("Animation.ParticleName"), "kkjj_on_fire", buf, INPUT_BUFFER_SIZE);
|
2022-02-06 18:16:04 -05:00
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Animation.AddParticle"), Widget::CalcSize()))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
std::string key = std::string("Custom.") + buf;
|
2022-06-15 06:45:43 -04:00
|
|
|
m_AnimData.m_pData->Set(key.c_str(), std::string("Dummy"));
|
2022-06-26 08:08:55 -04:00
|
|
|
Particle::m_Data.m_pData->Save();
|
2022-02-06 18:16:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::Spacing();
|
|
|
|
if (ImGui::BeginChild("Anims Child"))
|
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
Widget::DataList(Particle::m_Data, Particle::Play, Particle::Remove);
|
2022-02-06 18:16:04 -05:00
|
|
|
ImGui::EndChild();
|
|
|
|
}
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2022-02-14 12:31:05 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Animation.Styles")))
|
2022-02-06 18:16:04 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
ImGui::Spacing();
|
|
|
|
|
|
|
|
static int fightStyle;
|
|
|
|
static const char* fightStyles = "Default\0Boxing\0Kung Fu\0Kick Boxing\0Punch Kick\0";
|
|
|
|
static std::string walkStyle = "default";
|
|
|
|
static std::vector<std::string> walkStyles =
|
|
|
|
{
|
|
|
|
"default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman",
|
|
|
|
"fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
|
|
|
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate"
|
|
|
|
};
|
|
|
|
|
|
|
|
if (ImGui::Combo(TEXT("Animation.FightingStyle"), &fightStyle, fightStyles))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hPlayer, fightStyle + 4, 6);
|
2022-02-14 12:31:05 -05:00
|
|
|
SetHelpMessage(TEXT("Animation.FightingStyleSet"));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-07-01 04:06:34 -04:00
|
|
|
if (Widget::ListBox(TEXT("Animation.WalkingStyle"), walkStyles, walkStyle))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-06-28 16:23:03 -04:00
|
|
|
if (walkStyle == "default")
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
patch::Set<DWORD>(0x609A4E, 0x4D48689);
|
|
|
|
patch::Set<WORD>(0x609A52, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
patch::Nop(0x609A4E, 6);
|
2022-06-28 16:23:03 -04:00
|
|
|
Command<Commands::REQUEST_ANIMATION>(walkStyle.c_str());
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
2022-06-28 16:23:03 -04:00
|
|
|
Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hPlayer, walkStyle.c_str());
|
|
|
|
Command<Commands::REMOVE_ANIMATION>(walkStyle.c_str());
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-02-14 12:31:05 -05:00
|
|
|
SetHelpMessage(TEXT("Animation.WalkingStyleSet"));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2021-12-22 13:13:10 -05:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::EndTabBar();
|
|
|
|
}
|
2021-12-22 13:13:10 -05:00
|
|
|
}
|