|
|
@ -345,53 +345,43 @@ SPR_AdjustSize |
|
|
|
draw hudsprite routine |
|
|
|
draw hudsprite routine |
|
|
|
==================== |
|
|
|
==================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static void SPR_AdjustSize( float *x, float *y, float *w, float *h ) |
|
|
|
void SPR_AdjustSize( float *x, float *y, float *w, float *h ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
float xscale, yscale; |
|
|
|
float xscale, yscale; |
|
|
|
|
|
|
|
|
|
|
|
// scale for screen sizes
|
|
|
|
if( refState.width == clgame.scrInfo.iWidth && refState.height == clgame.scrInfo.iHeight ) |
|
|
|
xscale = refState.width / (float)clgame.scrInfo.iWidth; |
|
|
|
return; |
|
|
|
yscale = refState.height / (float)clgame.scrInfo.iHeight; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( x ) *x *= xscale; |
|
|
|
|
|
|
|
if( y ) *y *= yscale; |
|
|
|
|
|
|
|
if( w ) *w *= xscale; |
|
|
|
|
|
|
|
if( h ) *h *= yscale; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
SPR_AdjustSize |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw hudsprite routine |
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static void SPR_AdjustSizei( int *x, int *y, int *w, int *h ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
float xscale, yscale; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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; |
|
|
|
|
|
|
|
|
|
|
|
if( x ) *x *= xscale; |
|
|
|
*x *= xscale; |
|
|
|
if( y ) *y *= yscale; |
|
|
|
*y *= yscale; |
|
|
|
if( w ) *w *= xscale; |
|
|
|
*w *= xscale; |
|
|
|
if( h ) *h *= yscale; |
|
|
|
*h *= yscale; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 ) |
|
|
|
==================== |
|
|
|
|
|
|
|
PictAdjustSize |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw hudsprite routine |
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void PicAdjustSize( float *x, float *y, float *w, float *h ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if( !clgame.ds.adjust_size ) return; |
|
|
|
if( refState.width != clgame.scrInfo.iWidth ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// align to texel if scaling
|
|
|
|
|
|
|
|
*s1 += 0.5f; |
|
|
|
|
|
|
|
*s2 -= 0.5f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SPR_AdjustSize( x, y, w, h ); |
|
|
|
if( refState.height != clgame.scrInfo.iHeight ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// align to texel if scaling
|
|
|
|
|
|
|
|
*t1 += 0.5f; |
|
|
|
|
|
|
|
*t2 -= 0.5f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*s1 /= width; |
|
|
|
|
|
|
|
*t1 /= height; |
|
|
|
|
|
|
|
*s2 /= width; |
|
|
|
|
|
|
|
*t2 /= height; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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 ) |
|
|
@ -468,9 +458,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei |
|
|
|
|
|
|
|
|
|
|
|
if( prc ) |
|
|
|
if( prc ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
wrect_t rc; |
|
|
|
wrect_t rc = *prc; |
|
|
|
|
|
|
|
|
|
|
|
rc = *prc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sigh! some stupid modmakers set wrong rectangles in hud.txt
|
|
|
|
// Sigh! some stupid modmakers set wrong rectangles in hud.txt
|
|
|
|
if( rc.left <= 0 || rc.left >= width ) rc.left = 0; |
|
|
|
if( rc.left <= 0 || rc.left >= width ) rc.left = 0; |
|
|
@ -478,11 +466,13 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei |
|
|
|
if( rc.right <= 0 || rc.right > width ) rc.right = width; |
|
|
|
if( rc.right <= 0 || rc.right > width ) rc.right = width; |
|
|
|
if( rc.bottom <= 0 || rc.bottom > height ) rc.bottom = height; |
|
|
|
if( rc.bottom <= 0 || rc.bottom > height ) rc.bottom = height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s1 = rc.left; |
|
|
|
|
|
|
|
t1 = rc.top; |
|
|
|
|
|
|
|
s2 = rc.right; |
|
|
|
|
|
|
|
t2 = rc.bottom; |
|
|
|
|
|
|
|
|
|
|
|
// calc user-defined rectangle
|
|
|
|
// calc user-defined rectangle
|
|
|
|
s1 = (float)rc.left / width; |
|
|
|
SPR_AdjustTexCoords( width, height, &s1, &t1, &s2, &t2 ); |
|
|
|
t1 = (float)rc.top / height; |
|
|
|
|
|
|
|
s2 = (float)rc.right / width; |
|
|
|
|
|
|
|
t2 = (float)rc.bottom / height; |
|
|
|
|
|
|
|
width = rc.right - rc.left; |
|
|
|
width = rc.right - rc.left; |
|
|
|
height = rc.bottom - rc.top; |
|
|
|
height = rc.bottom - rc.top; |
|
|
|
} |
|
|
|
} |
|
|
@ -950,13 +940,16 @@ draw loading progress bar |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static void CL_DrawLoadingOrPaused( qboolean paused, float percent ) |
|
|
|
static void CL_DrawLoadingOrPaused( qboolean paused, float percent ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int x, y, width, height, right; |
|
|
|
float x, y, width, height; |
|
|
|
|
|
|
|
int iWidth, iHeight; |
|
|
|
|
|
|
|
|
|
|
|
R_GetTextureParms( &width, &height, paused ? cls.pauseIcon : cls.loadingBar ); |
|
|
|
R_GetTextureParms( &iWidth, &iHeight, paused ? cls.pauseIcon : cls.loadingBar ); |
|
|
|
x = ( clgame.scrInfo.iWidth - width ) >> 1; |
|
|
|
x = ( clgame.scrInfo.iWidth - width ) / 2.0f;; |
|
|
|
y = ( clgame.scrInfo.iHeight - height) >> 1; |
|
|
|
y = ( clgame.scrInfo.iHeight - height ) / 2.0f; |
|
|
|
|
|
|
|
width = iWidth; |
|
|
|
|
|
|
|
height = iHeight; |
|
|
|
|
|
|
|
|
|
|
|
SPR_AdjustSizei( &x, &y, &width, &height ); |
|
|
|
SPR_AdjustSize( &x, &y, &width, &height ); |
|
|
|
|
|
|
|
|
|
|
|
if( !paused ) |
|
|
|
if( !paused ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1170,10 +1163,6 @@ static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite, |
|
|
|
if( type == SPR_CLIENT || type == SPR_HUDSPRITE ) |
|
|
|
if( type == SPR_CLIENT || type == SPR_HUDSPRITE ) |
|
|
|
SetBits( m_pSprite->flags, MODEL_CLIENT ); |
|
|
|
SetBits( m_pSprite->flags, MODEL_CLIENT ); |
|
|
|
|
|
|
|
|
|
|
|
// force nearest filter for hud sprites to have less artifacts with hud_scale
|
|
|
|
|
|
|
|
if( type == SPR_HUDSPRITE ) |
|
|
|
|
|
|
|
SetBits( texFlags, TF_NEAREST ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pSprite->numtexinfo = texFlags; // store texFlags into numtexinfo
|
|
|
|
m_pSprite->numtexinfo = texFlags; // store texFlags into numtexinfo
|
|
|
|
|
|
|
|
|
|
|
|
if( !FS_FileExists( szSpriteName, false ) ) |
|
|
|
if( !FS_FileExists( szSpriteName, false ) ) |
|
|
|