Skip to content

Commit 7b2394c

Browse files
committed
Removed isIFPLoaded checks
1 parent 6243ca4 commit 7b2394c

File tree

6 files changed

+31
-78
lines changed

6 files changed

+31
-78
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4050,15 +4050,12 @@ bool CClientGame::AssocGroupCopyAnimationHandler ( CAnimBlendStaticAssociationSA
40504050
auto pReplacedAnimation = pClientPed->getReplacedAnimation ( pOriginalAnimStaticAssoc->pAnimHeirarchy );
40514051
if ( pReplacedAnimation != nullptr )
40524052
{
4053-
if ( pReplacedAnimation->pIFP->isIFPLoaded ( ) )
4054-
{
4055-
std::shared_ptr < CIFPAnimations > pIFPAnimations = pReplacedAnimation->pIFP->GetIFPAnimationsPointer ();
4056-
InsertAnimationAssociationToMap ( pAnimAssoc, pIFPAnimations );
4053+
std::shared_ptr < CIFPAnimations > pIFPAnimations = pReplacedAnimation->pIFP->GetIFPAnimationsPointer ();
4054+
InsertAnimationAssociationToMap ( pAnimAssoc, pIFPAnimations );
40574055

4058-
// Play our custom animation instead of default
4059-
CAnimBlendStaticAssociation_Init ( pOutAnimStaticAssoc, pClump, pReplacedAnimation->pAnimationHierarchy );
4060-
isCustomAnimationToPlay = true;
4061-
}
4056+
// Play our custom animation instead of default
4057+
CAnimBlendStaticAssociation_Init ( pOutAnimStaticAssoc, pClump, pReplacedAnimation->pAnimationHierarchy );
4058+
isCustomAnimationToPlay = true;
40624059
}
40634060
}
40644061

@@ -4100,18 +4097,15 @@ bool CClientGame::BlendAnimationHierarchyHandler ( CAnimBlendAssociationSAInterf
41004097
auto pCustomAnimBlendHierarchy = pIFP->GetAnimationHierarchy ( strAnimationName );
41014098
if ( pCustomAnimBlendHierarchy != nullptr )
41024099
{
4103-
if ( pIFP->isIFPLoaded ( ) )
4104-
{
4105-
std::shared_ptr < CIFPAnimations > pIFPAnimations = pIFP->GetIFPAnimationsPointer ();
4106-
InsertAnimationAssociationToMap ( pAnimAssoc, pIFPAnimations );
4100+
std::shared_ptr < CIFPAnimations > pIFPAnimations = pIFP->GetIFPAnimationsPointer ();
4101+
InsertAnimationAssociationToMap ( pAnimAssoc, pIFPAnimations );
41074102

4108-
pClientPed->setCurrentAnimationCustom ( true );
4109-
pClientPed->setNextAnimationNormal ( );
4103+
pClientPed->setCurrentAnimationCustom ( true );
4104+
pClientPed->setNextAnimationNormal ( );
41104105

4111-
*pOutAnimHierarchy = pCustomAnimBlendHierarchy;
4112-
isCustomAnimationToPlay = true;
4113-
return isCustomAnimationToPlay;
4114-
}
4106+
*pOutAnimHierarchy = pCustomAnimBlendHierarchy;
4107+
isCustomAnimationToPlay = true;
4108+
return isCustomAnimationToPlay;
41154109
}
41164110
else
41174111
{

Client/mods/deathmatch/logic/CClientIFP.cpp

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,49 +23,25 @@ CClientIFP::CClientIFP ( class CClientManager* pManager, ElementID ID ) : CClien
2323
// Init
2424
m_pManager = pManager;
2525
SetTypeName ( "IFP" );
26-
m_bisIFPLoaded = false;
27-
//m_pIFPAnimations = nullptr;
28-
m_pIFPAnimations = std::make_shared < CIFPAnimations > ();
26+
m_pIFPAnimations = std::make_shared < CIFPAnimations > ();
2927
}
3028

3129
CClientIFP::~CClientIFP ( void )
3230
{
33-
UnloadIFP ( );
3431
}
3532

3633
bool CClientIFP::LoadIFP ( const char* szFilePath, SString strBlockName )
3734
{
3835
printf ("\nCClientIFP::LoadIFP: szFilePath %s\n szBlockName: %s\n\n", szFilePath, strBlockName.c_str());
3936

4037
m_strBlockName = strBlockName;
41-
//m_pIFPAnimations ( new CIFPAnimations () );
4238
m_pVecAnimations = &m_pIFPAnimations->vecAnimations;
4339

4440
if ( LoadIFPFile ( szFilePath ) )
4541
{
46-
m_bisIFPLoaded = true;
47-
}
48-
return m_bisIFPLoaded;
49-
}
50-
51-
void CClientIFP::UnloadIFP ( void )
52-
{
53-
if ( m_bisIFPLoaded )
54-
{
55-
printf ("CClientIFP::UnloadIFP ( ) called!\n");
56-
57-
m_bisIFPLoaded = false;
58-
/*
59-
// When all animations from this IFP block stop playing, and
60-
// the reference count reaches zero, IFP animations will be unloaded
61-
m_pIFPAnimations->bUnloadOnZeroReferences = true;
62-
63-
// unload IFP animations, if reference count is zero
64-
if ( m_pIFPAnimations->iReferences == 0 )
65-
{
66-
g_pClientGame->DeleteIFPAnimations ( m_pIFPAnimations );
67-
}*/
42+
return true;
6843
}
44+
return false;
6945
}
7046

7147
bool CClientIFP::LoadIFPFile(const char * FilePath)
@@ -1113,20 +1089,14 @@ std::string CClientIFP::getCorrectBoneNameFromName(std::string const& BoneName)
11131089

11141090
CAnimBlendHierarchySAInterface * CClientIFP::GetAnimationHierarchy ( const SString & strAnimationName )
11151091
{
1116-
CAnimBlendHierarchySAInterface * pAnimHierarchyInterface = nullptr;
1117-
1118-
for (auto it = m_pVecAnimations->begin(); it != m_pVecAnimations->end(); ++it)
1092+
for ( auto it = m_pVecAnimations->begin(); it != m_pVecAnimations->end(); ++it )
11191093
{
11201094
if (strAnimationName.ToLower() == it->Name.ToLower())
11211095
{
1122-
if ( m_bisIFPLoaded )
1123-
{
1124-
pAnimHierarchyInterface = (CAnimBlendHierarchySAInterface *)&it->Hierarchy;
1125-
}
1126-
break;
1096+
return (CAnimBlendHierarchySAInterface *)&it->Hierarchy;
11271097
}
11281098
}
1129-
return pAnimHierarchyInterface;
1099+
return nullptr;
11301100
}
11311101

11321102
// ----------------------------------------------------------------------------------------------------------

Client/mods/deathmatch/logic/CClientIFP.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ class CClientIFP: public CClientEntity, FileLoader
1717
virtual eClientEntityType GetType ( void ) const { return CCLIENTIFP; }
1818

1919
const SString & GetBlockName ( void ) { return m_strBlockName; }
20-
bool isIFPLoaded ( void ) { return m_bisIFPLoaded; }
2120
bool LoadIFP ( const char* szFilePath, SString strBlockName );
22-
void UnloadIFP ( void );
2321

2422
bool LoadIFPFile(const char * FilePath);
2523
void ReadIFPVersion1();
@@ -50,12 +48,10 @@ class CClientIFP: public CClientEntity, FileLoader
5048

5149
private:
5250
std::shared_ptr < CIFPAnimations > m_pIFPAnimations;
53-
SString m_strBlockName;
54-
std::vector < IFP_Animation > * m_pVecAnimations;
55-
std::vector < unsigned char * > m_DummySequencesKeyFrames;
56-
bool isVersion1;
57-
IFPHeaderV2 HeaderV2;
58-
bool m_bisIFPLoaded;
51+
SString m_strBlockName;
52+
std::vector < IFP_Animation > * m_pVecAnimations;
53+
bool isVersion1;
54+
IFPHeaderV2 HeaderV2;
5955

6056
};
6157

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6191,18 +6191,13 @@ CAnimBlendAssociation * CClientPed::GetFirstAnimation ( void )
61916191
return NULL;
61926192
}
61936193

6194-
bool CClientPed::ReplaceAnimation ( CAnimBlendHierarchy * pInternalAnimHierarchy, const std::shared_ptr < CClientIFP > & pIFP, CAnimBlendHierarchySAInterface * pCustomAnimHierarchy )
6194+
void CClientPed::ReplaceAnimation ( CAnimBlendHierarchy * pInternalAnimHierarchy, const std::shared_ptr < CClientIFP > & pIFP, CAnimBlendHierarchySAInterface * pCustomAnimHierarchy )
61956195
{
6196-
if ( pIFP->isIFPLoaded ( ) )
6197-
{
6198-
SReplacedAnimation replacedAnimation;
6199-
replacedAnimation.pIFP = pIFP;
6200-
replacedAnimation.pAnimationHierarchy = pCustomAnimHierarchy;
6196+
SReplacedAnimation replacedAnimation;
6197+
replacedAnimation.pIFP = pIFP;
6198+
replacedAnimation.pAnimationHierarchy = pCustomAnimHierarchy;
62016199

6202-
m_mapOfReplacedAnimations [ pInternalAnimHierarchy->GetInterface () ] = replacedAnimation;
6203-
return true;
6204-
}
6205-
return false;
6200+
m_mapOfReplacedAnimations [ pInternalAnimHierarchy->GetInterface () ] = replacedAnimation;
62066201
}
62076202

62086203
void CClientPed::RestoreAnimation ( CAnimBlendHierarchy * pInternalAnimHierarchy )

Client/mods/deathmatch/logic/CClientPed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
478478
inline const SString & GetNextAnimationCustomBlockName ( void ) { return m_strCustomIFPBlockName; }
479479
inline const SString & GetNextAnimationCustomName ( void ) { return m_strCustomIFPAnimationName; }
480480

481-
bool ReplaceAnimation ( CAnimBlendHierarchy * pInternalAnimHierarchy, const std::shared_ptr < CClientIFP > & pIFP, CAnimBlendHierarchySAInterface * pCustomAnimHierarchy );
481+
void ReplaceAnimation ( CAnimBlendHierarchy * pInternalAnimHierarchy, const std::shared_ptr < CClientIFP > & pIFP, CAnimBlendHierarchySAInterface * pCustomAnimHierarchy );
482482
void RestoreAnimation ( CAnimBlendHierarchy * pInternalAnimHierarchy );
483483
void RestoreAnimations ( const std::shared_ptr < CClientIFP > & IFP );
484484
void RestoreAnimations ( CAnimBlock & animationBlock );

Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,9 @@ int CLuaEngineDefs::EngineReplaceAnimation ( lua_State* luaVM )
538538
CAnimBlendHierarchySAInterface * pCustomAnimHierarchyInterface = pCustomIFP->GetAnimationHierarchy ( strCustomAnimName );
539539
if ( pInternalAnimHierarchy && pCustomAnimHierarchyInterface )
540540
{
541-
if ( Ped.ReplaceAnimation ( pInternalAnimHierarchy, pCustomIFP, pCustomAnimHierarchyInterface ) )
542-
{
543-
lua_pushboolean ( luaVM, true );
544-
return 1;
545-
}
541+
Ped.ReplaceAnimation ( pInternalAnimHierarchy, pCustomIFP, pCustomAnimHierarchyInterface );
542+
lua_pushboolean ( luaVM, true );
543+
return 1;
546544
}
547545
else
548546
argStream.SetCustomError ( "Incorrect Animation name" );

0 commit comments

Comments
 (0)