@@ -3701,9 +3701,9 @@ bool CClientGame::StaticChokingHandler ( unsigned char ucWeaponType )
3701
3701
return g_pClientGame->ChokingHandler ( ucWeaponType );
3702
3702
}
3703
3703
3704
- bool CClientGame::StaticCAnimBlendAssocHierConstructorHandler ( SIFPAnimations ** pOutIFPAnimations, CAnimBlendAssociationSAInterface * pThis, RpClump * pClump, CAnimBlendHierarchySAInterface * pAnimHierarchy )
3704
+ bool CClientGame::StaticCAnimBlendAssocHierConstructorHandler ( SIFPAnimations ** pOutIFPAnimations, CAnimBlendAssociationSAInterface * pThis, RpClump * pClump, CAnimBlendHierarchySAInterface ** pOutAnimHierarchy )
3705
3705
{
3706
- return g_pClientGame->CAnimBlendAssocHierConstructorHandler ( pOutIFPAnimations, pThis, pClump, pAnimHierarchy );
3706
+ return g_pClientGame->CAnimBlendAssocHierConstructorHandler ( pOutIFPAnimations, pThis, pClump, pOutAnimHierarchy );
3707
3707
}
3708
3708
3709
3709
void CClientGame::StaticCAnimBlendAssocDestructorHandler ( CAnimBlendAssociationSAInterface * pThis )
@@ -3726,9 +3726,9 @@ bool CClientGame::StaticAssocGroupCopyAnimationHandler ( CAnimBlendStaticAssocia
3726
3726
return g_pClientGame->AssocGroupCopyAnimationHandler ( pOutAnimStaticAssoc, pOutIFPAnimations, pClump, pAnimAssocGroup, animID );
3727
3727
}
3728
3728
3729
- CAnimBlendHierarchySAInterface * CClientGame::StaticBlendAnimationHierarchyHandler ( RpClump * pClump , CAnimBlendHierarchySAInterface * pAnimHierarchy, int flags, float fBlendDelta )
3729
+ bool CClientGame::StaticBlendAnimationHierarchyHandler ( SIFPAnimations ** pOutIFPAnimations , CAnimBlendHierarchySAInterface ** pOutAnimHierarchy, RpClump * pClump )
3730
3730
{
3731
- return g_pClientGame->BlendAnimationHierarchyHandler ( pClump, pAnimHierarchy, flags, fBlendDelta );
3731
+ return g_pClientGame->BlendAnimationHierarchyHandler ( pOutIFPAnimations, pOutAnimHierarchy, pClump );
3732
3732
}
3733
3733
3734
3734
void CClientGame::StaticPreWorldProcessHandler ( void )
@@ -4013,23 +4013,58 @@ bool CClientGame::ChokingHandler ( unsigned char ucWeaponType )
4013
4013
}
4014
4014
4015
4015
4016
- bool CClientGame::CAnimBlendAssocHierConstructorHandler ( SIFPAnimations ** pOutIFPAnimations, CAnimBlendAssociationSAInterface * pThis, RpClump * pClump, CAnimBlendHierarchySAInterface * pAnimHierarchy )
4016
+ bool CClientGame::CAnimBlendAssocHierConstructorHandler ( SIFPAnimations ** pOutIFPAnimations, CAnimBlendAssociationSAInterface * pThis, RpClump * pClump, CAnimBlendHierarchySAInterface ** pOutAnimHierarchy )
4017
4017
{
4018
- printf (" CClientGame::CAnimBlendAssocHierConstructorHandler called! sAnimID: %d\n " , pThis->sAnimID );
4019
4018
bool isCustomAnimationToPlay = false ;
4020
4019
4020
+ CAnimBlendHierarchySAInterface * pAnimHierarchy = *pOutAnimHierarchy;
4021
+
4022
+ printf (" pAnimHierarchy->usNumSequences: %d\n " , pAnimHierarchy->usNumSequences );
4023
+
4021
4024
CAnimManager * pAnimationManager = g_pGame->GetAnimManager ();
4022
4025
CClientPed * pClientPed = GetClientPedByClump ( *pClump );
4023
4026
if ( pClientPed != nullptr )
4024
4027
{
4025
- printf (" CAnimBlendAssocHierConstructorHandler: got pClientPed\n\n " );
4026
- if ( pClientPed->IsCurrentAnimationCustom ( ) )
4027
- {
4028
- printf (" CAnimBlendAssocHierConstructorHandler: current animation is custom\n\n " );
4029
- *pOutIFPAnimations = pClientPed->GetIFPAnimationsPointer ();
4030
- isCustomAnimationToPlay = true ;
4028
+ printf (" CAnimBlendAssocHierConstructorHandler: Found pClientPed\n " );
4029
+ if ( pClientPed->isNextAnimationCustom () )
4030
+ {
4031
+ const SString & strBlockName = pClientPed->GetNextAnimationCustomBlockName ( );
4032
+ CClientIFP * pIFP = GetIFPPointerFromMap ( strBlockName );
4033
+ if ( pIFP )
4034
+ {
4035
+ const SString & strAnimationName = pClientPed->GetNextAnimationCustomName ( );
4036
+ auto pCustomAnimBlendHierarchy = pIFP->GetAnimationHierarchy ( strAnimationName );
4037
+ if ( pCustomAnimBlendHierarchy != nullptr )
4038
+ {
4039
+ if ( pIFP->isIFPLoaded ( ) )
4040
+ {
4041
+ SIFPAnimations * pIFPAnimations = pIFP->GetIFPAnimationsPointer ();
4042
+ pIFPAnimations->iReferences ++;
4043
+
4044
+ pClientPed->setCurrentAnimationCustom ( true );
4045
+ pClientPed->setNextAnimationNormal ( );
4046
+
4047
+ *pOutIFPAnimations = pIFPAnimations;
4048
+ *pOutAnimHierarchy = pCustomAnimBlendHierarchy;
4049
+ isCustomAnimationToPlay = true ;
4050
+ return isCustomAnimationToPlay;
4051
+ }
4052
+ }
4053
+ else
4054
+ {
4055
+ printf (" CAnimBlendAssocHierConstructorHandler: could not find IFP animation hierarchy '%s'\n " , strAnimationName.c_str ());
4056
+ }
4057
+ }
4058
+ else
4059
+ {
4060
+ printf (" CAnimBlendAssocHierConstructorHandler: could not find IFP block name '%s'\n " , strBlockName.c_str ());
4061
+ }
4031
4062
}
4063
+
4064
+ pClientPed->setCurrentAnimationCustom ( false );
4065
+ pClientPed->setNextAnimationNormal ( );
4032
4066
}
4067
+ printf (" CClientGame::CAnimBlendAssocHierConstructorHandler RETURNING! sAnimID: %d\n " , pThis->sAnimID );
4033
4068
return isCustomAnimationToPlay;
4034
4069
}
4035
4070
@@ -4106,15 +4141,15 @@ bool CClientGame::AssocGroupCopyAnimationHandler ( CAnimBlendStaticAssociationSA
4106
4141
}
4107
4142
4108
4143
4109
- CAnimBlendHierarchySAInterface * CClientGame::BlendAnimationHierarchyHandler ( RpClump * pClump , CAnimBlendHierarchySAInterface * pAnimHierarchy, int flags, float fBlendDelta )
4144
+ bool CClientGame::BlendAnimationHierarchyHandler ( SIFPAnimations ** pOutIFPAnimations , CAnimBlendHierarchySAInterface ** pOutAnimHierarchy, RpClump * pClump )
4110
4145
{
4111
- printf ( " CClientGame::BlendAnimationHierarchyHandler called | pClump: %p \n " , ( void *)pClump) ;
4146
+ bool isCustomAnimationToPlay = false ;
4112
4147
4113
4148
CAnimManager * pAnimationManager = g_pGame->GetAnimManager ();
4114
- CClientPed * pClientPed = GetClientPedByClump ( *pClump ); // pAnimationManager->GetPedPointerFromMap ( pClump ); //m_pRootEntity->GetClientPedByClump ( *pClump );
4149
+ CClientPed * pClientPed = GetClientPedByClump ( *pClump );
4115
4150
if ( pClientPed != nullptr )
4116
4151
{
4117
- printf (" BlendAnimationHierarchyHandler : Found pClientPed\n " );
4152
+ printf (" CAnimBlendAssocHierConstructorHandler : Found pClientPed\n " );
4118
4153
if ( pClientPed->isNextAnimationCustom () )
4119
4154
{
4120
4155
const SString & strBlockName = pClientPed->GetNextAnimationCustomBlockName ( );
@@ -4131,32 +4166,29 @@ CAnimBlendHierarchySAInterface * CClientGame::BlendAnimationHierarchyHandler ( R
4131
4166
pIFPAnimations->iReferences ++;
4132
4167
4133
4168
pClientPed->setCurrentAnimationCustom ( true );
4134
- pClientPed->SetIFPAnimationsPointer ( pIFPAnimations );
4135
- // Modifying a hierarchy like this is just bad, it's much better to create a new CAnimBlendHierarchySAInterface for every animation
4136
- // and then delete it once animation is over
4137
- pCustomAnimBlendHierarchy->iHashKey = pAnimHierarchy->iHashKey ;
4138
- pCustomAnimBlendHierarchy->iAnimBlockID = pAnimHierarchy->iAnimBlockID ;
4139
4169
pClientPed->setNextAnimationNormal ( );
4140
4170
4141
- printf (" BlendAnimationHierarchyHandler: Found Hierarchy, returning \n " );
4142
- return pCustomAnimBlendHierarchy;
4171
+ *pOutIFPAnimations = pIFPAnimations;
4172
+ *pOutAnimHierarchy = pCustomAnimBlendHierarchy;
4173
+ isCustomAnimationToPlay = true ;
4174
+ return isCustomAnimationToPlay;
4143
4175
}
4144
4176
}
4145
4177
else
4146
4178
{
4147
- printf (" BlendAnimationHierarchyHandler : could not find IFP animation hierarchy '%s'\n " , strAnimationName.c_str ());
4179
+ printf (" CAnimBlendAssocHierConstructorHandler : could not find IFP animation hierarchy '%s'\n " , strAnimationName.c_str ());
4148
4180
}
4149
4181
}
4150
4182
else
4151
4183
{
4152
- printf (" BlendAnimationHierarchyHandler : could not find IFP block name '%s'\n " , strBlockName.c_str ());
4184
+ printf (" CAnimBlendAssocHierConstructorHandler : could not find IFP block name '%s'\n " , strBlockName.c_str ());
4153
4185
}
4154
4186
}
4155
4187
4156
4188
pClientPed->setCurrentAnimationCustom ( false );
4157
4189
pClientPed->setNextAnimationNormal ( );
4158
4190
}
4159
- return pAnimHierarchy ;
4191
+ return isCustomAnimationToPlay ;
4160
4192
}
4161
4193
4162
4194
0 commit comments