[III | VC] Add animation support
This commit is contained in:
parent
b1be10666c
commit
c5dfbb30ef
357
resource/III/CheatMenu/json/animation.json
Normal file
357
resource/III/CheatMenu/json/animation.json
Normal file
@ -0,0 +1,357 @@
|
||||
{
|
||||
"Rocket right" :
|
||||
{
|
||||
"ROCKETRIGHT WALK ROCKET RIGHT" : "24$0",
|
||||
"ROCKETRIGHT RUN ROCKET RIGHT" : "24$1",
|
||||
"ROCKETRIGHT RUN ROCKET RIGHT 1" : "24$2",
|
||||
"ROCKETRIGHT IDLE ROCKET" : "24$3",
|
||||
"ROCKETRIGHT WALKST ROCKET RIGHT" : "24$4"
|
||||
},
|
||||
"Rocket left" :
|
||||
{
|
||||
"ROCKETLEFT WALK ROCKET LEFT" : "23$0",
|
||||
"ROCKETLEFT RUN ROCKET LEFT" : "23$1",
|
||||
"ROCKETLEFT RUN ROCKET LEFT 1" : "23$2",
|
||||
"ROCKETLEFT IDLE ROCKET" : "23$3",
|
||||
"ROCKETLEFT WALKST ROCKET LEFT" : "23$4"
|
||||
},
|
||||
"Rocket back" :
|
||||
{
|
||||
"ROCKETBACK WALK ROCKET BACK" : "22$0",
|
||||
"ROCKETBACK RUN ROCKET BACK" : "22$1",
|
||||
"ROCKETBACK RUN ROCKET BACK 1" : "22$2",
|
||||
"ROCKETBACK IDLE ROCKET" : "22$3",
|
||||
"ROCKETBACK WALKST ROCKET BACK" : "22$4"
|
||||
},
|
||||
"Player right" :
|
||||
{
|
||||
"PLAYERRIGHT WALK PLAYER RIGHT" : "21$0",
|
||||
"PLAYERRIGHT RUN RIGHT" : "21$1",
|
||||
"PLAYERRIGHT RUN RIGHT 1" : "21$2",
|
||||
"PLAYERRIGHT IDLE STANCE" : "21$3",
|
||||
"PLAYERRIGHT WALK START RIGHT" : "21$4"
|
||||
},
|
||||
"Player left" :
|
||||
{
|
||||
"PLAYERLEFT WALK PLAYER LEFT" : "20$0",
|
||||
"PLAYERLEFT RUN LEFT" : "20$1",
|
||||
"PLAYERLEFT RUN LEFT 1" : "20$2",
|
||||
"PLAYERLEFT IDLE STANCE" : "20$3",
|
||||
"PLAYERLEFT WALK START LEFT" : "20$4"
|
||||
},
|
||||
"Player back" :
|
||||
{
|
||||
"PLAYERBACK WALK PLAYER BACK" : "19$0",
|
||||
"PLAYERBACK RUN PLAYER BACK" : "19$1",
|
||||
"PLAYERBACK RUN PLAYER BACK 1" : "19$2",
|
||||
"PLAYERBACK IDLE STANCE" : "19$3",
|
||||
"PLAYERBACK WALK START BACK" : "19$4"
|
||||
},
|
||||
"Panic chuncky" :
|
||||
{
|
||||
"PANICCHUNKY RUN FATOLD" : "18$0",
|
||||
"PANICCHUNKY WOMAN RUNPANIC" : "18$1",
|
||||
"PANICCHUNKY WOMAN RUNPANIC 1" : "18$2",
|
||||
"PANICCHUNKY IDLE STANCE" : "18$3"
|
||||
},
|
||||
"Fat woman" :
|
||||
{
|
||||
"FATWOMAN WALK FAT" : "17$0",
|
||||
"FATWOMAN WOMAN RUN" : "17$1",
|
||||
"FATWOMAN WOMAN RUNPANIC" : "17$2",
|
||||
"FATWOMAN WOMAN IDLESTANCE" : "17$3"
|
||||
},
|
||||
"Old woman" :
|
||||
{
|
||||
"OLDWOMAN WOMAN WALKOLD" : "16$0",
|
||||
"OLDWOMAN WOMAN RUN" : "16$1",
|
||||
"OLDWOMAN WOMAN RUNPANIC" : "16$2",
|
||||
"OLDWOMAN WOMAN IDLESTANCE" : "16$3"
|
||||
},
|
||||
"Sexy woman" :
|
||||
{
|
||||
"SEXYWOMAN WOMAN WALKSEXY" : "15$0",
|
||||
"SEXYWOMAN WOMAN RUN" : "15$1",
|
||||
"SEXYWOMAN WOMAN RUNPANIC" : "15$2",
|
||||
"SEXYWOMAN WOMAN IDLESTANCE" : "15$3"
|
||||
},
|
||||
"Busy woman" :
|
||||
{
|
||||
"BUSYWOMAN WOMAN WALKBUSY" : "14$0",
|
||||
"BUSYWOMAN WOMAN RUN" : "14$1",
|
||||
"BUSYWOMAN WOMAN RUNPANIC" : "14$2",
|
||||
"BUSYWOMAN WOMAN IDLESTANCE" : "14$3"
|
||||
},
|
||||
"Shopping" :
|
||||
{
|
||||
"SHOPPING WOMAN WALKSHOP" : "13$0",
|
||||
"SHOPPING WOMAN RUN" : "13$1",
|
||||
"SHOPPING WOMAN RUN 1" : "13$2",
|
||||
"SHOPPING WOMAN IDLESTANCE" : "13$3"
|
||||
},
|
||||
"Woman" :
|
||||
{
|
||||
"WOMAN WALKNORM" : "12$0",
|
||||
"WOMAN RUN" : "12$1",
|
||||
"WOMAN RUNPANIC" : "12$2",
|
||||
"WOMAN IDLESTANCE" : "12$3"
|
||||
},
|
||||
"Old fatman" :
|
||||
{
|
||||
"OLDFATMAN WALK FATOLD" : "11$0",
|
||||
"OLDFATMAN RUN FATOLD" : "11$1",
|
||||
"OLDFATMAN WOMAN RUNPANIC" : "11$2",
|
||||
"OLDFATMAN IDLE STANCE" : "11$3"
|
||||
},
|
||||
"Fatman" :
|
||||
{
|
||||
"FATMAN WALK FAT" : "10$0",
|
||||
"FATMAN RUN CIVI" : "10$1",
|
||||
"FATMAN WOMAN RUNPANIC" : "10$2",
|
||||
"FATMAN IDLE STANCE" : "10$3"
|
||||
},
|
||||
"Gang2" :
|
||||
{
|
||||
"GANG2 WALK GANG2" : "9$0",
|
||||
"GANG2 RUN GANG1" : "9$1",
|
||||
"GANG2 SPRINT CIVI" : "9$2",
|
||||
"GANG2 IDLE STANCE" : "9$3"
|
||||
},
|
||||
"Gang1" :
|
||||
{
|
||||
"GANG1 WALK GANG1" : "8$0",
|
||||
"GANG1 RUN GANG1" : "8$1",
|
||||
"GANG1 SPRINT CIVI" : "8$2",
|
||||
"GANG1 IDLE STANCE" : "8$3"
|
||||
},
|
||||
"Oldman" :
|
||||
{
|
||||
"OLDMAN WALK OLD" : "7$0",
|
||||
"OLDMAN RUN CIVI" : "7$1",
|
||||
"OLDMAN SPRINT CIVI" : "7$2",
|
||||
"OLDMAN IDLE STANCE" : "7$3"
|
||||
},
|
||||
"Shuffle" :
|
||||
{
|
||||
"SHUFFLE WALK SHUFFLE" : "6$0",
|
||||
"SHUFFLE RUN CIVI" : "6$1",
|
||||
"SHUFFLE SPRINT CIVI" : "6$2",
|
||||
"SHUFFLE IDLE STANCE" : "6$3"
|
||||
},
|
||||
"Player baseball bat" :
|
||||
{
|
||||
"PLAYERBBBAT WALK PLAYER" : "5$0",
|
||||
"PLAYERBBBAT RUN PLAYER" : "5$1",
|
||||
"PLAYERBBBAT RUN PLAYER 1" : "5$2",
|
||||
"PLAYERBBBAT IDLE STANCE" : "5$3",
|
||||
"PLAYERBBBAT WALK START" : "5$4"
|
||||
},
|
||||
"Player2 armed" :
|
||||
{
|
||||
"PLAYER2ARMED WALK PLAYER" : "4$0",
|
||||
"PLAYER2ARMED RUN ARMED" : "4$1",
|
||||
"PLAYER2ARMED RUN ARMED 1" : "4$2",
|
||||
"PLAYER2ARMED IDLE STANCE" : "4$3",
|
||||
"PLAYER2ARMED WALK START" : "4$4"
|
||||
},
|
||||
"Player1 armed" :
|
||||
{
|
||||
"PLAYER1ARMED WALK PLAYER" : "3$0",
|
||||
"PLAYER1ARMED RUN 1ARMED" : "3$1",
|
||||
"PLAYER1ARMED SPRINT CIVI" : "3$2",
|
||||
"PLAYER1ARMED IDLE STANCE" : "3$3",
|
||||
"PLAYER1ARMED WALK START" : "3$4"
|
||||
},
|
||||
"Player rocket" :
|
||||
{
|
||||
"PLAYERROCKET WALK ROCKET" : "2$0",
|
||||
"PLAYERROCKET RUN ROCKET" : "2$1",
|
||||
"PLAYERROCKET RUN ROCKET 1" : "2$2",
|
||||
"PLAYERROCKET IDLE ROCKET" : "2$3",
|
||||
"PLAYERROCKET WALK START ROCKET" : "2$4"
|
||||
},
|
||||
"Player" :
|
||||
{
|
||||
"PLAYER WALK PLAYER" : "1$0",
|
||||
"PLAYER RUN PLAYER" : "1$1",
|
||||
"PLAYER SPRINT CIVI" : "1$2",
|
||||
"PLAYER IDLE STANCE" : "1$3",
|
||||
"PLAYER WALK START" : "1$4"
|
||||
},
|
||||
"Man" :
|
||||
{
|
||||
"WALK CIVI" : "0$0",
|
||||
"RUN CIVI" : "0$1",
|
||||
"SPRINT PANIC" : "0$2",
|
||||
"IDLE STANCE" : "0$3",
|
||||
"WALK START" : "0$4",
|
||||
"RUN STOP" : "0$5",
|
||||
"RUN STOPR" : "0$6",
|
||||
"IDLE CAM" : "0$7",
|
||||
"IDLE HBHB" : "0$8",
|
||||
"IDLE TIRED" : "0$9",
|
||||
"IDLE ARMED" : "0$10",
|
||||
"IDLE CHAT" : "0$11",
|
||||
"IDLE TAXI" : "0$12",
|
||||
"KO SHOT FRONT" : "0$13",
|
||||
"KO SHOT FRONT 1" : "0$14",
|
||||
"KO SHOT FRONT 2" : "0$15",
|
||||
"KO SHOT FRONT 3" : "0$16",
|
||||
"KO SHOT FACE" : "0$17",
|
||||
"KO SHOT STOM" : "0$18",
|
||||
"KO SHOT ARML" : "0$19",
|
||||
"KO SHOT ARMR" : "0$20",
|
||||
"KO SHOT LEGL" : "0$21",
|
||||
"KO SHOT LEGR" : "0$22",
|
||||
"KD LEFT" : "0$23",
|
||||
"KD RIGHT" : "0$24",
|
||||
"KO SKID FRONT" : "0$25",
|
||||
"KO SPIN R" : "0$26",
|
||||
"KO SKID BACK" : "0$27",
|
||||
"KO SPIN L" : "0$28",
|
||||
"SHOT PARTIAL" : "0$29",
|
||||
"SHOT LEFTP" : "0$30",
|
||||
"SHOT PARTIAL 1" : "0$31",
|
||||
"SHOT RIGHTP" : "0$32",
|
||||
"HIT FRONT" : "0$33",
|
||||
"HIT L" : "0$34",
|
||||
"HIT BACK" : "0$35",
|
||||
"HIT R" : "0$36",
|
||||
"FLOOR HIT" : "0$37",
|
||||
"HIT BODYBLOW" : "0$38",
|
||||
"HIT CHEST" : "0$39",
|
||||
"HIT HEAD" : "0$40",
|
||||
"HIT WALK" : "0$41",
|
||||
"HIT WALL" : "0$42",
|
||||
"FLOOR HIT F" : "0$43",
|
||||
"HIT BEHIND" : "0$44",
|
||||
"PUNCHR" : "0$45",
|
||||
"KICK FLOOR" : "0$46",
|
||||
"WEAPON BAT H" : "0$47",
|
||||
"WEAPON BAT V" : "0$48",
|
||||
"WEAPON HGUN BODY" : "0$49",
|
||||
"WEAPON AK BODY" : "0$50",
|
||||
"WEAPON PUMP" : "0$51",
|
||||
"WEAPON SNIPER" : "0$52",
|
||||
"WEAPON THROW" : "0$53",
|
||||
"WEAPON THROWU" : "0$54",
|
||||
"WEAPON START THROW" : "0$55",
|
||||
"BOMBER" : "0$56",
|
||||
"WEAPON HGUN RLOAD" : "0$57",
|
||||
"WEAPON AK RLOAD" : "0$58",
|
||||
"FPS PUNCH" : "0$59",
|
||||
"FPS BAT" : "0$60",
|
||||
"FPS UZI" : "0$61",
|
||||
"FPS PUMP" : "0$62",
|
||||
"FPS AK" : "0$63",
|
||||
"FPS M16" : "0$64",
|
||||
"FPS ROCKET" : "0$65",
|
||||
"FIGHTIDLE" : "0$66",
|
||||
"FIGHT2IDLE" : "0$67",
|
||||
"FIGHTSH F" : "0$68",
|
||||
"FIGHTBODYBLOW" : "0$69",
|
||||
"FIGHTHEAD" : "0$70",
|
||||
"FIGHTKICK" : "0$71",
|
||||
"FIGHTKNEE" : "0$72",
|
||||
"FIGHTLHOOK" : "0$73",
|
||||
"FIGHTPUNCH" : "0$74",
|
||||
"FIGHTRNDHSE" : "0$75",
|
||||
"FIGHTLNGKCK" : "0$76",
|
||||
"FIGHTPPUNCH" : "0$77",
|
||||
"CAR JACKEDRHS" : "0$78",
|
||||
"CAR LJACKEDRHS" : "0$79",
|
||||
"CAR JACKEDLHS" : "0$80",
|
||||
"CAR LJACKEDLHS" : "0$81",
|
||||
"CAR QJACK" : "0$82",
|
||||
"CAR QJACKED" : "0$83",
|
||||
"CAR ALIGN LHS" : "0$84",
|
||||
"CAR ALIGNHI LHS" : "0$85",
|
||||
"CAR OPEN LHS" : "0$86",
|
||||
"CAR DOORLOCKED LHS" : "0$87",
|
||||
"CAR PULLOUT LHS" : "0$88",
|
||||
"CAR PULLOUTL LHS" : "0$89",
|
||||
"CAR GETIN LHS" : "0$90",
|
||||
"CAR GETINL LHS" : "0$91",
|
||||
"CAR CLOSEDOOR LHS" : "0$92",
|
||||
"CAR CLOSEDOORL LHS" : "0$93",
|
||||
"CAR ROLLDOOR" : "0$94",
|
||||
"CAR ROLLDOORLO" : "0$95",
|
||||
"CAR GETOUT LHS" : "0$96",
|
||||
"CAR GETOUTL LHS" : "0$97",
|
||||
"CAR CLOSE LHS" : "0$98",
|
||||
"CAR ALIGN RHS" : "0$99",
|
||||
"CAR ALIGNHI RHS" : "0$100",
|
||||
"CAR OPEN RHS" : "0$101",
|
||||
"CAR DOORLOCKED RHS" : "0$102",
|
||||
"CAR PULLOUT RHS" : "0$103",
|
||||
"CAR PULLOUTL RHS" : "0$104",
|
||||
"CAR GETIN RHS" : "0$105",
|
||||
"CAR GETINL RHS" : "0$106",
|
||||
"CAR CLOSEDOOR RHS" : "0$107",
|
||||
"CAR CLOSEDOORL RHS" : "0$108",
|
||||
"CAR SHUFFLE RHS" : "0$109",
|
||||
"CAR LSHUFFLE RHS" : "0$110",
|
||||
"CAR SIT" : "0$111",
|
||||
"CAR LSIT" : "0$112",
|
||||
"CAR SITP" : "0$113",
|
||||
"CAR SITPLO" : "0$114",
|
||||
"DRIVE L" : "0$115",
|
||||
"DRIVE R" : "0$116",
|
||||
"DRIVE LO L" : "0$117",
|
||||
"DRIVE LO R" : "0$118",
|
||||
"DRIVEBY L" : "0$119",
|
||||
"DRIVEBY R" : "0$120",
|
||||
"CAR LB" : "0$121",
|
||||
"DRIVE BOAT" : "0$122",
|
||||
"CAR GETOUT RHS" : "0$123",
|
||||
"CAR GETOUTL RHS" : "0$124",
|
||||
"CAR CLOSE RHS" : "0$125",
|
||||
"CAR HOOKERTALK" : "0$126",
|
||||
"COACH OPNL" : "0$127",
|
||||
"COACH OPNR" : "0$128",
|
||||
"COACH INL" : "0$129",
|
||||
"COACH INR" : "0$130",
|
||||
"COACH OUTL" : "0$131",
|
||||
"TRAIN GETIN" : "0$132",
|
||||
"TRAIN GETOUT" : "0$133",
|
||||
"CAR CRAWLOUTRHS" : "0$134",
|
||||
"CAR CRAWLOUTRHS 1" : "0$135",
|
||||
"VAN OPENL" : "0$136",
|
||||
"VAN GETINL" : "0$137",
|
||||
"VAN CLOSEL" : "0$138",
|
||||
"VAN GETOUTL" : "0$139",
|
||||
"VAN OPEN" : "0$140",
|
||||
"VAN GETIN" : "0$141",
|
||||
"VAN CLOSE" : "0$142",
|
||||
"VAN GETOUT" : "0$143",
|
||||
"GETUP" : "0$144",
|
||||
"GETUP 1" : "0$145",
|
||||
"GETUP 2" : "0$146",
|
||||
"GETUP FRONT" : "0$147",
|
||||
"JUMP LAUNCH" : "0$148",
|
||||
"JUMP GLIDE" : "0$149",
|
||||
"JUMP LAND" : "0$150",
|
||||
"FALL FALL" : "0$151",
|
||||
"FALL GLIDE" : "0$152",
|
||||
"FALL LAND" : "0$153",
|
||||
"FALL COLLAPSE" : "0$154",
|
||||
"EV STEP" : "0$155",
|
||||
"EV DIVE" : "0$156",
|
||||
"XPRESSSCRATCH" : "0$157",
|
||||
"ROADCROSS" : "0$158",
|
||||
"TURN 180" : "0$159",
|
||||
"ARRESTGUN" : "0$160",
|
||||
"DROWN" : "0$161",
|
||||
"CPR" : "0$162",
|
||||
"DUCK DOWN" : "0$163",
|
||||
"DUCK LOW" : "0$164",
|
||||
"RBLOCK CSHOOT" : "0$165",
|
||||
"WEAPON THROWU 1" : "0$166",
|
||||
"HANDSUP" : "0$167",
|
||||
"HANDSCOWER" : "0$168",
|
||||
"FUCKU" : "0$169",
|
||||
"PHONE IN" : "0$170",
|
||||
"PHONE OUT" : "0$171",
|
||||
"PHONE TALK" : "0$172"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,196 @@
|
||||
#include "pch.h"
|
||||
#include "animation.h"
|
||||
#ifdef GTASA
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifndef GTASA
|
||||
#include <CAnimationStyleDescriptor.h>
|
||||
#include <CAnimManager.h>
|
||||
#include "../depend/kiero/minhook/MinHook.h"
|
||||
#include "eAnimations.h"
|
||||
#include <CAnimBlendAssociation.h>
|
||||
#endif
|
||||
|
||||
#ifdef GTA3
|
||||
#include <RpAnimBlend.h>
|
||||
#endif
|
||||
|
||||
#ifdef GTASA
|
||||
void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior)
|
||||
{
|
||||
if (Util::IsOnCutscene())
|
||||
{
|
||||
SetHelpMessage("Another cutscene is running", false, false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
if (!pPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_Cutscene::m_SceneName = cutsceneId;
|
||||
Command<Commands::LOAD_CUTSCENE>(cutsceneId.c_str());
|
||||
m_Cutscene::m_nInterior = pPlayer->m_nAreaCode;
|
||||
pPlayer->m_nAreaCode = std::stoi(interior);
|
||||
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
|
||||
}
|
||||
|
||||
#elif GTAVC
|
||||
// Thanks to codenulls(https://github.com/codenulls/)
|
||||
|
||||
static auto OLD_CStreaming_RemoveModel = (bool(__cdecl*)(int))0x40D6E0;
|
||||
static bool NEW_CStreaming_RemoveModel(int modelID)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float blend)
|
||||
{
|
||||
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;
|
||||
|
||||
if (m_Loop)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= ANIMATION_LOOPED;
|
||||
}
|
||||
|
||||
if (m_bSecondary)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= ANIMATION_PARTIAL;
|
||||
}
|
||||
}
|
||||
|
||||
bool Animation::_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;
|
||||
}
|
||||
#else // GTA III
|
||||
|
||||
void Animation::_PlayAnimation(RpClump* pClump, int animGroup, int animID, float blend)
|
||||
{
|
||||
CAnimBlendAssociation* pAnimStaticAssoc = CAnimManager::GetAnimAssociation((AssocGroupId)animGroup, (AnimationId)animID);
|
||||
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);
|
||||
}
|
||||
pAnimAssoc = CAnimManager::BlendAnimation(pClump, (AssocGroupId)animGroup, (AnimationId)animID, blend);
|
||||
pAnimAssoc->m_nFlags = 0x1 | 0x20;
|
||||
|
||||
if (m_Loop)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= 0x2;
|
||||
}
|
||||
|
||||
if (m_bSecondary)
|
||||
{
|
||||
pAnimAssoc->m_nFlags |= 0x10;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& value)
|
||||
{
|
||||
CPlayerPed *pPlayer = FindPlayerPed();
|
||||
|
||||
if (!pPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef GTASA
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
|
||||
if (ifp != "PED")
|
||||
{
|
||||
Command<Commands::REQUEST_ANIMATION>(ifp.c_str());
|
||||
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
||||
}
|
||||
|
||||
Command<Commands::CLEAR_CHAR_TASKS>(hplayer);
|
||||
if (m_bSecondary)
|
||||
{
|
||||
Command<Commands::TASK_PLAY_ANIM_SECONDARY>(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Command<Commands::TASK_PLAY_ANIM>(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
||||
}
|
||||
|
||||
if (ifp != "PED")
|
||||
{
|
||||
Command<Commands::REMOVE_ANIMATION>(ifp.c_str());
|
||||
}
|
||||
|
||||
#else // GTA VC & III
|
||||
if (pPlayer)
|
||||
{
|
||||
int groupID, animID;
|
||||
sscanf(value.c_str(), "%d$%d,", &groupID, &animID);
|
||||
_PlayAnimation(pPlayer->m_pRwClump, groupID, animID, 4.0f);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Animation::Animation()
|
||||
{
|
||||
#ifdef GTASA
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
if (m_Cutscene::m_bRunning)
|
||||
@ -33,27 +218,18 @@ Animation::Animation()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
#elif GTAVC
|
||||
// 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);
|
||||
|
||||
void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior)
|
||||
{
|
||||
if (Util::IsOnCutscene())
|
||||
{
|
||||
SetHelpMessage("Another cutscene is running", false, false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
if (!pPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_Cutscene::m_SceneName = cutsceneId;
|
||||
Command<Commands::LOAD_CUTSCENE>(cutsceneId.c_str());
|
||||
m_Cutscene::m_nInterior = pPlayer->m_nAreaCode;
|
||||
pPlayer->m_nAreaCode = std::stoi(interior);
|
||||
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
|
||||
MH_CreateHook((void*)0x40D6E0, NEW_CStreaming_RemoveModel, (void**)&OLD_CStreaming_RemoveModel);
|
||||
MH_EnableHook((void*)0x40D6E0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Animation::Draw()
|
||||
@ -73,7 +249,11 @@ void Animation::Draw()
|
||||
{
|
||||
if (hPlayer)
|
||||
{
|
||||
#ifdef GTASA
|
||||
Command<Commands::CLEAR_CHAR_TASKS>(hPlayer);
|
||||
#else
|
||||
_PlayAnimation(pPlayer->m_pRwClump, ANIM_GROUP_MAN, ANIM_MAN_IDLE_STANCE, 4.0f);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +276,19 @@ void Animation::Draw()
|
||||
}
|
||||
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();
|
||||
@ -124,19 +316,6 @@ void Animation::Draw()
|
||||
}
|
||||
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();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Cutscene"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
@ -164,36 +343,11 @@ void Animation::Draw()
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
#endif
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
{
|
||||
int hplayer = CPools::GetPedRef(FindPlayerPed());
|
||||
|
||||
if (ifp != "PED")
|
||||
{
|
||||
Command<Commands::REQUEST_ANIMATION>(ifp.c_str());
|
||||
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
||||
}
|
||||
|
||||
Command<Commands::CLEAR_CHAR_TASKS>(hplayer);
|
||||
if (m_bSecondary)
|
||||
{
|
||||
Command<Commands::TASK_PLAY_ANIM_SECONDARY>(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Command<Commands::TASK_PLAY_ANIM>(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
||||
}
|
||||
|
||||
if (ifp != "PED")
|
||||
{
|
||||
Command<Commands::REMOVE_ANIMATION>(ifp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
{
|
||||
if (ifp == "Custom")
|
||||
@ -207,4 +361,3 @@ void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string
|
||||
SetHelpMessage("You can only remove custom anims", false, false, false);
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,4 +1,3 @@
|
||||
#ifdef GTASA
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
@ -13,6 +12,7 @@ private:
|
||||
static inline bool m_Loop; // loop animation
|
||||
static inline bool m_bSecondary; // play animation as secondary
|
||||
|
||||
#ifdef GTASA
|
||||
// Cutscene player
|
||||
struct m_Cutscene
|
||||
{
|
||||
@ -32,6 +32,7 @@ private:
|
||||
"fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
||||
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate"
|
||||
};
|
||||
#endif
|
||||
|
||||
protected:
|
||||
Animation();
|
||||
@ -39,11 +40,15 @@ protected:
|
||||
public:
|
||||
static void Draw();
|
||||
static void PlayAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
static void PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior);
|
||||
static void RemoveAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
};
|
||||
#else
|
||||
|
||||
// Dummy Class for VC & III
|
||||
class Animation{};
|
||||
#ifdef GTASA
|
||||
static void PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior);
|
||||
#elif GTAVC
|
||||
static bool _LoadAnimationBlock(const char* szBlockName);
|
||||
#endif
|
||||
|
||||
#ifndef GTASA
|
||||
static void _PlayAnimation(RpClump* pClump, int animGroup, int animID, float blend);
|
||||
#endif
|
||||
};
|
@ -29,11 +29,7 @@ private:
|
||||
|
||||
static inline CallbackTable header{
|
||||
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
|
||||
#ifdef GTASA
|
||||
{"Animation", &Animation::Draw},
|
||||
#else
|
||||
{"Dummy", nullptr},
|
||||
#endif
|
||||
{"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw}, {"Game", &Game::Draw},
|
||||
{"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#define MENU_NAME "Cheat Menu"
|
||||
#define MENU_VERSION_NUMBER "3.0"
|
||||
#define MENU_VERSION_NUMBER "3.1"
|
||||
#define MENU_VERSION MENU_VERSION_NUMBER
|
||||
#define BUILD_NUMBER "20211217"
|
||||
#define BUILD_NUMBER "20211222"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION
|
||||
|
Loading…
Reference in New Issue
Block a user