@@ -270,7 +270,8 @@ CClientGame::CClientGame ( bool bLocalPlay )
270
270
g_pMultiplayer->SetPreFxRenderHandler ( CClientGame::StaticPreFxRenderHandler );
271
271
g_pMultiplayer->SetPreHudRenderHandler ( CClientGame::StaticPreHudRenderHandler );
272
272
g_pMultiplayer->SetAddAnimationHandler ( CClientGame::StaticAddAnimationHandler );
273
- g_pMultiplayer->SetBlendAnimationHandler ( CClientGame::StaticBlendAnimationHandler );
273
+ g_pMultiplayer->SetAddAnimationAndSyncHandler ( CClientGame::StaticAddAnimationAndSyncHandler );
274
+ g_pMultiplayer->SetBlendAnimationHierarchyHandler ( CClientGame::StaticBlendAnimationHierarchyHandler );
274
275
g_pMultiplayer->SetProcessCollisionHandler ( CClientGame::StaticProcessCollisionHandler );
275
276
g_pMultiplayer->SetVehicleCollisionHandler ( CClientGame::StaticVehicleCollisionHandler );
276
277
g_pMultiplayer->SetVehicleDamageHandler ( CClientGame::StaticVehicleDamageHandler );
@@ -428,7 +429,8 @@ CClientGame::~CClientGame ( void )
428
429
g_pMultiplayer->SetPreFxRenderHandler ( NULL );
429
430
g_pMultiplayer->SetPreHudRenderHandler ( NULL );
430
431
g_pMultiplayer->SetAddAnimationHandler ( NULL );
431
- g_pMultiplayer->SetBlendAnimationHandler ( NULL );
432
+ g_pMultiplayer->SetAddAnimationAndSyncHandler ( NULL );
433
+ g_pMultiplayer->SetBlendAnimationHierarchyHandler ( NULL );
432
434
g_pMultiplayer->SetProcessCollisionHandler ( NULL );
433
435
g_pMultiplayer->SetVehicleCollisionHandler ( NULL );
434
436
g_pMultiplayer->SetVehicleDamageHandler ( NULL );
@@ -3697,9 +3699,14 @@ CAnimBlendAssociationSAInterface * CClientGame::StaticAddAnimationHandler ( RpCl
3697
3699
return g_pClientGame->AddAnimationHandler ( pClump, animGroup, animID );
3698
3700
}
3699
3701
3700
- CAnimBlendHierarchySAInterface * CClientGame::StaticBlendAnimationHandler ( RpClump * pClump, CAnimBlendHierarchySAInterface * pAnimHierarchy, int flags, float fBlendDelta )
3702
+ CAnimBlendAssociationSAInterface * CClientGame::StaticAddAnimationAndSyncHandler ( RpClump * pClump, CAnimBlendAssociationSAInterface * pAnimAssocToSyncWith, AssocGroupId animGroup, AnimationId animID )
3701
3703
{
3702
- return g_pClientGame->BlendAnimationHandler ( pClump, pAnimHierarchy, flags, fBlendDelta );
3704
+ return g_pClientGame->AddAnimationAndSyncHandler ( pClump, pAnimAssocToSyncWith, animGroup, animID );
3705
+ }
3706
+
3707
+ CAnimBlendHierarchySAInterface * CClientGame::StaticBlendAnimationHierarchyHandler ( RpClump * pClump, CAnimBlendHierarchySAInterface * pAnimHierarchy, int flags, float fBlendDelta )
3708
+ {
3709
+ return g_pClientGame->BlendAnimationHierarchyHandler ( pClump, pAnimHierarchy, flags, fBlendDelta );
3703
3710
}
3704
3711
3705
3712
void CClientGame::StaticPreWorldProcessHandler ( void )
@@ -4002,7 +4009,15 @@ CAnimBlendAssociationSAInterface * CClientGame::AddAnimationHandler ( RpClump *
4002
4009
int *next; // eax
4003
4010
DWORD *tempAssoc; // eax
4004
4011
int *nextAssoc; // ecx
4005
- // We need to remove this line and add some code here for running animations simultaneously
4012
+
4013
+ CAnimManager * pAnimationManager = g_pGame->GetAnimManager ();
4014
+ CAnimBlendStaticAssoc * pAnimOriginalStaticAssoc = (CAnimBlendStaticAssoc *)pAnimationManager->GetAnimStaticAssociation ( animGroup, animID );
4015
+
4016
+ UncompressAnimation ( pAnimOriginalStaticAssoc->m_pAnimBlendHier );
4017
+ pAnimAssoc = (CAnimBlendAssoc *)malloc (sizeof (CAnimBlendAssoc));
4018
+ OLD_CAnimBlendAssoc_Constructor_staticAssocRef ( pAnimAssoc, *pAnimOriginalStaticAssoc);
4019
+
4020
+ // We need to remove this line and add some code here for running animations simultaneously
4006
4021
pAnimAssoc = CAnimBlendAssocGroup_CopyAnimation ((DWORD *) (*(DWORD*)0x00B4EA34 ) + 5 * animGroup, animID);
4007
4022
4008
4023
// //ofs << "Done calling CAnimBlendAssocGroup_CopyAnimation " << std::endl;
@@ -4050,15 +4065,62 @@ CAnimBlendAssociationSAInterface * CClientGame::AddAnimationHandler ( RpClump *
4050
4065
return (CAnimBlendAssociationSAInterface *)pAnimAssoc;
4051
4066
}
4052
4067
4053
- CAnimBlendHierarchySAInterface * CClientGame::BlendAnimationHandler ( RpClump * pClump, CAnimBlendHierarchySAInterface * pAnimHierarchy, int flags, float fBlendDelta )
4068
+ CAnimBlendAssociationSAInterface * CClientGame::AddAnimationAndSyncHandler ( RpClump * pClump, CAnimBlendAssociationSAInterface * pAnimAssocToSyncWith, AssocGroupId animGroup, AnimationId animID )
4069
+ {
4070
+ printf ( " AddAnimationAndSyncHandler called! pClump, GroupID, AnimID: %p, %d, %d\n " , (void *)pClump, animGroup, animID );
4071
+
4072
+ hCAnimBlendAssocGroup_CopyAnimation CAnimBlendAssocGroup_CopyAnimation = (hCAnimBlendAssocGroup_CopyAnimation)0x004CE130 ;
4073
+ hUncompressAnimation UncompressAnimation = (hUncompressAnimation)0x4d41c0 ;
4074
+ hCAnimBlendAssoc_Constructor_staticAssocRef OLD_CAnimBlendAssoc_Constructor_staticAssocRef = (hCAnimBlendAssoc_Constructor_staticAssocRef)0x4CF080 ;
4075
+ hCAnimBlendStaticAssoc_Constructor OLD_CAnimBlendStaticAssoc_Constructor = *(hCAnimBlendStaticAssoc_Constructor)0x4CE940 ;
4076
+ hCAnimBlendStaticAssoc_Init OLD_CAnimBlendStaticAssoc_Init = (hCAnimBlendStaticAssoc_Init)0x004CEC20 ;
4077
+ hCAnimBlendAssoc_SyncAnimation CAnimBlendAssoc_SyncAnimation = (hCAnimBlendAssoc_SyncAnimation)0x004CEB40 ;
4078
+ hCAnimBlendAssoc_Start CAnimBlendAssoc_Start = (hCAnimBlendAssoc_Start)0x004CEB70 ;
4079
+
4080
+ CAnimBlendAssoc * pAnimAssocToSyncWith2 = (CAnimBlendAssoc *)pAnimAssocToSyncWith;
4081
+ CAnimBlendAssoc *pAnimAssoc; // esi
4082
+ int *pClumpData; // edi
4083
+ DWORD *tempAssoc; // eax
4084
+ int nextAssoc; // ecx
4085
+
4086
+ pAnimAssoc = CAnimBlendAssocGroup_CopyAnimation ((DWORD *) (*(DWORD*)0x00B4EA34 ) + 5 * animGroup, animID);
4087
+ pClumpData = *(int **)( (*(DWORD*)0xB5F878 ) + (int )pClump);
4088
+ if ( (*((BYTE *)pAnimAssoc + 46 ) >> 5 ) & 1 && pAnimAssocToSyncWith2 )
4089
+ {
4090
+ CAnimBlendAssoc_SyncAnimation ( pAnimAssoc, pAnimAssocToSyncWith2);
4091
+ *((BYTE *)pAnimAssoc + 46 ) |= 1u ;
4092
+ }
4093
+ else
4094
+ {
4095
+ CAnimBlendAssoc_Start ( pAnimAssoc, 0 );
4096
+ }
4097
+
4098
+ tempAssoc = ((DWORD*)pAnimAssoc) + 1 ;
4099
+
4100
+ if ( *pClumpData )
4101
+ *(DWORD *)(*pClumpData + 4 ) = (DWORD)tempAssoc;
4102
+
4103
+ nextAssoc = *pClumpData;
4104
+
4105
+ DWORD * dwpAnimAssoc = (DWORD*) pAnimAssoc;
4106
+
4107
+ dwpAnimAssoc[2 ] = (DWORD)pClumpData;
4108
+
4109
+ *tempAssoc = nextAssoc;
4110
+
4111
+ *pClumpData = (int )tempAssoc;
4112
+ return (CAnimBlendAssociationSAInterface *)pAnimAssoc;
4113
+ }
4114
+
4115
+ CAnimBlendHierarchySAInterface * CClientGame::BlendAnimationHierarchyHandler ( RpClump * pClump, CAnimBlendHierarchySAInterface * pAnimHierarchy, int flags, float fBlendDelta )
4054
4116
{
4055
- printf (" CClientGame::BlendAnimationHandler called | pClump: %p\n " , (void *)pClump);
4117
+ printf (" CClientGame::BlendAnimationHierarchyHandler called | pClump: %p\n " , (void *)pClump);
4056
4118
4057
4119
CAnimManager * pAnimationManager = g_pGame->GetAnimManager ();
4058
4120
CClientPed * pClientPed = GetClientPedByClump ( *pClump ); // pAnimationManager->GetPedPointerFromMap ( pClump ); //m_pRootEntity->GetClientPedByClump ( *pClump );
4059
4121
if ( pClientPed != nullptr )
4060
4122
{
4061
- printf (" BlendAnimationHandler : Found pClientPed\n " );
4123
+ printf (" BlendAnimationHierarchyHandler : Found pClientPed\n " );
4062
4124
if ( pClientPed->isNextAnimationCustom () )
4063
4125
{
4064
4126
const SString & strBlockName = pClientPed->GetNextAnimationCustomBlockName ( );
@@ -4069,7 +4131,7 @@ CAnimBlendHierarchySAInterface * CClientGame::BlendAnimationHandler ( RpClump *
4069
4131
auto pCustomAnimBlendHierarchy = pIFP->GetAnimationHierarchy ( strAnimationName );
4070
4132
if ( pCustomAnimBlendHierarchy != nullptr )
4071
4133
{
4072
- printf (" BlendAnimationHandler : Found Hierarchy, returning \n " );
4134
+ printf (" BlendAnimationHierarchyHandler : Found Hierarchy, returning \n " );
4073
4135
4074
4136
pClientPed->setCurrentAnimationCustom ( true );
4075
4137
@@ -4082,12 +4144,12 @@ CAnimBlendHierarchySAInterface * CClientGame::BlendAnimationHandler ( RpClump *
4082
4144
}
4083
4145
else
4084
4146
{
4085
- printf (" BlendAnimationHandler : could not find IFP animation hierarchy '%s'\n " , strAnimationName.c_str ());
4147
+ printf (" BlendAnimationHierarchyHandler : could not find IFP animation hierarchy '%s'\n " , strAnimationName.c_str ());
4086
4148
}
4087
4149
}
4088
4150
else
4089
4151
{
4090
- printf (" BlendAnimationHandler : could not find IFP block name '%s'\n " , strBlockName.c_str ());
4152
+ printf (" BlendAnimationHierarchyHandler : could not find IFP block name '%s'\n " , strBlockName.c_str ());
4091
4153
}
4092
4154
}
4093
4155
else
0 commit comments