@@ -37,6 +37,8 @@ bool CClientIFP::LoadIFP ( const char* szFilePath, SString strBlockName )
3737// Temporary method to avoid memory leaks, we'll need to rewrite the entire thing ;)
3838void CClientIFP::UnloadIFP ( void )
3939{
40+ printf (" CClientIFP::UnloadIFP ( ) called, but IFP is not unloaded, PLEASE FIX THIS LATER!\n " );
41+ /*
4042 printf ("CClientIFP::UnloadIFP ( ) called!\n");
4143
4244 for ( size_t i = 0; i < m_Animations.size(); i++ )
@@ -62,10 +64,10 @@ void CClientIFP::UnloadIFP ( void )
6264 {
6365 unsigned char * pKeyFrames = m_DummySequencesKeyFrames [ DummySequenceIndex ];
6466 free ( pKeyFrames );
65- }
67+ }*/
6668
6769 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");
6971}
7072
7173bool CClientIFP::LoadIFPFile (const char * FilePath)
@@ -91,7 +93,6 @@ bool CClientIFP::LoadIFPFile(const char * FilePath)
9193 else
9294 {
9395 isVersion1 = true ;
94-
9596 ReadIFPVersion1 ( );
9697 }
9798
@@ -128,6 +129,7 @@ void CClientIFP::ReadIFPVersion2( bool anp3)
128129 Animation AnimationNode;
129130
130131 readCString ((char *)&AnimationNode.Name , sizeof (Animation::Name));
132+ ifpAnimation.Name = AnimationNode.Name ;
131133 readBuffer < int32_t >(&AnimationNode.TotalObjects );
132134
133135 // ofs << "Animation Name: " << AnimationNode.Name << " | Index: " << i << std::endl;
@@ -142,7 +144,7 @@ void CClientIFP::ReadIFPVersion2( bool anp3)
142144
143145 pAnimHierarchy->m_bRunningCompressed = AnimationNode.isCompressed & 1 ;
144146
145- pKeyFrames = (unsigned char *)malloc (AnimationNode.FrameSize );
147+ pKeyFrames = (unsigned char *) OLD_CMemoryMgr_Malloc (AnimationNode. FrameSize ); // malloc(AnimationNode.FrameSize);
146148
147149 ifpAnimation.pFramesMemoryVersion2 = pKeyFrames;
148150 }
@@ -353,6 +355,7 @@ void CClientIFP::ReadIFPVersion1 ( )
353355
354356 char AnimationName [ 24 ];
355357 readCString (AnimationName, Name.Base .Size );
358+ ifpAnimation.Name = AnimationName;
356359
357360 // ofs << "Animation Name: " << AnimationName << " | Index: " << i << std::endl;
358361 printf (" Animation Name: %s | Index: %d \n " , AnimationName, i);
@@ -467,7 +470,7 @@ void CClientIFP::ReadIFPVersion1 ( )
467470
468471 IFP_FrameType FrameType = getFrameTypeFromFourCC ( Kfrm.Base .FourCC );
469472 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 );
471474
472475 bool bIsRoot = FrameType != IFP_FrameType::KR00;
473476 if (bUnknownSequence)
@@ -682,9 +685,8 @@ void CClientIFP::insertAnimDummySequence ( bool anp3, _CAnimBlendHierarchy * pAn
682685 const size_t FramesDataSizeInBytes = FrameSize * TotalFrames;
683686 unsigned char * pKeyFrames = nullptr ;
684687
685-
686-
687- pKeyFrames = (unsigned char *)malloc (FramesDataSizeInBytes);
688+ pKeyFrames = (unsigned char *)OLD_CMemoryMgr_Malloc (FramesDataSizeInBytes);
689+ // pKeyFrames = (unsigned char*)malloc(FramesDataSizeInBytes);
688690
689691 if ( !isVersion1 )
690692 {
@@ -1170,6 +1172,18 @@ std::string CClientIFP::getCorrectBoneNameFromName(std::string const& BoneName)
11701172 return BoneName;
11711173}
11721174
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+
11731187// ----------------------------------------------------------------------------------------------------------
11741188// -------------------------------------- For Hierarchy ----------------------------------------------------
11751189// ----------------------------------------------------------------------------------------------------------
0 commit comments