mirror of
https://github.com/nillerusr/source-engine.git
synced 2025-04-25 04:17:29 +00:00
game: change min()->MIN() and max()->MAX()
This commit is contained in:
parent
15921cfe28
commit
12a8b08267
@ -117,7 +117,7 @@ void C_PlayerAttachedModel::ClientThink( void )
|
|||||||
|
|
||||||
if ( m_iFlags & PAM_SCALEUP )
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
|
|||||||
int y = 0;
|
int y = 0;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
y1 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
||||||
y2 = y + coord[NumSegments];
|
y2 = y + coord[NumSegments];
|
||||||
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
|
|
||||||
@ -75,9 +75,9 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
|
|||||||
yMult = 1;
|
yMult = 1;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
y1 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
||||||
y2 = y + coord[NumSegments];
|
y2 = y + coord[NumSegments];
|
||||||
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
xIndex += xDir;
|
xIndex += xDir;
|
||||||
@ -95,10 +95,10 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
|
|||||||
yMult = -1;
|
yMult = -1;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = y - coord[NumSegments];
|
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 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
xIndex += xDir;
|
xIndex += xDir;
|
||||||
yIndex += yDir;
|
yIndex += yDir;
|
||||||
@ -115,10 +115,10 @@ void DrawRoundedBackground( Color bgColor, int wide, int tall )
|
|||||||
yMult = -1;
|
yMult = -1;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = y - coord[NumSegments];
|
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 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
xIndex += xDir;
|
xIndex += xDir;
|
||||||
yIndex += yDir;
|
yIndex += yDir;
|
||||||
@ -166,10 +166,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
|
|||||||
int y = 0;
|
int y = 0;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
||||||
y2 = max( 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 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
|
|
||||||
xIndex += xDir;
|
xIndex += xDir;
|
||||||
@ -187,10 +187,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
|
|||||||
yMult = 1;
|
yMult = 1;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
||||||
y2 = max( 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 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
xIndex += xDir;
|
xIndex += xDir;
|
||||||
yIndex += yDir;
|
yIndex += yDir;
|
||||||
@ -207,10 +207,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
|
|||||||
yMult = -1;
|
yMult = -1;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
||||||
y2 = max( 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 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
xIndex += xDir;
|
xIndex += xDir;
|
||||||
yIndex += yDir;
|
yIndex += yDir;
|
||||||
@ -227,10 +227,10 @@ void DrawRoundedBorder( Color borderColor, int wide, int tall )
|
|||||||
yMult = -1;
|
yMult = -1;
|
||||||
for ( i=0; i<NumSegments; ++i )
|
for ( i=0; i<NumSegments; ++i )
|
||||||
{
|
{
|
||||||
x1 = min( 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 );
|
x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
|
||||||
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
|
||||||
y2 = max( 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 );
|
surface()->DrawFilledRect( x1, y1, x2, y2 );
|
||||||
xIndex += xDir;
|
xIndex += xDir;
|
||||||
yIndex += yDir;
|
yIndex += yDir;
|
||||||
|
@ -638,7 +638,7 @@ bool CTFMapOverview::DrawCapturePoint( int iCP, MapObject_t *obj )
|
|||||||
|
|
||||||
if ( requiredPlayers > 1 )
|
if ( requiredPlayers > 1 )
|
||||||
{
|
{
|
||||||
numPlayers = min( numPlayers, requiredPlayers );
|
numPlayers = MIN( numPlayers, requiredPlayers );
|
||||||
|
|
||||||
wchar_t wText[6];
|
wchar_t wText[6];
|
||||||
_snwprintf( wText, sizeof(wText)/sizeof(wchar_t), L"%d", numPlayers );
|
_snwprintf( wText, sizeof(wText)/sizeof(wchar_t), L"%d", numPlayers );
|
||||||
|
@ -139,7 +139,7 @@ void CTFHLTVDirector::CreateShotFromEvent( CHLTVGameEvent *event )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// shot 2 seconds after 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 ) )
|
else if ( !Q_strcmp( "object_destroyed", name ) )
|
||||||
{
|
{
|
||||||
|
@ -534,14 +534,14 @@ bool CBaseObject::EstimateValidBuildPos( void )
|
|||||||
|
|
||||||
// Adjust build distance based upon object size
|
// Adjust build distance based upon object size
|
||||||
Vector2D vecObjectRadius;
|
Vector2D vecObjectRadius;
|
||||||
vecObjectRadius.x = max( fabs( m_vecBuildMins.m_Value.x ), fabs( m_vecBuildMaxs.m_Value.x ) );
|
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.y = MAX( fabs( m_vecBuildMins.m_Value.y ), fabs( m_vecBuildMaxs.m_Value.y ) );
|
||||||
|
|
||||||
Vector2D vecPlayerRadius;
|
Vector2D vecPlayerRadius;
|
||||||
Vector vecPlayerMins = pPlayer->WorldAlignMins();
|
Vector vecPlayerMins = pPlayer->WorldAlignMins();
|
||||||
Vector vecPlayerMaxs = pPlayer->WorldAlignMaxs();
|
Vector vecPlayerMaxs = pPlayer->WorldAlignMaxs();
|
||||||
vecPlayerRadius.x = max( fabs( vecPlayerMins.x ), fabs( vecPlayerMaxs.x ) );
|
vecPlayerRadius.x = MAX( fabs( vecPlayerMins.x ), fabs( vecPlayerMaxs.x ) );
|
||||||
vecPlayerRadius.y = max( fabs( vecPlayerMins.y ), fabs( vecPlayerMaxs.y ) );
|
vecPlayerRadius.y = MAX( fabs( vecPlayerMins.y ), fabs( vecPlayerMaxs.y ) );
|
||||||
|
|
||||||
float flDistance = vecObjectRadius.Length() + vecPlayerRadius.Length() + 4; // small safety buffer
|
float flDistance = vecObjectRadius.Length() + vecPlayerRadius.Length() + 4; // small safety buffer
|
||||||
Vector vecBuildOrigin = pPlayer->WorldSpaceCenter() + forward * flDistance;
|
Vector vecBuildOrigin = pPlayer->WorldSpaceCenter() + forward * flDistance;
|
||||||
@ -688,7 +688,7 @@ float CBaseObject::GetTotalTime( void )
|
|||||||
float flBuildTime = GetObjectInfo( ObjectType() )->m_flBuildTime;
|
float flBuildTime = GetObjectInfo( ObjectType() )->m_flBuildTime;
|
||||||
|
|
||||||
if (tf_fastbuild.GetInt())
|
if (tf_fastbuild.GetInt())
|
||||||
return ( min( 2.f, flBuildTime ) );
|
return ( MIN( 2.f, flBuildTime ) );
|
||||||
|
|
||||||
return flBuildTime;
|
return flBuildTime;
|
||||||
}
|
}
|
||||||
@ -765,7 +765,7 @@ bool CBaseObject::FindNearestBuildPoint( CBaseEntity *pEntity, CBasePlayer *pBui
|
|||||||
float flDist = (vecBPOrigin - pBuilder->GetAbsOrigin()).Length();
|
float flDist = (vecBPOrigin - pBuilder->GetAbsOrigin()).Length();
|
||||||
|
|
||||||
// if this is closer, or is the first one in our view, check it out
|
// 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;
|
flNearestPoint = flDist;
|
||||||
vecNearestBuildPoint = vecBPOrigin;
|
vecNearestBuildPoint = vecBPOrigin;
|
||||||
@ -1592,13 +1592,13 @@ bool CBaseObject::Repair( float flHealth )
|
|||||||
{
|
{
|
||||||
// Reduce the construction time by the correct amount for the health passed in
|
// Reduce the construction time by the correct amount for the health passed in
|
||||||
float flConstructionTime = flHealth / ((GetMaxHealth() - OBJECT_CONSTRUCTION_STARTINGHEALTH) / m_flTotalConstructionTime);
|
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_flConstructionTimeLeft = clamp( m_flConstructionTimeLeft, 0.0f, m_flTotalConstructionTime );
|
||||||
m_flPercentageConstructed = 1 - (m_flConstructionTimeLeft / m_flTotalConstructionTime);
|
m_flPercentageConstructed = 1 - (m_flConstructionTimeLeft / m_flTotalConstructionTime);
|
||||||
m_flPercentageConstructed = clamp( m_flPercentageConstructed, 0.0f, 1.0f );
|
m_flPercentageConstructed = clamp( m_flPercentageConstructed, 0.0f, 1.0f );
|
||||||
|
|
||||||
// Increase health.
|
// Increase health.
|
||||||
SetHealth( min( GetMaxHealth(), m_flHealth + flHealth ) );
|
SetHealth( MIN( GetMaxHealth(), m_flHealth + flHealth ) );
|
||||||
|
|
||||||
// Return true if we're constructed now
|
// Return true if we're constructed now
|
||||||
if ( m_flConstructionTimeLeft <= 0.0f )
|
if ( m_flConstructionTimeLeft <= 0.0f )
|
||||||
@ -1614,7 +1614,7 @@ bool CBaseObject::Repair( float flHealth )
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Increase health.
|
// Increase health.
|
||||||
SetHealth( min( GetMaxHealth(), m_flHealth + flHealth ) );
|
SetHealth( MIN( GetMaxHealth(), m_flHealth + flHealth ) );
|
||||||
|
|
||||||
m_OnRepaired.FireOutput( this, this);
|
m_OnRepaired.FireOutput( this, this);
|
||||||
|
|
||||||
@ -1960,7 +1960,7 @@ void CBaseObject::InputSetHealth( inputdata_t &inputdata )
|
|||||||
void CBaseObject::InputAddHealth( inputdata_t &inputdata )
|
void CBaseObject::InputAddHealth( inputdata_t &inputdata )
|
||||||
{
|
{
|
||||||
int iHealth = inputdata.value.Int();
|
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 )
|
bool CBaseObject::Command_Repair( CTFPlayer *pActivator )
|
||||||
{
|
{
|
||||||
int iAmountToHeal = min( 100, GetMaxHealth() - GetHealth() );
|
int iAmountToHeal = MIN( 100, GetMaxHealth() - GetHealth() );
|
||||||
|
|
||||||
// repair the building
|
// repair the building
|
||||||
int iRepairCost = ceil( (float)( iAmountToHeal ) * 0.2f );
|
int iRepairCost = ceil( (float)( iAmountToHeal ) * 0.2f );
|
||||||
@ -2087,7 +2087,7 @@ bool CBaseObject::Command_Repair( CTFPlayer *pActivator )
|
|||||||
|
|
||||||
pActivator->RemoveBuildResources( iRepairCost );
|
pActivator->RemoveBuildResources( iRepairCost );
|
||||||
|
|
||||||
float flNewHealth = min( GetMaxHealth(), m_flHealth + ( iRepairCost * 5 ) );
|
float flNewHealth = MIN( GetMaxHealth(), m_flHealth + ( iRepairCost * 5 ) );
|
||||||
SetHealth( flNewHealth );
|
SetHealth( flNewHealth );
|
||||||
|
|
||||||
return ( iRepairCost > 0 );
|
return ( iRepairCost > 0 );
|
||||||
|
@ -2553,7 +2553,7 @@ int CTFPlayer::OnTakeDamage( const CTakeDamageInfo &inputInfo )
|
|||||||
|
|
||||||
if ( bitsDamage & DMG_USEDISTANCEMOD )
|
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;
|
float flOptimalDistance = 512.0;
|
||||||
|
|
||||||
flCenter = RemapValClamped( flDistance / flOptimalDistance, 0.0, 2.0, 1.0, 0.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 );
|
flCenter = RemapVal( flCenter, 0.5, 1.0, 0.5, 0.65 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flMin = max( 0.0, flCenter - 0.25 );
|
flMin = MAX( 0.0, flCenter - 0.25 );
|
||||||
flMax = min( 1.0, flCenter + 0.25 );
|
flMax = MIN( 1.0, flCenter + 0.25 );
|
||||||
|
|
||||||
if ( bDebug )
|
if ( bDebug )
|
||||||
{
|
{
|
||||||
@ -2901,7 +2901,7 @@ int CTFPlayer::OnTakeDamage_Alive( const CTakeDamageInfo &info )
|
|||||||
if ( event )
|
if ( event )
|
||||||
{
|
{
|
||||||
event->SetInt( "userid", GetUserID() );
|
event->SetInt( "userid", GetUserID() );
|
||||||
event->SetInt( "health", max( 0, m_iHealth ) );
|
event->SetInt( "health", MAX( 0, m_iHealth ) );
|
||||||
|
|
||||||
// HLTV event priority, not transmitted
|
// HLTV event priority, not transmitted
|
||||||
event->SetInt( "priority", 5 );
|
event->SetInt( "priority", 5 );
|
||||||
@ -3428,9 +3428,9 @@ void CTFPlayer::DropAmmoPack( void )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Fill the ammo pack with unused player ammo, if out add a minimum amount.
|
// Fill the ammo pack with unused player ammo, if out add a minimum amount.
|
||||||
int iPrimary = max( 5, GetAmmoCount( TF_AMMO_PRIMARY ) );
|
int iPrimary = MAX( 5, GetAmmoCount( TF_AMMO_PRIMARY ) );
|
||||||
int iSecondary = max( 5, GetAmmoCount( TF_AMMO_SECONDARY ) );
|
int iSecondary = MAX( 5, GetAmmoCount( TF_AMMO_SECONDARY ) );
|
||||||
int iMetal = max( 5, GetAmmoCount( TF_AMMO_METAL ) );
|
int iMetal = MAX( 5, GetAmmoCount( TF_AMMO_METAL ) );
|
||||||
|
|
||||||
// Create the ammo pack.
|
// Create the ammo pack.
|
||||||
CTFAmmoPack *pAmmoPack = CTFAmmoPack::Create( vecPackOrigin, vecPackAngles, this, pszWorldModel );
|
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 iMax = m_PlayerClass.GetData()->m_aAmmoMax[iAmmoIndex];
|
||||||
int iAdd = min( iCount, iMax - GetAmmoCount(iAmmoIndex) );
|
int iAdd = MIN( iCount, iMax - GetAmmoCount(iAmmoIndex) );
|
||||||
if ( iAdd < 1 )
|
if ( iAdd < 1 )
|
||||||
{
|
{
|
||||||
return 0;
|
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 ) )
|
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
|
// speak a louder pain concept to just the attacker
|
||||||
@ -5789,7 +5789,7 @@ bool CTFPlayer::CanSpeakVoiceCommand( void )
|
|||||||
void CTFPlayer::NoteSpokeVoiceCommand( const char *pszScenePlayed )
|
void CTFPlayer::NoteSpokeVoiceCommand( const char *pszScenePlayed )
|
||||||
{
|
{
|
||||||
Assert( 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() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -918,7 +918,7 @@ void CTFGameRules::RadiusDamage( const CTakeDamageInfo &info, const Vector &vecS
|
|||||||
float flToWorldSpaceCenter = ( vecSrc - pEntity->WorldSpaceCenter() ).Length();
|
float flToWorldSpaceCenter = ( vecSrc - pEntity->WorldSpaceCenter() ).Length();
|
||||||
float flToOrigin = ( vecSrc - pEntity->GetAbsOrigin() ).Length();
|
float flToOrigin = ( vecSrc - pEntity->GetAbsOrigin() ).Length();
|
||||||
|
|
||||||
flDistanceToEntity = min( flToWorldSpaceCenter, flToOrigin );
|
flDistanceToEntity = MIN( flToWorldSpaceCenter, flToOrigin );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2158,7 +2158,7 @@ void CTFGameRules::SendWinPanelInfo( void )
|
|||||||
vecPlayerScore.Sort( PlayerRoundScoreSortFunc );
|
vecPlayerScore.Sort( PlayerRoundScoreSortFunc );
|
||||||
|
|
||||||
// set the top (up to) 3 players by round score in the event data
|
// 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++ )
|
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
|
// 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_TELEPORTS] / TF_SCORE_TELEPORTS_PER_POINT ) +
|
||||||
( pRoundStats->m_iStat[TFSTAT_INVULNS] / TF_SCORE_INVULN ) +
|
( pRoundStats->m_iStat[TFSTAT_INVULNS] / TF_SCORE_INVULN ) +
|
||||||
( pRoundStats->m_iStat[TFSTAT_REVENGE] / TF_SCORE_REVENGE );
|
( pRoundStats->m_iStat[TFSTAT_REVENGE] / TF_SCORE_REVENGE );
|
||||||
return max( iScore, 0 );
|
return MAX( iScore, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -518,7 +518,7 @@ void CTFPlayerShared::ConditionGameRulesThink( void )
|
|||||||
flReduction += (m_aHealers.Count() * flReduction * 4);
|
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 )
|
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 ) )
|
if ( m_Shared.InCond( TF_COND_DISGUISED ) && !m_Shared.InCond( TF_COND_STEALTHED ) )
|
||||||
{
|
{
|
||||||
float flMaxDisguiseSpeed = GetPlayerClassData( m_Shared.GetDisguiseClass() )->m_flMaxSpeed;
|
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
|
// Second, see if any flags are slowing them down
|
||||||
|
@ -575,7 +575,7 @@ bool CWeaponMedigun::FindAndHealTargets( void )
|
|||||||
flChargeAmount /= (float)iTotalHealers;
|
flChargeAmount /= (float)iTotalHealers;
|
||||||
}
|
}
|
||||||
|
|
||||||
float flNewLevel = min( m_flChargeLevel + flChargeAmount, 1.0 );
|
float flNewLevel = MIN( m_flChargeLevel + flChargeAmount, 1.0 );
|
||||||
#ifdef GAME_DLL
|
#ifdef GAME_DLL
|
||||||
if ( flNewLevel >= 1.0 && m_flChargeLevel < 1.0 )
|
if ( flNewLevel >= 1.0 && m_flChargeLevel < 1.0 )
|
||||||
{
|
{
|
||||||
@ -619,7 +619,7 @@ void CWeaponMedigun::DrainCharge( void )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float flChargeAmount = gpGlobals->frametime / weapon_medigun_chargerelease_rate.GetFloat();
|
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 )
|
if ( !m_flChargeLevel )
|
||||||
{
|
{
|
||||||
m_bChargeRelease = false;
|
m_bChargeRelease = false;
|
||||||
|
@ -229,7 +229,7 @@ void CTFSniperRifle::HandleZooms( void )
|
|||||||
{
|
{
|
||||||
if ( gpGlobals->curtime > m_flRezoomTime )
|
if ( gpGlobals->curtime > m_flRezoomTime )
|
||||||
{
|
{
|
||||||
ZoomIn();
|
ZoomIn();
|
||||||
m_flRezoomTime = -1;
|
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.
|
// 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 )
|
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
|
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();
|
ToggleZoom();
|
||||||
|
|
||||||
// at least 0.1 seconds from now, but don't stomp a previous value
|
// 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;
|
m_flNextSecondaryAttack = gpGlobals->curtime + TF_WEAPON_SNIPERRIFLE_ZOOM_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,7 +512,7 @@ void CTFSniperRifle::SetRezoom( bool bRezoom, float flDelay )
|
|||||||
float CTFSniperRifle::GetProjectileDamage( void )
|
float CTFSniperRifle::GetProjectileDamage( void )
|
||||||
{
|
{
|
||||||
// Uncharged? Min damage.
|
// Uncharged? Min damage.
|
||||||
return max( m_flChargedDamage, TF_WEAPON_SNIPERRIFLE_DAMAGE_MIN );
|
return MAX( m_flChargedDamage, TF_WEAPON_SNIPERRIFLE_DAMAGE_MIN );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -396,7 +396,7 @@ bool CTFWeaponBase::Deploy( void )
|
|||||||
// Don't override primary attacks that are already further out than this. This prevents
|
// Don't override primary attacks that are already further out than this. This prevents
|
||||||
// people exploiting weapon switches to allow weapons to fire faster.
|
// people exploiting weapon switches to allow weapons to fire faster.
|
||||||
float flDeployTime = 0.67;
|
float flDeployTime = 0.67;
|
||||||
m_flNextPrimaryAttack = max( flOriginalPrimaryAttack, gpGlobals->curtime + flDeployTime );
|
m_flNextPrimaryAttack = MAX( flOriginalPrimaryAttack, gpGlobals->curtime + flDeployTime );
|
||||||
|
|
||||||
CTFPlayer *pPlayer = ToTFPlayer( GetOwner() );
|
CTFPlayer *pPlayer = ToTFPlayer( GetOwner() );
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
@ -653,7 +653,7 @@ bool CTFWeaponBase::ReloadSingly( void )
|
|||||||
// If we have ammo, remove ammo and add it to clip
|
// If we have ammo, remove ammo and add it to clip
|
||||||
if ( pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) > 0 && !m_bReloadedThroughAnimEvent )
|
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 );
|
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 )
|
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 );
|
pOperator->RemoveAmmo( 1, m_iPrimaryAmmoType );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,7 +727,7 @@ bool CTFWeaponBase::DefaultReload( int iClipSize1, int iClipSize2, int iActivity
|
|||||||
if ( UsesClipsForAmmo1() )
|
if ( UsesClipsForAmmo1() )
|
||||||
{
|
{
|
||||||
// need to reload primary clip?
|
// 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 )
|
if ( primary != 0 )
|
||||||
{
|
{
|
||||||
bReloadPrimary = true;
|
bReloadPrimary = true;
|
||||||
@ -737,7 +737,7 @@ bool CTFWeaponBase::DefaultReload( int iClipSize1, int iClipSize2, int iActivity
|
|||||||
if ( UsesClipsForAmmo2() )
|
if ( UsesClipsForAmmo2() )
|
||||||
{
|
{
|
||||||
// need to reload secondary clip?
|
// 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 )
|
if ( secondary != 0 )
|
||||||
{
|
{
|
||||||
bReloadSecondary = true;
|
bReloadSecondary = true;
|
||||||
@ -1876,7 +1876,7 @@ float CalcViewModelBobHelper( CBasePlayer *player, BobState_t *pBobState )
|
|||||||
|
|
||||||
//Find the speed of the player
|
//Find the speed of the player
|
||||||
float speed = player->GetLocalVelocity().Length2D();
|
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
|
// don't allow too big speed changes
|
||||||
speed = clamp( speed, pBobState->m_flLastSpeed-flmaxSpeedDelta, pBobState->m_flLastSpeed+flmaxSpeedDelta );
|
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 )
|
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 );
|
pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user