diff --git a/dlls/player.cpp b/dlls/player.cpp index 036dc95..3ff712c 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -788,7 +788,7 @@ void CBasePlayer::Killed(entvars_t* pevAttacker, int iGib) SetAnimation(PLAYER_DIE); - m_iRespawnFrames = 0; + m_flRespawnTimer = 0.0f; pev->modelindex = g_ulModelIndexPlayer; // don't use eyes @@ -925,6 +925,8 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim) if (pev->sequence == animDesired) return; + //ALERT(at_console, "Set die animation to %d\n", animDesired); + pev->gaitsequence = 0; pev->sequence = animDesired; pev->frame = 0; @@ -1206,19 +1208,28 @@ void CBasePlayer::PlayerDeathThink() { StudioFrameAdvance(); - m_iRespawnFrames++; // Note, these aren't necessarily real "frames", so behavior is dependent on # of client movement commands - if (m_iRespawnFrames < 120) // Animations should be no longer than this + m_flRespawnTimer += gpGlobals->frametime; + if (m_flRespawnTimer < 4.0f) // 120 frames at 30 fps -- animations should be no longer than this return; } + if (pev->deadflag == DEAD_DYING) + { + // Once we finish animating, if we're in multiplayer just make a copy of our body right away. + if (m_fSequenceFinished && g_pGameRules->IsMultiplayer() && pev->movetype == MOVETYPE_NONE) + { + CopyToBodyQue(pev); + pev->modelindex = 0; + } + + 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; - if (pev->deadflag == DEAD_DYING) - pev->deadflag = DEAD_DEAD; - StopAnimation(); pev->effects |= EF_NOINTERP; @@ -1258,7 +1269,7 @@ void CBasePlayer::PlayerDeathThink() return; pev->button = 0; - m_iRespawnFrames = 0; + m_flRespawnTimer = 0.0f; //ALERT(at_console, "Respawn\n"); diff --git a/dlls/player.h b/dlls/player.h index 9cdd9ea..0485cea 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -196,7 +196,7 @@ public: Vector m_vecAutoAim; bool m_fOnTarget; int m_iDeaths; - float m_iRespawnFrames; // used in PlayerDeathThink() to make sure players can always respawn + float m_flRespawnTimer; // used in PlayerDeathThink() to make sure players can always respawn int m_lastx, m_lasty; // These are the previous update's crosshair angles, DON"T SAVE/RESTORE diff --git a/dlls/world.cpp b/dlls/world.cpp index 3a5dfd4..e13d29a 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -226,7 +226,7 @@ static void InitBodyQue() // void CopyToBodyQue(entvars_t* pev) { - if ((pev->effects & EF_NODRAW) != 0) + if ((pev->effects & EF_NODRAW) != 0 || pev->modelindex == 0) return; entvars_t* pevHead = VARS(g_pBodyQueueHead);