css_enhanced_waf/game/client/cstrike/cs_prediction.cpp

78 lines
2.2 KiB
C++
Raw Normal View History

2020-04-22 18:56:21 +02:00
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
2024-07-14 15:41:26 +02:00
#include "iclientvehicle.h"
2020-04-22 18:56:21 +02:00
#include "prediction.h"
#include "c_cs_player.h"
#include "igamemovement.h"
static CMoveData g_MoveData;
CMoveData *g_pMoveData = &g_MoveData;
class CCSPrediction : public CPrediction
{
DECLARE_CLASS( CCSPrediction, CPrediction );
public:
2024-07-14 15:41:26 +02:00
virtual void StartCommand( CBasePlayer *player, CUserCmd *cmd );
2020-04-22 18:56:21 +02:00
virtual void SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move );
virtual void FinishMove( C_BasePlayer *player, CUserCmd *ucmd, CMoveData *move );
};
2024-07-14 15:41:26 +02:00
void CCSPrediction::StartCommand(CBasePlayer* player, CUserCmd* cmd)
{
CCSPlayer *pPlayer = ToCSPlayer( player );
BaseClass::StartCommand( player, cmd );
}
2020-04-22 18:56:21 +02:00
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCSPrediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper,
CMoveData *move )
{
player->AvoidPhysicsProps( ucmd );
// Call the default SetupMove code.
BaseClass::SetupMove( player, ucmd, pHelper, move );
2024-07-14 15:41:26 +02:00
IClientVehicle *pVehicle = player->GetVehicle();
if (pVehicle && gpGlobals->frametime != 0)
{
pVehicle->SetupMove( player, ucmd, pHelper, move );
}
2020-04-22 18:56:21 +02:00
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CCSPrediction::FinishMove( C_BasePlayer *player, CUserCmd *ucmd, CMoveData *move )
{
// Call the default FinishMove code.
BaseClass::FinishMove( player, ucmd, move );
2024-07-14 15:41:26 +02:00
IClientVehicle *pVehicle = player->GetVehicle();
if (pVehicle && gpGlobals->frametime != 0)
{
pVehicle->FinishMove( player, ucmd, move );
}
2020-04-22 18:56:21 +02:00
}
// Expose interface to engine
// Expose interface to engine
static CCSPrediction g_Prediction;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CCSPrediction, IPrediction, VCLIENT_PREDICTION_INTERFACE_VERSION, g_Prediction );
CPrediction *prediction = &g_Prediction;