engine: host: avoid some of unnecessary double-to-float conversions

This commit is contained in:
Alibek Omarov 2024-06-12 10:12:36 +03:00
parent 739592e50d
commit 2c7bf49fc9
4 changed files with 8 additions and 15 deletions

View file

@ -523,7 +523,7 @@ qboolean Host_IsLocalClient( void );
void Host_ShutdownServer( void ); void Host_ShutdownServer( void );
void Host_Error( const char *error, ... ) _format( 1 ); void Host_Error( const char *error, ... ) _format( 1 );
void Host_ValidateEngineFeatures( uint32_t features ); void Host_ValidateEngineFeatures( uint32_t features );
void Host_Frame( float time ); void Host_Frame( double time );
void Host_Credits( void ); void Host_Credits( void );
// //
@ -534,7 +534,7 @@ void COM_NewGame( char const *pMapName );
void COM_LoadLevel( char const *pMapName, qboolean background ); void COM_LoadLevel( char const *pMapName, qboolean background );
void COM_LoadGame( char const *pSaveFileName ); void COM_LoadGame( char const *pSaveFileName );
void COM_ChangeLevel( char const *pNewLevel, char const *pLandmarkName, qboolean background ); void COM_ChangeLevel( char const *pNewLevel, char const *pLandmarkName, qboolean background );
void COM_Frame( float time ); void COM_Frame( double time );
/* /*
============================================================== ==============================================================

View file

@ -257,7 +257,3 @@ void FS_Shutdown( void )
FS_UnloadProgs(); FS_UnloadProgs();
} }

View file

@ -763,7 +763,7 @@ Host_FilterTime
Returns false if the time is too short to run a frame Returns false if the time is too short to run a frame
=================== ===================
*/ */
static qboolean Host_FilterTime( float time ) static qboolean Host_FilterTime( double time )
{ {
static double oldtime; static double oldtime;
double dt; double dt;
@ -793,9 +793,9 @@ static qboolean Host_FilterTime( float time )
Host_Frame Host_Frame
================= =================
*/ */
void Host_Frame( float time ) void Host_Frame( double time )
{ {
double t1, t2; double t1;
// decide the simulation time // decide the simulation time
if( !Host_FilterTime( time )) if( !Host_FilterTime( time ))
@ -813,11 +813,8 @@ void Host_Frame( float time )
Host_ClientFrame (); // client frame Host_ClientFrame (); // client frame
HTTP_Run(); // both server and client HTTP_Run(); // both server and client
t2 = Sys_DoubleTime();
host.pureframetime = t2 - t1;
host.framecount++; host.framecount++;
host.pureframetime = Sys_DoubleTime() - t1;
} }
/* /*

View file

@ -137,7 +137,7 @@ static void Host_ShutdownGame( void )
} }
} }
static void Host_RunFrame( float time ) static void Host_RunFrame( double time )
{ {
// at this time, we don't need to get events from OS on dedicated // at this time, we don't need to get events from OS on dedicated
#if !XASH_DEDICATED #if !XASH_DEDICATED
@ -168,7 +168,7 @@ static void Host_RunFrame( float time )
} }
} }
void COM_Frame( float time ) void COM_Frame( double time )
{ {
int loopCount = 0; int loopCount = 0;