Fixed crash while firing
This commit is contained in:
parent
a54eabf77a
commit
7625fd7947
6 changed files with 43 additions and 7 deletions
|
@ -2232,6 +2232,16 @@ void C_CSPlayer::Simulate( void )
|
||||||
DrawClientHitboxes(0.0f, true);
|
DrawClientHitboxes(0.0f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C_CSPlayer::PostThink()
|
||||||
|
{
|
||||||
|
BaseClass::PostThink();
|
||||||
|
// Reset this.. it gets reset each frame that we're in a bomb zone.
|
||||||
|
m_bInBombZone = false;
|
||||||
|
m_bInBuyZone = false;
|
||||||
|
m_bInHostageRescueZone = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void C_CSPlayer::ReleaseFlashlight( void )
|
void C_CSPlayer::ReleaseFlashlight( void )
|
||||||
{
|
{
|
||||||
if( m_pFlashlightBeam )
|
if( m_pFlashlightBeam )
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
~C_CSPlayer();
|
~C_CSPlayer();
|
||||||
|
|
||||||
virtual void Simulate();
|
virtual void Simulate();
|
||||||
|
virtual void PostThink();
|
||||||
|
|
||||||
bool HasDefuser() const;
|
bool HasDefuser() const;
|
||||||
|
|
||||||
|
@ -227,7 +228,7 @@ public:
|
||||||
CNetworkVar( bool, m_bInBombZone );
|
CNetworkVar( bool, m_bInBombZone );
|
||||||
CNetworkVar( bool, m_bInBuyZone );
|
CNetworkVar( bool, m_bInBuyZone );
|
||||||
CNetworkVar( int, m_iThrowGrenadeCounter ); // used to trigger grenade throw animations.
|
CNetworkVar( int, m_iThrowGrenadeCounter ); // used to trigger grenade throw animations.
|
||||||
|
bool m_bInHostageRescueZone;
|
||||||
bool IsInHostageRescueZone( void );
|
bool IsInHostageRescueZone( void );
|
||||||
|
|
||||||
// This is a combination of the ADDON_ flags in cs_shareddefs.h.
|
// This is a combination of the ADDON_ flags in cs_shareddefs.h.
|
||||||
|
@ -324,7 +325,6 @@ private:
|
||||||
int m_ArmorValue;
|
int m_ArmorValue;
|
||||||
QAngle m_angEyeAngles;
|
QAngle m_angEyeAngles;
|
||||||
bool m_bHasDefuser;
|
bool m_bHasDefuser;
|
||||||
bool m_bInHostageRescueZone;
|
|
||||||
float m_fNextThinkPushAway;
|
float m_fNextThinkPushAway;
|
||||||
|
|
||||||
bool m_bPlayingFreezeCamSound;
|
bool m_bPlayingFreezeCamSound;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// $NoKeywords: $
|
// $NoKeywords: $
|
||||||
//=============================================================================//
|
//=============================================================================//
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
|
#include "iclientvehicle.h"
|
||||||
#include "prediction.h"
|
#include "prediction.h"
|
||||||
#include "c_cs_player.h"
|
#include "c_cs_player.h"
|
||||||
#include "igamemovement.h"
|
#include "igamemovement.h"
|
||||||
|
@ -19,10 +20,19 @@ class CCSPrediction : public CPrediction
|
||||||
DECLARE_CLASS( CCSPrediction, CPrediction );
|
DECLARE_CLASS( CCSPrediction, CPrediction );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual void StartCommand( CBasePlayer *player, CUserCmd *cmd );
|
||||||
virtual void SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
|
virtual void SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
|
||||||
virtual void FinishMove( C_BasePlayer *player, CUserCmd *ucmd, CMoveData *move );
|
virtual void FinishMove( C_BasePlayer *player, CUserCmd *ucmd, CMoveData *move );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void CCSPrediction::StartCommand(CBasePlayer* player, CUserCmd* cmd)
|
||||||
|
{
|
||||||
|
CCSPlayer *pPlayer = ToCSPlayer( player );
|
||||||
|
|
||||||
|
BaseClass::StartCommand( player, cmd );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -33,6 +43,12 @@ void CCSPrediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
|
|
||||||
// Call the default SetupMove code.
|
// Call the default SetupMove code.
|
||||||
BaseClass::SetupMove( player, ucmd, pHelper, move );
|
BaseClass::SetupMove( player, ucmd, pHelper, move );
|
||||||
|
|
||||||
|
IClientVehicle *pVehicle = player->GetVehicle();
|
||||||
|
if (pVehicle && gpGlobals->frametime != 0)
|
||||||
|
{
|
||||||
|
pVehicle->SetupMove( player, ucmd, pHelper, move );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -42,6 +58,12 @@ void CCSPrediction::FinishMove( C_BasePlayer *player, CUserCmd *ucmd, CMoveData
|
||||||
{
|
{
|
||||||
// Call the default FinishMove code.
|
// Call the default FinishMove code.
|
||||||
BaseClass::FinishMove( player, ucmd, move );
|
BaseClass::FinishMove( player, ucmd, move );
|
||||||
|
|
||||||
|
IClientVehicle *pVehicle = player->GetVehicle();
|
||||||
|
if (pVehicle && gpGlobals->frametime != 0)
|
||||||
|
{
|
||||||
|
pVehicle->FinishMove( player, ucmd, move );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -883,6 +883,8 @@ void CPrediction::RunCommand( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
PREDICTION_TRACKVALUECHANGESCOPE( sz );
|
PREDICTION_TRACKVALUECHANGESCOPE( sz );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
StartCommand( player, ucmd );
|
||||||
|
|
||||||
g_pGameMovement->StartTrackPredictionErrors( player );
|
g_pGameMovement->StartTrackPredictionErrors( player );
|
||||||
|
|
||||||
gpGlobals->frametime = m_bEnginePaused ? 0 : TICK_INTERVAL;
|
gpGlobals->frametime = m_bEnginePaused ? 0 : TICK_INTERVAL;
|
||||||
|
@ -893,8 +895,6 @@ void CPrediction::RunCommand( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
|
|
||||||
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
||||||
|
|
||||||
StartCommand( player, ucmd );
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// TODO: Check for impulse predicted?
|
// TODO: Check for impulse predicted?
|
||||||
|
|
||||||
|
|
|
@ -1630,6 +1630,11 @@ void CCSPlayer::PostThink()
|
||||||
StopSound( "Player.AmbientUnderWater" );
|
StopSound( "Player.AmbientUnderWater" );
|
||||||
SetPlayerUnderwater( false );
|
SetPlayerUnderwater( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset this.. it gets reset each frame that we're in a bomb zone.
|
||||||
|
m_bInBombZone = false;
|
||||||
|
m_bInBuyZone = false;
|
||||||
|
m_bInHostageRescueZone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -336,16 +336,15 @@ void CPlayerMove::RunCommand ( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
return; // Don't process this command
|
return; // Don't process this command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartCommand( player, ucmd );
|
||||||
|
|
||||||
g_pGameMovement->StartTrackPredictionErrors( player );
|
g_pGameMovement->StartTrackPredictionErrors( player );
|
||||||
|
|
||||||
gpGlobals->frametime = playerFrameTime;
|
gpGlobals->frametime = playerFrameTime;
|
||||||
gpGlobals->curtime = (player->m_nTickBase - 1) * TICK_INTERVAL;
|
gpGlobals->curtime = (player->m_nTickBase - 1) * TICK_INTERVAL;
|
||||||
|
|
||||||
// Run post think first, this will let some space for client side interpolation.
|
// Run post think first, this will let some space for client side interpolation.
|
||||||
RunPostThink( player );
|
RunPostThink( player );
|
||||||
|
|
||||||
StartCommand( player, ucmd );
|
|
||||||
|
|
||||||
// Set globals appropriately
|
// Set globals appropriately
|
||||||
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
||||||
|
|
Loading…
Reference in a new issue