Skip to content

Commit ee23cd9

Browse files
committed
Added animation hierarchy functions
1 parent 7a6146d commit ee23cd9

File tree

3 files changed

+117
-9
lines changed

3 files changed

+117
-9
lines changed

Client/game_sa/CAnimBlendHierarchySA.cpp

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,81 @@
1212

1313
#include "StdInc.h"
1414

15+
// Careful, GetIndex will not work for custom animations
1516
int CAnimBlendHierarchySAInterface::GetIndex ( void )
1617
{
1718
return ( ( ( DWORD ) this - ARRAY_CAnimManager_Animations ) / 24 );
1819
}
20+
21+
void CAnimBlendHierarchySA::Initialize ( void )
22+
{
23+
m_pInterface->pSequences = 0;
24+
m_pInterface->usNumSequences = 0;
25+
m_pInterface->bRunningCompressed = 0;
26+
m_pInterface->pad = 0;
27+
m_pInterface->iAnimBlockID = -1;
28+
m_pInterface->fTotalTime = 0;
29+
m_pInterface->pLinkPtr = 0;
30+
}
31+
32+
void CAnimBlendHierarchySA::SetName ( const char * szName )
33+
{
34+
DWORD dwThis = ( DWORD ) m_pInterface;
35+
DWORD dwFunc = FUNC_CAnimBlendHierarchy_SetName;
36+
_asm
37+
{
38+
push szName
39+
mov ecx, dwThis
40+
call dwFunc
41+
}
42+
}
43+
44+
void CAnimBlendHierarchySA::RemoveAnimSequences ( void )
45+
{
46+
DWORD dwThis = ( DWORD ) m_pInterface;
47+
DWORD dwFunc = FUNC_CAnimBlendHierarchy_RemoveAnimSequences;
48+
_asm
49+
{
50+
mov ecx, dwThis
51+
call dwFunc
52+
}
53+
}
54+
55+
void CAnimBlendHierarchySA::RemoveFromUncompressedCache ( void )
56+
{
57+
DWORD dwThis = ( DWORD ) m_pInterface;
58+
DWORD dwFunc = FUNC_CAnimBlendHierarchy_RemoveFromUncompressedCache;
59+
_asm
60+
{
61+
mov ecx, dwThis
62+
call dwFunc
63+
}
64+
}
65+
66+
void CAnimBlendHierarchySA::RemoveQuaternionFlips ( void )
67+
{
68+
DWORD dwThis = ( DWORD ) m_pInterface;
69+
DWORD dwFunc = FUNC_CAnimBlendHierarchy_RemoveQuaternionFlips;
70+
_asm
71+
{
72+
mov ecx, dwThis
73+
call dwFunc
74+
}
75+
}
76+
77+
void CAnimBlendHierarchySA::CalculateTotalTime ( void )
78+
{
79+
DWORD dwThis = ( DWORD ) m_pInterface;
80+
DWORD dwFunc = FUNC_CAnimBlendHierarchy_CalculateTotalTime;
81+
_asm
82+
{
83+
mov ecx, dwThis
84+
call dwFunc
85+
}
86+
}
87+
88+
CAnimBlendSequenceSAInterface * CAnimBlendHierarchySA::GetSequence ( DWORD dwIndex )
89+
{
90+
BYTE * pSequences = reinterpret_cast < BYTE * > ( m_pInterface->pSequences );
91+
return reinterpret_cast < CAnimBlendSequenceSAInterface * > ( pSequences + ( sizeof ( CAnimBlendSequenceSAInterface ) * dwIndex ) );
92+
}

Client/game_sa/CAnimBlendHierarchySA.h

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,24 @@
1818
#include <game/CAnimBlendHierarchy.h>
1919
#include "Common.h"
2020

21-
#define FUNC_CAnimBlendHierarchy_GetAnimSequence 0x4ce8f0
22-
#define FUNC_CAnimBlendHierarchy_GetAnimSequences 0x4d1350
21+
#define FUNC_CAnimBlendHierarchy_SetName 0x4CF2D0
22+
#define FUNC_CAnimBlendHierarchy_RemoveAnimSequences 0x4CF8E0
23+
#define FUNC_CAnimBlendHierarchy_RemoveFromUncompressedCache 0x4D42A0
24+
#define FUNC_CAnimBlendHierarchy_RemoveQuaternionFlips 0x4CF4E0
25+
#define FUNC_CAnimBlendHierarchy_CalculateTotalTime 0x4CF2F0
26+
#define FUNC_CAnimBlendHierarchy_GetAnimSequence 0x4ce8f0
27+
#define FUNC_CAnimBlendHierarchy_GetAnimSequences 0x4d1350
2328

2429
class CAnimBlendSequence;
2530

2631
class CAnimBlendHierarchySAInterface
2732
{
2833
public:
34+
// Careful, GetIndex will not work for custom animations
2935
int GetIndex ( void );
36+
3037
unsigned int iHashKey;
31-
DWORD * pSequences;
38+
CAnimBlendSequenceSAInterface * pSequences;
3239
unsigned short usNumSequences;
3340
bool bRunningCompressed;
3441
BYTE pad;
@@ -41,10 +48,23 @@ class CAnimBlendHierarchySAInterface
4148
class CAnimBlendHierarchySA : public CAnimBlendHierarchy
4249
{
4350
public:
44-
CAnimBlendHierarchySA ( CAnimBlendHierarchySAInterface * pInterface ) { m_pInterface = pInterface; }
45-
46-
CAnimBlendHierarchySAInterface * GetInterface ( void ) { return m_pInterface; }
47-
int GetAnimBlockID ( void ) { return m_pInterface->iAnimBlockID; }
51+
CAnimBlendHierarchySA ( CAnimBlendHierarchySAInterface * pInterface ) { m_pInterface = pInterface; }
52+
void Initialize ( void );
53+
void SetName ( const char * szName );
54+
void SetSequences ( CAnimBlendSequenceSAInterface * pSequences ) { m_pInterface->pSequences = pSequences; }
55+
void SetNumSequences ( unsigned short uNumSequences ) { m_pInterface->usNumSequences = uNumSequences; }
56+
void SetRunningCompressed ( bool bCompressed ) { m_pInterface->bRunningCompressed = bCompressed; }
57+
void SetAnimationBlockID ( int iBlockID ) { m_pInterface->iAnimBlockID = iBlockID; }
58+
void RemoveAnimSequences ( void );
59+
void RemoveFromUncompressedCache ( void );
60+
void RemoveQuaternionFlips ( void );
61+
void CalculateTotalTime ( void );
62+
CAnimBlendSequenceSAInterface * GetSequence ( DWORD dwIndex );
63+
CAnimBlendSequenceSAInterface * GetSequences ( void ) { return m_pInterface->pSequences; }
64+
unsigned short GetNumSequences ( void ) { return m_pInterface->usNumSequences; }
65+
bool isRunningCompressed ( void ) { return m_pInterface->bRunningCompressed; }
66+
int GetAnimBlockID ( void ) { return m_pInterface->iAnimBlockID; }
67+
CAnimBlendHierarchySAInterface * GetInterface ( void ) { return m_pInterface; }
4868

4969
protected:
5070
CAnimBlendHierarchySAInterface * m_pInterface;

Client/sdk/game/CAnimBlendHierarchy.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,22 @@ class CAnimBlendHierarchySAInterface;
1717
class CAnimBlendHierarchy
1818
{
1919
public:
20-
virtual CAnimBlendHierarchySAInterface * GetInterface ( void ) = 0;
21-
virtual int GetAnimBlockID ( void ) = 0;
20+
virtual void Initialize ( void ) = 0;
21+
virtual void SetName ( const char * szName ) = 0;
22+
virtual void SetSequences ( CAnimBlendSequenceSAInterface * pSequences ) = 0;
23+
virtual void SetNumSequences ( unsigned short uNumSequences ) = 0;
24+
virtual void SetRunningCompressed ( bool bCompressed ) = 0;
25+
virtual void SetAnimationBlockID ( int iBlockID ) = 0;
26+
virtual void RemoveAnimSequences ( void ) = 0;
27+
virtual void RemoveFromUncompressedCache ( void ) = 0;
28+
virtual void RemoveQuaternionFlips ( void ) = 0;
29+
virtual void CalculateTotalTime ( void ) = 0;
30+
virtual CAnimBlendSequenceSAInterface * GetSequence ( DWORD dwIndex ) = 0;
31+
virtual CAnimBlendSequenceSAInterface * GetSequences ( void ) = 0;
32+
virtual unsigned short GetNumSequences ( void ) = 0;
33+
virtual bool isRunningCompressed ( void ) = 0;
34+
virtual int GetAnimBlockID ( void ) = 0;
35+
virtual CAnimBlendHierarchySAInterface * GetInterface ( void ) = 0;
2236
};
2337

2438
#endif

0 commit comments

Comments
 (0)