@@ -37,6 +37,8 @@ bool CClientIFP::LoadIFP ( const char* szFilePath, SString strBlockName )
37
37
// Temporary method to avoid memory leaks, we'll need to rewrite the entire thing ;)
38
38
void CClientIFP::UnloadIFP ( void )
39
39
{
40
+ printf (" CClientIFP::UnloadIFP ( ) called, but IFP is not unloaded, PLEASE FIX THIS LATER!\n " );
41
+ /*
40
42
printf ("CClientIFP::UnloadIFP ( ) called!\n");
41
43
42
44
for ( size_t i = 0; i < m_Animations.size(); i++ )
@@ -62,10 +64,10 @@ void CClientIFP::UnloadIFP ( void )
62
64
{
63
65
unsigned char * pKeyFrames = m_DummySequencesKeyFrames [ DummySequenceIndex ];
64
66
free ( pKeyFrames );
65
- }
67
+ }*/
66
68
67
69
g_pClientGame->RemoveIFPPointerFromMap ( m_strBlockName );
68
- printf (" IFP unloaded sucessfully, removed from map as well.\n " );
70
+ // printf ("IFP unloaded sucessfully, removed from map as well.\n");
69
71
}
70
72
71
73
bool CClientIFP::LoadIFPFile (const char * FilePath)
@@ -91,7 +93,6 @@ bool CClientIFP::LoadIFPFile(const char * FilePath)
91
93
else
92
94
{
93
95
isVersion1 = true ;
94
-
95
96
ReadIFPVersion1 ( );
96
97
}
97
98
@@ -128,6 +129,7 @@ void CClientIFP::ReadIFPVersion2( bool anp3)
128
129
Animation AnimationNode;
129
130
130
131
readCString ((char *)&AnimationNode.Name , sizeof (Animation::Name));
132
+ ifpAnimation.Name = AnimationNode.Name ;
131
133
readBuffer < int32_t >(&AnimationNode.TotalObjects );
132
134
133
135
// ofs << "Animation Name: " << AnimationNode.Name << " | Index: " << i << std::endl;
@@ -142,7 +144,7 @@ void CClientIFP::ReadIFPVersion2( bool anp3)
142
144
143
145
pAnimHierarchy->m_bRunningCompressed = AnimationNode.isCompressed & 1 ;
144
146
145
- pKeyFrames = (unsigned char *)malloc (AnimationNode.FrameSize );
147
+ pKeyFrames = (unsigned char *) OLD_CMemoryMgr_Malloc (AnimationNode. FrameSize ); // malloc(AnimationNode.FrameSize);
146
148
147
149
ifpAnimation.pFramesMemoryVersion2 = pKeyFrames;
148
150
}
@@ -353,6 +355,7 @@ void CClientIFP::ReadIFPVersion1 ( )
353
355
354
356
char AnimationName [ 24 ];
355
357
readCString (AnimationName, Name.Base .Size );
358
+ ifpAnimation.Name = AnimationName;
356
359
357
360
// ofs << "Animation Name: " << AnimationName << " | Index: " << i << std::endl;
358
361
printf (" Animation Name: %s | Index: %d \n " , AnimationName, i);
@@ -467,7 +470,7 @@ void CClientIFP::ReadIFPVersion1 ( )
467
470
468
471
IFP_FrameType FrameType = getFrameTypeFromFourCC ( Kfrm.Base .FourCC );
469
472
size_t CompressedFrameSize = GetSizeOfCompressedFrame ( FrameType );
470
- BYTE * pKeyFrames = ( BYTE * ) malloc ( CompressedFrameSize * Anim.Frames );
473
+ BYTE * pKeyFrames = ( BYTE * ) OLD_CMemoryMgr_Malloc ( CompressedFrameSize * Anim. Frames ); // malloc ( CompressedFrameSize * Anim.Frames );
471
474
472
475
bool bIsRoot = FrameType != IFP_FrameType::KR00;
473
476
if (bUnknownSequence)
@@ -682,9 +685,8 @@ void CClientIFP::insertAnimDummySequence ( bool anp3, _CAnimBlendHierarchy * pAn
682
685
const size_t FramesDataSizeInBytes = FrameSize * TotalFrames;
683
686
unsigned char * pKeyFrames = nullptr ;
684
687
685
-
686
-
687
- pKeyFrames = (unsigned char *)malloc (FramesDataSizeInBytes);
688
+ pKeyFrames = (unsigned char *)OLD_CMemoryMgr_Malloc (FramesDataSizeInBytes);
689
+ // pKeyFrames = (unsigned char*)malloc(FramesDataSizeInBytes);
688
690
689
691
if ( !isVersion1 )
690
692
{
@@ -1170,6 +1172,18 @@ std::string CClientIFP::getCorrectBoneNameFromName(std::string const& BoneName)
1170
1172
return BoneName;
1171
1173
}
1172
1174
1175
+ CAnimBlendHierarchySAInterface * CClientIFP::GetAnimationHierarchy ( const SString & strAnimationName )
1176
+ {
1177
+ for (auto it = m_Animations.begin (); it != m_Animations.end (); ++it)
1178
+ {
1179
+ if (strAnimationName.ToLower () == it->Name .ToLower ())
1180
+ {
1181
+ return (CAnimBlendHierarchySAInterface *)&it->Hierarchy ;
1182
+ }
1183
+ }
1184
+ return nullptr ;
1185
+ }
1186
+
1173
1187
// ----------------------------------------------------------------------------------------------------------
1174
1188
// -------------------------------------- For Hierarchy ----------------------------------------------------
1175
1189
// ----------------------------------------------------------------------------------------------------------
0 commit comments