@@ -8,42 +8,37 @@ CIFPAnimations::CIFPAnimations ( void )
88
99CIFPAnimations::~CIFPAnimations ( void )
1010{
11- printf (" ~CIFPAnimations(): CIFPAnimations destoryed \n " );
11+ printf (" ~CIFPAnimations(): Going to call DeleteAnimations \n " );
1212 DeleteAnimations ( );
1313}
1414
1515void CIFPAnimations::DeleteAnimations ( void )
1616{
1717 CAnimManager * pAnimManager = g_pGame->GetAnimManager ( );
18- for ( size_t i = 0 ; i < vecAnimations.size (); i++ )
19- {
20- IFP_Animation * ifpAnimation = &vecAnimations[i];
21-
22- pAnimManager->RemoveFromUncompressedCache ( &ifpAnimation->Hierarchy );
23-
24- for (unsigned short SequenceIndex = 0 ; SequenceIndex < ifpAnimation->Hierarchy .usNumSequences ; SequenceIndex++)
18+ for ( auto it = vecAnimations.begin (); it != vecAnimations.end (); ++it )
19+ {
20+ auto pAnimationHierarchy = pAnimManager->GetCustomAnimBlendHierarchy ( &it->Hierarchy );
21+ for (unsigned short SequenceIndex = 0 ; SequenceIndex < pAnimationHierarchy->GetNumSequences ( ); SequenceIndex++)
2522 {
26- auto pSequence = (CAnimBlendSequenceSAInterface*)((BYTE*)ifpAnimation->Hierarchy .pSequences + (sizeof (CAnimBlendSequenceSAInterface) * SequenceIndex));
27-
28- if ( !( (pSequence->sFlags >> 3 ) & 1 ) ) // If ( !OneBigChunkForAllSequences )
23+ pAnimManager->RemoveFromUncompressedCache ( pAnimationHierarchy->GetInterface ( ) );
24+ auto pAnimationSequence = pAnimManager->GetCustomAnimBlendSequence ( pAnimationHierarchy->GetSequence ( SequenceIndex ) );
25+ void * pKeyFrames = pAnimationSequence->GetKeyFrames ( );
26+ if ( !pAnimationSequence->IsBigChunkForAllSequences ( ) )
2927 {
30- pAnimManager->FreeKeyFramesMemory ( pSequence-> pKeyFrames ); // *(void **)(pThis + 8)); //pSequence->m_pFrames );
28+ pAnimManager->FreeKeyFramesMemory ( pKeyFrames );
3129 }
3230 else
3331 {
3432 if ( SequenceIndex == 0 )
3533 {
3634 // All frames of all sequences are allocated on one memory block, so free that one
3735 // and break the loop
38- pAnimManager->FreeKeyFramesMemory ( pSequence-> pKeyFrames );
36+ pAnimManager->FreeKeyFramesMemory ( pKeyFrames );
3937 break ;
4038 }
4139 }
42-
4340 }
44- delete ifpAnimation ->pSequencesMemory ;
41+ delete it ->pSequencesMemory ;
4542 }
46-
4743 printf (" CIFPAnimations::DeleteAnimations: IFP Animations have been unloaded successfully!\n " );
48-
4944}
0 commit comments