Fix death animation loop.

This commit is contained in:
Andrey Akhmichin 2024-02-13 18:42:37 +05:00
parent 7bbc2cf4d7
commit c949e02e4e
2 changed files with 8 additions and 8 deletions

View File

@ -1296,7 +1296,7 @@ void CBasePlayer::PlayerDeathThink( void )
PackDeadPlayerItems(); PackDeadPlayerItems();
} }
if( pev->modelindex && ( !m_fSequenceFinished ) && ( pev->deadflag == DEAD_DYING ) ) if( pev->modelindex && ( !m_fSequenceFinished ) && ( pev->deadflag == DEAD_DYING ))
{ {
StudioFrameAdvance(); StudioFrameAdvance();
@ -1305,14 +1305,9 @@ void CBasePlayer::PlayerDeathThink( void )
return; return;
} }
// once we're done animating our death and we're on the ground, we want to set movetype to None so our dead body won't do collisions and stuff anymore
// this prevents a bug where the dead body would go to a player's head if he walked over it while the dead player was clicking their button to respawn
if( pev->movetype != MOVETYPE_NONE && FBitSet( pev->flags, FL_ONGROUND ) )
pev->movetype = MOVETYPE_NONE;
if( pev->deadflag == DEAD_DYING ) if( pev->deadflag == DEAD_DYING )
{ {
if( g_pGameRules->IsMultiplayer() && pev->movetype == MOVETYPE_NONE ) if( g_pGameRules->IsMultiplayer() && m_fSequenceFinished && pev->movetype == MOVETYPE_NONE )
{ {
CopyToBodyQue( pev ); CopyToBodyQue( pev );
pev->modelindex = 0; pev->modelindex = 0;
@ -1320,6 +1315,11 @@ void CBasePlayer::PlayerDeathThink( void )
pev->deadflag = DEAD_DEAD; pev->deadflag = DEAD_DEAD;
} }
// once we're done animating our death and we're on the ground, we want to set movetype to None so our dead body won't do collisions and stuff anymore
// this prevents a bug where the dead body would go to a player's head if he walked over it while the dead player was clicking their button to respawn
if( pev->movetype != MOVETYPE_NONE && FBitSet( pev->flags, FL_ONGROUND ) )
pev->movetype = MOVETYPE_NONE;
StopAnimation(); StopAnimation();
pev->effects |= EF_NOINTERP; pev->effects |= EF_NOINTERP;

View File

@ -226,7 +226,7 @@ static void InitBodyQue( void )
// //
void CopyToBodyQue( entvars_t *pev ) void CopyToBodyQue( entvars_t *pev )
{ {
if( pev->effects & EF_NODRAW ) if( ( pev->effects & EF_NODRAW ) || !pev->modelindex )
return; return;
entvars_t *pevHead = VARS( g_pBodyQueueHead ); entvars_t *pevHead = VARS( g_pBodyQueueHead );