@@ -158,8 +158,13 @@ DWORD RETURN_CEventHandler_ComputeKnockOffBikeResponse = 0x4BA076;
158158#define HOOKPOS_CAnimManager_AddAnimation 0x4d3aa0
159159DWORD RETURN_CAnimManager_AddAnimation = 0x4D3AAA ;
160160DWORD RETURN_CAnimManager_AddAnimation_SkipCopyAnimation = 0x4D3ABC ;
161- #define HOOKPOS_CAnimManager_BlendAnimation 0x4D4610
162- DWORD RETURN_CAnimManager_BlendAnimation = 0x4D4617 ;
161+
162+ #define HOOKPOS_CAnimManager_AddAnimationAndSync 0x4D3B30
163+ DWORD RETURN_CAnimManager_AddAnimationAndSync = 0x4D3B3A ;
164+ DWORD RETURN_CAnimManager_AddAnimationAndSync_SkipCopyAnimation = 0x4D3B4C ;
165+
166+ #define HOOKPOS_CAnimManager_BlendAnimation_Hierarchy 0x4D4410 // 0x4D4425
167+ DWORD RETURN_CAnimManager_BlendAnimation_Hierarchy = 0x4D4417 ; // 0x4D442D;
163168
164169#define HOOKPOS_CPed_GetWeaponSkill 0x5e3b60
165170DWORD RETURN_CPed_GetWeaponSkill = 0x5E3B68 ;
@@ -424,7 +429,8 @@ void HOOK_RenderScene_end ();
424429void HOOK_CPlantMgr_Render ();
425430void HOOK_CEventHandler_ComputeKnockOffBikeResponse ();
426431void HOOK_CAnimManager_AddAnimation ();
427- void HOOK_CAnimManager_BlendAnimation ();
432+ void HOOK_CAnimManager_AddAnimationAndSync ();
433+ void HOOK_CAnimManager_BlendAnimation_Hierarchy ();
428434void HOOK_CPed_GetWeaponSkill ();
429435void HOOK_CPed_AddGogglesModel ();
430436void HOOK_CPhysical_ProcessCollisionSectorList ();
@@ -631,7 +637,8 @@ void CMultiplayerSA::InitHooks()
631637 HookInstall (HOOKPOS_Idle, (DWORD)HOOK_Idle, 10 );
632638 HookInstall (HOOKPOS_CEventHandler_ComputeKnockOffBikeResponse, (DWORD)HOOK_CEventHandler_ComputeKnockOffBikeResponse, 7 );
633639 HookInstall (HOOKPOS_CAnimManager_AddAnimation, (DWORD)HOOK_CAnimManager_AddAnimation, 10 );
634- HookInstall (HOOKPOS_CAnimManager_BlendAnimation, (DWORD)HOOK_CAnimManager_BlendAnimation, 7 );
640+ HookInstall (HOOKPOS_CAnimManager_AddAnimationAndSync, (DWORD)HOOK_CAnimManager_AddAnimationAndSync, 10 );
641+ HookInstall (HOOKPOS_CAnimManager_BlendAnimation_Hierarchy, (DWORD)HOOK_CAnimManager_BlendAnimation_Hierarchy, 7 );
635642 HookInstall (HOOKPOS_CPed_GetWeaponSkill, (DWORD)HOOK_CPed_GetWeaponSkill, 8 );
636643 HookInstall (HOOKPOS_CPed_AddGogglesModel, (DWORD)HOOK_CPed_AddGogglesModel, 6 );
637644 HookInstall (HOOKPOS_CPhysical_ProcessCollisionSectorList, (DWORD)HOOK_CPhysical_ProcessCollisionSectorList, 7 );
@@ -5372,34 +5379,85 @@ void _declspec(naked) HOOK_CAnimManager_AddAnimation ()
53725379 }
53735380}
53745381
5375- float animationBlendDelta;
5376- void _declspec (naked) HOOK_CAnimManager_BlendAnimation ()
5382+
5383+ CAnimBlendAssociationSAInterface * pAnimAssociationToSyncWith = nullptr ;
5384+ void _declspec (naked) HOOK_CAnimManager_AddAnimationAndSync ()
53775385{
53785386 _asm
53795387 {
53805388 mov eax, [esp+4 ]
53815389 mov animationClump, eax
53825390 mov eax, [esp+8 ]
5383- mov animationGroup , eax
5391+ mov pAnimAssociationToSyncWith , eax
53845392 mov eax, [esp+12 ]
5393+ mov animationGroup, eax
5394+ mov eax, [esp+16 ]
53855395 mov animationID, eax
5396+ pushad
5397+ }
5398+
5399+ if ( m_pAddAnimationHandler )
5400+ {
5401+ pAnimAssociation = m_pAddAnimationHandler ( animationClump, animationGroup, animationID );
5402+ }
5403+ else
5404+ {
5405+ // This will avoid crash if m_pAddAnimationHandler is removed
5406+ // continue the normal flow of AddAnimationAndSync function, instead of skipping CopyAnimation
5407+
5408+ _asm
5409+ {
5410+ popad
5411+ mov eax,dword ptr [esp+0Ch]
5412+ mov edx,dword ptr ds:[0B4EA34h]
5413+ jmp RETURN_CAnimManager_AddAnimation
5414+ }
5415+ }
5416+
5417+
5418+ // As we are manually creating animation association, so skip CopyAnimation call
5419+ _asm
5420+ {
5421+ popad
5422+ push esi
5423+ push edi
5424+ mov eax, pAnimAssociation
5425+ jmp RETURN_CAnimManager_AddAnimation_SkipCopyAnimation
5426+ }
5427+ }
5428+
5429+
5430+ CAnimBlendHierarchySAInterface * pAnimHierarchy = nullptr ;
5431+ int flags = 0 ;
5432+ float animationBlendDelta = 0 .0f ;
5433+ void _declspec (naked) HOOK_CAnimManager_BlendAnimation_Hierarchy ()
5434+ {
5435+ _asm
5436+ {
5437+ mov eax, [esp+4 ]
5438+ mov animationClump, eax
5439+ mov eax, [esp+8 ]
5440+ mov pAnimHierarchy, eax
5441+ mov eax, [esp+12 ]
5442+ mov flags, eax
53865443 mov eax, [esp+16 ]
53875444 mov animationBlendDelta, eax
53885445 pushad
53895446 }
53905447
53915448 if ( m_pBlendAnimationHandler )
53925449 {
5393- m_pBlendAnimationHandler ( animationClump, animationGroup, animationID , animationBlendDelta );
5450+ m_pBlendAnimationHandler ( animationClump, pAnimHierarchy, flags , animationBlendDelta );
53945451 }
53955452
53965453 _asm
53975454 {
53985455 popad
5399- sub esp,14h
5400- mov ecx,dword ptr [esp+18h]
5401- jmp RETURN_CAnimManager_BlendAnimation
5456+ push 0FFFFFFFFh
5457+ push 04D4410h
5458+ jmp RETURN_CAnimManager_BlendAnimation_Hierarchy
54025459 }
5460+
54035461}
54045462
54055463CPedSAInterface * weaponSkillPed;
0 commit comments