From 689e29bc42e95e1751b0f9c466c11ce46df524b9 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 23 Nov 2024 15:01:12 +0300 Subject: [PATCH] engine: client: only load paused icon when requested --- engine/client/cl_game.c | 6 +++++- engine/client/cl_scrn.c | 18 ++++++++++++------ engine/client/client.h | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index b08f4d9a..fff0c217 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -952,7 +952,11 @@ void CL_DrawHUD( int state ) CL_DrawCenterPrint (); clgame.dllFuncs.pfnRedraw( cl.time, cl.intermission ); if( showpause.value ) - CL_DrawLoadingOrPaused( cls.pauseIcon ); + { + if( !cls.pauseIcon ) + cls.pauseIcon = SCR_LoadPauseIcon(); + CL_DrawLoadingOrPaused( Q_max( 0, cls.pauseIcon )); + } break; case CL_LOADING: CL_DrawLoadingOrPaused( cls.loadingBar ); diff --git a/engine/client/cl_scrn.c b/engine/client/cl_scrn.c index ed937777..139be701 100644 --- a/engine/client/cl_scrn.c +++ b/engine/client/cl_scrn.c @@ -793,6 +793,18 @@ static void SCR_InstallParticlePalette( void ) } } +int SCR_LoadPauseIcon( void ) +{ + int texnum = 0; + + if( FS_FileExists( "gfx/paused.lmp", false )) + texnum = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST ); + else if( FS_FileExists( "gfx/pause.lmp", false )) + texnum = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST ); + + return texnum ? texnum : -1; +} + /* ================ SCR_RegisterTextures @@ -803,12 +815,6 @@ INTERNAL RESOURCE void SCR_RegisterTextures( void ) { // register gfx.wad images - - if( FS_FileExists( "gfx/paused.lmp", false )) - cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST ); - else if( FS_FileExists( "gfx/pause.lmp", false )) - cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST ); - if( FS_FileExists( "gfx/lambda.lmp", false )) { if( cl_allow_levelshots.value ) diff --git a/engine/client/client.h b/engine/client/client.h index 3adac361..476a8828 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -953,6 +953,7 @@ void SCR_VidInit( void ); void SCR_TileClear( void ); void SCR_DirtyScreen( void ); void SCR_EndLoadingPlaque( void ); +int SCR_LoadPauseIcon( void ); void SCR_RegisterTextures( void ); void SCR_LoadCreditsFont( void ); void SCR_MakeScreenShot( void );