mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-24 18:59:26 +01:00
client: min->Q_min, max->Q_max.
This commit is contained in:
parent
70bd3a2497
commit
745d722a5a
@ -152,7 +152,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
||||
pWeapon->hInactive = SPR_Load( sz );
|
||||
pWeapon->rcInactive = p->rc;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
else
|
||||
pWeapon->hInactive = 0;
|
||||
@ -174,7 +174,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
||||
pWeapon->hAmmo = SPR_Load( sz );
|
||||
pWeapon->rcAmmo = p->rc;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
else
|
||||
pWeapon->hAmmo = 0;
|
||||
@ -186,7 +186,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
||||
pWeapon->hAmmo2 = SPR_Load( sz );
|
||||
pWeapon->rcAmmo2 = p->rc;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
else
|
||||
pWeapon->hAmmo2 = 0;
|
||||
@ -320,7 +320,7 @@ int CHudAmmo::VidInit( void )
|
||||
giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left;
|
||||
giBucketHeight = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top );
|
||||
|
||||
// If we've already loaded weapons, let's get new sprites
|
||||
gWR.LoadAllWeaponSprites();
|
||||
@ -861,7 +861,7 @@ int CHudAmmo::Draw( float flTime )
|
||||
|
||||
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
|
||||
|
||||
a = (int)max( MIN_ALPHA, m_fFade );
|
||||
a = (int)Q_max( MIN_ALPHA, m_fFade );
|
||||
|
||||
if( m_fFade > 0 )
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
|
@ -61,7 +61,7 @@ int CHudAmmoSecondary::Draw( float flTime )
|
||||
// draw secondary ammo icons above normal ammo readout
|
||||
int a, x, y, r, g, b, AmmoWidth;
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
a = (int)max( MIN_ALPHA, m_fFade );
|
||||
a = (int)Q_max( MIN_ALPHA, m_fFade );
|
||||
if( m_fFade > 0 )
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 ); // slowly lower alpha to fade out icons
|
||||
ScaleColors( r, g, b, a );
|
||||
@ -142,7 +142,7 @@ int CHudAmmoSecondary::MsgFunc_SecAmmoVal( const char *pszName, int iSize, void
|
||||
int count = 0;
|
||||
for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
|
||||
{
|
||||
count += max( 0, m_iAmmoAmounts[i] );
|
||||
count += Q_max( 0, m_iAmmoAmounts[i] );
|
||||
}
|
||||
|
||||
if( count == 0 )
|
||||
|
@ -111,7 +111,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
{
|
||||
if( rgAmmoHistory[i].type )
|
||||
{
|
||||
rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
|
||||
rgAmmoHistory[i].DisplayTime = Q_min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
|
||||
|
||||
if( rgAmmoHistory[i].DisplayTime <= flTime )
|
||||
{
|
||||
@ -127,7 +127,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
int r, g, b;
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
ScaleColors( r, g, b, Q_min( scale, 255 ) );
|
||||
|
||||
// Draw the pic
|
||||
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
|
||||
@ -158,7 +158,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
UnpackRGB( r, g, b, RGB_REDISH ); // if the weapon doesn't have ammo, display it as red
|
||||
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
ScaleColors( r, g, b, Q_min( scale, 255 ) );
|
||||
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
|
||||
int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left );
|
||||
@ -176,7 +176,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
ScaleColors( r, g, b, Q_min( scale, 255 ) );
|
||||
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
|
||||
int xpos = ScreenWidth - ( rect.right - rect.left ) - 10;
|
||||
|
@ -78,7 +78,7 @@ int CHudBattery::Draw( float flTime )
|
||||
wrect_t rc;
|
||||
|
||||
rc = *m_prc2;
|
||||
rc.top += m_iHeight * ( (float)( 100 - ( min( 100,m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
||||
rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
||||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
|
||||
|
@ -148,8 +148,8 @@ inline void CenterPrint( const char *string )
|
||||
inline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }
|
||||
inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); }
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define Q_max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define Q_min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define fabs(x) ((x) > 0 ? (x) : 0 - (x))
|
||||
|
||||
void ScaleColors( int &r, int &g, int &b, int a );
|
||||
|
@ -106,7 +106,7 @@ int CHudDeathNotice::Draw( float flTime )
|
||||
continue;
|
||||
}
|
||||
|
||||
rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
|
||||
rgDeathNoticeList[i].flDisplayTime = Q_min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
|
||||
|
||||
// Only draw if the viewport will let me
|
||||
// vgui dropped out
|
||||
|
@ -273,25 +273,25 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom )
|
||||
if( side > 0 )
|
||||
{
|
||||
if( side > 0.3 )
|
||||
m_fAttackFront = max( m_fAttackFront, side );
|
||||
m_fAttackFront = Q_max( m_fAttackFront, side );
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = fabs( side );
|
||||
if( f > 0.3 )
|
||||
m_fAttackRear = max( m_fAttackRear, f );
|
||||
m_fAttackRear = Q_max( m_fAttackRear, f );
|
||||
}
|
||||
|
||||
if( front > 0 )
|
||||
{
|
||||
if( front > 0.3 )
|
||||
m_fAttackRight = max( m_fAttackRight, front );
|
||||
m_fAttackRight = Q_max( m_fAttackRight, front );
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = fabs( front );
|
||||
if( f > 0.3 )
|
||||
m_fAttackLeft = max( m_fAttackLeft, f );
|
||||
m_fAttackLeft = Q_max( m_fAttackLeft, f );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -313,28 +313,28 @@ int CHudHealth::DrawPain( float flTime )
|
||||
if( m_fAttackFront > 0.4 )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackFront, 0.5 );
|
||||
shade = a * Q_max( m_fAttackFront, 0.5 );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 0 ) / 2;
|
||||
y = ScreenHeight / 2 - SPR_Height( m_hSprite, 0 ) * 3;
|
||||
SPR_DrawAdditive( 0, x, y, NULL );
|
||||
m_fAttackFront = max( 0, m_fAttackFront - fFade );
|
||||
m_fAttackFront = Q_max( 0, m_fAttackFront - fFade );
|
||||
} else
|
||||
m_fAttackFront = 0;
|
||||
|
||||
if( m_fAttackRight > 0.4 )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackRight, 0.5 );
|
||||
shade = a * Q_max( m_fAttackRight, 0.5 );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
x = ScreenWidth / 2 + SPR_Width( m_hSprite, 1 ) * 2;
|
||||
y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2;
|
||||
SPR_DrawAdditive( 1, x, y, NULL );
|
||||
m_fAttackRight = max( 0, m_fAttackRight - fFade );
|
||||
m_fAttackRight = Q_max( 0, m_fAttackRight - fFade );
|
||||
}
|
||||
else
|
||||
m_fAttackRight = 0;
|
||||
@ -342,14 +342,14 @@ int CHudHealth::DrawPain( float flTime )
|
||||
if( m_fAttackRear > 0.4 )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackRear, 0.5 );
|
||||
shade = a * Q_max( m_fAttackRear, 0.5 );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 2 ) / 2;
|
||||
y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2;
|
||||
SPR_DrawAdditive( 2, x, y, NULL );
|
||||
m_fAttackRear = max( 0, m_fAttackRear - fFade );
|
||||
m_fAttackRear = Q_max( 0, m_fAttackRear - fFade );
|
||||
}
|
||||
else
|
||||
m_fAttackRear = 0;
|
||||
@ -357,7 +357,7 @@ int CHudHealth::DrawPain( float flTime )
|
||||
if( m_fAttackLeft > 0.4 )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackLeft, 0.5 );
|
||||
shade = a * Q_max( m_fAttackLeft, 0.5 );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
@ -365,7 +365,7 @@ int CHudHealth::DrawPain( float flTime )
|
||||
y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2;
|
||||
SPR_DrawAdditive( 3, x, y, NULL );
|
||||
|
||||
m_fAttackLeft = max( 0, m_fAttackLeft - fFade );
|
||||
m_fAttackLeft = Q_max( 0, m_fAttackLeft - fFade );
|
||||
} else
|
||||
m_fAttackLeft = 0;
|
||||
|
||||
@ -397,7 +397,7 @@ int CHudHealth::DrawDamage( float flTime )
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b );
|
||||
SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) );
|
||||
|
||||
pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
|
||||
pdmg->fExpire = Q_min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
|
||||
|
||||
if( pdmg->fExpire <= flTime // when the time has expired
|
||||
&& a < 40 ) // and the flash is at the low point of the cycle
|
||||
|
@ -75,7 +75,7 @@ void CHud::Think( void )
|
||||
if( m_iFOV == 0 )
|
||||
{
|
||||
// only let players adjust up in fov, and only if they are not overriden by something else
|
||||
m_iFOV = max( default_fov->value, 90 );
|
||||
m_iFOV = Q_max( default_fov->value, 90 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ int CHudSayText::Draw( float flTime )
|
||||
int y = Y_START;
|
||||
|
||||
// make sure the scrolltime is within reasonable bounds, to guard against the clock being reset
|
||||
flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );
|
||||
flScrollTime = Q_min( flScrollTime, flTime + m_HUD_saytext_time->value );
|
||||
|
||||
if( flScrollTime <= flTime )
|
||||
{
|
||||
@ -123,8 +123,8 @@ int CHudSayText::Draw( float flTime )
|
||||
static char buf[MAX_PLAYER_NAME_LENGTH + 32];
|
||||
|
||||
// draw the first x characters in the player color
|
||||
strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) );
|
||||
buf[min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0;
|
||||
strncpy( buf, g_szLineBuffer[i], Q_min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) );
|
||||
buf[Q_min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0;
|
||||
DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] );
|
||||
int x = DrawConsoleString( LINE_START, y, buf );
|
||||
|
||||
@ -193,7 +193,7 @@ void CHudSayText::SayTextPrint( const char *pszBuf, int iBufSize, int clientInde
|
||||
}
|
||||
}
|
||||
|
||||
strncpy( g_szLineBuffer[i], pszBuf, max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) );
|
||||
strncpy( g_szLineBuffer[i], pszBuf, Q_max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) );
|
||||
|
||||
// make sure the text fits in one line
|
||||
EnsureTextFitsInOneLineAndWrapIfHaveTo( i );
|
||||
|
@ -561,7 +561,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf
|
||||
if( g_TeamInfo[j].name[0] == '\0' )
|
||||
break;
|
||||
}
|
||||
m_iNumTeams = max( j, m_iNumTeams );
|
||||
m_iNumTeams = Q_max( j, m_iNumTeams );
|
||||
|
||||
strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME );
|
||||
g_TeamInfo[j].players = 0;
|
||||
|
@ -197,7 +197,7 @@ int CHudStatusBar::Draw( float fTime )
|
||||
// let user set status ID bar centering
|
||||
if( ( i == STATUSBAR_ID_LINE ) && CVAR_GET_FLOAT( "hud_centerid" ) )
|
||||
{
|
||||
x = max( 0, max( 2, ( ScreenWidth - TextWidth ) ) / 2 );
|
||||
x = Q_max( 0, Q_max( 2, ( ScreenWidth - TextWidth ) ) / 2 );
|
||||
y = ( ScreenHeight / 2 ) + ( TextHeight * CVAR_GET_FLOAT( "hud_centerid" ) );
|
||||
}
|
||||
|
||||
|
@ -213,8 +213,8 @@ float V_CalcBob( struct ref_params_s *pparams )
|
||||
|
||||
bob = sqrt( vel[0] * vel[0] + vel[1] * vel[1] ) * cl_bob->value;
|
||||
bob = bob * 0.3 + bob * 0.7 * sin(cycle);
|
||||
bob = min( bob, 4 );
|
||||
bob = max( bob, -7 );
|
||||
bob = Q_min( bob, 4 );
|
||||
bob = Q_max( bob, -7 );
|
||||
return bob;
|
||||
}
|
||||
|
||||
@ -708,7 +708,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
||||
if( dt > 0.0 )
|
||||
{
|
||||
frac = ( t - ViewInterp.OriginTime[foundidx & ORIGIN_MASK] ) / dt;
|
||||
frac = min( 1.0, frac );
|
||||
frac = Q_min( 1.0, frac );
|
||||
VectorSubtract( ViewInterp.Origins[( foundidx + 1 ) & ORIGIN_MASK], ViewInterp.Origins[foundidx & ORIGIN_MASK], delta );
|
||||
VectorMA( ViewInterp.Origins[foundidx & ORIGIN_MASK], frac, delta, neworg );
|
||||
|
||||
@ -1566,7 +1566,7 @@ void V_DropPunchAngle( float frametime, float *ev_punchangle )
|
||||
|
||||
len = VectorNormalize( ev_punchangle );
|
||||
len -= ( 10.0 + len * 0.5 ) * frametime;
|
||||
len = max( len, 0.0 );
|
||||
len = Q_max( len, 0.0 );
|
||||
VectorScale( ev_punchangle, len, ev_punchangle );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user