Merge branch 'master' into zombie-x

This commit is contained in:
Andrey Akhmichin 2019-08-12 04:17:22 +05:00
commit 9cd0edf291
15 changed files with 55 additions and 48 deletions

View File

@ -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();
@ -879,7 +879,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 );

View File

@ -60,8 +60,10 @@ 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, gHUD.m_iHUDColor ); //LRC
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 +144,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 )

View File

@ -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, gHUD.m_iHUDColor);
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, gHUD.m_iHUDColor);
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;

View File

@ -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, gHUD.m_iHUDColor);

View File

@ -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 );

View File

@ -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

View File

@ -275,25 +275,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 );
}
}
}
@ -315,28 +315,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;
@ -344,14 +344,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;
@ -359,7 +359,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 );
@ -367,7 +367,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;
@ -399,7 +399,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

View File

@ -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 );
}
}

View File

@ -96,10 +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 );
// 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 )
{
@ -126,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 );
@ -196,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 );

View File

@ -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;

View File

@ -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" ) );
}

View File

@ -215,8 +215,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;
}
@ -737,7 +737,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 );
@ -1610,7 +1610,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 );
}

View File

@ -354,8 +354,6 @@ public:
}
void TabulateAmmo( void );
Vector m_vecLastViewAngles;
float m_flStartCharge;
float m_flAmmoStartCharge;
float m_flPlayAftershock;
@ -373,6 +371,7 @@ public:
float m_flNextChatTime;
int m_iNextTeam;
Vector m_vecLastViewAngles;
bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message.
};

View File

@ -110,7 +110,11 @@ typedef int BOOL;
// The _declspec forces them to be exported by name so we can do a lookup with GetProcAddress()
// The function is used to intialize / allocate the object for the entity
#if defined(CLIENT_DLL)
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName)
#else // CLIENT_DLL
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" EXPORT void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); }
#endif // CLIENT_DLL
//
// Conversion among the three types of "entity", including identity-conversions.

View File

@ -64,7 +64,7 @@ class Android:
else:
self.ndk_rev = 10
if self.ndk_rev not in [10, 19]:
if self.ndk_rev not in [10, 19, 20]:
ctx.fatal('Unknown NDK revision: {}'.format(self.ndk_rev))
self.arch = arch
@ -197,7 +197,10 @@ class Android:
return os.path.abspath(os.path.join(self.ndk_home, path))
def cflags(self):
cflags = ['--sysroot={0}'.format(self.sysroot()), '-DANDROID', '-D__ANDROID__']
cflags = []
if self.ndk_rev < 20:
cflags = ['--sysroot={0}'.format(self.sysroot())]
cflags += ['-DANDROID', '-D__ANDROID__']
cflags += ['-I{0}'.format(self.system_stl())]
if self.is_arm():
if self.arch == 'armeabi-v7a':
@ -218,7 +221,9 @@ class Android:
# they go before object list
def linkflags(self):
linkflags = ['--sysroot={0}'.format(self.sysroot())]
linkflags = []
if self.ndk_rev < 20:
linkflags = ['--sysroot={0}'.format(self.sysroot())]
return linkflags
def ldflags(self):
@ -277,7 +282,7 @@ def configure(conf):
def post_compiler_cxx_configure(conf):
if conf.options.ANDROID_OPTS:
if conf.android.ndk_rev >= 19:
if conf.android.ndk_rev == 19:
conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++']
conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++']
return