Skip to content

Commit 7705414

Browse files
committed
added 3 new functions for finding the correct CClientPed * in a map of Ped clumps.
1 parent ff8e9b9 commit 7705414

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

Client/game_sa/CAnimManagerSA.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,3 +760,26 @@ CAnimBlendHierarchy * CAnimManagerSA::GetAnimBlendHierarchy ( CAnimBlendHierarch
760760
}
761761
return NULL;
762762
}
763+
764+
void CAnimManagerSA::InsertPedClumpToMap ( RpClump * pClump, CClientPed * pClientPed )
765+
{
766+
if ( m_mapOfPedClumps.count ( pClump ) == 0 )
767+
{
768+
m_mapOfPedClumps [ pClump ] = pClientPed;
769+
}
770+
}
771+
772+
void CAnimManagerSA::RemovePedClumpFromMap ( RpClump * pClump )
773+
{
774+
m_mapOfPedClumps.erase ( pClump );
775+
}
776+
777+
CClientPed * CAnimManagerSA::GetClientPedFromClumpMap ( RpClump * pClump )
778+
{
779+
ClumpMap_type::iterator it = m_mapOfPedClumps.find ( pClump );
780+
if ( it != m_mapOfPedClumps.end ( ) )
781+
{
782+
return it->second;
783+
}
784+
return nullptr;
785+
}

Client/game_sa/CAnimManagerSA.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "Common.h"
2222
#include <list>
23+
#include <map>
2324

2425
#define FUNC_CAnimManager_Initialize 0x5bf6b0
2526
#define FUNC_CAnimManager_Shutdown 0x4d4130
@@ -78,6 +79,8 @@ class CAnimManagerSAInterface
7879

7980
class CAnimManagerSA : public CAnimManager
8081
{
82+
typedef std::map < RpClump *, CClientPed * > ClumpMap_type;
83+
8184
public:
8285
CAnimManagerSA ( void );
8386
~CAnimManagerSA ( void );
@@ -146,12 +149,20 @@ class CAnimManagerSA : public CAnimManager
146149
CAnimBlendAssocGroup * GetAnimBlendAssocGroup ( CAnimBlendAssocGroupSAInterface * pInterface );
147150
CAnimBlock * GetAnimBlock ( CAnimBlockSAInterface * pInterface );
148151
CAnimBlendHierarchy * GetAnimBlendHierarchy ( CAnimBlendHierarchySAInterface * pInterface );
152+
153+
// This is used in AddAnimationHandler and AddAnimationAndSyncHandler for playing
154+
// custom animations and to help in replacing and restoring animations
155+
void InsertPedClumpToMap ( RpClump * pClump, CClientPed * pClientPed );
156+
void RemovePedClumpFromMap ( RpClump * pClump );
157+
CClientPed * GetClientPedFromClumpMap ( RpClump * pClump );
149158

150159
private:
151160
CAnimBlendAssocGroup * m_pAnimAssocGroups [ MAX_ANIM_GROUPS ];
152161
CAnimBlendHierarchy * m_pAnimations [ MAX_ANIMATIONS ];
153162
CAnimBlock * m_pAnimBlocks [ MAX_ANIM_BLOCKS ];
154-
std::list < CAnimBlendAssociation * > m_Associations;
163+
std::list < CAnimBlendAssociation * > m_Associations;
164+
ClumpMap_type m_mapOfPedClumps;
165+
155166
};
156167

157168
#endif

Client/sdk/game/CAnimManager.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class CAnimBlendAssocGroup;
2424
class CAnimBlendHierarchy;
2525
class CAnimBlock;
2626
class CAnimBlendAssociation;
27+
class CClientPed;
2728
struct RpClump;
2829
struct RwStream;
2930
struct AnimAssocDefinition;
@@ -102,6 +103,10 @@ class CAnimManager
102103
virtual CAnimBlendAssocGroup * GetAnimBlendAssocGroup ( CAnimBlendAssocGroupSAInterface * pInterface ) = 0;
103104
virtual CAnimBlock * GetAnimBlock ( CAnimBlockSAInterface * pInterface ) = 0;
104105
virtual CAnimBlendHierarchy * GetAnimBlendHierarchy ( CAnimBlendHierarchySAInterface * pInterface ) = 0;
106+
107+
virtual void InsertPedClumpToMap ( RpClump * pClump, CClientPed * pEntity ) = 0;
108+
virtual void RemovePedClumpFromMap ( RpClump * pClump ) = 0;
109+
virtual CClientPed * GetClientPedFromClumpMap ( RpClump * pClump ) = 0;
105110
};
106111

107112
#endif

0 commit comments

Comments
 (0)