1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

Fixed conflict between min/max macros and std::min/max when using GCC >= 4.2.

This commit is contained in:
Scott Ehlert 2011-04-28 01:29:22 -05:00
parent 88dd2ac536
commit 7f4855ae1f
265 changed files with 904 additions and 945 deletions

View File

@ -748,7 +748,7 @@ float CFlexAnimationTrack::GetFracIntensity( float time, int type )
CExpressionSample *esEnd = NULL;
// do binary search for sample in time period
int j = max( rampCount / 2, 1 );
int j = MAX( rampCount / 2, 1 );
int i = j;
while ( i > -2 && i < rampCount + 1 )
{
@ -756,7 +756,7 @@ float CFlexAnimationTrack::GetFracIntensity( float time, int type )
esStart = GetBoundedSample( i, dummy, type );
esEnd = GetBoundedSample( i + 1, dummy, type );
j = max( j / 2, 1 );
j = MAX( j / 2, 1 );
if ( time < esStart->time)
{
i -= j;
@ -785,8 +785,8 @@ float CFlexAnimationTrack::GetFracIntensity( float time, int type )
int prev = i - 1;
int next = i + 2;
prev = max( -1, prev );
next = min( next, rampCount );
prev = MAX( -1, prev );
next = MIN( next, rampCount );
bool clamp[ 2 ];
CExpressionSample *esPre = GetBoundedSample( prev, clamp[ 0 ], type );
@ -1590,7 +1590,7 @@ float CChoreoEvent::GetRampIntensity( ICurveDataAccessor *data, float time )
CExpressionSample *esEnd = NULL;
// do binary search for sample in time period
int j = max( rampCount / 2, 1 );
int j = MAX( rampCount / 2, 1 );
int i = j;
while ( i > -2 && i < rampCount + 1 )
{
@ -1598,7 +1598,7 @@ float CChoreoEvent::GetRampIntensity( ICurveDataAccessor *data, float time )
esStart = data->CurveGetBoundedSample( i, dummy );
esEnd = data->CurveGetBoundedSample( i + 1, dummy );
j = max( j / 2, 1 );
j = MAX( j / 2, 1 );
if ( time < esStart->time)
{
i -= j;
@ -1621,8 +1621,8 @@ float CChoreoEvent::GetRampIntensity( ICurveDataAccessor *data, float time )
int prev = i - 1;
int next = i + 2;
prev = max( -1, prev );
next = min( next, rampCount );
prev = MAX( -1, prev );
next = MIN( next, rampCount );
bool clamp[ 2 ];
CExpressionSample *esPre = data->CurveGetBoundedSample( prev, clamp[ 0 ] );
@ -2938,10 +2938,10 @@ float CChoreoEvent::GetOriginalPercentageFromPlaybackPercentage( float t )
int end = i + 1;
int next = i + 2;
prev = max( -2, prev );
start = max( -1, start );
end = min( end, count );
next = min( next, count + 1 );
prev = MAX( -2, prev );
start = MAX( -1, start );
end = MIN( end, count );
next = MIN( next, count + 1 );
CEventAbsoluteTag *pStartTag = NULL;
CEventAbsoluteTag *pEndTag = NULL;
@ -3064,10 +3064,10 @@ float CChoreoEvent::GetPlaybackPercentageFromOriginalPercentage( float t )
int end = i + 1;
int next = i + 2;
prev = max( -2, prev );
start = max( -1, start );
end = min( end, count );
next = min( next, count + 1 );
prev = MAX( -2, prev );
start = MAX( -1, start );
end = MIN( end, count );
next = MIN( next, count + 1 );
CEventAbsoluteTag *pStartTag = NULL;
CEventAbsoluteTag *pEndTag = NULL;
@ -3218,7 +3218,7 @@ void CChoreoEvent::SetLoopCount( int numloops )
{
Assert( GetType() == LOOP );
// Never below -1
m_nNumLoops = max( numloops, -1 );
m_nNumLoops = MAX( numloops, -1 );
}
//-----------------------------------------------------------------------------
@ -3433,14 +3433,14 @@ bool CChoreoEvent::PreventTagOverlap( void )
{
tag->SetPercentage( minP );
minDp = min( 0.01, minP / (i + 1) );
minDp = MIN( 0.01, minP / (i + 1) );
bHadOverlap = true;
}
else
{
minP = tag->GetPercentage();
}
minP = max( minP - minDp, 0 );
minP = MAX( minP - minDp, 0 );
}
return bHadOverlap;

View File

@ -460,7 +460,7 @@ void DrawSegs( int noise_divisions, float *prgNoise, const model_t* spritemodel,
}
length = VectorLength( delta );
float flMaxWidth = max(startWidth, endWidth) * 0.5f;
float flMaxWidth = MAX(startWidth, endWidth) * 0.5f;
div = 1.0 / (segments-1);
if ( length*div < flMaxWidth * 1.414 )

View File

@ -510,7 +510,7 @@ void C_ClientRagdoll::FadeOut( void )
int iAlpha = GetRenderColor().a;
int iFadeSpeed = ( g_RagdollLVManager.IsLowViolence() ) ? g_ragdoll_lvfadespeed.GetInt() : g_ragdoll_fadespeed.GetInt();
iAlpha = max( iAlpha - ( iFadeSpeed * gpGlobals->frametime ), 0 );
iAlpha = MAX( iAlpha - ( iFadeSpeed * gpGlobals->frametime ), 0 );
SetRenderMode( kRenderTransAlpha );
SetRenderColorA( iAlpha );
@ -890,7 +890,7 @@ CStudioHdr *C_BaseAnimating::OnNewModel()
}
}
int boneControllerCount = min( hdr->numbonecontrollers(), ARRAYSIZE( m_flEncodedController ) );
int boneControllerCount = MIN( hdr->numbonecontrollers(), ARRAYSIZE( m_flEncodedController ) );
m_iv_flEncodedController.SetMaxCount( boneControllerCount );
@ -1886,7 +1886,7 @@ void C_BaseAnimating::CalculateIKLocks( float currentTime )
VectorMA( estGround, pTarget->est.height, up, p1 );
VectorMA( estGround, -pTarget->est.height, up, p2 );
float r = max( pTarget->est.radius, 1);
float r = MAX( pTarget->est.radius, 1);
// don't IK to other characters
ray.Init( p1, p2, Vector(-r,-r,0), Vector(r,r,r*2) );
@ -3977,7 +3977,7 @@ float C_BaseAnimating::GetAnimTimeInterval( void ) const
{
#define MAX_ANIMTIME_INTERVAL 0.2f
float flInterval = min( gpGlobals->curtime - m_flAnimTime, MAX_ANIMTIME_INTERVAL );
float flInterval = MIN( gpGlobals->curtime - m_flAnimTime, MAX_ANIMTIME_INTERVAL );
return flInterval;
}
@ -4209,7 +4209,7 @@ float C_BaseAnimating::FrameAdvance( float flInterval )
addcycle = (serverAdvance + addcycle) / 2;
const float MAX_CYCLE_ADJUSTMENT = 0.1f;
addcycle = min( MAX_CYCLE_ADJUSTMENT, addcycle );// Don't do too big of a jump; it's too jarring as well.
addcycle = MIN( MAX_CYCLE_ADJUSTMENT, addcycle );// Don't do too big of a jump; it's too jarring as well.
DevMsg( 2, "(%d): Cycle latch used to correct %.2f in to %.2f instead of %.2f.\n",
entindex(), GetCycle(), GetCycle() + addcycle, GetCycle() + originalAdvance );

View File

@ -603,8 +603,8 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float
if ( !pVar->GetHistoryValue( i, changetime ) )
return;
flMin = min( flMin, changetime );
flMax = max( flMax, changetime );
flMin = MIN( flMin, changetime );
flMax = MAX( flMax, changetime );
i = pVar->GetNext( i );
}
}
@ -4765,7 +4765,7 @@ int C_BaseEntity::GetIntermediateDataSize( void )
Assert( size > 0 );
// At least 4 bytes to avoid some really bad stuff
return max( size, 4 );
return MAX( size, 4 );
#else
return 0;
#endif

View File

@ -472,7 +472,7 @@ void C_BaseFlex::ComputeBlendedSetting( Emphasized_Phoneme *classes, float empha
}
else
{
emphasis_intensity = min( emphasis_intensity, STRONG_CROSSFADE_START );
emphasis_intensity = MIN( emphasis_intensity, STRONG_CROSSFADE_START );
classes[ PHONEME_CLASS_NORMAL ].amount = 2.0f * emphasis_intensity;
}
}
@ -489,7 +489,7 @@ void C_BaseFlex::ComputeBlendedSetting( Emphasized_Phoneme *classes, float empha
}
else
{
emphasis_intensity = max( emphasis_intensity, WEAK_CROSSFADE_START );
emphasis_intensity = MAX( emphasis_intensity, WEAK_CROSSFADE_START );
classes[ PHONEME_CLASS_NORMAL ].amount = 2.0f * emphasis_intensity;
}
}
@ -703,7 +703,7 @@ void C_BaseFlex::AddVisemesForSentence( Emphasized_Phoneme *classes, float empha
const CBasePhonemeTag *next = sentence->GetRuntimePhoneme( k + 1 );
if ( next )
{
dt = max( dt, min( next->GetEndTime() - t, phoneme->GetEndTime() - phoneme->GetStartTime() ) );
dt = MAX( dt, MIN( next->GetEndTime() - t, phoneme->GetEndTime() - phoneme->GetStartTime() ) );
}
}
}
@ -1725,6 +1725,6 @@ void CSceneEventInfo::InitWeight( C_BaseFlex *pActor )
float CSceneEventInfo::UpdateWeight( C_BaseFlex *pActor )
{
m_flWeight = min( m_flWeight + 0.1, 1.0 );
m_flWeight = MIN( m_flWeight + 0.1, 1.0 );
return m_flWeight;
}

View File

@ -603,7 +603,7 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
int min_fov = GetMinFOV();
// Don't let it go too low
localFOV = max( min_fov, localFOV );
localFOV = MAX( min_fov, localFOV );
gHUD.m_flFOVSensitivityAdjust = 1.0f;
#ifndef _XBOX

View File

@ -761,7 +761,7 @@ bool CClient_Precipitation::ComputeEmissionArea( Vector& origin, Vector2D& size
return false;
// Determine how much time it'll take a falling particle to hit the player
float emissionHeight = min( vMaxs[2], pPlayer->GetAbsOrigin()[2] + 512 );
float emissionHeight = MIN( vMaxs[2], pPlayer->GetAbsOrigin()[2] + 512 );
float distToFall = emissionHeight - pPlayer->GetAbsOrigin()[2];
float fallTime = distToFall / GetSpeed();
@ -781,12 +781,12 @@ bool CClient_Precipitation::ComputeEmissionArea( Vector& origin, Vector2D& size
( vMins[0] > hibound[0] ) || ( vMins[1] > hibound[1] ) )
return false;
origin[0] = max( vMins[0], lobound[0] );
origin[1] = max( vMins[1], lobound[1] );
origin[0] = MAX( vMins[0], lobound[0] );
origin[1] = MAX( vMins[1], lobound[1] );
origin[2] = emissionHeight;
hibound[0] = min( vMaxs[0], hibound[0] );
hibound[1] = min( vMaxs[1], hibound[1] );
hibound[0] = MIN( vMaxs[0], hibound[0] );
hibound[1] = MIN( vMaxs[1], hibound[1] );
size[0] = hibound[0] - origin[0];
size[1] = hibound[1] - origin[1];

View File

@ -245,9 +245,9 @@ void C_EntityDissolve::BuildTeslaEffect( mstudiobbox_t *pHitBox, const matrix3x4
pParticle->m_vecVelocity = vec3_origin;
Vector color( 1,1,1 );
float colorRamp = RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = RandomFloat( 6,13 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize - 2;
pParticle->m_uchStartAlpha = 255;

View File

@ -550,7 +550,7 @@ void C_FireSmoke::UpdateFlames( void )
//NOTENOTE: Sprite renderer assumes a scale of 0.0 means 1.0
if ( m_bFadingOut == false )
{
m_entFlames[i].SetScale( max(0.000001,newScale) );
m_entFlames[i].SetScale( MAX(0.000001,newScale) );
}
else
{
@ -585,7 +585,7 @@ void C_FireSmoke::UpdateFlames( void )
//NOTENOTE: Sprite renderer assumes a scale of 0.0 means 1.0
if ( m_bFadingOut == false )
{
m_entFlamesFromAbove[i].SetScale( max(0.000001,newScale) );
m_entFlamesFromAbove[i].SetScale( MAX(0.000001,newScale) );
}
else
{
@ -733,9 +733,9 @@ void C_FireSmoke::SpawnSmoke( void )
scalar = Helper_RandomFloat( 0.5f, 2.0f );
sParticle->m_uchColor[0] = min( 255, Helper_RandomFloat( 185.0f, 190.0f ) * scalar );
sParticle->m_uchColor[1] = min( 255, Helper_RandomFloat( 140.0f, 165.0f ) * scalar );
sParticle->m_uchColor[2] = min( 255, 65.0f * scalar );
sParticle->m_uchColor[0] = MIN( 255, Helper_RandomFloat( 185.0f, 190.0f ) * scalar );
sParticle->m_uchColor[1] = MIN( 255, Helper_RandomFloat( 140.0f, 165.0f ) * scalar );
sParticle->m_uchColor[2] = MIN( 255, 65.0f * scalar );
sParticle->m_uchStartAlpha = 255;
sParticle->m_uchEndAlpha = 0;
sParticle->m_uchStartSize = 2;
@ -1453,9 +1453,9 @@ void C_EntityFlame::UpdateHitBoxFlames( void )
//
// colorRamp = random->RandomFloat( 0.75f, 1.25f );
//
// pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
// pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
// pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
// pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
// pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
// pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
//
// pParticle->m_uchStartSize = random->RandomFloat( scale * 0.5, scale * 2 );
// pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2;

View File

@ -192,7 +192,7 @@ void C_Func_Dust::ClientThink()
// Spawn particles?
if( m_DustFlags & DUSTFLAGS_ON )
{
float flDelta = min( gpGlobals->frametime, 0.1f );
float flDelta = MIN( gpGlobals->frametime, 0.1f );
while( m_Spawner.NextEvent( flDelta ) )
{
AttemptSpawnNewParticle();

View File

@ -124,7 +124,7 @@ static void CreateFleckParticles( const Vector& origin, const Vector &color, tra
// Handle increased scale
float flMaxSpeed = FLECK_MAX_SPEED * iScale;
float flAngularSpray = max( 0.2, FLECK_ANGULAR_SPRAY - ( (float)iScale * 0.2f) ); // More power makes the spray more controlled
float flAngularSpray = MAX( 0.2, FLECK_ANGULAR_SPRAY - ( (float)iScale * 0.2f) ); // More power makes the spray more controlled
// Setup our collision information
fleckEmitter->m_ParticleCollision.Setup( spawnOffset, &trace->plane.normal, flAngularSpray, FLECK_MIN_SPEED, flMaxSpeed, FLECK_GRAVITY, FLECK_DAMPEN );
@ -179,9 +179,9 @@ static void CreateFleckParticles( const Vector& origin, const Vector &color, tra
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pFleckParticle->m_uchColor[0] = min( 1.0f, color[0]*colorRamp )*255.0f;
pFleckParticle->m_uchColor[1] = min( 1.0f, color[1]*colorRamp )*255.0f;
pFleckParticle->m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f;
pFleckParticle->m_uchColor[0] = MIN( 1.0f, color[0]*colorRamp )*255.0f;
pFleckParticle->m_uchColor[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
pFleckParticle->m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
}
}
@ -258,9 +258,9 @@ void FX_DebrisFlecks( const Vector& origin, trace_t *tr, char materialType, int
// Ramp the color
colorRamp = random->RandomFloat( 0.5f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
// scaled
pParticle->m_uchStartSize = (iScale*0.5f) * random->RandomInt( 3, 4 ) * (i+1);
@ -294,9 +294,9 @@ void FX_DebrisFlecks( const Vector& origin, trace_t *tr, char materialType, int
colorRamp = random->RandomFloat( 0.5f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 4, 8 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4;
@ -357,9 +357,9 @@ void FX_DebrisFlecks( const Vector& origin, trace_t *tr, char materialType, int
float colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = min( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f;
newParticle.m_uchColor[0] = MIN( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, smokeMaterial );
}
@ -392,9 +392,9 @@ void FX_DebrisFlecks( const Vector& origin, trace_t *tr, char materialType, int
float colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = min( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f;
newParticle.m_uchColor[0] = MIN( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, bloodMaterial );
}
@ -426,9 +426,9 @@ void FX_DebrisFlecks( const Vector& origin, trace_t *tr, char materialType, int
float colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = min( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f;
newParticle.m_uchColor[0] = MIN( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, smokeMaterial );
@ -547,9 +547,9 @@ void FX_GlassImpact( const Vector &pos, const Vector &normal )
colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = min( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f;
newParticle.m_uchColor[0] = MIN( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, bloodMaterial );
}
@ -580,9 +580,9 @@ void FX_GlassImpact( const Vector &pos, const Vector &normal )
colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = min( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f;
newParticle.m_uchColor[0] = MIN( 1.0f, color[0]*colorRamp )*255.0f;
newParticle.m_uchColor[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, ParticleMgr()->GetPMaterial( "particle/particle_smokegrenade" ) );
}
@ -723,9 +723,9 @@ void FX_AntlionImpact( const Vector &pos, trace_t *trace )
colorRamp = random->RandomFloat( 0.5f, 1.0f );
pParticle->m_uchColor[0] = min( 1.0f, color[0]*colorRamp )*255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1]*colorRamp )*255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0]*colorRamp )*255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
}
// Blood spurt
@ -1010,9 +1010,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, int iScale )
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
// scaled
pParticle->m_uchStartSize = iScale * random->RandomInt( 3, 4 ) * (i+1);
@ -1053,9 +1053,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, int iScale )
pParticle->m_vecVelocity.Init();
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 4, 8 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4;
@ -1111,9 +1111,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, int iScale )
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
// scaled
pParticle->m_uchStartSize = iScale * random->RandomInt( 3, 4 ) * (i+1);
@ -1152,9 +1152,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, int iScale )
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 2, 4 ) * (i+1);
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2;
@ -1194,9 +1194,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, int iScale )
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 1, 4 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4;

View File

@ -662,7 +662,7 @@ inline void C_ParticleSmokeGrenade::ApplyDynamicLight( const Vector &vParticlePo
}
// Rescale the color..
float flMax = max( color.x, max( color.y, color.z ) );
float flMax = MAX( color.x, MAX( color.y, color.z ) );
if ( flMax > 1 )
{
color /= flMax;

View File

@ -33,7 +33,7 @@ float PixelVisibility_DrawProxy( OcclusionQueryObjectHandle_t queryHandle, Vecto
float forwardScale = scale;
// draw a pyramid of points touching a sphere of radius "scale" at origin
float pixelsPerUnit = materials->ComputePixelWidthOfSphere( origin, 1.0f );
pixelsPerUnit = max( pixelsPerUnit, 1e-4f );
pixelsPerUnit = MAX( pixelsPerUnit, 1e-4f );
if ( screenspace )
{
// Force this to be the size of a sphere of diameter "scale" at some reference distance (1.0 unit)
@ -82,8 +82,8 @@ float PixelVisibility_DrawProxy( OcclusionQueryObjectHandle_t queryHandle, Vecto
// compute area and screen-clipped area
float w = screen[1].x - screen[0].x;
float h = screen[0].y - screen[3].y;
float ws = min(1.0f, screen[1].x) - max(-1.0f, screen[0].x);
float hs = min(1.0f, screen[0].y) - max(-1.0f, screen[3].y);
float ws = MIN(1.0f, screen[1].x) - MAX(-1.0f, screen[0].x);
float hs = MIN(1.0f, screen[0].y) - MAX(-1.0f, screen[3].y);
float area = w*h; // area can be zero when we ALT-TAB
float areaClipped = ws*hs;
float ratio = 0.0f;

View File

@ -235,7 +235,7 @@ void C_Plasma::AddEntity( void )
m_flGlowScale = m_flScaleRegister;
// Note: Sprite renderer assumes scale of 0.0 is 1.0
m_entGlow.SetScale( max( 0.0000001f, (m_flScaleRegister*1.5f) + GetFlickerScale() ) );
m_entGlow.SetScale( MAX( 0.0000001f, (m_flScaleRegister*1.5f) + GetFlickerScale() ) );
m_entGlow.SetLocalOriginDim( Z_INDEX, m_entGlow.GetLocalOriginDim( Z_INDEX ) + ( dScale * 32.0f ) );
}
@ -407,7 +407,7 @@ void C_Plasma::UpdateFlames( void )
offset[2] = m_entFlames[i].GetAbsOrigin()[2];
// Note: Sprite render assumes 0 scale means 1.0
m_entFlames[i].SetScale ( max(0.000001,newScale) );
m_entFlames[i].SetScale ( MAX(0.000001,newScale) );
if ( i != 0 )
{

View File

@ -622,7 +622,7 @@ void C_RopeKeyframe::CPhysicsDelegate::ApplyConstraints( CSimplePhysics::CNode *
AngleVectors( angles, &forward );
int parity = 1;
int nFalloffNodes = min( 2, nNodes - 2 );
int nFalloffNodes = MIN( 2, nNodes - 2 );
LockNodeDirection( pNodes, parity, nFalloffNodes, g_flLockAmount, g_flLockFalloff, forward );
}
}
@ -636,7 +636,7 @@ void C_RopeKeyframe::CPhysicsDelegate::ApplyConstraints( CSimplePhysics::CNode *
AngleVectors( angles, &forward );
int parity = -1;
int nFalloffNodes = min( 2, nNodes - 2 );
int nFalloffNodes = MIN( 2, nNodes - 2 );
LockNodeDirection( &pNodes[nNodes-1], parity, nFalloffNodes, g_flLockAmount, g_flLockFalloff, forward );
}
}
@ -1242,7 +1242,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData )
// Right here, we need to specify a width that will be 1 pixel larger in screen space.
float zCoord = CurrentViewForward().Dot( pSegmentData->m_Segments[iSegment].m_vPos - CurrentViewOrigin() );
zCoord = max( zCoord, 0.1f );
zCoord = MAX( zCoord, 0.1f );
float flScreenSpaceWidth = m_Width * flHalfScreenWidth / zCoord;
if ( flScreenSpaceWidth < flMinScreenSpaceWidth )
@ -1270,7 +1270,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData )
}
else
{
pSegmentData->m_flMaxBackWidth = max( pSegmentData->m_flMaxBackWidth, pSegmentData->m_BackWidths[iSegment] );
pSegmentData->m_flMaxBackWidth = MAX( pSegmentData->m_flMaxBackWidth, pSegmentData->m_BackWidths[iSegment] );
}
}
@ -1472,12 +1472,12 @@ void C_RopeKeyframe::CalcLightValues()
for ( int iSide=0; iSide < 6; iSide++ )
{
float flLen = boxColors[iSide].Length();
flMaxIntensity = max( flMaxIntensity, flLen );
flMaxIntensity = MAX( flMaxIntensity, flLen );
}
VectorNormalize( m_LightValues[i] );
m_LightValues[i] *= flMaxIntensity;
float flMax = max( m_LightValues[i].x, max( m_LightValues[i].y, m_LightValues[i].z ) );
float flMax = MAX( m_LightValues[i].x, MAX( m_LightValues[i].y, m_LightValues[i].z ) );
if ( flMax > 1 )
m_LightValues[i] /= flMax;
}

View File

@ -320,7 +320,7 @@ void C_SmokeTrail::Update( float fTimeDelta )
VectorMA( pParticle->m_vecVelocity, flDirectedVel, vecForward, pParticle->m_vecVelocity );
offsetColor = m_StartColor;
float flMaxVal = max( m_StartColor[0], m_StartColor[1] );
float flMaxVal = MAX( m_StartColor[0], m_StartColor[1] );
if ( flMaxVal < m_StartColor[2] )
{
flMaxVal = m_StartColor[2];

View File

@ -482,7 +482,7 @@ void CSprite::GetToolRecordingState( KeyValues *msg )
if ( m_bWorldSpaceScale )
{
CEngineSprite *psprite = ( CEngineSprite * )modelinfo->GetModelExtraData( GetModel() );
float flMinSize = min( psprite->GetWidth(), psprite->GetHeight() );
float flMinSize = MIN( psprite->GetWidth(), psprite->GetHeight() );
renderscale /= flMinSize;
}

View File

@ -181,7 +181,7 @@ void C_SteamJet::OnDataChanged(DataUpdateType_t updateType)
// Recalulate lifetime in case length or speed changed.
m_Lifetime = m_JetLength / m_Speed;
m_ParticleEffect.SetParticleCullRadius( max(m_StartSize, m_EndSize) );
m_ParticleEffect.SetParticleCullRadius( MAX(m_StartSize, m_EndSize) );
}
@ -243,7 +243,7 @@ void CalcFastApproximateRenderBoundsAABB( C_BaseEntity *pEnt, float flBloatSize,
Vector vAddMins, vAddMaxs;
pEnt->GetRenderBounds( vAddMins, vAddMaxs );
flBloatSize += max( vAddMins.Length(), vAddMaxs.Length() );
flBloatSize += MAX( vAddMins.Length(), vAddMaxs.Length() );
}
else
{
@ -407,9 +407,9 @@ void C_SteamJet::RenderParticles( CParticleRenderIterator *pIterator )
Vector vRampColor = m_Ramps[iRamp] + (m_Ramps[iRamp+1] - m_Ramps[iRamp]) * fraction;
vRampColor[0] = min( 1.0f, vRampColor[0] );
vRampColor[1] = min( 1.0f, vRampColor[1] );
vRampColor[2] = min( 1.0f, vRampColor[2] );
vRampColor[0] = MIN( 1.0f, vRampColor[0] );
vRampColor[1] = MIN( 1.0f, vRampColor[1] );
vRampColor[2] = MIN( 1.0f, vRampColor[2] );
float sinLifetime = sin(pParticle->m_Lifetime * 3.14159f / pParticle->m_DieTime);
@ -518,7 +518,7 @@ void C_SteamJet::UpdateLightingRamp()
}
// Renormalize?
float maxVal = max(pRamp->x, max(pRamp->y, pRamp->z));
float maxVal = MAX(pRamp->x, MAX(pRamp->y, pRamp->z));
if(maxVal > 1)
{
*pRamp = *pRamp / maxVal;

View File

@ -57,7 +57,7 @@ void C_Sun::OnDataChanged( DataUpdateType_t updateType )
// for the sun, which should always be completely opaque at its core. Here, we renormalize the
// components to make sure only hue is altered.
float maxComponent = max ( m_clrRender->r, max ( m_clrRender->g, m_clrRender->b ) );
float maxComponent = MAX ( m_clrRender->r, MAX ( m_clrRender->g, m_clrRender->b ) );
Vector vOverlayColor;
Vector vMainColor;

View File

@ -188,8 +188,8 @@ int C_LocalTempEntity::DrawModel( int flags )
float flDot = DotProduct( m_vecNormal, vecDelta );
if ( flDot > 0 )
{
float flAlpha = RemapVal( min(flDot,0.3), 0, 0.3, 0, 1 );
flAlpha = max( 1.0, tempent_renderamt - (tempent_renderamt * flAlpha) );
float flAlpha = RemapVal( MIN(flDot,0.3), 0, 0.3, 0, 1 );
flAlpha = MAX( 1.0, tempent_renderamt - (tempent_renderamt * flAlpha) );
SetRenderColorA( flAlpha );
}
}
@ -2022,11 +2022,11 @@ void CTempEnts::PlaySound ( C_LocalTempEntity *pTemp, float damp )
if ( isshellcasing )
{
fvol *= min (1.0, ((float)zvel) / 350.0);
fvol *= MIN (1.0, ((float)zvel) / 350.0);
}
else
{
fvol *= min (1.0, ((float)zvel) / 450.0);
fvol *= MIN (1.0, ((float)zvel) / 450.0);
}
if ( !random->RandomInt(0,3) && !isshellcasing )

View File

@ -300,8 +300,8 @@ void DefaultRenderBoundsWorldspace( IClientRenderable *pRenderable, Vector &absM
// if our origin is actually farther away than that, expand again
float radius = pEnt->GetLocalOrigin().Length();
float flBloatSize = max( vAddMins.Length(), vAddMaxs.Length() );
flBloatSize = max(flBloatSize, radius);
float flBloatSize = MAX( vAddMins.Length(), vAddMaxs.Length() );
flBloatSize = MAX(flBloatSize, radius);
absMins -= Vector( flBloatSize, flBloatSize, flBloatSize );
absMaxs += Vector( flBloatSize, flBloatSize, flBloatSize );
return;
@ -360,8 +360,8 @@ void CalcRenderableWorldSpaceAABB_Fast( IClientRenderable *pRenderable, Vector &
// if our origin is actually farther away than that, expand again
float radius = pEnt->GetLocalOrigin().Length();
float flBloatSize = max( vAddMins.Length(), vAddMaxs.Length() );
flBloatSize = max(flBloatSize, radius);
float flBloatSize = MAX( vAddMins.Length(), vAddMaxs.Length() );
flBloatSize = MAX(flBloatSize, radius);
absMin -= Vector( flBloatSize, flBloatSize, flBloatSize );
absMax += Vector( flBloatSize, flBloatSize, flBloatSize );
}
@ -895,7 +895,7 @@ void CClientLeafSystem::ProjectShadow( ClientLeafShadowHandle_t handle, const Ve
VectorMultiply( dir, maxDist, ray.m_Delta );
ray.m_StartOffset.Init( 0, 0, 0 );
float maxsize = max( size.x, size.y ) * 0.5f;
float maxsize = MAX( size.x, size.y ) * 0.5f;
ray.m_Extents.Init( maxsize, maxsize, maxsize );
ray.m_IsRay = false;
ray.m_IsSwept = true;

View File

@ -1333,8 +1333,8 @@ void CClientShadowMgr::SetupRenderToTextureShadow( ClientShadowHandle_t h )
// Compute the maximum dimension
Vector size;
VectorSubtract( maxs, mins, size );
float maxSize = max( size.x, size.y );
maxSize = max( maxSize, size.z );
float maxSize = MAX( size.x, size.y );
maxSize = MAX( maxSize, size.z );
// Figure out the texture size
// For now, we're going to assume a fixed number of shadow texels

View File

@ -144,7 +144,7 @@ void CHudDeathNotice::Paint()
continue;
}
rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gpGlobals->curtime + DEATHNOTICE_DISPLAY_TIME );
rgDeathNoticeList[i].flDisplayTime = MIN( rgDeathNoticeList[i].flDisplayTime, gpGlobals->curtime + DEATHNOTICE_DISPLAY_TIME );
// Draw the death notice
y = DEATHNOTICE_TOP + (20 * i) + 100; //!!!

View File

@ -1346,8 +1346,8 @@ void CDetailObjectSystem::LevelInitPostEntity()
if ( GetDetailController() )
{
cl_detailfade.SetValue( min( m_flDefaultFadeStart, GetDetailController()->m_flFadeStartDist ) );
cl_detaildist.SetValue( min( m_flDefaultFadeEnd, GetDetailController()->m_flFadeEndDist ) );
cl_detailfade.SetValue( MIN( m_flDefaultFadeStart, GetDetailController()->m_flFadeStartDist ) );
cl_detaildist.SetValue( MIN( m_flDefaultFadeEnd, GetDetailController()->m_flFadeEndDist ) );
}
else
{

View File

@ -656,8 +656,8 @@ public:
int color[3][2];
for( int i = 0; i < 3; ++i )
{
color[i][0] = max( 0, m_SpurtColor[i] - 64 );
color[i][1] = min( 255, m_SpurtColor[i] + 64 );
color[i][0] = MAX( 0, m_SpurtColor[i] - 64 );
color[i][1] = MIN( 255, m_SpurtColor[i] + 64 );
}
pParticle->m_uchColor[0] = random->RandomInt( color[0][0], color[0][1] );
pParticle->m_uchColor[1] = random->RandomInt( color[1][0], color[1][1] );
@ -1052,9 +1052,9 @@ void FX_Tesla( const CTeslaInfo &teslaInfo )
pParticle->m_vecVelocity = vec3_origin;
Vector color( 1,1,1 );
float colorRamp = RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = RandomFloat( 6,13 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize - 2;
pParticle->m_uchStartAlpha = 255;

View File

@ -226,9 +226,9 @@ void FX_BloodSpray( const Vector &origin, const Vector &normal, float scale, uns
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomFloat( scale * 0.25, scale );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2;
@ -271,9 +271,9 @@ void FX_BloodSpray( const Vector &origin, const Vector &normal, float scale, uns
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomFloat( scale * 1.5f, scale * 2.0f );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4;
@ -356,9 +356,9 @@ void FX_BloodBulletImpact( const Vector &origin, const Vector &normal, float sca
colorRamp = random->RandomFloat( 0.75f, 2.0f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 2, 4 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 8;
@ -392,9 +392,9 @@ void FX_BloodBulletImpact( const Vector &origin, const Vector &normal, float sca
colorRamp = random->RandomFloat( 0.75f, 2.0f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 2, 4 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4;

View File

@ -76,8 +76,8 @@ void CFXDiscreetLine::Draw( double frametime )
float eDistance = sDistance - m_fLength;
//Clip to start
sDistance = max( 0.0f, sDistance );
eDistance = max( 0.0f, eDistance );
sDistance = MAX( 0.0f, sDistance );
eDistance = MAX( 0.0f, eDistance );
if ( ( sDistance == 0.0f ) && ( eDistance == 0.0f ) )
return;
@ -85,8 +85,8 @@ void CFXDiscreetLine::Draw( double frametime )
// Clip it
if ( m_fClipLength != 0.0f )
{
sDistance = min( sDistance, m_fClipLength );
eDistance = min( eDistance, m_fClipLength );
sDistance = MIN( sDistance, m_fClipLength );
eDistance = MIN( eDistance, m_fClipLength );
}
// Get our delta to calculate the tc offset

View File

@ -680,9 +680,9 @@ void C_BaseExplosionEffect::CreateDebris( void )
pParticle->m_flRollDelta = random->RandomFloat( 0, 360 );
float colorRamp = random->RandomFloat( 0.5f, 1.5f );
pParticle->m_uchColor[0] = min( 1.0f, 0.25f*colorRamp )*255.0f;
pParticle->m_uchColor[1] = min( 1.0f, 0.25f*colorRamp )*255.0f;
pParticle->m_uchColor[2] = min( 1.0f, 0.25f*colorRamp )*255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, 0.25f*colorRamp )*255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, 0.25f*colorRamp )*255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, 0.25f*colorRamp )*255.0f;
}
#endif // !_XBOX
}
@ -1205,7 +1205,7 @@ void C_WaterExplosionEffect::CreateMisc( void )
colorRamp = random->RandomFloat( 1.5f, 2.0f );
FloatToColor32( tParticle->m_color, min( 1.0f, m_vecColor[0] * colorRamp ), min( 1.0f, m_vecColor[1] * colorRamp ), min( 1.0f, m_vecColor[2] * colorRamp ), m_flLuminosity );
FloatToColor32( tParticle->m_color, MIN( 1.0f, m_vecColor[0] * colorRamp ), MIN( 1.0f, m_vecColor[1] * colorRamp ), MIN( 1.0f, m_vecColor[2] * colorRamp ), m_flLuminosity );
}
//Dump out drops
@ -1233,7 +1233,7 @@ void C_WaterExplosionEffect::CreateMisc( void )
colorRamp = random->RandomFloat( 1.5f, 2.0f );
FloatToColor32( tParticle->m_color, min( 1.0f, m_vecColor[0] * colorRamp ), min( 1.0f, m_vecColor[1] * colorRamp ), min( 1.0f, m_vecColor[2] * colorRamp ), m_flLuminosity );
FloatToColor32( tParticle->m_color, MIN( 1.0f, m_vecColor[0] * colorRamp ), MIN( 1.0f, m_vecColor[1] * colorRamp ), MIN( 1.0f, m_vecColor[2] * colorRamp ), m_flLuminosity );
}
#endif
@ -1264,12 +1264,12 @@ void C_WaterExplosionEffect::CreateMisc( void )
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, m_vecColor[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, m_vecColor[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, m_vecColor[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, m_vecColor[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, m_vecColor[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, m_vecColor[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = 24 * flScale * RemapValClamped( i, 7, 0, 1, 0.5f );
pParticle->m_uchEndSize = min( 255, pParticle->m_uchStartSize * 2 );
pParticle->m_uchEndSize = MIN( 255, pParticle->m_uchStartSize * 2 );
pParticle->m_uchStartAlpha = RemapValClamped( i, 7, 0, 255, 32 ) * m_flLuminosity;
pParticle->m_uchEndAlpha = 0;

View File

@ -1148,9 +1148,9 @@ void FX_Explosion( Vector& origin, Vector& normal, char materialType )
pParticle->m_flRollDelta = random->RandomFloat( 0, 360 );
float colorRamp = random->RandomFloat( 0.75f, 1.5f );
pParticle->m_uchColor[0] = min( 1.0f, r*colorRamp )*255.0f;
pParticle->m_uchColor[1] = min( 1.0f, g*colorRamp )*255.0f;
pParticle->m_uchColor[2] = min( 1.0f, b*colorRamp )*255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, r*colorRamp )*255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, g*colorRamp )*255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, b*colorRamp )*255.0f;
}
}
@ -1171,9 +1171,9 @@ void FX_Explosion( Vector& origin, Vector& normal, char materialType )
pSphereParticle->m_vecVelocity = Vector(0,0,0);
float colorRamp = random->RandomFloat( 0.75f, 1.5f );
pSphereParticle->m_uchColor[0] = min( 1.0f, r*colorRamp )*255.0f;
pSphereParticle->m_uchColor[1] = min( 1.0f, g*colorRamp )*255.0f;
pSphereParticle->m_uchColor[2] = min( 1.0f, b*colorRamp )*255.0f;
pSphereParticle->m_uchColor[0] = MIN( 1.0f, r*colorRamp )*255.0f;
pSphereParticle->m_uchColor[1] = MIN( 1.0f, g*colorRamp )*255.0f;
pSphereParticle->m_uchColor[2] = MIN( 1.0f, b*colorRamp )*255.0f;
}
// Throw some smoke balls out around the normal
@ -1200,9 +1200,9 @@ void FX_Explosion( Vector& origin, Vector& normal, char materialType )
pParticle->m_vecVelocity = (vecRight*x + vecUp*y) * 1024.0;
float colorRamp = random->RandomFloat( 0.75f, 1.5f );
pParticle->m_uchColor[0] = min( 1.0f, r*colorRamp )*255.0f;
pParticle->m_uchColor[1] = min( 1.0f, g*colorRamp )*255.0f;
pParticle->m_uchColor[2] = min( 1.0f, b*colorRamp )*255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, r*colorRamp )*255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, g*colorRamp )*255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, b*colorRamp )*255.0f;
}
}
@ -1230,9 +1230,9 @@ void FX_Explosion( Vector& origin, Vector& normal, char materialType )
pParticle->m_flRollDelta = random->RandomFloat( -1, 1 );
float colorRamp = random->RandomFloat( 0.5f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, r*colorRamp )*255.0f;
pParticle->m_uchColor[1] = min( 1.0f, g*colorRamp )*255.0f;
pParticle->m_uchColor[2] = min( 1.0f, b*colorRamp )*255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, r*colorRamp )*255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, g*colorRamp )*255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, b*colorRamp )*255.0f;
}
}

View File

@ -67,7 +67,7 @@ void UTIL_GetNormalizedColorTintAndLuminosity( const Vector &color, Vector *tint
}
else
{
float maxComponent = max( color.x, max( color.y, color.z ) );
float maxComponent = MAX( color.x, MAX( color.y, color.z ) );
*tint = color / maxComponent;
}
}
@ -91,7 +91,7 @@ inline void FX_GetSplashLighting( Vector position, Vector *color, float *luminos
// Fake a specular highlight (too dim otherwise)
if ( luminosity != NULL )
{
*luminosity = min( 1.0f, (*luminosity) * 4.0f );
*luminosity = MIN( 1.0f, (*luminosity) * 4.0f );
// Clamp so that we never go completely translucent
if ( *luminosity < 0.25f )
@ -215,9 +215,9 @@ void FX_GunshotSplash( const Vector &origin, const Vector &normal, float scale )
colorRamp = random->RandomFloat( 0.75f, 1.25f );
tParticle->m_color.r = min( 1.0f, color[0] * colorRamp ) * 255;
tParticle->m_color.g = min( 1.0f, color[1] * colorRamp ) * 255;
tParticle->m_color.b = min( 1.0f, color[2] * colorRamp ) * 255;
tParticle->m_color.r = MIN( 1.0f, color[0] * colorRamp ) * 255;
tParticle->m_color.g = MIN( 1.0f, color[1] * colorRamp ) * 255;
tParticle->m_color.b = MIN( 1.0f, color[2] * colorRamp ) * 255;
tParticle->m_color.a = luminosity * 255;
}
@ -250,12 +250,12 @@ void FX_GunshotSplash( const Vector &origin, const Vector &normal, float scale )
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = 24 * flScale * RemapValClamped( i, 7, 0, 1, 0.5f );
pParticle->m_uchEndSize = min( 255, pParticle->m_uchStartSize * 2 );
pParticle->m_uchEndSize = MIN( 255, pParticle->m_uchStartSize * 2 );
pParticle->m_uchStartAlpha = RemapValClamped( i, 7, 0, 255, 32 ) * luminosity;
pParticle->m_uchEndAlpha = 0;
@ -296,7 +296,7 @@ void FX_GunshotSlimeSplash( const Vector &origin, const Vector &normal, float sc
VPROF_BUDGET( "FX_GunshotSlimeSplash", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
float colorRamp;
float flScale = min( 1.0f, scale / 8.0f );
float flScale = MIN( 1.0f, scale / 8.0f );
PMaterialHandle hMaterial = ParticleMgr()->GetPMaterial( "effects/slime1" );
PMaterialHandle hMaterial2 = ParticleMgr()->GetPMaterial( "effects/splash4" );
@ -351,9 +351,9 @@ void FX_GunshotSlimeSplash( const Vector &origin, const Vector &normal, float sc
colorRamp = random->RandomFloat( 0.75f, 1.25f );
tParticle->m_color.r = min( 1.0f, color.x * colorRamp ) * 255;
tParticle->m_color.g = min( 1.0f, color.y * colorRamp ) * 255;
tParticle->m_color.b = min( 1.0f, color.z * colorRamp ) * 255;
tParticle->m_color.r = MIN( 1.0f, color.x * colorRamp ) * 255;
tParticle->m_color.g = MIN( 1.0f, color.y * colorRamp ) * 255;
tParticle->m_color.b = MIN( 1.0f, color.z * colorRamp ) * 255;
tParticle->m_color.a = 255 * luminosity;
}
@ -394,12 +394,12 @@ void FX_GunshotSlimeSplash( const Vector &origin, const Vector &normal, float sc
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = 24 * flScale * RemapValClamped( i, 7, 0, 1, 0.5f );
pParticle->m_uchEndSize = min( 255, pParticle->m_uchStartSize * 2 );
pParticle->m_uchEndSize = MIN( 255, pParticle->m_uchStartSize * 2 );
pParticle->m_uchStartAlpha = RemapValClamped( i, 7, 0, 255, 32 ) * luminosity;
pParticle->m_uchEndAlpha = 0;

View File

@ -1094,7 +1094,7 @@ void CMapOverview::UpdateSizeAndPosition()
if ( y < iTopBarHeight )
y = iTopBarHeight;
SetBounds( x,y,w,min(h,iScreenTall) );
SetBounds( x,y,w,MIN(h,iScreenTall) );
}
}

View File

@ -90,8 +90,8 @@ void CNavProgress::Init( const char *title, int numTicks, int startTick )
{
m_pText->SetText( title );
m_numTicks = max( 1, numTicks ); // non-zero, since we'll divide by this
m_currentTick = max( 0, min( m_numTicks, startTick ) );
m_numTicks = MAX( 1, numTicks ); // non-zero, since we'll divide by this
m_currentTick = MAX( 0, MIN( m_numTicks, startTick ) );
InvalidateLayout();
}

View File

@ -192,7 +192,7 @@ void CTextWindow::ShowFile( const char *filename )
char buffer[2048];
int size = min( vgui::filesystem()->Size( f ), sizeof(buffer)-1 ); // just allow 2KB
int size = MIN( vgui::filesystem()->Size( f ), sizeof(buffer)-1 ); // just allow 2KB
vgui::filesystem()->Read( buffer, size, f );
vgui::filesystem()->Close( f );

View File

@ -256,7 +256,7 @@ void CGlowOverlay::UpdateGlowObstruction( const Vector &vToGlow, bool bCacheFull
else
{
m_flGlowObstructionScale -= gpGlobals->frametime / cl_sun_decay_rate.GetFloat();
m_flGlowObstructionScale = max( m_flGlowObstructionScale, 0.0f );
m_flGlowObstructionScale = MAX( m_flGlowObstructionScale, 0.0f );
}
}
else
@ -268,7 +268,7 @@ void CGlowOverlay::UpdateGlowObstruction( const Vector &vToGlow, bool bCacheFull
else
{
m_flGlowObstructionScale += gpGlobals->frametime / cl_sun_decay_rate.GetFloat();
m_flGlowObstructionScale = min( m_flGlowObstructionScale, 1.0f );
m_flGlowObstructionScale = MIN( m_flGlowObstructionScale, 1.0f );
}
}
}

View File

@ -294,7 +294,7 @@ void CHudHistoryResource::Paint( void )
{
if ( m_PickupHistory[i].type )
{
m_PickupHistory[i].DisplayTime = min( m_PickupHistory[i].DisplayTime, gpGlobals->curtime + hud_drawhistory_time.GetFloat() );
m_PickupHistory[i].DisplayTime = MIN( m_PickupHistory[i].DisplayTime, gpGlobals->curtime + hud_drawhistory_time.GetFloat() );
if ( m_PickupHistory[i].DisplayTime <= gpGlobals->curtime )
{
// pic drawing time has expired
@ -306,7 +306,7 @@ void CHudHistoryResource::Paint( void )
float elapsed = m_PickupHistory[i].DisplayTime - gpGlobals->curtime;
float scale = elapsed * 80;
Color clr = gHUD.m_clrNormal;
clr[3] = min( scale, 255 );
clr[3] = MIN( scale, 255 );
bool bUseAmmoFullMsg = false;
@ -329,7 +329,7 @@ void CHudHistoryResource::Paint( void )
bUseAmmoFullMsg = true;
// display as red
clr = gHUD.m_clrCaution;
clr[3] = min( scale, 255 );
clr[3] = MIN( scale, 255 );
}
break;
@ -343,7 +343,7 @@ void CHudHistoryResource::Paint( void )
{
// if the weapon doesn't have ammo, display it as red
clr = gHUD.m_clrCaution;
clr[3] = min( scale, 255 );
clr[3] = MIN( scale, 255 );
}
itemIcon = pWeapon->GetSpriteInactive();

View File

@ -98,7 +98,7 @@ float C_BaseHLPlayer::GetFOV()
int min_fov = ( gpGlobals->maxClients == 1 ) ? 5 : default_fov.GetInt();
// Don't let it go too low
flFOVOffset = max( min_fov, flFOVOffset );
flFOVOffset = MAX( min_fov, flFOVOffset );
return flFOVOffset;
}
@ -266,7 +266,7 @@ void C_BaseHLPlayer::PerformClientSideObstacleAvoidance( float flFrameTime, CUse
if ( curspeed > 150.0f )
{
curspeed = min( 2048.0f, curspeed );
curspeed = MIN( 2048.0f, curspeed );
factor = ( 1.0f + ( curspeed - 150.0f ) / 150.0f );

View File

@ -117,7 +117,7 @@ void C_PropCombineBall::DrawMotionBlur( void )
speed = clamp( speed, 0, 32 );
float stepSize = min( ( speed * 0.5f ), 4.0f );
float stepSize = MIN( ( speed * 0.5f ), 4.0f );
Vector spawnPos = GetAbsOrigin();
Vector spawnStep = -vecDir * stepSize;

View File

@ -1060,9 +1060,9 @@ void StriderBlood( const Vector &origin, const Vector &normal, float scale )
int randomColor = random->RandomInt( 0, 2 );
tParticle->m_color.r = min( 1.0f, color[randomColor].x * colorRamp ) * 255;
tParticle->m_color.g = min( 1.0f, color[randomColor].y * colorRamp ) * 255;
tParticle->m_color.b = min( 1.0f, color[randomColor].z * colorRamp ) * 255;
tParticle->m_color.r = MIN( 1.0f, color[randomColor].x * colorRamp ) * 255;
tParticle->m_color.g = MIN( 1.0f, color[randomColor].y * colorRamp ) * 255;
tParticle->m_color.b = MIN( 1.0f, color[randomColor].z * colorRamp ) * 255;
tParticle->m_color.a = 255;
}
}

View File

@ -117,7 +117,7 @@ void FX_ThumperDust( const CEffectData &data )
Vector vecColor;
int i = 0;
float flScale = min( data.m_flScale, 255 );
float flScale = MIN( data.m_flScale, 255 );
// Setup the color for these particles
engine->ComputeLighting( data.m_vOrigin, NULL, true, vecColor );

View File

@ -660,9 +660,9 @@ void C_PropAirboat::DrawPontoonSplash( Vector origin, Vector direction, float sp
colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = min( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchColor[0] = MIN( 1.0f, color[0] * colorRamp ) * 255.0f;
pParticle->m_uchColor[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomFloat( 8, 16 ) * flScale;
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2;

View File

@ -92,7 +92,7 @@ int C_CrossbowBolt::DrawModel( int flags )
if ( speed > 0 )
{
float stepSize = min( ( speed * 0.5f ), 4.0f );
float stepSize = MIN( ( speed * 0.5f ), 4.0f );
Vector spawnPos = GetAbsOrigin() + ( vecDir * 24.0f );
Vector spawnStep = -vecDir * stepSize;

View File

@ -197,7 +197,7 @@ void FX_PlayerAR2Tracer( const Vector &start, const Vector &end )
//Randomly place the tracer along this line, with a random length
VectorMA( start, random->RandomFloat( 0.0f, 8.0f ), shotDir, dStart );
VectorMA( dStart, min( length, random->RandomFloat( 256.0f, 1024.0f ) ), shotDir, dEnd );
VectorMA( dStart, MIN( length, random->RandomFloat( 256.0f, 1024.0f ) ), shotDir, dEnd );
//Create the line
CFXStaticLine *tracerLine = new CFXStaticLine( "Tracer", dStart, dEnd, random->RandomFloat( 6.0f, 12.0f ), 0.01f, "effects/gunshiptracer", 0 );

View File

@ -286,11 +286,11 @@ void CHUDAutoAim::OnThink()
Vector vecGoal( goalx, goaly, 0 );
Vector vecDir = vecGoal - m_vecPos;
float flDistRemaining = VectorNormalize( vecDir );
m_vecPos += vecDir * min(flDistRemaining, (speed * gpGlobals->frametime) );
m_vecPos += vecDir * MIN(flDistRemaining, (speed * gpGlobals->frametime) );
// Lerp and Clamp scale
float scaleDelta = fabs( goalscale - m_scale );
float scaleMove = min( AUTOAIM_SCALE_SPEED * gpGlobals->frametime, scaleDelta );
float scaleMove = MIN( AUTOAIM_SCALE_SPEED * gpGlobals->frametime, scaleDelta );
if( m_scale < goalscale )
{
m_scale += scaleMove;

View File

@ -315,7 +315,7 @@ void CHudCredits::DrawOutroCreditsName( void )
}
}
cColor[3] = max( 0, m_Alpha );
cColor[3] = MAX( 0, m_Alpha );
}
}
else
@ -361,7 +361,7 @@ void CHudCredits::DrawLogo( void )
{
float flDeltaTime = ( m_flFadeTime - gpGlobals->curtime );
m_Alpha = max( 0, RemapValClamped( flDeltaTime, 5.0f, 0, -128, 255 ) );
m_Alpha = MAX( 0, RemapValClamped( flDeltaTime, 5.0f, 0, -128, 255 ) );
if ( flDeltaTime <= 0.0f )
{

View File

@ -117,7 +117,7 @@ void CHudHealth::OnThink()
if ( local )
{
// Never below zero
newHealth = max( local->GetHealth(), 0 );
newHealth = MAX( local->GetHealth(), 0 );
}
// Only update the fade if we've changed health

View File

@ -468,7 +468,7 @@ void CHudWeaponSelection::Paint()
// interpolate the selected box size between the small box size and the large box size
// interpolation has been removed since there is no weapon pickup animation anymore, so it's all at the largest size
float percentageDone = 1.0f; //min(1.0f, (gpGlobals->curtime - m_flPickupStartTime) / m_flWeaponPickupGrowTime);
float percentageDone = 1.0f; //MIN(1.0f, (gpGlobals->curtime - m_flPickupStartTime) / m_flWeaponPickupGrowTime);
int largeBoxWide = m_flSmallBoxSize + ((m_flLargeBoxWide - m_flSmallBoxSize) * percentageDone);
int largeBoxTall = m_flSmallBoxSize + ((m_flLargeBoxTall - m_flSmallBoxSize) * percentageDone);
Color selectedColor;

View File

@ -194,7 +194,7 @@ void CHudZoom::Paint( void )
{
surface()->DrawFilledRect(xpos, ypos, xpos + 1, ypos + m_flDashHeight);
surface()->DrawFilledRect(wide - xpos, ypos, wide - xpos + 1, ypos + m_flDashHeight);
xpos = (int)((wide / 2) + (m_flDashGap * ++dashCount * max(scale,0.1f)));
xpos = (int)((wide / 2) + (m_flDashGap * ++dashCount * MAX(scale,0.1f)));
}
// draw the darkened edges, with a rotated texture in the four corners

View File

@ -533,7 +533,7 @@ float C_HL2MP_Player::GetFOV( void )
int min_fov = GetMinFOV();
// Don't let it go too low
flFOVOffset = max( min_fov, flFOVOffset );
flFOVOffset = MAX( min_fov, flFOVOffset );
return flFOVOffset;
}

View File

@ -131,8 +131,8 @@ void CHudChatLine::PerformFadeout( void )
{
wchar_t wText[4096];
// draw the first x characters in the player color
wcsncpy( wText, wbuf, min( m_iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
wText[ min( m_iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
wcsncpy( wText, wbuf, MIN( m_iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
wText[ MIN( m_iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
m_clrNameColor[3] = alpha;
@ -430,8 +430,8 @@ void CHudChat::ChatPrintf( int iPlayerIndex, const char *fmt, ... )
line->SetExpireTime();
// draw the first x characters in the player color
Q_strncpy( buf, pmsg, min( iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
buf[ min( iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
Q_strncpy( buf, pmsg, MIN( iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
buf[ MIN( iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
line->InsertColorChange( Color( flColor[0], flColor[1], flColor[2], 255 ) );
line->InsertString( buf );
Q_strncpy( buf, pmsg + iNameLength, strlen( pmsg ));

View File

@ -90,9 +90,9 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
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 );
@ -111,9 +111,9 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
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;
@ -131,10 +131,10 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
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;
@ -151,10 +151,10 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
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;
@ -207,10 +207,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
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;
@ -228,10 +228,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
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;
@ -248,10 +248,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
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;
@ -268,10 +268,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
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

@ -588,7 +588,7 @@ int CBaseHudChat::ComputeBreakChar( int width, const char *text, int textlen )
// this one
if ( lastbreak == textlen )
{
lastbreak = max( 0, i - 1 );
lastbreak = MAX( 0, i - 1 );
}
break;
}

View File

@ -1035,7 +1035,7 @@ void CHudCloseCaption::Paint( void )
float desiredAlpha = visibleitems.Count() >= 1 ? 1.0f : 0.0f;
// Always return at least one line height for drawing the surrounding box
totalheight = max( totalheight, m_nLineHeight );
totalheight = MAX( totalheight, m_nLineHeight );
// Trigger box growing
if ( totalheight != m_nGoalHeight )
@ -1091,7 +1091,7 @@ void CHudCloseCaption::Paint( void )
Color bgColor = GetBgColor();
bgColor[3] = m_flBackgroundAlpha;
DrawBox( rcText.left, max(rcText.top,0), rcText.right - rcText.left, rcText.bottom - max(rcText.top,0), bgColor, m_flCurrentAlpha );
DrawBox( rcText.left, MAX(rcText.top,0), rcText.right - rcText.left, rcText.bottom - MAX(rcText.top,0), bgColor, m_flCurrentAlpha );
if ( !visibleitems.Count() )
{
@ -1129,7 +1129,7 @@ void CHudCloseCaption::Paint( void )
{
float ttl = si->item->GetTimeToLive();
ttl -= si->item->GetAddedTime();
ttl = max( 0.0f, ttl );
ttl = MAX( 0.0f, ttl );
si->item->SetTimeToLive( ttl );
si->item->SetAddedTime( 0.0f );
}
@ -1272,7 +1272,7 @@ void CHudCloseCaption::OnTick( void )
if ( predisplay > 0.0f )
{
predisplay -= dt;
predisplay = max( 0.0f, predisplay );
predisplay = MAX( 0.0f, predisplay );
item->SetPreDisplayTime( predisplay );
}
else
@ -1280,7 +1280,7 @@ void CHudCloseCaption::OnTick( void )
// remove time from actual playback
float ttl = item->GetTimeToLive();
ttl -= dt;
ttl = max( 0.0f, ttl );
ttl = MAX( 0.0f, ttl );
item->SetTimeToLive( ttl );
}
}
@ -1528,7 +1528,7 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, char cons
addedlife = prevlife - lifespan;
}
lifespan = max( lifespan, prevlife );
lifespan = MAX( lifespan, prevlife );
}
float delay = 0.0f;
@ -1572,7 +1572,7 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, char cons
out = phrase;
// Delay must be positive
delay = max( 0.0f, (float)wcstod( args, NULL ) );
delay = MAX( 0.0f, (float)wcstod( args, NULL ) );
continue;
}
@ -1619,7 +1619,7 @@ void CHudCloseCaption::CreateFonts( void )
m_hFonts[ CCFONT_ITALIC ] = pScheme->GetFont( "CloseCaption_Italic" );
m_hFonts[ CCFONT_ITALICBOLD ] = pScheme->GetFont( "CloseCaption_BoldItalic" );
#endif
m_nLineHeight = max( 6, vgui::surface()->GetFontTall( m_hFonts[ CCFONT_NORMAL ] ) );
m_nLineHeight = MAX( 6, vgui::surface()->GetFontTall( m_hFonts[ CCFONT_NORMAL ] ) );
}
struct WorkUnitParams
@ -1706,8 +1706,8 @@ void CHudCloseCaption::AddWorkUnit( CCloseCaptionItem *item,
int curheight = item->GetHeight();
int curwidth = item->GetWidth();
curheight = max( curheight, params.y + wu->GetHeight() );
curwidth = max( curwidth, params.x + params.width );
curheight = MAX( curheight, params.y + wu->GetHeight() );
curwidth = MAX( curwidth, params.x + params.width );
item->SetHeight( curheight );
item->SetWidth( curwidth );
@ -2771,7 +2771,7 @@ void EmitRandomCaption_f()
int count = 1;
if ( engine->Cmd_Argc() == 2 )
{
count = max( 1, atoi( engine->Cmd_Argv( 1 ) ) );
count = MAX( 1, atoi( engine->Cmd_Argv( 1 ) ) );
}
CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption );
if ( hudCloseCaption )

View File

@ -288,7 +288,7 @@ bool CHudHintDisplay::SetHintText( const char *text )
}
}
}
int tallest = max( tallest1, tallest2 );
int tallest = MAX( tallest1, tallest2 );
// position the labels
int col1_x = m_iTextX;

View File

@ -89,8 +89,8 @@ void CHud::Think(void)
void CHud::DrawProgressBar( int x, int y, int width, int height, float percentage, Color& clr, unsigned char type )
{
//Clamp our percentage
percentage = min( 1.0f, percentage );
percentage = max( 0.0f, percentage );
percentage = MIN( 1.0f, percentage );
percentage = MAX( 0.0f, percentage );
Color lowColor = clr;
lowColor[ 0 ] /= 2;
@ -145,8 +145,8 @@ void CHud::DrawIconProgressBar( int x, int y, CHudTexture *icon, CHudTexture *ic
return;
//Clamp our percentage
percentage = min( 1.0f, percentage );
percentage = max( 0.0f, percentage );
percentage = MIN( 1.0f, percentage );
percentage = MAX( 0.0f, percentage );
int height = icon->Height();
int width = icon->Width();

View File

@ -579,11 +579,11 @@ void CInput::GetFullscreenMousePos( int *mx, int *my, int *unclampedx /*=NULL*/,
}
// Clamp
current_posx = max( 0, current_posx );
current_posx = min( ScreenWidth(), current_posx );
current_posx = MAX( 0, current_posx );
current_posx = MIN( ScreenWidth(), current_posx );
current_posy = max( 0, current_posy );
current_posy = min( ScreenHeight(), current_posy );
current_posy = MAX( 0, current_posy );
current_posy = MIN( ScreenHeight(), current_posy );
*mx = current_posx;
*my = current_posy;

View File

@ -623,7 +623,7 @@ inline bool CInterpolatedVarArrayBase<Type>::GetInterpolationInfo(
if ( dt > 0.0001f )
{
pInfo->frac = ( targettime - older_change_time ) / ( newer_change_time - older_change_time );
pInfo->frac = min( pInfo->frac, 2.0f );
pInfo->frac = MIN( pInfo->frac, 2.0f );
CVarHistory::IndexType_t oldestindex = varHistory.Next( i );
@ -1090,7 +1090,7 @@ inline void CInterpolatedVarArrayBase<Type>::_Extrapolate(
}
else
{
float flExtrapolationAmount = min( flDestinationTime - pNew->changetime, flMaxExtrapolationAmount );
float flExtrapolationAmount = MIN( flDestinationTime - pNew->changetime, flMaxExtrapolationAmount );
float divisor = 1.0f / (pNew->changetime - pOld->changetime);
for ( int i=0; i < m_nMaxCount; i++ )

View File

@ -91,7 +91,7 @@ void CLampHaloProxy::OnBind( C_BaseEntity *pEnt )
}
else
{
fade = min( (fade - 0.25) * 1.35, 1.0f );
fade = MIN( (fade - 0.25) * 1.35, 1.0f );
}
m_pFadeValue->SetFloatValue( fade );

View File

@ -167,8 +167,8 @@ inline const Particle* CParticleRenderIterator::GetNext( float sortKey )
// Update the incremental sort.
if( m_bBucketSort )
{
m_MinZ = min( sortKey, m_MinZ );
m_MaxZ = max( sortKey, m_MaxZ );
m_MinZ = MIN( sortKey, m_MinZ );
m_MaxZ = MAX( sortKey, m_MaxZ );
m_zCoords[m_nZCoords] = sortKey;
++m_nZCoords;

View File

@ -556,7 +556,7 @@ Vector CFireParticle::UpdateColor( const SimpleParticle *pParticle )
for ( int i = 0; i < 3; i++ )
{
//FIXME: This is frame dependant... but I don't want to store off start/end colors yet
//pParticle->m_uchColor[i] = max( 0, pParticle->m_uchColor[i]-2 );
//pParticle->m_uchColor[i] = MAX( 0, pParticle->m_uchColor[i]-2 );
}
return CSimpleEmitter::UpdateColor( pParticle );

View File

@ -110,7 +110,7 @@ inline void CParticleSphereRenderer::AddLightColor(
inline void CParticleSphereRenderer::ClampColor( Vector &vColor )
{
float flMax = max( vColor.x, max( vColor.y, vColor.z ) );
float flMax = MAX( vColor.x, MAX( vColor.y, vColor.z ) );
if( flMax > 1 )
{
vColor *= 255.0f / flMax;

View File

@ -1361,9 +1361,9 @@ int CPrediction::ComputeFirstCommandToExecute( bool received_new_world_update, i
// this is where we would normally start
int start = incoming_acknowledged + 1;
// outgoing_command is where we really want to start
skipahead = max( 0, ( outgoing_command - start ) );
skipahead = MAX( 0, ( outgoing_command - start ) );
// Don't start past the last predicted command, though, or we'll get prediction errors
skipahead = min( skipahead, m_nCommandsPredicted );
skipahead = MIN( skipahead, m_nCommandsPredicted );
if ( m_nCommandsPredicted != skipahead )
{

View File

@ -119,8 +119,8 @@ void CHudChatLine::PerformFadeout( void )
{
wchar_t wText[4096];
// draw the first x characters in the player color
wcsncpy( wText, wbuf, min( m_iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
wText[ min( m_iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
wcsncpy( wText, wbuf, MIN( m_iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
wText[ MIN( m_iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
m_clrNameColor[3] = alpha;
@ -433,8 +433,8 @@ void CHudChat::ChatPrintf( int iPlayerIndex, const char *fmt, ... )
line->SetExpireTime();
// draw the first x characters in the player color
Q_strncpy( buf, pmsg, min( iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
buf[ min( iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
Q_strncpy( buf, pmsg, MIN( iNameLength + 1, MAX_PLAYER_NAME_LENGTH+32) );
buf[ MIN( iNameLength, MAX_PLAYER_NAME_LENGTH+31) ] = 0;
line->InsertColorChange( Color( flColor[0], flColor[1], flColor[2], 255 ) );
line->InsertString( buf );
Q_strncpy( buf, pmsg + iNameLength, strlen( pmsg ));

View File

@ -117,7 +117,7 @@ void CHudHealth::OnThink()
if ( local )
{
// Never below zero
newHealth = max( local->GetHealth(), 0 );
newHealth = MAX( local->GetHealth(), 0 );
}
// Only update the fade if we've changed health

View File

@ -217,7 +217,7 @@ void CHudWeaponSelection::Paint()
// interpolate the selected box size between the small box size and the large box size
// interpolation has been removed since there is no weapon pickup animation anymore, so it's all at the largest size
float percentageDone = 1.0f; //min(1.0f, (gpGlobals->curtime - m_flPickupStartTime) / m_flWeaponPickupGrowTime);
float percentageDone = 1.0f; //MIN(1.0f, (gpGlobals->curtime - m_flPickupStartTime) / m_flWeaponPickupGrowTime);
int largeBoxWide = m_flSmallBoxSize + ((m_flLargeBoxWide - m_flSmallBoxSize) * percentageDone);
int largeBoxTall = m_flSmallBoxSize + ((m_flLargeBoxTall - m_flSmallBoxSize) * percentageDone);
Color selectedColor;

View File

@ -74,10 +74,10 @@ void DrawSmokeFogOverlay()
static float dist = 10;
Vector vColor = g_SmokeFogOverlayColor;
vColor.x = min(max(vColor.x, 0), 1);
vColor.y = min(max(vColor.y, 0), 1);
vColor.z = min(max(vColor.z, 0), 1);
float alpha = min(max(g_SmokeFogOverlayAlpha, 0), 1);
vColor.x = MIN(MAX(vColor.x, 0), 1);
vColor.y = MIN(MAX(vColor.y, 0), 1);
vColor.z = MIN(MAX(vColor.z, 0), 1);
float alpha = MIN(MAX(g_SmokeFogOverlayAlpha, 0), 1);
meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 );

View File

@ -94,13 +94,13 @@ static int IntersectWRect(const wrect_t *prc1, const wrect_t *prc2, wrect_t *prc
if (!prc)
prc = &rc;
prc->left = max(prc1->left, prc2->left);
prc->right = min(prc1->right, prc2->right);
prc->left = MAX(prc1->left, prc2->left);
prc->right = MIN(prc1->right, prc2->right);
if (prc->left < prc->right)
{
prc->top = max(prc1->top, prc2->top);
prc->bottom = min(prc1->bottom, prc2->bottom);
prc->top = MAX(prc1->top, prc2->top);
prc->bottom = MIN(prc1->bottom, prc2->bottom);
if (prc->top < prc->bottom)
return 1;

View File

@ -102,7 +102,7 @@ void CEntityPanel::ComputeAndSetSize( void )
// Get distance to entity
float flDistance = (m_pBaseEntity->GetRenderOrigin() - MainViewOrigin()).Length();
flDistance *= 2;
m_flScale = 0.25 + max( 0, 2.0 - (flDistance / 2048) );
m_flScale = 0.25 + MAX( 0, 2.0 - (flDistance / 2048) );
}
// Update the size

View File

@ -683,7 +683,7 @@ void CBlockingFileIOPanel::DrawIOTime( int x, int y, int w, int h, int slot, ch
int historyWide = ( int ) ( w * hfrac + 0.5f );
int spikeWide = ( int ) ( w * spikefrac + 0.5f );
int useWide = max( barWide, historyWide );
int useWide = MAX( barWide, historyWide );
vgui::surface()->DrawSetColor( Color( 0, 0, 0, 31 ) );
vgui::surface()->DrawFilledRect( x, y, x + w, y + h );

View File

@ -390,15 +390,15 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w
int ptx, pty;
// Draw cmd_rate value
ptx = max( x + w - 1 - 25, 1 );
pty = max( vrect.y + vrect.height - 4 - LERP_HEIGHT + 1, 1 );
ptx = MAX( x + w - 1 - 25, 1 );
pty = MAX( vrect.y + vrect.height - 4 - LERP_HEIGHT + 1, 1 );
extrap_point = LERP_HEIGHT / 3;
for (a=0 ; a<w ; a++)
{
i = ( m_OutgoingSequence - a ) & ( TIMINGS - 1 );
h = min( ( cmdinfo[i].cmd_lerp / 3.0 ) * LERP_HEIGHT, LERP_HEIGHT );
h = MIN( ( cmdinfo[i].cmd_lerp / 3.0 ) * LERP_HEIGHT, LERP_HEIGHT );
rcFill.x = x + w -a - 1;
rcFill.width = 1;
@ -505,7 +505,7 @@ void CNetGraphPanel::GetFrameData( INetChannelInfo *netchannel, int *biggest_me
}
// Can't be below zero
m_AvgLatency = max( 0.0, m_AvgLatency );
m_AvgLatency = MAX( 0.0, m_AvgLatency );
// Fill in frame data
for ( int seqnr =m_IncomingSequence - m_UpdateWindowSize + 1
@ -755,7 +755,7 @@ void CNetGraphPanel::DrawHatches( int x, int y, int maxmsgbytes )
byte color[3];
ystep = (int)( 10.0 / net_scale.GetFloat() );
ystep = max( ystep, 1 );
ystep = MAX( ystep, 1 );
rcHatch.y = y;
rcHatch.height = 1;
@ -921,7 +921,7 @@ void CNetGraphPanel::Paint()
vrect.height = sh;
w = min( (int)TIMINGS, m_EstimatedWidth );
w = MIN( (int)TIMINGS, m_EstimatedWidth );
if ( vrect.width < w + 10 )
{
w = vrect.width - 10;
@ -952,7 +952,7 @@ void CNetGraphPanel::Paint()
DrawTimes( vrect, m_Cmdinfo, x, w );
// Draw update rate
DrawUpdateRate( max( 1, x + w - 25 ), max( 1, y - net_graphheight.GetFloat() - 1 ) );
DrawUpdateRate( MAX( 1, x + w - 25 ), MAX( 1, y - net_graphheight.GetFloat() - 1 ) );
}
DrawTextFields( graphtype, x, y, m_Graph, m_Cmdinfo );

View File

@ -481,7 +481,7 @@ void CViewRenderBeams::InitBeams( void )
int p = CommandLine()->ParmValue("-particles", -1);
if ( p >= 0 )
{
m_nNumBeamTrails = max( p, MIN_PARTICLES );
m_nNumBeamTrails = MAX( p, MIN_PARTICLES );
}
else
{
@ -1540,8 +1540,8 @@ void CViewRenderBeams::UpdateBeam( Beam_t *pbeam, float frametime )
{
frac = remaining / pbeam->life;
}
frac = min( 1.0f, frac );
frac = max( 0.0f, frac );
frac = MIN( 1.0f, frac );
frac = MAX( 0.0f, frac );
frac = 1.0f - frac;

View File

@ -526,8 +526,8 @@ void CViewEffects::FadeCalculate( void )
{
iFadeAlpha += pFade->alpha;
}
iFadeAlpha = min( iFadeAlpha, pFade->alpha );
iFadeAlpha = max( 0, iFadeAlpha );
iFadeAlpha = MIN( iFadeAlpha, pFade->alpha );
iFadeAlpha = MAX( 0, iFadeAlpha );
}
else
{

View File

@ -1087,7 +1087,7 @@ void CViewRender::DrawOpaqueRenderables( ClientWorldListInfo_t& info, CRenderLis
nOpaque = renderList.m_RenderGroupCounts[RENDER_GROUP_OPAQUE_STATIC];
if ( nOpaque )
{
nOpaque = min( nOpaque, 512 );
nOpaque = MIN( nOpaque, 512 );
IClientRenderable *pStatics[512];
for( i=0; i < nOpaque; ++i )
@ -2615,8 +2615,8 @@ static void DrawScreenSpaceRectangleWithSlop(
)
{
// add slop
int slopwidth=width+FILTER_KERNEL_SLOP; //min(dest_rt->GetActualWidth()-destx,width+FILTER_KERNEL_SLOP);
int slopheight=height+FILTER_KERNEL_SLOP; //min(dest_rt->GetActualHeight()-desty,height+FILTER_KERNEL_SLOP);
int slopwidth=width+FILTER_KERNEL_SLOP; //MIN(dest_rt->GetActualWidth()-destx,width+FILTER_KERNEL_SLOP);
int slopheight=height+FILTER_KERNEL_SLOP; //MIN(dest_rt->GetActualHeight()-desty,height+FILTER_KERNEL_SLOP);
// adjust coordinates for slop
src_texture_x1=FLerp(src_texture_x0,src_texture_x1,destx,destx+width-1,destx+slopwidth-1);
src_texture_y1=FLerp(src_texture_y0,src_texture_y1,desty,desty+height-1,desty+slopheight-1);
@ -2882,7 +2882,7 @@ public:
int width=500*(e.m_max_lum-e.m_min_lum);
if (np)
{
int height=max(1,min(HISTOGRAM_BAR_SIZE,np/6000));
int height=MAX(1,MIN(HISTOGRAM_BAR_SIZE,np/6000));
materials->Viewport(xp,HISTOGRAM_BAR_SIZE-height,width,height);
materials->ClearColor3ub(255,0,0);
materials->ClearBuffers(true,true);
@ -2958,7 +2958,7 @@ static void SetToneMapScale(float newvalue, float minvalue, float maxvalue)
avg+=weight*s_MovingAverageToneMapScale[i];
}
avg*=(1.0/sumweights);
avg=min(maxvalue,max(minvalue,avg));
avg=MIN(maxvalue,MAX(minvalue,avg));
mat_hdr_tonemapscale.SetValue(avg);
}
#endif
@ -3069,10 +3069,10 @@ static void DoPostProcessingEffects( int x, int y, int w, int h )
float avg_lum=g_HDR_HistogramSystem.GetAverageLuminance();
float last_scale=materials->GetToneMappingScaleLinear().x;
float actual_unscaled_luminance=avg_lum*(1.0/last_scale);
actual_unscaled_luminance=max(0.000000001,avg_lum);
actual_unscaled_luminance=MAX(0.000000001,avg_lum);
float target_scale=0.005/actual_unscaled_luminance;
float scalevalue=max(flAutoExposureMin,
min(flAutoExposureMax,target_scale));
float scalevalue=MAX(flAutoExposureMin,
MIN(flAutoExposureMax,target_scale));
if (mat_debug_autoexposure.GetInt())
Warning("avg_lum=%f ra=%f target=%f adj target=%f\n",
avg_lum,actual_unscaled_luminance,target_scale,scalevalue);
@ -3154,9 +3154,9 @@ static void DoPostProcessingEffects( int x, int y, int w, int h )
// Warning("avg_lum=%f\n",g_HDR_HistogramSystem.GetAverageLuminance());
if (mat_dynamic_tonemapping.GetInt())
{
float avg_lum=max(0.0001,g_HDR_HistogramSystem.GetAverageLuminance());
float scalevalue=max(flAutoExposureMin,
min(flAutoExposureMax,0.18/avg_lum));
float avg_lum=MAX(0.0001,g_HDR_HistogramSystem.GetAverageLuminance());
float scalevalue=MAX(flAutoExposureMin,
MIN(flAutoExposureMax,0.18/avg_lum));
mat_hdr_tonemapscale.SetValue(scalevalue);
}
}
@ -3188,9 +3188,9 @@ static void DoPostProcessingEffects( int x, int y, int w, int h )
g_HDR_HistogramSystem.DisplayHistogram();
if (mat_dynamic_tonemapping.GetInt())
{
float avg_lum=max(0.0001,g_HDR_HistogramSystem.GetAverageLuminance());
float scalevalue=max(flAutoExposureMin,
min(flAutoExposureMax,0.023/avg_lum));
float avg_lum=MAX(0.0001,g_HDR_HistogramSystem.GetAverageLuminance());
float scalevalue=MAX(flAutoExposureMin,
MIN(flAutoExposureMax,0.023/avg_lum));
SetToneMapScale(scalevalue,flAutoExposureMin,flAutoExposureMax);
}
materials->SetRenderTarget( NULL );

View File

@ -458,8 +458,8 @@ const char *SplitContext( const char *raw, char *key, int keylen, char *value, i
}
int len = colon1 - raw;
Q_strncpy( key, raw, min( len + 1, keylen ) );
key[ min( len, keylen - 1 ) ] = 0;
Q_strncpy( key, raw, MIN( len + 1, keylen ) );
key[ MIN( len, keylen - 1 ) ] = 0;
bool last = false;
char *end = Q_strstr( colon1 + 1, "," );
@ -476,7 +476,7 @@ const char *SplitContext( const char *raw, char *key, int keylen, char *value, i
if ( duration )
*duration = atof( colon2 + 1 );
len = min( colon2 - ( colon1 + 1 ), valuelen - 1 );
len = MIN( colon2 - ( colon1 + 1 ), valuelen - 1 );
Q_strncpy( value, colon1 + 1, len + 1 );
value[ len ] = 0;
}
@ -485,7 +485,7 @@ const char *SplitContext( const char *raw, char *key, int keylen, char *value, i
if ( duration )
*duration = 0.0;
len = min( end - ( colon1 + 1 ), valuelen - 1 );
len = MIN( end - ( colon1 + 1 ), valuelen - 1 );
Q_strncpy( value, colon1 + 1, len + 1 );
value[ len ] = 0;
}

View File

@ -74,7 +74,7 @@ void CAI_InterestTarget::Add( CBaseEntity *pTarget, float flImportance, float fl
{
if (target.m_flStartTime == gpGlobals->curtime)
{
flImportance = max( flImportance, target.m_flInterest );
flImportance = MAX( flImportance, target.m_flInterest );
}
Remove( i );
break;
@ -114,7 +114,7 @@ void CAI_InterestTarget::Add( CBaseEntity *pTarget, const Vector &vecPosition, f
{
if (target.m_flStartTime == gpGlobals->curtime)
{
flImportance = max( flImportance, target.m_flInterest );
flImportance = MAX( flImportance, target.m_flInterest );
}
Remove( i );
break;

View File

@ -12,9 +12,6 @@
#pragma once
#endif
#undef MINMAX_H
#include "minmax.h" // max() define
//-----------------------------------------------------------------------------
// CAI_BaseActor
//

View File

@ -673,7 +673,7 @@ int CBaseAnimatingOverlay::AllocateLayer( int iPriority )
{
if (m_AnimOverlay[i].m_nPriority <= iPriority)
{
iNewOrder = max( iNewOrder, m_AnimOverlay[i].m_nOrder + 1 );
iNewOrder = MAX( iNewOrder, m_AnimOverlay[i].m_nOrder + 1 );
}
}
else if (m_AnimOverlay[ i ].IsDying())
@ -759,7 +759,7 @@ void CBaseAnimatingOverlay::SetLayerPriority( int iLayer, int iPriority )
{
if (m_AnimOverlay[i].m_nPriority <= iPriority)
{
iNewOrder = max( iNewOrder, m_AnimOverlay[i].m_nOrder + 1 );
iNewOrder = MAX( iNewOrder, m_AnimOverlay[i].m_nOrder + 1 );
}
}
}

View File

@ -207,7 +207,7 @@ float CRagdollMagnet::DistToPoint( const Vector &vecPoint )
axis.InitializePlane( vecUp, GetAbsOrigin() );
vDist = fabs( axis.PointDist( vecPoint ) );
return max( hDist, vDist );
return MAX( hDist, vDist );
}
else
{

View File

@ -1036,7 +1036,7 @@ void CPointCommentaryNode::UpdateViewPostThink( void )
{
// Blend back to the player's position over time.
float flCurTime = (gpGlobals->curtime - m_flFinishedTime);
float flTimeToBlend = min( 2.0, m_flFinishedTime - m_flStartTime );
float flTimeToBlend = MIN( 2.0, m_flFinishedTime - m_flStartTime );
float flBlendPerc = 1.0 - clamp( flCurTime / flTimeToBlend, 0, 1 );
//Msg("OUT: CurTime %.2f, BlendTime: %.2f, Blend: %.3f\n", flCurTime, flTimeToBlend, flBlendPerc );

View File

@ -143,7 +143,7 @@ void CEnvBeam::Spawn( void )
BaseClass::Spawn();
m_noiseAmplitude = min(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude);
m_noiseAmplitude = MIN(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude);
// Check for tapering
if ( HasSpawnFlags( SF_BEAM_TAPEROUT ) )
@ -747,8 +747,8 @@ void CEnvBeam::BeamUpdateVars( void )
RelinkBeam();
SetWidth( min(MAX_BEAM_WIDTH, m_boltWidth) );
SetNoise( min(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude) );
SetWidth( MIN(MAX_BEAM_WIDTH, m_boltWidth) );
SetNoise( MIN(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude) );
SetFrame( m_frameStart );
SetScrollRate( m_speed );
if ( m_spawnflags & SF_BEAM_SHADEIN )

View File

@ -214,7 +214,7 @@ void CEnvShake::ApplyShake( ShakeCommand_t command )
radius = 512;
}
Vector extents = Vector(radius, radius, radius);
extents.z = max(extents.z, 100);
extents.z = MAX(extents.z, 100);
Vector mins = GetAbsOrigin() - extents;
Vector maxs = GetAbsOrigin() + extents;
int count = UTIL_EntitiesInBox( list, 1024, mins, maxs, 0 );

View File

@ -207,9 +207,9 @@ float CPointAngularVelocitySensor::SampleAngularVelocity(CBaseEntity *pEntity)
else
{
QAngle vecAngVel = pEntity->GetLocalAngularVelocity();
float flMax = max(fabs(vecAngVel[PITCH]), fabs(vecAngVel[YAW]));
float flMax = MAX(fabs(vecAngVel[PITCH]), fabs(vecAngVel[YAW]));
return max(flMax, fabs(vecAngVel[ROLL]));
return MAX(flMax, fabs(vecAngVel[ROLL]));
}
return 0;

View File

@ -254,7 +254,7 @@ bool CAI_BaseActor::StartSceneEvent( CSceneEventInfo *info, CChoreoScene *scene,
Blink();
// don't blink for duration, or next random blink time
float flDuration = (event->GetEndTime() - scene->GetTime());
m_flBlinktime = gpGlobals->curtime + max( flDuration, random->RandomFloat( 1.5, 4.5 ) );
m_flBlinktime = gpGlobals->curtime + MAX( flDuration, random->RandomFloat( 1.5, 4.5 ) );
}
else if (stricmp( event->GetParameters(), "AI_HOLSTER") == 0)
{
@ -410,8 +410,8 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
{
dir = 1;
}
flSpineYaw = min( diff, 30 );
flBodyYaw = min( diff - flSpineYaw, 30 );
flSpineYaw = MIN( diff, 30 );
flBodyYaw = MIN( diff - flSpineYaw, 30 );
m_goalSpineYaw = m_goalSpineYaw * (1.0 - intensity) + intensity * flSpineYaw * dir;
m_goalBodyYaw = m_goalBodyYaw * (1.0 - intensity) + intensity * flBodyYaw * dir;
@ -442,15 +442,15 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
}
// calc how much to use the spine for turning
float spineintensity = (1.0 - max( 0.0, (intensity - 0.5) / 0.5 ));
float spineintensity = (1.0 - MAX( 0.0, (intensity - 0.5) / 0.5 ));
// force spine to full if not in scene or locked
if (!bInScene || event->IsLockBodyFacing() )
{
spineintensity = 1.0;
}
flSpineYaw = min( diff * spineintensity, 30 );
flBodyYaw = min( diff * spineintensity - flSpineYaw, 30 );
flSpineYaw = MIN( diff * spineintensity, 30 );
flBodyYaw = MIN( diff * spineintensity - flSpineYaw, 30 );
info->m_flFacingYaw = info->m_flInitialYaw + (diff - flBodyYaw - flSpineYaw) * dir;
if (!event->IsLockBodyFacing())
@ -461,7 +461,7 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
if (bInScene)
{
// FIXME: what's a reasonable time to wait?
AddSceneLock( min( 2.0, event->GetEndTime() - scene->GetTime() + 0.2 ) );
AddSceneLock( MIN( 2.0, event->GetEndTime() - scene->GetTime() + 0.2 ) );
}
return true;
}
@ -473,7 +473,7 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
{
// keep eyes not blinking for duration
float flDuration = (event->GetEndTime() - scene->GetTime());
m_flBlinktime = max( m_flBlinktime, gpGlobals->curtime + flDuration );
m_flBlinktime = MAX( m_flBlinktime, gpGlobals->curtime + flDuration );
}
return true;
case SCENE_AI_HOLSTER:
@ -505,7 +505,7 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
{
float flDuration = (event->GetEndTime() - scene->GetTime());
int i = m_syntheticLookQueue.Count() - 1;
m_syntheticLookQueue[i].m_flEndTime = min( m_syntheticLookQueue[i].m_flEndTime, gpGlobals->curtime + flDuration );
m_syntheticLookQueue[i].m_flEndTime = MIN( m_syntheticLookQueue[i].m_flEndTime, gpGlobals->curtime + flDuration );
m_syntheticLookQueue[i].m_flInterest = 0.1;
}
}
@ -1496,7 +1496,7 @@ void CAI_BaseActor::MaintainLookTargets( float flInterval )
// no target, decay all head control direction
m_goalHeadDirection = m_goalHeadDirection * 0.8 + vHead * 0.2;
m_goalHeadInfluence = max( m_goalHeadInfluence - 0.2, 0 );
m_goalHeadInfluence = MAX( m_goalHeadInfluence - 0.2, 0 );
VectorNormalize( m_goalHeadDirection );
UpdateHeadBodyControl( vEyePosition + m_goalHeadDirection * 100, m_goalHeadInfluence, vEyePosition + m_goalHeadDirection * 100, 0.0 );

View File

@ -3445,7 +3445,7 @@ void CAI_BaseNPC::RebalanceThinks()
int iMaxThinkersPerTick = static_cast<int>(ceil( (float)( rebalanceCandidates.Count() + 1 ) / (float)iTicksPer10Hz )); // +1 to account for "this"
int iCurTickDistributing = min( gpGlobals->tickcount, rebalanceCandidates[0].iNextThinkTick );
int iCurTickDistributing = MIN( gpGlobals->tickcount, rebalanceCandidates[0].iNextThinkTick );
int iRemainingThinksToDistribute = iMaxThinkersPerTick - 1; // Start with one fewer first time because "this" is
// always gets a slot in the current tick to avoid complications
// in the calculation of "last think"
@ -5499,7 +5499,7 @@ void CAI_BaseNPC::GatherEnemyConditions( CBaseEntity *pEnemy )
float tooFar = m_flDistTooFar;
if ( GetActiveWeapon() && HasCondition(COND_SEE_ENEMY) )
{
tooFar = max( m_flDistTooFar, GetActiveWeapon()->m_fMaxRange1 );
tooFar = MAX( m_flDistTooFar, GetActiveWeapon()->m_fMaxRange1 );
}
if ( flDistToEnemy >= tooFar )

View File

@ -34,8 +34,6 @@
#include "ai_navgoaltype.h" //GoalType_t enum
#include "eventlist.h"
#include "soundent.h"
#undef MINMAX_H
#include "minmax.h"
#define PLAYER_SQUADNAME "player_squad"
@ -1467,7 +1465,7 @@ public:
//
//-----------------------------------------------------
void AddSceneLock( float flDuration ) { m_flSceneTime = max( gpGlobals->curtime + flDuration, m_flSceneTime ); };
void AddSceneLock( float flDuration ) { m_flSceneTime = MAX( gpGlobals->curtime + flDuration, m_flSceneTime ); };
bool IsInLockedScene( void ) { return m_flSceneTime > gpGlobals->curtime; };
float m_flSceneTime;
string_t m_iszSceneCustomMoveSeq;

View File

@ -790,11 +790,11 @@ bool CAI_BaseNPC::FindCoverPos( CSound *pSound, Vector *pResult )
{
if ( !GetTacticalServices()->FindCoverPos( pSound->GetSoundReactOrigin(),
pSound->GetSoundReactOrigin(),
min( pSound->Volume(), 120.0 ),
MIN( pSound->Volume(), 120.0 ),
CoverRadius(),
pResult ) )
{
return GetTacticalServices()->FindLateralCover( pSound->GetSoundReactOrigin(), min( pSound->Volume(), 60.0 ), pResult );
return GetTacticalServices()->FindLateralCover( pSound->GetSoundReactOrigin(), MIN( pSound->Volume(), 60.0 ), pResult );
}
return true;
@ -1732,7 +1732,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
{
if ( GetActiveWeapon() && GetEnemy() )
{
float range = max( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
float range = MAX( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
if ( pTask->flTaskData != 0 && pTask->flTaskData < range )
range = pTask->flTaskData;
float dist = EnemyDistance( GetEnemy() );
@ -1763,8 +1763,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
if ( GetActiveWeapon() )
{
flMaxRange = max( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
flMinRange = min( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 );
flMaxRange = MAX( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
flMinRange = MIN( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 );
}
//Check against NPC's max range
@ -1903,8 +1903,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
if ( GetActiveWeapon() )
{
flMaxRange = max( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
flMinRange = min( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 );
flMaxRange = MAX( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
flMinRange = MIN( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 );
}
// Check against NPC's max range
@ -2054,8 +2054,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
float flMinRange = 0;
if (GetActiveWeapon())
{
flMaxRange = max(GetActiveWeapon()->m_fMaxRange1,GetActiveWeapon()->m_fMaxRange2);
flMinRange = min(GetActiveWeapon()->m_fMinRange1,GetActiveWeapon()->m_fMinRange2);
flMaxRange = MAX(GetActiveWeapon()->m_fMaxRange1,GetActiveWeapon()->m_fMaxRange2);
flMinRange = MIN(GetActiveWeapon()->m_fMinRange1,GetActiveWeapon()->m_fMinRange2);
}
// Check against NPC's max range
@ -3453,7 +3453,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
}
AngleVectors( ang, &move );
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, min(36,pTask->flTaskData), true ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ))
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, MIN(36,pTask->flTaskData), true ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ))
{
TaskComplete();
}
@ -3462,7 +3462,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
ang.y = GetMotor()->GetIdealYaw() + 91;
AngleVectors( ang, &move );
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, min(24,pTask->flTaskData), true ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ) )
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, MIN(24,pTask->flTaskData), true ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ) )
{
TaskComplete();
}
@ -3479,7 +3479,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
ang.y = GetMotor()->GetIdealYaw() + 271;
AngleVectors( ang, &move );
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, min(24,pTask->flTaskData), true ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ) )
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, MIN(24,pTask->flTaskData), true ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ) )
{
TaskComplete();
}
@ -3501,7 +3501,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
AngleVectors( ang, &move );
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, min(6,pTask->flTaskData), false ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ) )
if ( GetNavigator()->SetVectorGoal( move, (float)pTask->flTaskData, MIN(6,pTask->flTaskData), false ) && IsValidMoveAwayDest( GetNavigator()->GetGoalPos() ) )
{
TaskComplete();
}

View File

@ -435,14 +435,14 @@ bool CAI_FollowBehavior::IsFollowTargetInRange()
if( GetNpcState() == NPC_STATE_COMBAT )
{
if( IsFollowGoalInRange( max( m_FollowNavGoal.coverTolerance, m_FollowNavGoal.enemyLOSTolerance ), GetGoalZRange(), GetGoalFlags() ) )
if( IsFollowGoalInRange( MAX( m_FollowNavGoal.coverTolerance, m_FollowNavGoal.enemyLOSTolerance ), GetGoalZRange(), GetGoalFlags() ) )
{
return true;
}
}
else
{
if( IsFollowGoalInRange( max( m_FollowNavGoal.tolerance, GetGoalRange() ), GetGoalZRange(), GetGoalFlags() ) )
if( IsFollowGoalInRange( MAX( m_FollowNavGoal.tolerance, GetGoalRange() ), GetGoalZRange(), GetGoalFlags() ) )
{
if ( m_FollowNavGoal.flags & AIFF_REQUIRE_LOS_OUTSIDE_COMBAT )
{
@ -827,7 +827,7 @@ CAI_Hint *CAI_FollowBehavior::FindFollowPoint()
hintCriteria.SetFlag( bits_HINT_NODE_VISIBLE | bits_HINT_NODE_NEAREST );
// Add the search position
hintCriteria.AddIncludePosition( GetGoalPosition(), max( m_FollowNavGoal.followPointTolerance, GetGoalRange() ) );
hintCriteria.AddIncludePosition( GetGoalPosition(), MAX( m_FollowNavGoal.followPointTolerance, GetGoalRange() ) );
hintCriteria.AddExcludePosition( GetGoalPosition(), (GetFollowTarget()->WorldAlignMins().AsVector2D() - GetFollowTarget()->WorldAlignMaxs().AsVector2D()).Length());
return CAI_HintManager::FindHint( GetOuter(), hintCriteria );
@ -839,7 +839,7 @@ bool CAI_FollowBehavior::IsFollowPointInRange()
{
return ( GetHintNode() &&
GetHintNode()->HintType() == HINT_FOLLOW_WAIT_POINT &&
(GetHintNode()->GetAbsOrigin() - GetFollowTarget()->GetAbsOrigin()).LengthSqr() < Square(max(m_FollowNavGoal.followPointTolerance, GetGoalRange())) );
(GetHintNode()->GetAbsOrigin() - GetFollowTarget()->GetAbsOrigin()).LengthSqr() < Square(MAX(m_FollowNavGoal.followPointTolerance, GetGoalRange())) );
}
@ -1390,7 +1390,7 @@ void CAI_FollowBehavior::StartTask( const Task_t *pTask )
if ( pLeader )
{
Vector coverPos = vec3_invalid;
float coverRadius = min( GetOuter()->CoverRadius(), m_FollowNavGoal.coverTolerance );
float coverRadius = MIN( GetOuter()->CoverRadius(), m_FollowNavGoal.coverTolerance );
if ( FindCoverFromEnemyAtFollowTarget( coverRadius, &coverPos ) )
{
@ -1479,7 +1479,7 @@ void CAI_FollowBehavior::RunTask( const Task_t *pTask )
{
Assert( GetOuter()->m_vInterruptSavePosition == vec3_invalid );
Vector coverPos = vec3_invalid;
float coverRadius = min( (float)12*12, m_FollowNavGoal.coverTolerance );
float coverRadius = MIN( (float)12*12, m_FollowNavGoal.coverTolerance );
if ( FindCoverFromEnemyAtFollowTarget( coverRadius, &coverPos ) )
{
GetOuter()->m_vInterruptSavePosition = coverPos;

View File

@ -148,7 +148,7 @@ void CAI_RappelBehavior::SetDescentSpeed()
float factor;
factor = flDist / RAPPEL_DECEL_DIST;
speed = max( RAPPEL_MIN_SPEED, speed * factor );
speed = MAX( RAPPEL_MIN_SPEED, speed * factor );
}
Vector vecNewVelocity = vec3_origin;

View File

@ -380,7 +380,7 @@ void CAI_BlendedMotor::SetMoveScriptAnim( float flNewSpeed )
m_flSecondaryWeight = 0.0;
}
m_flSecondaryWeight = min( m_flSecondaryWeight + 0.3, 1.0 );
m_flSecondaryWeight = MIN( m_flSecondaryWeight + 0.3, 1.0 );
if (m_flSecondaryWeight < 1.0)
{
@ -1092,7 +1092,7 @@ void CAI_BlendedMotor::BuildVelocityScript( const AILocalMoveGoal_t &move )
*/
}
idealVelocity = idealVelocity * min( m_flReactiveSpeedAdjust, m_flPredictiveSpeedAdjust );
idealVelocity = idealVelocity * MIN( m_flReactiveSpeedAdjust, m_flPredictiveSpeedAdjust );
//-------------------------
@ -1178,7 +1178,7 @@ void CAI_BlendedMotor::BuildVelocityScript( const AILocalMoveGoal_t &move )
{
float minJumpHeight = 0;
float maxHorzVel = max( GetCurSpeed(), 100 );
float maxHorzVel = MAX( GetCurSpeed(), 100 );
float gravity = sv_gravity.GetFloat() * GetOuter()->GetGravity();
Vector vecApex;
Vector rawJumpVel = GetMoveProbe()->CalcJumpLaunchVelocity(script.vecLocation, pNext->vecLocation, gravity, &minJumpHeight, maxHorzVel, &vecApex );
@ -1447,7 +1447,7 @@ void CAI_BlendedMotor::BuildVelocityScript( const AILocalMoveGoal_t &move )
// clamp min velocities
for (i = 0; i < m_scriptMove.Count(); i++)
{
m_scriptMove[i].flMaxVelocity = max( m_scriptMove[i].flMaxVelocity, MIN_VELOCITY );
m_scriptMove[i].flMaxVelocity = MAX( m_scriptMove[i].flMaxVelocity, MIN_VELOCITY );
}
// rebuild fields
@ -1517,7 +1517,7 @@ void CAI_BlendedMotor::InsertSlowdown( float distToObstruction, float idealAccel
// clamp the next velocity to the possible accel in the given distance
if (!bAlwaysSlowdown && SolveQuadratic( -0.5 * idealAccel, m_scriptMove[0].flMaxVelocity, -distToObstruction, r1, r2 ))
{
script.flMaxVelocity = max( 10, m_scriptMove[0].flMaxVelocity - idealAccel * r1 );
script.flMaxVelocity = MAX( 10, m_scriptMove[0].flMaxVelocity - idealAccel * r1 );
}
else
{
@ -1718,7 +1718,7 @@ bool CAI_BlendedMotor::AddTurnGesture( float flYD )
float speed = (diff / (turnCompletion * actualDuration / rate)) * 0.1;
speed = clamp( speed, 15, 35 );
speed = min( speed, diff );
speed = MIN( speed, diff );
actualDuration = (diff / (turnCompletion * speed)) * 0.1 ;
@ -1731,7 +1731,7 @@ bool CAI_BlendedMotor::AddTurnGesture( float flYD )
Remember( bits_MEMORY_TURNING );
// don't overlap the turn portion of the gestures, and don't play them too often
m_flNextTurnGesture = gpGlobals->curtime + max( turnCompletion * actualDuration, 0.3 );
m_flNextTurnGesture = gpGlobals->curtime + MAX( turnCompletion * actualDuration, 0.3 );
/*
if ( GetOuter()->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT )

View File

@ -508,7 +508,7 @@ CAI_Hint *CAI_HintManager::FindHint( CAI_BaseNPC *pNPC, const Vector &position,
pNPC ? pNPC->entindex() : -1,
position.x, position.y, position.z,
timer.GetDuration().GetMillisecondsF(),
timer.GetDuration().GetMillisecondsF()/max( (float)visited, 1.0f ) );
timer.GetDuration().GetMillisecondsF()/MAX( (float)visited, 1.0f ) );
}
#endif
return pBestHint;
@ -1347,7 +1347,7 @@ int CAI_Hint::DrawDebugTextOverlays(void)
Q_snprintf(tempstr,sizeof(tempstr),"%s (%i)", GetHintTypeDescription( HintType() ), HintType());
EntityText(text_offset,tempstr,0);
text_offset++;
Q_snprintf(tempstr,sizeof(tempstr),"delay %f", max( 0.0f, m_flNextUseTime - gpGlobals->curtime ) ) ;
Q_snprintf(tempstr,sizeof(tempstr),"delay %f", MAX( 0.0f, m_flNextUseTime - gpGlobals->curtime ) ) ;
EntityText(text_offset,tempstr,0);
text_offset++;

View File

@ -91,13 +91,13 @@ bool CAI_LocalNavigator::MoveCalcDirect( AILocalMoveGoal_t *pMoveGoal, bool bOnl
CAI_Motor *pMotor = GetOuter()->GetMotor();
float minCheckDist = pMotor->MinCheckDist();
float probeDist = m_pPlaneSolver->CalcProbeDist( pMoveGoal->speed ); // having this match steering allows one fewer traces
float checkDist = max( minCheckDist, probeDist );
float checkStepDist = max( 16.0, probeDist * 0.5 );
float checkDist = MAX( minCheckDist, probeDist );
float checkStepDist = MAX( 16.0, probeDist * 0.5 );
if ( pMoveGoal->flags & ( AILMG_TARGET_IS_TRANSITION | AILMG_TARGET_IS_GOAL ) )
{
// clamp checkDist to be no farther than max distance to goal
checkDist = min( checkDist, pMoveGoal->maxDist );
checkDist = MIN( checkDist, pMoveGoal->maxDist );
}
if ( checkDist <= 0.0 )

View File

@ -303,7 +303,7 @@ AIMoveResult_t CAI_Motor::MoveClimbExecute( const Vector &climbDest, const Vecto
if (m_nDismountSequence != ACT_INVALID)
{
// catch situations where the climb mount/dismount finished before reaching goal
climbSpeed = max( climbSpeed, 30.0 );
climbSpeed = MAX( climbSpeed, 30.0 );
}
else
{
@ -763,7 +763,7 @@ void CAI_Motor::UpdateYaw( int yawSpeed )
ideal = UTIL_AngleMod( GetIdealYaw() );
// FIXME: this needs a proper interval
float dt = min( 0.2, gpGlobals->curtime - GetLastThink() );
float dt = MIN( 0.2, gpGlobals->curtime - GetLastThink() );
newYaw = AI_ClampYaw( (float)yawSpeed * 10.0, current, ideal, dt );
@ -933,7 +933,7 @@ float CAI_Motor::MinCheckDist( void )
{
// Take the groundspeed into account
float flMoveDist = GetMoveInterval() * GetIdealSpeed();
float flMinDist = max( MinStoppingDist(), flMoveDist);
float flMinDist = MAX( MinStoppingDist(), flMoveDist);
if ( flMinDist < GetHullWidth() )
flMinDist = GetHullWidth();
return flMinDist;

View File

@ -528,7 +528,7 @@ bool CAI_MoveProbe::TestGroundMove( const Vector &vecActualStart, const Vector &
for (;;)
{
float flStepSize = min( LOCAL_STEP_SIZE, pMoveTrace->flTotalDist - distClear );
float flStepSize = MIN( LOCAL_STEP_SIZE, pMoveTrace->flTotalDist - distClear );
if ( flStepSize < 0.001 )
break;
@ -643,7 +643,7 @@ bool CAI_MoveProbe::TestGroundMove( const Vector &vecActualStart, const Vector &
// and not a ledge above or below the target.
if (!(flags & AITGM_2D))
{
float threshold = max( 0.5f * GetHullHeight(), StepHeight() + 0.1 );
float threshold = MAX( 0.5f * GetHullHeight(), StepHeight() + 0.1 );
if (fabs(pMoveTrace->vEndPosition.z - vecDesiredEnd.z) > threshold)
{
#if 0
@ -1094,9 +1094,9 @@ Vector CAI_MoveProbe::CalcJumpLaunchVelocity(const Vector &startPos, const Vecto
float minHorzHeight = 0.5 * flGravity * (minHorzTime * 0.5) * (minHorzTime * 0.5);
// jump height must be enough to hang in the air
*pminHeight = max( *pminHeight, minHorzHeight );
*pminHeight = MAX( *pminHeight, minHorzHeight );
// jump height must be enough to cover the step up
*pminHeight = max( *pminHeight, stepHeight );
*pminHeight = MAX( *pminHeight, stepHeight );
// time from start to apex
float t0 = sqrt( ( 2.0 * *pminHeight) / flGravity );

View File

@ -1342,7 +1342,7 @@ AIMoveResult_t CAI_Navigator::MoveClimb()
// Look for a block by another NPC, and attempt to recover
AIMoveTrace_t moveTrace;
if ( climbDist > 0.01 &&
!GetMoveProbe()->MoveLimit( NAV_CLIMB, GetLocalOrigin(), GetLocalOrigin() + ( climbDir * min(0.1,climbDist - 0.005) ), MASK_NPCSOLID, GetNavTargetEntity(), &moveTrace ) )
!GetMoveProbe()->MoveLimit( NAV_CLIMB, GetLocalOrigin(), GetLocalOrigin() + ( climbDir * MIN(0.1,climbDist - 0.005) ), MASK_NPCSOLID, GetNavTargetEntity(), &moveTrace ) )
{
CAI_BaseNPC *pOther = ( moveTrace.pObstruction ) ? moveTrace.pObstruction->MyNPCPointer() : NULL;
if ( pOther )
@ -2953,7 +2953,7 @@ AI_NavPathProgress_t CAI_Navigator::ProgressFlyPath( const AI_ProgressFlyPathPar
if ( CurWaypointIsGoal() )
{
float tolerance = max( params.goalTolerance, GetPath()->GetGoalTolerance() );
float tolerance = MAX( params.goalTolerance, GetPath()->GetGoalTolerance() );
if ( waypointDist <= tolerance )
return AINPP_COMPLETE;
}

View File

@ -528,11 +528,11 @@ void CAI_NetworkManager::LoadNetworkGraph( void )
// ------------------------------------------------------------------------
if ( engine->IsInEditMode() )
{
numNodes = max( numNodes, 1024 );
numNodes = MAX( numNodes, 1024 );
}
m_pNetwork->m_pAInode = new CAI_Node*[max( numNodes, 1 )];
memset( m_pNetwork->m_pAInode, 0, sizeof( CAI_Node* ) * max( numNodes, 1 ) );
m_pNetwork->m_pAInode = new CAI_Node*[MAX( numNodes, 1 )];
memset( m_pNetwork->m_pAInode, 0, sizeof( CAI_Node* ) * MAX( numNodes, 1 ) );
// -------------------------------
// Load all the nodes to the file
@ -578,8 +578,8 @@ void CAI_NetworkManager::LoadNetworkGraph( void )
// Load WC lookup table
// -------------------------------
delete [] GetEditOps()->m_pNodeIndexTable;
GetEditOps()->m_pNodeIndexTable = new int[max( m_pNetwork->m_iNumNodes, 1 )];
memset( GetEditOps()->m_pNodeIndexTable, 0, sizeof( int ) *max( m_pNetwork->m_iNumNodes, 1 ) );
GetEditOps()->m_pNodeIndexTable = new int[MAX( m_pNetwork->m_iNumNodes, 1 )];
memset( GetEditOps()->m_pNodeIndexTable, 0, sizeof( int ) *MAX( m_pNetwork->m_iNumNodes, 1 ) );
for (node = 0; node < m_pNetwork->m_iNumNodes; node++)
{
@ -692,7 +692,7 @@ void CAI_NetworkManager::LoadNetworkGraph( void )
// ------------------------------------------------------------------------
if ( engine->IsInEditMode() )
{
numNodes = max( numNodes, 1024 );
numNodes = MAX( numNodes, 1024 );
}
m_pAInode = new CAI_Node*[numNodes];

View File

@ -860,7 +860,7 @@ bool CAI_PlaneSolver::Solve( const AILocalMoveGoal_t &goal, float distClear, Vec
if ( goal.flags & ( AILMG_TARGET_IS_TRANSITION | AILMG_TARGET_IS_GOAL ) )
{
probeDist = min( goal.maxDist, probeDist );
probeDist = MIN( goal.maxDist, probeDist );
}
if ( GenerateObstacleSuggestions( goal, goal.directTrace, distClear, probeDist, degreesPositiveArc, NUM_PROBES ) != SR_FAIL )

View File

@ -16,10 +16,6 @@
#undef min
#endif
#include "stdstring.h"
#ifndef _WIN32
#undef MINMAX_H
#include "minmax.h"
#endif
#if defined( _WIN32 )
#pragma once

View File

@ -275,7 +275,7 @@ float CAI_Path::GetGoalSpeed( const Vector &startPos )
Vector goalDirection = GetGoalDirection( startPos );
Vector targetVelocity = m_goalSpeedTarget->GetSmoothedVelocity();
float dot = DotProduct( goalDirection, targetVelocity );
dot = max( 0.0f, dot );
dot = MAX( 0.0f, dot );
// return a relative impact speed of m_goalSpeed
if (m_goalSpeed > 0.0)
{

View File

@ -682,7 +682,7 @@ bool CAI_Expresser::CanSpeak()
if ( m_flLastTimeAcceptedSpeak == gpGlobals->curtime ) // only one speak accepted per think
return false;
float timeOk = max( m_flStopTalkTime, m_flBlockedTalkTime );
float timeOk = MAX( m_flStopTalkTime, m_flBlockedTalkTime );
return ( timeOk <= gpGlobals->curtime );
}
@ -697,7 +697,7 @@ bool CAI_Expresser::CanSpeakAfterMyself()
if ( m_flLastTimeAcceptedSpeak == gpGlobals->curtime ) // only one speak accepted per think
return false;
float timeOk = max( m_flStopTalkTimeWithoutDelay, m_flBlockedTalkTime );
float timeOk = MAX( m_flStopTalkTimeWithoutDelay, m_flBlockedTalkTime );
return ( timeOk <= gpGlobals->curtime );
}

View File

@ -1449,7 +1449,7 @@ void CBaseAnimating::CalculateIKLocks( float currentTime )
VectorMA( pTarget->est.pos, pTarget->est.height, up, p1 );
VectorMA( pTarget->est.pos, -pTarget->est.height, up, p2 );
float r = max(pTarget->est.radius,1);
float r = MAX(pTarget->est.radius,1);
// don't IK to other characters
ray.Init( p1, p2, Vector(-r,-r,0), Vector(r,r,1) );

View File

@ -2641,7 +2641,7 @@ int CBaseCombatCharacter::GiveAmmo( int iCount, int iAmmoIndex, bool bSuppressSo
return 0;
int iMax = GetAmmoDef()->MaxCarry(iAmmoIndex);
int iAdd = min( iCount, iMax - m_iAmmo[iAmmoIndex] );
int iAdd = MIN( iCount, iMax - m_iAmmo[iAmmoIndex] );
if ( iAdd < 1 )
return 0;
@ -2854,7 +2854,7 @@ void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrc, float flRa
{
// Even the tiniest explosion gets attention. Don't let the radius
// be less than 128 units.
float soundRadius = max( 128.0f, flRadius * 1.5 );
float soundRadius = MAX( 128.0f, flRadius * 1.5 );
CSoundEnt::InsertSound( SOUND_COMBAT | SOUND_CONTEXT_EXPLOSION, vecSrc, static_cast<int>(soundRadius), 0.25, info.GetInflictor() );
}

Some files were not shown because too many files have changed in this diff Show More