From fdb59e990ee7ed2e80024063d6e0f8474be618ab Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 5 May 2026 01:04:57 +0500 Subject: [PATCH] engine: rename Host_IsLocalGame to Host_IsSinglePlayerGame to avoid confusion --- engine/client/dll_int/cl_render.c | 4 ++-- engine/common/common.h | 4 +++- engine/common/host.c | 7 ++++--- engine/ref_api.h | 2 +- engine/server/sv_client.c | 2 +- engine/server/sv_main.c | 2 +- ref/gl/gl_studio.c | 2 +- ref/soft/r_studio.c | 2 +- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/engine/client/dll_int/cl_render.c b/engine/client/dll_int/cl_render.c index c30141b6..74954559 100644 --- a/engine/client/dll_int/cl_render.c +++ b/engine/client/dll_int/cl_render.c @@ -172,8 +172,8 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe return cl.local.waterlevel; case PARM_LOCAL_HEALTH: return cl.local.health; - case PARM_LOCAL_GAME: - return Host_IsLocalGame(); + case PARM_SINGLEPLAYER_GAME: + return Host_IsSinglePlayerGame(); case PARM_NUMENTITIES: return pfnNumberOfEntities(); case PARM_GET_CLIENT_PTR: diff --git a/engine/common/common.h b/engine/common/common.h index 7e3726f4..ef1edcad 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -852,13 +852,15 @@ static inline connprotocol_t CL_Protocol( void ) } #endif -static inline qboolean Host_IsLocalGame( void ) +// true in singleplayer only but not specific to local game +static inline qboolean Host_IsSinglePlayerGame( void ) { if( SV_Active( )) return SV_GetMaxClients() == 1 ? true : false; return CL_GetMaxClients() == 1 ? true : false; } +// true when both server and client running on the same host static inline qboolean Host_IsLocalClient( void ) { return CL_Initialized( ) && SV_Initialized( ) ? true : false; diff --git a/engine/common/host.c b/engine/common/host.c index c3901ad5..4118c13a 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -513,7 +513,7 @@ static double Host_CalcFPS( void ) { fps = CL_GetDemoFramerate(); } - else if( Host_IsLocalGame( )) + else if( Host_IsSinglePlayerGame( )) { if( !gl_vsync.value ) fps = host_maxfps.value; @@ -642,9 +642,10 @@ static qboolean Host_FilterTime( double time ) oldtime = host.realtime; // NOTE: allow only in singleplayer while demos are not active - if( host_framerate.value > 0.0f && Host_IsLocalGame() && !CL_IsPlaybackDemo() && !CL_IsRecordDemo( )) + if( host_framerate.value > 0.0f && Host_IsSinglePlayerGame() && !CL_IsPlaybackDemo() && !CL_IsRecordDemo( )) host.frametime = bound( MIN_FRAMETIME, host_framerate.value * scale, MAX_FRAMETIME ); - else host.frametime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME ); + else + host.frametime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME ); return true; } diff --git a/engine/ref_api.h b/engine/ref_api.h index 72999f8c..ec2a1514 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -330,7 +330,7 @@ typedef enum PARM_WATER_LEVEL = -8, // cl.local.water_level PARM_GET_WORLD_PTR = -9, // world PARM_LOCAL_HEALTH = -10, // cl.local.health - PARM_LOCAL_GAME = -11, + PARM_SINGLEPLAYER_GAME = -11, // was PARM_LOCAL_GAME PARM_NUMENTITIES = -12, // local game only PARM_GET_MOVEVARS_PTR = -13, // clgame.movevars PARM_GET_PALETTE_PTR = -14, // clgame.palette diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index fbb46e3e..8b21e4e0 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -1724,7 +1724,7 @@ static qboolean SV_ShouldUpdateUserinfo( sv_client_t *cl ) if( FBitSet( cl->flags, FCL_FAKECLIENT )) return allow; - if( Host_IsLocalGame( )) + if( Host_IsSinglePlayerGame( )) return allow; // start from 1 second diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 252ecab0..afce862f 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -262,7 +262,7 @@ static void SV_CheckCmdTimes( void ) Cvar_SetValue( "sv_fps", MAX_FPS_HARD ); } - if( Host_IsLocalGame( )) + if( Host_IsSinglePlayerGame( )) return; if(( host.realtime - lastreset ) < 1.0 ) diff --git a/ref/gl/gl_studio.c b/ref/gl/gl_studio.c index 1bed6a0e..8ca26135 100644 --- a/ref/gl/gl_studio.c +++ b/ref/gl/gl_studio.c @@ -2420,7 +2420,7 @@ static model_t *R_StudioSetupPlayerModel( int index ) state = &g_studio.player_models[index]; // g-cont: force for "dev-mode", non-local games and menu preview - if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) ) && info->model[0] ) + if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_SINGLEPLAYER_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) ) && info->model[0] ) { if( Q_strcmp( state->name, info->model )) { diff --git a/ref/soft/r_studio.c b/ref/soft/r_studio.c index a75b0a63..a7247c8a 100644 --- a/ref/soft/r_studio.c +++ b/ref/soft/r_studio.c @@ -2084,7 +2084,7 @@ static model_t *R_StudioSetupPlayerModel( int index ) state = &g_studio.player_models[index]; // g-cont: force for "dev-mode", non-local games and menu preview - if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) && info->model[0] ) + if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_SINGLEPLAYER_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) && info->model[0] ) { if( Q_strcmp( state->name, info->model )) {