game: change min()->MIN() and max()->MAX()

This commit is contained in:
SanyaSho 2022-08-10 20:32:45 +03:00
parent 15921cfe28
commit 12a8b08267
11 changed files with 75 additions and 75 deletions

View File

@ -117,7 +117,7 @@ void C_PlayerAttachedModel::ClientThink( void )
if ( m_iFlags & PAM_SCALEUP )
{
m_flScale = min( m_flScale + (gpGlobals->frametime * PAM_SCALE_SPEED), PAM_MAX_SCALE );
m_flScale = MIN( m_flScale + (gpGlobals->frametime * PAM_SCALE_SPEED), PAM_MAX_SCALE );
}
}
@ -134,4 +134,4 @@ void C_PlayerAttachedModel::ApplyBoneMatrixTransform( matrix3x4_t& transform )
VectorScale( transform[0], m_flScale, transform[0] );
VectorScale( transform[1], m_flScale, transform[1] );
VectorScale( transform[2], m_flScale, transform[2] );
}
}

View File

@ -54,9 +54,9 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
int y = 0;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = y + coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
@ -75,9 +75,9 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
yMult = 1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = y + coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
@ -95,10 +95,10 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = y - coord[NumSegments];
y2 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
@ -115,10 +115,10 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = y - coord[NumSegments];
y2 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
@ -166,10 +166,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
int y = 0;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
@ -187,10 +187,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
yMult = 1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
@ -207,10 +207,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;
@ -227,10 +227,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
yMult = -1;
for ( i=0; i<NumSegments; ++i )
{
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir;
yIndex += yDir;

View File

@ -638,7 +638,7 @@ bool CTFMapOverview::DrawCapturePoint( int iCP, MapObject_t *obj )
if ( requiredPlayers > 1 )
{
numPlayers = min( numPlayers, requiredPlayers );
numPlayers = MIN( numPlayers, requiredPlayers );
wchar_t wText[6];
_snwprintf( wText, sizeof(wText)/sizeof(wchar_t), L"%d", numPlayers );
@ -856,4 +856,4 @@ void CTFMapOverview::UpdateMapOverlayTexture()
return;
}
*/
}
}

View File

@ -139,7 +139,7 @@ void CTFHLTVDirector::CreateShotFromEvent( CHLTVGameEvent *event )
}
// shot 2 seconds after event
m_nNextShotTick = min( m_nNextShotTick, (event->m_Tick+TIME_TO_TICKS(1.0)) );
m_nNextShotTick = MIN( m_nNextShotTick, (event->m_Tick+TIME_TO_TICKS(1.0)) );
}
else if ( !Q_strcmp( "object_destroyed", name ) )
{
@ -227,4 +227,4 @@ CHLTVDirector* HLTVDirector()
IGameSystem* HLTVDirectorSystem()
{
return &s_HLTVDirector;
}
}

View File

@ -534,14 +534,14 @@ bool CBaseObject::EstimateValidBuildPos( void )
// Adjust build distance based upon object size
Vector2D vecObjectRadius;
vecObjectRadius.x = max( fabs( m_vecBuildMins.m_Value.x ), fabs( m_vecBuildMaxs.m_Value.x ) );
vecObjectRadius.y = max( fabs( m_vecBuildMins.m_Value.y ), fabs( m_vecBuildMaxs.m_Value.y ) );
vecObjectRadius.x = MAX( fabs( m_vecBuildMins.m_Value.x ), fabs( m_vecBuildMaxs.m_Value.x ) );
vecObjectRadius.y = MAX( fabs( m_vecBuildMins.m_Value.y ), fabs( m_vecBuildMaxs.m_Value.y ) );
Vector2D vecPlayerRadius;
Vector vecPlayerMins = pPlayer->WorldAlignMins();
Vector vecPlayerMaxs = pPlayer->WorldAlignMaxs();
vecPlayerRadius.x = max( fabs( vecPlayerMins.x ), fabs( vecPlayerMaxs.x ) );
vecPlayerRadius.y = max( fabs( vecPlayerMins.y ), fabs( vecPlayerMaxs.y ) );
vecPlayerRadius.x = MAX( fabs( vecPlayerMins.x ), fabs( vecPlayerMaxs.x ) );
vecPlayerRadius.y = MAX( fabs( vecPlayerMins.y ), fabs( vecPlayerMaxs.y ) );
float flDistance = vecObjectRadius.Length() + vecPlayerRadius.Length() + 4; // small safety buffer
Vector vecBuildOrigin = pPlayer->WorldSpaceCenter() + forward * flDistance;
@ -688,7 +688,7 @@ float CBaseObject::GetTotalTime( void )
float flBuildTime = GetObjectInfo( ObjectType() )->m_flBuildTime;
if (tf_fastbuild.GetInt())
return ( min( 2.f, flBuildTime ) );
return ( MIN( 2.f, flBuildTime ) );
return flBuildTime;
}
@ -765,7 +765,7 @@ bool CBaseObject::FindNearestBuildPoint( CBaseEntity *pEntity, CBasePlayer *pBui
float flDist = (vecBPOrigin - pBuilder->GetAbsOrigin()).Length();
// if this is closer, or is the first one in our view, check it out
if ( flDist < min(flNearestPoint, pBPInterface->GetMaxSnapDistance( i )) )
if ( flDist < MIN(flNearestPoint, pBPInterface->GetMaxSnapDistance( i )) )
{
flNearestPoint = flDist;
vecNearestBuildPoint = vecBPOrigin;
@ -1592,13 +1592,13 @@ bool CBaseObject::Repair( float flHealth )
{
// Reduce the construction time by the correct amount for the health passed in
float flConstructionTime = flHealth / ((GetMaxHealth() - OBJECT_CONSTRUCTION_STARTINGHEALTH) / m_flTotalConstructionTime);
m_flConstructionTimeLeft = max( 0, m_flConstructionTimeLeft - flConstructionTime);
m_flConstructionTimeLeft = MAX( 0, m_flConstructionTimeLeft - flConstructionTime);
m_flConstructionTimeLeft = clamp( m_flConstructionTimeLeft, 0.0f, m_flTotalConstructionTime );
m_flPercentageConstructed = 1 - (m_flConstructionTimeLeft / m_flTotalConstructionTime);
m_flPercentageConstructed = clamp( m_flPercentageConstructed, 0.0f, 1.0f );
// Increase health.
SetHealth( min( GetMaxHealth(), m_flHealth + flHealth ) );
SetHealth( MIN( GetMaxHealth(), m_flHealth + flHealth ) );
// Return true if we're constructed now
if ( m_flConstructionTimeLeft <= 0.0f )
@ -1614,7 +1614,7 @@ bool CBaseObject::Repair( float flHealth )
return true;
// Increase health.
SetHealth( min( GetMaxHealth(), m_flHealth + flHealth ) );
SetHealth( MIN( GetMaxHealth(), m_flHealth + flHealth ) );
m_OnRepaired.FireOutput( this, this);
@ -1960,7 +1960,7 @@ void CBaseObject::InputSetHealth( inputdata_t &inputdata )
void CBaseObject::InputAddHealth( inputdata_t &inputdata )
{
int iHealth = inputdata.value.Int();
SetHealth( min( GetMaxHealth(), m_flHealth + iHealth ) );
SetHealth( MIN( GetMaxHealth(), m_flHealth + iHealth ) );
}
//-----------------------------------------------------------------------------
@ -2068,7 +2068,7 @@ bool CBaseObject::OnWrenchHit( CTFPlayer *pPlayer )
//-----------------------------------------------------------------------------
bool CBaseObject::Command_Repair( CTFPlayer *pActivator )
{
int iAmountToHeal = min( 100, GetMaxHealth() - GetHealth() );
int iAmountToHeal = MIN( 100, GetMaxHealth() - GetHealth() );
// repair the building
int iRepairCost = ceil( (float)( iAmountToHeal ) * 0.2f );
@ -2087,7 +2087,7 @@ bool CBaseObject::Command_Repair( CTFPlayer *pActivator )
pActivator->RemoveBuildResources( iRepairCost );
float flNewHealth = min( GetMaxHealth(), m_flHealth + ( iRepairCost * 5 ) );
float flNewHealth = MIN( GetMaxHealth(), m_flHealth + ( iRepairCost * 5 ) );
SetHealth( flNewHealth );
return ( iRepairCost > 0 );

View File

@ -2553,7 +2553,7 @@ int CTFPlayer::OnTakeDamage( const CTakeDamageInfo &inputInfo )
if ( bitsDamage & DMG_USEDISTANCEMOD )
{
float flDistance = max( 1.0, (WorldSpaceCenter() - info.GetAttacker()->WorldSpaceCenter()).Length() );
float flDistance = MAX( 1.0, (WorldSpaceCenter() - info.GetAttacker()->WorldSpaceCenter()).Length() );
float flOptimalDistance = 512.0;
flCenter = RemapValClamped( flDistance / flOptimalDistance, 0.0, 2.0, 1.0, 0.0 );
@ -2565,8 +2565,8 @@ int CTFPlayer::OnTakeDamage( const CTakeDamageInfo &inputInfo )
flCenter = RemapVal( flCenter, 0.5, 1.0, 0.5, 0.65 );
}
}
flMin = max( 0.0, flCenter - 0.25 );
flMax = min( 1.0, flCenter + 0.25 );
flMin = MAX( 0.0, flCenter - 0.25 );
flMax = MIN( 1.0, flCenter + 0.25 );
if ( bDebug )
{
@ -2901,7 +2901,7 @@ int CTFPlayer::OnTakeDamage_Alive( const CTakeDamageInfo &info )
if ( event )
{
event->SetInt( "userid", GetUserID() );
event->SetInt( "health", max( 0, m_iHealth ) );
event->SetInt( "health", MAX( 0, m_iHealth ) );
// HLTV event priority, not transmitted
event->SetInt( "priority", 5 );
@ -3428,9 +3428,9 @@ void CTFPlayer::DropAmmoPack( void )
return;
// Fill the ammo pack with unused player ammo, if out add a minimum amount.
int iPrimary = max( 5, GetAmmoCount( TF_AMMO_PRIMARY ) );
int iSecondary = max( 5, GetAmmoCount( TF_AMMO_SECONDARY ) );
int iMetal = max( 5, GetAmmoCount( TF_AMMO_METAL ) );
int iPrimary = MAX( 5, GetAmmoCount( TF_AMMO_PRIMARY ) );
int iSecondary = MAX( 5, GetAmmoCount( TF_AMMO_SECONDARY ) );
int iMetal = MAX( 5, GetAmmoCount( TF_AMMO_METAL ) );
// Create the ammo pack.
CTFAmmoPack *pAmmoPack = CTFAmmoPack::Create( vecPackOrigin, vecPackAngles, this, pszWorldModel );
@ -4122,7 +4122,7 @@ int CTFPlayer::GiveAmmo( int iCount, int iAmmoIndex, bool bSuppressSound )
}
int iMax = m_PlayerClass.GetData()->m_aAmmoMax[iAmmoIndex];
int iAdd = min( iCount, iMax - GetAmmoCount(iAmmoIndex) );
int iAdd = MIN( iCount, iMax - GetAmmoCount(iAmmoIndex) );
if ( iAdd < 1 )
{
return 0;
@ -4591,7 +4591,7 @@ void CTFPlayer::PainSound( const CTakeDamageInfo &info )
if ( SpeakConceptIfAllowed( MP_CONCEPT_PLAYER_PAIN, "damagecritical:1", szResponse, AI_Response::MAX_RESPONSE_NAME, &filter ) )
{
flPainLength = max( GetSceneDuration( szResponse ), flPainLength );
flPainLength = MAX( GetSceneDuration( szResponse ), flPainLength );
}
// speak a louder pain concept to just the attacker
@ -5789,7 +5789,7 @@ bool CTFPlayer::CanSpeakVoiceCommand( void )
void CTFPlayer::NoteSpokeVoiceCommand( const char *pszScenePlayed )
{
Assert( pszScenePlayed );
m_flNextVoiceCommandTime = gpGlobals->curtime + min( GetSceneDuration( pszScenePlayed ), tf_max_voice_speak_delay.GetFloat() );
m_flNextVoiceCommandTime = gpGlobals->curtime + MIN( GetSceneDuration( pszScenePlayed ), tf_max_voice_speak_delay.GetFloat() );
}
//-----------------------------------------------------------------------------

View File

@ -918,7 +918,7 @@ void CTFGameRules::RadiusDamage( const CTakeDamageInfo &info, const Vector &vecS
float flToWorldSpaceCenter = ( vecSrc - pEntity->WorldSpaceCenter() ).Length();
float flToOrigin = ( vecSrc - pEntity->GetAbsOrigin() ).Length();
flDistanceToEntity = min( flToWorldSpaceCenter, flToOrigin );
flDistanceToEntity = MIN( flToWorldSpaceCenter, flToOrigin );
}
else
{
@ -2158,7 +2158,7 @@ void CTFGameRules::SendWinPanelInfo( void )
vecPlayerScore.Sort( PlayerRoundScoreSortFunc );
// set the top (up to) 3 players by round score in the event data
int numPlayers = min( 3, vecPlayerScore.Count() );
int numPlayers = MIN( 3, vecPlayerScore.Count() );
for ( int i = 0; i < numPlayers; i++ )
{
// only include players who have non-zero points this round; if we get to a player with 0 round points, stop
@ -2806,7 +2806,7 @@ int CTFGameRules::CalcPlayerScore( RoundStats_t *pRoundStats )
( pRoundStats->m_iStat[TFSTAT_TELEPORTS] / TF_SCORE_TELEPORTS_PER_POINT ) +
( pRoundStats->m_iStat[TFSTAT_INVULNS] / TF_SCORE_INVULN ) +
( pRoundStats->m_iStat[TFSTAT_REVENGE] / TF_SCORE_REVENGE );
return max( iScore, 0 );
return MAX( iScore, 0 );
}
//-----------------------------------------------------------------------------

View File

@ -518,7 +518,7 @@ void CTFPlayerShared::ConditionGameRulesThink( void )
flReduction += (m_aHealers.Count() * flReduction * 4);
}
m_flCondExpireTimeLeft[i] = max( m_flCondExpireTimeLeft[i] - flReduction, 0 );
m_flCondExpireTimeLeft[i] = MAX( m_flCondExpireTimeLeft[i] - flReduction, 0 );
if ( m_flCondExpireTimeLeft[i] == 0 )
{
@ -2069,7 +2069,7 @@ void CTFPlayer::TeamFortress_SetSpeed()
if ( m_Shared.InCond( TF_COND_DISGUISED ) && !m_Shared.InCond( TF_COND_STEALTHED ) )
{
float flMaxDisguiseSpeed = GetPlayerClassData( m_Shared.GetDisguiseClass() )->m_flMaxSpeed;
maxfbspeed = min( flMaxDisguiseSpeed, maxfbspeed );
maxfbspeed = MIN( flMaxDisguiseSpeed, maxfbspeed );
}
// Second, see if any flags are slowing them down

View File

@ -575,7 +575,7 @@ bool CWeaponMedigun::FindAndHealTargets( void )
flChargeAmount /= (float)iTotalHealers;
}
float flNewLevel = min( m_flChargeLevel + flChargeAmount, 1.0 );
float flNewLevel = MIN( m_flChargeLevel + flChargeAmount, 1.0 );
#ifdef GAME_DLL
if ( flNewLevel >= 1.0 && m_flChargeLevel < 1.0 )
{
@ -619,7 +619,7 @@ void CWeaponMedigun::DrainCharge( void )
return;
float flChargeAmount = gpGlobals->frametime / weapon_medigun_chargerelease_rate.GetFloat();
m_flChargeLevel = max( m_flChargeLevel - flChargeAmount, 0.0 );
m_flChargeLevel = MAX( m_flChargeLevel - flChargeAmount, 0.0 );
if ( !m_flChargeLevel )
{
m_bChargeRelease = false;

View File

@ -229,7 +229,7 @@ void CTFSniperRifle::HandleZooms( void )
{
if ( gpGlobals->curtime > m_flRezoomTime )
{
ZoomIn();
ZoomIn();
m_flRezoomTime = -1;
}
}
@ -300,11 +300,11 @@ void CTFSniperRifle::ItemPostFrame( void )
// Don't start charging in the time just after a shot before we unzoom to play rack anim.
if ( pPlayer->m_Shared.InCond( TF_COND_AIMING ) && !m_bRezoomAfterShot )
{
m_flChargedDamage = min( m_flChargedDamage + gpGlobals->frametime * TF_WEAPON_SNIPERRIFLE_CHARGE_PER_SEC, TF_WEAPON_SNIPERRIFLE_DAMAGE_MAX );
m_flChargedDamage = MIN( m_flChargedDamage + gpGlobals->frametime * TF_WEAPON_SNIPERRIFLE_CHARGE_PER_SEC, TF_WEAPON_SNIPERRIFLE_DAMAGE_MAX );
}
else
{
m_flChargedDamage = max( 0, m_flChargedDamage - gpGlobals->frametime * TF_WEAPON_SNIPERRIFLE_UNCHARGE_PER_SEC );
m_flChargedDamage = MAX( 0, m_flChargedDamage - gpGlobals->frametime * TF_WEAPON_SNIPERRIFLE_UNCHARGE_PER_SEC );
}
}
@ -359,7 +359,7 @@ void CTFSniperRifle::Zoom( void )
ToggleZoom();
// at least 0.1 seconds from now, but don't stomp a previous value
m_flNextPrimaryAttack = max( m_flNextPrimaryAttack, gpGlobals->curtime + 0.1 );
m_flNextPrimaryAttack = MAX( m_flNextPrimaryAttack, gpGlobals->curtime + 0.1 );
m_flNextSecondaryAttack = gpGlobals->curtime + TF_WEAPON_SNIPERRIFLE_ZOOM_TIME;
}
@ -512,7 +512,7 @@ void CTFSniperRifle::SetRezoom( bool bRezoom, float flDelay )
float CTFSniperRifle::GetProjectileDamage( void )
{
// Uncharged? Min damage.
return max( m_flChargedDamage, TF_WEAPON_SNIPERRIFLE_DAMAGE_MIN );
return MAX( m_flChargedDamage, TF_WEAPON_SNIPERRIFLE_DAMAGE_MIN );
}
//-----------------------------------------------------------------------------

View File

@ -396,7 +396,7 @@ bool CTFWeaponBase::Deploy( void )
// Don't override primary attacks that are already further out than this. This prevents
// people exploiting weapon switches to allow weapons to fire faster.
float flDeployTime = 0.67;
m_flNextPrimaryAttack = max( flOriginalPrimaryAttack, gpGlobals->curtime + flDeployTime );
m_flNextPrimaryAttack = MAX( flOriginalPrimaryAttack, gpGlobals->curtime + flDeployTime );
CTFPlayer *pPlayer = ToTFPlayer( GetOwner() );
if (!pPlayer)
@ -653,7 +653,7 @@ bool CTFWeaponBase::ReloadSingly( void )
// If we have ammo, remove ammo and add it to clip
if ( pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) > 0 && !m_bReloadedThroughAnimEvent )
{
m_iClip1 = min( ( m_iClip1 + 1 ), GetMaxClip1() );
m_iClip1 = MIN( ( m_iClip1 + 1 ), GetMaxClip1() );
pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType );
}
@ -699,7 +699,7 @@ void CTFWeaponBase::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCh
{
if ( pOperator->GetAmmoCount( m_iPrimaryAmmoType ) > 0 && !m_bReloadedThroughAnimEvent )
{
m_iClip1 = min( ( m_iClip1 + 1 ), GetMaxClip1() );
m_iClip1 = MIN( ( m_iClip1 + 1 ), GetMaxClip1() );
pOperator->RemoveAmmo( 1, m_iPrimaryAmmoType );
}
@ -727,7 +727,7 @@ bool CTFWeaponBase::DefaultReload( int iClipSize1, int iClipSize2, int iActivity
if ( UsesClipsForAmmo1() )
{
// need to reload primary clip?
int primary = min( iClipSize1 - m_iClip1, pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) );
int primary = MIN( iClipSize1 - m_iClip1, pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) );
if ( primary != 0 )
{
bReloadPrimary = true;
@ -737,7 +737,7 @@ bool CTFWeaponBase::DefaultReload( int iClipSize1, int iClipSize2, int iActivity
if ( UsesClipsForAmmo2() )
{
// need to reload secondary clip?
int secondary = min( iClipSize2 - m_iClip2, pPlayer->GetAmmoCount( m_iSecondaryAmmoType ) );
int secondary = MIN( iClipSize2 - m_iClip2, pPlayer->GetAmmoCount( m_iSecondaryAmmoType ) );
if ( secondary != 0 )
{
bReloadSecondary = true;
@ -1876,7 +1876,7 @@ float CalcViewModelBobHelper( CBasePlayer *player, BobState_t *pBobState )
//Find the speed of the player
float speed = player->GetLocalVelocity().Length2D();
float flmaxSpeedDelta = max( 0, (gpGlobals->curtime - pBobState->m_flLastBobTime ) * 320.0f );
float flmaxSpeedDelta = MAX( 0, (gpGlobals->curtime - pBobState->m_flLastBobTime ) * 320.0f );
// don't allow too big speed changes
speed = clamp( speed, pBobState->m_flLastSpeed-flmaxSpeedDelta, pBobState->m_flLastSpeed+flmaxSpeedDelta );
@ -2084,7 +2084,7 @@ bool CTFWeaponBase::OnFireEvent( C_BaseViewModel *pViewModel, const Vector& orig
if ( pPlayer && pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) > 0 && !m_bReloadedThroughAnimEvent )
{
m_iClip1 = min( ( m_iClip1 + 1 ), GetMaxClip1() );
m_iClip1 = MIN( ( m_iClip1 + 1 ), GetMaxClip1() );
pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType );
}