Skip to content

Commit d153d3b

Browse files
committed
Fixes in ModelRequestCallBack and CClientPed constructor and destructor.
Removed code for inserting and remove clump from map in ModelRequestCallBack. Also, CClientPed is inserted into map in constructor call and removed when destructor is called.
1 parent c529467 commit d153d3b

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ void CClientPed::Init ( CClientManager* pManager, unsigned long ulModelID, bool
100100
m_pRequester = pManager->GetModelRequestManager ();
101101

102102
m_bisNextAnimationCustom = false;
103+
m_bisCurrentAnimationCustom = false;
104+
m_strCustomIFPBlockName = "Default";
105+
m_strCustomIFPAnimationName = "Default";
103106
m_iVehicleInOutState = VEHICLE_INOUT_NONE;
104107
m_pPlayerPed = NULL;
105108
m_pTaskManager = NULL;
@@ -243,11 +246,15 @@ void CClientPed::Init ( CClientManager* pManager, unsigned long ulModelID, bool
243246

244247
SetArmor ( 0.0f );
245248
}
249+
250+
g_pClientGame->InsertPedPointerToMap ( this );
246251
}
247252

248253

249254
CClientPed::~CClientPed ( void )
250-
{
255+
{
256+
g_pClientGame->RemovePedPointerFromMap ( this );
257+
251258
// Remove from the ped manager
252259
m_pManager->GetPedManager ()->RemoveFromList ( this );
253260

@@ -1032,6 +1039,11 @@ bool CClientPed::SetModel ( unsigned long ulModel, bool bTemp )
10321039
// Different model from what we have now?
10331040
if ( m_ulModel != ulModel )
10341041
{
1042+
if ( m_bisCurrentAnimationCustom )
1043+
{
1044+
m_bisNextAnimationCustom = true;
1045+
}
1046+
10351047
if ( bTemp )
10361048
m_ulStoredModel = m_ulModel;
10371049

@@ -2862,6 +2874,12 @@ void CClientPed::StreamedInPulse ( bool bDoStandardPulses )
28622874
// Is it loaded now?
28632875
if ( m_pAnimationBlock->IsLoaded () )
28642876
{
2877+
printf("\nstreamed in pulse for ped\n\n");
2878+
if ( m_bisCurrentAnimationCustom )
2879+
{
2880+
m_bisNextAnimationCustom = true;
2881+
}
2882+
28652883
m_bRequestedAnimation = false;
28662884

28672885
// Copy our name incase it gets deleted
@@ -3722,6 +3740,11 @@ void CClientPed::_CreateModel ( void )
37223740
// Are we still playing a looped animation?
37233741
if ( m_bLoopAnimation && m_pAnimationBlock )
37243742
{
3743+
printf("\n create model for ped\n\n");
3744+
if ( m_bisCurrentAnimationCustom )
3745+
{
3746+
m_bisNextAnimationCustom = true;
3747+
}
37253748
// Copy our anim name incase it gets deleted
37263749
SString strAnimName = m_strAnimationName;
37273750
// Run our animation
@@ -4019,6 +4042,12 @@ void CClientPed::_ChangeModel ( void )
40194042
// Are we still playing a looped animation?
40204043
if ( m_bLoopAnimation && m_pAnimationBlock )
40214044
{
4045+
printf("\nchange model for ped\n\n");
4046+
if ( m_bisCurrentAnimationCustom )
4047+
{
4048+
m_bisNextAnimationCustom = true;
4049+
}
4050+
40224051
// Copy our anim name incase it gets deleted
40234052
SString strAnimName = m_strAnimationName;
40244053
// Run our animation
@@ -4074,13 +4103,7 @@ void CClientPed::ReCreateModel ( void )
40744103

40754104

40764105
void CClientPed::ModelRequestCallback ( CModelInfo* pModelInfo )
4077-
{
4078-
RpClump * pOldClump = m_pPlayerPed->GetRpClump();
4079-
4080-
printf ("CClientPed::ModelRequestCallback Called! pOldClump: %p\n", pOldClump);
4081-
4082-
g_pGame->GetAnimManager()->RemovePedPointerFromMap ( pOldClump );
4083-
4106+
{
40844107
// If we have a player loaded
40854108
if ( m_pPlayerPed )
40864109
{
@@ -4092,11 +4115,6 @@ void CClientPed::ModelRequestCallback ( CModelInfo* pModelInfo )
40924115
// If we don't have a player loaded, load it
40934116
_CreateModel ();
40944117
}
4095-
4096-
RpClump * pNewClump = m_pPlayerPed->GetRpClump();
4097-
g_pGame->GetAnimManager()->InsertPedPointerToMap ( pNewClump, this );
4098-
4099-
printf ("CClientPed::ModelRequestCallback: Model changed/created | pNewClump: %p\n", m_pPlayerPed->GetRpClump());
41004118
}
41014119

41024120

@@ -5262,6 +5280,7 @@ void CClientPed::Respawn ( CVector * pvecPosition, bool bRestoreState, bool bCam
52625280
// We must not call CPed::Respawn for remote players
52635281
if ( m_bIsLocalPlayer )
52645282
{
5283+
setNextAnimationNormal ( );
52655284
SetFrozenWaitingForGroundToLoad ( true );
52665285
if ( m_pPlayerPed )
52675286
{
@@ -5869,6 +5888,7 @@ void CClientPed::KillAnimation ( void )
58695888
m_pAnimationBlock = NULL;
58705889
m_strAnimationName = "";
58715890
m_bRequestedAnimation = false;
5891+
setNextAnimationNormal ( );
58725892
}
58735893

58745894
void CClientPed::PostWeaponFire ( void )

Client/mods/deathmatch/logic/CClientPed.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
456456

457457
bool isNextAnimationCustom ( ) { return m_bisNextAnimationCustom; }
458458
void setNextAnimationCustom ( const SString & strBlockName, const SString & strAnimationName ) { m_bisNextAnimationCustom = true; m_strCustomIFPBlockName = strBlockName; m_strCustomIFPAnimationName = strAnimationName; }
459-
459+
void setCurrentAnimationCustom ( bool bCustom ) { m_bisCurrentAnimationCustom = bCustom; }
460+
460461
// This will indicate that we have played custom animation, so next animation can be internal GTA animation
461462
// You must call this function after playing a custom animation
462463
void setNextAnimationNormal ( void ) { m_bisNextAnimationCustom = false; }
@@ -660,6 +661,7 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
660661
// This is checked within AddAnimation and AddAnimationAndSync
661662
// It is set to false when custom animation is played.
662663
bool m_bisNextAnimationCustom;
664+
bool m_bisCurrentAnimationCustom;
663665
SString m_strCustomIFPBlockName;
664666
SString m_strCustomIFPAnimationName;
665667
};

0 commit comments

Comments
 (0)