File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed
Client/mods/deathmatch/logic/IFP Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < StdInc.h>
2+
3+ CIFPAnimations::CIFPAnimations ( void )
4+ {
5+
6+ }
7+
8+ CIFPAnimations::~CIFPAnimations ( void )
9+ {
10+ printf (" ~CIFPAnimations(): CIFPAnimations destoryed\n " );
11+ DeleteAnimations ( );
12+ }
13+
14+ void CIFPAnimations::DeleteAnimations ( void )
15+ {
16+ hCMemoryMgr_Free OLD_CMemoryMgr_Free = (hCMemoryMgr_Free)0x0072F430 ;
17+ auto OLD_CAnimBlendHierarchy_RemoveFromUncompressedCache = (hCAnimBlendHierarchy_RemoveFromUncompressedCache)0x004D42A0 ;
18+
19+ for ( size_t i = 0 ; i < vecAnimations.size (); i++ )
20+ {
21+ IFP_Animation * ifpAnimation = &vecAnimations[i];
22+
23+ OLD_CAnimBlendHierarchy_RemoveFromUncompressedCache ( (int )&ifpAnimation->Hierarchy );
24+
25+ for (unsigned short SequenceIndex = 0 ; SequenceIndex < ifpAnimation->Hierarchy .m_nSeqCount ; SequenceIndex++)
26+ {
27+ _CAnimBlendSequence * pSequence = (_CAnimBlendSequence*)((BYTE*)ifpAnimation->Hierarchy .m_pSequences + (sizeof (_CAnimBlendSequence) * SequenceIndex));
28+
29+ if ( !( (pSequence->m_nFlags >> 3 ) & 1 ) ) // If ( !OneBigChunkForAllSequences )
30+ {
31+ OLD_CMemoryMgr_Free ( pSequence->m_pFrames ); // *(void **)(pThis + 8)); //pSequence->m_pFrames );
32+ }
33+ else
34+ {
35+ if ( SequenceIndex == 0 )
36+ {
37+ // All frames of all sequences are allocated on one memory block, so free that one
38+ // and break the loop
39+ OLD_CMemoryMgr_Free ( pSequence->m_pFrames );
40+ break ;
41+ }
42+ }
43+
44+ }
45+ delete ifpAnimation->pSequencesMemory ;
46+ }
47+
48+ printf (" CIFPAnimations::DeleteAnimations: IFP Animations have been unloaded successfully!\n " );
49+
50+ }
Original file line number Diff line number Diff line change 1+ #pragma
2+ #ifndef __CIFPANIMATIONS_H
3+ #define __CIFPANIMATIONS_H
4+ #include " ../mods/deathmatch/logic/IFP/IFPLoader.h"
5+
6+ class CIFPAnimations
7+ {
8+ public:
9+ // This is set to true when unloadIFP function is called, it means that animations
10+ // can be unloaded when iReferences reaches zero, if this boolean is set to true
11+ bool bUnloadOnZeroReferences;
12+ // incremented when a new CAnimBlendAssociationSAInteface is created and decremented
13+ // when destructor of that animation is called
14+ DWORD iReferences;
15+ std::vector < IFP_Animation > vecAnimations;
16+
17+ public:
18+ CIFPAnimations ( void );
19+ ~CIFPAnimations ( void );
20+
21+ void DeleteAnimations ( void );
22+
23+ };
24+ #endif
You can’t perform that action at this time.
0 commit comments