Browse Source

engine: client: simplify drawing loading or paused bar, fix position with hud_scale active

pull/2/head
Alibek Omarov 2 years ago
parent
commit
6282acc825
  1. 26
      engine/client/cl_game.c

26
engine/client/cl_game.c

@ -938,31 +938,21 @@ CL_DrawLoading @@ -938,31 +938,21 @@ CL_DrawLoading
draw loading progress bar
=============
*/
static void CL_DrawLoadingOrPaused( qboolean paused, float percent )
static void CL_DrawLoadingOrPaused( int tex )
{
float x, y, width, height;
int iWidth, iHeight;
R_GetTextureParms( &iWidth, &iHeight, paused ? cls.pauseIcon : cls.loadingBar );
x = ( clgame.scrInfo.iWidth - width ) / 2.0f;;
y = ( clgame.scrInfo.iHeight - height ) / 2.0f;
R_GetTextureParms( &iWidth, &iHeight, tex );
x = ( clgame.scrInfo.iWidth - iWidth ) / 2.0f;
y = ( clgame.scrInfo.iHeight - iHeight ) / 2.0f;
width = iWidth;
height = iHeight;
SPR_AdjustSize( &x, &y, &width, &height );
if( !paused )
{
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
}
else
{
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.pauseIcon );
}
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, tex );
}
void CL_DrawHUD( int state )
@ -988,15 +978,15 @@ void CL_DrawHUD( int state ) @@ -988,15 +978,15 @@ void CL_DrawHUD( int state )
CL_DrawCrosshair ();
CL_DrawCenterPrint ();
clgame.dllFuncs.pfnRedraw( cl.time, cl.intermission );
CL_DrawLoadingOrPaused( true, 0.0f );
CL_DrawLoadingOrPaused( cls.pauseIcon );
break;
case CL_LOADING:
CL_DrawLoadingOrPaused( false, scr_loading->value );
CL_DrawLoadingOrPaused( cls.loadingBar );
break;
case CL_CHANGELEVEL:
if( cls.draw_changelevel )
{
CL_DrawLoadingOrPaused( false, 100.0f );
CL_DrawLoadingOrPaused( cls.loadingBar );
cls.draw_changelevel = false;
}
break;

Loading…
Cancel
Save