Browse Source

engine: client: combine loading or paused icon drawing

pull/2/head
Alibek Omarov 5 years ago
parent
commit
db39f0cc88
  1. 75
      engine/client/cl_game.c

75
engine/client/cl_game.c

@ -380,8 +380,6 @@ static void SPR_AdjustSize( float *x, float *y, float *w, float *h )
{ {
float xscale, yscale; float xscale, yscale;
if( !x && !y && !w && !h ) return;
// scale for screen sizes // scale for screen sizes
xscale = refState.width / (float)clgame.scrInfo.iWidth; xscale = refState.width / (float)clgame.scrInfo.iWidth;
yscale = refState.height / (float)clgame.scrInfo.iHeight; yscale = refState.height / (float)clgame.scrInfo.iHeight;
@ -394,18 +392,15 @@ static void SPR_AdjustSize( float *x, float *y, float *w, float *h )
/* /*
==================== ====================
PictAdjustSize SPR_AdjustSize
draw hudsprite routine draw hudsprite routine
==================== ====================
*/ */
void PicAdjustSize( float *x, float *y, float *w, float *h ) static void SPR_AdjustSizei( int *x, int *y, int *w, int *h )
{ {
float xscale, yscale; float xscale, yscale;
if( !clgame.ds.adjust_size ) return;
if( !x && !y && !w && !h ) return;
// scale for screen sizes // scale for screen sizes
xscale = refState.width / (float)clgame.scrInfo.iWidth; xscale = refState.width / (float)clgame.scrInfo.iWidth;
yscale = refState.height / (float)clgame.scrInfo.iHeight; yscale = refState.height / (float)clgame.scrInfo.iHeight;
@ -416,6 +411,20 @@ void PicAdjustSize( float *x, float *y, float *w, float *h )
if( h ) *h *= yscale; if( h ) *h *= yscale;
} }
/*
====================
PictAdjustSize
draw hudsprite routine
====================
*/
void PicAdjustSize( float *x, float *y, float *w, float *h )
{
if( !clgame.ds.adjust_size ) return;
SPR_AdjustSize( x, y, w, h );
}
static qboolean SPR_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 ) static qboolean SPR_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
{ {
float dudx, dvdy; float dudx, dvdy;
@ -947,25 +956,20 @@ CL_DrawLoading
draw loading progress bar draw loading progress bar
============= =============
*/ */
static void CL_DrawLoading( float percent ) static void CL_DrawLoadingOrPaused( qboolean paused, float percent )
{ {
int x, y, width, height, right; int x, y, width, height, right;
float xscale, yscale, step, s2;
R_GetTextureParms( &width, &height, cls.loadingBar ); R_GetTextureParms( &width, &height, paused ? cls.pauseIcon : cls.loadingBar );
x = ( clgame.scrInfo.iWidth - width ) >> 1; x = ( clgame.scrInfo.iWidth - width ) >> 1;
y = ( clgame.scrInfo.iHeight - height) >> 1; y = ( clgame.scrInfo.iHeight - height) >> 1;
xscale = refState.width / (float)clgame.scrInfo.iWidth; SPR_AdjustSizei( &x, &y, &width, &height );
yscale = refState.height / (float)clgame.scrInfo.iHeight;
x *= xscale;
y *= yscale;
width *= xscale;
height *= yscale;
if( cl_allow_levelshots->value ) if( !paused && cl_allow_levelshots->value )
{ {
float step, s2;
ref.dllFuncs.Color4ub( 128, 128, 128, 255 ); ref.dllFuncs.Color4ub( 128, 128, 128, 255 );
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture ); ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar ); ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
@ -988,35 +992,6 @@ static void CL_DrawLoading( float percent )
} }
} }
/*
=============
CL_DrawPause
draw pause sign
=============
*/
static void CL_DrawPause( void )
{
int x, y, width, height;
float xscale, yscale;
R_GetTextureParms( &width, &height, cls.pauseIcon );
x = ( clgame.scrInfo.iWidth - width ) >> 1;
y = ( clgame.scrInfo.iHeight - height) >> 1;
xscale = refState.width / (float)clgame.scrInfo.iWidth;
yscale = refState.height / (float)clgame.scrInfo.iHeight;
x *= xscale;
y *= yscale;
width *= xscale;
height *= yscale;
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 );
}
void CL_DrawHUD( int state ) void CL_DrawHUD( int state )
{ {
if( state == CL_ACTIVE && !cl.video_prepped ) if( state == CL_ACTIVE && !cl.video_prepped )
@ -1040,15 +1015,15 @@ void CL_DrawHUD( int state )
CL_DrawCrosshair (); CL_DrawCrosshair ();
CL_DrawCenterPrint (); CL_DrawCenterPrint ();
clgame.dllFuncs.pfnRedraw( cl.time, cl.intermission ); clgame.dllFuncs.pfnRedraw( cl.time, cl.intermission );
CL_DrawPause(); CL_DrawLoadingOrPaused( true, 0.0f );
break; break;
case CL_LOADING: case CL_LOADING:
CL_DrawLoading( scr_loading->value ); CL_DrawLoadingOrPaused( false, scr_loading->value );
break; break;
case CL_CHANGELEVEL: case CL_CHANGELEVEL:
if( cls.draw_changelevel ) if( cls.draw_changelevel )
{ {
CL_DrawLoading( 100.0f ); CL_DrawLoadingOrPaused( false, 100.0f );
cls.draw_changelevel = false; cls.draw_changelevel = false;
} }
break; break;

Loading…
Cancel
Save