diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/cl_pred.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'engine/cl_pred.cpp')
| -rw-r--r-- | engine/cl_pred.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/engine/cl_pred.cpp b/engine/cl_pred.cpp new file mode 100644 index 0000000..b0ab1ed --- /dev/null +++ b/engine/cl_pred.cpp @@ -0,0 +1,74 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// +#include "client_pch.h" +#include "demo.h" +#include "host.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// Purpose: +// Input : world_start_state - +// validframe - +// start_command - +// stop_command - +//----------------------------------------------------------------------------- +void CL_Predict( int world_start_state, bool validframe, int start_command, int stop_command ) +{ + // Allow client .dll to do prediction. + g_pClientSidePrediction->Update( + world_start_state, + validframe, + start_command, + stop_command ); +} + +//----------------------------------------------------------------------------- +// Purpose: Determine if we received a new message, which means we need to +// redo prediction +//----------------------------------------------------------------------------- +void CL_RunPrediction( PREDICTION_REASON reason ) +{ + tmZone( TELEMETRY_LEVEL0, TMZF_NONE, "%s", __FUNCTION__ ); + + if ( !cl.IsActive() ) + return; + + if ( cl.m_nDeltaTick < 0 ) + { + // no valid snapshot received yet + return; + } + + // Don't do prediction if skipping ahead during demo playback + if ( demoplayer->IsSkipping() ) + { + return; + } + + //Msg( "%i pred reason %s\n", host_framecount, reason == PREDICTION_SIMULATION_RESULTS_ARRIVING_ON_SEND_FRAME ? + // "same frame" : "normal" ); + + bool valid = cl.m_nDeltaTick > 0; // cl.GetReceiveList( cl.delta_tick ) != NULL; + + //Msg( "%i/%i CL_RunPrediction: last ack %i most recent %i\n", + // host_framecount, cl.tickcount, + // cl.last_command_ack, + // cl.netchan->m_nOutSequenceNr - 1 ); + + CL_Predict( cl.m_nDeltaTick, + valid, + cl.last_command_ack, + cl.lastoutgoingcommand + cl.chokedcommands ); +} |