diff --git a/choreoobjects/choreoevent.cpp b/choreoobjects/choreoevent.cpp index 3cc1c217..2c5b0338 100644 --- a/choreoobjects/choreoevent.cpp +++ b/choreoobjects/choreoevent.cpp @@ -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; diff --git a/cl_dll/beamdraw.cpp b/cl_dll/beamdraw.cpp index c1daa38c..adb91173 100644 --- a/cl_dll/beamdraw.cpp +++ b/cl_dll/beamdraw.cpp @@ -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 ) diff --git a/cl_dll/c_baseanimating.cpp b/cl_dll/c_baseanimating.cpp index e8f1433c..659dc4b6 100644 --- a/cl_dll/c_baseanimating.cpp +++ b/cl_dll/c_baseanimating.cpp @@ -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 ); diff --git a/cl_dll/c_baseentity.cpp b/cl_dll/c_baseentity.cpp index d3fdbfe8..58d59e5a 100644 --- a/cl_dll/c_baseentity.cpp +++ b/cl_dll/c_baseentity.cpp @@ -603,8 +603,8 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar *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 diff --git a/cl_dll/c_baseflex.cpp b/cl_dll/c_baseflex.cpp index 1a3f7fa7..c11f2029 100644 --- a/cl_dll/c_baseflex.cpp +++ b/cl_dll/c_baseflex.cpp @@ -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; } diff --git a/cl_dll/c_baseplayer.cpp b/cl_dll/c_baseplayer.cpp index 49f8414e..1193a1fb 100644 --- a/cl_dll/c_baseplayer.cpp +++ b/cl_dll/c_baseplayer.cpp @@ -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 diff --git a/cl_dll/c_effects.cpp b/cl_dll/c_effects.cpp index 84eb92cb..08814651 100644 --- a/cl_dll/c_effects.cpp +++ b/cl_dll/c_effects.cpp @@ -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]; diff --git a/cl_dll/c_entitydissolve.cpp b/cl_dll/c_entitydissolve.cpp index 065e6ca3..e965d692 100644 --- a/cl_dll/c_entitydissolve.cpp +++ b/cl_dll/c_entitydissolve.cpp @@ -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; diff --git a/cl_dll/c_fire_smoke.cpp b/cl_dll/c_fire_smoke.cpp index 92ea1eb9..d52bc698 100644 --- a/cl_dll/c_fire_smoke.cpp +++ b/cl_dll/c_fire_smoke.cpp @@ -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; diff --git a/cl_dll/c_func_dust.cpp b/cl_dll/c_func_dust.cpp index e5717bc9..a6d7596e 100644 --- a/cl_dll/c_func_dust.cpp +++ b/cl_dll/c_func_dust.cpp @@ -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(); diff --git a/cl_dll/c_impact_effects.cpp b/cl_dll/c_impact_effects.cpp index 4a514cf4..4fcfba33 100644 --- a/cl_dll/c_impact_effects.cpp +++ b/cl_dll/c_impact_effects.cpp @@ -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; diff --git a/cl_dll/c_particle_smokegrenade.cpp b/cl_dll/c_particle_smokegrenade.cpp index 31407da8..6a4bbeb0 100644 --- a/cl_dll/c_particle_smokegrenade.cpp +++ b/cl_dll/c_particle_smokegrenade.cpp @@ -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; diff --git a/cl_dll/c_pixel_visibility.cpp b/cl_dll/c_pixel_visibility.cpp index 3723274b..f85b85f9 100644 --- a/cl_dll/c_pixel_visibility.cpp +++ b/cl_dll/c_pixel_visibility.cpp @@ -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; diff --git a/cl_dll/c_plasma.cpp b/cl_dll/c_plasma.cpp index f9bf76b1..3ddb6629 100644 --- a/cl_dll/c_plasma.cpp +++ b/cl_dll/c_plasma.cpp @@ -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 ) { diff --git a/cl_dll/c_rope.cpp b/cl_dll/c_rope.cpp index 6a775d2e..3b6093dd 100644 --- a/cl_dll/c_rope.cpp +++ b/cl_dll/c_rope.cpp @@ -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; } diff --git a/cl_dll/c_smoke_trail.cpp b/cl_dll/c_smoke_trail.cpp index f55a9cec..8dc103ab 100644 --- a/cl_dll/c_smoke_trail.cpp +++ b/cl_dll/c_smoke_trail.cpp @@ -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]; diff --git a/cl_dll/c_sprite.cpp b/cl_dll/c_sprite.cpp index 2ac8e422..5b5b93f3 100644 --- a/cl_dll/c_sprite.cpp +++ b/cl_dll/c_sprite.cpp @@ -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; } diff --git a/cl_dll/c_steamjet.cpp b/cl_dll/c_steamjet.cpp index 4ed4a80d..62de4924 100644 --- a/cl_dll/c_steamjet.cpp +++ b/cl_dll/c_steamjet.cpp @@ -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; diff --git a/cl_dll/c_sun.cpp b/cl_dll/c_sun.cpp index d039e041..1f99ed5d 100644 --- a/cl_dll/c_sun.cpp +++ b/cl_dll/c_sun.cpp @@ -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; diff --git a/cl_dll/c_te_legacytempents.cpp b/cl_dll/c_te_legacytempents.cpp index 5eea5a18..070525df 100644 --- a/cl_dll/c_te_legacytempents.cpp +++ b/cl_dll/c_te_legacytempents.cpp @@ -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 ) diff --git a/cl_dll/clientleafsystem.cpp b/cl_dll/clientleafsystem.cpp index 4cc7de33..ab8c8fce 100644 --- a/cl_dll/clientleafsystem.cpp +++ b/cl_dll/clientleafsystem.cpp @@ -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; diff --git a/cl_dll/clientshadowmgr.cpp b/cl_dll/clientshadowmgr.cpp index b3a27f28..c9ca24c8 100644 --- a/cl_dll/clientshadowmgr.cpp +++ b/cl_dll/clientshadowmgr.cpp @@ -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 diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index ec976b16..272fd67e 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -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; //!!! diff --git a/cl_dll/detailobjectsystem.cpp b/cl_dll/detailobjectsystem.cpp index 7a03a2a0..cc8574ff 100644 --- a/cl_dll/detailobjectsystem.cpp +++ b/cl_dll/detailobjectsystem.cpp @@ -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 { diff --git a/cl_dll/fx.cpp b/cl_dll/fx.cpp index b7a7acf0..fcd0a317 100644 --- a/cl_dll/fx.cpp +++ b/cl_dll/fx.cpp @@ -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; diff --git a/cl_dll/fx_blood.cpp b/cl_dll/fx_blood.cpp index 0b40d636..f8cd056f 100644 --- a/cl_dll/fx_blood.cpp +++ b/cl_dll/fx_blood.cpp @@ -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; diff --git a/cl_dll/fx_discreetline.cpp b/cl_dll/fx_discreetline.cpp index 5b5744be..bd80c1f2 100644 --- a/cl_dll/fx_discreetline.cpp +++ b/cl_dll/fx_discreetline.cpp @@ -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 diff --git a/cl_dll/fx_explosion.cpp b/cl_dll/fx_explosion.cpp index d8553119..99d8fae4 100644 --- a/cl_dll/fx_explosion.cpp +++ b/cl_dll/fx_explosion.cpp @@ -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; diff --git a/cl_dll/fx_sparks.cpp b/cl_dll/fx_sparks.cpp index 87e6a6bb..3e4a649d 100644 --- a/cl_dll/fx_sparks.cpp +++ b/cl_dll/fx_sparks.cpp @@ -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; } } diff --git a/cl_dll/fx_water.cpp b/cl_dll/fx_water.cpp index 198825fb..e07180b0 100644 --- a/cl_dll/fx_water.cpp +++ b/cl_dll/fx_water.cpp @@ -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; diff --git a/cl_dll/game_controls/MapOverview.cpp b/cl_dll/game_controls/MapOverview.cpp index d5e70408..c6e1a5b1 100644 --- a/cl_dll/game_controls/MapOverview.cpp +++ b/cl_dll/game_controls/MapOverview.cpp @@ -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) ); } } diff --git a/cl_dll/game_controls/NavProgress.cpp b/cl_dll/game_controls/NavProgress.cpp index a824cba8..8256c17e 100644 --- a/cl_dll/game_controls/NavProgress.cpp +++ b/cl_dll/game_controls/NavProgress.cpp @@ -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(); } diff --git a/cl_dll/game_controls/vguitextwindow.cpp b/cl_dll/game_controls/vguitextwindow.cpp index a9cf51fe..5e368068 100644 --- a/cl_dll/game_controls/vguitextwindow.cpp +++ b/cl_dll/game_controls/vguitextwindow.cpp @@ -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 ); diff --git a/cl_dll/glow_overlay.cpp b/cl_dll/glow_overlay.cpp index fd508036..cc2d5cba 100644 --- a/cl_dll/glow_overlay.cpp +++ b/cl_dll/glow_overlay.cpp @@ -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 ); } } } diff --git a/cl_dll/history_resource.cpp b/cl_dll/history_resource.cpp index 22ca32b0..437be78c 100644 --- a/cl_dll/history_resource.cpp +++ b/cl_dll/history_resource.cpp @@ -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(); diff --git a/cl_dll/hl2_hud/c_basehlplayer.cpp b/cl_dll/hl2_hud/c_basehlplayer.cpp index c650170e..fc1f6a86 100644 --- a/cl_dll/hl2_hud/c_basehlplayer.cpp +++ b/cl_dll/hl2_hud/c_basehlplayer.cpp @@ -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 ); diff --git a/cl_dll/hl2_hud/c_prop_combine_ball.cpp b/cl_dll/hl2_hud/c_prop_combine_ball.cpp index 6f7f00d9..fe44fb22 100644 --- a/cl_dll/hl2_hud/c_prop_combine_ball.cpp +++ b/cl_dll/hl2_hud/c_prop_combine_ball.cpp @@ -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; diff --git a/cl_dll/hl2_hud/c_strider.cpp b/cl_dll/hl2_hud/c_strider.cpp index 7e693792..be499896 100644 --- a/cl_dll/hl2_hud/c_strider.cpp +++ b/cl_dll/hl2_hud/c_strider.cpp @@ -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; } } diff --git a/cl_dll/hl2_hud/c_thumper_dust.cpp b/cl_dll/hl2_hud/c_thumper_dust.cpp index 330f2568..9de1ea21 100644 --- a/cl_dll/hl2_hud/c_thumper_dust.cpp +++ b/cl_dll/hl2_hud/c_thumper_dust.cpp @@ -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 ); diff --git a/cl_dll/hl2_hud/c_vehicle_airboat.cpp b/cl_dll/hl2_hud/c_vehicle_airboat.cpp index d6fa0b52..0494a559 100644 --- a/cl_dll/hl2_hud/c_vehicle_airboat.cpp +++ b/cl_dll/hl2_hud/c_vehicle_airboat.cpp @@ -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; diff --git a/cl_dll/hl2_hud/c_weapon_crossbow.cpp b/cl_dll/hl2_hud/c_weapon_crossbow.cpp index cae66597..c27e375f 100644 --- a/cl_dll/hl2_hud/c_weapon_crossbow.cpp +++ b/cl_dll/hl2_hud/c_weapon_crossbow.cpp @@ -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; diff --git a/cl_dll/hl2_hud/fx_hl2_tracers.cpp b/cl_dll/hl2_hud/fx_hl2_tracers.cpp index 7f92cefb..b074efd9 100644 --- a/cl_dll/hl2_hud/fx_hl2_tracers.cpp +++ b/cl_dll/hl2_hud/fx_hl2_tracers.cpp @@ -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 ); diff --git a/cl_dll/hl2_hud/hud_autoaim.cpp b/cl_dll/hl2_hud/hud_autoaim.cpp index 68a9e203..dc9ff497 100644 --- a/cl_dll/hl2_hud/hud_autoaim.cpp +++ b/cl_dll/hl2_hud/hud_autoaim.cpp @@ -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; diff --git a/cl_dll/hl2_hud/hud_credits.cpp b/cl_dll/hl2_hud/hud_credits.cpp index b62b5334..6245a38d 100644 --- a/cl_dll/hl2_hud/hud_credits.cpp +++ b/cl_dll/hl2_hud/hud_credits.cpp @@ -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 ) { diff --git a/cl_dll/hl2_hud/hud_health.cpp b/cl_dll/hl2_hud/hud_health.cpp index 980fa688..d49ceaa6 100644 --- a/cl_dll/hl2_hud/hud_health.cpp +++ b/cl_dll/hl2_hud/hud_health.cpp @@ -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 diff --git a/cl_dll/hl2_hud/hud_weaponselection.cpp b/cl_dll/hl2_hud/hud_weaponselection.cpp index 5293e152..0e185942 100644 --- a/cl_dll/hl2_hud/hud_weaponselection.cpp +++ b/cl_dll/hl2_hud/hud_weaponselection.cpp @@ -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; diff --git a/cl_dll/hl2_hud/hud_zoom.cpp b/cl_dll/hl2_hud/hud_zoom.cpp index 58e1b38e..78ee7951 100644 --- a/cl_dll/hl2_hud/hud_zoom.cpp +++ b/cl_dll/hl2_hud/hud_zoom.cpp @@ -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 diff --git a/cl_dll/hl2mp/c_hl2mp_player.cpp b/cl_dll/hl2mp/c_hl2mp_player.cpp index 41d006cc..8b404412 100644 --- a/cl_dll/hl2mp/c_hl2mp_player.cpp +++ b/cl_dll/hl2mp/c_hl2mp_player.cpp @@ -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; } diff --git a/cl_dll/hl2mp/hl2mp_hud_chat.cpp b/cl_dll/hl2mp/hl2mp_hud_chat.cpp index 5100a527..a1dc2f26 100644 --- a/cl_dll/hl2mp/hl2mp_hud_chat.cpp +++ b/cl_dll/hl2mp/hl2mp_hud_chat.cpp @@ -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 )); diff --git a/cl_dll/hl2mp/ui/hl2mpclientscoreboard.cpp b/cl_dll/hl2mp/ui/hl2mpclientscoreboard.cpp index 22b4ca2f..4e170c38 100644 --- a/cl_dll/hl2mp/ui/hl2mpclientscoreboard.cpp +++ b/cl_dll/hl2mp/ui/hl2mpclientscoreboard.cpp @@ -90,9 +90,9 @@ void CHL2MPClientScoreBoardDialog::PaintBackground() int y = 0; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); @@ -111,9 +111,9 @@ void CHL2MPClientScoreBoardDialog::PaintBackground() yMult = 1; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); xIndex += xDir; @@ -131,10 +131,10 @@ void CHL2MPClientScoreBoardDialog::PaintBackground() yMult = -1; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); xIndex += xDir; yIndex += yDir; @@ -151,10 +151,10 @@ void CHL2MPClientScoreBoardDialog::PaintBackground() yMult = -1; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); xIndex += xDir; yIndex += yDir; @@ -207,10 +207,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder() int y = 0; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); xIndex += xDir; @@ -228,10 +228,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder() yMult = 1; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); xIndex += xDir; yIndex += yDir; @@ -248,10 +248,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder() yMult = -1; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); xIndex += xDir; yIndex += yDir; @@ -268,10 +268,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder() yMult = -1; for ( i=0; iDrawFilledRect( x1, y1, x2, y2 ); xIndex += xDir; yIndex += yDir; diff --git a/cl_dll/hud_basechat.cpp b/cl_dll/hud_basechat.cpp index b10969bf..8f1cbaac 100644 --- a/cl_dll/hud_basechat.cpp +++ b/cl_dll/hud_basechat.cpp @@ -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; } diff --git a/cl_dll/hud_closecaption.cpp b/cl_dll/hud_closecaption.cpp index b13785c1..ca8b0ca1 100644 --- a/cl_dll/hud_closecaption.cpp +++ b/cl_dll/hud_closecaption.cpp @@ -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 ) diff --git a/cl_dll/hud_hintdisplay.cpp b/cl_dll/hud_hintdisplay.cpp index 339df82a..084ce78c 100644 --- a/cl_dll/hud_hintdisplay.cpp +++ b/cl_dll/hud_hintdisplay.cpp @@ -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; diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index ab7ea3fa..55abd7cd 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -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(); diff --git a/cl_dll/in_mouse.cpp b/cl_dll/in_mouse.cpp index 3e427b14..c4718c94 100644 --- a/cl_dll/in_mouse.cpp +++ b/cl_dll/in_mouse.cpp @@ -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; diff --git a/cl_dll/interpolatedvar.h b/cl_dll/interpolatedvar.h index 6735a035..df24b3be 100644 --- a/cl_dll/interpolatedvar.h +++ b/cl_dll/interpolatedvar.h @@ -623,7 +623,7 @@ inline bool CInterpolatedVarArrayBase::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::_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++ ) diff --git a/cl_dll/lamphaloproxy.cpp b/cl_dll/lamphaloproxy.cpp index 4ce20bf9..038ffc6a 100644 --- a/cl_dll/lamphaloproxy.cpp +++ b/cl_dll/lamphaloproxy.cpp @@ -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 ); diff --git a/cl_dll/particle_iterators.h b/cl_dll/particle_iterators.h index 7108739e..ae3571b4 100644 --- a/cl_dll/particle_iterators.h +++ b/cl_dll/particle_iterators.h @@ -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; diff --git a/cl_dll/particles_simple.cpp b/cl_dll/particles_simple.cpp index 48c55756..be8806c5 100644 --- a/cl_dll/particles_simple.cpp +++ b/cl_dll/particles_simple.cpp @@ -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 ); diff --git a/cl_dll/particlesphererenderer.h b/cl_dll/particlesphererenderer.h index d7f46bb9..ac0980d7 100644 --- a/cl_dll/particlesphererenderer.h +++ b/cl_dll/particlesphererenderer.h @@ -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; diff --git a/cl_dll/prediction.cpp b/cl_dll/prediction.cpp index 5107af9a..f546984d 100644 --- a/cl_dll/prediction.cpp +++ b/cl_dll/prediction.cpp @@ -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 ) { diff --git a/cl_dll/sdk/sdk_hud_chat.cpp b/cl_dll/sdk/sdk_hud_chat.cpp index a6ac0f78..6cea8d5b 100644 --- a/cl_dll/sdk/sdk_hud_chat.cpp +++ b/cl_dll/sdk/sdk_hud_chat.cpp @@ -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 )); diff --git a/cl_dll/sdk/sdk_hud_health.cpp b/cl_dll/sdk/sdk_hud_health.cpp index 980fa688..d49ceaa6 100644 --- a/cl_dll/sdk/sdk_hud_health.cpp +++ b/cl_dll/sdk/sdk_hud_health.cpp @@ -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 diff --git a/cl_dll/sdk/sdk_hud_weaponselection.cpp b/cl_dll/sdk/sdk_hud_weaponselection.cpp index 63826d2a..38bc7285 100644 --- a/cl_dll/sdk/sdk_hud_weaponselection.cpp +++ b/cl_dll/sdk/sdk_hud_weaponselection.cpp @@ -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; diff --git a/cl_dll/smoke_fog_overlay.cpp b/cl_dll/smoke_fog_overlay.cpp index 8f302c81..267964de 100644 --- a/cl_dll/smoke_fog_overlay.cpp +++ b/cl_dll/smoke_fog_overlay.cpp @@ -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 ); diff --git a/cl_dll/spritemodel.cpp b/cl_dll/spritemodel.cpp index 923befa7..a946d0e7 100644 --- a/cl_dll/spritemodel.cpp +++ b/cl_dll/spritemodel.cpp @@ -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; diff --git a/cl_dll/vgui_entitypanel.cpp b/cl_dll/vgui_entitypanel.cpp index 46de9ec7..386edc9c 100644 --- a/cl_dll/vgui_entitypanel.cpp +++ b/cl_dll/vgui_entitypanel.cpp @@ -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 diff --git a/cl_dll/vgui_fpspanel.cpp b/cl_dll/vgui_fpspanel.cpp index b9319c67..cb515775 100644 --- a/cl_dll/vgui_fpspanel.cpp +++ b/cl_dll/vgui_fpspanel.cpp @@ -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 ); diff --git a/cl_dll/vgui_netgraphpanel.cpp b/cl_dll/vgui_netgraphpanel.cpp index 0954a277..49a98f19 100644 --- a/cl_dll/vgui_netgraphpanel.cpp +++ b/cl_dll/vgui_netgraphpanel.cpp @@ -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 ; aParmValue("-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; diff --git a/cl_dll/view_effects.cpp b/cl_dll/view_effects.cpp index d74783c3..bfe7766f 100644 --- a/cl_dll/view_effects.cpp +++ b/cl_dll/view_effects.cpp @@ -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 { diff --git a/cl_dll/view_scene.cpp b/cl_dll/view_scene.cpp index a95518a2..61eb91d8 100644 --- a/cl_dll/view_scene.cpp +++ b/cl_dll/view_scene.cpp @@ -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 ); diff --git a/dlls/AI_Criteria.cpp b/dlls/AI_Criteria.cpp index 6f73cacc..12f2b201 100644 --- a/dlls/AI_Criteria.cpp +++ b/dlls/AI_Criteria.cpp @@ -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; } diff --git a/dlls/AI_Interest_Target.cpp b/dlls/AI_Interest_Target.cpp index 3652682f..a50fffde 100644 --- a/dlls/AI_Interest_Target.cpp +++ b/dlls/AI_Interest_Target.cpp @@ -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; diff --git a/dlls/AI_Interest_Target.h b/dlls/AI_Interest_Target.h index c67f0714..15c7dad9 100644 --- a/dlls/AI_Interest_Target.h +++ b/dlls/AI_Interest_Target.h @@ -12,9 +12,6 @@ #pragma once #endif -#undef MINMAX_H -#include "minmax.h" // max() define - //----------------------------------------------------------------------------- // CAI_BaseActor // diff --git a/dlls/BaseAnimatingOverlay.cpp b/dlls/BaseAnimatingOverlay.cpp index 0f44f989..366dfcdd 100644 --- a/dlls/BaseAnimatingOverlay.cpp +++ b/dlls/BaseAnimatingOverlay.cpp @@ -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 ); } } } diff --git a/dlls/CRagdollMagnet.cpp b/dlls/CRagdollMagnet.cpp index 4ededf5d..7186e1b7 100644 --- a/dlls/CRagdollMagnet.cpp +++ b/dlls/CRagdollMagnet.cpp @@ -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 { diff --git a/dlls/CommentarySystem.cpp b/dlls/CommentarySystem.cpp index 2e4f6f80..ce7a7681 100644 --- a/dlls/CommentarySystem.cpp +++ b/dlls/CommentarySystem.cpp @@ -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 ); diff --git a/dlls/EnvBeam.cpp b/dlls/EnvBeam.cpp index 6e32fc74..af0fd2a5 100644 --- a/dlls/EnvBeam.cpp +++ b/dlls/EnvBeam.cpp @@ -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 ) diff --git a/dlls/EnvShake.cpp b/dlls/EnvShake.cpp index d59e73d9..e8d4aaf8 100644 --- a/dlls/EnvShake.cpp +++ b/dlls/EnvShake.cpp @@ -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 ); diff --git a/dlls/PointAngularVelocitySensor.cpp b/dlls/PointAngularVelocitySensor.cpp index 755c7d8b..cf0d0382 100644 --- a/dlls/PointAngularVelocitySensor.cpp +++ b/dlls/PointAngularVelocitySensor.cpp @@ -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; diff --git a/dlls/ai_baseactor.cpp b/dlls/ai_baseactor.cpp index d42e25b6..55a1b3e8 100644 --- a/dlls/ai_baseactor.cpp +++ b/dlls/ai_baseactor.cpp @@ -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 ); diff --git a/dlls/ai_basenpc.cpp b/dlls/ai_basenpc.cpp index f3caf305..8d6f5b94 100644 --- a/dlls/ai_basenpc.cpp +++ b/dlls/ai_basenpc.cpp @@ -3445,7 +3445,7 @@ void CAI_BaseNPC::RebalanceThinks() int iMaxThinkersPerTick = static_cast(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 ) diff --git a/dlls/ai_basenpc.h b/dlls/ai_basenpc.h index 86e2209d..330d979d 100644 --- a/dlls/ai_basenpc.h +++ b/dlls/ai_basenpc.h @@ -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; diff --git a/dlls/ai_basenpc_schedule.cpp b/dlls/ai_basenpc_schedule.cpp index 04f66130..4d6b092e 100644 --- a/dlls/ai_basenpc_schedule.cpp +++ b/dlls/ai_basenpc_schedule.cpp @@ -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(); } diff --git a/dlls/ai_behavior_follow.cpp b/dlls/ai_behavior_follow.cpp index 7a8a4fca..928652df 100644 --- a/dlls/ai_behavior_follow.cpp +++ b/dlls/ai_behavior_follow.cpp @@ -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; diff --git a/dlls/ai_behavior_rappel.cpp b/dlls/ai_behavior_rappel.cpp index 6120fbbb..dc2a2c13 100644 --- a/dlls/ai_behavior_rappel.cpp +++ b/dlls/ai_behavior_rappel.cpp @@ -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; diff --git a/dlls/ai_blended_movement.cpp b/dlls/ai_blended_movement.cpp index 87810768..718bc87b 100644 --- a/dlls/ai_blended_movement.cpp +++ b/dlls/ai_blended_movement.cpp @@ -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 ) diff --git a/dlls/ai_hint.cpp b/dlls/ai_hint.cpp index f2f9d84c..5ab549ec 100644 --- a/dlls/ai_hint.cpp +++ b/dlls/ai_hint.cpp @@ -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++; diff --git a/dlls/ai_localnavigator.cpp b/dlls/ai_localnavigator.cpp index 81c3b193..f8ec501c 100644 --- a/dlls/ai_localnavigator.cpp +++ b/dlls/ai_localnavigator.cpp @@ -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 ) diff --git a/dlls/ai_motor.cpp b/dlls/ai_motor.cpp index e769116c..00c0e6bc 100644 --- a/dlls/ai_motor.cpp +++ b/dlls/ai_motor.cpp @@ -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; diff --git a/dlls/ai_moveprobe.cpp b/dlls/ai_moveprobe.cpp index bdb18928..0b72d711 100644 --- a/dlls/ai_moveprobe.cpp +++ b/dlls/ai_moveprobe.cpp @@ -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 ); diff --git a/dlls/ai_navigator.cpp b/dlls/ai_navigator.cpp index 24526fe2..0e2baf4e 100644 --- a/dlls/ai_navigator.cpp +++ b/dlls/ai_navigator.cpp @@ -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; } diff --git a/dlls/ai_networkmanager.cpp b/dlls/ai_networkmanager.cpp index 29c9a6a8..5f00ea2f 100644 --- a/dlls/ai_networkmanager.cpp +++ b/dlls/ai_networkmanager.cpp @@ -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]; diff --git a/dlls/ai_planesolver.cpp b/dlls/ai_planesolver.cpp index d70dad20..89d2763d 100644 --- a/dlls/ai_planesolver.cpp +++ b/dlls/ai_planesolver.cpp @@ -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 ) diff --git a/dlls/ai_playerally.h b/dlls/ai_playerally.h index 2257ffe5..73e6e914 100644 --- a/dlls/ai_playerally.h +++ b/dlls/ai_playerally.h @@ -16,10 +16,6 @@ #undef min #endif #include "stdstring.h" -#ifndef _WIN32 -#undef MINMAX_H -#include "minmax.h" -#endif #if defined( _WIN32 ) #pragma once diff --git a/dlls/ai_route.cpp b/dlls/ai_route.cpp index 3336c911..28b22f13 100644 --- a/dlls/ai_route.cpp +++ b/dlls/ai_route.cpp @@ -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) { diff --git a/dlls/ai_speech.cpp b/dlls/ai_speech.cpp index 870a08e8..1d3d4c26 100644 --- a/dlls/ai_speech.cpp +++ b/dlls/ai_speech.cpp @@ -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 ); } diff --git a/dlls/baseanimating.cpp b/dlls/baseanimating.cpp index 23b5591a..e5015c81 100644 --- a/dlls/baseanimating.cpp +++ b/dlls/baseanimating.cpp @@ -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) ); diff --git a/dlls/basecombatcharacter.cpp b/dlls/basecombatcharacter.cpp index da96f002..b121077a 100644 --- a/dlls/basecombatcharacter.cpp +++ b/dlls/basecombatcharacter.cpp @@ -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(soundRadius), 0.25, info.GetInflictor() ); } diff --git a/dlls/baseentity.cpp b/dlls/baseentity.cpp index 569bf263..07659778 100644 --- a/dlls/baseentity.cpp +++ b/dlls/baseentity.cpp @@ -2051,7 +2051,7 @@ static void CheckPushedEntity( CBaseEntity *pEntity, pushblock_t ¶ms ) float t = expectedDist != 0.0f ? fabsf(deltaAngle / expectedDist) : 1.0f; t = clamp(t,0,1); - fraction = max(fraction, t); + fraction = MAX(fraction, t); } else { @@ -6383,7 +6383,7 @@ void CBaseEntity::SUB_PerformFadeOut( void ) dt = 0.1f; } m_nRenderMode = kRenderTransTexture; - int speed = static_cast(max(1,256*dt)); // fade out over 1 second + int speed = static_cast(MAX(1,256*dt)); // fade out over 1 second SetRenderColorA( static_cast(UTIL_Approach( 0, m_clrRender->a, speed )) ); } diff --git a/dlls/baseflex.cpp b/dlls/baseflex.cpp index 4956e86e..2aaabdb6 100644 --- a/dlls/baseflex.cpp +++ b/dlls/baseflex.cpp @@ -684,7 +684,7 @@ bool CBaseFlex::StartMoveToSceneEvent( CSceneEventInfo *info, CChoreoScene *scen if (EnterSceneSequence( true )) { - myNpc->AddSceneLock( min( 2.0, event->GetEndTime() - scene->GetTime() + 0.2 ) ); + myNpc->AddSceneLock( MIN( 2.0, event->GetEndTime() - scene->GetTime() + 0.2 ) ); } // if they're already moving, stop them @@ -1236,7 +1236,7 @@ bool CBaseFlex::ProcessFacingSceneEvent( CSceneEventInfo *info, CChoreoScene *sc } // FIXME: what's a reasonable time to wait? - myNpc->AddSceneLock( min( 2.0, scene->FindStopTime() - scene->GetTime() + 0.2 ) ); + myNpc->AddSceneLock( MIN( 2.0, scene->FindStopTime() - scene->GetTime() + 0.2 ) ); return true; } return false; @@ -1337,7 +1337,7 @@ bool CBaseFlex::ProcessMoveToSceneEvent( CSceneEventInfo *info, CChoreoScene *sc float flDist = (info->m_hTarget->EyePosition() - GetAbsOrigin()).Length2D(); - if (flDist > max( max( flDistTolerance, 0.1 ), event->GetDistanceToTarget())) + if (flDist > MAX( MAX( flDistTolerance, 0.1 ), event->GetDistanceToTarget())) { // Msg("flDist %.1f\n", flDist ); int result = myNpc->GetNavigator()->SetGoal( goal, AIN_CLEAR_TARGET ); @@ -1421,7 +1421,7 @@ bool CBaseFlex::ProcessMoveToSceneEvent( CSceneEventInfo *info, CChoreoScene *sc NDebugOverlay::Box( vTestPoint, myNpc->GetHullMins(), myNpc->GetHullMaxs(), r, g, b, 0, 0.12 ); } - myNpc->AddSceneLock( min( 2.0, event->GetEndTime() - scene->GetTime() + 0.2 ) ); + myNpc->AddSceneLock( MIN( 2.0, event->GetEndTime() - scene->GetTime() + 0.2 ) ); // handled in task return true; @@ -1814,11 +1814,11 @@ bool CBaseFlex::ProcessGestureSceneEvent( CSceneEventInfo *info, CChoreoScene *s { if (IsMoving()) { - info->m_flWeight = max( info->m_flWeight - 0.2, 0.0 ); + info->m_flWeight = MAX( info->m_flWeight - 0.2, 0.0 ); } else { - info->m_flWeight = min( info->m_flWeight + 0.2, 1.0 ); + info->m_flWeight = MIN( info->m_flWeight + 0.2, 1.0 ); } } @@ -1892,11 +1892,11 @@ bool CBaseFlex::ProcessSequenceSceneEvent( CSceneEventInfo *info, CChoreoScene * if (bFadeOut) { - info->m_flWeight = max( info->m_flWeight - 0.2, 0.0 ); + info->m_flWeight = MAX( info->m_flWeight - 0.2, 0.0 ); } else { - info->m_flWeight = min( info->m_flWeight + 0.2, 1.0 ); + info->m_flWeight = MIN( info->m_flWeight + 0.2, 1.0 ); } float spline = 3 * info->m_flWeight * info->m_flWeight - 2 * info->m_flWeight * info->m_flWeight * info->m_flWeight; @@ -2059,11 +2059,11 @@ float CSceneEventInfo::UpdateWeight( CBaseFlex *pActor ) // decay if this is a background scene and there's other flex animations playing if (pActor->IsSuppressedFlexAnimation( this )) { - m_flWeight = max( m_flWeight - 0.2, 0.0 ); + m_flWeight = MAX( m_flWeight - 0.2, 0.0 ); } else { - m_flWeight = min( m_flWeight + 0.1, 1.0 ); + m_flWeight = MIN( m_flWeight + 0.1, 1.0 ); } return m_flWeight; } diff --git a/dlls/buttons.cpp b/dlls/buttons.cpp index ee872a62..2812c2d0 100644 --- a/dlls/buttons.cpp +++ b/dlls/buttons.cpp @@ -1091,7 +1091,7 @@ void CMomentaryRotButton::InputSetPosition( inputdata_t &inputdata ) // QAngle vecNewAngles = m_start + m_vecMoveAng * ( m_IdealYaw * m_flMoveDistance ); float flAngleDelta = fabs( AxisDelta( m_spawnflags, vecNewAngles, GetLocalAngles() )); - m_flTimeDelta = min( flAngleDelta / m_flSpeed, 0.1f ); + m_flTimeDelta = MIN( flAngleDelta / m_flSpeed, 0.1f ); SetMoveDoneTime( m_flTimeDelta ); } diff --git a/dlls/cbase.cpp b/dlls/cbase.cpp index 3c5cf209..712ff90a 100644 --- a/dlls/cbase.cpp +++ b/dlls/cbase.cpp @@ -186,7 +186,7 @@ CEventAction::CEventAction( const char *ActionData ) // this memory pool stores blocks around the size of CEventAction/inputitem_t structs // can be used for other blocks; will error if to big a block is tried to be allocated -CMemoryPool g_EntityListPool( max(sizeof(CEventAction),sizeof(CMultiInputVar::inputitem_t)), 512, CMemoryPool::GROW_FAST, "g_EntityListPool" ); +CMemoryPool g_EntityListPool( MAX(sizeof(CEventAction),sizeof(CMultiInputVar::inputitem_t)), 512, CMemoryPool::GROW_FAST, "g_EntityListPool" ); #include "tier0/memdbgoff.h" diff --git a/dlls/cbase.h b/dlls/cbase.h index d8435c01..b019005c 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -28,7 +28,6 @@ #include #include -#include "minmax.h" // tier 0 #include "tier0/dbg.h" diff --git a/dlls/entitylist.cpp b/dlls/entitylist.cpp index 610e03bd..7fd93cbb 100644 --- a/dlls/entitylist.cpp +++ b/dlls/entitylist.cpp @@ -93,7 +93,7 @@ public: int ListCount() { return m_targetList.Count(); } int ListCopy( CBaseEntity *pList[], int listMax ) { - int count = min(listMax, ListCount() ); + int count = MIN(listMax, ListCount() ); memcpy( pList, m_targetList.Base(), sizeof(CBaseEntity *) * count ); return count; } @@ -195,7 +195,7 @@ public: int ListCopy( CBaseEntity *pList[], int listMax ) { - int count = min(listMax, ListCount()); + int count = MIN(listMax, ListCount()); for ( int i = 0; i < count; i++ ) { int entinfoIndex = m_simThinkList[i]; diff --git a/dlls/env_debughistory.cpp b/dlls/env_debughistory.cpp index 8002a742..5e3fdce5 100644 --- a/dlls/env_debughistory.cpp +++ b/dlls/env_debughistory.cpp @@ -95,7 +95,7 @@ void CDebugHistory::AddDebugHistoryLine( int iCategory, const char *szLine ) int iCharsLeftBeforeLoop = sizeof(m_DebugLines[iCategory]) - (m_DebugLineEnd[iCategory] - m_DebugLines[iCategory]); // Write into the buffer - int iWrote = min( iCharsToWrite, iCharsLeftBeforeLoop ); + int iWrote = MIN( iCharsToWrite, iCharsLeftBeforeLoop ); memcpy( m_DebugLineEnd[iCategory], pszRemaining, iWrote ); m_DebugLineEnd[iCategory] += iWrote; pszRemaining += iWrote; @@ -221,7 +221,7 @@ int CDebugHistory::Restore( IRestore &restore ) ClearHistories(); int iMaxCategorys = restore.ReadInt(); - for ( int iCategory = 0; iCategory < min(iMaxCategorys,MAX_HISTORY_CATEGORIES); iCategory++ ) + for ( int iCategory = 0; iCategory < MIN(iMaxCategorys,MAX_HISTORY_CATEGORIES); iCategory++ ) { int iEnd = restore.ReadInt(); m_DebugLineEnd[iCategory] = m_DebugLines[iCategory] + iEnd; diff --git a/dlls/episodic/grenade_hopwire.cpp b/dlls/episodic/grenade_hopwire.cpp index bd3bd9e8..b04ab3ce 100644 --- a/dlls/episodic/grenade_hopwire.cpp +++ b/dlls/episodic/grenade_hopwire.cpp @@ -540,7 +540,7 @@ void CGrenadeHopwire::Detonate( void ) UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, MAX_HOP_HEIGHT*2 ), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr ); // Jump half the height to the found ceiling - float hopHeight = min( MAX_HOP_HEIGHT, (MAX_HOP_HEIGHT*tr.fraction) ); + float hopHeight = MIN( MAX_HOP_HEIGHT, (MAX_HOP_HEIGHT*tr.fraction) ); //Add upwards velocity for the "hop" Vector hopVel( 0.0f, 0.0f, hopHeight ); diff --git a/dlls/event_tempentity_tester.cpp b/dlls/event_tempentity_tester.cpp index ba0350d3..ab4a0b02 100644 --- a/dlls/event_tempentity_tester.cpp +++ b/dlls/event_tempentity_tester.cpp @@ -30,8 +30,8 @@ CBaseEntity *CTempEntTester::Create( const Vector &vecOrigin, const QAngle &vecA if ( lifetime && lifetime[0] ) { life = atoi( lifetime ); - life = max( 1.0, life ); - life = min( 1000.0, life ); + life = MAX( 1.0, life ); + life = MIN( 1000.0, life ); life += gpGlobals->curtime; } diff --git a/dlls/fourwheelvehiclephysics.cpp b/dlls/fourwheelvehiclephysics.cpp index 4ae8cfbe..fcde8358 100644 --- a/dlls/fourwheelvehiclephysics.cpp +++ b/dlls/fourwheelvehiclephysics.cpp @@ -1219,7 +1219,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = max( 0.1, m_maxThrottle - ( m_maxThrottle * m_flThrottleReduction ) ); + float flMaxThrottle = MAX( 0.1, m_maxThrottle - ( m_maxThrottle * m_flThrottleReduction ) ); m_controls.throttle = Approach( flMaxThrottle * flAnalogThrottle, m_controls.throttle, flFrameTime * m_throttleRate ); // Apply the brake. @@ -1247,7 +1247,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = min( -0.1, m_flMaxRevThrottle - ( m_flMaxRevThrottle * m_flThrottleReduction ) ); + float flMaxThrottle = MIN( -0.1, m_flMaxRevThrottle - ( m_flMaxRevThrottle * m_flThrottleReduction ) ); m_controls.throttle = Approach( flMaxThrottle * flAnalogBrake, m_controls.throttle, flFrameTime * m_throttleRate ); // Apply the brake. @@ -1281,7 +1281,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = max( 0.1, m_maxThrottle - ( m_maxThrottle * m_flThrottleReduction ) ); + float flMaxThrottle = MAX( 0.1, m_maxThrottle - ( m_maxThrottle * m_flThrottleReduction ) ); m_controls.throttle = Approach( flMaxThrottle, m_controls.throttle, flFrameTime * m_throttleRate ); // Apply the brake. @@ -1305,7 +1305,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = min( -0.1, m_flMaxRevThrottle - ( m_flMaxRevThrottle * m_flThrottleReduction ) ); + float flMaxThrottle = MIN( -0.1, m_flMaxRevThrottle - ( m_flMaxRevThrottle * m_flThrottleReduction ) ); m_controls.throttle = Approach( flMaxThrottle, m_controls.throttle, flFrameTime * m_throttleRate ); // Apply the brake. @@ -1408,7 +1408,7 @@ void CFourWheelVehiclePhysics::AddThrottleReduction( float flPercentage ) //----------------------------------------------------------------------------- void CFourWheelVehiclePhysics::RemoveThrottleReduction( float flPercentage ) { - m_flThrottleReduction = max( 0, m_flThrottleReduction - flPercentage ); + m_flThrottleReduction = MAX( 0, m_flThrottleReduction - flPercentage ); //Msg("Removed speed reduction. Now %.2f\n", m_flThrottleReduction ); } diff --git a/dlls/func_breakablesurf.cpp b/dlls/func_breakablesurf.cpp index 2b0fc5d4..65d16911 100644 --- a/dlls/func_breakablesurf.cpp +++ b/dlls/func_breakablesurf.cpp @@ -275,11 +275,11 @@ void CBreakableSurface::SurfaceTouch( CBaseEntity *pOther ) float flMaxsWidth,flMaxsHeight; PanePos(vTouchPos, &flMaxsWidth, &flMaxsHeight); - int nMinWidth = Floor2Int(max(0, min(flMinsWidth,flMaxsWidth))); - int nMaxWidth = Ceil2Int(min(m_nNumWide,max(flMinsWidth,flMaxsWidth))); + int nMinWidth = Floor2Int(MAX(0, MIN(flMinsWidth,flMaxsWidth))); + int nMaxWidth = Ceil2Int(MIN(m_nNumWide,MAX(flMinsWidth,flMaxsWidth))); - int nMinHeight = Floor2Int(max(0, min(flMinsHeight,flMaxsHeight))); - int nMaxHeight = Ceil2Int(min(m_nNumHigh,max(flMinsHeight,flMaxsHeight))); + int nMinHeight = Floor2Int(MAX(0, MIN(flMinsHeight,flMaxsHeight))); + int nMaxHeight = Ceil2Int(MIN(m_nNumHigh,MAX(flMinsHeight,flMaxsHeight))); Vector vHitVel; pOther->GetVelocity( &vHitVel, NULL ); @@ -783,7 +783,7 @@ void CBreakableSurface::SetSupport( int w, int h, float support ) //------------------------------------------------------------------------------ float CBreakableSurface::GetSupport(int nWidth, int nHeight) { - return max(0,m_flSupport[nWidth][nHeight]); + return MAX(0,m_flSupport[nWidth][nHeight]); } //------------------------------------------------------------------------------ diff --git a/dlls/gib.cpp b/dlls/gib.cpp index b199efec..c231781a 100644 --- a/dlls/gib.cpp +++ b/dlls/gib.cpp @@ -539,7 +539,7 @@ void CGib::BounceGibTouch ( CBaseEntity *pOther ) float volume; float zvel = fabs(GetAbsVelocity().z); - volume = 0.8f * min(1.0, ((float)zvel) / 450.0f); + volume = 0.8f * MIN(1.0, ((float)zvel) / 450.0f); CBreakable::MaterialSoundRandom( entindex(), (Materials)m_material, volume ); } diff --git a/dlls/h_ai.cpp b/dlls/h_ai.cpp index 7ad5edd7..fa579253 100644 --- a/dlls/h_ai.cpp +++ b/dlls/h_ai.cpp @@ -111,7 +111,7 @@ Vector VecCheckToss( CBaseEntity *pEntity, Vector vecSpot1, Vector vecSpot2, flo // But don't throw so high that it looks silly. Maximize the height of the // throw above the highest of the two endpoints to a ratio of the throw length. float flHeightMax = flHeightMaxRatio * (vecSpot2 - vecSpot1).Length(); - float flHighestEndZ = max(vecSpot1.z, vecSpot2.z); + float flHighestEndZ = MAX(vecSpot1.z, vecSpot2.z); if ((vecMidPoint.z - flHighestEndZ) > flHeightMax) { vecMidPoint.z = flHighestEndZ + flHeightMax; diff --git a/dlls/hl2_dll/ai_behavior_police.cpp b/dlls/hl2_dll/ai_behavior_police.cpp index eb80e7dd..7ad7478a 100644 --- a/dlls/hl2_dll/ai_behavior_police.cpp +++ b/dlls/hl2_dll/ai_behavior_police.cpp @@ -321,7 +321,7 @@ void CAI_PolicingBehavior::StartTask( const Task_t *pTask ) // Find a point on our policing radius to stand on if ( LineSphereIntersection( m_hPoliceGoal->GetAbsOrigin(), m_hPoliceGoal->GetRadius(), GetAbsOrigin(), harassDir, &flInter1, &flInter2 ) ) { - Vector vPos = m_hPoliceGoal->GetAbsOrigin() + harassDir * ( max( flInter1, flInter2 ) ); + Vector vPos = m_hPoliceGoal->GetAbsOrigin() + harassDir * ( MAX( flInter1, flInter2 ) ); // See how far away the default one is float testDist = UTIL_DistApprox2D( m_hPoliceGoal->GetAbsOrigin(), harassPos ); diff --git a/dlls/hl2_dll/ai_spotlight.cpp b/dlls/hl2_dll/ai_spotlight.cpp index 5495848f..3aca435d 100644 --- a/dlls/hl2_dll/ai_spotlight.cpp +++ b/dlls/hl2_dll/ai_spotlight.cpp @@ -377,7 +377,7 @@ void CAI_Spotlight::UpdateSpotlightEndpoint( void ) // Adjust end width to keep beam width constant float flNewWidth = SPOTLIGHT_WIDTH * ( flBeamLength / m_flSpotlightMaxLength ); - flNewWidth = min( 100, flNewWidth ); + flNewWidth = MIN( 100, flNewWidth ); m_hSpotlight->SetWidth(flNewWidth); m_hSpotlight->SetEndWidth(flNewWidth); diff --git a/dlls/hl2_dll/env_speaker.cpp b/dlls/hl2_dll/env_speaker.cpp index 94bfa50e..cd2b60fc 100644 --- a/dlls/hl2_dll/env_speaker.cpp +++ b/dlls/hl2_dll/env_speaker.cpp @@ -165,7 +165,7 @@ void CSpeaker::SpeakerThink( void ) // Wait for the talking characters to finish first. if ( !g_AIFriendliesTalkSemaphore.IsAvailable( this ) || !g_AIFoesTalkSemaphore.IsAvailable( this ) ) { - float releaseTime = max( g_AIFriendliesTalkSemaphore.GetReleaseTime(), g_AIFoesTalkSemaphore.GetReleaseTime() ); + float releaseTime = MAX( g_AIFriendliesTalkSemaphore.GetReleaseTime(), g_AIFoesTalkSemaphore.GetReleaseTime() ); // Add some slop (only up to one second) releaseTime += random->RandomFloat( 0, 1 ); SetNextThink( releaseTime ); diff --git a/dlls/hl2_dll/grenade_homer.cpp b/dlls/hl2_dll/grenade_homer.cpp index 08f60910..faea74ff 100644 --- a/dlls/hl2_dll/grenade_homer.cpp +++ b/dlls/hl2_dll/grenade_homer.cpp @@ -330,7 +330,7 @@ void CGrenadeHomer::Launch( CBaseEntity* pOwner, { // Figure out how long it'll take for me to reach the target. float flDist = ( pTarget->WorldSpaceCenter() - WorldSpaceCenter() ).Length(); - float flTime = max( 0.5, flDist / GetAbsVelocity().Length() ); + float flTime = MAX( 0.5, flDist / GetAbsVelocity().Length() ); CSoundEnt::InsertSound ( SOUND_DANGER, m_hTarget->GetAbsOrigin(), 300, flTime, pOwner ); } @@ -600,7 +600,7 @@ void CGrenadeHomer::AimThink( void ) // Extract speed and direction Vector vCurDir = GetAbsVelocity(); float flCurSpeed = VectorNormalize(vCurDir); - flTargetSpeed = max(flTargetSpeed, flCurSpeed); + flTargetSpeed = MAX(flTargetSpeed, flCurSpeed); // Add in homing direction Vector vecNewVelocity = GetAbsVelocity(); diff --git a/dlls/hl2_dll/hl2_player.cpp b/dlls/hl2_dll/hl2_player.cpp index 65a29574..28c0763c 100644 --- a/dlls/hl2_dll/hl2_player.cpp +++ b/dlls/hl2_dll/hl2_player.cpp @@ -159,7 +159,7 @@ void CC_ToggleDuck( void ) flForwardSpeed = pCVcl_forwardspeed->GetFloat(); } - flForwardSpeed = max( 1.0f, flForwardSpeed ); + flForwardSpeed = MAX( 1.0f, flForwardSpeed ); // Make sure we're not in the blindspot on the crouch detection float flStickDistPerc = ( pPlayer->GetStickDist() / flForwardSpeed ); // Speed is the magnitude diff --git a/dlls/hl2_dll/hl2_triggers.cpp b/dlls/hl2_dll/hl2_triggers.cpp index 22a9e905..25cdf8a1 100644 --- a/dlls/hl2_dll/hl2_triggers.cpp +++ b/dlls/hl2_dll/hl2_triggers.cpp @@ -542,7 +542,7 @@ void CWateryDeathLeech::LeechThink( void ) dt = 0.1f; } m_nRenderMode = kRenderTransTexture; - int speed = static_cast(max(1,256*dt)); // fade out over 1 second + int speed = static_cast(MAX(1,256*dt)); // fade out over 1 second if ( m_iFadeState == -1 ) SetRenderColorA( static_cast(UTIL_Approach( 0, m_clrRender->a, speed )) ); @@ -705,7 +705,7 @@ void CTriggerWateryDeath::Touch( CBaseEntity *pOther ) // Kill it if ( pOther->IsPlayer() ) { - m_flPainValue = min( m_flPainValue + WD_PAINVALUE_STEP, WD_MAX_DAMAGE ); + m_flPainValue = MIN( m_flPainValue + WD_PAINVALUE_STEP, WD_MAX_DAMAGE ); } else { diff --git a/dlls/hl2_dll/item_ammo.cpp b/dlls/hl2_dll/item_ammo.cpp index 6c8f36de..c793de16 100644 --- a/dlls/hl2_dll/item_ammo.cpp +++ b/dlls/hl2_dll/item_ammo.cpp @@ -30,7 +30,7 @@ int ITEM_GiveAmmo( CBasePlayer *pPlayer, float flCount, const char *pszAmmoName, flCount *= g_pGameRules->GetAmmoQuantityScale(iAmmoType); // Don't give out less than 1 of anything. - flCount = max( 1.0f, flCount ); + flCount = MAX( 1.0f, flCount ); return pPlayer->GiveAmmo( static_cast(flCount), iAmmoType, bSuppressSound ); } diff --git a/dlls/hl2_dll/npc_BaseZombie.cpp b/dlls/hl2_dll/npc_BaseZombie.cpp index b783cb44..01720541 100644 --- a/dlls/hl2_dll/npc_BaseZombie.cpp +++ b/dlls/hl2_dll/npc_BaseZombie.cpp @@ -289,7 +289,7 @@ bool CNPC_BaseZombie::FindNearestPhysicsObject( int iMaxMass ) return false; } - float flNearestDist = min( dist, ZOMBIE_FARTHEST_PHYSICS_OBJECT * 0.5 ); + float flNearestDist = MIN( dist, ZOMBIE_FARTHEST_PHYSICS_OBJECT * 0.5 ); Vector vecDelta( flNearestDist, flNearestDist, GetHullHeight() * 2.0 ); class CZombieSwatEntitiesEnum : public CFlaggedEntitiesEnum @@ -842,7 +842,7 @@ int CNPC_BaseZombie::OnTakeDamage_Alive( const CTakeDamageInfo &inputInfo ) // flDamageThreshold is what percentage of the creature's max health // this amount of damage represents. (clips at 1.0) - float flDamageThreshold = min( 1, info.GetDamage() / m_iMaxHealth ); + float flDamageThreshold = MIN( 1, info.GetDamage() / m_iMaxHealth ); // Being chopped up by a sharp physics object is a pretty special case // so we handle it with some special code. Mainly for @@ -1024,7 +1024,7 @@ void CNPC_BaseZombie::MoanSound( envelopePoint_t *pEnvelope, int iEnvelopeSize ) //----------------------------------------------------------------------------- bool CNPC_BaseZombie::IsChopped( const CTakeDamageInfo &info ) { - float flDamageThreshold = min( 1, info.GetDamage() / m_iMaxHealth ); + float flDamageThreshold = MIN( 1, info.GetDamage() / m_iMaxHealth ); if ( m_iHealth > 0 || flDamageThreshold <= 0.5 ) return false; @@ -1224,7 +1224,7 @@ void CNPC_BaseZombie::Ignite( float flFlameLifetime, bool bNPCOnly, float flSize #endif // HL2_EPISODIC // Set the zombie up to burn to death in about ten seconds. - SetHealth( static_cast(min( m_iHealth, FLAME_DIRECT_DAMAGE_PER_SEC * (ZOMBIE_BURN_TIME + random->RandomFloat( -ZOMBIE_BURN_TIME_NOISE, ZOMBIE_BURN_TIME_NOISE))) ) ); + SetHealth( static_cast(MIN( m_iHealth, FLAME_DIRECT_DAMAGE_PER_SEC * (ZOMBIE_BURN_TIME + random->RandomFloat( -ZOMBIE_BURN_TIME_NOISE, ZOMBIE_BURN_TIME_NOISE))) ) ); // FIXME: use overlays when they come online //AddOverlay( ACT_ZOM_WALK_ON_FIRE, false ); @@ -1322,20 +1322,20 @@ CBaseEntity *CNPC_BaseZombie::ClawAttack( float flDist, int iDamage, QAngle &qaV { case ZOMBIE_BLOOD_LEFT_HAND: if( GetAttachment( "blood_left", vecBloodPos ) ) - SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), min( iDamage, 30 ) ); + SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), MIN( iDamage, 30 ) ); break; case ZOMBIE_BLOOD_RIGHT_HAND: if( GetAttachment( "blood_right", vecBloodPos ) ) - SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), min( iDamage, 30 ) ); + SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), MIN( iDamage, 30 ) ); break; case ZOMBIE_BLOOD_BOTH_HANDS: if( GetAttachment( "blood_left", vecBloodPos ) ) - SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), min( iDamage, 30 ) ); + SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), MIN( iDamage, 30 ) ); if( GetAttachment( "blood_right", vecBloodPos ) ) - SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), min( iDamage, 30 ) ); + SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), MIN( iDamage, 30 ) ); break; case ZOMBIE_BLOOD_BITE: diff --git a/dlls/hl2_dll/npc_PoisonZombie.cpp b/dlls/hl2_dll/npc_PoisonZombie.cpp index ba1bf00a..0dd3e3fc 100644 --- a/dlls/hl2_dll/npc_PoisonZombie.cpp +++ b/dlls/hl2_dll/npc_PoisonZombie.cpp @@ -451,7 +451,7 @@ int CNPC_PoisonZombie::OnTakeDamage_Alive( const CTakeDamageInfo &inputInfo ) // Calculate what percentage of the creature's max health // this amount of damage represents (clips at 1.0). // - float flDamagePercent = min( 1, inputInfo.GetDamage() / m_iMaxHealth ); + float flDamagePercent = MIN( 1, inputInfo.GetDamage() / m_iMaxHealth ); // // Throw one crab for every 20% damage we take. diff --git a/dlls/hl2_dll/npc_antlionguard.cpp b/dlls/hl2_dll/npc_antlionguard.cpp index 43166406..606938c3 100644 --- a/dlls/hl2_dll/npc_antlionguard.cpp +++ b/dlls/hl2_dll/npc_antlionguard.cpp @@ -723,7 +723,7 @@ bool CNPC_AntlionGuard::CanSummon( bool bIgnoreTime ) return false; // Hit the max number of them allowed? Only summon when we're 2 down. - if ( m_iNumLiveAntlions >= max(1, ANTLIONGUARD_SUMMON_COUNT-1) ) + if ( m_iNumLiveAntlions >= MAX(1, ANTLIONGUARD_SUMMON_COUNT-1) ) return false; return true; diff --git a/dlls/hl2_dll/npc_attackchopper.cpp b/dlls/hl2_dll/npc_attackchopper.cpp index d6fcb8ac..069adf6e 100644 --- a/dlls/hl2_dll/npc_attackchopper.cpp +++ b/dlls/hl2_dll/npc_attackchopper.cpp @@ -1982,19 +1982,19 @@ bool CNPC_AttackHelicopter::PoseGunTowardTargetDirection( const Vector &vTargetD if (angles.x > m_angGun.x) { - m_angGun.x = min( angles.x, m_angGun.x + 12 ); + m_angGun.x = MIN( angles.x, m_angGun.x + 12 ); } if (angles.x < m_angGun.x) { - m_angGun.x = max( angles.x, m_angGun.x - 12 ); + m_angGun.x = MAX( angles.x, m_angGun.x - 12 ); } if (angles.y > m_angGun.y) { - m_angGun.y = min( angles.y, m_angGun.y + 12 ); + m_angGun.y = MIN( angles.y, m_angGun.y + 12 ); } if (angles.y < m_angGun.y) { - m_angGun.y = max( angles.y, m_angGun.y - 12 ); + m_angGun.y = MAX( angles.y, m_angGun.y - 12 ); } SetPoseParameter( "weapon_pitch", -m_angGun.x ); @@ -3789,7 +3789,7 @@ void CNPC_AttackHelicopter::Flight( void ) Vector vecTargetPosition; float flCurrentSpeed = GetAbsVelocity().Length(); - float flDist = min( flCurrentSpeed + accelRate, maxSpeed ); + float flDist = MIN( flCurrentSpeed + accelRate, maxSpeed ); float dt = 1.0f; ComputeActualTargetPosition( flDist, dt, flPerpDist, &vecTargetPosition ); diff --git a/dlls/hl2_dll/npc_barnacle.cpp b/dlls/hl2_dll/npc_barnacle.cpp index 86bbb5a5..24fe7c08 100644 --- a/dlls/hl2_dll/npc_barnacle.cpp +++ b/dlls/hl2_dll/npc_barnacle.cpp @@ -1326,7 +1326,7 @@ void CNPC_Barnacle::AttachTongueToTarget( CBaseEntity *pTouchEnt, Vector vecGrab // barnacle might let go if ragdoll is separated - so increase the separation checking a bit constraint_groupparams_t params; pRagdoll->pGroup->GetErrorParams( ¶ms ); - params.minErrorTicks = min( params.minErrorTicks, 5 ); + params.minErrorTicks = MIN( params.minErrorTicks, 5 ); pRagdoll->pGroup->SetErrorParams( params ); for ( int i = 0; i < pRagdoll->listCount; i++ ) @@ -1882,11 +1882,11 @@ void CNPC_Barnacle::WaitTillDead ( void ) float dt = gpGlobals->curtime - GetLastThink(); if ( m_flAltitude >= goalAltitude ) { - flNewAltitude = max( goalAltitude, m_flAltitude - m_flBarnaclePullSpeed * dt ); + flNewAltitude = MAX( goalAltitude, m_flAltitude - m_flBarnaclePullSpeed * dt ); } else { - flNewAltitude = min( goalAltitude, m_flAltitude + m_flBarnaclePullSpeed * dt ); + flNewAltitude = MIN( goalAltitude, m_flAltitude + m_flBarnaclePullSpeed * dt ); } SetAltitude( flNewAltitude ); } @@ -2087,7 +2087,7 @@ CBaseEntity *CNPC_Barnacle::TongueTouchEnt ( float *pflLength ) length = fabs( GetAbsOrigin().z - tr.endpos.z ); // Pull it up a tad - length = max(8, length - m_flRestUnitsAboveGround); + length = MAX(8, length - m_flRestUnitsAboveGround); if ( pflLength ) { *pflLength = length; @@ -2155,7 +2155,7 @@ CBaseEntity *CNPC_Barnacle::TongueTouchEnt ( float *pflLength ) #ifdef HL2_EPISODIC length = fabs( GetAbsOrigin().z - pTest->WorldSpaceCenter().z ); // Pull it up a tad - length = max(8, length - m_flRestUnitsAboveGround); + length = MAX(8, length - m_flRestUnitsAboveGround); if ( pflLength ) { *pflLength = length; @@ -2183,7 +2183,7 @@ CBaseEntity *CNPC_Barnacle::TongueTouchEnt ( float *pflLength ) #ifdef HL2_EPISODIC length = fabs( GetAbsOrigin().z - pTest->WorldSpaceCenter().z ); // Pull it up a tad - length = max(8, length - m_flRestUnitsAboveGround); + length = MAX(8, length - m_flRestUnitsAboveGround); if ( pflLength ) { *pflLength = length; diff --git a/dlls/hl2_dll/npc_citizen17.cpp b/dlls/hl2_dll/npc_citizen17.cpp index ff69775d..4fc2a0e3 100644 --- a/dlls/hl2_dll/npc_citizen17.cpp +++ b/dlls/hl2_dll/npc_citizen17.cpp @@ -982,7 +982,7 @@ void CNPC_Citizen::PrescheduleThink() const float TIME_FADE = 1.0; float timeInSquad = gpGlobals->curtime - m_flTimeJoinedPlayerSquad; - timeInSquad = min( TIME_FADE, max( timeInSquad, 0 ) ); + timeInSquad = MIN( TIME_FADE, MAX( timeInSquad, 0 ) ); float fade = ( 1.0 - timeInSquad / TIME_FADE ); diff --git a/dlls/hl2_dll/npc_combinedropship.cpp b/dlls/hl2_dll/npc_combinedropship.cpp index eade4081..a362dfc5 100644 --- a/dlls/hl2_dll/npc_combinedropship.cpp +++ b/dlls/hl2_dll/npc_combinedropship.cpp @@ -1141,7 +1141,7 @@ void CNPC_CombineDropship::Flight( void ) } float flCurrentSpeed = GetAbsVelocity().Length(); - float flDist = min( flCurrentSpeed + accelRate, maxSpeed ); + float flDist = MIN( flCurrentSpeed + accelRate, maxSpeed ); Vector deltaPos; if ( GetLandingState() == LANDING_SWOOPING ) @@ -1954,8 +1954,8 @@ void CNPC_CombineDropship::PrescheduleThink( void ) #define MIN_LAND_VEL -75.0f #define ALTITUDE_CAP 512.0f - float flFactor = min( 1.0, flAltitude / ALTITUDE_CAP ); - float flDescendVelocity = min( -75, MAX_LAND_VEL * flFactor ); + float flFactor = MIN( 1.0, flAltitude / ALTITUDE_CAP ); + float flDescendVelocity = MIN( -75, MAX_LAND_VEL * flFactor ); vecVelocity.z = flDescendVelocity; @@ -2184,7 +2184,7 @@ void CNPC_CombineDropship::PrescheduleThink( void ) float flSpeed = GetAbsVelocity().Length(); Vector vecVelocity = vecToTarget; VectorNormalize( vecVelocity ); - SetAbsVelocity( vecVelocity * min(flSpeed,flDistance) ); + SetAbsVelocity( vecVelocity * MIN(flSpeed,flDistance) ); } else */ diff --git a/dlls/hl2_dll/npc_combinegunship.cpp b/dlls/hl2_dll/npc_combinegunship.cpp index 8f332060..96350f52 100644 --- a/dlls/hl2_dll/npc_combinegunship.cpp +++ b/dlls/hl2_dll/npc_combinegunship.cpp @@ -2073,7 +2073,7 @@ void CNPC_CombineGunship::Flight( void ) } float flCurrentSpeed = GetAbsVelocity().Length(); - float flDist = min( flCurrentSpeed + accelRate, maxSpeed ); + float flDist = MIN( flCurrentSpeed + accelRate, maxSpeed ); Vector deltaPos; if ( m_lifeState == LIFE_DYING || m_hGroundAttackTarget ) @@ -2670,19 +2670,19 @@ bool CNPC_CombineGunship::PoseGunTowardTargetDirection( const Vector &vTargetDir if (angles.x > m_angGun.x) { - m_angGun.x = min( angles.x, m_angGun.x + 12 ); + m_angGun.x = MIN( angles.x, m_angGun.x + 12 ); } if (angles.x < m_angGun.x) { - m_angGun.x = max( angles.x, m_angGun.x - 12 ); + m_angGun.x = MAX( angles.x, m_angGun.x - 12 ); } if (angles.y > m_angGun.y) { - m_angGun.y = min( angles.y, m_angGun.y + 12 ); + m_angGun.y = MIN( angles.y, m_angGun.y + 12 ); } if (angles.y < m_angGun.y) { - m_angGun.y = max( angles.y, m_angGun.y - 12 ); + m_angGun.y = MAX( angles.y, m_angGun.y - 12 ); } SetPoseParameter( "weapon_pitch", -m_angGun.x ); diff --git a/dlls/hl2_dll/npc_cranedriver.cpp b/dlls/hl2_dll/npc_cranedriver.cpp index a76826e0..f1f1fcd9 100644 --- a/dlls/hl2_dll/npc_cranedriver.cpp +++ b/dlls/hl2_dll/npc_cranedriver.cpp @@ -606,7 +606,7 @@ void CNPC_CraneDriver::DriveVehicle( void ) // Start slowing if we're going to hit the point soon float flTurnInDeg = RAD2DEG( acos(flDotForward) ); float flSpeed = m_hCrane->GetMaxTurnRate() * (flTurnInDeg / 15.0); - flSpeed = min( m_hCrane->GetMaxTurnRate(), flSpeed ); + flSpeed = MIN( m_hCrane->GetMaxTurnRate(), flSpeed ); if ( fabs(flSpeed) < 0.05 ) { // We're approaching the target, so stop turning diff --git a/dlls/hl2_dll/npc_crow.cpp b/dlls/hl2_dll/npc_crow.cpp index 337ec115..9a9d2437 100644 --- a/dlls/hl2_dll/npc_crow.cpp +++ b/dlls/hl2_dll/npc_crow.cpp @@ -1063,7 +1063,7 @@ bool CNPC_Crow::BecomeRagdollOnClient( const Vector &force ) { float flMass = VPhysicsGetObject()->GetMass(); float speed = VectorNormalize( newForce ); - speed = min( speed, (CROW_RAGDOLL_SPEED_LIMIT * flMass) ); + speed = MIN( speed, (CROW_RAGDOLL_SPEED_LIMIT * flMass) ); newForce *= speed; } diff --git a/dlls/hl2_dll/npc_fastzombie.cpp b/dlls/hl2_dll/npc_fastzombie.cpp index f468ec06..e0ffb62d 100644 --- a/dlls/hl2_dll/npc_fastzombie.cpp +++ b/dlls/hl2_dll/npc_fastzombie.cpp @@ -555,7 +555,7 @@ void CFastZombie::PrescheduleThink( void ) // Zombie is close! Recalculate pitch. int iPitch; - m_flDistFactor = min( 1.0, 1 - flDistNoBBox / FASTZOMBIE_EXCITE_DIST ); + m_flDistFactor = MIN( 1.0, 1 - flDistNoBBox / FASTZOMBIE_EXCITE_DIST ); iPitch = static_cast(FASTZOMBIE_MIN_PITCH + ( ( FASTZOMBIE_MAX_PITCH - FASTZOMBIE_MIN_PITCH ) * m_flDistFactor)); ENVELOPE_CONTROLLER.SoundChangePitch( m_pMoanSound, iPitch, FASTZOMBIE_SOUND_UPDATE_FREQ ); } diff --git a/dlls/hl2_dll/npc_headcrab.cpp b/dlls/hl2_dll/npc_headcrab.cpp index d2d15c6c..2af481e3 100644 --- a/dlls/hl2_dll/npc_headcrab.cpp +++ b/dlls/hl2_dll/npc_headcrab.cpp @@ -1051,7 +1051,7 @@ void CBaseHeadcrab::PrescheduleThink( void ) // Are we fading in after being hidden? if ( !m_bHidden && (m_nRenderMode != kRenderNormal) ) { - int iNewAlpha = min( 255, GetRenderColor().a + 120 ); + int iNewAlpha = MIN( 255, GetRenderColor().a + 120 ); if ( iNewAlpha >= 255 ) { m_nRenderMode = kRenderNormal; diff --git a/dlls/hl2_dll/npc_ichthyosaur.cpp b/dlls/hl2_dll/npc_ichthyosaur.cpp index 9722bf85..a56e7bf9 100644 --- a/dlls/hl2_dll/npc_ichthyosaur.cpp +++ b/dlls/hl2_dll/npc_ichthyosaur.cpp @@ -743,7 +743,7 @@ void CNPC_Ichthyosaur::SteerArrive(Vector &Steer, const Vector &Target) float fTargetDistance = Offset.Length(); float fIdealSpeed = m_flGroundSpeed * (fTargetDistance / ICH_WAYPOINT_DISTANCE); - float fClippedSpeed = min( fIdealSpeed, m_flGroundSpeed ); + float fClippedSpeed = MIN( fIdealSpeed, m_flGroundSpeed ); Vector DesiredVelocity( 0, 0, 0 ); @@ -896,29 +896,29 @@ void CNPC_Ichthyosaur::ClampSteer(Vector &SteerAbs, Vector &SteerRel, Vector &fo if (fForwardSteer > 0) { - fForwardSteer = min(fForwardSteer, m_vecAccelerationMax.x); + fForwardSteer = MIN(fForwardSteer, m_vecAccelerationMax.x); } else { - fForwardSteer = max(fForwardSteer, m_vecAccelerationMin.x); + fForwardSteer = MAX(fForwardSteer, m_vecAccelerationMin.x); } if (fRightSteer > 0) { - fRightSteer = min(fRightSteer, m_vecAccelerationMax.y); + fRightSteer = MIN(fRightSteer, m_vecAccelerationMax.y); } else { - fRightSteer = max(fRightSteer, m_vecAccelerationMin.y); + fRightSteer = MAX(fRightSteer, m_vecAccelerationMin.y); } if (fUpSteer > 0) { - fUpSteer = min(fUpSteer, m_vecAccelerationMax.z); + fUpSteer = MIN(fUpSteer, m_vecAccelerationMax.z); } else { - fUpSteer = max(fUpSteer, m_vecAccelerationMin.z); + fUpSteer = MAX(fUpSteer, m_vecAccelerationMin.z); } SteerAbs = (fForwardSteer*forward) + (fRightSteer*right) + (fUpSteer*up); @@ -1244,7 +1244,7 @@ void CNPC_Ichthyosaur::EnsnareVictim( CBaseEntity *pVictim ) if ( pPlayer ) { - m_flHoldTime = max( gpGlobals->curtime+3.0f, pPlayer->PlayerDrownTime() - 2.0f ); + m_flHoldTime = MAX( gpGlobals->curtime+3.0f, pPlayer->PlayerDrownTime() - 2.0f ); } } else diff --git a/dlls/hl2_dll/npc_manhack.cpp b/dlls/hl2_dll/npc_manhack.cpp index c4dc5726..e76157a1 100644 --- a/dlls/hl2_dll/npc_manhack.cpp +++ b/dlls/hl2_dll/npc_manhack.cpp @@ -1096,7 +1096,7 @@ void CNPC_Manhack::MaintainGroundHeight( void ) if ( tr.fraction != 1.0f ) { - float speedAdj = max( 16, (-zSpeed*0.5f) ); + float speedAdj = MAX( 16, (-zSpeed*0.5f) ); m_vForceVelocity += Vector(0,0,1) * ( speedAdj * ( 1.0f - tr.fraction ) ); } @@ -1285,7 +1285,7 @@ void CNPC_Manhack::MoveToTarget(float flInterval, const Vector &vMoveTarget) #else myAccel = 400; #endif // _XBOX - myZAccel = min( 500, zDist / flInterval ); + myZAccel = MIN( 500, zDist / flInterval ); } else { @@ -1810,11 +1810,11 @@ void CNPC_Manhack::PlayFlySound(void) int iPitch1, iPitch2; float flDistFactor; - flDistFactor = min( 1.0, 1 - flEnemyDist / MANHACK_PITCH_DIST1 ); + flDistFactor = MIN( 1.0, 1 - flEnemyDist / MANHACK_PITCH_DIST1 ); iPitch1 = static_cast(MANHACK_MIN_PITCH1 + ( ( MANHACK_MAX_PITCH1 - MANHACK_MIN_PITCH1 ) * flDistFactor)); // NOTE: MANHACK_PITCH_DIST2 must be < MANHACK_PITCH_DIST1 - flDistFactor = min( 1.0, 1 - flEnemyDist / MANHACK_PITCH_DIST2 ); + flDistFactor = MIN( 1.0, 1 - flEnemyDist / MANHACK_PITCH_DIST2 ); iPitch2 = static_cast(MANHACK_MIN_PITCH2 + ( ( MANHACK_MAX_PITCH2 - MANHACK_MIN_PITCH2 ) * flDistFactor)); m_nEnginePitch1 = iPitch1; @@ -1952,7 +1952,7 @@ void CNPC_Manhack::MoveExecute_Alive(float flInterval) else if( GetWaterLevel() > 0 ) { // Allow the manhack to lift off, but not to go deeper. - m_vCurrentVelocity.z = max( m_vCurrentVelocity.z, 0 ); + m_vCurrentVelocity.z = MAX( m_vCurrentVelocity.z, 0 ); } CheckCollisions(flInterval); diff --git a/dlls/hl2_dll/npc_metropolice.cpp b/dlls/hl2_dll/npc_metropolice.cpp index 55c64008..6b874a7d 100644 --- a/dlls/hl2_dll/npc_metropolice.cpp +++ b/dlls/hl2_dll/npc_metropolice.cpp @@ -1825,7 +1825,7 @@ void CNPC_MetroPolice::AimBurstAtEnemy( float flReactionTime ) // Compute the distance along the stitch direction to the cop. we don't want to cross that line Vector vecStitchStart, vecStitchEnd; - VectorMA( vecShootAt, -min( flStitchLength * flReactionFraction, flMaxStitchDistance ), vecDelta, vecStitchStart ); + VectorMA( vecShootAt, -MIN( flStitchLength * flReactionFraction, flMaxStitchDistance ), vecDelta, vecStitchStart ); VectorMA( vecShootAt, flStitchLength * (1.0f - flReactionFraction), vecDelta, vecStitchEnd ); // Trace down a bit to hit the ground if we're above the ground... @@ -2004,7 +2004,7 @@ void CNPC_MetroPolice::AimBurstAlongSideOfEnemy( float flFollowTime ) vecShootAtVel.z = 0.0f; float flTargetSpeed = VectorNormalize( vecShootAtVel ); - float flStitchLength = max( AIM_IN_FRONT_OF_DEFAULT_STITCH_LENGTH, flTargetSpeed * flFollowTime * 0.9 ); + float flStitchLength = MAX( AIM_IN_FRONT_OF_DEFAULT_STITCH_LENGTH, flTargetSpeed * flFollowTime * 0.9 ); // This defines the line of death, which, when crossed, results in damage m_vecBurstLineOfDeathOrigin = vecSidePoint; @@ -4790,8 +4790,8 @@ void CNPC_MetroPolice::RunTask( 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 diff --git a/dlls/hl2_dll/npc_missiledefense.cpp b/dlls/hl2_dll/npc_missiledefense.cpp index e7fe8df7..96082b45 100644 --- a/dlls/hl2_dll/npc_missiledefense.cpp +++ b/dlls/hl2_dll/npc_missiledefense.cpp @@ -463,13 +463,13 @@ void CNPC_MissileDefense::AimGun( void ) float flOldY = m_vGunAng.y; if (angles.x > m_vGunAng.x) - m_vGunAng.x = min( angles.x, m_vGunAng.x + MD_PITCH_SPEED ); + m_vGunAng.x = MIN( angles.x, m_vGunAng.x + MD_PITCH_SPEED ); if (angles.x < m_vGunAng.x) - m_vGunAng.x = max( angles.x, m_vGunAng.x - MD_PITCH_SPEED ); + m_vGunAng.x = MAX( angles.x, m_vGunAng.x - MD_PITCH_SPEED ); if (angles.y > m_vGunAng.y) - m_vGunAng.y = min( angles.y, m_vGunAng.y + MD_YAW_SPEED ); + m_vGunAng.y = MIN( angles.y, m_vGunAng.y + MD_YAW_SPEED ); if (angles.y < m_vGunAng.y) - m_vGunAng.y = max( angles.y, m_vGunAng.y - MD_YAW_SPEED ); + m_vGunAng.y = MAX( angles.y, m_vGunAng.y - MD_YAW_SPEED ); m_vGunAng.y = SetBoneController( MD_BC_YAW, m_vGunAng.y ); m_vGunAng.x = SetBoneController( MD_BC_PITCH, m_vGunAng.x ); diff --git a/dlls/hl2_dll/npc_playercompanion.cpp b/dlls/hl2_dll/npc_playercompanion.cpp index e76aa57e..3e8a4c01 100644 --- a/dlls/hl2_dll/npc_playercompanion.cpp +++ b/dlls/hl2_dll/npc_playercompanion.cpp @@ -1400,7 +1400,7 @@ void CNPC_PlayerCompanion::SubtractReadiness( float flSub, bool bOverrideLock ) return; // Prevent readiness from going below 0 (below 0 is only for scripted states) - SetReadinessValue( max(GetReadinessValue() - flSub, 0) ); + SetReadinessValue( MAX(GetReadinessValue() - flSub, 0) ); } //----------------------------------------------------------------------------- @@ -1427,8 +1427,8 @@ void CNPC_PlayerCompanion::SetReadinessValue( float flSet ) int priorReadiness = GetReadinessLevel(); - flSet = min( 1.0f, flSet ); - flSet = max( READINESS_MIN_VALUE, flSet ); + flSet = MIN( 1.0f, flSet ); + flSet = MAX( READINESS_MIN_VALUE, flSet ); m_flReadiness = flSet; diff --git a/dlls/hl2_dll/npc_scanner.cpp b/dlls/hl2_dll/npc_scanner.cpp index a5fb2797..0c322a57 100644 --- a/dlls/hl2_dll/npc_scanner.cpp +++ b/dlls/hl2_dll/npc_scanner.cpp @@ -1359,7 +1359,7 @@ void CNPC_CScanner::PlayFlySound(void) float speed = GetCurrentVelocity().Length(); float flVolume = 0.25f + (0.75f*(speed/GetMaxSpeed())); - int iPitch = static_cast(min( 255, 80 + (20*(speed/GetMaxSpeed())) )); + int iPitch = static_cast(MIN( 255, 80 + (20*(speed/GetMaxSpeed())) )); //Update our pitch and volume based on our speed controller.SoundChangePitch( m_pEngineSound, iPitch, 0.1f ); diff --git a/dlls/hl2_dll/npc_strider.cpp b/dlls/hl2_dll/npc_strider.cpp index dc2a8243..df802c78 100644 --- a/dlls/hl2_dll/npc_strider.cpp +++ b/dlls/hl2_dll/npc_strider.cpp @@ -968,7 +968,7 @@ void CNPC_Strider::GatherConditions() { #if 0 if ( !HasCondition( COND_STRIDER_SHOULD_CROUCH ) && !HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) - SetIdealHeight( min( GetMaxHeight(), GetHeight() + 75.0 * 0.1 ) ); // default to rising up + SetIdealHeight( MIN( GetMaxHeight(), GetHeight() + 75.0 * 0.1 ) ); // default to rising up #endif GatherHeightConditions( GetAdjustedOrigin(), GetEnemy() ); } @@ -3576,8 +3576,8 @@ bool CNPC_Strider::AimCannonAt( CBaseEntity *pEntity, float flInterval ) float yawSpeed = fabsf(aimSpeed*flInterval*localEnemyAngles.y); float pitchSpeed = fabsf(aimSpeed*flInterval*localEnemyAngles.x); - yawSpeed = max(yawSpeed,5); - pitchSpeed = max(pitchSpeed,5); + yawSpeed = MAX(yawSpeed,5); + pitchSpeed = MAX(pitchSpeed,5); m_aimYaw = UTIL_Approach( targetYaw, m_aimYaw, yawSpeed ); m_aimPitch = UTIL_Approach( targetPitch, m_aimPitch, pitchSpeed ); @@ -4300,10 +4300,10 @@ void CStriderMinigun::AimAtPoint( IStriderMinigunHost *pHost, const Vector &vecP m_pitch.target += 0.5 * pdiff; m_yaw.target -= 0.5 * ydiff; - m_pitch.target = max( MINIGUN_MIN_PITCH, m_pitch.target ); - m_pitch.target = min( MINIGUN_MAX_PITCH, m_pitch.target ); - m_yaw.target = max( MINIGUN_MIN_YAW, m_yaw.target ); - m_yaw.target = min( MINIGUN_MAX_YAW, m_yaw.target ); + m_pitch.target = MAX( MINIGUN_MIN_PITCH, m_pitch.target ); + m_pitch.target = MIN( MINIGUN_MAX_PITCH, m_pitch.target ); + m_yaw.target = MAX( MINIGUN_MIN_YAW, m_yaw.target ); + m_yaw.target = MIN( MINIGUN_MAX_YAW, m_yaw.target ); } //--------------------------------------------------------- @@ -4714,7 +4714,7 @@ void CStriderMinigun::Think( IStriderMinigunHost *pHost, float dt ) // time. This guarantees that the minigun will strike the target a few times. float flFactor = (flRemainingShootTime - pHost->GetMinigunOnTargetTime() ) / m_shootDuration; - flFactor = max( 0.0f, flFactor ); + flFactor = MAX( 0.0f, flFactor ); Vector vecTarget = pTargetEnt->BodyTarget( assert_cast(pHost->GetEntity())->GetAdjustedOrigin()); @@ -4738,7 +4738,7 @@ void CStriderMinigun::Think( IStriderMinigunHost *pHost, float dt ) { m_bWarnedAI = true; - CSoundEnt::InsertSound( SOUND_DANGER | SOUND_CONTEXT_REACT_TO_SOURCE, pTargetEnt->EarPosition() + Vector( 0, 0, 1 ), 120, max( 1.0, flRemainingShootTime ), pHost->GetEntity() ); + CSoundEnt::InsertSound( SOUND_DANGER | SOUND_CONTEXT_REACT_TO_SOURCE, pTargetEnt->EarPosition() + Vector( 0, 0, 1 ), 120, MAX( 1.0, flRemainingShootTime ), pHost->GetEntity() ); } } } diff --git a/dlls/hl2_dll/npc_turret.cpp b/dlls/hl2_dll/npc_turret.cpp index 52bdcf97..e534a4de 100644 --- a/dlls/hl2_dll/npc_turret.cpp +++ b/dlls/hl2_dll/npc_turret.cpp @@ -379,7 +379,7 @@ void CBaseTurret::EyeOff( ) { if (m_eyeBrightness > 0) { - m_eyeBrightness = max( 0, m_eyeBrightness - 30 ); + m_eyeBrightness = MAX( 0, m_eyeBrightness - 30 ); m_pEyeGlow->SetBrightness( m_eyeBrightness ); } } diff --git a/dlls/hl2_dll/prop_combine_ball.cpp b/dlls/hl2_dll/prop_combine_ball.cpp index 1d3b02d3..6f0986ec 100644 --- a/dlls/hl2_dll/prop_combine_ball.cpp +++ b/dlls/hl2_dll/prop_combine_ball.cpp @@ -1722,7 +1722,7 @@ void CFuncCombineBallSpawner::Spawn() float flWidth = CollisionProp()->OBBSize().x; float flHeight = CollisionProp()->OBBSize().y; - m_flRadius = min( flWidth, flHeight ) * 0.5f; + m_flRadius = MIN( flWidth, flHeight ) * 0.5f; if ( m_flRadius <= 0.0f && m_bShooter == false ) { Warning("Zero dimension func_combine_ball_spawner! Removing...\n"); diff --git a/dlls/hl2_dll/prop_thumper.cpp b/dlls/hl2_dll/prop_thumper.cpp index 1ae16b68..5d6c50ce 100644 --- a/dlls/hl2_dll/prop_thumper.cpp +++ b/dlls/hl2_dll/prop_thumper.cpp @@ -146,11 +146,11 @@ void CPropThumper::HandleState( void ) { if ( m_bEnabled == false ) { - m_flPlaybackRate = max( m_flPlaybackRate - STATE_CHANGE_MODIFIER, 0.0f ); + m_flPlaybackRate = MAX( m_flPlaybackRate - STATE_CHANGE_MODIFIER, 0.0f ); } else { - m_flPlaybackRate = min( m_flPlaybackRate + STATE_CHANGE_MODIFIER, 1.0f ); + m_flPlaybackRate = MIN( m_flPlaybackRate + STATE_CHANGE_MODIFIER, 1.0f ); } (CSoundEnvelopeController::GetController()).Play( m_sndMotor, 1.0f, m_flPlaybackRate * 100 ); diff --git a/dlls/hl2_dll/proto_sniper.cpp b/dlls/hl2_dll/proto_sniper.cpp index 696de887..357d9697 100644 --- a/dlls/hl2_dll/proto_sniper.cpp +++ b/dlls/hl2_dll/proto_sniper.cpp @@ -745,7 +745,7 @@ void CProtoSniper::PaintTarget( const Vector &vecTarget, float flPaintTime ) float P; // keep painttime from hitting 0 exactly. - flPaintTime = max( flPaintTime, 0.000001f ); + flPaintTime = MAX( flPaintTime, 0.000001f ); P = GetPositionParameter( flPaintTime, false ); diff --git a/dlls/hl2_dll/vehicle_airboat.cpp b/dlls/hl2_dll/vehicle_airboat.cpp index 78a42a68..cd87aca5 100644 --- a/dlls/hl2_dll/vehicle_airboat.cpp +++ b/dlls/hl2_dll/vehicle_airboat.cpp @@ -786,7 +786,7 @@ Vector CPropAirboat::GetSmoothedVelocity( void ) Vector vecForward; GetVectors( &vecForward, NULL, NULL ); - vecForward *= max( flSpeed, 1.0f ); + vecForward *= MAX( flSpeed, 1.0f ); if ( flSpeed <= SMOOTHED_MIN_VELOCITY ) return vecForward; diff --git a/dlls/hl2_dll/vehicle_cannon.cpp b/dlls/hl2_dll/vehicle_cannon.cpp index ce1e7deb..af44af30 100644 --- a/dlls/hl2_dll/vehicle_cannon.cpp +++ b/dlls/hl2_dll/vehicle_cannon.cpp @@ -401,7 +401,7 @@ void CPropCannon::DriveCannon( int iDriverButtons, int iButtonsPressed ) // If we're turning back on ourselves, use decel speed if ( m_flTurn < 0 ) { - flTurnAdd = max( flTurnAdd, m_flTurnDecel ); + flTurnAdd = MAX( flTurnAdd, m_flTurnDecel ); } m_flTurn = UTIL_Approach( m_flMaxTurnSpeed, m_flTurn, flTurnAdd * gpGlobals->frametime ); @@ -415,7 +415,7 @@ void CPropCannon::DriveCannon( int iDriverButtons, int iButtonsPressed ) // If we're turning back on ourselves, increase the rate if ( m_flTurn > 0 ) { - flTurnAdd = max( flTurnAdd, m_flTurnDecel ); + flTurnAdd = MAX( flTurnAdd, m_flTurnDecel ); } m_flTurn = UTIL_Approach( -m_flMaxTurnSpeed, m_flTurn, flTurnAdd * gpGlobals->frametime ); diff --git a/dlls/hl2_dll/vehicle_crane.cpp b/dlls/hl2_dll/vehicle_crane.cpp index da16003a..80b6513a 100644 --- a/dlls/hl2_dll/vehicle_crane.cpp +++ b/dlls/hl2_dll/vehicle_crane.cpp @@ -537,7 +537,7 @@ void CPropCrane::DriveCrane( int iDriverButtons, int iButtonsPressed, float flNP // If we're turning back on ourselves, use decel speed if ( m_flTurn < 0 ) { - flTurnAdd = max( flTurnAdd, m_flTurnDecel ); + flTurnAdd = MAX( flTurnAdd, m_flTurnDecel ); } m_flTurn = UTIL_Approach( m_flMaxTurnSpeed, m_flTurn, flTurnAdd * gpGlobals->frametime ); @@ -558,7 +558,7 @@ void CPropCrane::DriveCrane( int iDriverButtons, int iButtonsPressed, float flNP // If we're turning back on ourselves, increase the rate if ( m_flTurn > 0 ) { - flTurnAdd = max( flTurnAdd, m_flTurnDecel ); + flTurnAdd = MAX( flTurnAdd, m_flTurnDecel ); } m_flTurn = UTIL_Approach( -m_flMaxTurnSpeed, m_flTurn, flTurnAdd * gpGlobals->frametime ); } @@ -580,7 +580,7 @@ void CPropCrane::DriveCrane( int iDriverButtons, int iButtonsPressed, float flNP float rumble; float factor = fabs(m_flTurn) / maxTurn; - factor = min( factor, 1.0f ); + factor = MIN( factor, 1.0f ); rumble = minRumble + (rumbleRange * factor); m_hPlayer->RumbleEffect( RUMBLE_FLAT_BOTH, (int)(rumble * 100), RUMBLE_FLAG_UPDATE_SCALE ); diff --git a/dlls/hl2_dll/weapon_annabelle.cpp b/dlls/hl2_dll/weapon_annabelle.cpp index 971adcaa..ed621e85 100644 --- a/dlls/hl2_dll/weapon_annabelle.cpp +++ b/dlls/hl2_dll/weapon_annabelle.cpp @@ -157,7 +157,7 @@ bool CWeaponAnnabelle::StartReload( void ) m_bNeedPump = true; } - int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; @@ -198,7 +198,7 @@ bool CWeaponAnnabelle::Reload( void ) if (m_iClip1 >= GetMaxClip1()) return false; - int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; @@ -323,7 +323,7 @@ void CWeaponAnnabelle::ItemHolsterFrame( void ) return; // Just load the clip with no animations - int ammoFill = min( (GetMaxClip1() - m_iClip1), GetOwner()->GetAmmoCount( GetPrimaryAmmoType() ) ); + int ammoFill = MIN( (GetMaxClip1() - m_iClip1), GetOwner()->GetAmmoCount( GetPrimaryAmmoType() ) ); GetOwner()->RemoveAmmo( ammoFill, GetPrimaryAmmoType() ); m_iClip1 += ammoFill; diff --git a/dlls/hl2_dll/weapon_immolator.cpp b/dlls/hl2_dll/weapon_immolator.cpp index 9d8e3526..a0fb6ee5 100644 --- a/dlls/hl2_dll/weapon_immolator.cpp +++ b/dlls/hl2_dll/weapon_immolator.cpp @@ -226,7 +226,7 @@ void CWeaponImmolator::Update() } // Clamp - m_flBurnRadius = min( m_flBurnRadius, MAX_BURN_RADIUS ); + m_flBurnRadius = MIN( m_flBurnRadius, MAX_BURN_RADIUS ); CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); diff --git a/dlls/hl2_dll/weapon_physcannon.cpp b/dlls/hl2_dll/weapon_physcannon.cpp index 2f2f22e2..30b9d3dc 100644 --- a/dlls/hl2_dll/weapon_physcannon.cpp +++ b/dlls/hl2_dll/weapon_physcannon.cpp @@ -1799,7 +1799,7 @@ void CWeaponPhysCannon::PuntVPhysics( CBaseEntity *pEntity, const Vector &vecFor { maxMass *= 2.5; // 625 for vehicles } - float mass = min(totalMass, maxMass); // max 250kg of additional force + float mass = MIN(totalMass, maxMass); // max 250kg of additional force // Put some spin on the object for ( i = 0; i < listCount; i++ ) @@ -1811,7 +1811,7 @@ void CWeaponPhysCannon::PuntVPhysics( CBaseEntity *pEntity, const Vector &vecFor if ( pList[i] == pEntity->VPhysicsGetObject() ) { ratio += hitObjectFactor; - ratio = min(ratio,1.0f); + ratio = MIN(ratio,1.0f); } else { diff --git a/dlls/hl2_dll/weapon_rpg.cpp b/dlls/hl2_dll/weapon_rpg.cpp index 3b9b14e4..62e2193f 100644 --- a/dlls/hl2_dll/weapon_rpg.cpp +++ b/dlls/hl2_dll/weapon_rpg.cpp @@ -1985,7 +1985,7 @@ int CWeaponRPG::WeaponRangeAttack1Condition( float flDot, float flDist ) flDist = vecToTarget.Length(); } - if ( flDist < min( m_fMinRange1, m_fMinRange2 ) ) + if ( flDist < MIN( m_fMinRange1, m_fMinRange2 ) ) return COND_TOO_CLOSE_TO_ATTACK; if ( m_flNextPrimaryAttack > gpGlobals->curtime ) diff --git a/dlls/hl2_dll/weapon_shotgun.cpp b/dlls/hl2_dll/weapon_shotgun.cpp index 2cd55088..5417fc37 100644 --- a/dlls/hl2_dll/weapon_shotgun.cpp +++ b/dlls/hl2_dll/weapon_shotgun.cpp @@ -241,7 +241,7 @@ bool CWeaponShotgun::StartReload( void ) m_bNeedPump = true; } - int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; @@ -282,7 +282,7 @@ bool CWeaponShotgun::Reload( void ) if (m_iClip1 >= GetMaxClip1()) return false; - int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; @@ -705,7 +705,7 @@ void CWeaponShotgun::ItemHolsterFrame( void ) return; // Just load the clip with no animations - int ammoFill = min( (GetMaxClip1() - m_iClip1), GetOwner()->GetAmmoCount( GetPrimaryAmmoType() ) ); + int ammoFill = MIN( (GetMaxClip1() - m_iClip1), GetOwner()->GetAmmoCount( GetPrimaryAmmoType() ) ); GetOwner()->RemoveAmmo( ammoFill, GetPrimaryAmmoType() ); m_iClip1 += ammoFill; diff --git a/dlls/hl2_dll/weapon_sniperrifle.cpp b/dlls/hl2_dll/weapon_sniperrifle.cpp index d0d32dda..687d8c46 100644 --- a/dlls/hl2_dll/weapon_sniperrifle.cpp +++ b/dlls/hl2_dll/weapon_sniperrifle.cpp @@ -273,8 +273,8 @@ bool CWeaponSniperRifle::Reload( void ) if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) > 0) { - int primary = min(GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); - int secondary = min(GetMaxClip2() - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType)); + int primary = MIN(GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int secondary = MIN(GetMaxClip2() - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType)); if (primary > 0 || secondary > 0) { diff --git a/dlls/hltvdirector.cpp b/dlls/hltvdirector.cpp index 14740bca..8645e62e 100644 --- a/dlls/hltvdirector.cpp +++ b/dlls/hltvdirector.cpp @@ -225,7 +225,7 @@ void CHLTVDirector::UpdateSettings() } } - m_nBroadcastTick = max( 0, newBroadcastTick ); + m_nBroadcastTick = MAX( 0, newBroadcastTick ); } const char** CHLTVDirector::GetModEvents() @@ -504,7 +504,7 @@ void CHLTVDirector::StartBestFixedCameraShot( bool bForce ) void CHLTVDirector::StartRandomShot() { int toTick = m_nBroadcastTick + TIME_TO_TICKS ( DEF_SHOT_LENGTH ); - m_nNextShotTick = min( m_nNextShotTick, toTick ); + m_nNextShotTick = MIN( m_nNextShotTick, toTick ); if ( RandomFloat(0,1) < 0.25 && tv_allow_static_shots.GetBool() ) { @@ -581,7 +581,7 @@ void CHLTVDirector::CreateShotFromEvent( CGameEvent *event ) } // shot 2 seconds after death/hurt - m_nNextShotTick = min( m_nNextShotTick, (event->m_Tick+TIME_TO_TICKS(2.0)) ); + m_nNextShotTick = MIN( m_nNextShotTick, (event->m_Tick+TIME_TO_TICKS(2.0)) ); m_iPVSEntity = victim->entindex(); } else if ( bRoundStart || bRoundEnd ) @@ -819,7 +819,7 @@ bool CHLTVDirector::StartCameraManShot() void CHLTVDirector::StartNewShot() { // we can remove all events the - int smallestTick = max(0, gpGlobals->tickcount - TIME_TO_TICKS(HLTV_MAX_DELAY) ); + int smallestTick = MAX(0, gpGlobals->tickcount - TIME_TO_TICKS(HLTV_MAX_DELAY) ); RemoveEventsFromHistory( smallestTick ); if ( m_iCameraMan > 0 ) diff --git a/dlls/maprules.cpp b/dlls/maprules.cpp index f91a9f29..d8e15b96 100644 --- a/dlls/maprules.cpp +++ b/dlls/maprules.cpp @@ -624,7 +624,7 @@ bool CGamePlayerEquip::KeyValue( const char *szKeyName, const char *szValue ) m_weaponNames[i] = AllocPooledString(tmp); m_weaponCount[i] = atoi(szValue); - m_weaponCount[i] = max(1,m_weaponCount[i]); + m_weaponCount[i] = MAX(1,m_weaponCount[i]); return true; } } diff --git a/dlls/nav_area.cpp b/dlls/nav_area.cpp index df3f01d7..6a33e971 100644 --- a/dlls/nav_area.cpp +++ b/dlls/nav_area.cpp @@ -914,8 +914,8 @@ bool CNavArea::SpliceEdit( CNavArea *other ) if (m_extent.lo.x > other->m_extent.hi.x) { // 'this' is east of 'other' - float top = max( m_extent.lo.y, other->m_extent.lo.y ); - float bottom = min( m_extent.hi.y, other->m_extent.hi.y ); + float top = MAX( m_extent.lo.y, other->m_extent.lo.y ); + float bottom = MIN( m_extent.hi.y, other->m_extent.hi.y ); nw.x = other->m_extent.hi.x; nw.y = top; @@ -944,8 +944,8 @@ bool CNavArea::SpliceEdit( CNavArea *other ) else if (m_extent.hi.x < other->m_extent.lo.x) { // 'this' is west of 'other' - float top = max( m_extent.lo.y, other->m_extent.lo.y ); - float bottom = min( m_extent.hi.y, other->m_extent.hi.y ); + float top = MAX( m_extent.lo.y, other->m_extent.lo.y ); + float bottom = MIN( m_extent.hi.y, other->m_extent.hi.y ); nw.x = m_extent.hi.x; nw.y = top; @@ -976,8 +976,8 @@ bool CNavArea::SpliceEdit( CNavArea *other ) if (m_extent.lo.y > other->m_extent.hi.y) { // 'this' is south of 'other' - float left = max( m_extent.lo.x, other->m_extent.lo.x ); - float right = min( m_extent.hi.x, other->m_extent.hi.x ); + float left = MAX( m_extent.lo.x, other->m_extent.lo.x ); + float right = MIN( m_extent.hi.x, other->m_extent.hi.x ); nw.x = left; nw.y = other->m_extent.hi.y; @@ -1006,8 +1006,8 @@ bool CNavArea::SpliceEdit( CNavArea *other ) else if (m_extent.hi.y < other->m_extent.lo.y) { // 'this' is north of 'other' - float left = max( m_extent.lo.x, other->m_extent.lo.x ); - float right = min( m_extent.hi.x, other->m_extent.hi.x ); + float left = MAX( m_extent.lo.x, other->m_extent.lo.x ); + float right = MIN( m_extent.hi.x, other->m_extent.hi.x ); nw.x = left; nw.y = m_extent.hi.y; @@ -1560,8 +1560,8 @@ void CNavArea::ComputePortal( const CNavArea *to, NavDirType dir, Vector *center else center->y = m_extent.hi.y; - float left = max( m_extent.lo.x, to->m_extent.lo.x ); - float right = min( m_extent.hi.x, to->m_extent.hi.x ); + float left = MAX( m_extent.lo.x, to->m_extent.lo.x ); + float right = MIN( m_extent.hi.x, to->m_extent.hi.x ); // clamp to our extent in case areas are disjoint if (left < m_extent.lo.x) @@ -1584,8 +1584,8 @@ void CNavArea::ComputePortal( const CNavArea *to, NavDirType dir, Vector *center else center->x = m_extent.hi.x; - float top = max( m_extent.lo.y, to->m_extent.lo.y ); - float bottom = min( m_extent.hi.y, to->m_extent.hi.y ); + float top = MAX( m_extent.lo.y, to->m_extent.lo.y ); + float bottom = MIN( m_extent.hi.y, to->m_extent.hi.y ); // clamp to our extent in case areas are disjoint if (top < m_extent.lo.y) @@ -1618,8 +1618,8 @@ void CNavArea::ComputeClosestPointInPortal( const CNavArea *to, NavDirType dir, else closePos->y = m_extent.hi.y; - float left = max( m_extent.lo.x, to->m_extent.lo.x ); - float right = min( m_extent.hi.x, to->m_extent.hi.x ); + float left = MAX( m_extent.lo.x, to->m_extent.lo.x ); + float right = MIN( m_extent.hi.x, to->m_extent.hi.x ); // clamp to our extent in case areas are disjoint if (left < m_extent.lo.x) @@ -1652,8 +1652,8 @@ void CNavArea::ComputeClosestPointInPortal( const CNavArea *to, NavDirType dir, else closePos->x = m_extent.hi.x; - float top = max( m_extent.lo.y, to->m_extent.lo.y ); - float bottom = min( m_extent.hi.y, to->m_extent.hi.y ); + float top = MAX( m_extent.lo.y, to->m_extent.lo.y ); + float bottom = MIN( m_extent.hi.y, to->m_extent.hi.y ); // clamp to our extent in case areas are disjoint if (top < m_extent.lo.y) @@ -1748,8 +1748,8 @@ bool CNavArea::GetCornerHotspot( NavCornerType corner, Vector hotspot[NUM_CORNER Vector se = GetCorner( SOUTH_EAST ); float size = 9.0f; - size = min( size, GetSizeX()/3 ); // make sure the hotspot doesn't extend outside small areas - size = min( size, GetSizeY()/3 ); + size = MIN( size, GetSizeX()/3 ); // make sure the hotspot doesn't extend outside small areas + size = MIN( size, GetSizeY()/3 ); switch ( corner ) { @@ -3391,8 +3391,8 @@ void CNavArea::UpdateBlocked( void ) Vector origin = GetCenter(); origin.z += HalfHumanHeight; - const float sizeX = max( 1, min( GetSizeX()/2 - 5, HalfHumanWidth ) ); - const float sizeY = max( 1, min( GetSizeY()/2 - 5, HalfHumanWidth ) ); + const float sizeX = MAX( 1, MIN( GetSizeX()/2 - 5, HalfHumanWidth ) ); + const float sizeY = MAX( 1, MIN( GetSizeY()/2 - 5, HalfHumanWidth ) ); Vector mins( -sizeX, -sizeY, 0 ); Vector maxs( sizeX, sizeY, VEC_DUCK_HULL_MAX.z ); diff --git a/dlls/nav_colors.cpp b/dlls/nav_colors.cpp index f189a955..5d101db3 100644 --- a/dlls/nav_colors.cpp +++ b/dlls/nav_colors.cpp @@ -113,7 +113,7 @@ void NavDrawDashedLine( const Vector& from, const Vector& to, NavEditColor navCo { Vector start = from + unit * distance; float endDistance = distance + solidLen; - endDistance = min( endDistance, totalDistance ); + endDistance = MIN( endDistance, totalDistance ); Vector end = from + unit * endDistance; distance += solidLen + gapLen; diff --git a/dlls/nav_edit.cpp b/dlls/nav_edit.cpp index 90295b12..5357bbb9 100644 --- a/dlls/nav_edit.cpp +++ b/dlls/nav_edit.cpp @@ -245,11 +245,11 @@ bool CNavMesh::GetActiveNavArea( void ) right *= ladder->m_width * 0.5f; left = -right; - absMin.x += min( left.x, right.x ); - absMin.y += min( left.y, right.y ); + absMin.x += MIN( left.x, right.x ); + absMin.y += MIN( left.y, right.y ); - absMax.x += max( left.x, right.x ); - absMax.y += max( left.y, right.y ); + absMax.x += MAX( left.x, right.x ); + absMax.y += MAX( left.y, right.y ); Extent e; e.lo = absMin + Vector( -5, -5, -5 ); @@ -1354,13 +1354,13 @@ void CNavMesh::CommandNavEndArea( void ) // the two points defining the ladder are m_ladderAnchor and m_editCursorPos. The normal is m_ladderNormal. Vector mins, maxs; - mins.x = min( m_ladderAnchor.x, m_editCursorPos.x ); - mins.y = min( m_ladderAnchor.y, m_editCursorPos.y ); - mins.z = min( m_ladderAnchor.z, m_editCursorPos.z ); + mins.x = MIN( m_ladderAnchor.x, m_editCursorPos.x ); + mins.y = MIN( m_ladderAnchor.y, m_editCursorPos.y ); + mins.z = MIN( m_ladderAnchor.z, m_editCursorPos.z ); - maxs.x = max( m_ladderAnchor.x, m_editCursorPos.x ); - maxs.y = max( m_ladderAnchor.y, m_editCursorPos.y ); - maxs.z = max( m_ladderAnchor.z, m_editCursorPos.z ); + maxs.x = MAX( m_ladderAnchor.x, m_editCursorPos.x ); + maxs.y = MAX( m_ladderAnchor.y, m_editCursorPos.y ); + maxs.z = MAX( m_ladderAnchor.z, m_editCursorPos.z ); Vector2D ladderDir = m_ladderNormal.AsVector2D(); CreateLadder( mins, maxs, &ladderDir ); diff --git a/dlls/nav_generate.cpp b/dlls/nav_generate.cpp index 3ec7dff4..9c222293 100644 --- a/dlls/nav_generate.cpp +++ b/dlls/nav_generate.cpp @@ -481,7 +481,7 @@ void CNavLadder::ConnectGeneratedLadder( void ) center = m_top + Vector( 0, 0, GenerationStepSize ); AddDirectionVector( ¢er, m_dir, HalfHumanWidth ); - float beneathLimit = min( 120.0f, m_top.z - m_bottom.z + HalfHumanWidth ); + float beneathLimit = MIN( 120.0f, m_top.z - m_bottom.z + HalfHumanWidth ); // find "ahead" area m_topForwardArea = findFirstAreaInDirection( ¢er, OppositeDirection( m_dir ), nearLadderRange, beneathLimit, NULL ); diff --git a/dlls/nav_node.cpp b/dlls/nav_node.cpp index f761bef2..4ee7da5f 100644 --- a/dlls/nav_node.cpp +++ b/dlls/nav_node.cpp @@ -227,7 +227,7 @@ void CNavNode::CheckCrouch( void ) float floorZ; if ( TheNavMesh->GetGroundHeight( m_pos, &floorZ ) ) { - maxFloorZ = max( maxFloorZ, floorZ + 0.1f ); + maxFloorZ = MAX( maxFloorZ, floorZ + 0.1f ); } } } diff --git a/dlls/npc_talker.h b/dlls/npc_talker.h index f1fb8524..ed03bcc6 100644 --- a/dlls/npc_talker.h +++ b/dlls/npc_talker.h @@ -25,12 +25,6 @@ #pragma once #endif -#ifdef _LINUX -// the include monkey's with the max() define, unbreak it -#undef MINMAX_H -#include "minmax.h" -#endif - #include "ai_playerally.h" #include "soundflags.h" diff --git a/dlls/npc_vehicledriver.cpp b/dlls/npc_vehicledriver.cpp index a6774cf0..0eb13d89 100644 --- a/dlls/npc_vehicledriver.cpp +++ b/dlls/npc_vehicledriver.cpp @@ -688,7 +688,7 @@ bool CNPC_VehicleDriver::WaypointReached( void ) m_pNextWaypoint = m_Waypoints[1]; // Drop the spline marker back - m_flDistanceAlongSpline = max( 0, m_flDistanceAlongSpline - 1.0 ); + m_flDistanceAlongSpline = MAX( 0, m_flDistanceAlongSpline - 1.0 ); CheckForTeleport(); diff --git a/dlls/physics.cpp b/dlls/physics.cpp index ab293383..16feb4d7 100644 --- a/dlls/physics.cpp +++ b/dlls/physics.cpp @@ -1152,7 +1152,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" ) lastTime = elapsed; } - totalTime = max( totalTime, 0.001 ); + totalTime = MAX( totalTime, 0.001 ); for ( i = 0; i < ents.Count(); i++ ) { float fraction = times[i] / totalTime; @@ -1333,10 +1333,10 @@ void CCollisionEvent::PreCollision( vcollisionevent_t *pEvent ) // so make it fairly small and have a tiny collision instead. pObject->GetVelocity( &velocity, &angVel ); float len = VectorNormalize(velocity); - len = max( len, 10 ); + len = MAX( len, 10 ); velocity *= len; len = VectorNormalize(angVel); - len = max( len, 1 ); + len = MAX( len, 1 ); angVel *= len; pObject->SetVelocity( &velocity, &angVel ); } diff --git a/dlls/physics_main.cpp b/dlls/physics_main.cpp index 0f60d2ea..4849ac61 100644 --- a/dlls/physics_main.cpp +++ b/dlls/physics_main.cpp @@ -2143,7 +2143,7 @@ void Physics_RunThinkFunctions( bool simulating ) { UTIL_DisableRemoveImmediate(); int listMax = SimThink_ListCount(); - listMax = max(listMax,1); + listMax = MAX(listMax,1); CBaseEntity **list = (CBaseEntity **)stackalloc( sizeof(CBaseEntity *) * listMax ); // iterate through all entities and have them think or simulate diff --git a/dlls/player.cpp b/dlls/player.cpp index eaa9547c..89dc423c 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1428,7 +1428,7 @@ int CBasePlayer::OnTakeDamage_Alive( const CTakeDamageInfo &info ) if ( event ) { event->SetInt("userid", GetUserID() ); - event->SetInt("health", max(0, m_iHealth) ); + event->SetInt("health", MAX(0, m_iHealth) ); event->SetInt("priority", 5 ); // HLTV event priority, not transmitted if ( attacker->IsPlayer() ) @@ -3518,7 +3518,7 @@ void CBasePlayer::CheckTimeBasedDamage() // after the player has been drowning and finally takes a breath if (m_idrowndmg > m_idrownrestored) { - int idif = min(m_idrowndmg - m_idrownrestored, 10); + int idif = MIN(m_idrowndmg - m_idrownrestored, 10); TakeHealth(idif, DMG_GENERIC); m_idrownrestored += idif; @@ -3532,7 +3532,7 @@ void CBasePlayer::CheckTimeBasedDamage() // after the player has been poisoned. if (m_nPoisonDmg > m_nPoisonRestored) { - int nDif = min(m_nPoisonDmg - m_nPoisonRestored, 10); + int nDif = MIN(m_nPoisonDmg - m_nPoisonRestored, 10); TakeHealth(nDif, DMG_GENERIC); m_nPoisonRestored += nDif; } diff --git a/dlls/player_pickup.cpp b/dlls/player_pickup.cpp index 28fcb7d0..e94dc22f 100644 --- a/dlls/player_pickup.cpp +++ b/dlls/player_pickup.cpp @@ -114,7 +114,7 @@ Vector Pickup_DefaultPhysGunLaunchVelocity( const Vector &vecForward, float flMa float mass = flMass; if ( mass > 100 ) { - mass = min( mass, 1000 ); + mass = MIN( mass, 1000 ); float flForceMin = physcannon_minforce.GetFloat(); flForce = SimpleSplineRemapVal( mass, 100, 600, flForceMax, flForceMin ); } diff --git a/dlls/player_resource.cpp b/dlls/player_resource.cpp index 8aa25b42..e7023c9b 100644 --- a/dlls/player_resource.cpp +++ b/dlls/player_resource.cpp @@ -104,7 +104,7 @@ void CPlayerResource::UpdatePlayerData( void ) m_bConnected.Set( i, 1 ); m_iTeam.Set( i, pPlayer->GetTeamNumber() ); m_bAlive.Set( i, pPlayer->IsAlive()?1:0 ); - m_iHealth.Set(i, max( 0, pPlayer->GetHealth() ) ); + m_iHealth.Set(i, MAX( 0, pPlayer->GetHealth() ) ); // Don't update ping / packetloss everytime diff --git a/dlls/props.cpp b/dlls/props.cpp index c557e5d0..0b4fda1a 100644 --- a/dlls/props.cpp +++ b/dlls/props.cpp @@ -1060,7 +1060,7 @@ int CBreakableProp::OnTakeDamage( const CTakeDamageInfo &inputInfo ) float flFactor; flFactor = flDist / MAX_BLAST_DIST; const float MAX_BURN_TIME = 5.0f; - flBurnTime = max( 0.5, MAX_BURN_TIME * flFactor ); + flBurnTime = MAX( 0.5, MAX_BURN_TIME * flFactor ); flBurnTime += random->RandomFloat( 0, 0.5 ); } else @@ -1070,7 +1070,7 @@ int CBreakableProp::OnTakeDamage( const CTakeDamageInfo &inputInfo ) } // Change my health so that I burn for flBurnTime seconds. - float flIdealHealth = min( m_iHealth, FLAME_DIRECT_DAMAGE_PER_SEC * flBurnTime ); + float flIdealHealth = MIN( m_iHealth, FLAME_DIRECT_DAMAGE_PER_SEC * flBurnTime ); float flIdealDamage = m_iHealth - flIdealHealth; // Scale the damage to do ideal damage. @@ -3093,7 +3093,7 @@ CBaseEntity *BreakModelCreateSingle( CBaseEntity *pOwner, breakmodel_t *pModel, pEntity->m_iHealth = pModel->health; if ( g_ActiveGibCount >= ACTIVE_GIB_FADE ) { - pModel->fadeTime = min( 3, pModel->fadeTime ); + pModel->fadeTime = MIN( 3, pModel->fadeTime ); } if ( pModel->fadeTime ) { @@ -4540,14 +4540,14 @@ CPropDoorRotating::~CPropDoorRotating( void ) void UTIL_ComputeAABBForBounds( const Vector &mins1, const Vector &maxs1, const Vector &mins2, const Vector &maxs2, Vector *destMins, Vector *destMaxs ) { // Find the minimum extents - (*destMins)[0] = min( mins1[0], mins2[0] ); - (*destMins)[1] = min( mins1[1], mins2[1] ); - (*destMins)[2] = min( mins1[2], mins2[2] ); + (*destMins)[0] = MIN( mins1[0], mins2[0] ); + (*destMins)[1] = MIN( mins1[1], mins2[1] ); + (*destMins)[2] = MIN( mins1[2], mins2[2] ); // Find the maximum extents - (*destMaxs)[0] = max( maxs1[0], maxs2[0] ); - (*destMaxs)[1] = max( maxs1[1], maxs2[1] ); - (*destMaxs)[2] = max( maxs1[2], maxs2[2] ); + (*destMaxs)[0] = MAX( maxs1[0], maxs2[0] ); + (*destMaxs)[1] = MAX( maxs1[1], maxs2[1] ); + (*destMaxs)[2] = MAX( maxs1[2], maxs2[2] ); } //----------------------------------------------------------------------------- @@ -4992,8 +4992,8 @@ void CPropDoorRotating::BeginOpening(CBaseEntity *pOpenAwayFrom) Vector volumeCenter = ((mins+maxs) * 0.5f) + GetAbsOrigin(); // Ignoring the Z - float volumeRadius = max( fabs(mins.x), maxs.x ); - volumeRadius = max( volumeRadius, max( fabs(mins.y), maxs.y ) ); + float volumeRadius = MAX( fabs(mins.x), maxs.x ); + volumeRadius = MAX( volumeRadius, MAX( fabs(mins.y), maxs.y ) ); // Debug if ( g_debug_doors.GetBool() ) diff --git a/dlls/sceneentity.cpp b/dlls/sceneentity.cpp index 64fba186..2b01f354 100644 --- a/dlls/sceneentity.cpp +++ b/dlls/sceneentity.cpp @@ -1662,7 +1662,7 @@ void CSceneEntity::DispatchStartSpeak( CChoreoScene *scene, CBaseFlex *actor, CC float durationShort = event->GetDuration(); float durationLong = endtime - event->GetStartTime(); - float duration = max( durationShort, durationLong ); + float duration = MAX( durationShort, durationLong ); byte byteflags = CLOSE_CAPTION_WARNIFMISSING; // warnifmissing @@ -1692,7 +1692,7 @@ void CSceneEntity::DispatchStartSpeak( CChoreoScene *scene, CBaseFlex *actor, CC #else WRITE_STRING( lowercase ); #endif - WRITE_SHORT( min( 255, (int)( duration * 10.0f ) ) ); + WRITE_SHORT( MIN( 255, (int)( duration * 10.0f ) ) ); WRITE_BYTE( byteflags ); // warn on missing MessageEnd(); } @@ -4453,7 +4453,7 @@ void CSceneManager::Think() // The manager is always thinking at 20 hz SetNextThink( gpGlobals->curtime + SCENE_THINK_INTERVAL ); float frameTime = ( gpGlobals->curtime - GetLastThink() ); - frameTime = min( 0.1, frameTime ); + frameTime = MIN( 0.1, frameTime ); // stop if AI is diabled if (CAI_BaseNPC::m_nDebugBits & bits_debugDisableAI) diff --git a/dlls/soundscape_system.cpp b/dlls/soundscape_system.cpp index 7985bc55..df28497d 100644 --- a/dlls/soundscape_system.cpp +++ b/dlls/soundscape_system.cpp @@ -203,7 +203,7 @@ void CSoundscapeSystem::FrameUpdatePostEntityThink() } // update 2 soundscape entities each tick - int count = min(2, total); + int count = MIN(2, total); for ( int i = 0; i < count; i++ ) { m_activeIndex++; diff --git a/dlls/te_bubbletrail.cpp b/dlls/te_bubbletrail.cpp index 3a535a1a..fae51c7c 100644 --- a/dlls/te_bubbletrail.cpp +++ b/dlls/te_bubbletrail.cpp @@ -132,7 +132,7 @@ void TE_BubbleTrail( IRecipientFilter& filter, float delay, g_TEBubbleTrail.m_vecMaxs = *maxs; g_TEBubbleTrail.m_flWaterZ = flWaterZ; g_TEBubbleTrail.m_nModelIndex = modelindex; - g_TEBubbleTrail.m_nCount = min( count, BUBBLE_TRAIL_MAX_COUNT ); + g_TEBubbleTrail.m_nCount = MIN( count, BUBBLE_TRAIL_MAX_COUNT ); g_TEBubbleTrail.m_fSpeed = speed; // Send it over the wire diff --git a/dlls/terrainmodmgr.cpp b/dlls/terrainmodmgr.cpp index 222336c1..c6cdb28f 100644 --- a/dlls/terrainmodmgr.cpp +++ b/dlls/terrainmodmgr.cpp @@ -25,7 +25,7 @@ void TerrainMod_Add( TerrainModType type, const CTerrainModParams ¶ms ) float playerStartHeights[MAX_PLAYERS]; int i; - int nPlayers = min( MAX_PLAYERS, gpGlobals->maxClients ); + int nPlayers = MIN( MAX_PLAYERS, gpGlobals->maxClients ); for( i=0; i < nPlayers; i++ ) { CBasePlayer *pPlayer = UTIL_PlayerByIndex( i+1 ); diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 69d46dad..104ad398 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1185,7 +1185,7 @@ int CTriggerLook::DrawDebugTextOverlays(void) // Print Look time // ---------------- char tempstr[255]; - Q_snprintf(tempstr,sizeof(tempstr),"Time: %3.2f",m_flLookTime - max(0,m_flLookTimeTotal)); + Q_snprintf(tempstr,sizeof(tempstr),"Time: %3.2f",m_flLookTime - MAX(0,m_flLookTimeTotal)); EntityText(text_offset,tempstr,0); text_offset++; } diff --git a/dlls/util.cpp b/dlls/util.cpp index 3883953b..f4d5cb58 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -680,7 +680,7 @@ void UTIL_GetPlayerConnectionInfo( int playerIndex, int& ping, int &packetloss ) // then updaterate, what is the case for default settings const char * szCmdRate = engine->GetClientConVarValue( playerIndex, "cl_cmdrate" ); - int nCmdRate = max( 1, Q_atoi( szCmdRate ) ); + int nCmdRate = MAX( 1, Q_atoi( szCmdRate ) ); latency -= (0.5f/nCmdRate) + TICKS_TO_TIME( 1.0f ); // correct latency // in GoldSrc we had a different, not fixed tickrate. so we have to adjust @@ -1327,7 +1327,7 @@ void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, color = 0; CPVSFilter filter( origin ); - te->BloodStream( filter, 0.0, &origin, &direction, 247, 63, 14, 255, min( amount, 255 ) ); + te->BloodStream( filter, 0.0, &origin, &direction, 247, 63, 14, 255, MIN( amount, 255 ) ); } diff --git a/game_shared/SoundEmitterSystem.cpp b/game_shared/SoundEmitterSystem.cpp index 9b301bfa..9f1d4c69 100644 --- a/game_shared/SoundEmitterSystem.cpp +++ b/game_shared/SoundEmitterSystem.cpp @@ -733,7 +733,7 @@ public: #else WRITE_STRING( lowercase ); #endif - WRITE_SHORT( min( 255, (int)( duration * 10.0f ) ) ), + WRITE_SHORT( MIN( 255, (int)( duration * 10.0f ) ) ), WRITE_BYTE( byteflags ), MessageEnd(); #else diff --git a/game_shared/Sprite.cpp b/game_shared/Sprite.cpp index 38cb6d4f..cb934003 100644 --- a/game_shared/Sprite.cpp +++ b/game_shared/Sprite.cpp @@ -246,7 +246,7 @@ void CSprite::ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pV // Find the height and width of the source of the sprite float width = modelinfo->GetModelSpriteWidth( GetModel() ); float height = modelinfo->GetModelSpriteHeight( GetModel() ); - flScale *= max( width, height ); + flScale *= MAX( width, height ); } pVecWorldMins->Init( -flScale, -flScale, -flScale ); @@ -642,7 +642,7 @@ void CSprite::GetRenderBounds( Vector &vecMins, Vector &vecMaxs ) if ( m_bWorldSpaceScale == false ) { CEngineSprite *psprite = (CEngineSprite *) modelinfo->GetModelExtraData( GetModel() ); - float flSize = max( psprite->GetWidth(), psprite->GetHeight() ); + float flSize = MAX( psprite->GetWidth(), psprite->GetHeight() ); flScale *= flSize; } @@ -749,7 +749,7 @@ int CSprite::DrawModel( int flags ) 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; } diff --git a/game_shared/base_playeranimstate.cpp b/game_shared/base_playeranimstate.cpp index e3a54683..1ff9a5f2 100644 --- a/game_shared/base_playeranimstate.cpp +++ b/game_shared/base_playeranimstate.cpp @@ -391,7 +391,7 @@ void CBasePlayerAnimState::OptimizeLayerWeights( int iFirstLayer, int nLayers ) if ( pLayer->IsActive() && pLayer->m_flWeight > 0.0f ) { pLayer->m_flWeight = 1.0f - totalWeight; - pLayer->m_flWeight = max(pLayer->m_flWeight, 0.0f); + pLayer->m_flWeight = MAX(pLayer->m_flWeight, 0.0f); } // This part is just an optimization. Since we have the walk/run animations weighted on top of diff --git a/game_shared/basecombatcharacter_shared.cpp b/game_shared/basecombatcharacter_shared.cpp index cc144ec0..feba0c7a 100644 --- a/game_shared/basecombatcharacter_shared.cpp +++ b/game_shared/basecombatcharacter_shared.cpp @@ -128,7 +128,7 @@ void CBaseCombatCharacter::RemoveAmmo( int iCount, int iAmmoIndex ) return; // Ammo pickup sound - m_iAmmo.Set( iAmmoIndex, max( m_iAmmo[iAmmoIndex] - iCount, 0 ) ); + m_iAmmo.Set( iAmmoIndex, MAX( m_iAmmo[iAmmoIndex] - iCount, 0 ) ); } void CBaseCombatCharacter::RemoveAmmo( int iCount, const char *szName ) diff --git a/game_shared/basecombatweapon_shared.cpp b/game_shared/basecombatweapon_shared.cpp index 10e24e9e..46819105 100644 --- a/game_shared/basecombatweapon_shared.cpp +++ b/game_shared/basecombatweapon_shared.cpp @@ -870,7 +870,7 @@ void CBaseCombatWeapon::SetActivity( Activity act, float duration ) { // FIXME: does this even make sense in non-shoot animations? m_flPlaybackRate = SequenceDuration( sequence ) / duration; - m_flPlaybackRate = min( m_flPlaybackRate, 12.0); // FIXME; magic number!, network encoding range + m_flPlaybackRate = MIN( m_flPlaybackRate, 12.0); // FIXME; magic number!, network encoding range } else { @@ -1682,7 +1682,7 @@ bool CBaseCombatWeapon::DefaultReload( int iClipSize1, int iClipSize2, int iActi if ( UsesClipsForAmmo1() ) { // need to reload primary clip? - int primary = min(iClipSize1 - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int primary = MIN(iClipSize1 - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if ( primary != 0 ) { bReload = true; @@ -1692,7 +1692,7 @@ bool CBaseCombatWeapon::DefaultReload( int iClipSize1, int iClipSize2, int iActi if ( UsesClipsForAmmo2() ) { // need to reload secondary clip? - int secondary = min(iClipSize2 - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType)); + int secondary = MIN(iClipSize2 - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType)); if ( secondary != 0 ) { bReload = true; @@ -1844,7 +1844,7 @@ void CBaseCombatWeapon::FinishReload( void ) // If I use primary clips, reload primary if ( UsesClipsForAmmo1() ) { - int primary = min( GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int primary = MIN( GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); m_iClip1 += primary; pOwner->RemoveAmmo( primary, m_iPrimaryAmmoType); } @@ -1852,7 +1852,7 @@ void CBaseCombatWeapon::FinishReload( void ) // If I use secondary clips, reload secondary if ( UsesClipsForAmmo2() ) { - int secondary = min( GetMaxClip2() - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType)); + int secondary = MIN( GetMaxClip2() - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType)); m_iClip2 += secondary; pOwner->RemoveAmmo( secondary, m_iSecondaryAmmoType ); } @@ -1926,12 +1926,12 @@ void CBaseCombatWeapon::PrimaryAttack( void ) // Make sure we don't fire more than the amount in the clip if ( UsesClipsForAmmo1() ) { - info.m_iShots = min( info.m_iShots, m_iClip1 ); + info.m_iShots = MIN( info.m_iShots, m_iClip1 ); m_iClip1 -= info.m_iShots; } else { - info.m_iShots = min( info.m_iShots, pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) ); + info.m_iShots = MIN( info.m_iShots, pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) ); pPlayer->RemoveAmmo( info.m_iShots, m_iPrimaryAmmoType ); } diff --git a/game_shared/baseplayer_shared.cpp b/game_shared/baseplayer_shared.cpp index 62512485..f6fa8759 100644 --- a/game_shared/baseplayer_shared.cpp +++ b/game_shared/baseplayer_shared.cpp @@ -1086,10 +1086,10 @@ void CBasePlayer::PlayerUse ( void ) vPushAway.z = 0; float flDist = VectorNormalize( vPushAway ); - flDist = max( flDist, 1 ); + flDist = MAX( flDist, 1 ); float flForce = sv_pushaway_force.GetFloat() / flDist; - flForce = min( flForce, sv_pushaway_max_force.GetFloat() ); + flForce = MIN( flForce, sv_pushaway_max_force.GetFloat() ); pObj->ApplyForceOffset( vPushAway * flForce, WorldSpaceCenter() ); } diff --git a/game_shared/beam_shared.h b/game_shared/beam_shared.h index 7d613788..7aeec244 100644 --- a/game_shared/beam_shared.h +++ b/game_shared/beam_shared.h @@ -297,13 +297,13 @@ inline void CBeam::SetHaloScale( int haloScale ) inline void CBeam::SetWidth( float width ) { Assert( width <= MAX_BEAM_WIDTH ); - m_fWidth = min( MAX_BEAM_WIDTH, width ); + m_fWidth = MIN( MAX_BEAM_WIDTH, width ); } inline void CBeam::SetEndWidth( float endWidth ) { Assert( endWidth <= MAX_BEAM_WIDTH ); - m_fEndWidth = min( MAX_BEAM_WIDTH, endWidth ); + m_fEndWidth = MIN( MAX_BEAM_WIDTH, endWidth ); } inline void CBeam::SetFadeLength( float fadeLength ) diff --git a/game_shared/choreoevent.cpp b/game_shared/choreoevent.cpp index 10a008d8..7f0c502d 100644 --- a/game_shared/choreoevent.cpp +++ b/game_shared/choreoevent.cpp @@ -12,7 +12,6 @@ #include "choreoevent.h" #include "choreoactor.h" #include "choreochannel.h" -#include "minmax.h" #include "mathlib.h" #include "vstdlib/strtools.h" #include "choreoscene.h" @@ -748,7 +747,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 +755,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 +784,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 +1589,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 +1597,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 +1620,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 +2937,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 +3063,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 +3217,7 @@ void CChoreoEvent::SetLoopCount( int numloops ) { Assert( GetType() == LOOP ); // Never below -1 - m_nNumLoops = max( numloops, -1 ); + m_nNumLoops = MAX( numloops, -1 ); } //----------------------------------------------------------------------------- @@ -3433,14 +3432,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; diff --git a/game_shared/collisionproperty.cpp b/game_shared/collisionproperty.cpp index 9b76019b..55be5364 100644 --- a/game_shared/collisionproperty.cpp +++ b/game_shared/collisionproperty.cpp @@ -887,15 +887,15 @@ void CCollisionProperty::ComputeRotationExpandedBounds( Vector *pVecWorldMins, V else { float flMaxVal; - flMaxVal = max( FloatMakePositive(m_vecMins.Get().x), FloatMakePositive(m_vecMaxs.Get().x) ); + flMaxVal = MAX( FloatMakePositive(m_vecMins.Get().x), FloatMakePositive(m_vecMaxs.Get().x) ); pVecWorldMins->x = -flMaxVal; pVecWorldMaxs->x = flMaxVal; - flMaxVal = max( FloatMakePositive(m_vecMins.Get().y), FloatMakePositive(m_vecMaxs.Get().y) ); + flMaxVal = MAX( FloatMakePositive(m_vecMins.Get().y), FloatMakePositive(m_vecMaxs.Get().y) ); pVecWorldMins->y = -flMaxVal; pVecWorldMaxs->y = flMaxVal; - flMaxVal = max( FloatMakePositive(m_vecMins.Get().z), FloatMakePositive(m_vecMaxs.Get().z) ); + flMaxVal = MAX( FloatMakePositive(m_vecMins.Get().z), FloatMakePositive(m_vecMaxs.Get().z) ); pVecWorldMins->z = -flMaxVal; pVecWorldMaxs->z = flMaxVal; } diff --git a/game_shared/gamemovement.cpp b/game_shared/gamemovement.cpp index 3b9dc87c..04273b52 100644 --- a/game_shared/gamemovement.cpp +++ b/game_shared/gamemovement.cpp @@ -542,7 +542,7 @@ void CGameMovement::CheckParameters( void ) maxspeed = mv->m_flClientMaxSpeed; if ( maxspeed != 0.0 ) { - mv->m_flMaxSpeed = min( maxspeed, mv->m_flMaxSpeed ); + mv->m_flMaxSpeed = MIN( maxspeed, mv->m_flMaxSpeed ); } // Slow down by the speed factor @@ -3134,7 +3134,7 @@ void TracePlayerBBoxForGround( const Vector& start, const Vector& end, const Vec // Check the -x, -y quadrant mins = minsSrc; - maxs.Init( min( 0, maxsSrc.x ), min( 0, maxsSrc.y ), maxsSrc.z ); + maxs.Init( MIN( 0, maxsSrc.x ), MIN( 0, maxsSrc.y ), maxsSrc.z ); ray.Init( start, end, mins, maxs ); UTIL_TraceRay( ray, fMask, player, collisionGroup, &pm ); if ( pm.m_pEnt && pm.plane.normal[2] >= 0.7) @@ -3145,7 +3145,7 @@ void TracePlayerBBoxForGround( const Vector& start, const Vector& end, const Vec } // Check the +x, +y quadrant - mins.Init( max( 0, minsSrc.x ), max( 0, minsSrc.y ), minsSrc.z ); + mins.Init( MAX( 0, minsSrc.x ), MAX( 0, minsSrc.y ), minsSrc.z ); maxs = maxsSrc; ray.Init( start, end, mins, maxs ); UTIL_TraceRay( ray, fMask, player, collisionGroup, &pm ); @@ -3157,8 +3157,8 @@ void TracePlayerBBoxForGround( const Vector& start, const Vector& end, const Vec } // Check the -x, +y quadrant - mins.Init( minsSrc.x, max( 0, minsSrc.y ), minsSrc.z ); - maxs.Init( min( 0, maxsSrc.x ), maxsSrc.y, maxsSrc.z ); + mins.Init( minsSrc.x, MAX( 0, minsSrc.y ), minsSrc.z ); + maxs.Init( MIN( 0, maxsSrc.x ), maxsSrc.y, maxsSrc.z ); ray.Init( start, end, mins, maxs ); UTIL_TraceRay( ray, fMask, player, collisionGroup, &pm ); if ( pm.m_pEnt && pm.plane.normal[2] >= 0.7) @@ -3169,8 +3169,8 @@ void TracePlayerBBoxForGround( const Vector& start, const Vector& end, const Vec } // Check the +x, -y quadrant - mins.Init( max( 0, minsSrc.x ), minsSrc.y, minsSrc.z ); - maxs.Init( maxsSrc.x, min( 0, maxsSrc.y ), maxsSrc.z ); + mins.Init( MAX( 0, minsSrc.x ), minsSrc.y, minsSrc.z ); + maxs.Init( maxsSrc.x, MIN( 0, maxsSrc.y ), maxsSrc.z ); ray.Init( start, end, mins, maxs ); UTIL_TraceRay( ray, fMask, player, collisionGroup, &pm ); if ( pm.m_pEnt && pm.plane.normal[2] >= 0.7) @@ -3336,7 +3336,7 @@ void CGameMovement::CheckFalling( void ) { // Player landed on a descending object. Subtract the velocity of the ground entity. player->m_Local.m_flFallVelocity += player->GetGroundEntity()->GetAbsVelocity().z; - player->m_Local.m_flFallVelocity = max( 0.1f, player->m_Local.m_flFallVelocity ); + player->m_Local.m_flFallVelocity = MAX( 0.1f, player->m_Local.m_flFallVelocity ); } if ( player->m_Local.m_flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED ) @@ -3523,7 +3523,7 @@ void CGameMovement::UpdateDuckJumpEyeOffset( void ) { if ( player->m_Local.m_flDuckJumpTime != 0.0f ) { - float flDuckMilliseconds = max( 0.0f, GAMEMOVEMENT_DUCK_TIME - ( float )player->m_Local.m_flDuckJumpTime ); + float flDuckMilliseconds = MAX( 0.0f, GAMEMOVEMENT_DUCK_TIME - ( float )player->m_Local.m_flDuckJumpTime ); float flDuckSeconds = flDuckMilliseconds / GAMEMOVEMENT_DUCK_TIME; if ( flDuckSeconds > TIME_TO_UNDUCK ) { @@ -3757,7 +3757,7 @@ void CGameMovement::Duck( void ) // The player is in duck transition and not duck-jumping. if ( player->m_Local.m_bDucking && !bDuckJump && !bDuckJumpTime ) { - float flDuckMilliseconds = max( 0.0f, GAMEMOVEMENT_DUCK_TIME - ( float )player->m_Local.m_flDucktime ); + float flDuckMilliseconds = MAX( 0.0f, GAMEMOVEMENT_DUCK_TIME - ( float )player->m_Local.m_flDucktime ); float flDuckSeconds = flDuckMilliseconds * 0.001f; // Finish in duck transition when transition time is over, in "duck", in air. @@ -3855,7 +3855,7 @@ void CGameMovement::Duck( void ) // or unducking if ( ( player->m_Local.m_bDucking || player->m_Local.m_bDucked ) ) { - float flDuckMilliseconds = max( 0.0f, GAMEMOVEMENT_DUCK_TIME - (float)player->m_Local.m_flDucktime ); + float flDuckMilliseconds = MAX( 0.0f, GAMEMOVEMENT_DUCK_TIME - (float)player->m_Local.m_flDucktime ); float flDuckSeconds = flDuckMilliseconds * 0.001f; // Finish ducking immediately if duck time is over or not on ground diff --git a/game_shared/gamestats/ep1_gamestats.cpp b/game_shared/gamestats/ep1_gamestats.cpp index d3a94c77..5b295033 100644 --- a/game_shared/gamestats/ep1_gamestats.cpp +++ b/game_shared/gamestats/ep1_gamestats.cpp @@ -51,7 +51,7 @@ bool GameStatsRecord_t::ParseFromBuffer( CUtlBuffer &buf ) m_nSeconds = buf.GetInt(); // Note, don't put the buf.GetInt() in the macro since it'll get evaluated twice!!! - m_nSeconds = max( m_nSeconds, 0 ); + m_nSeconds = MAX( m_nSeconds, 0 ); m_nCommentary = buf.GetInt(); if ( m_nCommentary < 0 || m_nCommentary > 100000 ) diff --git a/game_shared/hl2/hl_gamemovement.cpp b/game_shared/hl2/hl_gamemovement.cpp index 0d2f2a50..3229d3da 100644 --- a/game_shared/hl2/hl_gamemovement.cpp +++ b/game_shared/hl2/hl_gamemovement.cpp @@ -726,7 +726,7 @@ void CHL2GameMovement::FullLadderMove() dist1sqr = ( topPosition - mv->m_vecAbsOrigin ).LengthSqr(); dist2sqr = ( bottomPosition - mv->m_vecAbsOrigin ).LengthSqr(); - float dist = min( dist1sqr, dist2sqr ); + float dist = MIN( dist1sqr, dist2sqr ); bool neardismountnode = ( dist < 16.0f * 16.0f ) ? true : false; float ladderUnitsPerTick = ( MAX_CLIMB_SPEED * gpGlobals->interval_per_tick ); bool neardismountnode2 = ( dist < ladderUnitsPerTick * ladderUnitsPerTick ) ? true : false; diff --git a/game_shared/hl2mp/weapon_physcannon.cpp b/game_shared/hl2mp/weapon_physcannon.cpp index fcf1ed02..f0b0ab03 100644 --- a/game_shared/hl2mp/weapon_physcannon.cpp +++ b/game_shared/hl2mp/weapon_physcannon.cpp @@ -1705,7 +1705,7 @@ void CWeaponPhysCannon::PuntVPhysics( CBaseEntity *pEntity, const Vector &vecFor { maxMass *= 2.5; // 625 for vehicles } - float mass = min(totalMass, maxMass); // max 250kg of additional force + float mass = MIN(totalMass, maxMass); // max 250kg of additional force // Put some spin on the object for ( i = 0; i < listCount; i++ ) @@ -1717,7 +1717,7 @@ void CWeaponPhysCannon::PuntVPhysics( CBaseEntity *pEntity, const Vector &vecFor if ( pList[i] == pEntity->VPhysicsGetObject() ) { ratio += hitObjectFactor; - ratio = min(ratio,1.0f); + ratio = MIN(ratio,1.0f); } else { @@ -1772,7 +1772,7 @@ void CWeaponPhysCannon::ApplyVelocityBasedForce( CBaseEntity *pEntity, const Vec float mass = pPhysicsObject->GetMass(); if (mass > 100) { - mass = min(mass, 1000); + mass = MIN(mass, 1000); float flForceMin = physcannon_minforce.GetFloat(); flForce = SimpleSplineRemapVal(mass, 100, 600, flForceMax, flForceMin); } diff --git a/game_shared/hl2mp/weapon_shotgun.cpp b/game_shared/hl2mp/weapon_shotgun.cpp index 26445d22..76281830 100644 --- a/game_shared/hl2mp/weapon_shotgun.cpp +++ b/game_shared/hl2mp/weapon_shotgun.cpp @@ -139,7 +139,7 @@ bool CWeaponShotgun::StartReload( void ) return false; - int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; @@ -180,7 +180,7 @@ bool CWeaponShotgun::Reload( void ) if (m_iClip1 >= GetMaxClip1()) return false; - int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); + int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; @@ -604,7 +604,7 @@ void CWeaponShotgun::ItemHolsterFrame( void ) return; // Just load the clip with no animations - int ammoFill = min( (GetMaxClip1() - m_iClip1), GetOwner()->GetAmmoCount( GetPrimaryAmmoType() ) ); + int ammoFill = MIN( (GetMaxClip1() - m_iClip1), GetOwner()->GetAmmoCount( GetPrimaryAmmoType() ) ); GetOwner()->RemoveAmmo( ammoFill, GetPrimaryAmmoType() ); m_iClip1 += ammoFill; diff --git a/game_shared/multiplay_gamerules.cpp b/game_shared/multiplay_gamerules.cpp index acc7fe86..70b6a492 100644 --- a/game_shared/multiplay_gamerules.cpp +++ b/game_shared/multiplay_gamerules.cpp @@ -849,7 +849,7 @@ bool CMultiplayRules::IsMultiplayer( void ) if ( tv_delaymapchange.GetBool() && HLTVDirector()->IsActive() ) { - flWaitTime = max ( flWaitTime, HLTVDirector()->GetDelay() ); + flWaitTime = MAX ( flWaitTime, HLTVDirector()->GetDelay() ); } m_flIntermissionEndTime = gpGlobals->curtime + flWaitTime; diff --git a/game_shared/obstacle_pushaway.cpp b/game_shared/obstacle_pushaway.cpp index 6fd489d5..6976940e 100644 --- a/game_shared/obstacle_pushaway.cpp +++ b/game_shared/obstacle_pushaway.cpp @@ -221,7 +221,7 @@ void AvoidPushawayProps( CBaseCombatCharacter *pPlayer, CUserCmd *pCmd ) } mass = clamp( mass, minMass, maxMass ); - mass = max( mass, 0 ); + mass = MAX( mass, 0 ); mass /= maxMass; // bring into a 0..1 range // Push away from the collision point. The closer our center is to the collision point, @@ -251,10 +251,10 @@ void AvoidPushawayProps( CBaseCombatCharacter *pPlayer, CUserCmd *pCmd ) flDist = VectorNormalize( vPushAway ); } - flDist = max( flDist, 1 ); + flDist = MAX( flDist, 1 ); float flForce = sv_pushaway_player_force.GetFloat() / flDist * mass; - flForce = min( flForce, sv_pushaway_max_player_force.GetFloat() ); + flForce = MIN( flForce, sv_pushaway_max_player_force.GetFloat() ); #ifndef CLIENT_DLL pPlayer->PushawayTouch( props[i] ); @@ -318,10 +318,10 @@ void PerformObstaclePushaway( CBaseCombatCharacter *pPushingEntity ) vPushAway.z = 0; float flDist = VectorNormalize( vPushAway ); - flDist = max( flDist, 1 ); + flDist = MAX( flDist, 1 ); float flForce = sv_pushaway_force.GetFloat() / flDist; - flForce = min( flForce, sv_pushaway_max_force.GetFloat() ); + flForce = MIN( flForce, sv_pushaway_max_force.GetFloat() ); pObj->ApplyForceOffset( vPushAway * flForce, pPushingEntity->WorldSpaceCenter() ); } diff --git a/game_shared/physics_saverestore.cpp b/game_shared/physics_saverestore.cpp index 1f0990b0..aebf4b5a 100644 --- a/game_shared/physics_saverestore.cpp +++ b/game_shared/physics_saverestore.cpp @@ -271,7 +271,7 @@ public: if ( pItem ) { - int nObjects = min( header.nObjects, pItem->header.nObjects ); + int nObjects = MIN( header.nObjects, pItem->header.nObjects ); if ( pItem->header.type == PIID_IPHYSICSOBJECT && nObjects == 1 ) { RestorePhysicsObjectAndModel( pRestore, header, pItem, nObjects ); diff --git a/game_shared/props_shared.cpp b/game_shared/props_shared.cpp index 68bf1fbe..58f299cc 100644 --- a/game_shared/props_shared.cpp +++ b/game_shared/props_shared.cpp @@ -478,7 +478,7 @@ const char *CPropData::GetRandomChunkModel( const char *pszBreakableSection, int else { // Don't pick anything over the specified size - iRandom = RandomInt( 0, min(iMaxSize, m_BreakableChunks[i].iszChunkModels.Count()-1) ); + iRandom = RandomInt( 0, MIN(iMaxSize, m_BreakableChunks[i].iszChunkModels.Count()-1) ); } return STRING(m_BreakableChunks[i].iszChunkModels[iRandom]); @@ -895,7 +895,7 @@ void PropBreakableCreateAll( int modelindex, IPhysicsObject *pPhysics, const bre { if ( iPrecomputedBreakableCount != -1 ) { - iPrecomputedBreakableCount = min( iMaxBreakCount, iPrecomputedBreakableCount ); + iPrecomputedBreakableCount = MIN( iMaxBreakCount, iPrecomputedBreakableCount ); } else { diff --git a/game_shared/ragdoll_shared.cpp b/game_shared/ragdoll_shared.cpp index 1791367b..5cc9c9ad 100644 --- a/game_shared/ragdoll_shared.cpp +++ b/game_shared/ragdoll_shared.cpp @@ -460,7 +460,7 @@ bool RagdollCreate( ragdoll_t &ragdoll, const ragdollparams_t ¶ms, IPhysicsE { totalMass += ragdoll.list[i].pObject->GetMass(); } - totalMass = max(totalMass,1); + totalMass = MAX(totalMass,1); // apply force to the model Vector nudgeForce = params.forceVector; diff --git a/game_shared/rope_helpers.cpp b/game_shared/rope_helpers.cpp index 14e60ee0..4b9968f4 100644 --- a/game_shared/rope_helpers.cpp +++ b/game_shared/rope_helpers.cpp @@ -113,7 +113,7 @@ void CalcRopeStartingConditions( rope.m_flRopeLength = (vEndPos - vStartPos).Length(); rope.m_flWantedHangDist = desiredHang; - rope.m_flStartZ = min( vStartPos.z, vEndPos.z ); // Calculate hang as the Z distance from the + rope.m_flStartZ = MIN( vStartPos.z, vEndPos.z ); // Calculate hang as the Z distance from the // lowest endpoint to the bottom of the rope. rope.SetNumNodes( nNodes ); diff --git a/game_shared/saverestore.h b/game_shared/saverestore.h index b0c017fa..e9f7b72b 100644 --- a/game_shared/saverestore.h +++ b/game_shared/saverestore.h @@ -289,7 +289,7 @@ private: else { Assert( nBytesAvailable % sizeof(T) == 0 ); - actual = min( desired, nBytesAvailable ); + actual = MIN( desired, nBytesAvailable ); } BufferReadBytes( (char *)pValue, actual ); diff --git a/game_shared/saverestore_bitstring.h b/game_shared/saverestore_bitstring.h index 9af71652..2128281d 100644 --- a/game_shared/saverestore_bitstring.h +++ b/game_shared/saverestore_bitstring.h @@ -45,7 +45,7 @@ public: pBitString->ClearAllBits(); } int numIntsInStream = CalcNumIntsForBits( numBits ); - int readSize = min( pBitString->GetNumInts(), numIntsInStream ); + int readSize = MIN( pBitString->GetNumInts(), numIntsInStream ); pRestore->ReadInt( pBitString->GetInts(), numIntsInStream ); numIntsInStream -= readSize; diff --git a/game_shared/sequence_Transitioner.cpp b/game_shared/sequence_Transitioner.cpp index 5b09d9f2..404c73d1 100644 --- a/game_shared/sequence_Transitioner.cpp +++ b/game_shared/sequence_Transitioner.cpp @@ -48,7 +48,7 @@ void CSequenceTransitioner::CheckForSequenceChange( else { mstudioseqdesc_t &prevseqdesc = hdr->pSeqdesc( currentblend->m_nSequence ); - currentblend->m_flLayerFadeOuttime = min( prevseqdesc.fadeouttime, seqdesc.fadeintime ); + currentblend->m_flLayerFadeOuttime = MIN( prevseqdesc.fadeouttime, seqdesc.fadeintime ); /* // clip blends to time remaining if ( !IsSequenceLooping(hdr, currentblend->m_nSequence) ) diff --git a/game_shared/soundenvelope.cpp b/game_shared/soundenvelope.cpp index 2c3728eb..87769def 100644 --- a/game_shared/soundenvelope.cpp +++ b/game_shared/soundenvelope.cpp @@ -75,7 +75,7 @@ void CSoundEnvelope::SetTarget( float target, float deltaTime ) if ( deltaValue && deltaTime > 0 ) { m_target = target; - m_rate = max( 0.1, fabs(deltaValue / deltaTime) ); + m_rate = MAX( 0.1, fabs(deltaValue / deltaTime) ); } else { diff --git a/game_shared/takedamageinfo.cpp b/game_shared/takedamageinfo.cpp index d4116669..ca794a6a 100644 --- a/game_shared/takedamageinfo.cpp +++ b/game_shared/takedamageinfo.cpp @@ -214,7 +214,7 @@ void AddMultiDamage( const CTakeDamageInfo &info, CBaseEntity *pEntity ) g_MultiDamage.SetDamageForce( g_MultiDamage.GetDamageForce() + info.GetDamageForce() ); g_MultiDamage.SetDamagePosition( info.GetDamagePosition() ); g_MultiDamage.SetReportedPosition( info.GetReportedPosition() ); - g_MultiDamage.SetMaxDamage( max( g_MultiDamage.GetMaxDamage(), info.GetDamage() ) ); + g_MultiDamage.SetMaxDamage( MAX( g_MultiDamage.GetMaxDamage(), info.GetDamage() ) ); g_MultiDamage.SetAmmoType( info.GetAmmoType() ); if ( !( g_MultiDamage.GetDamageType() & DMG_NO_PHYSICS_FORCE ) && g_MultiDamage.GetDamageType() != DMG_GENERIC ) diff --git a/game_shared/vphysics_sound.h b/game_shared/vphysics_sound.h index c60a580f..ae3e1578 100644 --- a/game_shared/vphysics_sound.h +++ b/game_shared/vphysics_sound.h @@ -101,7 +101,7 @@ namespace physicssound sound.surfacePropsHit = surfacePropsHit; } sound.volume += volume; - sound.impactSpeed = max(impactSpeed,sound.impactSpeed); + sound.impactSpeed = MAX(impactSpeed,sound.impactSpeed); return; } } diff --git a/materialsystem/stdshaders/SDK_WaterCheap_ps20.fxc b/materialsystem/stdshaders/SDK_WaterCheap_ps20.fxc index 771160b6..2a67c130 100644 --- a/materialsystem/stdshaders/SDK_WaterCheap_ps20.fxc +++ b/materialsystem/stdshaders/SDK_WaterCheap_ps20.fxc @@ -92,7 +92,7 @@ HDR_PS_OUTPUT main( PS_INPUT i ) : COLOR // FIXME: It's unclear that we want to do this for cheap water // but the code did this previously and I didn't want to change it HALF flDotResult = dot( worldSpaceEye, worldSpaceNormal ); - flDotResult = 1.0f - max( 0.0f, flDotResult ); + flDotResult = 1.0f - MAX( 0.0f, flDotResult ); HALF flFresnelFactor = flDotResult * flDotResult; flFresnelFactor *= flFresnelFactor; diff --git a/materialsystem/stdshaders/SDK_lightmappedgeneric_ps20.fxc b/materialsystem/stdshaders/SDK_lightmappedgeneric_ps20.fxc index 3d21ac32..4e7e6458 100644 --- a/materialsystem/stdshaders/SDK_lightmappedgeneric_ps20.fxc +++ b/materialsystem/stdshaders/SDK_lightmappedgeneric_ps20.fxc @@ -227,8 +227,8 @@ HDR_PS_OUTPUT main( PS_INPUT i ) : COLOR float minb=modt.g-modt.r; float maxb=modt.g+modt.r; #else - float minb=max(0,modt.g-modt.r); - float maxb=min(1,modt.g+modt.r); + float minb=MAX(0,modt.g-modt.r); + float maxb=MIN(1,modt.g+modt.r); #endif blendfactor=smoothstep(minb,maxb,blendfactor); #endif diff --git a/materialsystem/stdshaders/SDK_vertexlit_and_unlit_generic_ps20.fxc b/materialsystem/stdshaders/SDK_vertexlit_and_unlit_generic_ps20.fxc index 17075f1c..f0bc6304 100644 --- a/materialsystem/stdshaders/SDK_vertexlit_and_unlit_generic_ps20.fxc +++ b/materialsystem/stdshaders/SDK_vertexlit_and_unlit_generic_ps20.fxc @@ -174,7 +174,7 @@ HDR_PS_OUTPUT main( PS_INPUT i ) : COLOR // 0.125-1.0 = selfillum*(1+alpha-0.125)*8 (over bright glows) HALF3 selfIllumComponent = g_SelfIllumTint * albedo; half Adj_Alpha=8*envmapMaskTexel.a; - diffuseComponent=( max( 0, 1-Adj_Alpha ) * diffuseComponent) + Adj_Alpha * selfIllumComponent; + diffuseComponent=( MAX( 0, 1-Adj_Alpha ) * diffuseComponent) + Adj_Alpha * selfIllumComponent; #else if( bSelfIllum ) { diff --git a/materialsystem/stdshaders/common_fxc.h b/materialsystem/stdshaders/common_fxc.h index 7a0e78da..cce1943d 100644 --- a/materialsystem/stdshaders/common_fxc.h +++ b/materialsystem/stdshaders/common_fxc.h @@ -61,7 +61,7 @@ HALF3 CalcReflectionVectorUnnormalized( HALF3 normal, HALF3 eyeVector ) float3 HuePreservingColorClamp( float3 c ) { // Get the max of all of the color components and a specified maximum amount - float maximum = max( max( c.x, c.y ), max( c.z, 1.0f ) ); + float maximum = MAX( MAX( c.x, c.y ), MAX( c.z, 1.0f ) ); return (c / maximum); } @@ -69,7 +69,7 @@ float3 HuePreservingColorClamp( float3 c ) HALF3 HuePreservingColorClamp( HALF3 c, HALF maxVal ) { // Get the max of all of the color components and a specified maximum amount - float maximum = max( max( c.x, c.y ), max( c.z, maxVal ) ); + float maximum = MAX( MAX( c.x, c.y ), MAX( c.z, maxVal ) ); return (c * ( maxVal / maximum ) ); } @@ -134,14 +134,14 @@ float4 CompressHDR( float3 input ) { // FIXME: want to use min so that we clamp to white, but what happens if we // have an albedo component that's less than 1/MAX_HDR_OVERBRIGHT? - // float fMax = max( max( color.r, color.g ), color.b ); + // float fMax = MAX( MAX( color.r, color.g ), color.b ); float4 output; - float fMax = min( min( input.r, input.g ), input.b ); + float fMax = MIN( MIN( input.r, input.g ), input.b ); if( fMax > 1.0f ) { float oofMax = 1.0f / fMax; output.rgb = oofMax * input.rgb; - output.a = min( fMax / MAX_HDR_OVERBRIGHT, 1.0f ); + output.a = MIN( fMax / MAX_HDR_OVERBRIGHT, 1.0f ); } else { diff --git a/materialsystem/stdshaders/common_ps_fxc.h b/materialsystem/stdshaders/common_ps_fxc.h index 753c6e3c..8d4b0e80 100644 --- a/materialsystem/stdshaders/common_ps_fxc.h +++ b/materialsystem/stdshaders/common_ps_fxc.h @@ -182,7 +182,7 @@ float CalcWaterFogAlpha( const float flWaterZ, const float flEyePosZ, const floa // if flDepthFromWater < 0, then set it to 0 // This is the equivalent of moving the vert to the water surface if it's above the water surface // We'll do this with the saturate at the end instead. -// flDepthFromWater = max( 0.0f, flDepthFromWater ); +// flDepthFromWater = MAX( 0.0f, flDepthFromWater ); // Calculate the ratio of water fog to regular fog (ie. how much of the distance from the viewer // to the vert is actually underwater. @@ -356,7 +356,7 @@ float2 CalcParallaxedTexCoord( float2 inTexCoord, float2 vParallax, float3 vNorm float sh4 = (tex2D( sNormalMap, texSampleBase + inXY * 0.22 ).w - sh0 - 0.22 ) * 12 * fShadowSoftening; // Compute the actual shadow strength: - float fShadow = 1 - max( max( max( max( max( max( shA, sh9 ), sh8 ), sh7 ), sh6 ), sh5 ), sh4 ); + float fShadow = 1 - MAX( MAX( MAX( MAX( MAX( MAX( shA, sh9 ), sh8 ), sh7 ), sh6 ), sh5 ), sh4 ); cResultColor.rgb *= fShadow * 0.6 + 0.4; } @@ -379,8 +379,8 @@ float2 CalcParallaxedTexCoord( float2 inTexCoord, float2 vParallax, float3 vNorm float4 RGBtoHSL( float4 inColor ) { float h, s; - float flMax = max( inColor.r, max( inColor.g, inColor.b ) ); - float flMin = min( inColor.r, min( inColor.g, inColor.b ) ); + float flMax = MAX( inColor.r, MAX( inColor.g, inColor.b ) ); + float flMin = MIN( inColor.r, MIN( inColor.g, inColor.b ) ); float l = (flMax + flMin) / 2.0f; diff --git a/materialsystem/stdshaders/common_vertexlitgeneric_dx9.h b/materialsystem/stdshaders/common_vertexlitgeneric_dx9.h index 71e976dc..bf27d176 100644 --- a/materialsystem/stdshaders/common_vertexlitgeneric_dx9.h +++ b/materialsystem/stdshaders/common_vertexlitgeneric_dx9.h @@ -119,7 +119,7 @@ float3 DiffuseTerm( const bool bHalfLambert, const float3 worldNormal, const flo } else { - fResult = max( 0.0f, NDotL ); // Saturate pure Lambertian term + fResult = MAX( 0.0f, NDotL ); // Saturate pure Lambertian term } if ( bDoDirectionalDiffuse ) diff --git a/materialsystem/stdshaders/common_vs_fxc.h b/materialsystem/stdshaders/common_vs_fxc.h index dfecd4e0..b44abd43 100644 --- a/materialsystem/stdshaders/common_vs_fxc.h +++ b/materialsystem/stdshaders/common_vs_fxc.h @@ -185,7 +185,7 @@ float WaterFog( const float3 worldPos, const float3 projPos ) // if $tmp.x < 0, then set it to 0 // This is the equivalent of moving the vert to the water surface if it's above the water surface - tmp.x = max( cZero, tmp.x ); + tmp.x = MAX( cZero, tmp.x ); // $tmp.w = $tmp.x / $tmp.y tmp.w = tmp.x / tmp.y; @@ -392,7 +392,7 @@ float3 SpotLight( const float3 worldPos, const float3 worldNormal, int lightNum, { // compute n dot l nDotL = dot( worldNormal, lightDir ); - nDotL = max( cZero, nDotL ); + nDotL = MAX( cZero, nDotL ); } else { @@ -404,9 +404,9 @@ float3 SpotLight( const float3 worldPos, const float3 worldNormal, int lightNum, // compute angular attenuation float flCosTheta = dot( cLightInfo[lightNum].dir, -lightDir ); float flAngularAtten = (flCosTheta - cLightInfo[lightNum].spotParams.z) * cLightInfo[lightNum].spotParams.w; - flAngularAtten = max( cZero, flAngularAtten ); + flAngularAtten = MAX( cZero, flAngularAtten ); flAngularAtten = pow( flAngularAtten, cLightInfo[lightNum].spotParams.x ); - flAngularAtten = min( cOne, flAngularAtten ); + flAngularAtten = MIN( cOne, flAngularAtten ); return cLightInfo[lightNum].color * flDistanceAttenuation * flAngularAtten * nDotL; } @@ -443,7 +443,7 @@ float3 PointLight( const float3 worldPos, const float3 worldNormal, int lightNum { // compute n dot l NDotL = dot( worldNormal, lightDir ); - NDotL = max( cZero, NDotL ); + NDotL = MAX( cZero, NDotL ); } else { @@ -463,7 +463,7 @@ float3 DirectionalLight( const float3 worldNormal, int lightNum, bool bHalfLambe { // compute n dot l NDotL = dot( worldNormal, -cLightInfo[lightNum].dir ); - NDotL = max( cZero, NDotL ); + NDotL = MAX( cZero, NDotL ); } else { @@ -670,9 +670,9 @@ float3 Compute_SpotLightVertexColor( const float3 worldPos, const float3 worldNo float flCosTheta = dot( cLightInfo[lightNum].dir, -lightDir ); float flAngularAtten = (flCosTheta - cLightInfo[lightNum].spotParams.z) * cLightInfo[lightNum].spotParams.w; - flAngularAtten = max( 0.0f, flAngularAtten ); + flAngularAtten = MAX( 0.0f, flAngularAtten ); flAngularAtten = pow( flAngularAtten, cLightInfo[lightNum].spotParams.x ); - flAngularAtten = min( 1.0f, flAngularAtten ); + flAngularAtten = MIN( 1.0f, flAngularAtten ); return flDistanceAttenuation * flAngularAtten * cLightInfo[lightNum].color; } diff --git a/mathlib/mathlib_base.cpp b/mathlib/mathlib_base.cpp index a47ea308..9da47149 100644 --- a/mathlib/mathlib_base.cpp +++ b/mathlib/mathlib_base.cpp @@ -572,8 +572,8 @@ float _SSE_InvRSquared(const float* v) shufps xmm2, xmm2, 1 // x2 = vy * vy, X, X, X addss xmm1, xmm2 // x1 = (vx * vx) + (vy * vy), X, X, X addss xmm1, xmm3 // x1 = (vx * vx) + (vy * vy) + (vz * vz), X, X, X - maxss xmm1, xmm5 // x1 = max( 1.0, x1 ) - rcpss xmm0, xmm1 // x0 = 1 / max( 1.0, x1 ) + maxss xmm1, xmm5 // x1 = MAX( 1.0, x1 ) + rcpss xmm0, xmm1 // x0 = 1 / MAX( 1.0, x1 ) movss inv_r2, xmm0 // inv_r2 = x0 } #elif _LINUX @@ -3678,7 +3678,7 @@ void QuaternionScale( const Quaternion &p, float t, Quaternion &q ) // FIXME: nick, this isn't overly sensitive to accuracy, and it may be faster to // use the cos part (w) of the quaternion (sin(omega)*N,cos(omega)) to figure the new scale. float sinom = sqrt( DotProduct( &p.x, &p.x ) ); - sinom = min( sinom, 1.f ); + sinom = MIN( sinom, 1.f ); float sinsom = sin( asin( sinom ) * t ); diff --git a/public/bitmap/float_bm.h b/public/bitmap/float_bm.h index dd990fd3..ca3c90e6 100644 --- a/public/bitmap/float_bm.h +++ b/public/bitmap/float_bm.h @@ -240,7 +240,7 @@ public: if (face_maps[f].RGBAData) { nfaces++; - ret=max(ret,face_maps[f].BrightestColor()); + ret=MAX(ret,face_maps[f].BrightestColor()); } return ret; } diff --git a/public/bone_setup.cpp b/public/bone_setup.cpp index 3724dd1e..46fbb815 100644 --- a/public/bone_setup.cpp +++ b/public/bone_setup.cpp @@ -1286,7 +1286,7 @@ bool CalcPoseSingle( } else { - cycle = max( 0.0, min( cycle, 0.9999 ) ); + cycle = MAX( 0.0, MIN( cycle, 0.9999 ) ); } } @@ -2004,8 +2004,8 @@ bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vecto // exaggerate knee targets for legs that are nearly straight // FIXME: should be configurable, and the ikKnee should be from the original animation, not modifed - float d = (targetFoot-worldThigh).Length() - min( l1, l2 ); - d = max( l1 + l2, d ); + float d = (targetFoot-worldThigh).Length() - MIN( l1, l2 ); + d = MAX( l1 + l2, d ); // FIXME: too short knee directions cause trouble d = d * 100; @@ -2501,7 +2501,7 @@ void CIKContext::AddDependencies( mstudioseqdesc_t &seqdesc, int iSequence, floa } else { - flCycle = max( 0.0, min( flCycle, 0.9999 ) ); + flCycle = MAX( 0.0, MIN( flCycle, 0.9999 ) ); } } @@ -2966,7 +2966,7 @@ void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneTo pTarget->est.floor = Lerp( pRule->flRuleWeight, pTarget->est.floor, pRule->floor ); pTarget->est.radius = Lerp( pRule->flRuleWeight, pTarget->est.radius, pRule->radius ); //pTarget->est.latched = Lerp( pRule->flRuleWeight, pTarget->est.latched, pRule->latched ); - pTarget->est.latched = min( pTarget->est.latched, pRule->latched ); + pTarget->est.latched = MIN( pTarget->est.latched, pRule->latched ); pTarget->est.release = Lerp( pRule->flRuleWeight, pTarget->est.release, pRule->release ); pTarget->est.flWeight = Lerp( pRule->flRuleWeight, pTarget->est.flWeight, pRule->flWeight ); } @@ -2984,7 +2984,7 @@ void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneTo if (pRule->latched > 0.0) pTarget->est.latched = 0.0; else - pTarget->est.latched = min( pTarget->est.latched, 1.0f - pRule->flWeight ); + pTarget->est.latched = MIN( pTarget->est.latched, 1.0f - pRule->flWeight ); } break; case IK_RELEASE: @@ -2993,7 +2993,7 @@ void CIKContext::UpdateTargets( Vector pos[], Quaternion q[], matrix3x4_t boneTo if (pRule->latched > 0.0) pTarget->est.latched = 0.0; else - pTarget->est.latched = min( pTarget->est.latched, 1.0f - pRule->flWeight ); + pTarget->est.latched = MIN( pTarget->est.latched, 1.0f - pRule->flWeight ); pTarget->est.flWeight = (pTarget->est.flWeight) * (1 - pRule->flWeight * pRule->flRuleWeight); } @@ -3156,11 +3156,11 @@ void CIKContext::AutoIKRelease( void ) float ft = m_flTime - pTarget->error.flErrorTime; if (dt < 0.25) { - pTarget->error.ramp = min( pTarget->error.ramp + ft * 4.0, 1.0 ); + pTarget->error.ramp = MIN( pTarget->error.ramp + ft * 4.0, 1.0 ); } else { - pTarget->error.ramp = max( pTarget->error.ramp - ft * 4.0, 0.0 ); + pTarget->error.ramp = MAX( pTarget->error.ramp - ft * 4.0, 0.0 ); } if (pTarget->error.ramp > 0.0) { @@ -3845,7 +3845,7 @@ void DoQuatInterpBone( // FIXME: a fast acos should be acceptable dot = clamp( dot, -1, 1 ); weight[i] = 1 - (2 * acos( dot ) * pProc->pTrigger( i )->inv_tolerance ); - weight[i] = max( 0, weight[i] ); + weight[i] = MAX( 0, weight[i] ); scale += weight[i]; } diff --git a/public/compressed_vector.h b/public/compressed_vector.h index 2d180ac7..3238ab54 100644 --- a/public/compressed_vector.h +++ b/public/compressed_vector.h @@ -25,8 +25,6 @@ #include "tier0/dbg.h" #include "vector.h" -#undef MINMAX_H -#include "minmax.h" #include "mathlib.h" #ifdef __cplusplus @@ -68,8 +66,8 @@ inline Vector32& Vector32::operator=(const Vector &vOther) static float expScale[4] = { 4.0f, 16.0f, 32.f, 64.f }; - float fmax = max( fabs( vOther.x ), fabs( vOther.y ) ); - fmax = max( fmax, fabs( vOther.z ) ); + float fmax = MAX( fabs( vOther.x ), fabs( vOther.y ) ); + fmax = MAX( fmax, fabs( vOther.z ) ); for (exp = 0; exp < 3; exp++) { diff --git a/public/materialsystem/materialsystem_config.h b/public/materialsystem/materialsystem_config.h index 463216db..a67a51c3 100644 --- a/public/materialsystem/materialsystem_config.h +++ b/public/materialsystem/materialsystem_config.h @@ -103,7 +103,7 @@ struct MaterialSystem_Config_t int numTextureUnits; // set to zero if there is no limit on the // number of texture units to be used. // otherwise, the effective number of texture units - // will be max( config->numTexturesUnits, hardwareNumTextureUnits ) + // will be MAX( config->numTexturesUnits, hardwareNumTextureUnits ) float m_SlopeScaleDepthBias_Decal; float m_SlopeScaleDepthBias_Normal; diff --git a/public/mathlib/math_base.h b/public/mathlib/math_base.h index 0b394834..59a3e38e 100644 --- a/public/mathlib/math_base.h +++ b/public/mathlib/math_base.h @@ -14,13 +14,10 @@ #include "vector2d.h" #include "tier0/dbg.h" -#undef MINMAX_H -#include "minmax.h" - #ifdef _WIN32 #define FORCEINLINE_MATH FORCEINLINE #else -#define FORCEINLINE_MATH extern __inline__ FORCEINLINE +#define FORCEINLINE_MATH __inline__ FORCEINLINE #endif // plane_t structure @@ -194,12 +191,12 @@ FORCEINLINE_MATH void VectorClear(vec_t *a) FORCEINLINE_MATH float VectorMaximum(const vec_t *v) { - return max( v[0], max( v[1], v[2] ) ); + return MAX( v[0], MAX( v[1], v[2] ) ); } FORCEINLINE_MATH float VectorMaximum(const Vector& v) { - return max( v.x, max( v.y, v.z ) ); + return MAX( v.x, MAX( v.y, v.z ) ); } FORCEINLINE_MATH void VectorScale (const float* in, vec_t scale, float* out) @@ -224,7 +221,7 @@ inline void VectorNegate(vec_t *a) } -//#define VectorMaximum(a) ( max( (a)[0], max( (a)[1], (a)[2] ) ) ) +//#define VectorMaximum(a) ( MAX( (a)[0], MAX( (a)[1], (a)[2] ) ) ) #define Vector2Clear(x) {(x)[0]=(x)[1]=0;} #define Vector2Negate(x) {(x)[0]=-((x)[0]);(x)[1]=-((x)[1]);} #define Vector2Copy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];} diff --git a/public/minmax.h b/public/minmax.h deleted file mode 100644 index 853c4d77..00000000 --- a/public/minmax.h +++ /dev/null @@ -1,22 +0,0 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -// $NoKeywords: $ -//=============================================================================// - -#ifndef MINMAX_H -#define MINMAX_H - -#if defined( _WIN32 ) -#pragma once -#endif - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#endif // MINMAX_H diff --git a/public/rope_physics.cpp b/public/rope_physics.cpp index 5afdbe67..84a65516 100644 --- a/public/rope_physics.cpp +++ b/public/rope_physics.cpp @@ -60,7 +60,7 @@ void CBaseRopePhysics::Restart() void CBaseRopePhysics::ResetSpringLength( float flSpringDist ) { - m_flSpringDist = max( flSpringDist, 0 ); + m_flSpringDist = MAX( flSpringDist, 0 ); m_flSpringDistSqr = m_flSpringDist * m_flSpringDist; for( int i=0; i < NumSprings(); i++ ) diff --git a/public/sentence.cpp b/public/sentence.cpp index d5ff7c5d..4dfb6858 100644 --- a/public/sentence.cpp +++ b/public/sentence.cpp @@ -1024,7 +1024,7 @@ void CSentence::ResetToBase( void ) void CSentence::MarkNewPhraseBase( void ) { #if PHONEME_EDITOR - m_nResetWordBase = max( m_Words.Size(), 0 ); + m_nResetWordBase = MAX( m_Words.Size(), 0 ); #endif } @@ -1419,10 +1419,10 @@ float CSentence::GetIntensity( float time, float endtime ) int end = i + 1; int next = i + 2; - prev = max( -1, prev ); - start = max( -1, start ); - end = min( end, GetNumSamples() ); - next = min( next, GetNumSamples() ); + prev = MAX( -1, prev ); + start = MAX( -1, start ); + end = MIN( end, GetNumSamples() ); + next = MIN( next, GetNumSamples() ); CEmphasisSample *esPre = GetBoundedSample( prev, endtime ); CEmphasisSample *esStart = GetBoundedSample( start, endtime ); diff --git a/public/smooth_average.h b/public/smooth_average.h index 0c8a4bd4..72fd4c7e 100644 --- a/public/smooth_average.h +++ b/public/smooth_average.h @@ -123,12 +123,12 @@ inline CTimingInfo< T > CalcSmoothAverage_Struct( const T &value, int nTimes, co { if ( i != newValueIndex ) { - info.m_HighAverage = max( pInfo->m_Values[i].m_Average, info.m_HighAverage ); - info.m_LowAverage = min( pInfo->m_Values[i].m_Average, info.m_LowAverage ); + info.m_HighAverage = MAX( pInfo->m_Values[i].m_Average, info.m_HighAverage ); + info.m_LowAverage = MIN( pInfo->m_Values[i].m_Average, info.m_LowAverage ); } - info.m_HighValue = max( pInfo->m_Values[i].m_Value, info.m_HighValue ); - info.m_LowValue = min( pInfo->m_Values[i].m_Value, info.m_LowValue ); + info.m_HighValue = MAX( pInfo->m_Values[i].m_Value, info.m_HighValue ); + info.m_LowValue = MIN( pInfo->m_Values[i].m_Value, info.m_LowValue ); info.m_AverageValue += pInfo->m_Values[i].m_Value; } @@ -194,12 +194,12 @@ inline CTimingInfo< T > SumOverTimeInterval_Struct( const T &value, float nSecon { if ( i != newValueIndex ) { - info.m_HighAverage = max( pInfo->m_Values[i].m_Average, info.m_HighAverage ); - info.m_LowAverage = min( pInfo->m_Values[i].m_Average, info.m_LowAverage ); + info.m_HighAverage = MAX( pInfo->m_Values[i].m_Average, info.m_HighAverage ); + info.m_LowAverage = MIN( pInfo->m_Values[i].m_Average, info.m_LowAverage ); } - info.m_HighValue = max( pInfo->m_Values[i].m_Value, info.m_HighValue ); - info.m_LowValue = min( pInfo->m_Values[i].m_Value, info.m_LowValue ); + info.m_HighValue = MAX( pInfo->m_Values[i].m_Value, info.m_HighValue ); + info.m_LowValue = MIN( pInfo->m_Values[i].m_Value, info.m_LowValue ); info.m_AverageValue += pInfo->m_Values[i].m_Value; } diff --git a/public/soundcombiner.cpp b/public/soundcombiner.cpp index 95f973a6..c87f2ea8 100644 --- a/public/soundcombiner.cpp +++ b/public/soundcombiner.cpp @@ -612,8 +612,8 @@ bool CSoundCombiner::AppendSilence( int ¤tsample, float duration ) while ( --numSamples >= 0 ) { currentValue += random->RandomInt( -MOTION_MAXSTEP, MOTION_MAXSTEP ); - currentValue = min( maxValue, currentValue ); - currentValue = max( minValue, currentValue ); + currentValue = MIN( maxValue, currentValue ); + currentValue = MAX( minValue, currentValue ); // Downsample to 0 65556 range short s = (float)currentValue / 32768.0f; diff --git a/public/studio.cpp b/public/studio.cpp index 8a708a02..f42f3e8c 100644 --- a/public/studio.cpp +++ b/public/studio.cpp @@ -438,7 +438,7 @@ int studiohdr_t::GetActivityListVersion( void ) const Assert( pStudioHdr ); - version = min( version, pStudioHdr->activitylistversion ); + version = MIN( version, pStudioHdr->activitylistversion ); } return version; @@ -1065,7 +1065,7 @@ int CStudioHdr::GetActivityListVersion( void ) const { const studiohdr_t *pStudioHdr = GroupStudioHdr( i ); Assert( pStudioHdr ); - version = min( version, pStudioHdr->activitylistversion ); + version = MIN( version, pStudioHdr->activitylistversion ); } return version; @@ -1108,7 +1108,7 @@ int CStudioHdr::GetEventListVersion( void ) const { const studiohdr_t *pStudioHdr = GroupStudioHdr( i ); Assert( pStudioHdr ); - version = min( version, pStudioHdr->eventsindexed ); + version = MIN( version, pStudioHdr->eventsindexed ); } return version; @@ -1272,8 +1272,8 @@ void CStudioHdr::RunFlexRules( const float *src, float *dest ) k--; break; case STUDIO_NEG: stack[k-1] = -stack[k-1]; break; - case STUDIO_MAX: stack[k-2] = max( stack[k-2], stack[k-1] ); k--; break; - case STUDIO_MIN: stack[k-2] = min( stack[k-2], stack[k-1] ); k--; break; + case STUDIO_MAX: stack[k-2] = MAX( stack[k-2], stack[k-1] ); k--; break; + case STUDIO_MIN: stack[k-2] = MIN( stack[k-2], stack[k-1] ); k--; break; case STUDIO_CONST: stack[k] = pops->d.value; k++; break; case STUDIO_FETCH1: { diff --git a/public/studio_virtualmodel.cpp b/public/studio_virtualmodel.cpp index 00a89b85..2116c609 100644 --- a/public/studio_virtualmodel.cpp +++ b/public/studio_virtualmodel.cpp @@ -455,8 +455,8 @@ void virtualmodel_t::AppendPoseParameters( int group, const studiohdr_t *pStudio // duplicate, reset start and end to fit full dynamic range mstudioposeparamdesc_t *pPose1 = pStudioHdr->pLocalPoseParameter( j ); mstudioposeparamdesc_t *pPose2 = m_group[ pose[k].group ].GetStudioHdr()->pLocalPoseParameter( pose[k].index ); - float start = min( pPose2->end, min( pPose1->end, min( pPose2->start, pPose1->start ) ) ); - float end = max( pPose2->end, max( pPose1->end, max( pPose2->start, pPose1->start ) ) ); + float start = MIN( pPose2->end, MIN( pPose1->end, MIN( pPose2->start, pPose1->start ) ) ); + float end = MAX( pPose2->end, MAX( pPose1->end, MAX( pPose2->start, pPose1->start ) ) ); pPose2->start = start; pPose2->end = end; } diff --git a/public/tier0/basetypes.h b/public/tier0/basetypes.h index ef36ebdb..1c314c0b 100644 --- a/public/tier0/basetypes.h +++ b/public/tier0/basetypes.h @@ -8,6 +8,7 @@ #ifndef BASETYPES_H #define BASETYPES_H +#include "tier0/platform.h" #include "commonmacros.h" #include "wchartypes.h" @@ -69,12 +70,15 @@ inline T AlignValue( T val, unsigned alignment ) #endif #define M_PI 3.14159265358979323846 -#ifndef min - #define min(a,b) (((a) < (b)) ? (a) : (b)) +// #define COMPILETIME_MAX and COMPILETIME_MIN for max/min in constant expressions +#define COMPILETIME_MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) +#define COMPILETIME_MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) +#ifndef MIN +#define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif -#ifndef max - #define max(a,b) (((a) > (b)) ? (a) : (b)) +#ifndef MAX +#define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif #ifdef __cplusplus diff --git a/public/tier0/platform.h b/public/tier0/platform.h index 7d329e3e..16c31c7e 100644 --- a/public/tier0/platform.h +++ b/public/tier0/platform.h @@ -10,7 +10,6 @@ #define PLATFORM_H #include "wchartypes.h" -#include "basetypes.h" #include "tier0/valve_off.h" #ifdef _WIN32 diff --git a/public/tier1/mempool.h b/public/tier1/mempool.h index f4538c4c..f0bbafbc 100644 --- a/public/tier1/mempool.h +++ b/public/tier1/mempool.h @@ -121,7 +121,7 @@ class CAlignedMemPool { enum { - BLOCK_SIZE = max( ALIGN_VALUE( ITEM_SIZE, ALIGNMENT ), 8 ), + BLOCK_SIZE = COMPILETIME_MAX( ALIGN_VALUE( ITEM_SIZE, ALIGNMENT ), 8 ), }; public: diff --git a/public/tier1/utlmemory.h b/public/tier1/utlmemory.h index acbab9dd..d1641aec 100644 --- a/public/tier1/utlmemory.h +++ b/public/tier1/utlmemory.h @@ -109,7 +109,7 @@ protected: const int MAX_GROW = 128; if ( m_nGrowSize * sizeof(T) > MAX_GROW ) { - m_nGrowSize = max( 1, MAX_GROW / sizeof(T) ); + m_nGrowSize = MAX( 1, MAX_GROW / sizeof(T) ); } } #endif diff --git a/public/tier1/utlrbtree.h b/public/tier1/utlrbtree.h index 958b7bfe..3ca57e27 100644 --- a/public/tier1/utlrbtree.h +++ b/public/tier1/utlrbtree.h @@ -1179,7 +1179,7 @@ int CUtlRBTree::Depth( I node ) const int depthright = Depth( RightChild(node) ); int depthleft = Depth( LeftChild(node) ); - return max(depthright, depthleft) + 1; + return MAX(depthright, depthleft) + 1; } diff --git a/public/xzp.cpp b/public/xzp.cpp index e9a0ac5c..3fd77c2e 100644 --- a/public/xzp.cpp +++ b/public/xzp.cpp @@ -736,7 +736,7 @@ bool xZipAddFile( char* filename, bool bPrecacheEntireFile, bool bProcessPrecach else if( bProcessPrecacheHeaderOnly ) { customPreloadSize = xZipComputeCustomPreloads( filename ); - fileSize = min( fileSize, customPreloadSize ); + fileSize = MIN( fileSize, customPreloadSize ); } // Does this file have a split header? diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index ae63fefc..44d5b4e7 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -62,7 +62,7 @@ public: m_errorStack[m_errorIndex] = symName; } m_errorIndex++; - m_maxErrorIndex = max( m_maxErrorIndex, (m_errorIndex-1) ); + m_maxErrorIndex = MAX( m_maxErrorIndex, (m_errorIndex-1) ); return m_errorIndex-1; } diff --git a/tier1/diff.cpp b/tier1/diff.cpp index 36072caf..0b01aa1c 100644 --- a/tier1/diff.cpp +++ b/tier1/diff.cpp @@ -219,8 +219,8 @@ int FindDiffsForLargeFiles(uint8 const *NewBlock, uint8 const *OldBlock, int match_of=b->dataptr-lastmatchend; if ((match_of>-32768) && (match_of<32767)) { - int max_mlength=min(65535,OldBlock+OldSize-b->dataptr); - max_mlength=min(max_mlength,NewBlock+NewSize-walk); + int max_mlength=MIN(65535,OldBlock+OldSize-b->dataptr); + max_mlength=MIN(max_mlength,NewBlock+NewSize-walk); int i; for(i=0;idataptr[i]) @@ -355,8 +355,8 @@ int FindDiffs(uint8 const *NewBlock, uint8 const *OldBlock, int match_of=b->dataptr-lastmatchend; if ((match_of>-32768) && (match_of<32767)) { - int max_mlength=min(65535,OldBlock+OldSize-b->dataptr); - max_mlength=min(max_mlength,NewBlock+NewSize-walk); + int max_mlength=MIN(65535,OldBlock+OldSize-b->dataptr); + max_mlength=MIN(max_mlength,NewBlock+NewSize-walk); int i; for(i=0;idataptr[i]) @@ -467,7 +467,7 @@ int FindDiffsLowMemory(uint8 const *NewBlock, uint8 const *OldBlock, uint16 hash1=(walk[0]+walk[1]+walk[2]+walk[3]) & (NELEMS(old_data_hash)-1); if (old_data_hash[hash1]) { - int max_bytes_to_compare=min(NewBlock+NewSize-walk,OldBlock+OldSize-old_data_hash[hash1]); + int max_bytes_to_compare=MIN(NewBlock+NewSize-walk,OldBlock+OldSize-old_data_hash[hash1]); int nmatches; for(nmatches=0;nmatches #include "vstdlib/strtools.h" -#include "minmax.h" // max() +#include "minmax.h" // MAX() // Should be last include #include "tier0/memdbgon.h" @@ -247,7 +247,7 @@ void *CMemoryPool::Alloc( unsigned int amount ) } } m_BlocksAllocated++; - m_PeakAlloc = max(m_PeakAlloc, m_BlocksAllocated); + m_PeakAlloc = MAX(m_PeakAlloc, m_BlocksAllocated); returnBlock = m_pHeadOfFreeList; diff --git a/tier1/strtools.cpp b/tier1/strtools.cpp index 374b7b67..b0c191fe 100644 --- a/tier1/strtools.cpp +++ b/tier1/strtools.cpp @@ -680,7 +680,7 @@ char *V_strncat(char *pDest, const char *pSrc, size_t destBufferSize, int max_ch } else { - charstocopy = (size_t)min( max_chars_to_copy, (int)srclen ); + charstocopy = (size_t)MIN( max_chars_to_copy, (int)srclen ); } if ( len + charstocopy >= destBufferSize ) @@ -745,7 +745,7 @@ char *V_pretifymem( float value, int digitsafterdecimal /*= 2*/, bool usebinaryo char val[ 32 ]; // Clamp to >= 0 - digitsafterdecimal = max( digitsafterdecimal, 0 ); + digitsafterdecimal = MAX( digitsafterdecimal, 0 ); // If it's basically integral, don't do any decimals if ( FloatMakePositive( value - (int)value ) < 0.00001 ) @@ -954,7 +954,7 @@ static unsigned char V_nibble( char c ) void V_hextobinary( char const *in, int numchars, byte *out, int maxoutputbytes ) { int len = V_strlen( in ); - numchars = min( len, numchars ); + numchars = MIN( len, numchars ); // Make sure it's even numchars = ( numchars ) & ~0x1; @@ -1062,7 +1062,7 @@ void V_FileBase( const char *in, char *out, int maxlen ) // Length of new sting len = end - start + 1; - int maxcopy = min( len + 1, maxlen ); + int maxcopy = MIN( len + 1, maxlen ); // Copy partial string V_strncpy( out, &in[start], maxcopy ); @@ -1112,7 +1112,7 @@ void V_StripExtension( const char *in, char *out, int outSize ) if ( pLastExt > in ) { int nChars = pLastExt - in - 1; - nChars = min( nChars, outSize-1 ); + nChars = MIN( nChars, outSize-1 ); memcpy( out, in, nChars ); out[nChars] = 0; } @@ -1322,7 +1322,7 @@ bool V_ExtractFilePath (const char *path, char *dest, int destSize ) src--; } - int copysize = min( src - path, destSize - 1 ); + int copysize = MIN( src - path, destSize - 1 ); memcpy( dest, path, copysize ); dest[copysize] = 0; @@ -1596,7 +1596,7 @@ char* AllocString( const char *pStr, int nMaxChars ) if ( nMaxChars == -1 ) allocLen = strlen( pStr ) + 1; else - allocLen = min( (int)strlen(pStr), nMaxChars ) + 1; + allocLen = MIN( (int)strlen(pStr), nMaxChars ) + 1; char *pOut = new char[allocLen]; V_strncpy( pOut, pStr, allocLen ); diff --git a/tier1/utlsymbol.cpp b/tier1/utlsymbol.cpp index 5623e934..c62f5c3e 100644 --- a/tier1/utlsymbol.cpp +++ b/tier1/utlsymbol.cpp @@ -207,7 +207,7 @@ CUtlSymbol CUtlSymbolTable::AddString( char const* pString ) if ( iPool == -1 ) { // Add a new pool. - int newPoolSize = max( len, MIN_STRING_POOL_SIZE ); + int newPoolSize = MAX( len, MIN_STRING_POOL_SIZE ); StringPool_t *pPool = (StringPool_t*)malloc( sizeof( StringPool_t ) + newPoolSize - 1 ); pPool->m_TotalLen = newPoolSize; pPool->m_SpaceUsed = 0; diff --git a/utils/demoinfo/demosmoothersamplesource.cpp b/utils/demoinfo/demosmoothersamplesource.cpp index 1a1457e1..0d1c1a60 100644 --- a/utils/demoinfo/demosmoothersamplesource.cpp +++ b/utils/demoinfo/demosmoothersamplesource.cpp @@ -636,7 +636,7 @@ void CDemoSmootherPanel::OnPreview( bool original ) m_bPreviewing = true; m_bPreviewPaused = false; m_bPreviewOriginal = original; - SetLastFrame( false, max( 0, m_nSelection[0] - 10 ) ); + SetLastFrame( false, MAX( 0, m_nSelection[0] - 10 ) ); m_iPreviewStartTick = GetTickForFrame( m_nPreviewLastFrame ); m_fPreviewCurrentTime = TICKS_TO_TIME( m_iPreviewStartTick ); } @@ -875,14 +875,14 @@ void CDemoSmootherPanel::DrawDebuggingInfo( int frame, float elapsed ) bool showall = m_pShowAllSamples->IsSelected(); if ( !showall ) { - start = max( frame - 200, 0 ); - end = min( frame + 200, c - 1 ); + start = MAX( frame - 200, 0 ); + end = MIN( frame + 200, c - 1 ); } if ( m_bHasSelection && !showall ) { - start = max( m_nSelection[ 0 ] - 10, 0 ); - end = min( m_nSelection[ 1 ] + 10, c - 1 ); + start = MAX( m_nSelection[ 0 ] - 10, 0 ); + end = MIN( m_nSelection[ 1 ] + 10, c - 1 ); } bool draworiginal = !m_pHideOriginal->IsSelected(); @@ -1111,7 +1111,7 @@ bool CDemoSmootherPanel::GetInterpolatedOriginAndAngles( bool readonly, Vector& demosmoothing_t *startsample = &m_Smoothing.smooth[ startframe ]; demosmoothing_t *endsample = &m_Smoothing.smooth[ nextframe ]; - if ( nextframe >= min( m_nSelection[1] + 10, c - 1 ) ) + if ( nextframe >= MIN( m_nSelection[1] + 10, c - 1 ) ) { if ( !readonly ) { @@ -1219,7 +1219,7 @@ void CDemoSmootherPanel::OnStep( bool forward ) int c = m_Smoothing.smooth.Count(); SetLastFrame( false, m_nPreviewLastFrame + ( forward ? 1 : -1 ) ); - SetLastFrame( false, clamp( m_nPreviewLastFrame, max( m_nSelection[ 0 ] - 10, 0 ), min( m_nSelection[ 1 ] + 10, c - 1 ) ) ); + SetLastFrame( false, clamp( m_nPreviewLastFrame, MAX( m_nSelection[ 0 ] - 10, 0 ), MIN( m_nSelection[ 1 ] + 10, c - 1 ) ) ); m_fPreviewCurrentTime = TICKS_TO_TIME( GetTickForFrame( m_nPreviewLastFrame ) ); } diff --git a/utils/demoinfo/tooldemofile.cpp b/utils/demoinfo/tooldemofile.cpp index 95b5f25a..f0e0329b 100644 --- a/utils/demoinfo/tooldemofile.cpp +++ b/utils/demoinfo/tooldemofile.cpp @@ -108,7 +108,7 @@ int CToolDemoFile::ReadNetworkDataTables( CUtlBuffer *buf ) while( length > 0 ) { - int chunk = min( length, 1024 ); + int chunk = MIN( length, 1024 ); g_pFileSystem->Read( data, chunk, m_hDemoFile ); length -= chunk; diff --git a/utils/hlmv/controlpanel.cpp b/utils/hlmv/controlpanel.cpp index 94581b59..5b5d2b5c 100644 --- a/utils/hlmv/controlpanel.cpp +++ b/utils/hlmv/controlpanel.cpp @@ -1789,7 +1789,7 @@ ControlPanel::handleEvent (mxEvent *event) if ( event->event == mxEvent::Size ) { - tab->setBounds( 0, 0, event->width, max( 0, event->height - 20 ) ); + tab->setBounds( 0, 0, event->width, MAX( 0, event->height - 20 ) ); return 1; } diff --git a/utils/hlmv/matsyswin.cpp b/utils/hlmv/matsyswin.cpp index fc7e1b06..717d7f8c 100644 --- a/utils/hlmv/matsyswin.cpp +++ b/utils/hlmv/matsyswin.cpp @@ -290,7 +290,7 @@ MatSysWindow::handleEvent (mxEvent *event) oldlry = g_viewerSettings.lightrot[0]; g_viewerSettings.pause = false; - float r = 1.0/3.0 * min( w(), h() ); + float r = 1.0/3.0 * MIN( w(), h() ); float d = sqrt( ( float )( (event->x - w()/2) * (event->x - w()/2) + (event->y - h()/2) * (event->y - h()/2) ) ); diff --git a/utils/hlmv/studio_render.cpp b/utils/hlmv/studio_render.cpp index 1711d014..3475f05a 100644 --- a/utils/hlmv/studio_render.cpp +++ b/utils/hlmv/studio_render.cpp @@ -453,7 +453,7 @@ void StudioModel::SetUpBones( bool mergeBones ) { if (m_Layer[i].m_weight > 0) { - iMaxPriority = max( m_Layer[i].m_priority, iMaxPriority ); + iMaxPriority = MAX( m_Layer[i].m_priority, iMaxPriority ); } } diff --git a/utils/hlmv/viewersettings.cpp b/utils/hlmv/viewersettings.cpp index 451ecb86..d7bd295d 100644 --- a/utils/hlmv/viewersettings.cpp +++ b/utils/hlmv/viewersettings.cpp @@ -518,8 +518,8 @@ bool LoadViewerSettings (const char *filename, StudioModel *pModel ) RegReadFloat( hModelKey, "speedscale", &g_viewerSettings.speedScale ); if (g_viewerSettings.speedScale > 1.0) g_viewerSettings.speedScale = 1.0; - g_viewerSettings.width = max( 200, g_viewerSettings.width ); - g_viewerSettings.height = max( 150, g_viewerSettings.height ); + g_viewerSettings.width = MAX( 200, g_viewerSettings.width ); + g_viewerSettings.height = MAX( 150, g_viewerSettings.height ); RegReadInt( hModelKey, "viewermode", &g_viewerSettings.application_mode ); RegReadInt( hModelKey, "thumbnailsize", &g_viewerSettings.thumbnailsize ); diff --git a/utils/phonemeextractor/phonemeextractor.cpp b/utils/phonemeextractor/phonemeextractor.cpp index 20ec82bb..401a6f4c 100644 --- a/utils/phonemeextractor/phonemeextractor.cpp +++ b/utils/phonemeextractor/phonemeextractor.cpp @@ -332,7 +332,7 @@ bool BuildRules( ISpRecoGrammar* cpRecoGrammar, SPSTATEHANDLE *root, CUtlVector< if ( numrules > 1 ) { - for ( int skip = 1; skip <= min( MAX_WORD_SKIP, numrules ); skip++ ) + for ( int skip = 1; skip <= MIN( MAX_WORD_SKIP, numrules ); skip++ ) { OutputDebugString( va( "Opt transition from Root to %s\r\n", (*rules)[ 0 ].plaintext ) ); @@ -1036,8 +1036,8 @@ void MergeWords( CWordTag *w1, CWordTag *w2 ) { unsigned int start, end; - start = min( w1->m_uiStartByte, w2->m_uiStartByte ); - end = max( w1->m_uiEndByte, w2->m_uiEndByte ); + start = MIN( w1->m_uiStartByte, w2->m_uiStartByte ); + end = MAX( w1->m_uiEndByte, w2->m_uiEndByte ); unsigned int mid = ( start + end ) / 2; diff --git a/utils/studiomdl/collisionmodel.cpp b/utils/studiomdl/collisionmodel.cpp index 1567181d..e03bb830 100644 --- a/utils/studiomdl/collisionmodel.cpp +++ b/utils/studiomdl/collisionmodel.cpp @@ -1015,10 +1015,10 @@ void MarkConnectedMeshes( int *vertID, s_source_t *pmodel, int *vertMap ) globalFace.c = vertMap[globalFace.c]; - // find min(faceid, vertID[a], vertID[b], vertID[c]); - int newid = min(faceid, vertID[globalFace.a]); - newid = min( newid, vertID[globalFace.b]); - newid = min( newid, vertID[globalFace.c]); + // find MIN(faceid, vertID[a], vertID[b], vertID[c]); + int newid = MIN(faceid, vertID[globalFace.a]); + newid = MIN( newid, vertID[globalFace.b]); + newid = MIN( newid, vertID[globalFace.c]); // mark all verts with the minimum, count the number we had to mark if ( vertID[globalFace.a] != newid ) diff --git a/utils/studiomdl/simplify.cpp b/utils/studiomdl/simplify.cpp index eb9a1a23..e9acadcb 100644 --- a/utils/studiomdl/simplify.cpp +++ b/utils/studiomdl/simplify.cpp @@ -311,7 +311,7 @@ void processAnimations() { for (k = 0; k < g_sequence[i].groupsize[1]; k++) { - g_sequence[i].weight[n] = max( g_sequence[i].weight[n], g_sequence[i].panim[j][k]->weight[n] ); + g_sequence[i].weight[n] = MAX( g_sequence[i].weight[n], g_sequence[i].panim[j][k]->weight[n] ); } } } @@ -1822,13 +1822,13 @@ void matchBlend( s_animation_t *pDestAnim, s_animation_t *pSrcAnimation, int iSr if (pDestAnim->flags & STUDIO_LOOPING) { - iPre = max( iPre, -pDestAnim->numframes ); - iPost = min( iPost, pDestAnim->numframes ); + iPre = MAX( iPre, -pDestAnim->numframes ); + iPost = MIN( iPost, pDestAnim->numframes ); } else { - iPre = max( iPre, -iDestFrame ); - iPost = min( iPost, pDestAnim->numframes - iDestFrame ); + iPre = MAX( iPre, -iDestFrame ); + iPost = MIN( iPost, pDestAnim->numframes - iDestFrame ); } Vector delta_pos[MAXSTUDIOSRCBONES]; @@ -2274,7 +2274,7 @@ void RemapVertexAnimations(void) model_to_vanim_vert_imap[j] = -1; } - int minLod = min( g_minLod, g_ScriptLODs.Size() - 1 ); + int minLod = MIN( g_minLod, g_ScriptLODs.Size() - 1 ); for (j = 0; j < pvsource->numvertices; j++) { @@ -5568,10 +5568,10 @@ static void CalcPoseParameters( void ) MdlError( "calcblend failed in %s\n", pseq->name ); } - g_pose[j0].min = min( g_pose[j0].min, pseq->paramstart[iPose] ); - g_pose[j0].max = max( g_pose[j0].max, pseq->paramstart[iPose] ); - g_pose[j0].min = min( g_pose[j0].min, pseq->paramend[iPose] ); - g_pose[j0].max = max( g_pose[j0].max, pseq->paramend[iPose] ); + g_pose[j0].min = MIN( g_pose[j0].min, pseq->paramstart[iPose] ); + g_pose[j0].max = MAX( g_pose[j0].max, pseq->paramstart[iPose] ); + g_pose[j0].min = MIN( g_pose[j0].min, pseq->paramend[iPose] ); + g_pose[j0].max = MAX( g_pose[j0].max, pseq->paramend[iPose] ); } else { @@ -6290,7 +6290,7 @@ static void ProcessIKRules( ) { for (k = 0; k < g_sequence[i].groupsize[1]; k++) { - g_sequence[i].numikrules = max( g_sequence[i].numikrules, g_sequence[i].panim[j][k]->numikrules ); + g_sequence[i].numikrules = MAX( g_sequence[i].numikrules, g_sequence[i].panim[j][k]->numikrules ); } } @@ -6510,8 +6510,8 @@ static void CompressAnimations( ) value[n] = ( g_panimation[i]->sanim[n][j].pos[k] - g_bonetable[j].pos[k] ) / g_bonetable[j].posscale[k]; } - checkmin[k] = min( value[n] * g_bonetable[j].posscale[k], checkmin[k] ); - checkmax[k] = max( value[n] * g_bonetable[j].posscale[k], checkmax[k] ); + checkmin[k] = MIN( value[n] * g_bonetable[j].posscale[k], checkmin[k] ); + checkmax[k] = MAX( value[n] * g_bonetable[j].posscale[k], checkmax[k] ); break; case 3: /* X Rotation */ case 4: /* Y Rotation */ @@ -6530,8 +6530,8 @@ static void CompressAnimations( ) while (v < -M_PI) v += M_PI * 2; - checkmin[k] = min( v, checkmin[k] ); - checkmax[k] = max( v, checkmax[k] ); + checkmin[k] = MIN( v, checkmin[k] ); + checkmax[k] = MAX( v, checkmax[k] ); value[n] = v / g_bonetable[j].rotscale[k-3]; break; } diff --git a/utils/studiomdl/studiomdl.cpp b/utils/studiomdl/studiomdl.cpp index 8d5ec57b..dc0caf3a 100644 --- a/utils/studiomdl/studiomdl.cpp +++ b/utils/studiomdl/studiomdl.cpp @@ -2745,10 +2745,10 @@ int ParseSequence( s_sequence_t *pseq, bool isAppend ) GetToken( false ); pseq->paramend[i] = verify_atof( token ); - g_pose[j].min = min( g_pose[j].min, pseq->paramstart[i] ); - g_pose[j].min = min( g_pose[j].min, pseq->paramend[i] ); - g_pose[j].max = max( g_pose[j].max, pseq->paramstart[i] ); - g_pose[j].max = max( g_pose[j].max, pseq->paramend[i] ); + g_pose[j].min = MIN( g_pose[j].min, pseq->paramstart[i] ); + g_pose[j].min = MIN( g_pose[j].min, pseq->paramend[i] ); + g_pose[j].max = MAX( g_pose[j].max, pseq->paramstart[i] ); + g_pose[j].max = MAX( g_pose[j].max, pseq->paramend[i] ); } else if (stricmp("calcblend", token ) == 0) { diff --git a/utils/vbsp/ivp.cpp b/utils/vbsp/ivp.cpp index 727011ff..860fdca0 100644 --- a/utils/vbsp/ivp.cpp +++ b/utils/vbsp/ivp.cpp @@ -1081,7 +1081,7 @@ static void Flood_FindConnectedWaterVolumes_r( CUtlVector &list, node_ visited.Set( pLeaf->diskId ); list.AddToTail( pLeaf ); - baseleaf.minZ = min( pLeaf->mins.z, baseleaf.minZ ); + baseleaf.minZ = MIN( pLeaf->mins.z, baseleaf.minZ ); for (portal_t *p = pLeaf->portals ; p ; p = p->next[!oppositeNodeIndex]) { diff --git a/utils/vrad/incremental.cpp b/utils/vrad/incremental.cpp index 13b824ba..0d12d4bb 100644 --- a/utils/vrad/incremental.cpp +++ b/utils/vrad/incremental.cpp @@ -578,7 +578,7 @@ void CIncremental::AddLightsForActiveLights() // Copy the light information. pLight->m_Light = dl->light; - pLight->m_flMaxIntensity = max( dl->light.intensity[0], max( dl->light.intensity[1], dl->light.intensity[2] ) ); + pLight->m_flMaxIntensity = MAX( dl->light.intensity[0], MAX( dl->light.intensity[1], dl->light.intensity[2] ) ); } } @@ -613,8 +613,8 @@ bool CIncremental::LoadIncrementalFile() FileRead( fp, pLight->m_Light ); pLight->m_flMaxIntensity = - max( pLight->m_Light.intensity.x, - max( pLight->m_Light.intensity.y, pLight->m_Light.intensity.z ) ); + MAX( pLight->m_Light.intensity.x, + MAX( pLight->m_Light.intensity.y, pLight->m_Light.intensity.z ) ); int nFaces; FileRead( fp, nFaces ); diff --git a/utils/vrad/leaf_ambient_lighting.cpp b/utils/vrad/leaf_ambient_lighting.cpp index 2cf883fe..f689efb8 100644 --- a/utils/vrad/leaf_ambient_lighting.cpp +++ b/utils/vrad/leaf_ambient_lighting.cpp @@ -182,8 +182,8 @@ bool IsLeafAmbientSurfaceLight( dworldlight_t *wl ) if ( wl->style != 0 ) return false; - float intensity = max( wl->intensity[0], wl->intensity[1] ); - intensity = max( intensity, wl->intensity[2] ); + float intensity = MAX( wl->intensity[0], wl->intensity[1] ); + intensity = MAX( intensity, wl->intensity[2] ); return (intensity * g_flWorldLightMinEmitSurfaceDistanceRatio) < g_flWorldLightMinEmitSurface; } diff --git a/utils/vrad/lightmap.cpp b/utils/vrad/lightmap.cpp index e850007d..5dfc412d 100644 --- a/utils/vrad/lightmap.cpp +++ b/utils/vrad/lightmap.cpp @@ -93,8 +93,8 @@ int CNormalList::FindOrAddNormal( Vector const &vNormal ) for( int iDim=0; iDim < 3; iDim++ ) { gi[iDim] = (int)( ((vNormal[iDim] + 1.0f) * 0.5f) * NUM_SUBDIVS - 0.000001f ); - gi[iDim] = min( gi[iDim], NUM_SUBDIVS ); - gi[iDim] = max( gi[iDim], 0 ); + gi[iDim] = MIN( gi[iDim], NUM_SUBDIVS ); + gi[iDim] = MAX( gi[iDim], 0 ); } // Look for a matching vector in there. @@ -2356,18 +2356,18 @@ static void ComputeLightmapGradients( SampleInfo_t& info, bool const* pHasProces if (sample.t > 0) { - if (sample.s > 0) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-1-w] ) ); - gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-w] ) ); - if (sample.s < w-1) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+1-w] ) ); + if (sample.s > 0) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-1-w] ) ); + gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-w] ) ); + if (sample.s < w-1) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+1-w] ) ); } if (sample.t < h-1) { - if (sample.s > 0) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-1+w] ) ); - gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+w] ) ); - if (sample.s < w-1) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+1+w] ) ); + if (sample.s > 0) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-1+w] ) ); + gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+w] ) ); + if (sample.s < w-1) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+1+w] ) ); } - if (sample.s > 0) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-1] ) ); - if (sample.s < w-1) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+1] ) ); + if (sample.s > 0) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-1] ) ); + if (sample.s < w-1) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+1] ) ); } } } @@ -3015,18 +3015,18 @@ void BuildFacelightsOld(int facenum, int iThread) if (fl->sample[i].t > 0) { - if (fl->sample[i].s > 0) gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j-1-w] ) ); - gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j-w] ) ); - if (fl->sample[i].s < w-1) gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j+1-w] ) ); + if (fl->sample[i].s > 0) gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j-1-w] ) ); + gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j-w] ) ); + if (fl->sample[i].s < w-1) gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j+1-w] ) ); } if (fl->sample[i].t < h-1) { - if (fl->sample[i].s > 0) gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j-1+w] ) ); - gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j+w] ) ); - if (fl->sample[i].s < w-1) gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j+1+w] ) ); + if (fl->sample[i].s > 0) gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j-1+w] ) ); + gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j+w] ) ); + if (fl->sample[i].s < w-1) gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j+1+w] ) ); } - if (fl->sample[i].s > 0) gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j-1] ) ); - if (fl->sample[i].s < w-1) gradient[i] = max( gradient[i], fabs( sampled[j] - sampled[j+1] ) ); + if (fl->sample[i].s > 0) gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j-1] ) ); + if (fl->sample[i].s < w-1) gradient[i] = MAX( gradient[i], fabs( sampled[j] - sampled[j+1] ) ); } do_anotherpass = false; diff --git a/utils/vrad/radial.cpp b/utils/vrad/radial.cpp index 6e097893..5f23a7d2 100644 --- a/utils/vrad/radial.cpp +++ b/utils/vrad/radial.cpp @@ -62,19 +62,19 @@ void AddDirectToRadial( radial_t *rad, s_max = ( int )( coordmaxs[0] + 0.9999f ) + 1; // ???? t_max = ( int )( coordmaxs[1] + 0.9999f ) + 1; - s_min = max( s_min, 0 ); - t_min = max( t_min, 0 ); - s_max = min( s_max, rad->w ); - t_max = min( t_max, rad->h ); + s_min = MAX( s_min, 0 ); + t_min = MAX( t_min, 0 ); + s_max = MIN( s_max, rad->w ); + t_max = MIN( t_max, rad->h ); for( s = s_min; s < s_max; s++ ) { for( t = t_min; t < t_max; t++ ) { - float s0 = max( coordmins[0] - s, -1.0 ); - float t0 = max( coordmins[1] - t, -1.0 ); - float s1 = min( coordmaxs[0] - s, 1.0 ); - float t1 = min( coordmaxs[1] - t, 1.0 ); + float s0 = MAX( coordmins[0] - s, -1.0 ); + float t0 = MAX( coordmins[1] - t, -1.0 ); + float s1 = MIN( coordmaxs[0] - s, 1.0 ); + float t1 = MIN( coordmaxs[1] - t, 1.0 ); area = (s1 - s0) * (t1 - t0); @@ -83,7 +83,7 @@ void AddDirectToRadial( radial_t *rad, ds = fabs( coord[0] - s ); dt = fabs( coord[1] - t ); - r = max( ds, dt ); + r = MAX( ds, dt ); if (r < 0.1) { @@ -149,8 +149,8 @@ void AddBouncedToRadial( radial_t *rad, distt = (coordmaxs[1] - coordmins[1]); // patches less than a luxel in size could be mistakeningly filtered, so clamp. - dists = max( 1.0, dists ); - distt = max( 1.0, distt ); + dists = MAX( 1.0, dists ); + distt = MAX( 1.0, distt ); // find possible domain of patch influence s_min = ( int )( coord[0] - dists * RADIALDIST ); @@ -159,10 +159,10 @@ void AddBouncedToRadial( radial_t *rad, t_max = ( int )( coord[1] + distt * RADIALDIST + 1.0f ); // clamp to valid luxel - s_min = max( s_min, 0 ); - t_min = max( t_min, 0 ); - s_max = min( s_max, rad->w ); - t_max = min( t_max, rad->h ); + s_min = MAX( s_min, 0 ); + t_min = MAX( t_min, 0 ); + s_max = MIN( s_max, rad->w ); + t_max = MIN( t_max, rad->h ); for( s = s_min; s < s_max; s++ ) { @@ -222,10 +222,10 @@ void PatchLightmapCoordRange( radial_t *rad, int ndxPatch, Vector2D &mins, Vecto for (i = 0; i < w->numpoints; i++) { WorldToLuxelSpace( &rad->l, w->p[i], coord ); - mins[0] = min( mins[0], coord[0] ); - maxs[0] = max( maxs[0], coord[0] ); - mins[1] = min( mins[1], coord[1] ); - maxs[1] = max( maxs[1], coord[1] ); + mins[0] = MIN( mins[0], coord[0] ); + maxs[0] = MAX( maxs[0], coord[0] ); + mins[1] = MIN( mins[1], coord[1] ); + maxs[1] = MAX( maxs[1], coord[1] ); } } diff --git a/utils/vrad/samplehash.cpp b/utils/vrad/samplehash.cpp index c8163672..d098d1ae 100644 --- a/utils/vrad/samplehash.cpp +++ b/utils/vrad/samplehash.cpp @@ -187,9 +187,9 @@ void PatchSampleData_AddSample( patch_t *pPatch, int ndxPatch ) // Make sure mins are smaller than maxs so we don't iterate for 4 bil. Assert( patchSampleMins[0] <= patchSampleMaxs[0] && patchSampleMins[1] <= patchSampleMaxs[1] && patchSampleMins[2] <= patchSampleMaxs[2] ); - patchSampleMins[0] = min( patchSampleMins[0], patchSampleMaxs[0] ); - patchSampleMins[1] = min( patchSampleMins[1], patchSampleMaxs[1] ); - patchSampleMins[2] = min( patchSampleMins[2], patchSampleMaxs[2] ); + patchSampleMins[0] = MIN( patchSampleMins[0], patchSampleMaxs[0] ); + patchSampleMins[1] = MIN( patchSampleMins[1], patchSampleMaxs[1] ); + patchSampleMins[2] = MIN( patchSampleMins[2], patchSampleMaxs[2] ); int iterateCoords[3]; for ( iterateCoords[0]=patchSampleMins[0]; iterateCoords[0] <= patchSampleMaxs[0]; iterateCoords[0]++ ) diff --git a/utils/vrad/vrad.cpp b/utils/vrad/vrad.cpp index ff91b968..42886dd7 100644 --- a/utils/vrad/vrad.cpp +++ b/utils/vrad/vrad.cpp @@ -240,7 +240,7 @@ void ReadLightFile (char *filename) texlights[j].filename = filename; file_texlights++; - num_texlights = max( num_texlights, j+1 ); + num_texlights = MAX( num_texlights, j+1 ); } qprintf ("[%i texlights parsed from '%s']\n\n", file_texlights, filename); @@ -775,7 +775,7 @@ int CreateChildPatch( int nParentIndex, winding_t *pWinding, float flArea, const if ( (child->face_maxs[i] == child->maxs[i] || child->face_mins[i] == child->mins[i] ) && total[i] > minchop ) { - child->chop = max( minchop, child->chop / 2 ); + child->chop = MAX( minchop, child->chop / 2 ); break; } } @@ -835,7 +835,7 @@ void SubdividePatch( int ndxPatch ) if (patch->chop > minchop) { bSubdivide = true; - patch->chop = max( minchop, patch->chop / 2 ); + patch->chop = MAX( minchop, patch->chop / 2 ); } } } @@ -2369,7 +2369,7 @@ int ParseCommandLine( int argc, char **argv, bool *onlydetail ) Warning("Error: expected positive value after '-chop'\n" ); return 1; } - minchop = min( minchop, maxchop ); + minchop = MIN( minchop, maxchop ); } else { diff --git a/utils/xwad/xwad.cpp b/utils/xwad/xwad.cpp index 3d87176d..d51f4c2b 100644 --- a/utils/xwad/xwad.cpp +++ b/utils/xwad/xwad.cpp @@ -500,7 +500,7 @@ void RunVTexOnFile( const char *pBaseDir, const char *pFilename ) char executableDir[MAX_PATH]; GetModuleFileName( NULL, executableDir, sizeof( executableDir ) ); - char *pLastSlash = max( strrchr( executableDir, '/' ), strrchr( executableDir, '\\' ) ); + char *pLastSlash = MAX( strrchr( executableDir, '/' ), strrchr( executableDir, '\\' ) ); if ( !pLastSlash ) Error( "Can't find filename in '%s'.\n", executableDir ); diff --git a/vgui2/controls/BitmapImagePanel.cpp b/vgui2/controls/BitmapImagePanel.cpp index de225559..67d271d5 100644 --- a/vgui2/controls/BitmapImagePanel.cpp +++ b/vgui2/controls/BitmapImagePanel.cpp @@ -17,7 +17,7 @@ #include "tier0/memdbgon.h" #ifndef min -#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif using namespace vgui; @@ -89,7 +89,7 @@ void CBitmapImagePanel::ComputeImagePosition(int &x, int &y, int &w, int &h) { float xScale = (float)panelWide / (float)imageWide; float yScale = (float)panelTall / (float)imageTall; - float scale = min( xScale, yScale ); + float scale = MIN( xScale, yScale ); w = (int) (imageWide * scale); h = (int) (imageTall * scale); diff --git a/vgui2/controls/BuildGroup.cpp b/vgui2/controls/BuildGroup.cpp index 6ccbe31d..601dd61f 100644 --- a/vgui2/controls/BuildGroup.cpp +++ b/vgui2/controls/BuildGroup.cpp @@ -309,8 +309,8 @@ bool BuildGroup::CursorMoved(int x, int y, Panel *panel) if (_dragMouseCode == MOUSE_RIGHT) { - int newW = max( 1, _dragStartPanelSize[ 0 ] + x - _dragStartCursorPos[0] ); - int newH = max( 1, _dragStartPanelSize[ 1 ] + y - _dragStartCursorPos[1] ); + int newW = MAX( 1, _dragStartPanelSize[ 0 ] + x - _dragStartCursorPos[0] ); + int newH = MAX( 1, _dragStartPanelSize[ 1 ] + y - _dragStartCursorPos[1] ); bool shift = ( input()->IsKeyDown(KEY_LSHIFT) || input()->IsKeyDown(KEY_RSHIFT) ); bool ctrl = ( input()->IsKeyDown(KEY_LCONTROL) || input()->IsKeyDown(KEY_RCONTROL) ); diff --git a/vgui2/controls/ComboBox.cpp b/vgui2/controls/ComboBox.cpp index 66d7984f..e6b7950e 100644 --- a/vgui2/controls/ComboBox.cpp +++ b/vgui2/controls/ComboBox.cpp @@ -304,7 +304,7 @@ void ComboBox::PerformLayout() HFont buttonFont = m_pButton->GetFont(); int fontTall = surface()->GetFontTall( buttonFont ); - int buttonSize = min( tall, fontTall ); + int buttonSize = MIN( tall, fontTall ); int buttonY = ( ( tall - 1 ) - buttonSize ) / 2; diff --git a/vgui2/controls/Frame.cpp b/vgui2/controls/Frame.cpp index a646084d..f37f425a 100644 --- a/vgui2/controls/Frame.cpp +++ b/vgui2/controls/Frame.cpp @@ -2135,8 +2135,8 @@ void Frame::OnScreenSizeChanged(int iOldWide, int iOldTall) } // make sure the top-left is visible - x = max( 0, x ); - y = max( 0, y ); + x = MAX( 0, x ); + y = MAX( 0, y ); // apply SetPos(x, y); diff --git a/vgui2/controls/Label.cpp b/vgui2/controls/Label.cpp index dc96b927..2891a4c6 100644 --- a/vgui2/controls/Label.cpp +++ b/vgui2/controls/Label.cpp @@ -28,7 +28,7 @@ using namespace vgui; #ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif DECLARE_BUILD_FACTORY_DEFAULT_TEXT( Label, Label ); @@ -133,7 +133,7 @@ void Label::GetContentSize(int &wide, int &tall) for (int i=0; i < _imageDar.Size(); i++) wide += _imageDar[i].offset; - tall = max((ty1 - ty0) + _textInset[1], iTall); + tall = MAX((ty1 - ty0) + _textInset[1], iTall); } //----------------------------------------------------------------------------- @@ -380,7 +380,7 @@ void Label::ComputeAlignment(int &tx0, int &ty0, int &tx1, int &ty1) actualXAlignment = Label::a_west; // get the max height - maxY = max(maxY, iTall); + maxY = MAX(maxY, iTall); maxX += iWide; // add the offset to x diff --git a/vgui2/controls/ListPanel.cpp b/vgui2/controls/ListPanel.cpp index f0480dfa..f277b509 100644 --- a/vgui2/controls/ListPanel.cpp +++ b/vgui2/controls/ListPanel.cpp @@ -44,11 +44,11 @@ enum #ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif #ifndef clamp @@ -1087,7 +1087,7 @@ void ListPanel::IndexItem(int itemID) FastSortListPanelItem *newitem = (FastSortListPanelItem*) m_DataItems[itemID]; // remove the item from the indexes and re-add - int maxCount = min(m_ColumnsHistory.Count(), newitem->m_SortedTreeIndexes.Count()); + int maxCount = MIN(m_ColumnsHistory.Count(), newitem->m_SortedTreeIndexes.Count()); for (int i = 0; i < maxCount; i++) { IndexRBTree_t &rbtree = m_ColumnsData[m_ColumnsHistory[i]].m_SortedTree; @@ -1458,7 +1458,7 @@ Panel *ListPanel::GetCellRenderer(int itemID, int col) // set cell size Panel *header = column.m_pHeader; int wide = header->GetWide(); - m_pTextImage->SetSize( min( cw, wide - 5 ), tall); + m_pTextImage->SetSize( MIN( cw, wide - 5 ), tall); m_pLabel->SetTextImageIndex( 0 ); m_pLabel->SetImageAtIndex(0, m_pTextImage, 3); @@ -1951,7 +1951,7 @@ void ListPanel::Paint() render->SetPos( xpos, (drawcount * m_iRowHeight) + m_iTableStartY); - int right = min( xpos + wide, maxw ); + int right = MIN( xpos + wide, maxw ); int usew = right - xpos; render->SetSize( usew, m_iRowHeight - 1 ); diff --git a/vgui2/controls/Menu.cpp b/vgui2/controls/Menu.cpp index 0971eab2..19008e24 100644 --- a/vgui2/controls/Menu.cpp +++ b/vgui2/controls/Menu.cpp @@ -788,7 +788,7 @@ void Menu::PerformLayout() AddScrollBar(); // This fills in m_VisibleSortedItems as needed - MakeItemsVisibleInScrollRange( m_iNumVisibleLines, min( fullHeightWouldRequire, workTall ) ); + MakeItemsVisibleInScrollRange( m_iNumVisibleLines, MIN( fullHeightWouldRequire, workTall ) ); } else { @@ -1700,7 +1700,7 @@ void Menu::ApplySchemeSettings(IScheme *pScheme) int wide, tall; m_MenuItems[i]->GetCheckImageSize( wide, tall ); - m_iCheckImageWidth = max ( m_iCheckImageWidth, wide ); + m_iCheckImageWidth = MAX ( m_iCheckImageWidth, wide ); } } _recalculateWidth = true; diff --git a/vgui2/controls/MenuItem.cpp b/vgui2/controls/MenuItem.cpp index 8837e22f..ad00a722 100644 --- a/vgui2/controls/MenuItem.cpp +++ b/vgui2/controls/MenuItem.cpp @@ -643,5 +643,5 @@ void MenuItem::GetContentSize( int& cw, int &ch ) m_pCurrentKeyBinding->GetSize( iw, ih ); cw += iw + KEYBINDING_INSET; - ch = max( ch, ih ); + ch = MAX( ch, ih ); } diff --git a/vgui2/controls/MessageBox.cpp b/vgui2/controls/MessageBox.cpp index 368ac2b8..7e536f59 100644 --- a/vgui2/controls/MessageBox.cpp +++ b/vgui2/controls/MessageBox.cpp @@ -20,7 +20,7 @@ using namespace vgui; #ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif vgui::Panel *MessageBox_Factory() @@ -236,8 +236,8 @@ void MessageBox::PerformLayout() int btnWide, btnTall; m_pOkButton->GetContentSize(btnWide, btnTall); - btnWide = max(oldWide, btnWide + 10); - btnTall = max(oldTall, btnTall + 10); + btnWide = MAX(oldWide, btnWide + 10); + btnTall = MAX(oldTall, btnTall + 10); m_pOkButton->SetSize(btnWide, btnTall); int btnWide2 = 0, btnTall2 = 0; @@ -246,13 +246,13 @@ void MessageBox::PerformLayout() m_pCancelButton->GetSize(oldWide, oldTall); m_pCancelButton->GetContentSize(btnWide2, btnTall2); - btnWide2 = max(oldWide, btnWide2 + 10); - btnTall2 = max(oldTall, btnTall2 + 10); + btnWide2 = MAX(oldWide, btnWide2 + 10); + btnTall2 = MAX(oldTall, btnTall2 + 10); m_pCancelButton->SetSize(btnWide2, btnTall2); } - boxWidth = max(boxWidth, m_pMessageLabel->GetWide() + 100); - boxWidth = max(boxWidth, (btnWide + btnWide2) * 2 + 30); + boxWidth = MAX(boxWidth, m_pMessageLabel->GetWide() + 100); + boxWidth = MAX(boxWidth, (btnWide + btnWide2) * 2 + 30); SetSize(boxWidth, boxTall); GetSize(boxWidth, boxTall); diff --git a/vgui2/controls/Panel.cpp b/vgui2/controls/Panel.cpp index 5fc02503..05db3ab8 100644 --- a/vgui2/controls/Panel.cpp +++ b/vgui2/controls/Panel.cpp @@ -6125,8 +6125,8 @@ void Panel::OnDraggablePanelPaint() input()->GetCursorPos( x, y ); int w, h; - w = min( sw, 80 ); - h = min( sh, 80 ); + w = MIN( sw, 80 ); + h = MIN( sh, 80 ); x -= ( w >> 1 ); y -= ( h >> 1 ); diff --git a/vgui2/controls/ProgressBox.cpp b/vgui2/controls/ProgressBox.cpp index e90a0c92..ac02733f 100644 --- a/vgui2/controls/ProgressBox.cpp +++ b/vgui2/controls/ProgressBox.cpp @@ -26,7 +26,7 @@ using namespace vgui; #ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif //----------------------------------------------------------------------------- diff --git a/vgui2/controls/PropertySheet.cpp b/vgui2/controls/PropertySheet.cpp index 633358d0..63ea2322 100644 --- a/vgui2/controls/PropertySheet.cpp +++ b/vgui2/controls/PropertySheet.cpp @@ -310,7 +310,7 @@ public: GetSize(wide, tall); GetContentSize(contentWide, contentTall); - wide = max(m_bMaxTabWidth, contentWide + 10); // 10 = 5 pixels margin on each side + wide = MAX(m_bMaxTabWidth, contentWide + 10); // 10 = 5 pixels margin on each side wide += m_pContextLabel ? 10 : 0; SetSize(wide, tall); } @@ -1022,7 +1022,7 @@ void PropertySheet::RemovePage(Panel *panel) { _activePage = NULL; // if this page is currently active, backup to the page before this. - ChangeActiveTab( max( location - 1, 0 ) ); + ChangeActiveTab( MAX( location - 1, 0 ) ); } PerformLayout(); diff --git a/vgui2/controls/QueryBox.cpp b/vgui2/controls/QueryBox.cpp index c218bedf..005eea5b 100644 --- a/vgui2/controls/QueryBox.cpp +++ b/vgui2/controls/QueryBox.cpp @@ -17,7 +17,7 @@ #include #ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif using namespace vgui; @@ -91,13 +91,13 @@ void QueryBox::PerformLayout() int btnWide, btnTall; m_pCancelButton->GetContentSize(btnWide, btnTall); - btnWide = max(oldWide, btnWide + 10); - btnTall = max(oldTall, btnTall + 10); + btnWide = MAX(oldWide, btnWide + 10); + btnTall = MAX(oldTall, btnTall + 10); m_pCancelButton->SetSize(btnWide, btnTall); //nt boxWidth, boxTall; GetSize(boxWidth, boxTall); -// wide = max(wide, btnWide * 2 + 100); +// wide = MAX(wide, btnWide * 2 + 100); // SetSize(wide, tall); m_pOkButton->SetPos((wide/2)-(m_pOkButton->GetWide())-1 + x, tall - m_pOkButton->GetTall() - 15); diff --git a/vgui2/controls/RichText.cpp b/vgui2/controls/RichText.cpp index ccb8d6bc..45fe0433 100644 --- a/vgui2/controls/RichText.cpp +++ b/vgui2/controls/RichText.cpp @@ -20,7 +20,7 @@ enum using namespace vgui; #ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif namespace vgui diff --git a/vgui2/controls/TextEntry.cpp b/vgui2/controls/TextEntry.cpp index 0e8fe76a..9569be1c 100644 --- a/vgui2/controls/TextEntry.cpp +++ b/vgui2/controls/TextEntry.cpp @@ -3493,7 +3493,7 @@ void TextEntry::GetText(wchar_t *wbuf, int bufLenInBytes) int len = m_TextStream.Count(); if (m_TextStream.Count()) { - int terminator = min(len, (bufLenInBytes / (int)sizeof(wchar_t)) - 1); + int terminator = MIN(len, (bufLenInBytes / (int)sizeof(wchar_t)) - 1); wcsncpy(wbuf, m_TextStream.Base(), terminator); wbuf[terminator] = 0; } diff --git a/vgui2/controls/TreeView.cpp b/vgui2/controls/TreeView.cpp index 75cd41f5..84a64ad8 100644 --- a/vgui2/controls/TreeView.cpp +++ b/vgui2/controls/TreeView.cpp @@ -35,7 +35,7 @@ #include #ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif using namespace vgui; @@ -883,7 +883,7 @@ void TreeNode::CalculateVisibleMaxWidth() int childMaxWidth = GetMaxChildrenWidth(); childMaxWidth += TREE_INDENT_AMOUNT; - width = max(childMaxWidth, m_iNodeWidth); + width = MAX(childMaxWidth, m_iNodeWidth); } else { diff --git a/vgui2/controls/TreeViewListControl.cpp b/vgui2/controls/TreeViewListControl.cpp index 2a039a14..a500ce98 100644 --- a/vgui2/controls/TreeViewListControl.cpp +++ b/vgui2/controls/TreeViewListControl.cpp @@ -301,7 +301,7 @@ void CTreeViewListControl::DrawTitleBars() } else { - int textRight = min( right, rightEdge ); + int textRight = MIN( right, rightEdge ); int midx = (left+textRight)/2; int midy = (top+bottom)/2;