Skip to content

Commit 2600653

Browse files
committed
Removed code from AddAnimationHandler and AddAnimationAndSyncHandler
The code worked perfectly except for custom CopyAnimation function, if we tried to rewrite this function, it would crash.
1 parent af38b5f commit 2600653

File tree

1 file changed

+5
-111
lines changed

1 file changed

+5
-111
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 5 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <net/SyncStructures.h>
2727
#include <../Client/game_sa/CAnimBlendAssocGroupSA.h>
2828
#include <../Client/game_sa/CAnimBlendAssociationSA.h>
29+
#include <../game_sa/CAnimBlendHierarchySA.h>
2930

3031
SString StringZeroPadout ( const SString& strInput, uint uiPadoutSize )
3132
{
@@ -3990,126 +3991,19 @@ bool CClientGame::ChokingHandler ( unsigned char ucWeaponType )
39903991
return m_pLocalPlayer->CallEvent ( "onClientPlayerChoke", Arguments, true );
39913992
}
39923993

3993-
#include <../game_sa/CAnimBlendHierarchySA.h> // ---------------- REMOVE THIS LATER
3994+
3995+
39943996

39953997
CAnimBlendAssociationSAInterface * CClientGame::AddAnimationHandler ( RpClump * pClump, AssocGroupId animGroup, AnimationId animID )
39963998
{
39973999
printf ( "AddAnimationHandler called! pClump, GroupID, AnimID: %p, %d, %d\n", (void*)pClump, animGroup, animID );
3998-
3999-
hCAnimBlendAssocGroup_CopyAnimation CAnimBlendAssocGroup_CopyAnimation = (hCAnimBlendAssocGroup_CopyAnimation)0x004CE130;
4000-
hUncompressAnimation UncompressAnimation = (hUncompressAnimation)0x4d41c0;
4001-
hCAnimBlendAssoc_Constructor_staticAssocRef OLD_CAnimBlendAssoc_Constructor_staticAssocRef = (hCAnimBlendAssoc_Constructor_staticAssocRef)0x4CF080;
4002-
hCAnimBlendStaticAssoc_Constructor OLD_CAnimBlendStaticAssoc_Constructor = *(hCAnimBlendStaticAssoc_Constructor)0x4CE940;
4003-
hCAnimBlendStaticAssoc_Init OLD_CAnimBlendStaticAssoc_Init = (hCAnimBlendStaticAssoc_Init)0x004CEC20;
4004-
hCAnimBlendAssoc_SyncAnimation CAnimBlendAssoc_SyncAnimation = (hCAnimBlendAssoc_SyncAnimation)0x004CEB40;
4005-
hCAnimBlendAssoc_Start CAnimBlendAssoc_Start = (hCAnimBlendAssoc_Start)0x004CEB70;
4006-
4007-
CAnimBlendAssoc * pAnimAssoc; // esi
4008-
int *clumpData; // edi
4009-
int *next; // eax
4010-
DWORD *tempAssoc; // eax
4011-
int *nextAssoc; // ecx
4012-
4013-
CAnimManager * pAnimationManager = g_pGame->GetAnimManager();
4014-
CAnimBlendStaticAssoc * pAnimOriginalStaticAssoc = (CAnimBlendStaticAssoc *)pAnimationManager->GetAnimStaticAssociation ( animGroup, animID );
4015-
4016-
UncompressAnimation ( pAnimOriginalStaticAssoc->m_pAnimBlendHier );
4017-
pAnimAssoc = (CAnimBlendAssoc *)malloc(sizeof(CAnimBlendAssoc));
4018-
OLD_CAnimBlendAssoc_Constructor_staticAssocRef ( pAnimAssoc, *pAnimOriginalStaticAssoc);
4019-
4020-
// We need to remove this line and add some code here for running animations simultaneously
4021-
pAnimAssoc = CAnimBlendAssocGroup_CopyAnimation((DWORD *) (*(DWORD*)0x00B4EA34) + 5 * animGroup, animID);
4022-
4023-
////ofs << "Done calling CAnimBlendAssocGroup_CopyAnimation " << std::endl;
4024-
4025-
clumpData = *(int **)( (*(DWORD*)0xB5F878) + ((int)pClump));
4026-
4027-
if ( !((*((BYTE *)pAnimAssoc + 46) >> 5) & 1) )
4028-
goto LABEL_5;
4029-
next = (int *)*clumpData;
4030-
if ( !*clumpData )
4031-
goto LABEL_5;
4032-
while ( !((*((BYTE *)next + 42) >> 5) & 1) )
4033-
{
4034-
next = (int *)*next;
4035-
if ( !next )
4036-
goto LABEL_5;
4037-
}
4038-
if ( next )
4039-
{
4040-
CAnimBlendAssoc_SyncAnimation(pAnimAssoc, (CAnimBlendAssoc *)(next - 1));
4041-
*((BYTE *)pAnimAssoc + 46) |= 1u;
4042-
}
4043-
else
4044-
{
4045-
LABEL_5:
4046-
CAnimBlendAssoc_Start(pAnimAssoc, 0);
4047-
}
4048-
4049-
tempAssoc = ((DWORD*)pAnimAssoc) + 1;
4050-
4051-
if ( *clumpData ) // clumpData->nextAssoc
4052-
*(DWORD *)(*clumpData + 4) = (DWORD)tempAssoc;
4053-
4054-
nextAssoc = (int *)*clumpData;
4055-
4056-
DWORD * dwpAnimAssoc = (DWORD*) pAnimAssoc;
4057-
4058-
dwpAnimAssoc[2] = (DWORD)clumpData;
4059-
//pAnimAssoc[2] = clumpData;
4060-
4061-
*tempAssoc = (DWORD)nextAssoc;
4062-
4063-
*clumpData = (int)tempAssoc;
4064-
4065-
return (CAnimBlendAssociationSAInterface *)pAnimAssoc;
4000+
return nullptr;
40664001
}
40674002

40684003
CAnimBlendAssociationSAInterface * CClientGame::AddAnimationAndSyncHandler ( RpClump * pClump, CAnimBlendAssociationSAInterface * pAnimAssocToSyncWith, AssocGroupId animGroup, AnimationId animID )
40694004
{
40704005
printf ( "AddAnimationAndSyncHandler called! pClump, GroupID, AnimID: %p, %d, %d\n", (void*)pClump, animGroup, animID );
4071-
4072-
hCAnimBlendAssocGroup_CopyAnimation CAnimBlendAssocGroup_CopyAnimation = (hCAnimBlendAssocGroup_CopyAnimation)0x004CE130;
4073-
hUncompressAnimation UncompressAnimation = (hUncompressAnimation)0x4d41c0;
4074-
hCAnimBlendAssoc_Constructor_staticAssocRef OLD_CAnimBlendAssoc_Constructor_staticAssocRef = (hCAnimBlendAssoc_Constructor_staticAssocRef)0x4CF080;
4075-
hCAnimBlendStaticAssoc_Constructor OLD_CAnimBlendStaticAssoc_Constructor = *(hCAnimBlendStaticAssoc_Constructor)0x4CE940;
4076-
hCAnimBlendStaticAssoc_Init OLD_CAnimBlendStaticAssoc_Init = (hCAnimBlendStaticAssoc_Init)0x004CEC20;
4077-
hCAnimBlendAssoc_SyncAnimation CAnimBlendAssoc_SyncAnimation = (hCAnimBlendAssoc_SyncAnimation)0x004CEB40;
4078-
hCAnimBlendAssoc_Start CAnimBlendAssoc_Start = (hCAnimBlendAssoc_Start)0x004CEB70;
4079-
4080-
CAnimBlendAssoc * pAnimAssocToSyncWith2 = (CAnimBlendAssoc *)pAnimAssocToSyncWith;
4081-
CAnimBlendAssoc *pAnimAssoc; // esi
4082-
int *pClumpData; // edi
4083-
DWORD *tempAssoc; // eax
4084-
int nextAssoc; // ecx
4085-
4086-
pAnimAssoc = CAnimBlendAssocGroup_CopyAnimation((DWORD *) (*(DWORD*)0x00B4EA34) + 5 * animGroup, animID);
4087-
pClumpData = *(int **)( (*(DWORD*)0xB5F878) + (int)pClump);
4088-
if ( (*((BYTE *)pAnimAssoc + 46) >> 5) & 1 && pAnimAssocToSyncWith2 )
4089-
{
4090-
CAnimBlendAssoc_SyncAnimation ( pAnimAssoc, pAnimAssocToSyncWith2);
4091-
*((BYTE *)pAnimAssoc + 46) |= 1u;
4092-
}
4093-
else
4094-
{
4095-
CAnimBlendAssoc_Start ( pAnimAssoc, 0);
4096-
}
4097-
4098-
tempAssoc = ((DWORD*)pAnimAssoc) + 1;
4099-
4100-
if ( *pClumpData )
4101-
*(DWORD *)(*pClumpData + 4) = (DWORD)tempAssoc;
4102-
4103-
nextAssoc = *pClumpData;
4104-
4105-
DWORD * dwpAnimAssoc = (DWORD*) pAnimAssoc;
4106-
4107-
dwpAnimAssoc[2] = (DWORD)pClumpData;
4108-
4109-
*tempAssoc = nextAssoc;
4110-
4111-
*pClumpData = (int)tempAssoc;
4112-
return (CAnimBlendAssociationSAInterface *)pAnimAssoc;
4006+
return nullptr;
41134007
}
41144008

41154009
CAnimBlendHierarchySAInterface * CClientGame::BlendAnimationHierarchyHandler ( RpClump * pClump, CAnimBlendHierarchySAInterface * pAnimHierarchy, int flags, float fBlendDelta )

0 commit comments

Comments
 (0)