Some improvements on ducking and fixed angles not being aligned with prediction
This commit is contained in:
parent
d750216b3d
commit
67ed5669c0
6 changed files with 20 additions and 51 deletions
|
@ -3238,6 +3238,15 @@ void _Host_RunFrame (float time)
|
|||
cl.SetFrameTime(host_frametime);
|
||||
#ifndef SWDS
|
||||
g_ClientGlobalVariables.next_interpolation_amount = cl.m_tickRemainder / host_state.interval_per_tick;
|
||||
|
||||
// TODO_ENHANCED:
|
||||
// Update the mouse as last so we can get the right viewangles while taking screenshot.
|
||||
// The mouse is always simulated for the current frame's time
|
||||
// This makes updates smooth in every case
|
||||
// continuous controllers affecting the view are also simulated this way
|
||||
// but they have a cap applied by IN_SetSampleTime() so they are not also
|
||||
// simulated during input gathering
|
||||
CL_ExtraMouseUpdate( host_frametime );
|
||||
#endif
|
||||
for ( int tick = 0; tick < numticks; tick++ )
|
||||
{
|
||||
|
@ -3384,15 +3393,6 @@ void _Host_RunFrame (float time)
|
|||
CL_RunPrediction( PREDICTION_NORMAL );
|
||||
|
||||
CL_ApplyAddAngle();
|
||||
|
||||
// TODO_ENHANCED:
|
||||
// Update the mouse as last so we can get the right viewangles while taking screenshot.
|
||||
// The mouse is always simulated for the current frame's time
|
||||
// This makes updates smooth in every case
|
||||
// continuous controllers affecting the view are also simulated this way
|
||||
// but they have a cap applied by IN_SetSampleTime() so they are not also
|
||||
// simulated during input gathering
|
||||
CL_ExtraMouseUpdate( g_ClientGlobalVariables.frametime );
|
||||
}
|
||||
#endif
|
||||
#if defined( REPLAY_ENABLED )
|
||||
|
@ -3515,15 +3515,6 @@ void _Host_RunFrame (float time)
|
|||
|
||||
Host_SetClientInSimulation( false );
|
||||
|
||||
// TODO_ENHANCED:
|
||||
// Update the mouse as last so we can get the right viewangles while taking screenshot.
|
||||
// The mouse is always simulated for the current frame's time
|
||||
// This makes updates smooth in every case
|
||||
// continuous controllers affecting the view are also simulated this way
|
||||
// but they have a cap applied by IN_SetSampleTime() so they are not also
|
||||
// simulated during input gathering
|
||||
CL_ExtraMouseUpdate( g_ClientGlobalVariables.frametime );
|
||||
|
||||
g_ClientGlobalVariables.tickcount = saveTick;
|
||||
numticks_last_frame = numticks;
|
||||
host_remainder_last_frame = host_remainder;
|
||||
|
|
|
@ -440,14 +440,14 @@ BEGIN_PREDICTION_DATA_NO_BASE( C_BaseEntity )
|
|||
DEFINE_PRED_FIELD( m_MoveCollide, FIELD_CHARACTER, FTYPEDESC_INSENDTABLE ),
|
||||
|
||||
DEFINE_FIELD( m_vecAbsVelocity, FIELD_VECTOR ),
|
||||
DEFINE_PRED_FIELD_TOL( m_vecVelocity, FIELD_VECTOR, FTYPEDESC_INSENDTABLE, 0.5f ),
|
||||
DEFINE_PRED_FIELD_TOL( m_vecVelocity, FIELD_VECTOR, FTYPEDESC_INSENDTABLE, coordTolerance ),
|
||||
// DEFINE_PRED_FIELD( m_fEffects, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
|
||||
DEFINE_PRED_FIELD( m_nRenderMode, FIELD_CHARACTER, FTYPEDESC_INSENDTABLE ),
|
||||
DEFINE_PRED_FIELD( m_nRenderFX, FIELD_CHARACTER, FTYPEDESC_INSENDTABLE ),
|
||||
// DEFINE_PRED_FIELD( m_flAnimTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ),
|
||||
// DEFINE_PRED_FIELD( m_flSimulationTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ),
|
||||
DEFINE_PRED_FIELD( m_fFlags, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
|
||||
DEFINE_PRED_FIELD_TOL( m_vecViewOffset, FIELD_VECTOR, FTYPEDESC_INSENDTABLE, 0.25f ),
|
||||
DEFINE_PRED_FIELD_TOL( m_vecViewOffset, FIELD_VECTOR, FTYPEDESC_INSENDTABLE, coordTolerance ),
|
||||
DEFINE_PRED_FIELD( m_nModelIndex, FIELD_SHORT, FTYPEDESC_INSENDTABLE | FTYPEDESC_MODELINDEX ),
|
||||
DEFINE_PRED_FIELD( m_flFriction, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ),
|
||||
DEFINE_PRED_FIELD( m_iTeamNum, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ),
|
||||
|
|
|
@ -630,7 +630,7 @@ void CPrediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *
|
|||
move->m_bGameCodeMovedPlayer = true;
|
||||
}
|
||||
|
||||
move->m_nPlayerHandle = player->GetClientHandle();
|
||||
move->m_nPlayerHandle = player;
|
||||
move->m_vecVelocity = player->GetAbsVelocity();
|
||||
move->SetAbsOrigin( player->GetLocalOrigin() );
|
||||
move->m_vecOldAngles = move->m_vecAngles;
|
||||
|
|
|
@ -30,9 +30,9 @@ BEGIN_SEND_TABLE_NOBASE( CPlayerLocalData, DT_Local )
|
|||
SendPropInt (SENDINFO(m_bDucked), 1, SPROP_UNSIGNED ),
|
||||
SendPropInt (SENDINFO(m_bDucking), 1, SPROP_UNSIGNED ),
|
||||
SendPropInt (SENDINFO(m_bInDuckJump), 1, SPROP_UNSIGNED ),
|
||||
SendPropFloat (SENDINFO(m_flDucktime), 12, 0, 0.0f, 1000.0f ),
|
||||
SendPropFloat (SENDINFO(m_flDuckJumpTime), 12, 0, 0.0f, 1000.0f ),
|
||||
SendPropFloat (SENDINFO(m_flJumpTime), 12, 0, 0.0f, 1000.0f ),
|
||||
SendPropFloat (SENDINFO(m_flDucktime) ),
|
||||
SendPropFloat (SENDINFO(m_flDuckJumpTime) ),
|
||||
SendPropFloat (SENDINFO(m_flJumpTime)),
|
||||
#if PREDICTION_ERROR_CHECK_LEVEL > 1
|
||||
SendPropFloat (SENDINFO(m_flFallVelocity), 32, SPROP_NOSCALE ),
|
||||
|
||||
|
@ -53,7 +53,7 @@ BEGIN_SEND_TABLE_NOBASE( CPlayerLocalData, DT_Local )
|
|||
SendPropInt (SENDINFO(m_bWearingSuit), 1, SPROP_UNSIGNED ),
|
||||
SendPropBool (SENDINFO(m_bPoisoned)),
|
||||
|
||||
SendPropFloat (SENDINFO(m_flStepSize), 16, SPROP_ROUNDUP, 0.0f, 128.0f ),
|
||||
SendPropFloat (SENDINFO(m_flStepSize)),
|
||||
SendPropInt (SENDINFO(m_bAllowAutoMovement),1, SPROP_UNSIGNED ),
|
||||
|
||||
// 3d skybox data
|
||||
|
|
|
@ -379,7 +379,7 @@ void CCSGameMovement::PlayerMove()
|
|||
vHullMin.z = 0.0f;
|
||||
Vector vHullMax = GetPlayerMaxs( player->m_Local.m_bDucked );
|
||||
|
||||
Vector start = player->GetAbsOrigin();
|
||||
Vector start = mv->GetAbsOrigin();
|
||||
start.z += vHullMax.z;
|
||||
Vector end = start;
|
||||
end.z += eyeClearance - vHullMax.z;
|
||||
|
@ -398,7 +398,7 @@ void CCSGameMovement::PlayerMove()
|
|||
|
||||
if ( trace.fraction < 1.0f )
|
||||
{
|
||||
float est = start.z + trace.fraction * (end.z - start.z) - player->GetAbsOrigin().z - eyeClearance;
|
||||
float est = start.z + trace.fraction * (end.z - start.z) - mv->GetAbsOrigin().z - eyeClearance;
|
||||
if ( ( player->GetFlags() & FL_DUCKING ) == 0 && !player->m_Local.m_bDucking && !player->m_Local.m_bDucked )
|
||||
{
|
||||
offset.z = est;
|
||||
|
|
|
@ -4113,17 +4113,6 @@ void CGameMovement::FinishUnDuck( void )
|
|||
|
||||
mv->SetAbsOrigin( newOrigin );
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
#ifdef STAGING_ONLY
|
||||
if ( debug_latch_reset_onduck.GetBool() )
|
||||
{
|
||||
player->ResetLatched();
|
||||
}
|
||||
#else
|
||||
player->ResetLatched();
|
||||
#endif
|
||||
#endif // CLIENT_DLL
|
||||
|
||||
// Recategorize position since ducking can change origin
|
||||
CategorizePosition();
|
||||
}
|
||||
|
@ -4217,17 +4206,6 @@ void CGameMovement::FinishDuck( void )
|
|||
Vector out;
|
||||
VectorAdd( mv->GetAbsOrigin(), viewDelta, out );
|
||||
mv->SetAbsOrigin( out );
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
#ifdef STAGING_ONLY
|
||||
if ( debug_latch_reset_onduck.GetBool() )
|
||||
{
|
||||
player->ResetLatched();
|
||||
}
|
||||
#else
|
||||
player->ResetLatched();
|
||||
#endif
|
||||
#endif // CLIENT_DLL
|
||||
}
|
||||
|
||||
// See if we are stuck?
|
||||
|
@ -4488,7 +4466,7 @@ void CGameMovement::Duck( void )
|
|||
float flDuckSeconds = flDuckMilliseconds * 0.001f;
|
||||
|
||||
// Finish ducking immediately if duck time is over or not on ground
|
||||
if ( flDuckSeconds > TIME_TO_UNDUCK || ( bInAir && !bDuckJump ) )
|
||||
if ( flDuckSeconds >= TIME_TO_UNDUCK || ( bInAir && !bDuckJump ) )
|
||||
{
|
||||
FinishUnDuck();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue