From 4a3efa511c8488d9a26478011d8764c2ed76310b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 7 Jan 2023 07:20:38 +0300 Subject: [PATCH] engine: client: correctly decompiled version of CL_AdjustClock (with removed useless float-to-int operation) --- engine/client/cl_main.c | 10 +++++----- engine/client/client.h | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 35530d73..0ebe93c0 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -3030,12 +3030,12 @@ void CL_AdjustClock( void ) if( fabs( cl.timedelta ) >= 0.001f ) { double msec, adjust; - float sign; + double sign; - msec = ( cl.timedelta * 1000.0f ); - sign = ( msec < 0 ) ? 1.0f : -1.0f; - msec = fabs( msec ); - adjust = sign * ( cl_fixtimerate->value / 1000.0f ); + msec = ( cl.timedelta * 1000.0 ); + sign = ( msec < 0 ) ? 1.0 : -1.0; + msec = Q_min( cl_fixtimerate->value, fabs( msec )); + adjust = sign * ( msec / 1000.0 ); if( fabs( adjust ) < fabs( cl.timedelta )) { diff --git a/engine/client/client.h b/engine/client/client.h index 68ebd016..944f3cf3 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -211,7 +211,7 @@ typedef struct // a lerp point for other data double oldtime; // previous cl.time, time-oldtime is used // to decay light values and smooth step ups - float timedelta; // floating delta between two updates + double timedelta; // floating delta between two updates char serverinfo[MAX_SERVERINFO_STRING]; player_info_t players[MAX_CLIENTS]; // collected info about all other players include himself @@ -917,7 +917,6 @@ qboolean CL_IsPredicted( void ); int CL_TruePointContents( const vec3_t p ); int CL_WaterEntity( const float *rgflPos ); cl_entity_t *CL_GetWaterEntity( const float *rgflPos ); -void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, qboolean runfuncs, double time ); int CL_TestLine( const vec3_t start, const vec3_t end, int flags ); pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags ); pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );