Skip to content

Commit 4735bab

Browse files
committed
Fix crash introduced in fcc1ed4
1 parent 0e523be commit 4735bab

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ void CClientPed::Kill ( eWeaponType weaponType, unsigned char ucBodypart, bool b
18721872

18731873
// Remove goggles #9477
18741874
if ( IsWearingGoggles ( ) )
1875-
m_pPlayerPed->SetGogglesState ( false );
1875+
SetWearingGoggles ( false, false );
18761876

18771877
m_bDead = true;
18781878
}
@@ -4304,7 +4304,7 @@ bool CClientPed::IsChoking ( void )
43044304
}
43054305

43064306

4307-
void CClientPed::SetWearingGoggles ( bool bWearing )
4307+
void CClientPed::SetWearingGoggles ( bool bWearing, bool animationEnabled )
43084308
{
43094309
if ( m_pPlayerPed )
43104310
{
@@ -4314,10 +4314,13 @@ void CClientPed::SetWearingGoggles ( bool bWearing )
43144314
m_pPlayerPed->SetGogglesState ( bWearing );
43154315

43164316
// Are our goggle anims loaded?
4317-
CAnimBlock * pBlock = g_pGame->GetAnimManager ()->GetAnimationBlock ( "GOGGLES" );
4318-
if ( pBlock->IsLoaded () )
4317+
if (animationEnabled)
43194318
{
4320-
BlendAnimation ( ANIM_GROUP_GOGGLES, ANIM_ID_GOGGLES_ON, 4.0f );
4319+
CAnimBlock* pBlock = g_pGame->GetAnimManager()->GetAnimationBlock("GOGGLES");
4320+
if (pBlock->IsLoaded())
4321+
{
4322+
BlendAnimation(ANIM_GROUP_GOGGLES, ANIM_ID_GOGGLES_ON, 4.0f);
4323+
}
43214324
}
43224325
}
43234326
}

Client/mods/deathmatch/logic/CClientPed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
301301
void SetChoking ( bool bChoking );
302302
bool IsChoking ( void );
303303

304-
void SetWearingGoggles ( bool bWearing );
304+
void SetWearingGoggles ( bool bWearing, bool animationEnabled = true );
305305
bool IsWearingGoggles ( bool bCheckMoving = false );
306306
bool IsMovingGoggles ( bool & bPuttingOn );
307307

0 commit comments

Comments
 (0)