diff --git a/common/studiobyteswap.cpp b/common/studiobyteswap.cpp index fe178566..a49d094d 100644 --- a/common/studiobyteswap.cpp +++ b/common/studiobyteswap.cpp @@ -890,8 +890,8 @@ void ByteswapAnimData( mstudioanimdesc_t *pAnimDesc, int section, byte *&pDataSr int iStartFrame = section * sectionFrames; int iEndFrame = (section + 1) * sectionFrames; - iStartFrame = min( iStartFrame, totalFrames - 1 ); - iEndFrame = min( iEndFrame, totalFrames - 1 ); + iStartFrame = MIN( iStartFrame, totalFrames - 1 ); + iEndFrame = MIN( iEndFrame, totalFrames - 1 ); totalFrames = iEndFrame - iStartFrame + 1; } diff --git a/game/client/achievement_notification_panel.cpp b/game/client/achievement_notification_panel.cpp index 879d9d9e..cb0b10cc 100644 --- a/game/client/achievement_notification_panel.cpp +++ b/game/client/achievement_notification_panel.cpp @@ -215,9 +215,9 @@ void CAchievementNotificationPanel::ShowNextNotification() int iHeadingWidth = UTIL_ComputeStringWidth( hFontHeading, notification.szHeading ); int iTitleWidth = UTIL_ComputeStringWidth( hFontTitle, notification.szTitle ); // use the widest string - int iTextWidth = max( iHeadingWidth, iTitleWidth ); + int iTextWidth = MAX( iHeadingWidth, iTitleWidth ); // don't let it be insanely wide - iTextWidth = min( iTextWidth, XRES( 300 ) ); + iTextWidth = MIN( iTextWidth, XRES( 300 ) ); int iIconWidth = m_pIcon->GetWide(); int iSpacing = XRES( 10 ); int iPanelWidth = iSpacing + iIconWidth + iSpacing + iTextWidth + iSpacing; diff --git a/game/client/beamdraw.cpp b/game/client/beamdraw.cpp index eb8accb2..3c0e11b7 100644 --- a/game/client/beamdraw.cpp +++ b/game/client/beamdraw.cpp @@ -251,7 +251,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/game/client/c_baseanimating.cpp b/game/client/c_baseanimating.cpp index a639f82a..f063de6e 100644 --- a/game/client/c_baseanimating.cpp +++ b/game/client/c_baseanimating.cpp @@ -520,7 +520,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 ); @@ -998,7 +998,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 ); @@ -2146,7 +2146,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) ); @@ -4609,7 +4609,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; } @@ -4841,7 +4841,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/game/client/c_baseentity.cpp b/game/client/c_baseentity.cpp index 1dcde22a..da13a09a 100644 --- a/game/client/c_baseentity.cpp +++ b/game/client/c_baseentity.cpp @@ -686,8 +686,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 ); } } @@ -5093,7 +5093,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/game/client/c_baseflex.cpp b/game/client/c_baseflex.cpp index 0108410a..5fb4e534 100644 --- a/game/client/c_baseflex.cpp +++ b/game/client/c_baseflex.cpp @@ -688,7 +688,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; } } @@ -705,7 +705,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; } } @@ -874,7 +874,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() ) ); } } } @@ -1879,16 +1879,16 @@ void C_BaseFlex::AddFlexAnimation( CSceneEventInfo *info ) Q_strncpy( name, "right_" ,sizeof(name)); Q_strncat( name, track->GetFlexControllerName(),sizeof(name), COPY_ALL_CHARACTERS ); - track->SetFlexControllerIndex( max( FindFlexController( name ), LocalFlexController_t(0) ), 0, 0 ); + track->SetFlexControllerIndex( MAX( FindFlexController( name ), LocalFlexController_t(0) ), 0, 0 ); Q_strncpy( name, "left_" ,sizeof(name)); Q_strncat( name, track->GetFlexControllerName(),sizeof(name), COPY_ALL_CHARACTERS ); - track->SetFlexControllerIndex( max( FindFlexController( name ), LocalFlexController_t(0) ), 0, 1 ); + track->SetFlexControllerIndex( MAX( FindFlexController( name ), LocalFlexController_t(0) ), 0, 1 ); } else { - track->SetFlexControllerIndex( max( FindFlexController( (char *)track->GetFlexControllerName() ), LocalFlexController_t(0)), 0 ); + track->SetFlexControllerIndex( MAX( FindFlexController( (char *)track->GetFlexControllerName() ), LocalFlexController_t(0)), 0 ); } } @@ -1963,7 +1963,7 @@ 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/game/client/c_effects.cpp b/game/client/c_effects.cpp index 6932bbe9..98bd632c 100644 --- a/game/client/c_effects.cpp +++ b/game/client/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/game/client/c_entitydissolve.cpp b/game/client/c_entitydissolve.cpp index ff4294b8..4bb87ad8 100644 --- a/game/client/c_entitydissolve.cpp +++ b/game/client/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/game/client/c_func_dust.cpp b/game/client/c_func_dust.cpp index 0b96cc99..ab6ac43a 100644 --- a/game/client/c_func_dust.cpp +++ b/game/client/c_func_dust.cpp @@ -186,7 +186,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/game/client/c_impact_effects.cpp b/game/client/c_impact_effects.cpp index 52ca26d0..d7c80cb0 100644 --- a/game/client/c_impact_effects.cpp +++ b/game/client/c_impact_effects.cpp @@ -165,7 +165,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 ); @@ -216,9 +216,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; } } @@ -288,9 +288,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); @@ -324,9 +324,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; @@ -386,9 +386,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, g_Mat_DustPuff[0] ); } @@ -420,9 +420,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, g_Mat_BloodPuff[0] ); } @@ -454,9 +454,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, g_Mat_DustPuff[0] ); @@ -564,9 +564,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, g_Mat_BloodPuff[0] ); } @@ -597,9 +597,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, g_Mat_DustPuff[0] ); } @@ -738,9 +738,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; } @@ -1008,9 +1008,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); @@ -1051,9 +1051,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; @@ -1112,9 +1112,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, float flScale ) 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 = ( unsigned char )( flScale * random->RandomInt( 3, 4 ) * (i+1) ); @@ -1151,9 +1151,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, float flScale ) 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; @@ -1193,9 +1193,9 @@ void FX_DustImpact( const Vector &origin, trace_t *tr, float flScale ) 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/game/client/c_particle_smokegrenade.cpp b/game/client/c_particle_smokegrenade.cpp index 73e841e1..231f82a7 100644 --- a/game/client/c_particle_smokegrenade.cpp +++ b/game/client/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/game/client/c_pixel_visibility.cpp b/game/client/c_pixel_visibility.cpp index df62360b..9fbfb3ad 100644 --- a/game/client/c_pixel_visibility.cpp +++ b/game/client/c_pixel_visibility.cpp @@ -38,7 +38,7 @@ float PixelVisibility_DrawProxy( IMatRenderContext *pRenderContext, OcclusionQue float forwardScale = scale; // draw a pyramid of points touching a sphere of radius "scale" at origin float pixelsPerUnit = pRenderContext->ComputePixelDiameterOfSphere( 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) @@ -87,8 +87,8 @@ float PixelVisibility_DrawProxy( IMatRenderContext *pRenderContext, OcclusionQue // 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/game/client/c_plasma.cpp b/game/client/c_plasma.cpp index f9bf76b1..3ddb6629 100644 --- a/game/client/c_plasma.cpp +++ b/game/client/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/game/client/c_rope.cpp b/game/client/c_rope.cpp index 8a562090..76ed213f 100644 --- a/game/client/c_rope.cpp +++ b/game/client/c_rope.cpp @@ -899,7 +899,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 ); } } @@ -913,7 +913,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 ); } } @@ -1643,7 +1643,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData, const Vector &vCurr // Right here, we need to specify a width that will be 1 pixel larger in screen space. float zCoord = vCurrentViewForward.Dot( pSegmentData->m_Segments[iSegment].m_vPos - vCurrentViewOrigin ); - zCoord = max( zCoord, 0.1f ); + zCoord = MAX( zCoord, 0.1f ); float flScreenSpaceWidth = m_Width * flHalfScreenWidth / zCoord; if ( flScreenSpaceWidth < flMinScreenSpaceWidth ) @@ -1671,7 +1671,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData, const Vector &vCurr } else { - pSegmentData->m_flMaxBackWidth = max( pSegmentData->m_flMaxBackWidth, pSegmentData->m_BackWidths[iSegment] ); + pSegmentData->m_flMaxBackWidth = MAX( pSegmentData->m_flMaxBackWidth, pSegmentData->m_BackWidths[iSegment] ); } } @@ -1897,12 +1897,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/game/client/c_sceneentity.cpp b/game/client/c_sceneentity.cpp index 10f65024..63f1467e 100644 --- a/game/client/c_sceneentity.cpp +++ b/game/client/c_sceneentity.cpp @@ -625,7 +625,7 @@ void C_SceneEntity::DispatchStartSpeak( CChoreoScene *scene, C_BaseFlex *actor, float endtime = event->GetLastSlaveEndTime(); float durationShort = event->GetDuration(); float durationLong = endtime - event->GetStartTime(); - float duration = max( durationShort, durationLong ); + float duration = MAX( durationShort, durationLong ); CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption ); if ( hudCloseCaption ) diff --git a/game/client/c_slideshow_display.cpp b/game/client/c_slideshow_display.cpp index 71a995f8..8d520dd5 100644 --- a/game/client/c_slideshow_display.cpp +++ b/game/client/c_slideshow_display.cpp @@ -213,7 +213,7 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void ) return; } - int iFileSize = min( g_pFullFileSystem->Size( fh ), SLIDESHOW_LIST_BUFFER_MAX ); + int iFileSize = MIN( g_pFullFileSystem->Size( fh ), SLIDESHOW_LIST_BUFFER_MAX ); int iBytesRead = g_pFullFileSystem->Read( szFileBuffer, iFileSize, fh ); g_pFullFileSystem->Close( fh ); diff --git a/game/client/c_smoke_trail.cpp b/game/client/c_smoke_trail.cpp index f30c4e49..defa57b4 100644 --- a/game/client/c_smoke_trail.cpp +++ b/game/client/c_smoke_trail.cpp @@ -323,7 +323,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]; @@ -1839,7 +1839,7 @@ void C_DustTrail::Update( float fTimeDelta ) VectorMA( pParticle->m_vecVelocity, flDirectedVel, vecForward, pParticle->m_vecVelocity ); offsetColor = m_Color; - float flMaxVal = max( m_Color[0], m_Color[1] ); + float flMaxVal = MAX( m_Color[0], m_Color[1] ); if ( flMaxVal < m_Color[2] ) { flMaxVal = m_Color[2]; diff --git a/game/client/c_sprite.cpp b/game/client/c_sprite.cpp index ee64f006..5f24bd38 100644 --- a/game/client/c_sprite.cpp +++ b/game/client/c_sprite.cpp @@ -485,7 +485,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/game/client/c_steamjet.cpp b/game/client/c_steamjet.cpp index 0b1a28b0..4c011efd 100644 --- a/game/client/c_steamjet.cpp +++ b/game/client/c_steamjet.cpp @@ -177,7 +177,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) ); } @@ -239,7 +239,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 { @@ -403,9 +403,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); @@ -514,7 +514,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/game/client/c_sun.cpp b/game/client/c_sun.cpp index d039e041..1f99ed5d 100644 --- a/game/client/c_sun.cpp +++ b/game/client/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/game/client/c_te_legacytempents.cpp b/game/client/c_te_legacytempents.cpp index 6ec9423f..ef4c6675 100644 --- a/game/client/c_te_legacytempents.cpp +++ b/game/client/c_te_legacytempents.cpp @@ -205,8 +205,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 ); } } @@ -2210,11 +2210,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/game/client/cdll_bounded_cvars.cpp b/game/client/cdll_bounded_cvars.cpp index a3f09dec..15385526 100644 --- a/game/client/cdll_bounded_cvars.cpp +++ b/game/client/cdll_bounded_cvars.cpp @@ -110,7 +110,7 @@ public: static const ConVar *pMin = dynamic_cast< const ConVar* >( g_pCVar->FindCommandBase( "sv_client_min_interp_ratio" ) ); if ( pUpdateRate && pMin && pMin->GetFloat() != -1 ) { - return max( GetBaseFloatValue(), pMin->GetFloat() / pUpdateRate->GetFloat() ); + return MAX( GetBaseFloatValue(), pMin->GetFloat() / pUpdateRate->GetFloat() ); } else { @@ -128,7 +128,7 @@ float GetClientInterpAmount() if ( pUpdateRate ) { // #define FIXME_INTERP_RATIO - return max( cl_interp->GetFloat(), cl_interp_ratio->GetFloat() / pUpdateRate->GetFloat() ); + return MAX( cl_interp->GetFloat(), cl_interp_ratio->GetFloat() / pUpdateRate->GetFloat() ); } else { diff --git a/game/client/clientleafsystem.cpp b/game/client/clientleafsystem.cpp index 1d81f74b..9ff7a28f 100644 --- a/game/client/clientleafsystem.cpp +++ b/game/client/clientleafsystem.cpp @@ -360,8 +360,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; @@ -420,8 +420,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 ); } @@ -1618,7 +1618,7 @@ void CClientLeafSystem::CollateRenderablesInLeaf( int leaf, int worldListLeafInd Vector dims; VectorSubtract( absMaxs, absMins, dims ); - float const fDimension = max( max( fabs(dims.x), fabs(dims.y) ), fabs(dims.z) ); + float const fDimension = MAX( MAX( fabs(dims.x), fabs(dims.y) ), fabs(dims.z) ); group = DetectBucketedRenderGroup( group, fDimension ); Assert( group >= RENDER_GROUP_OPAQUE_STATIC_HUGE && group <= RENDER_GROUP_OPAQUE_ENTITY ); diff --git a/game/client/clientshadowmgr.cpp b/game/client/clientshadowmgr.cpp index f57a38cb..e63ae3e6 100644 --- a/game/client/clientshadowmgr.cpp +++ b/game/client/clientshadowmgr.cpp @@ -1596,8 +1596,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/game/client/commentary_modelviewer.cpp b/game/client/commentary_modelviewer.cpp index a6598753..caefcf48 100644 --- a/game/client/commentary_modelviewer.cpp +++ b/game/client/commentary_modelviewer.cpp @@ -180,7 +180,7 @@ void CCommentaryModelViewer::HandleMovementInput( void ) { m_flYawSpeed = 0; } - m_flYawSpeed = max(m_flYawSpeed-flAccel, -3.0); + m_flYawSpeed = MAX(m_flYawSpeed-flAccel, -3.0); } else if ( bRightDown ) { @@ -188,7 +188,7 @@ void CCommentaryModelViewer::HandleMovementInput( void ) { m_flYawSpeed = 0; } - m_flYawSpeed = min(m_flYawSpeed+flAccel, 3.0); + m_flYawSpeed = MIN(m_flYawSpeed+flAccel, 3.0); } if ( m_flYawSpeed != 0 ) { @@ -203,7 +203,7 @@ void CCommentaryModelViewer::HandleMovementInput( void ) if ( !bLeftDown && !bRightDown ) { - m_flYawSpeed = ( m_flYawSpeed > 0 ) ? max(0,m_flYawSpeed-0.1) : min(0,m_flYawSpeed+0.1); + m_flYawSpeed = ( m_flYawSpeed > 0 ) ? MAX(0,m_flYawSpeed-0.1) : MIN(0,m_flYawSpeed+0.1); } } @@ -214,7 +214,7 @@ void CCommentaryModelViewer::HandleMovementInput( void ) { m_flZoomSpeed = 0; } - m_flZoomSpeed = max(m_flZoomSpeed-flAccel, -3.0); + m_flZoomSpeed = MAX(m_flZoomSpeed-flAccel, -3.0); } else if ( bBackDown ) { @@ -222,7 +222,7 @@ void CCommentaryModelViewer::HandleMovementInput( void ) { m_flZoomSpeed = 0; } - m_flZoomSpeed = min(m_flZoomSpeed+flAccel, 3.0); + m_flZoomSpeed = MIN(m_flZoomSpeed+flAccel, 3.0); } if ( m_flZoomSpeed != 0 ) { @@ -239,7 +239,7 @@ void CCommentaryModelViewer::HandleMovementInput( void ) if ( !bForwardDown && !bBackDown ) { - m_flZoomSpeed = ( m_flZoomSpeed > 0 ) ? max(0,m_flZoomSpeed-0.1) : min(0,m_flZoomSpeed+0.1); + m_flZoomSpeed = ( m_flZoomSpeed > 0 ) ? MAX(0,m_flZoomSpeed-0.1) : MIN(0,m_flZoomSpeed+0.1); } } } diff --git a/game/client/death.cpp b/game/client/death.cpp index d1b76bfb..480ffe5e 100644 --- a/game/client/death.cpp +++ b/game/client/death.cpp @@ -145,7 +145,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/game/client/detailobjectsystem.cpp b/game/client/detailobjectsystem.cpp index 82115bce..16cf4631 100644 --- a/game/client/detailobjectsystem.cpp +++ b/game/client/detailobjectsystem.cpp @@ -1518,8 +1518,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 { @@ -1678,8 +1678,8 @@ void CDetailObjectSystem::ScanForCounts( CUtlBuffer& buf, { // need to pad nfast to next sse boundary nFast += ( 0 - nFast ) & 3; - nMaxFast = max( nMaxFast, nNumFastInLeaf ); - nMaxOld = max( nMaxOld, nNumOldInLeaf ); + nMaxFast = MAX( nMaxFast, nNumFastInLeaf ); + nMaxOld = MAX( nMaxOld, nNumOldInLeaf ); nNumOldInLeaf = 0; nNumFastInLeaf = 0; detailObjectLeaf = lump.m_Leaf; @@ -1700,8 +1700,8 @@ void CDetailObjectSystem::ScanForCounts( CUtlBuffer& buf, // need to pad nfast to next sse boundary nFast += ( 0 - nFast ) & 3; - nMaxFast = max( nMaxFast, nNumFastInLeaf ); - nMaxOld = max( nMaxOld, nNumOldInLeaf ); + nMaxFast = MAX( nMaxFast, nNumFastInLeaf ); + nMaxOld = MAX( nMaxOld, nNumOldInLeaf ); buf.SeekGet( CUtlBuffer::SEEK_HEAD, oldpos ); *pNumFastSpritesToAllocate = nFast; @@ -1987,7 +1987,7 @@ int CDetailObjectSystem::CountFastSpritesInLeafList( int nLeafCount, LeafIndex_t if ( pData ) { nCount += pData->m_nNumSprites; - nMax = max( nMax, pData->m_nNumSprites ); + nMax = MAX( nMax, pData->m_nNumSprites ); } } *nMaxFoundInLeaf = ( nMax + 3 ) & ~3; // round up @@ -2265,7 +2265,7 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec nMaxQuadsToDraw = nMaxVerts / 4; } - int nQuadsToDraw = min( nQuadCount, nMaxQuadsToDraw ); + int nQuadsToDraw = MIN( nQuadCount, nMaxQuadsToDraw ); int nQuadsRemaining = nQuadsToDraw; meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); @@ -2303,7 +2303,7 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec nQuadsRemaining = nQuadsToDraw; meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); } - int nToDraw = min( nCount, nQuadsRemaining ); + int nToDraw = MIN( nCount, nQuadsRemaining ); nCount -= nToDraw; nQuadsRemaining -= nToDraw; while( nToDraw-- ) @@ -2510,7 +2510,7 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector nMaxQuadsToDraw = nMaxVerts / 4; } - int nQuadsToDraw = min( nCount, nMaxQuadsToDraw ); + int nQuadsToDraw = MIN( nCount, nMaxQuadsToDraw ); int nQuadsRemaining = nQuadsToDraw; meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); @@ -2529,7 +2529,7 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector nQuadsRemaining = nQuadsToDraw; meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); } - int nToDraw = min( nCount, nQuadsRemaining ); + int nToDraw = MIN( nCount, nQuadsRemaining ); nCount -= nToDraw; nQuadsRemaining -= nToDraw; while( nToDraw-- ) @@ -2783,7 +2783,7 @@ void CDetailObjectSystem::BuildDetailObjectRenderLists( const Vector &vViewOrigi { m_flCurFadeSqDist = 0; } - m_flCurFadeSqDist = min( m_flCurFadeSqDist, m_flCurMaxSqDist -1 ); + m_flCurFadeSqDist = MIN( m_flCurFadeSqDist, m_flCurMaxSqDist -1 ); m_flCurFalloffFactor = 255.0f / ( m_flCurMaxSqDist - m_flCurFadeSqDist ); diff --git a/game/client/fx.cpp b/game/client/fx.cpp index 24321291..7c65759d 100644 --- a/game/client/fx.cpp +++ b/game/client/fx.cpp @@ -665,8 +665,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] ); @@ -947,8 +947,8 @@ void FX_HunterTracer( Vector& start, Vector& end, int velocity, bool makeWhiz ) totalDist = VectorNormalize( shotDir ); // Make short tracers in close quarters - // float flMinLength = min( totalDist, 128.0f ); - // float flMaxLength = min( totalDist, 128.0f ); + // float flMinLength = MIN( totalDist, 128.0f ); + // float flMaxLength = MIN( totalDist, 128.0f ); float length = 128.0f;//random->RandomFloat( flMinLength, flMaxLength ); float life = ( totalDist + length ) / velocity; // NOTENOTE: We want the tail to finish its run as well @@ -1095,9 +1095,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/game/client/fx_blood.cpp b/game/client/fx_blood.cpp index ae775a1c..ee0c9437 100644 --- a/game/client/fx_blood.cpp +++ b/game/client/fx_blood.cpp @@ -229,9 +229,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; @@ -274,9 +274,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; @@ -359,9 +359,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; @@ -395,9 +395,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/game/client/fx_discreetline.cpp b/game/client/fx_discreetline.cpp index 89454d74..b3643f00 100644 --- a/game/client/fx_discreetline.cpp +++ b/game/client/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/game/client/fx_explosion.cpp b/game/client/fx_explosion.cpp index ed0658a5..35a7c7ca 100644 --- a/game/client/fx_explosion.cpp +++ b/game/client/fx_explosion.cpp @@ -678,9 +678,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 } @@ -1208,7 +1208,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 @@ -1236,7 +1236,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 @@ -1267,12 +1267,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/game/client/fx_sparks.cpp b/game/client/fx_sparks.cpp index ebc373a9..0d070bd4 100644 --- a/game/client/fx_sparks.cpp +++ b/game/client/fx_sparks.cpp @@ -1151,9 +1151,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; } } @@ -1174,9 +1174,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 @@ -1203,9 +1203,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; } } @@ -1232,9 +1232,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/game/client/fx_water.cpp b/game/client/fx_water.cpp index 72a27dfd..927e47ac 100644 --- a/game/client/fx_water.cpp +++ b/game/client/fx_water.cpp @@ -66,7 +66,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; } } @@ -90,7 +90,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 ) @@ -214,9 +214,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; } @@ -249,12 +249,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; @@ -297,7 +297,7 @@ void FX_GunshotSlimeSplash( const Vector &origin, const Vector &normal, float sc #if 0 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" ); @@ -352,9 +352,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; } @@ -395,12 +395,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/game/client/game_controls/MapOverview.cpp b/game/client/game_controls/MapOverview.cpp index c6848a52..c77fdd7a 100644 --- a/game/client/game_controls/MapOverview.cpp +++ b/game/client/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/game/client/game_controls/NavProgress.cpp b/game/client/game_controls/NavProgress.cpp index 82ab33a1..96012bd2 100644 --- a/game/client/game_controls/NavProgress.cpp +++ b/game/client/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/game/client/game_controls/basemodel_panel.cpp b/game/client/game_controls/basemodel_panel.cpp index 497b0754..44583530 100644 --- a/game/client/game_controls/basemodel_panel.cpp +++ b/game/client/game_controls/basemodel_panel.cpp @@ -447,8 +447,8 @@ void CBaseModelPanel::LookAtBounds( const Vector &vecBoundsMin, const Vector &ve float flDistZ = fabs( aXFormPoints[iPoint].z / flTanFOVy ) - aXFormPoints[iPoint].x; dist[iPoint].x = flDistY; dist[iPoint].y = flDistZ; - float flTestDist = max( flDistZ, flDistY ); - flDist = max( flDist, flTestDist ); + float flTestDist = MAX( flDistZ, flDistY ); + flDist = MAX( flDist, flTestDist ); } // Screen space points. @@ -470,10 +470,10 @@ void CBaseModelPanel::LookAtBounds( const Vector &vecBoundsMin, const Vector &ve Vector2D vecScreenMin( 99999.0f, 99999.0f ), vecScreenMax( -99999.0f, -99999.0f ); for ( int iPoint = 0; iPoint < 8; ++iPoint ) { - vecScreenMin.x = min( vecScreenMin.x, aScreenPoints[iPoint].x ); - vecScreenMin.y = min( vecScreenMin.y, aScreenPoints[iPoint].y ); - vecScreenMax.x = max( vecScreenMax.x, aScreenPoints[iPoint].x ); - vecScreenMax.y = max( vecScreenMax.y, aScreenPoints[iPoint].y ); + vecScreenMin.x = MIN( vecScreenMin.x, aScreenPoints[iPoint].x ); + vecScreenMin.y = MIN( vecScreenMin.y, aScreenPoints[iPoint].y ); + vecScreenMax.x = MAX( vecScreenMax.x, aScreenPoints[iPoint].x ); + vecScreenMax.y = MAX( vecScreenMax.y, aScreenPoints[iPoint].y ); } // Offset the model to the be the correct distance away from the camera. diff --git a/game/client/game_controls/basemodelpanel.cpp b/game/client/game_controls/basemodelpanel.cpp index 3d3e22aa..71ac6723 100644 --- a/game/client/game_controls/basemodelpanel.cpp +++ b/game/client/game_controls/basemodelpanel.cpp @@ -781,8 +781,8 @@ void CModelPanel::CalculateFrameDistanceInternal( const model_t *pModel ) { float flDistZ = fabs( aXFormPoints[iPoint].z / flTanFOVy - aXFormPoints[iPoint].x ); float flDistY = fabs( aXFormPoints[iPoint].y / flTanFOVx - aXFormPoints[iPoint].x ); - float flTestDist = max( flDistZ, flDistY ); - flDist = max( flDist, flTestDist ); + float flTestDist = MAX( flDistZ, flDistY ); + flDist = MAX( flDist, flTestDist ); } // Scale the object down by 10%. @@ -815,10 +815,10 @@ void CModelPanel::CalculateFrameDistanceInternal( const model_t *pModel ) Vector2D vecScreenMin( 99999.0f, 99999.0f ), vecScreenMax( -99999.0f, -99999.0f ); for ( int iPoint = 0; iPoint < 8; ++iPoint ) { - vecScreenMin.x = min( vecScreenMin.x, aScreenPoints[iPoint].x ); - vecScreenMin.y = min( vecScreenMin.y, aScreenPoints[iPoint].y ); - vecScreenMax.x = max( vecScreenMax.x, aScreenPoints[iPoint].x ); - vecScreenMax.y = max( vecScreenMax.y, aScreenPoints[iPoint].y ); + vecScreenMin.x = MIN( vecScreenMin.x, aScreenPoints[iPoint].x ); + vecScreenMin.y = MIN( vecScreenMin.y, aScreenPoints[iPoint].y ); + vecScreenMax.x = MAX( vecScreenMax.x, aScreenPoints[iPoint].x ); + vecScreenMax.y = MAX( vecScreenMax.y, aScreenPoints[iPoint].y ); } vecScreenMin.x = clamp( vecScreenMin.x, 0.0f, flW ); diff --git a/game/client/game_controls/vguitextwindow.cpp b/game/client/game_controls/vguitextwindow.cpp index 8b05301c..7a700b0d 100644 --- a/game/client/game_controls/vguitextwindow.cpp +++ b/game/client/game_controls/vguitextwindow.cpp @@ -213,7 +213,7 @@ void CTextWindow::ShowFile( const char *filename ) char buffer[2048]; - int size = min( g_pFullFileSystem->Size( f ), sizeof(buffer)-1 ); // just allow 2KB + int size = MIN( g_pFullFileSystem->Size( f ), sizeof(buffer)-1 ); // just allow 2KB g_pFullFileSystem->Read( buffer, size, f ); g_pFullFileSystem->Close( f ); diff --git a/game/client/glow_overlay.cpp b/game/client/glow_overlay.cpp index dd1c7891..4076d8ba 100644 --- a/game/client/glow_overlay.cpp +++ b/game/client/glow_overlay.cpp @@ -260,7 +260,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 @@ -272,7 +272,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/game/client/history_resource.cpp b/game/client/history_resource.cpp index cce4b07d..0065057f 100644 --- a/game/client/history_resource.cpp +++ b/game/client/history_resource.cpp @@ -298,7 +298,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 @@ -310,7 +310,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; @@ -350,7 +350,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; @@ -364,7 +364,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/game/client/hl2/c_basehlplayer.cpp b/game/client/hl2/c_basehlplayer.cpp index fbc327dc..49b26c7d 100644 --- a/game/client/hl2/c_basehlplayer.cpp +++ b/game/client/hl2/c_basehlplayer.cpp @@ -100,7 +100,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; } @@ -267,7 +267,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 ); //engine->Con_NPrintf( slot++, "scaleup (%f) to radius %f\n", factor, radius * factor ); @@ -519,7 +519,7 @@ void C_BaseHLPlayer::PerformClientSideObstacleAvoidance( float flFrameTime, CUse flSideScale = fabs( cl_sidespeed.GetFloat() ) / fabs( pCmd->sidemove ); } - float flScale = min( flForwardScale, flSideScale ); + float flScale = MIN( flForwardScale, flSideScale ); pCmd->forwardmove *= flScale; pCmd->sidemove *= flScale; diff --git a/game/client/hl2/c_prop_combine_ball.cpp b/game/client/hl2/c_prop_combine_ball.cpp index 34782353..1335a126 100644 --- a/game/client/hl2/c_prop_combine_ball.cpp +++ b/game/client/hl2/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/game/client/hl2/c_strider.cpp b/game/client/hl2/c_strider.cpp index d36d9525..970b10b2 100644 --- a/game/client/hl2/c_strider.cpp +++ b/game/client/hl2/c_strider.cpp @@ -976,7 +976,7 @@ void StriderBlood( const Vector &origin, const Vector &normal, float scale ) tint = (tint * 0.25f)+(Vector(0.75f,0.75f,0.75f)); // Rescale to a character range - luminosity = max( 200, luminosity*255 ); + luminosity = MAX( 200, luminosity*255 ); CSmartPtr pSimple = CSplashParticle::Create( "splish" ); pSimple->SetSortOrigin( origin ); diff --git a/game/client/hl2/c_thumper_dust.cpp b/game/client/hl2/c_thumper_dust.cpp index cf7e6add..6eb26d9e 100644 --- a/game/client/hl2/c_thumper_dust.cpp +++ b/game/client/hl2/c_thumper_dust.cpp @@ -113,7 +113,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/game/client/hl2/c_vehicle_airboat.cpp b/game/client/hl2/c_vehicle_airboat.cpp index 94aefa23..aeae67fd 100644 --- a/game/client/hl2/c_vehicle_airboat.cpp +++ b/game/client/hl2/c_vehicle_airboat.cpp @@ -661,9 +661,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/game/client/hl2/c_weapon_crossbow.cpp b/game/client/hl2/c_weapon_crossbow.cpp index 11ebeb47..5eb6183f 100644 --- a/game/client/hl2/c_weapon_crossbow.cpp +++ b/game/client/hl2/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/game/client/hl2/fx_hl2_tracers.cpp b/game/client/hl2/fx_hl2_tracers.cpp index be3ff75b..75f1dd70 100644 --- a/game/client/hl2/fx_hl2_tracers.cpp +++ b/game/client/hl2/fx_hl2_tracers.cpp @@ -209,7 +209,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/game/client/hl2/hud_autoaim.cpp b/game/client/hl2/hud_autoaim.cpp index e0efae01..865c1d9c 100644 --- a/game/client/hl2/hud_autoaim.cpp +++ b/game/client/hl2/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/game/client/hl2/hud_bonusprogress.cpp b/game/client/hl2/hud_bonusprogress.cpp index 91104ec9..f9c44f69 100644 --- a/game/client/hl2/hud_bonusprogress.cpp +++ b/game/client/hl2/hud_bonusprogress.cpp @@ -127,7 +127,7 @@ void CHudBonusProgress::OnThink() } // Never below zero - newBonusProgress = max( local->GetBonusProgress(), 0 ); + newBonusProgress = MAX( local->GetBonusProgress(), 0 ); iBonusChallenge = local->GetBonusChallenge(); // Only update the fade if we've changed bonusProgress diff --git a/game/client/hl2/hud_credits.cpp b/game/client/hl2/hud_credits.cpp index fa13e124..cf5dab2a 100644 --- a/game/client/hl2/hud_credits.cpp +++ b/game/client/hl2/hud_credits.cpp @@ -328,7 +328,7 @@ void CHudCredits::DrawOutroCreditsName( void ) } } - cColor[3] = max( 0, m_Alpha ); + cColor[3] = MAX( 0, m_Alpha ); } } else @@ -374,7 +374,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/game/client/hl2/hud_health.cpp b/game/client/hl2/hud_health.cpp index b2a0ca95..320bf5e7 100644 --- a/game/client/hl2/hud_health.cpp +++ b/game/client/hl2/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/game/client/hl2/hud_weaponselection.cpp b/game/client/hl2/hud_weaponselection.cpp index bdebb0ac..232b8709 100644 --- a/game/client/hl2/hud_weaponselection.cpp +++ b/game/client/hl2/hud_weaponselection.cpp @@ -451,7 +451,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/game/client/hl2/hud_zoom.cpp b/game/client/hl2/hud_zoom.cpp index a3b83aea..2a26576b 100644 --- a/game/client/hl2/hud_zoom.cpp +++ b/game/client/hl2/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/game/client/hl2mp/c_hl2mp_player.cpp b/game/client/hl2mp/c_hl2mp_player.cpp index dcdeccdd..7e32a059 100644 --- a/game/client/hl2mp/c_hl2mp_player.cpp +++ b/game/client/hl2mp/c_hl2mp_player.cpp @@ -536,7 +536,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/game/client/hl2mp/ui/hl2mpclientscoreboard.cpp b/game/client/hl2mp/ui/hl2mpclientscoreboard.cpp index a82ec0b9..0ceb9284 100644 --- a/game/client/hl2mp/ui/hl2mpclientscoreboard.cpp +++ b/game/client/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/game/client/hud_basechat.cpp b/game/client/hud_basechat.cpp index 56413c4a..ce5557ae 100644 --- a/game/client/hud_basechat.cpp +++ b/game/client/hud_basechat.cpp @@ -1087,7 +1087,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/game/client/hud_closecaption.cpp b/game/client/hud_closecaption.cpp index 27a20e66..b5f5223f 100644 --- a/game/client/hud_closecaption.cpp +++ b/game/client/hud_closecaption.cpp @@ -1027,7 +1027,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 ) @@ -1083,7 +1083,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() ) { @@ -1115,7 +1115,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 ); } @@ -1248,7 +1248,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 @@ -1256,7 +1256,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 ); } } @@ -1504,7 +1504,7 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha addedlife = prevlife - lifespan; } - lifespan = max( lifespan, prevlife ); + lifespan = MAX( lifespan, prevlife ); } float delay = 0.0f; @@ -1548,7 +1548,7 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha out = phrase; // Delay must be positive - delay = max( 0.0f, (float)wcstod( args, NULL ) ); + delay = MAX( 0.0f, (float)wcstod( args, NULL ) ); continue; } @@ -1601,7 +1601,7 @@ void CHudCloseCaption::CreateFonts( void ) m_hFonts[CCFONT_SMALL] = pScheme->GetFont( "CloseCaption_Small" ); } - m_nLineHeight = max( 6, vgui::surface()->GetFontTall( m_hFonts[ CCFONT_NORMAL ] ) ); + m_nLineHeight = MAX( 6, vgui::surface()->GetFontTall( m_hFonts[ CCFONT_NORMAL ] ) ); } struct WorkUnitParams @@ -1686,8 +1686,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 ); @@ -2706,7 +2706,7 @@ CON_COMMAND( cc_random, "Emits a random caption" ) int count = 1; if ( args.ArgC() == 2 ) { - count = max( 1, atoi( args[ 1 ] ) ); + count = MAX( 1, atoi( args[ 1 ] ) ); } CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption ); if ( hudCloseCaption ) @@ -2864,7 +2864,7 @@ void CHudCloseCaption::FindSound( char const *pchANSI ) // Now we have the data const wchar_t *pIn = ( const wchar_t *)&block[ lu.offset ]; - Q_memcpy( (void *)stream, pIn, min( lu.length, sizeof( stream ) ) ); + Q_memcpy( (void *)stream, pIn, MIN( lu.length, sizeof( stream ) ) ); // Now search for search text g_pVGuiLocalize->ConvertUnicodeToANSI( stream, streamANSI, sizeof( streamANSI ) ); diff --git a/game/client/hud_controlpointicons.h b/game/client/hud_controlpointicons.h index 26277307..0fa7ce78 100644 --- a/game/client/hud_controlpointicons.h +++ b/game/client/hud_controlpointicons.h @@ -175,7 +175,7 @@ public: { if ( m_flFinishCapAnimStart && gpGlobals->curtime > m_flFinishCapAnimStart ) { - float flElapsedTime = max( 0, (gpGlobals->curtime - m_flFinishCapAnimStart) ); + float flElapsedTime = MAX( 0, (gpGlobals->curtime - m_flFinishCapAnimStart) ); if (GetImage()) { surface()->DrawSetColor(255, 255, 255, 255); diff --git a/game/client/hud_hintdisplay.cpp b/game/client/hud_hintdisplay.cpp index e73680ff..05944586 100644 --- a/game/client/hud_hintdisplay.cpp +++ b/game/client/hud_hintdisplay.cpp @@ -176,7 +176,7 @@ void CHudHintDisplay::PerformLayout() int iDesiredLabelWide = 0; for ( i=0; i < m_Labels.Count(); ++i ) { - iDesiredLabelWide = max( iDesiredLabelWide, m_Labels[i]->GetWide() ); + iDesiredLabelWide = MAX( iDesiredLabelWide, m_Labels[i]->GetWide() ); } // find the total height @@ -216,10 +216,10 @@ void CHudHintDisplay::PerformLayout() y = (tall - labelTall) / 2; } - x = max(x,0); - y = max(y,0); + x = MAX(x,0); + y = MAX(y,0); - iDesiredLabelWide = min(iDesiredLabelWide,wide); + iDesiredLabelWide = MIN(iDesiredLabelWide,wide); m_pLabel->SetBounds( x, y, iDesiredLabelWide, labelTall ); // now lay out the sub-labels @@ -670,7 +670,7 @@ bool CHudHintKeyDisplay::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/game/client/hud_redraw.cpp b/game/client/hud_redraw.cpp index f7a927a6..0904531d 100644 --- a/game/client/hud_redraw.cpp +++ b/game/client/hud_redraw.cpp @@ -100,8 +100,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; @@ -156,8 +156,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/game/client/in_camera.cpp b/game/client/in_camera.cpp index 19b8a72f..d46d7014 100644 --- a/game/client/in_camera.cpp +++ b/game/client/in_camera.cpp @@ -533,7 +533,7 @@ void CInput::CAM_Think( void ) } else { - float lag = max( 1, 1 + cam_ideallag.GetFloat() ); + float lag = MAX( 1, 1 + cam_ideallag.GetFloat() ); if( camOffset[ YAW ] - viewangles[ YAW ] != cam_idealyaw.GetFloat() ) camOffset[ YAW ] = MoveToward( camOffset[ YAW ], cam_idealyaw.GetFloat() + viewangles[ YAW ], lag ); @@ -644,7 +644,7 @@ void CInput::CAM_CameraThirdThink( void ) VectorCopy( m_vecCameraOffset, vecCamOffset ); // Move the camera. - float flLag = max( 1, 1 + m_pCameraThirdData->m_flLag ); + float flLag = MAX( 1, 1 + m_pCameraThirdData->m_flLag ); if( vecCamOffset[PITCH] - angView[PITCH] != m_pCameraThirdData->m_flPitch ) { vecCamOffset[PITCH] = MoveToward( vecCamOffset[PITCH], ( m_pCameraThirdData->m_flPitch + angView[PITCH] ), flLag ); diff --git a/game/client/in_joystick.cpp b/game/client/in_joystick.cpp index d52eda47..b38bd786 100644 --- a/game/client/in_joystick.cpp +++ b/game/client/in_joystick.cpp @@ -385,7 +385,7 @@ static float ResponseCurveLookAccelerated( float x, int axis, float otherAxis, f // this axis is pressed farther than the acceleration filter // Take the lowmap value, or the input, whichever is higher, since // we don't necesarily know whether this is the axis which is pegged - x = max( joy_lowmap.GetFloat(), x ); + x = MAX( joy_lowmap.GetFloat(), x ); bDoAcceleration = true; } else @@ -654,7 +654,7 @@ void CInput::JoyStickMove( float frametime, CUserCmd *cmd ) if ( m_flRemainingJoystickSampleTime <= 0 ) return; - frametime = min(m_flRemainingJoystickSampleTime, frametime); + frametime = MIN(m_flRemainingJoystickSampleTime, frametime); m_flRemainingJoystickSampleTime -= frametime; QAngle viewangles; diff --git a/game/client/in_main.cpp b/game/client/in_main.cpp index 89df3e33..9652079c 100644 --- a/game/client/in_main.cpp +++ b/game/client/in_main.cpp @@ -621,7 +621,7 @@ float CInput::DetermineKeySpeed( float frametime ) if ( m_flKeyboardSampleTime <= 0 ) return 0.0f; - frametime = min( m_flKeyboardSampleTime, frametime ); + frametime = MIN( m_flKeyboardSampleTime, frametime ); m_flKeyboardSampleTime -= frametime; } diff --git a/game/client/in_mouse.cpp b/game/client/in_mouse.cpp index b26933c2..aefa3107 100644 --- a/game/client/in_mouse.cpp +++ b/game/client/in_mouse.cpp @@ -647,11 +647,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/game/client/interpolatedvar.h b/game/client/interpolatedvar.h index 524e91f3..eb245dac 100644 --- a/game/client/interpolatedvar.h +++ b/game/client/interpolatedvar.h @@ -833,7 +833,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 ); int oldestindex = i+1; @@ -1254,7 +1254,7 @@ inline void CInterpolatedVarArrayBase::SetMaxCount( int newmax ) bool changed = ( newmax != m_nMaxCount ) ? true : false; // BUGBUG: Support 0 length properly? - newmax = max(1,newmax); + newmax = MAX(1,newmax); m_nMaxCount = newmax; // Wipe everything any time this changes!!! @@ -1330,7 +1330,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/game/client/lamphaloproxy.cpp b/game/client/lamphaloproxy.cpp index e0bf4e82..a9c03f7a 100644 --- a/game/client/lamphaloproxy.cpp +++ b/game/client/lamphaloproxy.cpp @@ -86,7 +86,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/game/client/particle_iterators.h b/game/client/particle_iterators.h index aec8b597..b16acd70 100644 --- a/game/client/particle_iterators.h +++ b/game/client/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/game/client/particlemgr.cpp b/game/client/particlemgr.cpp index 0af2e057..889b8081 100644 --- a/game/client/particlemgr.cpp +++ b/game/client/particlemgr.cpp @@ -1506,11 +1506,11 @@ int CParticleMgr::ComputeParticleDefScreenArea( int nInfoCount, RetireInfo_t *pI float flProjRadius = ( lSqr > flCullRadiusSqr ) ? 0.5f * flFocalDist * flCullRadius / sqrt( lSqr - flCullRadiusSqr ) : 1.0f; flProjRadius *= view.width; - float flMinX = max( view.x, vecScreenCenter.x - flProjRadius ); - float flMaxX = min( view.x + view.width, vecScreenCenter.x + flProjRadius ); + float flMinX = MAX( view.x, vecScreenCenter.x - flProjRadius ); + float flMaxX = MIN( view.x + view.width, vecScreenCenter.x + flProjRadius ); - float flMinY = max( view.y, vecScreenCenter.y - flProjRadius ); - float flMaxY = min( view.y + view.height, vecScreenCenter.y + flProjRadius ); + float flMinY = MAX( view.y, vecScreenCenter.y - flProjRadius ); + float flMaxY = MIN( view.y + view.height, vecScreenCenter.y + flProjRadius ); float flArea = ( flMaxX - flMinX ) * ( flMaxY - flMinY ); Assert( flArea <= flMaxPixels ); diff --git a/game/client/particles_simple.cpp b/game/client/particles_simple.cpp index 322afd19..9960269e 100644 --- a/game/client/particles_simple.cpp +++ b/game/client/particles_simple.cpp @@ -526,7 +526,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/game/client/particlesphererenderer.h b/game/client/particlesphererenderer.h index d7f46bb9..ac0980d7 100644 --- a/game/client/particlesphererenderer.h +++ b/game/client/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/game/client/prediction.cpp b/game/client/prediction.cpp index f36cda35..9cbbcf6d 100644 --- a/game/client/prediction.cpp +++ b/game/client/prediction.cpp @@ -1381,9 +1381,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 ); // Always restore since otherwise we might start prediction using an "interpolated" value instead of a purely predicted value RestoreEntityToPredictedFrame( skipahead - 1 ); diff --git a/game/client/sdk/sdk_hud_chat.cpp b/game/client/sdk/sdk_hud_chat.cpp index e253aaad..75283644 100644 --- a/game/client/sdk/sdk_hud_chat.cpp +++ b/game/client/sdk/sdk_hud_chat.cpp @@ -120,8 +120,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; @@ -442,8 +442,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/game/client/sdk/sdk_hud_health.cpp b/game/client/sdk/sdk_hud_health.cpp index b2a0ca95..320bf5e7 100644 --- a/game/client/sdk/sdk_hud_health.cpp +++ b/game/client/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/game/client/sdk/sdk_hud_weaponselection.cpp b/game/client/sdk/sdk_hud_weaponselection.cpp index b03da194..cd6a4a62 100644 --- a/game/client/sdk/sdk_hud_weaponselection.cpp +++ b/game/client/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/game/client/smoke_fog_overlay.cpp b/game/client/smoke_fog_overlay.cpp index 79538251..e3319eda 100644 --- a/game/client/smoke_fog_overlay.cpp +++ b/game/client/smoke_fog_overlay.cpp @@ -76,10 +76,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/game/client/spritemodel.cpp b/game/client/spritemodel.cpp index cc3f47b1..2ef6c4da 100644 --- a/game/client/spritemodel.cpp +++ b/game/client/spritemodel.cpp @@ -95,13 +95,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/game/client/vgui_entitypanel.cpp b/game/client/vgui_entitypanel.cpp index 46de9ec7..386edc9c 100644 --- a/game/client/vgui_entitypanel.cpp +++ b/game/client/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/game/client/vgui_fpspanel.cpp b/game/client/vgui_fpspanel.cpp index b16b714d..45d7fb27 100644 --- a/game/client/vgui_fpspanel.cpp +++ b/game/client/vgui_fpspanel.cpp @@ -706,7 +706,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/game/client/vgui_netgraphpanel.cpp b/game/client/vgui_netgraphpanel.cpp index fb4c8f73..39816a34 100644 --- a/game/client/vgui_netgraphpanel.cpp +++ b/game/client/vgui_netgraphpanel.cpp @@ -344,7 +344,7 @@ void CNetGraphPanel::ComputeNetgraphHeight() { lines = 4; } - m_nNetGraphHeight = max( lines * tall, m_nNetGraphHeight ); + m_nNetGraphHeight = MAX( lines * tall, m_nNetGraphHeight ); } //----------------------------------------------------------------------------- @@ -483,7 +483,7 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w, for (a=0 ; alatency < 9995 ) { lat->latency += flAdjust; - lat->latency = max( lat->latency, 0 ); + lat->latency = MAX( lat->latency, 0 ); } for ( int i=0; i<=INetChannelInfo::TOTAL; i++ ) @@ -970,7 +970,7 @@ void CNetGraphPanel::DrawHatches( int x, int y, int maxmsgbytes ) byte color[3]; ystep = (int)( 10.0 / net_scale.GetFloat() ); - ystep = max( ystep, 1 ); + ystep = MAX( ystep, 1 ); rcHatch.y = y; rcHatch.height = 1; @@ -1103,7 +1103,7 @@ void CNetGraphPanel::DrawLargePacketSizes( int x, int w, int graphtype, float wa int nTotalBytes = m_Graph[ i ].msgbytes[ INetChannelInfo::TOTAL ]; if ( warning_threshold != 0.0f && - nTotalBytes > max( 300, warning_threshold ) ) + nTotalBytes > MAX( 300, warning_threshold ) ) { char sz[ 32 ]; Q_snprintf( sz, sizeof( sz ), "%i", nTotalBytes ); @@ -1113,7 +1113,7 @@ void CNetGraphPanel::DrawLargePacketSizes( int x, int w, int graphtype, float wa int textx, texty; textx = rcFill.x - len / 2; - texty = max( 0, rcFill.y - 11 ); + texty = MAX( 0, rcFill.y - 11 ); g_pMatSystemSurface->DrawColoredText( m_hFont, textx, texty, 255, 255, 255, 255, sz ); } @@ -1157,7 +1157,7 @@ void CNetGraphPanel::Paint() vrect.height = sh; - w = min( (int)TIMINGS, m_EstimatedWidth ); + w = MIN( (int)TIMINGS, m_EstimatedWidth ); if ( vrect.width < w + 10 ) { w = vrect.width - 10; diff --git a/game/client/view.cpp b/game/client/view.cpp index fadf606a..badb0422 100644 --- a/game/client/view.cpp +++ b/game/client/view.cpp @@ -426,7 +426,7 @@ void CViewRender::OnRenderStart() int min_fov = player->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/game/client/view_beams.cpp b/game/client/view_beams.cpp index 72202a00..78736129 100644 --- a/game/client/view_beams.cpp +++ b/game/client/view_beams.cpp @@ -499,7 +499,7 @@ void CViewRenderBeams::InitBeams( void ) int p = CommandLine()->ParmValue("-particles", -1); if ( p >= 0 ) { - m_nNumBeamTrails = max( p, MIN_PARTICLES ); + m_nNumBeamTrails = MAX( p, MIN_PARTICLES ); } else { @@ -1558,8 +1558,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/game/client/view_effects.cpp b/game/client/view_effects.cpp index 324a2f5a..7d3bbaff 100644 --- a/game/client/view_effects.cpp +++ b/game/client/view_effects.cpp @@ -531,8 +531,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/game/client/viewpostprocess.cpp b/game/client/viewpostprocess.cpp index 71917c3e..de95c2d1 100644 --- a/game/client/viewpostprocess.cpp +++ b/game/client/viewpostprocess.cpp @@ -351,8 +351,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 ); @@ -642,7 +642,7 @@ float CLuminanceHistogramSystem::FindLocationOfPercentBrightPixels( float flPerc float flPercentOfThesePixelsNeeded = flPixelPercentNeeded / flThisBinPercentOfTotalPixels; float flPercentLocationOfBorder = 1.0f - ( flTotalPercentRangeTested + ( flThisBinLuminanceRange * flPercentOfThesePixelsNeeded ) ); - flPercentLocationOfBorder = max( CurHistogram[i].m_min_lum, min( CurHistogram[i].m_max_lum, flPercentLocationOfBorder ) ); // Clamp to this bin just in case + flPercentLocationOfBorder = MAX( CurHistogram[i].m_min_lum, MIN( CurHistogram[i].m_max_lum, flPercentLocationOfBorder ) ); // Clamp to this bin just in case return flPercentLocationOfBorder; } @@ -674,7 +674,7 @@ float CLuminanceHistogramSystem::GetTargetTonemapScalar( bool bGetIdealTargetFor } // Make sure this is > 0.0f - flPercentLocationOfTarget = max( 0.0001f, flPercentLocationOfTarget ); + flPercentLocationOfTarget = MAX( 0.0001f, flPercentLocationOfTarget ); // Compute target scalar float flTargetScalar = ( mat_tonemap_percent_target.GetFloat() / 100.0f ) / flPercentLocationOfTarget; @@ -697,7 +697,7 @@ float CLuminanceHistogramSystem::GetTargetTonemapScalar( bool bGetIdealTargetFor float flLastScale = pRenderContext->GetToneMappingScaleLinear().x; flTargetScalar *= flLastScale; - flTargetScalar = max( 0.001f, flTargetScalar ); + flTargetScalar = MAX( 0.001f, flTargetScalar ); return flTargetScalar; } else // Original tonemapping @@ -739,7 +739,7 @@ float CLuminanceHistogramSystem::GetTargetTonemapScalar( bool bGetIdealTargetFor average_luminance = 0.5; // Make sure this is > 0.0f - average_luminance = max( 0.0001f, average_luminance ); + average_luminance = MAX( 0.0001f, average_luminance ); // Compute target scalar float flTargetScalar = 0.005 / average_luminance; @@ -923,7 +923,7 @@ void CLuminanceHistogramSystem::DisplayHistogram( void ) } } - int width = max( 1, 500 * ( e.m_max_lum - e.m_min_lum ) ); + int width = MAX( 1, 500 * ( e.m_max_lum - e.m_min_lum ) ); nTotalGraphPixelsWide += width + 2; } @@ -935,7 +935,7 @@ void CLuminanceHistogramSystem::DisplayHistogram( void ) engine->Con_NPrintf( 17, "(All values in linear space)" ); engine->Con_NPrintf( 21, "AvgLum @ %4.2f%% mat_tonemap_min_avglum = %4.2f%% Using %d pixels of %d pixels on screen (%3d%%)", - max( 0.0f, FindLocationOfPercentBrightPixels( 50.0f ) ) * 100.0f, mat_tonemap_min_avglum.GetFloat(), + MAX( 0.0f, FindLocationOfPercentBrightPixels( 50.0f ) ) * 100.0f, mat_tonemap_min_avglum.GetFloat(), nTotalValidPixels, ( dest_width * dest_height ), int( float( nTotalValidPixels ) * 100.0f / float( dest_width * dest_height ) ) ); engine->Con_NPrintf( 23, "BloomScale = %4.2f mat_hdr_manual_tonemap_rate = %4.2f mat_accelerate_adjust_exposure_down = %4.2f", GetCurrentBloomScale(), mat_hdr_manual_tonemap_rate.GetFloat(), mat_accelerate_adjust_exposure_down.GetFloat() ); @@ -1004,13 +1004,13 @@ void CLuminanceHistogramSystem::DisplayHistogram( void ) CHistogram_entry_t &e = CurHistogram[l]; if ( e.ContainsValidData() ) np += e.m_npixels_in_range; - int width = max( 1, 500 * ( e.m_max_lum - e.m_min_lum ) ); + int width = MAX( 1, 500 * ( e.m_max_lum - e.m_min_lum ) ); //Warning( "Bucket %d: min/max %f / %f. m_npixels_in_range=%d m_npixels=%d\n", l, e.m_min_lum, e.m_max_lum, e.m_npixels_in_range, e.m_npixels ); if ( np ) { - int height = max( 1, min( HISTOGRAM_BAR_SIZE, ( (float)np / (float)nMaxValidPixels ) * HISTOGRAM_BAR_SIZE ) ); + int height = MAX( 1, MIN( HISTOGRAM_BAR_SIZE, ( (float)np / (float)nMaxValidPixels ) * HISTOGRAM_BAR_SIZE ) ); pRenderContext->ClearColor3ub( 255, 0, 0 ); pRenderContext->Viewport( xp, 4 + HISTOGRAM_BAR_SIZE - height, width, height ); @@ -1163,7 +1163,7 @@ static void SetToneMapScale(IMatRenderContext *pRenderContext, float newvalue, f avg += weight * s_MovingAverageToneMapScale[i]; } avg *= ( 1.0 / sumweights ); - avg = min( maxvalue, max( minvalue, avg )); + avg = MIN( maxvalue, MAX( minvalue, avg )); pRenderContext->SetGoalToneMappingScale( avg ); mat_hdr_tonemapscale.SetValue( avg ); } @@ -1527,8 +1527,8 @@ static void DoPreBloomTonemapping( IMatRenderContext *pRenderContext, int nX, in if ( mat_dynamic_tonemapping.GetInt() || mat_show_histogram.GetInt() ) { float flTargetScalar = g_HDR_HistogramSystem.GetTargetTonemapScalar(); - float flTargetScalarClamped = max( flAutoExposureMin, min( flAutoExposureMax, flTargetScalar ) ); - flTargetScalarClamped = max( 0.001f, flTargetScalarClamped ); // Don't let this go to 0! + float flTargetScalarClamped = MAX( flAutoExposureMin, MIN( flAutoExposureMax, flTargetScalar ) ); + flTargetScalarClamped = MAX( 0.001f, flTargetScalarClamped ); // Don't let this go to 0! if ( mat_dynamic_tonemapping.GetInt() ) { SetToneMapScale( pRenderContext, flTargetScalarClamped, flAutoExposureMin, flAutoExposureMax ); @@ -1849,9 +1849,9 @@ void DoEnginePostProcessing( int x, int y, int w, int h, bool bFlashlightIsOn, b // Warning("avg_lum=%f\n",g_HDR_HistogramSystem.GetTargetTonemapScalar()); if ( mat_dynamic_tonemapping.GetInt() ) { - float avg_lum = max( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() ); - float scalevalue = max( flAutoExposureMin, - min( flAutoExposureMax, 0.18 / avg_lum )); + float avg_lum = MAX( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() ); + float scalevalue = MAX( flAutoExposureMin, + MIN( flAutoExposureMax, 0.18 / avg_lum )); pRenderContext->SetGoalToneMappingScale( scalevalue ); mat_hdr_tonemapscale.SetValue( scalevalue ); } @@ -1875,9 +1875,9 @@ void DoEnginePostProcessing( int x, int y, int w, int h, bool bFlashlightIsOn, b g_HDR_HistogramSystem.DisplayHistogram(); if ( mat_dynamic_tonemapping.GetInt() ) { - float avg_lum = max( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() ); - float scalevalue = max( flAutoExposureMin, - min( flAutoExposureMax, 0.023 / avg_lum )); + float avg_lum = MAX( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() ); + float scalevalue = MAX( flAutoExposureMin, + MIN( flAutoExposureMax, 0.023 / avg_lum )); SetToneMapScale( pRenderContext, scalevalue, flAutoExposureMin, flAutoExposureMax ); } pRenderContext->SetRenderTarget( NULL ); diff --git a/game/client/viewrender.cpp b/game/client/viewrender.cpp index 4e8bcb21..d2444837 100644 --- a/game/client/viewrender.cpp +++ b/game/client/viewrender.cpp @@ -3066,7 +3066,7 @@ void CRendering3dView::SetupRenderablesList( int viewID ) float fMaxDist = cl_maxrenderable_dist.GetFloat(); // Shadowing light typically has a smaller farz than cl_maxrenderable_dist - setupInfo.m_flRenderDistSq = (viewID == VIEW_SHADOW_DEPTH_TEXTURE) ? min(zFar, fMaxDist) : fMaxDist; + setupInfo.m_flRenderDistSq = (viewID == VIEW_SHADOW_DEPTH_TEXTURE) ? MIN(zFar, fMaxDist) : fMaxDist; setupInfo.m_flRenderDistSq *= setupInfo.m_flRenderDistSq; ClientLeafSystem()->BuildRenderablesList( setupInfo ); @@ -4744,8 +4744,8 @@ void CFreezeFrameView::Draw( void ) int iFadeAlpha = FREEZECAM_SNAPSHOT_FADE_SPEED * ( g_flFreezeFlash - gpGlobals->curtime ); - iFadeAlpha = min( iFadeAlpha, 255 ); - iFadeAlpha = max( 0, iFadeAlpha ); + iFadeAlpha = MIN( iFadeAlpha, 255 ); + iFadeAlpha = MAX( 0, iFadeAlpha ); pMaterial->AlphaModulate( iFadeAlpha * ( 1.0f / 255.0f ) ); pMaterial->ColorModulate( 1.0f, 1.0f, 1.0f ); diff --git a/game/server/AI_Criteria.cpp b/game/server/AI_Criteria.cpp index c9de42d9..0ca77a95 100644 --- a/game/server/AI_Criteria.cpp +++ b/game/server/AI_Criteria.cpp @@ -474,8 +474,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, "," ); @@ -492,7 +492,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; } @@ -501,7 +501,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/game/server/AI_Interest_Target.cpp b/game/server/AI_Interest_Target.cpp index 3652682f..a50fffde 100644 --- a/game/server/AI_Interest_Target.cpp +++ b/game/server/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/game/server/BaseAnimatingOverlay.cpp b/game/server/BaseAnimatingOverlay.cpp index f72f4183..e80a3e89 100644 --- a/game/server/BaseAnimatingOverlay.cpp +++ b/game/server/BaseAnimatingOverlay.cpp @@ -685,7 +685,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()) @@ -779,7 +779,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/game/server/CRagdollMagnet.cpp b/game/server/CRagdollMagnet.cpp index 4ededf5d..7186e1b7 100644 --- a/game/server/CRagdollMagnet.cpp +++ b/game/server/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/game/server/CommentarySystem.cpp b/game/server/CommentarySystem.cpp index 60ad9169..b8ec6e25 100644 --- a/game/server/CommentarySystem.cpp +++ b/game/server/CommentarySystem.cpp @@ -1268,7 +1268,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/game/server/EnvBeam.cpp b/game/server/EnvBeam.cpp index e4bfc244..a7e87106 100644 --- a/game/server/EnvBeam.cpp +++ b/game/server/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/game/server/EnvShake.cpp b/game/server/EnvShake.cpp index 6444bd1f..7a585f17 100644 --- a/game/server/EnvShake.cpp +++ b/game/server/EnvShake.cpp @@ -217,7 +217,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/game/server/GameStats_BasicStatsFunctions.cpp b/game/server/GameStats_BasicStatsFunctions.cpp index 280600d1..56335ab7 100644 --- a/game/server/GameStats_BasicStatsFunctions.cpp +++ b/game/server/GameStats_BasicStatsFunctions.cpp @@ -49,7 +49,7 @@ bool BasicGameStatsRecord_t::ParseFromBuffer( CUtlBuffer &buf, int iBufferStatsV 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/server/PointAngularVelocitySensor.cpp b/game/server/PointAngularVelocitySensor.cpp index 0ba63386..77d94c07 100644 --- a/game/server/PointAngularVelocitySensor.cpp +++ b/game/server/PointAngularVelocitySensor.cpp @@ -227,9 +227,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/game/server/ai_baseactor.cpp b/game/server/ai_baseactor.cpp index fa62f70e..31c32a65 100644 --- a/game/server/ai_baseactor.cpp +++ b/game/server/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) { @@ -422,8 +422,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; @@ -465,15 +465,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()) @@ -490,7 +490,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: @@ -522,7 +522,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; } } @@ -1603,7 +1603,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 ); UpdateHeadControl( vEyePosition + m_goalHeadDirection * 100, m_goalHeadInfluence ); diff --git a/game/server/ai_basenpc.cpp b/game/server/ai_basenpc.cpp index 4ce849c0..53bdd0ad 100644 --- a/game/server/ai_basenpc.cpp +++ b/game/server/ai_basenpc.cpp @@ -3608,7 +3608,7 @@ void CAI_BaseNPC::RebalanceThinks() int iMaxThinkersPerTick = (int)ceil( (float)((rebalanceCandidates.Count() + 1) / 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" @@ -5674,7 +5674,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/game/server/ai_basenpc.h b/game/server/ai_basenpc.h index a8d16356..c5a4b256 100644 --- a/game/server/ai_basenpc.h +++ b/game/server/ai_basenpc.h @@ -1517,7 +1517,7 @@ public: // //----------------------------------------------------- - void AddSceneLock( float flDuration = 0.2f ) { m_flSceneTime = max( gpGlobals->curtime + flDuration, m_flSceneTime ); }; + void AddSceneLock( float flDuration = 0.2f ) { m_flSceneTime = MAX( gpGlobals->curtime + flDuration, m_flSceneTime ); }; void ClearSceneLock( float flDuration = 0.2f ) { m_flSceneTime = gpGlobals->curtime + flDuration; }; bool IsInLockedScene( void ) { return m_flSceneTime > gpGlobals->curtime; }; float m_flSceneTime; diff --git a/game/server/ai_basenpc_schedule.cpp b/game/server/ai_basenpc_schedule.cpp index 407944a7..4200f4e9 100644 --- a/game/server/ai_basenpc_schedule.cpp +++ b/game/server/ai_basenpc_schedule.cpp @@ -895,11 +895,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; @@ -1088,7 +1088,7 @@ float CAI_BaseNPC::GetReasonableFacingDist( void ) if ( GetEnemy() ) { float distEnemy = ( GetEnemy()->GetAbsOrigin().AsVector2D() - GetAbsOrigin().AsVector2D() ).Length() - 1.0; - return min( distEnemy, dist ); + return MIN( distEnemy, dist ); } return dist; @@ -1862,7 +1862,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask ) } else if ( GetActiveWeapon() ) { - flRange = max( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 ); + flRange = MAX( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 ); } else { @@ -1905,8 +1905,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 ); } else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 ) { @@ -2073,8 +2073,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 ); } else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 ) { @@ -2229,8 +2229,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); } else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 ) { @@ -3694,7 +3694,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask ) #else AngleVectors( ang, &move ); #endif //HL2_EPISODIC - 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(); } @@ -3703,7 +3703,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(); } @@ -3720,7 +3720,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(); } @@ -3742,7 +3742,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/game/server/ai_behavior_follow.cpp b/game/server/ai_behavior_follow.cpp index b0888927..cfaabb16 100644 --- a/game/server/ai_behavior_follow.cpp +++ b/game/server/ai_behavior_follow.cpp @@ -505,14 +505,14 @@ bool CAI_FollowBehavior::IsFollowTargetInRange( float rangeMultiplier ) if( GetNpcState() == NPC_STATE_COMBAT ) { - if( IsFollowGoalInRange( max( m_FollowNavGoal.coverTolerance, m_FollowNavGoal.enemyLOSTolerance ) * rangeMultiplier, GetGoalZRange(), GetGoalFlags() ) ) + if( IsFollowGoalInRange( MAX( m_FollowNavGoal.coverTolerance, m_FollowNavGoal.enemyLOSTolerance ) * rangeMultiplier, GetGoalZRange(), GetGoalFlags() ) ) { return true; } } else { - if( IsFollowGoalInRange( max( m_FollowNavGoal.tolerance, GetGoalRange() ) * rangeMultiplier, GetGoalZRange(), GetGoalFlags() ) ) + if( IsFollowGoalInRange( MAX( m_FollowNavGoal.tolerance, GetGoalRange() ) * rangeMultiplier, GetGoalZRange(), GetGoalFlags() ) ) { if ( m_FollowNavGoal.flags & AIFF_REQUIRE_LOS_OUTSIDE_COMBAT ) { @@ -934,7 +934,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 ); @@ -946,7 +946,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())) ); } @@ -1518,7 +1518,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 ) ) { @@ -1607,7 +1607,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/game/server/ai_behavior_rappel.cpp b/game/server/ai_behavior_rappel.cpp index 888e3ceb..6936462c 100644 --- a/game/server/ai_behavior_rappel.cpp +++ b/game/server/ai_behavior_rappel.cpp @@ -149,7 +149,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/game/server/ai_blended_movement.cpp b/game/server/ai_blended_movement.cpp index 55f587c9..51e9d5aa 100644 --- a/game/server/ai_blended_movement.cpp +++ b/game/server/ai_blended_movement.cpp @@ -314,7 +314,7 @@ void CAI_BlendedMotor::SetMoveScriptAnim( float flNewSpeed ) flWeight = 0.0; } // Msg("weight %.3f rate %.3f\n", flWeight, m_flCurrRate ); - m_flCurrRate = min( m_flCurrRate + (1.0 - m_flCurrRate) * 0.8, 1.0 ); + m_flCurrRate = MIN( m_flCurrRate + (1.0 - m_flCurrRate) * 0.8, 1.0 ); if (m_nSavedGoalActivity == ACT_INVALID) { @@ -392,7 +392,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) { @@ -1106,7 +1106,7 @@ void CAI_BlendedMotor::BuildVelocityScript( const AILocalMoveGoal_t &move ) */ } - idealVelocity = idealVelocity * min( m_flReactiveSpeedAdjust, m_flPredictiveSpeedAdjust ); + idealVelocity = idealVelocity * MIN( m_flReactiveSpeedAdjust, m_flPredictiveSpeedAdjust ); //------------------------- @@ -1192,7 +1192,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 ); @@ -1467,7 +1467,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 @@ -1537,7 +1537,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 { @@ -1746,7 +1746,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 ; @@ -1759,7 +1759,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/game/server/ai_hint.cpp b/game/server/ai_hint.cpp index 2f3ca855..f9cd7cfd 100644 --- a/game/server/ai_hint.cpp +++ b/game/server/ai_hint.cpp @@ -510,7 +510,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; @@ -1424,7 +1424,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/game/server/ai_localnavigator.cpp b/game/server/ai_localnavigator.cpp index 954aa0db..68275a2e 100644 --- a/game/server/ai_localnavigator.cpp +++ b/game/server/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/game/server/ai_motor.cpp b/game/server/ai_motor.cpp index dfc8124e..609b3ccf 100644 --- a/game/server/ai_motor.cpp +++ b/game/server/ai_motor.cpp @@ -302,7 +302,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( yaw * 10.0f, 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/game/server/ai_moveprobe.cpp b/game/server/ai_moveprobe.cpp index 7a264353..14ff997f 100644 --- a/game/server/ai_moveprobe.cpp +++ b/game/server/ai_moveprobe.cpp @@ -533,7 +533,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; @@ -648,7 +648,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 @@ -1104,9 +1104,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/game/server/ai_navigator.cpp b/game/server/ai_navigator.cpp index 4435cb86..9779749f 100644 --- a/game/server/ai_navigator.cpp +++ b/game/server/ai_navigator.cpp @@ -1464,7 +1464,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 ) @@ -3118,7 +3118,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/game/server/ai_networkmanager.cpp b/game/server/ai_networkmanager.cpp index 709a71c7..7f191a79 100644 --- a/game/server/ai_networkmanager.cpp +++ b/game/server/ai_networkmanager.cpp @@ -564,11 +564,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 @@ -619,8 +619,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++) { @@ -733,7 +733,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/game/server/ai_planesolver.cpp b/game/server/ai_planesolver.cpp index 99a7a398..7eb5e5cd 100644 --- a/game/server/ai_planesolver.cpp +++ b/game/server/ai_planesolver.cpp @@ -873,7 +873,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/game/server/ai_playerally.h b/game/server/ai_playerally.h index 4ac52760..beef807e 100644 --- a/game/server/ai_playerally.h +++ b/game/server/ai_playerally.h @@ -17,10 +17,6 @@ #undef max #endif #include "stdstring.h" -#ifndef _WIN32 -#undef MINMAX_H -#include "minmax.h" -#endif #if defined( _WIN32 ) #pragma once diff --git a/game/server/ai_route.cpp b/game/server/ai_route.cpp index 3336c911..28b22f13 100644 --- a/game/server/ai_route.cpp +++ b/game/server/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/game/server/ai_speech.cpp b/game/server/ai_speech.cpp index 6c4326bd..b9aef771 100644 --- a/game/server/ai_speech.cpp +++ b/game/server/ai_speech.cpp @@ -723,7 +723,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 ); } @@ -738,7 +738,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/game/server/baseanimating.cpp b/game/server/baseanimating.cpp index 875dc241..62cfb450 100644 --- a/game/server/baseanimating.cpp +++ b/game/server/baseanimating.cpp @@ -1592,7 +1592,7 @@ void CBaseAnimating::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,1) ); diff --git a/game/server/basecombatcharacter.cpp b/game/server/basecombatcharacter.cpp index 33bd72cb..164ade9e 100644 --- a/game/server/basecombatcharacter.cpp +++ b/game/server/basecombatcharacter.cpp @@ -619,7 +619,7 @@ CProp_Portal* CBaseCombatCharacter::FInViewConeThroughPortal( const Vector &vecS float flDot = DotProduct( los, facingDir ); // Use the tougher FOV of either the standard FOV or FOV clipped to the portal hole - if ( flDot > max( fFOVThroughPortal, m_flFieldOfView ) ) + if ( flDot > MAX( fFOVThroughPortal, m_flFieldOfView ) ) { float fActualDist = ptEyePosition.DistToSqr( vTranslatedVecSpot ); if( fActualDist < fDistToBeat ) @@ -2862,7 +2862,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; @@ -3072,7 +3072,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, (int)soundRadius, 0.25, info.GetInflictor() ); } diff --git a/game/server/baseentity.cpp b/game/server/baseentity.cpp index f5a0b75a..f57e1b7b 100644 --- a/game/server/baseentity.cpp +++ b/game/server/baseentity.cpp @@ -2246,7 +2246,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 { @@ -6926,7 +6926,7 @@ void CBaseEntity::SUB_PerformFadeOut( void ) dt = 0.1f; } m_nRenderMode = kRenderTransTexture; - int speed = (int)max(1,256*dt); // fade out over 1 second + int speed = (int)MAX(1,256*dt); // fade out over 1 second SetRenderColorA( (byte)UTIL_Approach( 0, m_clrRender->a, speed ) ); } diff --git a/game/server/baseflex.cpp b/game/server/baseflex.cpp index 60f03802..b77a89a2 100644 --- a/game/server/baseflex.cpp +++ b/game/server/baseflex.cpp @@ -1417,7 +1417,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 = false; @@ -1842,11 +1842,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 ); } } @@ -1920,11 +1920,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; @@ -2026,7 +2026,7 @@ bool CBaseFlex::EnterSceneSequence( CChoreoScene *scene, CChoreoEvent *event, bo return false; // 2 seconds past current event, or 0.2 seconds past end of scene, whichever is shorter - float flDuration = min( 2.0, min( event->GetEndTime() - scene->GetTime() + 2.0, scene->FindStopTime() - scene->GetTime() + 0.2 ) ); + float flDuration = MIN( 2.0, MIN( event->GetEndTime() - scene->GetTime() + 2.0, scene->FindStopTime() - scene->GetTime() + 0.2 ) ); if (myNpc->IsCurSchedule( SCHED_SCENE_GENERIC )) { @@ -2201,11 +2201,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/game/server/cbase.cpp b/game/server/cbase.cpp index b0be4228..f9375d5f 100644 --- a/game/server/cbase.cpp +++ b/game/server/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/game/server/entitylist.cpp b/game/server/entitylist.cpp index 4f2d10b9..a940e331 100644 --- a/game/server/entitylist.cpp +++ b/game/server/entitylist.cpp @@ -99,7 +99,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; } @@ -193,7 +193,7 @@ public: int ListCopy( CBaseEntity *pList[], int listMax ) { - int count = min(listMax, ListCount()); + int count = MIN(listMax, ListCount()); int out = 0; for ( int i = 0; i < count; i++ ) { diff --git a/game/server/env_debughistory.cpp b/game/server/env_debughistory.cpp index 124f9b05..4e5b4f6e 100644 --- a/game/server/env_debughistory.cpp +++ b/game/server/env_debughistory.cpp @@ -106,7 +106,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; @@ -238,7 +238,7 @@ int CDebugHistory::Restore( IRestore &restore ) if ( iVersion >= DEBUG_HISTORY_FIRST_VERSIONED ) { 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; @@ -248,7 +248,7 @@ int CDebugHistory::Restore( IRestore &restore ) else { int iMaxCategorys = iVersion; - 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/game/server/episodic/grenade_hopwire.cpp b/game/server/episodic/grenade_hopwire.cpp index 6d9bb2ee..0e354313 100644 --- a/game/server/episodic/grenade_hopwire.cpp +++ b/game/server/episodic/grenade_hopwire.cpp @@ -547,7 +547,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/game/server/episodic/npc_combine_cannon.cpp b/game/server/episodic/npc_combine_cannon.cpp index 47a8caf3..c303d785 100644 --- a/game/server/episodic/npc_combine_cannon.cpp +++ b/game/server/episodic/npc_combine_cannon.cpp @@ -481,7 +481,7 @@ void CNPC_Combine_Cannon::PaintTarget( const Vector &vecTarget, float flPaintTim Vector vecStart = GetBulletOrigin(); // keep painttime from hitting 0 exactly. - flPaintTime = max( flPaintTime, 0.000001f ); + flPaintTime = MAX( flPaintTime, 0.000001f ); // Find out where we are in the arc of the paint duration float flPaintPerc = GetWaitTimePercentage( flPaintTime, false ); diff --git a/game/server/episodic/npc_hunter.cpp b/game/server/episodic/npc_hunter.cpp index 1a548c97..d570967a 100644 --- a/game/server/episodic/npc_hunter.cpp +++ b/game/server/episodic/npc_hunter.cpp @@ -682,7 +682,7 @@ void CHunterFlechette::FlechetteTouch( CBaseEntity *pOther ) CBreakable *pBreak = dynamic_cast (pOther); if ( pBreak && ( pBreak->GetMaterialType() == matGlass ) ) { - flDamage = max( pOther->GetHealth(), flDamage ); + flDamage = MAX( pOther->GetHealth(), flDamage ); } CTakeDamageInfo dmgInfo( this, GetOwnerEntity(), flDamage, DMG_DISSOLVE | DMG_NEVERGIB ); @@ -1787,7 +1787,7 @@ void CNPC_Hunter::Spawn() float freeKnowledge = hunter_free_knowledge.GetFloat(); if ( freeKnowledge < GetEnemies()->GetEnemyDiscardTime() ) { - GetEnemies()->SetEnemyDiscardTime( max( freeKnowledge + 0.1, AI_DEF_ENEMY_DISCARD_TIME ) ); + GetEnemies()->SetEnemyDiscardTime( MAX( freeKnowledge + 0.1, AI_DEF_ENEMY_DISCARD_TIME ) ); } GetEnemies()->SetFreeKnowledgeDuration( freeKnowledge ); @@ -5180,7 +5180,7 @@ CBaseEntity *CNPC_Hunter::MeleeAttack( float flDist, int iDamage, QAngle &qaView { if ( GetAttachment( "blood_left", vecBloodPos ) ) { - SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), min( iDamage, 30 ) ); + SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), MIN( iDamage, 30 ) ); } break; @@ -7119,7 +7119,7 @@ public: int nRequested = nNPCs; if ( nNPCs < 3 ) { - nNPCs = min( 3, nNPCs + freeHunters.Count() ); + nNPCs = MIN( 3, nNPCs + freeHunters.Count() ); } int nSummoned = 0; diff --git a/game/server/event_tempentity_tester.cpp b/game/server/event_tempentity_tester.cpp index 93104623..26a5b988 100644 --- a/game/server/event_tempentity_tester.cpp +++ b/game/server/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/game/server/fourwheelvehiclephysics.cpp b/game/server/fourwheelvehiclephysics.cpp index 8175e065..0e3fb91f 100644 --- a/game/server/fourwheelvehiclephysics.cpp +++ b/game/server/fourwheelvehiclephysics.cpp @@ -1193,7 +1193,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = max( 0.1, m_maxThrottle ); + float flMaxThrottle = MAX( 0.1, m_maxThrottle ); if ( m_controls.steering != 0 ) { float flThrottleReduce = 0; @@ -1213,7 +1213,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram float limit = 1.0f - (flThrottleReduce * fabs(m_controls.steering)); if ( limit < 0 ) limit = 0; - flMaxThrottle = min( flMaxThrottle, limit ); + flMaxThrottle = MIN( flMaxThrottle, limit ); } m_controls.throttle = Approach( flMaxThrottle * flAnalogThrottle, m_controls.throttle, flFrameTime * m_throttleRate ); @@ -1243,7 +1243,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = min( -0.1, m_flMaxRevThrottle ); + float flMaxThrottle = MIN( -0.1, m_flMaxRevThrottle ); m_controls.throttle = Approach( flMaxThrottle * flAnalogBrake, m_controls.throttle, flFrameTime * m_throttleRate ); // Apply the brake. @@ -1268,7 +1268,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = max( 0.1, m_maxThrottle ); + float flMaxThrottle = MAX( 0.1, m_maxThrottle ); if ( m_controls.steering != 0 ) { @@ -1289,7 +1289,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram float limit = 1.0f - (flThrottleReduce * fabs(m_controls.steering)); if ( limit < 0 ) limit = 0; - flMaxThrottle = min( flMaxThrottle, limit ); + flMaxThrottle = MIN( flMaxThrottle, limit ); } m_controls.throttle = Approach( flMaxThrottle, m_controls.throttle, flFrameTime * m_throttleRate ); @@ -1315,7 +1315,7 @@ void CFourWheelVehiclePhysics::UpdateDriverControls( CUserCmd *cmd, float flFram m_controls.throttle = 0; } - float flMaxThrottle = min( -0.1, m_flMaxRevThrottle ); + float flMaxThrottle = MIN( -0.1, m_flMaxRevThrottle ); m_controls.throttle = Approach( flMaxThrottle, m_controls.throttle, flFrameTime * m_throttleRate ); // Apply the brake. diff --git a/game/server/func_break.cpp b/game/server/func_break.cpp index 962e421a..92e3665d 100644 --- a/game/server/func_break.cpp +++ b/game/server/func_break.cpp @@ -1067,7 +1067,7 @@ void CBreakable::Die( void ) else if ( m_PerformanceMode == PM_REDUCED_GIBS ) { int iNewCount = (int)(iCount * func_break_reduction_factor.GetFloat()); - iCount = max( iNewCount, 1 ); + iCount = MAX( iNewCount, 1 ); } } diff --git a/game/server/func_breakablesurf.cpp b/game/server/func_breakablesurf.cpp index 5c7b0271..1de48ee4 100644 --- a/game/server/func_breakablesurf.cpp +++ b/game/server/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(fpmin(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(fpmin(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/game/server/gameinterface.cpp b/game/server/gameinterface.cpp index e6784b5d..6546ca27 100644 --- a/game/server/gameinterface.cpp +++ b/game/server/gameinterface.cpp @@ -2434,7 +2434,7 @@ void CServerGameClients::ClientSettingsChanged( edict_t *pEdict ) flLerpRatio = 1.0f; } // #define FIXME_INTERP_RATIO - player->m_fLerpTime = max( flLerpAmount, flLerpRatio / player->m_nUpdateRate ); + player->m_fLerpTime = MAX( flLerpAmount, flLerpRatio / player->m_nUpdateRate ); } else { diff --git a/game/server/gib.cpp b/game/server/gib.cpp index 6f97bbd6..a8acb45b 100644 --- a/game/server/gib.cpp +++ b/game/server/gib.cpp @@ -540,7 +540,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/game/server/h_ai.cpp b/game/server/h_ai.cpp index f146c8f2..8923f73e 100644 --- a/game/server/h_ai.cpp +++ b/game/server/h_ai.cpp @@ -119,7 +119,7 @@ Vector VecCheckToss( CBaseEntity *pEntity, ITraceFilter *pFilter, Vector vecSpot // 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/game/server/hl2/ai_behavior_police.cpp b/game/server/hl2/ai_behavior_police.cpp index a079faee..d00169b2 100644 --- a/game/server/hl2/ai_behavior_police.cpp +++ b/game/server/hl2/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 ( IntersectInfiniteRayWithSphere( GetAbsOrigin(), harassDir, m_hPoliceGoal->GetAbsOrigin(), m_hPoliceGoal->GetRadius(), &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/game/server/hl2/ai_spotlight.cpp b/game/server/hl2/ai_spotlight.cpp index c29794a4..bbe4ec33 100644 --- a/game/server/hl2/ai_spotlight.cpp +++ b/game/server/hl2/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/game/server/hl2/cbasehelicopter.cpp b/game/server/hl2/cbasehelicopter.cpp index 3e5807b0..31f6966f 100644 --- a/game/server/hl2/cbasehelicopter.cpp +++ b/game/server/hl2/cbasehelicopter.cpp @@ -491,7 +491,7 @@ bool CBaseHelicopter::DoWashPush( washentity_t *pWash, const Vector &vecWashOrig // This used to be mass independent, which is a bad idea because it blows 200kg engine blocks // as much as it blows cardboard and soda cans. Make this force mass-independent, but clamp at // 30kg. - flMass = min( flMass, 30.0f ); + flMass = MIN( flMass, 30.0f ); Vector vecForce = (0.015f / 0.1f) * flWashAmount * flMass * vecToSpot * phys_pushscale.GetFloat(); pEntity->VPhysicsTakeDamage( CTakeDamageInfo( this, this, vecForce, vecWashOrigin, flWashAmount, DMG_BLAST ) ); diff --git a/game/server/hl2/env_speaker.cpp b/game/server/hl2/env_speaker.cpp index 5191d025..814d02b4 100644 --- a/game/server/hl2/env_speaker.cpp +++ b/game/server/hl2/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/game/server/hl2/grenade_frag.cpp b/game/server/hl2/grenade_frag.cpp index 4df94a80..be0dad92 100644 --- a/game/server/hl2/grenade_frag.cpp +++ b/game/server/hl2/grenade_frag.cpp @@ -400,7 +400,7 @@ bool CGrenadeFrag::HandleInteraction(int interactionType, void *data, CBaseComba else if ( interactionType == g_interactionBarnacleVictimReleased ) { // take the five seconds back off the timer. - float timer = max(m_flDetonateTime - gpGlobals->curtime - 5.0f,0.0f); + float timer = MAX(m_flDetonateTime - gpGlobals->curtime - 5.0f,0.0f); SetTimer( timer, timer - FRAG_GRENADE_WARN_TIME ); return true; } diff --git a/game/server/hl2/grenade_homer.cpp b/game/server/hl2/grenade_homer.cpp index 2b6b2f58..3760d1a9 100644 --- a/game/server/hl2/grenade_homer.cpp +++ b/game/server/hl2/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/game/server/hl2/hl2_player.cpp b/game/server/hl2/hl2_player.cpp index ed8e3c22..a99e9c12 100644 --- a/game/server/hl2/hl2_player.cpp +++ b/game/server/hl2/hl2_player.cpp @@ -267,7 +267,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/game/server/hl2/hl2_triggers.cpp b/game/server/hl2/hl2_triggers.cpp index 0d4a6dc4..e58f61b0 100644 --- a/game/server/hl2/hl2_triggers.cpp +++ b/game/server/hl2/hl2_triggers.cpp @@ -546,7 +546,7 @@ void CWateryDeathLeech::LeechThink( void ) dt = 0.1f; } m_nRenderMode = kRenderTransTexture; - int speed = (int)max(1,256*dt); // fade out over 1 second + int speed = (int)MAX(1,256*dt); // fade out over 1 second if ( m_iFadeState == -1 ) SetRenderColorA( (byte)UTIL_Approach( 0, m_clrRender->a, speed ) ); @@ -709,7 +709,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/game/server/hl2/item_ammo.cpp b/game/server/hl2/item_ammo.cpp index c1aac067..27a38eca 100644 --- a/game/server/hl2/item_ammo.cpp +++ b/game/server/hl2/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( (int)flCount, iAmmoType, bSuppressSound ); } diff --git a/game/server/hl2/npc_BaseZombie.cpp b/game/server/hl2/npc_BaseZombie.cpp index 91321fe0..29710a7b 100644 --- a/game/server/hl2/npc_BaseZombie.cpp +++ b/game/server/hl2/npc_BaseZombie.cpp @@ -290,7 +290,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 @@ -844,7 +844,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 @@ -1030,7 +1030,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; @@ -1216,7 +1216,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( (int)min( m_iHealth, FLAME_DIRECT_DAMAGE_PER_SEC * (ZOMBIE_BURN_TIME + random->RandomFloat( -ZOMBIE_BURN_TIME_NOISE, ZOMBIE_BURN_TIME_NOISE)) ) ); + SetHealth( (int)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 ); @@ -1362,20 +1362,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/game/server/hl2/npc_PoisonZombie.cpp b/game/server/hl2/npc_PoisonZombie.cpp index 874b592b..f28634d9 100644 --- a/game/server/hl2/npc_PoisonZombie.cpp +++ b/game/server/hl2/npc_PoisonZombie.cpp @@ -456,7 +456,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/game/server/hl2/npc_antlion.cpp b/game/server/hl2/npc_antlion.cpp index e3eb7673..c3fa6645 100644 --- a/game/server/hl2/npc_antlion.cpp +++ b/game/server/hl2/npc_antlion.cpp @@ -925,7 +925,7 @@ bool CNPC_Antlion::InnateWeaponLOSCondition( const Vector &ownerPos, const Vecto Vector VecCheckThrowTolerance( CBaseEntity *pEdict, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flTolerance ) { - flSpeed = max( 1.0f, flSpeed ); + flSpeed = MAX( 1.0f, flSpeed ); float flGravity = sv_gravity.GetFloat(); diff --git a/game/server/hl2/npc_antlionguard.cpp b/game/server/hl2/npc_antlionguard.cpp index da7f1381..e6ed1185 100644 --- a/game/server/hl2/npc_antlionguard.cpp +++ b/game/server/hl2/npc_antlionguard.cpp @@ -910,7 +910,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/game/server/hl2/npc_attackchopper.cpp b/game/server/hl2/npc_attackchopper.cpp index 5c724b1f..310fbb4a 100644 --- a/game/server/hl2/npc_attackchopper.cpp +++ b/game/server/hl2/npc_attackchopper.cpp @@ -2196,19 +2196,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( m_poseWeapon_Pitch, -m_angGun.x ); @@ -4194,7 +4194,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/game/server/hl2/npc_barnacle.cpp b/game/server/hl2/npc_barnacle.cpp index fb237380..41257160 100644 --- a/game/server/hl2/npc_barnacle.cpp +++ b/game/server/hl2/npc_barnacle.cpp @@ -893,7 +893,7 @@ void CNPC_Barnacle::PullEnemyTorwardsMouth( bool bAdjustEnemyOrigin ) { // get us there in a second Vector desiredVelocity; - float distToMove = min(distFromCenter, 24.0f * dt); + float distToMove = MIN(distFromCenter, 24.0f * dt); desiredVelocity.x = vToCenter.x * distToMove; desiredVelocity.y = vToCenter.y * distToMove; desiredVelocity.z = 0; @@ -1518,7 +1518,7 @@ You can use this stanza to try to counterplace the constraint on the player's he // 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++ ) @@ -2141,11 +2141,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 ); } @@ -2442,7 +2442,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; @@ -2510,7 +2510,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; @@ -2538,7 +2538,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/game/server/hl2/npc_basescanner.cpp b/game/server/hl2/npc_basescanner.cpp index 676ac18a..2719b353 100644 --- a/game/server/hl2/npc_basescanner.cpp +++ b/game/server/hl2/npc_basescanner.cpp @@ -813,7 +813,7 @@ void CNPC_BaseScanner::PlayFlySound(void) float speed = GetCurrentVelocity().Length(); float flVolume = 0.25f + (0.75f*(speed/GetMaxSpeed())); - int iPitch = (int)min( 255, 80 + (20*(speed/GetMaxSpeed())) ); + int iPitch = (int)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/game/server/hl2/npc_blob.cpp b/game/server/hl2/npc_blob.cpp index 355963a5..6d073f2c 100644 --- a/game/server/hl2/npc_blob.cpp +++ b/game/server/hl2/npc_blob.cpp @@ -322,7 +322,7 @@ void CBlobElement::MoveTowardsTargetLocation( float speed ) SetActiveMovementRule( BLOB_MOVE_DONT_MOVE ); } - speed = min( dist, speed ); + speed = MIN( dist, speed ); SetElementVelocity( vecDir * speed, true ); } @@ -588,7 +588,7 @@ void CNPC_Blob::RunAI() if( delta < 0 ) { delta = -delta; - delta = min(delta, 5 ); + delta = MIN(delta, 5 ); RemoveExcessElements( delta ); if( m_iReconfigureElement > m_iNumElements ) @@ -599,7 +599,7 @@ void CNPC_Blob::RunAI() } else { - delta = min(delta, 5 ); + delta = MIN(delta, 5 ); AddNewElements( delta ); } @@ -1253,7 +1253,7 @@ int CNPC_Blob::GetBatchStart() int CNPC_Blob::GetBatchEnd() { int batchDone = m_iBatchStart + ComputeBatchSize(); - batchDone = min( batchDone, m_Elements.Count() ); + batchDone = MIN( batchDone, m_Elements.Count() ); return batchDone; } diff --git a/game/server/hl2/npc_citizen17.cpp b/game/server/hl2/npc_citizen17.cpp index 5c0a7e17..6745d8ce 100644 --- a/game/server/hl2/npc_citizen17.cpp +++ b/game/server/hl2/npc_citizen17.cpp @@ -1029,7 +1029,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/game/server/hl2/npc_combinedropship.cpp b/game/server/hl2/npc_combinedropship.cpp index 6f54e2cf..8431385d 100644 --- a/game/server/hl2/npc_combinedropship.cpp +++ b/game/server/hl2/npc_combinedropship.cpp @@ -1194,7 +1194,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 ) @@ -2047,8 +2047,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; @@ -2290,7 +2290,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/game/server/hl2/npc_combinegunship.cpp b/game/server/hl2/npc_combinegunship.cpp index 547b521f..7b27c96d 100644 --- a/game/server/hl2/npc_combinegunship.cpp +++ b/game/server/hl2/npc_combinegunship.cpp @@ -2122,7 +2122,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 ) @@ -2719,19 +2719,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( m_poseWeapon_Pitch, -m_angGun.x ); diff --git a/game/server/hl2/npc_cranedriver.cpp b/game/server/hl2/npc_cranedriver.cpp index f4604eae..af3b58eb 100644 --- a/game/server/hl2/npc_cranedriver.cpp +++ b/game/server/hl2/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/game/server/hl2/npc_crow.cpp b/game/server/hl2/npc_crow.cpp index cc99878d..895ee735 100644 --- a/game/server/hl2/npc_crow.cpp +++ b/game/server/hl2/npc_crow.cpp @@ -1084,7 +1084,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/game/server/hl2/npc_fastzombie.cpp b/game/server/hl2/npc_fastzombie.cpp index 4be10168..ee9632fd 100644 --- a/game/server/hl2/npc_fastzombie.cpp +++ b/game/server/hl2/npc_fastzombie.cpp @@ -549,7 +549,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 = (int)(FASTZOMBIE_MIN_PITCH + ( ( FASTZOMBIE_MAX_PITCH - FASTZOMBIE_MIN_PITCH ) * m_flDistFactor)); ENVELOPE_CONTROLLER.SoundChangePitch( m_pMoanSound, iPitch, FASTZOMBIE_SOUND_UPDATE_FREQ ); } diff --git a/game/server/hl2/npc_headcrab.cpp b/game/server/hl2/npc_headcrab.cpp index 957db597..a9ae935e 100644 --- a/game/server/hl2/npc_headcrab.cpp +++ b/game/server/hl2/npc_headcrab.cpp @@ -1067,7 +1067,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/game/server/hl2/npc_ichthyosaur.cpp b/game/server/hl2/npc_ichthyosaur.cpp index 50abffec..2720d217 100644 --- a/game/server/hl2/npc_ichthyosaur.cpp +++ b/game/server/hl2/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/game/server/hl2/npc_manhack.cpp b/game/server/hl2/npc_manhack.cpp index 958146c7..658f2dd9 100644 --- a/game/server/hl2/npc_manhack.cpp +++ b/game/server/hl2/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 { @@ -1811,11 +1811,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 = (int)(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 = (int)(MANHACK_MIN_PITCH2 + ( ( MANHACK_MAX_PITCH2 - MANHACK_MIN_PITCH2 ) * flDistFactor)); m_nEnginePitch1 = iPitch1; @@ -1953,7 +1953,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/game/server/hl2/npc_metropolice.cpp b/game/server/hl2/npc_metropolice.cpp index 06c2ef89..a715f0b8 100644 --- a/game/server/hl2/npc_metropolice.cpp +++ b/game/server/hl2/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; @@ -4802,8 +4802,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/game/server/hl2/npc_missiledefense.cpp b/game/server/hl2/npc_missiledefense.cpp index e7fe8df7..96082b45 100644 --- a/game/server/hl2/npc_missiledefense.cpp +++ b/game/server/hl2/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/game/server/hl2/npc_playercompanion.cpp b/game/server/hl2/npc_playercompanion.cpp index 0c7a6122..25b510d3 100644 --- a/game/server/hl2/npc_playercompanion.cpp +++ b/game/server/hl2/npc_playercompanion.cpp @@ -1601,7 +1601,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) ); } //----------------------------------------------------------------------------- @@ -1628,8 +1628,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/game/server/hl2/npc_strider.cpp b/game/server/hl2/npc_strider.cpp index 439444d5..056a8e16 100644 --- a/game/server/hl2/npc_strider.cpp +++ b/game/server/hl2/npc_strider.cpp @@ -1131,7 +1131,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() ); } @@ -4015,8 +4015,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 ); @@ -4911,10 +4911,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 ); } //--------------------------------------------------------- @@ -5325,7 +5325,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()); @@ -5349,7 +5349,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/game/server/hl2/npc_turret.cpp b/game/server/hl2/npc_turret.cpp index 7cc2b162..43f53179 100644 --- a/game/server/hl2/npc_turret.cpp +++ b/game/server/hl2/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/game/server/hl2/prop_combine_ball.cpp b/game/server/hl2/prop_combine_ball.cpp index 2bc0b27a..c1a2f37a 100644 --- a/game/server/hl2/prop_combine_ball.cpp +++ b/game/server/hl2/prop_combine_ball.cpp @@ -1777,7 +1777,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/game/server/hl2/prop_thumper.cpp b/game/server/hl2/prop_thumper.cpp index 5c5384b5..b4c47c0b 100644 --- a/game/server/hl2/prop_thumper.cpp +++ b/game/server/hl2/prop_thumper.cpp @@ -171,11 +171,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/game/server/hl2/proto_sniper.cpp b/game/server/hl2/proto_sniper.cpp index 0c1ff532..6c6f236d 100644 --- a/game/server/hl2/proto_sniper.cpp +++ b/game/server/hl2/proto_sniper.cpp @@ -783,7 +783,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/game/server/hl2/vehicle_airboat.cpp b/game/server/hl2/vehicle_airboat.cpp index 0dff5125..be498943 100644 --- a/game/server/hl2/vehicle_airboat.cpp +++ b/game/server/hl2/vehicle_airboat.cpp @@ -805,7 +805,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/game/server/hl2/vehicle_cannon.cpp b/game/server/hl2/vehicle_cannon.cpp index 9f06395d..45190d2b 100644 --- a/game/server/hl2/vehicle_cannon.cpp +++ b/game/server/hl2/vehicle_cannon.cpp @@ -390,7 +390,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 ); @@ -404,7 +404,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/game/server/hl2/vehicle_crane.cpp b/game/server/hl2/vehicle_crane.cpp index f9e970b9..c766cf43 100644 --- a/game/server/hl2/vehicle_crane.cpp +++ b/game/server/hl2/vehicle_crane.cpp @@ -526,7 +526,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 ); @@ -547,7 +547,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 ); } @@ -568,7 +568,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/game/server/hl2/weapon_annabelle.cpp b/game/server/hl2/weapon_annabelle.cpp index 971adcaa..ed621e85 100644 --- a/game/server/hl2/weapon_annabelle.cpp +++ b/game/server/hl2/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/game/server/hl2/weapon_ar2.cpp b/game/server/hl2/weapon_ar2.cpp index 706613ea..8b155ceb 100644 --- a/game/server/hl2/weapon_ar2.cpp +++ b/game/server/hl2/weapon_ar2.cpp @@ -488,7 +488,7 @@ void CWeaponAR2::AddViewKick( void ) // AR2 progressive into the late, highly inaccurate stages of its kick. Just // spoof the time to make it look (to the kicking code) like we haven't been // firing for very long. - flDuration = min( flDuration, 0.75f ); + flDuration = MIN( flDuration, 0.75f ); } DoMachineGunKick( pPlayer, EASY_DAMPEN, MAX_VERTICAL_KICK, flDuration, SLIDE_LIMIT ); diff --git a/game/server/hl2/weapon_immolator.cpp b/game/server/hl2/weapon_immolator.cpp index 9e172a07..8aa3a905 100644 --- a/game/server/hl2/weapon_immolator.cpp +++ b/game/server/hl2/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/game/server/hl2/weapon_physcannon.cpp b/game/server/hl2/weapon_physcannon.cpp index 673092c4..af3ad10b 100644 --- a/game/server/hl2/weapon_physcannon.cpp +++ b/game/server/hl2/weapon_physcannon.cpp @@ -1867,7 +1867,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++ ) @@ -1879,7 +1879,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/game/server/hl2/weapon_rpg.cpp b/game/server/hl2/weapon_rpg.cpp index 42bf6a41..7ea2e63b 100644 --- a/game/server/hl2/weapon_rpg.cpp +++ b/game/server/hl2/weapon_rpg.cpp @@ -2070,7 +2070,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/game/server/hl2/weapon_shotgun.cpp b/game/server/hl2/weapon_shotgun.cpp index ac1eecce..e431d39a 100644 --- a/game/server/hl2/weapon_shotgun.cpp +++ b/game/server/hl2/weapon_shotgun.cpp @@ -295,7 +295,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; @@ -336,7 +336,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; @@ -765,7 +765,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/server/hl2/weapon_sniperrifle.cpp b/game/server/hl2/weapon_sniperrifle.cpp index 392556d1..3c44539d 100644 --- a/game/server/hl2/weapon_sniperrifle.cpp +++ b/game/server/hl2/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/game/server/hltvdirector.cpp b/game/server/hltvdirector.cpp index 5dc82db2..1971ac1a 100644 --- a/game/server/hltvdirector.cpp +++ b/game/server/hltvdirector.cpp @@ -232,7 +232,7 @@ void CHLTVDirector::UpdateSettings() } } - m_nBroadcastTick = max( 0, newBroadcastTick ); + m_nBroadcastTick = MAX( 0, newBroadcastTick ); } const char** CHLTVDirector::GetModEvents() @@ -517,7 +517,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() ) { @@ -573,7 +573,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)) ); } else if ( bRoundStart || bRoundEnd ) { @@ -832,7 +832,7 @@ void CHLTVDirector::StartInstantBroadcastShot() 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 the delay time is to short for autodirector, just show next best thing diff --git a/game/server/maprules.cpp b/game/server/maprules.cpp index f91a9f29..d8e15b96 100644 --- a/game/server/maprules.cpp +++ b/game/server/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/game/server/nav_area.cpp b/game/server/nav_area.cpp index 20f99791..949fb38f 100644 --- a/game/server/nav_area.cpp +++ b/game/server/nav_area.cpp @@ -919,8 +919,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; @@ -949,8 +949,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; @@ -981,8 +981,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; @@ -1011,8 +1011,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; @@ -1565,8 +1565,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) @@ -1589,8 +1589,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) @@ -1623,8 +1623,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) @@ -1657,8 +1657,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) @@ -1753,8 +1753,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 ) { @@ -3396,8 +3396,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/game/server/nav_colors.cpp b/game/server/nav_colors.cpp index f189a955..5d101db3 100644 --- a/game/server/nav_colors.cpp +++ b/game/server/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/game/server/nav_edit.cpp b/game/server/nav_edit.cpp index b7127d5e..37854f07 100644 --- a/game/server/nav_edit.cpp +++ b/game/server/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/game/server/nav_generate.cpp b/game/server/nav_generate.cpp index cdeddb18..61bd92ee 100644 --- a/game/server/nav_generate.cpp +++ b/game/server/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/game/server/nav_node.cpp b/game/server/nav_node.cpp index d76073e3..8f3ff0a3 100644 --- a/game/server/nav_node.cpp +++ b/game/server/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/game/server/npc_talker.h b/game/server/npc_talker.h index 9f30c657..23ff6d69 100644 --- a/game/server/npc_talker.h +++ b/game/server/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/game/server/npc_vehicledriver.cpp b/game/server/npc_vehicledriver.cpp index 35776ce7..5e7679aa 100644 --- a/game/server/npc_vehicledriver.cpp +++ b/game/server/npc_vehicledriver.cpp @@ -693,7 +693,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/game/server/physics.cpp b/game/server/physics.cpp index d386b1ae..649a4375 100644 --- a/game/server/physics.cpp +++ b/game/server/physics.cpp @@ -1612,7 +1612,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; @@ -1822,10 +1822,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/game/server/physics_main.cpp b/game/server/physics_main.cpp index 5f76cf7c..a22a28f6 100644 --- a/game/server/physics_main.cpp +++ b/game/server/physics_main.cpp @@ -2042,7 +2042,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/game/server/player.cpp b/game/server/player.cpp index 9084762a..7f51d26a 100644 --- a/game/server/player.cpp +++ b/game/server/player.cpp @@ -1564,7 +1564,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() ) @@ -3207,7 +3207,7 @@ void CBasePlayer::PhysicsSimulate( void ) int commandsToRun = vecAvailCommands.Count(); if ( gpGlobals->simTicksThisFrame >= commandLimit && vecAvailCommands.Count() > commandLimit ) { - int commandsToRollOver = min( vecAvailCommands.Count(), ( gpGlobals->simTicksThisFrame - 1 ) ); + int commandsToRollOver = MIN( vecAvailCommands.Count(), ( gpGlobals->simTicksThisFrame - 1 ) ); commandsToRun = vecAvailCommands.Count() - commandsToRollOver; Assert( commandsToRun >= 0 ); // Clear all contexts except the last one @@ -3857,7 +3857,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; @@ -3871,7 +3871,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; } @@ -6361,7 +6361,7 @@ bool CBasePlayer::ClientCommand( const CCommand &args ) int nRecords = -1; // all if ( args.ArgC() >= 3 ) { - nRecords = max( Q_atoi( args.Arg( 2 ) ), 1 ); + nRecords = MAX( Q_atoi( args.Arg( 2 ) ), 1 ); } CBasePlayer *pl = UTIL_PlayerByIndex( nRecip ); @@ -8172,7 +8172,7 @@ int CBasePlayer::GetFOVForNetworking( void ) if ( gpGlobals->curtime - m_flFOVTime < m_Local.m_flFOVRate ) { - fFOV = min( fFOV, m_iFOVStart ); + fFOV = MIN( fFOV, m_iFOVStart ); } return fFOV; } diff --git a/game/server/player_pickup.cpp b/game/server/player_pickup.cpp index 50857380..63d39930 100644 --- a/game/server/player_pickup.cpp +++ b/game/server/player_pickup.cpp @@ -125,7 +125,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 = SimpleSplineRemapValClamped( mass, 100, 600, flForceMax, flForceMin ); } diff --git a/game/server/player_resource.cpp b/game/server/player_resource.cpp index 97c26528..31353755 100644 --- a/game/server/player_resource.cpp +++ b/game/server/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/game/server/props.cpp b/game/server/props.cpp index 246249cd..68d245e3 100644 --- a/game/server/props.cpp +++ b/game/server/props.cpp @@ -1104,7 +1104,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 @@ -1114,7 +1114,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 = fpmin( m_iHealth, FLAME_DIRECT_DAMAGE_PER_SEC * flBurnTime ); float flIdealDamage = m_iHealth - flIdealHealth; // Scale the damage to do ideal damage. @@ -3301,7 +3301,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 ) { @@ -4758,14 +4758,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] ); } //----------------------------------------------------------------------------- @@ -5210,8 +5210,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/game/server/sceneentity.cpp b/game/server/sceneentity.cpp index 3c05204b..4e24205a 100644 --- a/game/server/sceneentity.cpp +++ b/game/server/sceneentity.cpp @@ -1812,7 +1812,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 @@ -1838,7 +1838,7 @@ void CSceneEntity::DispatchStartSpeak( CChoreoScene *scene, CBaseFlex *actor, CC // Send caption and duration hint down to client UserMessageBegin( filter, "CloseCaption" ); WRITE_STRING( lowercase ); - WRITE_SHORT( min( 255, (int)( duration * 10.0f ) ) ); + WRITE_SHORT( MIN( 255, (int)( duration * 10.0f ) ) ); WRITE_BYTE( byteflags ); // warn on missing MessageEnd(); } @@ -3652,11 +3652,11 @@ public: if (pActor) { m_vecPos1 = pActor->GetAbsOrigin(); - m_flMaxSegmentDistance = min( flMaxRadius, (m_vecPos1 - m_vecPos2).Length() + 1.0 ); + m_flMaxSegmentDistance = MIN( flMaxRadius, (m_vecPos1 - m_vecPos2).Length() + 1.0 ); if (m_flMaxSegmentDistance <= 1.0) { // must be closest to self - m_flMaxSegmentDistance = min( flMaxRadius, MAX_TRACE_LENGTH ); + m_flMaxSegmentDistance = MIN( flMaxRadius, MAX_TRACE_LENGTH ); } } } @@ -4660,7 +4660,7 @@ void CInstancedSceneEntity::DoThink( float frametime ) if ( m_flPreDelay > 0 ) { - m_flPreDelay = max( 0, m_flPreDelay - frametime ); + m_flPreDelay = MAX( 0, m_flPreDelay - frametime ); StartPlayback(); if ( !m_bIsPlayingBack ) return; @@ -4838,7 +4838,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/game/server/slideshow_display.cpp b/game/server/slideshow_display.cpp index 18a86f6e..24af76f2 100644 --- a/game/server/slideshow_display.cpp +++ b/game/server/slideshow_display.cpp @@ -469,7 +469,7 @@ void CSlideshowDisplay::BuildSlideShowImagesList( void ) return; } - int iFileSize = min( g_pFullFileSystem->Size( fh ), SLIDESHOW_LIST_BUFFER_MAX ); + int iFileSize = MIN( g_pFullFileSystem->Size( fh ), SLIDESHOW_LIST_BUFFER_MAX ); int iBytesRead = g_pFullFileSystem->Read( szFileBuffer, iFileSize, fh ); g_pFullFileSystem->Close( fh ); diff --git a/game/server/soundent.cpp b/game/server/soundent.cpp index 6675ef79..8a100e6c 100644 --- a/game/server/soundent.cpp +++ b/game/server/soundent.cpp @@ -525,7 +525,7 @@ void CSoundEnt::Initialize ( void ) // In MP, have one for each player and 32 extras. int nTotalSoundsInPool = MAX_WORLD_SOUNDS_SP; if ( gpGlobals->maxClients > 1 ) - nTotalSoundsInPool = min( MAX_WORLD_SOUNDS_MP, gpGlobals->maxClients + 32 ); + nTotalSoundsInPool = MIN( MAX_WORLD_SOUNDS_MP, gpGlobals->maxClients + 32 ); if ( gpGlobals->maxClients+16 > nTotalSoundsInPool ) { diff --git a/game/server/soundscape_system.cpp b/game/server/soundscape_system.cpp index 68639d69..9802e277 100644 --- a/game/server/soundscape_system.cpp +++ b/game/server/soundscape_system.cpp @@ -240,7 +240,7 @@ void CSoundscapeSystem::FrameUpdatePostEntityThink() // update 2 soundscape entities each tick. (when debugging update // them all) - int count = soundscape_debug.GetBool() ? total : min(2, total); + int count = soundscape_debug.GetBool() ? total : MIN(2, total); for ( int i = 0; i < count; i++ ) { m_activeIndex++; diff --git a/game/server/te_bubbletrail.cpp b/game/server/te_bubbletrail.cpp index 9fe05936..b0ac6986 100644 --- a/game/server/te_bubbletrail.cpp +++ b/game/server/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/game/server/triggers.cpp b/game/server/triggers.cpp index 54ad7499..ad930d2d 100644 --- a/game/server/triggers.cpp +++ b/game/server/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/game/server/util.cpp b/game/server/util.cpp index d72ca646..1a27f582 100644 --- a/game/server/util.cpp +++ b/game/server/util.cpp @@ -712,7 +712,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 @@ -1365,7 +1365,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/GameStats.cpp b/game/shared/GameStats.cpp index 4a8dd8c0..bb5ab04e 100644 --- a/game/shared/GameStats.cpp +++ b/game/shared/GameStats.cpp @@ -141,7 +141,7 @@ public: { T maxsofar = -16000000; for( int i = 0; i < STATS_WINDOW_SIZE; i++ ) - maxsofar = max( maxsofar, m_StatsBuffer[i].*field ); + maxsofar = MAX( maxsofar, m_StatsBuffer[i].*field ); return maxsofar; } @@ -149,7 +149,7 @@ public: { T minsofar = 16000000; for( int i = 0; i < STATS_WINDOW_SIZE; i++ ) - minsofar = min( minsofar, m_StatsBuffer[i].*field ); + minsofar = MIN( minsofar, m_StatsBuffer[i].*field ); return minsofar; } diff --git a/game/shared/SoundEmitterSystem.cpp b/game/shared/SoundEmitterSystem.cpp index 372c18b6..b09e4acd 100644 --- a/game/shared/SoundEmitterSystem.cpp +++ b/game/shared/SoundEmitterSystem.cpp @@ -656,7 +656,7 @@ public: // Send caption and duration hint down to client UserMessageBegin( filterCopy, "CloseCaption" ); WRITE_STRING( lowercase ); - 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 3761f980..6a4d8f5a 100644 --- a/game/shared/Sprite.cpp +++ b/game/shared/Sprite.cpp @@ -271,7 +271,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 ); @@ -669,7 +669,7 @@ void CSprite::GetRenderBounds( Vector &vecMins, Vector &vecMaxs ) CEngineSprite *psprite = (CEngineSprite *) modelinfo->GetModelExtraData( GetModel() ); if ( psprite ) { - float flSize = max( psprite->GetWidth(), psprite->GetHeight() ); + float flSize = MAX( psprite->GetWidth(), psprite->GetHeight() ); flScale *= flSize; } } @@ -786,7 +786,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 4fe2cb0f..daf7bcd7 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 1680e2f6..1b7d60ad 100644 --- a/game/shared/basecombatcharacter_shared.cpp +++ b/game/shared/basecombatcharacter_shared.cpp @@ -119,7 +119,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 15f61d02..db315389 100644 --- a/game/shared/basecombatweapon_shared.cpp +++ b/game/shared/basecombatweapon_shared.cpp @@ -966,7 +966,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 = fpmin( m_flPlaybackRate, 12.0); // FIXME; magic number!, network encoding range } else { @@ -1819,7 +1819,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; @@ -1829,7 +1829,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; @@ -1981,7 +1981,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); } @@ -1989,7 +1989,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 ); } @@ -2062,12 +2062,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 69e5f95c..c313330d 100644 --- a/game/shared/baseplayer_shared.cpp +++ b/game/shared/baseplayer_shared.cpp @@ -1217,10 +1217,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 f48f888f..3b6a8020 100644 --- a/game/shared/beam_shared.h +++ b/game/shared/beam_shared.h @@ -316,13 +316,13 @@ inline void CBeam::SetHaloScale( float 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 195c29ab..f95a3ecc 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/mathlib.h" #include "tier1/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 ); @@ -1621,7 +1620,7 @@ float CCurveData::GetIntensity( 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 ) { @@ -1629,7 +1628,7 @@ float CCurveData::GetIntensity( ICurveDataAccessor *data, float time ) esStart = GetBoundedSample( data, i, dummy ); esEnd = GetBoundedSample( data, i + 1, dummy ); - j = max( j / 2, 1 ); + j = MAX( j / 2, 1 ); if ( time < esStart->time) { i -= j; @@ -1652,8 +1651,8 @@ float CCurveData::GetIntensity( 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 = GetBoundedSample( data, prev, clamp[ 0 ] ); @@ -1803,7 +1802,7 @@ float CCurveData::GetIntensityArea( 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 ) { @@ -1811,7 +1810,7 @@ float CCurveData::GetIntensityArea( ICurveDataAccessor *data, float time ) esStart = GetBoundedSample( data, i, dummy ); esEnd = GetBoundedSample( data, i + 1, dummy ); - j = max( j / 2, 1 ); + j = MAX( j / 2, 1 ); if ( time < esStart->time) { i -= j; @@ -1834,8 +1833,8 @@ float CCurveData::GetIntensityArea( 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 = GetBoundedSample( data, prev, clamp[ 0 ] ); @@ -1920,7 +1919,7 @@ void CCurveData::UpdateIntensityArea( ICurveDataAccessor *data ) bool dummy; CExpressionSample *esPre = GetBoundedSample( data, i - 1, dummy ); CExpressionSample *esStart = GetBoundedSample( data, i, dummy ); - CExpressionSample *esEnd = GetBoundedSample( data, min( i + 1, rampCount ), dummy ); + CExpressionSample *esEnd = GetBoundedSample( data, MIN( i + 1, rampCount ), dummy ); Vector vPre( esPre->time, esPre->value, 0 ); Vector vStart( esStart->time, esStart->value, 0 ); @@ -1929,7 +1928,7 @@ void CCurveData::UpdateIntensityArea( ICurveDataAccessor *data ) Vector vOut; for (i = -1; i < rampCount; i++) { - CExpressionSample *esNext = GetBoundedSample( data, min( i + 2, rampCount ), dummy ); + CExpressionSample *esNext = GetBoundedSample( data, MIN( i + 2, rampCount ), dummy ); Vector vNext( esNext->time, esNext->value, 0 ); Catmull_Rom_Spline_Integral_Normalize( @@ -3167,10 +3166,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; @@ -3293,10 +3292,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; @@ -3447,7 +3446,7 @@ void CChoreoEvent::SetLoopCount( int numloops ) { Assert( GetType() == LOOP ); // Never below -1 - m_nNumLoops = max( numloops, -1 ); + m_nNumLoops = MAX( numloops, -1 ); } //----------------------------------------------------------------------------- @@ -3667,14 +3666,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 218fc6d2..63c1d107 100644 --- a/game/shared/collisionproperty.cpp +++ b/game/shared/collisionproperty.cpp @@ -982,15 +982,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 2dcd1e70..d2ed9801 100644 --- a/game/shared/gamemovement.cpp +++ b/game/shared/gamemovement.cpp @@ -275,7 +275,7 @@ public: return DIFFCHECK_DIFFERS; } - int maxSlot = max( serverslot->m_Lines.Count(), clientslot->m_Lines.Count() ); + int maxSlot = MAX( serverslot->m_Lines.Count(), clientslot->m_Lines.Count() ); if ( !bSpew ) { for ( int i = 0; i < maxSlot; ++i ) @@ -376,7 +376,7 @@ public: // Now compare them CDiffInfo *clientslot = &m_Client[ clidx ]; - int maxSlot = max( serverslot->m_Lines.Count(), clientslot->m_Lines.Count() ); + int maxSlot = MAX( serverslot->m_Lines.Count(), clientslot->m_Lines.Count() ); for ( int i = 0; i < maxSlot; ++i ) { @@ -993,7 +993,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 @@ -3602,7 +3602,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) @@ -3613,7 +3613,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 ); @@ -3625,8 +3625,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) @@ -3637,8 +3637,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) @@ -3808,7 +3808,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 ) @@ -4006,7 +4006,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 ) { @@ -4246,7 +4246,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. @@ -4344,7 +4344,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/hl2/hl_gamemovement.cpp b/game/shared/hl2/hl_gamemovement.cpp index 1ab00148..4f04e27e 100644 --- a/game/shared/hl2/hl_gamemovement.cpp +++ b/game/shared/hl2/hl_gamemovement.cpp @@ -607,7 +607,7 @@ void CHL2GameMovement::FullLadderMove() dist1sqr = ( topPosition - mv->GetAbsOrigin() ).LengthSqr(); dist2sqr = ( bottomPosition - mv->GetAbsOrigin() ).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 df0c1cb1..5b86e80b 100644 --- a/game/shared/hl2mp/weapon_physcannon.cpp +++ b/game/shared/hl2mp/weapon_physcannon.cpp @@ -1703,7 +1703,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++ ) @@ -1715,7 +1715,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 { @@ -1770,7 +1770,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 c336ca6a..6c3d74a7 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; @@ -606,7 +606,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 320a6b0f..02a95d2f 100644 --- a/game/shared/multiplay_gamerules.cpp +++ b/game/shared/multiplay_gamerules.cpp @@ -1029,7 +1029,7 @@ bool CMultiplayRules::Init() 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 d3553b6b..b3c9b790 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/particlesystemquery.cpp b/game/shared/particlesystemquery.cpp index f09cef5f..15ea2bdd 100644 --- a/game/shared/particlesystemquery.cpp +++ b/game/shared/particlesystemquery.cpp @@ -236,7 +236,7 @@ void CParticleSystemQuery::GetRandomPointsOnControllingObjectHitBox( int nHitbox = 0; int nNumIters = nNumTrysToGetAPointInsideTheModel; if (! vecDirectionalBias.IsZero( 0.0001 ) ) - nNumIters = max( nNumIters, 5 ); + nNumIters = MAX( nNumIters, 5 ); for( int i=0 ; i < nNumPtsOut; i++) { @@ -313,7 +313,7 @@ void CParticleSystemQuery::GetRandomPointsOnControllingObjectHitBox( int nHitbox = 0; int nNumIters = nNumTrysToGetAPointInsideTheModel; if (! vecDirectionalBias.IsZero( 0.0001 ) ) - nNumIters = max( nNumIters, 5 ); + nNumIters = MAX( nNumIters, 5 ); for( int i=0 ; i < nNumPtsOut; i++) { @@ -421,7 +421,7 @@ int CParticleSystemQuery::GetControllingObjectHitBoxInfo( if ( set ) { - nRet = min( nBufSize, set->numhitboxes ); + nRet = MIN( nBufSize, set->numhitboxes ); for( int i=0 ; i < nRet; i++ ) { mstudiobbox_t *pBox = set->pHitbox( i ); @@ -613,7 +613,7 @@ float CParticleSystemQuery::GetPixelVisibility( int *pQueryHandle, const Vector pixelvis_queryparams_t params; params.Init( vecOrigin, flScale, 1.0 ); float flVisibility = PixelVisibility_FractionVisible( params, pQueryHandle ); - flVisibility = max( 0.0f, flVisibility ); + flVisibility = MAX( 0.0f, flVisibility ); return flVisibility; #else return 0.0f; 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 704825ca..d6b5bf88 100644 --- a/game/shared/props_shared.cpp +++ b/game/shared/props_shared.cpp @@ -480,7 +480,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]); @@ -913,7 +913,7 @@ void PropBreakableCreateAll( int modelindex, IPhysicsObject *pPhysics, const bre { if ( iPrecomputedBreakableCount != -1 ) { - iPrecomputedBreakableCount = min( iMaxBreakCount, iPrecomputedBreakableCount ); + iPrecomputedBreakableCount = MIN( iMaxBreakCount, iPrecomputedBreakableCount ); } else { @@ -1299,7 +1299,7 @@ CBaseEntity *CreateGibsFromList( CUtlVector &list, int modelindex, { 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 c238ee63..b52a166a 100644 --- a/game/shared/ragdoll_shared.cpp +++ b/game/shared/ragdoll_shared.cpp @@ -401,7 +401,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 5726673f..52df8cbb 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 2917e8bf..e7dfab4e 100644 --- a/game/shared/saverestore.h +++ b/game/shared/saverestore.h @@ -293,7 +293,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 dbb29dc6..bff2892f 100644 --- a/game/shared/saverestore_bitstring.h +++ b/game/shared/saverestore_bitstring.h @@ -45,7 +45,7 @@ public: pBitString->ClearAll(); } int numIntsInStream = CalcNumIntsForBits( numBits ); - int readSize = min( pBitString->GetNumDWords(), numIntsInStream ); + int readSize = MIN( pBitString->GetNumDWords(), numIntsInStream ); pRestore->ReadInt( pBitString->Base(), 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 006a0580..63f6e019 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 7e3141ff..ea209ffd 100644 --- a/game/shared/takedamageinfo.cpp +++ b/game/shared/takedamageinfo.cpp @@ -237,7 +237,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() ); bool bHasPhysicsForceDamage = !g_pGameRules->Damage_NoPhysicsForce( info.GetDamageType() ); diff --git a/game/shared/teamplayroundbased_gamerules.cpp b/game/shared/teamplayroundbased_gamerules.cpp index 7bb73658..08132cef 100644 --- a/game/shared/teamplayroundbased_gamerules.cpp +++ b/game/shared/teamplayroundbased_gamerules.cpp @@ -1373,7 +1373,7 @@ void CTeamplayRoundBasedRules::State_Think_RND_RUNNING( void ) //----------------------------------------------------------------------------- void CTeamplayRoundBasedRules::State_Enter_TEAM_WIN( void ) { - float flTime = max( 5, mp_bonusroundtime.GetFloat() ); + float flTime = MAX( 5, mp_bonusroundtime.GetFloat() ); m_flStateTransitionTime = gpGlobals->curtime + flTime * mp_enableroundwaittime.GetFloat(); @@ -2519,7 +2519,7 @@ float CTeamplayRoundBasedRules::GetRespawnWaveMaxLength( int iTeam, bool bScaleW // For long respawn times, scale the time as the number of players drops if ( bScaleWithNumPlayers && flTime > 5 ) { - flTime = max( 5, flTime * GetRespawnTimeScalar(iTeam) ); + flTime = MAX( 5, flTime * GetRespawnTimeScalar(iTeam) ); } return flTime; @@ -2589,7 +2589,7 @@ bool CTeamplayRoundBasedRules::WouldChangeUnbalanceTeams( int iNewTeam, int iCur if ( i == iCurrentTeam ) { - iNumPlayers = max( 0, iNumPlayers-1 ); + iNumPlayers = MAX( 0, iNumPlayers-1 ); } if ( ( iNewTeamPlayers - iNumPlayers ) > mp_teams_unbalance_limit.GetInt() ) diff --git a/game/shared/vphysics_sound.h b/game/shared/vphysics_sound.h index 0b487e47..d610b6f4 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/mathlib/imagequant.cpp b/mathlib/imagequant.cpp index 33e86ac5..bdba52a6 100644 --- a/mathlib/imagequant.cpp +++ b/mathlib/imagequant.cpp @@ -6,7 +6,6 @@ // //=============================================================================// #include -#include #define N_EXTRAVALUES 1 #define N_DIMENSIONS (3+N_EXTRAVALUES) @@ -46,7 +45,7 @@ void ColorQuantize(uint8 const *Image, val1+=PIXEL(x,y,c)*ExtraValueXForms[i*3+c]; val1>>=8; NthSample(s,y*Width+x,N_DIMENSIONS)->Value[c]=(uint8) - (min(255,max(0,val1))); + (MIN(255,MAX(0,val1))); } } struct QuantizedValue *q=Quantize(s,Width*Height,N_DIMENSIONS, @@ -76,7 +75,7 @@ void ColorQuantize(uint8 const *Image, tryc+=Error[x][c][ErrorUse]; Error[x][c][ErrorUse]=0; } - samp[c]=(uint8) min(255,max(0,tryc)); + samp[c]=(uint8) MIN(255,MAX(0,tryc)); } struct QuantizedValue *f=FindMatch(samp,3,Weights,q); out_pixels[Width*y+x]=(uint8) (f->value); diff --git a/mathlib/mathlib_base.cpp b/mathlib/mathlib_base.cpp index fd763f20..353dc2af 100644 --- a/mathlib/mathlib_base.cpp +++ b/mathlib/mathlib_base.cpp @@ -1667,7 +1667,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 ); @@ -3938,10 +3938,10 @@ void CalcTriangleTangentSpace( const Vector &p0, const Vector &p1, const Vector //----------------------------------------------------------------------------- void RGBtoHSV( const Vector &rgb, Vector &hsv ) { - float flMax = max( rgb.x, rgb.y ); - flMax = max( flMax, rgb.z ); - float flMin = min( rgb.x, rgb.y ); - flMin = min( flMin, rgb.z ); + float flMax = MAX( rgb.x, rgb.y ); + flMax = MAX( flMax, rgb.z ); + float flMin = MIN( rgb.x, rgb.y ); + flMin = MIN( flMin, rgb.z ); // hsv.z is the value hsv.z = flMax; diff --git a/mathlib/quantize.cpp b/mathlib/quantize.cpp index e80d2fdf..dbaf15f2 100644 --- a/mathlib/quantize.cpp +++ b/mathlib/quantize.cpp @@ -18,7 +18,6 @@ #endif #include -#include #include @@ -411,8 +410,8 @@ static void Label(struct QuantizedValue *q, int updatecolor) else for(int i=0;iMins[i]=min(q->Children[0]->Mins[i],q->Children[1]->Mins[i]); - q->Maxs[i]=max(q->Children[0]->Maxs[i],q->Children[1]->Maxs[i]); + q->Mins[i]=MIN(q->Children[0]->Mins[i],q->Children[1]->Mins[i]); + q->Maxs[i]=MAX(q->Children[0]->Maxs[i],q->Children[1]->Maxs[i]); } } } diff --git a/mathlib/simdvectormatrix.cpp b/mathlib/simdvectormatrix.cpp index c5239319..ca21743e 100644 --- a/mathlib/simdvectormatrix.cpp +++ b/mathlib/simdvectormatrix.cpp @@ -48,7 +48,7 @@ void CSIMDVectorMatrix::CreateFromRGBA_FloatImageData(int srcwidth, int srcheigh { for(int cp=0;cp<4; cp++) { - int real_cp=min( cp, ntrailing_pixels_per_source_line-1 ); + int real_cp=MIN( cp, ntrailing_pixels_per_source_line-1 ); data_out[4*c+cp]= data_in[c+4*real_cp]; } } diff --git a/mathlib/sparse_convolution_noise.cpp b/mathlib/sparse_convolution_noise.cpp index 07a06d4a..e358135e 100644 --- a/mathlib/sparse_convolution_noise.cpp +++ b/mathlib/sparse_convolution_noise.cpp @@ -130,8 +130,8 @@ float SparseConvolutionNoise(Vector const &pnt, float (*pNoiseShapeFunction)(flo pNoiseShapeFunction ); } #ifdef MEASURE_RANGE - fmin1=min(sum_out,fmin1); - fmax1=max(sum_out,fmax1); + fmin1=MIN(sum_out,fmin1); + fmax1=MAX(sum_out,fmax1); #endif return RemapValClamped( sum_out, .544487, 9.219176, 0.0, 1.0 ); } diff --git a/mathlib/sse.cpp b/mathlib/sse.cpp index 83972318..d4788705 100644 --- a/mathlib/sse.cpp +++ b/mathlib/sse.cpp @@ -303,8 +303,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 diff --git a/public/bitmap/float_bm.h b/public/bitmap/float_bm.h index 3d52fd6e..ba84c79d 100644 --- a/public/bitmap/float_bm.h +++ b/public/bitmap/float_bm.h @@ -46,10 +46,10 @@ inline PixRGBAF PixRGBA8_to_F( PixRGBA8 const &x ) inline PixRGBA8 PixRGBAF_to_8( PixRGBAF const &f ) { PixRGBA8 x; - x.Red = max( 0, min( 255.0,255.0*f.Red ) ); - x.Green = max( 0, min( 255.0,255.0*f.Green ) ); - x.Blue = max( 0, min( 255.0,255.0*f.Blue ) ); - x.Alpha = max( 0, min( 255.0,255.0*f.Alpha ) ); + x.Red = MAX( 0, MIN( 255.0,255.0*f.Red ) ); + x.Green = MAX( 0, MIN( 255.0,255.0*f.Green ) ); + x.Blue = MAX( 0, MIN( 255.0,255.0*f.Blue ) ); + x.Alpha = MAX( 0, MIN( 255.0,255.0*f.Alpha ) ); return x; } @@ -296,7 +296,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 04d37564..00aa3de8 100644 --- a/public/bone_setup.cpp +++ b/public/bone_setup.cpp @@ -800,9 +800,9 @@ static void CalcZeroframeData( const CStudioHdr *pStudioHdr, const studiohdr_t * { s1 = clamp( (fFrame - index * animdesc.zeroframespan) / animdesc.zeroframespan, 0.0f, 1.0f ); } - int i0 = max( index - 1, 0 ); + int i0 = MAX( index - 1, 0 ); int i1 = index; - int i2 = min( index + 1, animdesc.zeroframecount - 1 ); + int i2 = MIN( index + 1, animdesc.zeroframecount - 1 ); for (j = 0; j < pAnimStudioHdr->numbones; j++) { if (pAnimGroup) @@ -2710,8 +2710,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; @@ -2731,7 +2731,7 @@ bool Studio_SolveIK( int iThigh, int iKnee, int iFoot, Vector &targetFoot, Vecto // too close? // limit distance to about an 80 degree knee bend - float minDist = max( fabs(l1 - l2) * 1.15, min( l1, l2 ) * 0.15 ); + float minDist = MAX( fabs(l1 - l2) * 1.15, MIN( l1, l2 ) * 0.15 ); if (ikFoot.Length() < minDist) { // too close to get an accurate vector, just use original vector @@ -3195,7 +3195,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 ) ); } } @@ -3689,7 +3689,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 ); } @@ -3707,7 +3707,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: @@ -3716,7 +3716,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); } @@ -3882,11 +3882,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) { @@ -4647,7 +4647,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/materialsystem/imesh.h b/public/materialsystem/imesh.h index 4d6a9d4a..617bbf82 100644 --- a/public/materialsystem/imesh.h +++ b/public/materialsystem/imesh.h @@ -2695,7 +2695,7 @@ inline void CIndexBuilder::GenerateIndices( MaterialPrimitiveType_t primitiveTyp return; int nMaxIndices = m_nMaxIndexCount - m_nCurrentIndex; - nIndexCount = min( nMaxIndices, nIndexCount ); + nIndexCount = MIN( nMaxIndices, nIndexCount ); if ( nIndexCount == 0 ) return; diff --git a/public/mathlib/compressed_vector.h b/public/mathlib/compressed_vector.h index 4dfb0f90..a33601ae 100644 --- a/public/mathlib/compressed_vector.h +++ b/public/mathlib/compressed_vector.h @@ -58,8 +58,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 = fpmax( fmax, fabs( vOther.z ) ); for (exp = 0; exp < 3; exp++) { diff --git a/public/mathlib/mathlib.h b/public/mathlib/mathlib.h index 070bfa47..923a97d6 100644 --- a/public/mathlib/mathlib.h +++ b/public/mathlib/mathlib.h @@ -224,12 +224,12 @@ FORCEINLINE void VectorClear(vec_t *a) FORCEINLINE 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 float VectorMaximum(const Vector& v) { - return max( v.x, max( v.y, v.z ) ); + return MAX( v.x, MAX( v.y, v.z ) ); } FORCEINLINE void VectorScale (const float* in, vec_t scale, float* out) @@ -254,7 +254,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];} @@ -1419,7 +1419,7 @@ FORCEINLINE unsigned char LinearToLightmap( float f ) FORCEINLINE void ColorClamp( Vector& color ) { - float maxc = max( color.x, max( color.y, color.z ) ); + float maxc = MAX( color.x, MAX( color.y, color.z ) ); if ( maxc > 1.0f ) { float ooMax = 1.0f / maxc; @@ -1915,10 +1915,10 @@ FORCEINLINE unsigned int * PackNormal_SHORT2( float nx, float ny, float nz, unsi ny *= 16384.0f; // '0' and '32768' values are invalid encodings - nx = max( nx, 1.0f ); // Make sure there are no zero values - ny = max( ny, 1.0f ); - nx = min( nx, 32767.0f ); // Make sure there are no 32768 values - ny = min( ny, 32767.0f ); + nx = MAX( nx, 1.0f ); // Make sure there are no zero values + ny = MAX( ny, 1.0f ); + nx = MIN( nx, 32767.0f ); // Make sure there are no 32768 values + ny = MIN( ny, 32767.0f ); if ( nz < 0.0f ) nx = -nx; // Set the sign bit for z diff --git a/public/mathlib/ssemath.h b/public/mathlib/ssemath.h index a6d15820..e9b294ce 100644 --- a/public/mathlib/ssemath.h +++ b/public/mathlib/ssemath.h @@ -436,23 +436,23 @@ FORCEINLINE fltx4 ArcTan2SIMD( const fltx4 &a, const fltx4 &b ) return result; } -FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // max(a,b) +FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // MAX(a,b) { fltx4 retVal; - SubFloat( retVal, 0 ) = max( SubFloat( a, 0 ), SubFloat( b, 0 ) ); - SubFloat( retVal, 1 ) = max( SubFloat( a, 1 ), SubFloat( b, 1 ) ); - SubFloat( retVal, 2 ) = max( SubFloat( a, 2 ), SubFloat( b, 2 ) ); - SubFloat( retVal, 3 ) = max( SubFloat( a, 3 ), SubFloat( b, 3 ) ); + SubFloat( retVal, 0 ) = MAX( SubFloat( a, 0 ), SubFloat( b, 0 ) ); + SubFloat( retVal, 1 ) = MAX( SubFloat( a, 1 ), SubFloat( b, 1 ) ); + SubFloat( retVal, 2 ) = MAX( SubFloat( a, 2 ), SubFloat( b, 2 ) ); + SubFloat( retVal, 3 ) = MAX( SubFloat( a, 3 ), SubFloat( b, 3 ) ); return retVal; } -FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // min(a,b) +FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // MIN(a,b) { fltx4 retVal; - SubFloat( retVal, 0 ) = min( SubFloat( a, 0 ), SubFloat( b, 0 ) ); - SubFloat( retVal, 1 ) = min( SubFloat( a, 1 ), SubFloat( b, 1 ) ); - SubFloat( retVal, 2 ) = min( SubFloat( a, 2 ), SubFloat( b, 2 ) ); - SubFloat( retVal, 3 ) = min( SubFloat( a, 3 ), SubFloat( b, 3 ) ); + SubFloat( retVal, 0 ) = MIN( SubFloat( a, 0 ), SubFloat( b, 0 ) ); + SubFloat( retVal, 1 ) = MIN( SubFloat( a, 1 ), SubFloat( b, 1 ) ); + SubFloat( retVal, 2 ) = MIN( SubFloat( a, 2 ), SubFloat( b, 2 ) ); + SubFloat( retVal, 3 ) = MIN( SubFloat( a, 3 ), SubFloat( b, 3 ) ); return retVal; } @@ -858,7 +858,7 @@ FORCEINLINE void TransposeSIMD( fltx4 & x, fltx4 & y, fltx4 & z, fltx4 & w ) // and replicate it to the whole return value. FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 & a ) { - float lowest = min( min( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2)); + float lowest = MIN( MIN( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2)); return ReplicateX4(lowest); } @@ -866,7 +866,7 @@ FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 & a ) // and replicate it to the whole return value. FORCEINLINE fltx4 FindHighestSIMD3( const fltx4 & a ) { - float highest = max( max( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2)); + float highest = MAX( MAX( SubFloat(a, 0), SubFloat(a, 1) ), SubFloat(a, 2)); return ReplicateX4(highest); } @@ -1067,12 +1067,12 @@ FORCEINLINE fltx4 ArcTan2SIMD( const fltx4 &a, const fltx4 &b ) // DivSIMD defined further down, since it uses ReciprocalSIMD -FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // max(a,b) +FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // MAX(a,b) { return __vmaxfp( a, b ); } -FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // min(a,b) +FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // MIN(a,b) { return __vminfp( a, b ); } @@ -1520,11 +1520,11 @@ FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 & a ) compareOne = __vrlimi( compareOne, a, 8 | 4 , 1 ); // compareOne is [y,z,G,G] fltx4 retval = MinSIMD( a, compareOne ); - // retVal is [min(x,y), min(y,z), G, G] + // retVal is [MIN(x,y), MIN(y,z), G, G] compareOne = __vrlimi( compareOne, a, 8 , 2); // compareOne is [z, G, G, G] retval = MinSIMD( retval, compareOne ); - // retVal = [ min(min(x,y),z), G, G, G ] + // retVal = [ MIN(MIN(x,y),z), G, G, G ] // splat the x component out to the whole vector and return return SplatXSIMD( retval ); @@ -1544,11 +1544,11 @@ FORCEINLINE fltx4 FindHighestSIMD3( const fltx4 & a ) compareOne = __vrlimi( compareOne, a, 8 | 4 , 1 ); // compareOne is [y,z,G,G] fltx4 retval = MaxSIMD( a, compareOne ); - // retVal is [max(x,y), max(y,z), G, G] + // retVal is [MAX(x,y), MAX(y,z), G, G] compareOne = __vrlimi( compareOne, a, 8 , 2); // compareOne is [z, G, G, G] retval = MaxSIMD( retval, compareOne ); - // retVal = [ max(max(x,y),z), G, G, G ] + // retVal = [ MAX(MAX(x,y),z), G, G, G ] // splat the x component out to the whole vector and return return SplatXSIMD( retval ); @@ -2120,12 +2120,12 @@ FORCEINLINE fltx4 CmpInBoundsSIMD( const fltx4 & a, const fltx4 & b ) // (a <= return AndSIMD( CmpLeSIMD(a,b), CmpGeSIMD(a, NegSIMD(b)) ); } -FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // min(a,b) +FORCEINLINE fltx4 MinSIMD( const fltx4 & a, const fltx4 & b ) // MIN(a,b) { return _mm_min_ps( a, b ); } -FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // max(a,b) +FORCEINLINE fltx4 MaxSIMD( const fltx4 & a, const fltx4 & b ) // MAX(a,b) { return _mm_max_ps( a, b ); } @@ -2271,11 +2271,11 @@ FORCEINLINE fltx4 FindLowestSIMD3( const fltx4 &a ) fltx4 compareOne = RotateLeft( a ); // compareOne is [y,z,G,x] fltx4 retval = MinSIMD( a, compareOne ); - // retVal is [min(x,y), ... ] + // retVal is [MIN(x,y), ... ] compareOne = RotateLeft2( a ); // compareOne is [z, G, x, y] retval = MinSIMD( retval, compareOne ); - // retVal = [ min(min(x,y),z)..] + // retVal = [ MIN(MIN(x,y),z)..] // splat the x component out to the whole vector and return return SplatXSIMD( retval ); @@ -2288,11 +2288,11 @@ FORCEINLINE fltx4 FindHighestSIMD3( const fltx4 &a ) fltx4 compareOne = RotateLeft( a ); // compareOne is [y,z,G,x] fltx4 retval = MaxSIMD( a, compareOne ); - // retVal is [max(x,y), ... ] + // retVal is [MAX(x,y), ... ] compareOne = RotateLeft2( a ); // compareOne is [z, G, x, y] retval = MaxSIMD( retval, compareOne ); - // retVal = [ max(max(x,y),z)..] + // retVal = [ MAX(MAX(x,y),z)..] // splat the x component out to the whole vector and return return SplatXSIMD( retval ); diff --git a/public/mathlib/ssequaternion.h b/public/mathlib/ssequaternion.h index d38c3c09..5021c315 100644 --- a/public/mathlib/ssequaternion.h +++ b/public/mathlib/ssequaternion.h @@ -233,7 +233,7 @@ FORCEINLINE fltx4 QuaternionScaleSIMD( const fltx4 &p, float t ) // 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( SubFloat( p, 0 ) * SubFloat( p, 0 ) + SubFloat( p, 1 ) * SubFloat( p, 1 ) + SubFloat( p, 2 ) * SubFloat( p, 2 ) ); - sinom = min( sinom, 1.f ); + sinom = MIN( sinom, 1.f ); float sinsom = sin( asin( sinom ) * t ); diff --git a/public/mathlib/vector.h b/public/mathlib/vector.h index 3884436d..6b332b56 100644 --- a/public/mathlib/vector.h +++ b/public/mathlib/vector.h @@ -31,7 +31,6 @@ #include "tier0/threadtools.h" #include "mathlib/vector2d.h" #include "mathlib/math_pfns.h" -#include "minmax.h" // Uncomment this to add extra Asserts to check for NANs, uninitialized vecs, etc. //#define VECTOR_PARANOIA 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/particles/particles.h b/public/particles/particles.h index b8364088..45cb145f 100644 --- a/public/particles/particles.h +++ b/public/particles/particles.h @@ -519,7 +519,7 @@ public: FORCEINLINE void RecordExecutionTime( float flETime ) { m_flUncomittedTime += flETime; - m_flMaxExecutionTime = max( m_flMaxExecutionTime, flETime ); + m_flMaxExecutionTime = MAX( m_flMaxExecutionTime, flETime ); } FORCEINLINE float TotalRecordedExecutionTime( void ) const @@ -931,8 +931,8 @@ struct CPathParameters void ClampControlPointIndices( void ) { - m_nStartControlPointNumber = max(0, min( MAX_PARTICLE_CONTROL_POINTS-1, m_nStartControlPointNumber ) ); - m_nEndControlPointNumber = max(0, min( MAX_PARTICLE_CONTROL_POINTS-1, m_nEndControlPointNumber ) ); + m_nStartControlPointNumber = MAX(0, MIN( MAX_PARTICLE_CONTROL_POINTS-1, m_nStartControlPointNumber ) ); + m_nEndControlPointNumber = MAX(0, MIN( MAX_PARTICLE_CONTROL_POINTS-1, m_nEndControlPointNumber ) ); } }; @@ -1479,7 +1479,7 @@ inline void CParticleCollection::SetAttributeToConstant( int nAttribute, float f inline void CParticleCollection::SetControlPoint( int nWhichPoint, const Vector &v ) { Assert( ( nWhichPoint >= 0) && ( nWhichPoint < MAX_PARTICLE_CONTROL_POINTS ) ); - m_nHighestCP = max( m_nHighestCP, nWhichPoint ); + m_nHighestCP = MAX( m_nHighestCP, nWhichPoint ); m_ControlPoints[ nWhichPoint ].m_Position = v; for( CParticleCollection *i = m_Children.m_pHead; i; i=i->m_pNext ) { 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 90fe05fc..fb0f6e4a 100644 --- a/public/sentence.cpp +++ b/public/sentence.cpp @@ -1096,7 +1096,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 } @@ -1491,10 +1491,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 b8b121db..396e0e11 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/stdstring.h b/public/stdstring.h index de602725..31804de6 100644 --- a/public/stdstring.h +++ b/public/stdstring.h @@ -23,9 +23,7 @@ #pragma warning(disable:4511) #endif -#include "tier0/valve_minmax_off.h" // GCC 4.2.2 headers screw up our min/max defs. #include -#include "tier0/valve_minmax_on.h" // GCC 4.2.2 headers screw up our min/max defs. #ifdef _WIN32 #pragma warning(pop) diff --git a/public/studio.cpp b/public/studio.cpp index caa21f71..f303fdb6 100644 --- a/public/studio.cpp +++ b/public/studio.cpp @@ -575,7 +575,7 @@ int studiohdr_t::GetActivityListVersion( void ) const Assert( pStudioHdr ); - version = min( version, pStudioHdr->activitylistversion ); + version = MIN( version, pStudioHdr->activitylistversion ); } return version; @@ -1208,7 +1208,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; @@ -1251,7 +1251,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; @@ -1416,8 +1416,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: { @@ -1682,7 +1682,7 @@ void CStudioHdr::CActivityToSequenceMapping::Initialize( CStudioHdr * __restrict HashValueType &element = m_ActToSeqHash[handle]; element.startingIdx = sequenceCount; sequenceCount += element.count; - topActivity = max(topActivity, element.activityIdx); + topActivity = MAX(topActivity, element.activityIdx); } diff --git a/public/studio.h b/public/studio.h index 3c4dbd0c..f7612ae5 100644 --- a/public/studio.h +++ b/public/studio.h @@ -1688,7 +1688,7 @@ struct thinModelVertices_t { Assert( ( m_numBoneInfluences >= 1 ) && ( m_numBoneInfluences <= 3 ) ); Assert( ( boneWeights.numbones >= 1 ) && ( boneWeights.numbones <= m_numBoneInfluences ) ); - int numStoredWeights = max( 0, ( m_numBoneInfluences - 1 ) ); + int numStoredWeights = MAX( 0, ( m_numBoneInfluences - 1 ) ); float *pBaseWeight = m_boneWeights + vertIndex*numStoredWeights; char *pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences; for ( int i = 0; i < m_numBoneInfluences; i++ ) @@ -1758,7 +1758,7 @@ private: Assert( pBoneWeights ); Assert( ( m_numBoneInfluences <= 1 ) || ( m_boneWeights != NULL ) ); Assert( ( m_numBoneInfluences <= 0 ) || ( m_boneIndices != NULL ) ); - int numStoredWeights = max( 0, ( m_numBoneInfluences - 1 ) ); + int numStoredWeights = MAX( 0, ( m_numBoneInfluences - 1 ) ); float *pBaseWeight = m_boneWeights + vertIndex*numStoredWeights; char *pBaseIndex = m_boneIndices + vertIndex*m_numBoneInfluences; float sum = 0.0f; diff --git a/public/studio_virtualmodel.cpp b/public/studio_virtualmodel.cpp index f8bf971c..8f2c53f3 100644 --- a/public/studio_virtualmodel.cpp +++ b/public/studio_virtualmodel.cpp @@ -474,8 +474,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 ccf15dcd..d488c12f 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" @@ -36,7 +37,6 @@ #define NULL 0 #endif - #if defined _LINUX && !defined __APPLE__ typedef unsigned int uintptr_t; #elif defined __APPLE__ @@ -75,11 +75,27 @@ inline T AlignValue( T val, unsigned alignment ) #endif #define M_PI 3.14159265358979323846 -#include "valve_minmax_on.h" +// #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 ) ) +#endif #if !defined(_X360) -#define fpmin min -#define fpmax max +FORCEINLINE float fpmin( float a, float b ) +{ + return ( a < b ) ? a : b; +} + +FORCEINLINE float fpmax( float a, float b ) +{ + return ( a > b ) ? a : b; +} #endif #ifdef __cplusplus diff --git a/public/tier0/platform.h b/public/tier0/platform.h index d209acfa..15ae413e 100644 --- a/public/tier0/platform.h +++ b/public/tier0/platform.h @@ -27,7 +27,6 @@ #endif #include "wchartypes.h" -#include "basetypes.h" #include "tier0/valve_off.h" #ifdef _WIN32 @@ -56,8 +55,6 @@ // need this for memset #include -#include "tier0/valve_minmax_on.h" // GCC 4.2.2 headers screw up our min/max defs. - #ifdef _RETAIL #define IsRetail() true #else diff --git a/public/tier0/valve_minmax_off.h b/public/tier0/valve_minmax_off.h deleted file mode 100644 index 827ae2a9..00000000 --- a/public/tier0/valve_minmax_off.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifdef min - #undef min -#endif - -#ifdef max - #undef max -#endif - diff --git a/public/tier0/valve_minmax_on.h b/public/tier0/valve_minmax_on.h deleted file mode 100644 index 99a2c5fe..00000000 --- a/public/tier0/valve_minmax_on.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef min - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifndef max - #define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - diff --git a/public/tier1/bitbuf.h b/public/tier1/bitbuf.h index 9ffc8b3c..9b6ba834 100644 --- a/public/tier1/bitbuf.h +++ b/public/tier1/bitbuf.h @@ -1097,7 +1097,7 @@ FORCEINLINE int CBitRead::GetNumBitsRead( void ) const return 0; int nCurOfs = ( 32 - m_nBitsAvail ) + ( 8 * sizeof( m_pData[0] ) * ( m_pDataIn - m_pData -1 ) ); int nAdjust = 8 * ( m_nDataBytes & 3 ); - return min ( nCurOfs + nAdjust, m_nDataBits ); + return MIN ( nCurOfs + nAdjust, m_nDataBits ); } diff --git a/public/tier1/mempool.h b/public/tier1/mempool.h index 3f334596..3b927812 100644 --- a/public/tier1/mempool.h +++ b/public/tier1/mempool.h @@ -142,7 +142,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/utlblockmemory.h b/public/tier1/utlblockmemory.h index e2da55d5..8d174466 100644 --- a/public/tier1/utlblockmemory.h +++ b/public/tier1/utlblockmemory.h @@ -88,7 +88,7 @@ public: int NumAllocated() const; int Count() const { return NumAllocated(); } - // Grows memory by max(num,growsize) rounded up to the next power of 2, and returns the allocation index/ptr + // Grows memory by MAX(num,growsize) rounded up to the next power of 2, and returns the allocation index/ptr void Grow( int num = 1 ); // Makes sure we've got at least this much memory diff --git a/public/tier1/utlfixedmemory.h b/public/tier1/utlfixedmemory.h index 8d0b89e8..c5587f07 100644 --- a/public/tier1/utlfixedmemory.h +++ b/public/tier1/utlfixedmemory.h @@ -123,7 +123,7 @@ public: int NumAllocated() const; int Count() const { return NumAllocated(); } - // Grows memory by max(num,growsize), and returns the allocation index/ptr + // Grows memory by MAX(num,growsize), and returns the allocation index/ptr void Grow( int num = 1 ); // Makes sure we've got at least this much memory diff --git a/public/tier1/utlmemory.h b/public/tier1/utlmemory.h index fa7d234c..a55f571e 100644 --- a/public/tier1/utlmemory.h +++ b/public/tier1/utlmemory.h @@ -132,7 +132,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 3593d82a..02aa4e40 100644 --- a/public/tier1/utlrbtree.h +++ b/public/tier1/utlrbtree.h @@ -1323,7 +1323,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/vstdlib/jobthread.h b/public/vstdlib/jobthread.h index 5aed64ee..d74f3d3a 100644 --- a/public/vstdlib/jobthread.h +++ b/public/vstdlib/jobthread.h @@ -104,7 +104,7 @@ struct ThreadPoolStartParams_t if ( bUseAffinityTable ) { // user supplied an optional 1:1 affinity mapping to override normal distribute behavior - nThreads = min( TP_MAX_POOL_THREADS, nThreads ); + nThreads = MIN( TP_MAX_POOL_THREADS, nThreads ); for ( int i = 0; i < nThreads; i++ ) { iAffinityTable[i] = pAffinities[i]; @@ -693,7 +693,7 @@ private: const int MAX_THREADS = 16; \ int nIdle = g_pThreadPool->NumIdleThreads(); \ ITERTYPE1 range = to - from; \ - int nThreads = min( nIdle + 1, range ); \ + int nThreads = MIN( nIdle + 1, range ); \ if ( nThreads > MAX_THREADS ) \ { \ nThreads = MAX_THREADS; \ @@ -728,7 +728,7 @@ FUNC_GENERATE_ALL( DEFINE_NON_MEMBER_ITER_RANGE_PARALLEL ); const int MAX_THREADS = 16; \ int nIdle = g_pThreadPool->NumIdleThreads(); \ ITERTYPE1 range = to - from; \ - int nThreads = min( nIdle + 1, range ); \ + int nThreads = MIN( nIdle + 1, range ); \ if ( nThreads > MAX_THREADS ) \ { \ nThreads = MAX_THREADS; \ diff --git a/public/xzp.cpp b/public/xzp.cpp index 5d8df984..8386960e 100644 --- a/public/xzp.cpp +++ b/public/xzp.cpp @@ -770,7 +770,7 @@ bool xZipAddFile( const char* filename, CUtlBuffer &fileBuff, bool bPrecacheEnti else if( bProcessPrecacheHeaderOnly ) { customPreloadSize = xZipComputeCustomPreloads( filename ); - fileSize = min( fileSize, customPreloadSize ); + fileSize = MIN( fileSize, customPreloadSize ); } unsigned CRC = xZipCRCFilename( filename ); diff --git a/public/zip_utils.cpp b/public/zip_utils.cpp index 7b7534e8..51dfdb44 100644 --- a/public/zip_utils.cpp +++ b/public/zip_utils.cpp @@ -544,7 +544,7 @@ void CZipFile::ParseFromBuffer( void *buffer, int bufferlength ) if ( rec.commentLength ) { char commentString[128]; - int commentLength = min( rec.commentLength, sizeof( commentString ) ); + int commentLength = MIN( rec.commentLength, sizeof( commentString ) ); buf.Get( commentString, commentLength ); commentString[commentLength] = '\0'; ParseXZipCommentString( commentString ); @@ -673,7 +673,7 @@ HANDLE CZipFile::ParseFromDisk( const char *pFilename ) if ( rec.commentLength ) { char commentString[128]; - int commentLength = min( rec.commentLength, sizeof( commentString ) ); + int commentLength = MIN( rec.commentLength, sizeof( commentString ) ); CWin32File::FileRead( hFile, commentString, commentLength ); commentString[commentLength] = '\0'; ParseXZipCommentString( commentString ); diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index ad08e5f3..6c84bc26 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -58,7 +58,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 8951193c..151a1b6a 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>= ( nAdjPosition & 31 ); - m_nBitsAvail = min( m_nBitsAvail, 32 - ( nAdjPosition & 31 ) ); // in case grabnextdword overflowed + m_nBitsAvail = MIN( m_nBitsAvail, 32 - ( nAdjPosition & 31 ) ); // in case grabnextdword overflowed } return bSucc; } diff --git a/tier1/strtools.cpp b/tier1/strtools.cpp index c2334eaa..b6a25a03 100644 --- a/tier1/strtools.cpp +++ b/tier1/strtools.cpp @@ -741,7 +741,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 ) @@ -801,7 +801,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 ) @@ -1010,7 +1010,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; @@ -1118,7 +1118,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 ); @@ -1162,7 +1162,7 @@ void V_StripExtension( const char *in, char *out, int outSize ) if (end > 0 && !PATHSEPARATOR( in[end] ) && end < outSize) { - int nChars = min( end, outSize-1 ); + int nChars = MIN( end, outSize-1 ); if ( out != in ) { memcpy( out, in, nChars ); @@ -1397,7 +1397,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; @@ -1781,7 +1781,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 d456b1b5..385ccaf9 100644 --- a/tier1/utlsymbol.cpp +++ b/tier1/utlsymbol.cpp @@ -209,7 +209,7 @@ CUtlSymbol CUtlSymbolTable::AddString( const char* 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/common/mpi_stats.cpp b/utils/common/mpi_stats.cpp index 43ec3cf8..468ba6fa 100644 --- a/utils/common/mpi_stats.cpp +++ b/utils/common/mpi_stats.cpp @@ -750,7 +750,7 @@ void RunJobWatchApp( char *pCmdLine ) if ( s1 || s2 ) { // Get rid of the last slash. - s1 = max( s1, s2 ); + s1 = MAX( s1, s2 ); s1[0] = 0; if ( !CreateProcess( diff --git a/utils/demoinfo/demosmoothersamplesource.cpp b/utils/demoinfo/demosmoothersamplesource.cpp index 0a5fc7de..6ad0672e 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/phonemeextractor/phonemeextractor.cpp b/utils/phonemeextractor/phonemeextractor.cpp index dd779b0d..76982f33 100644 --- a/utils/phonemeextractor/phonemeextractor.cpp +++ b/utils/phonemeextractor/phonemeextractor.cpp @@ -330,7 +330,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 ) ); @@ -1034,8 +1034,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/phonemeextractor/phonemeextractor_ims.cpp b/utils/phonemeextractor/phonemeextractor_ims.cpp index 20d1eeec..2ecc4e70 100644 --- a/utils/phonemeextractor/phonemeextractor_ims.cpp +++ b/utils/phonemeextractor/phonemeextractor_ims.cpp @@ -663,7 +663,7 @@ bool FuzzyWordMatch( char const *w1, char const *w2 ) int len1 = strlen( w1 ); int len2 = strlen( w2 ); - int minlen = min( len1, len2 ); + int minlen = MIN( len1, len2 ); // Found a match if ( !strnicmp( w1, w2, minlen ) ) diff --git a/utils/vbsp/disp_ivp.cpp b/utils/vbsp/disp_ivp.cpp index 6d3024c3..1b17a056 100644 --- a/utils/vbsp/disp_ivp.cpp +++ b/utils/vbsp/disp_ivp.cpp @@ -227,7 +227,7 @@ void CDispMeshEvent::GetVirtualMesh( void *userData, virtualmeshlist_t *pList ) pList->surfacePropsIndex = 0; // doesn't matter here, reset at runtime pList->pHull = NULL; int indexMax = ARRAYSIZE(pList->indices); - int indexCount = min(m_indexCount, indexMax); + int indexCount = MIN(m_indexCount, indexMax); Assert(m_indexCount < indexMax); Q_memcpy( pList->indices, m_pIndices, sizeof(*m_pIndices) * indexCount ); } @@ -247,7 +247,7 @@ void CDispMeshEvent::GetTrianglesInSphere( void *userData, const Vector ¢er, Assert(userData==((void *)this)); pList->triangleCount = m_indexCount/3; int indexMax = ARRAYSIZE(pList->triangleIndices); - int indexCount = min(m_indexCount, indexMax); + int indexCount = MIN(m_indexCount, indexMax); Assert(m_indexCount < MAX_VIRTUAL_TRIANGLES*3); Q_memcpy( pList->triangleIndices, m_pIndices, sizeof(*m_pIndices) * indexCount ); } diff --git a/utils/vbsp/ivp.cpp b/utils/vbsp/ivp.cpp index 3e7b738c..a70e5bc1 100644 --- a/utils/vbsp/ivp.cpp +++ b/utils/vbsp/ivp.cpp @@ -1054,7 +1054,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/vprojtomake/vcprojconvert.cpp b/utils/vprojtomake/vcprojconvert.cpp index 3e55fe96..40f94d44 100644 --- a/utils/vprojtomake/vcprojconvert.cpp +++ b/utils/vprojtomake/vcprojconvert.cpp @@ -33,13 +33,11 @@ #include #include #include -#include "valve_minmax_off.h" #if defined(XERCES_NEW_IOSTREAMS) #include #else #include #endif -#include "valve_minmax_on.h" #define IXMLDOMNode DOMNode #define IXMLDOMNodeList DOMNodeList diff --git a/utils/vrad/incremental.cpp b/utils/vrad/incremental.cpp index 0e75d219..de64b458 100644 --- a/utils/vrad/incremental.cpp +++ b/utils/vrad/incremental.cpp @@ -574,7 +574,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] ) ); } } @@ -609,8 +609,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 24d0c14c..82af0e37 100644 --- a/utils/vrad/leaf_ambient_lighting.cpp +++ b/utils/vrad/leaf_ambient_lighting.cpp @@ -191,8 +191,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; } @@ -345,7 +345,7 @@ void AddSampleToList( CUtlVector &list, const Vector &samplePos for (int s = 0; s < 3; s++ ) { float dc = fabs(list[i].cube[k][s] - list[j].cube[k][s]); - maxDC = max(maxDC,dc); + maxDC = MAX(maxDC,dc); } totalDC += maxDC; } @@ -452,8 +452,8 @@ float AABBDistance( const Vector &mins0, const Vector &maxs0, const Vector &mins Vector delta; for ( int i = 0; i < 3; i++ ) { - float greatestMin = max(mins0[i], mins1[i]); - float leastMax = min(maxs0[i], maxs1[i]); + float greatestMin = MAX(mins0[i], mins1[i]); + float leastMax = MIN(maxs0[i], maxs1[i]); delta[i] = (greatestMin < leastMax) ? 0 : (leastMax - greatestMin); } return delta.Length(); @@ -533,9 +533,9 @@ void ComputeAmbientForLeaf( int iThread, int leafID, CUtlVector int xSize = (dleafs[leafID].maxs[0] - dleafs[leafID].mins[0]) / 32; int ySize = (dleafs[leafID].maxs[1] - dleafs[leafID].mins[1]) / 32; int zSize = (dleafs[leafID].maxs[2] - dleafs[leafID].mins[2]) / 64; - xSize = max(xSize,1); - ySize = max(xSize,1); - zSize = max(xSize,1); + xSize = MAX(xSize,1); + ySize = MAX(xSize,1); + zSize = MAX(xSize,1); // generate update 128 candidate samples, always at least one sample int volumeCount = xSize * ySize * zSize; if ( g_bFastAmbient ) diff --git a/utils/vrad/lightmap.cpp b/utils/vrad/lightmap.cpp index f48cdde7..0367a9d9 100644 --- a/utils/vrad/lightmap.cpp +++ b/utils/vrad/lightmap.cpp @@ -90,8 +90,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. @@ -1326,8 +1326,8 @@ bool CanLeafTraceToSky( int iLeaf ) for ( int j = 0; j < NUMVERTEXNORMALS; j+=4 ) { // search back to see if we can hit a sky brush - delta.LoadAndSwizzle( g_anorms[j], g_anorms[min( j+1, NUMVERTEXNORMALS-1 )], - g_anorms[min( j+2, NUMVERTEXNORMALS-1 )], g_anorms[min( j+3, NUMVERTEXNORMALS-1 )] ); + delta.LoadAndSwizzle( g_anorms[j], g_anorms[MIN( j+1, NUMVERTEXNORMALS-1 )], + g_anorms[MIN( j+2, NUMVERTEXNORMALS-1 )], g_anorms[MIN( j+3, NUMVERTEXNORMALS-1 )] ); delta *= -MAX_TRACE_LENGTH; delta += center4; @@ -2816,18 +2816,18 @@ static void ComputeLightmapGradients( SSE_SampleInfo_t& info, bool const* pHasPr 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] ) ); } } } @@ -3118,7 +3118,7 @@ void BuildFacelights (int iThread, int facenum) int nSample = 4 * grp; sample_t *sample = sampleInfo.m_pFaceLight->sample + nSample; - int numSamples = min ( 4, sampleInfo.m_pFaceLight->numsamples - nSample ); + int numSamples = MIN ( 4, sampleInfo.m_pFaceLight->numsamples - nSample ); FourVectors positions; FourVectors normals; diff --git a/utils/vrad/radial.cpp b/utils/vrad/radial.cpp index ac73f40e..a9edd829 100644 --- a/utils/vrad/radial.cpp +++ b/utils/vrad/radial.cpp @@ -89,19 +89,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); @@ -110,7 +110,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) { @@ -176,8 +176,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 ); @@ -186,10 +186,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++ ) { @@ -249,10 +249,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] ); } } @@ -810,7 +810,7 @@ void FinalLightFace( int iThread, int facenum ) // garymct: minlight is a per entity minimum light value? for( i=0; i<3; i++ ) { - lb[bumpSample].m_vecLighting[i] = max( lb[bumpSample].m_vecLighting[i], minlight ); + lb[bumpSample].m_vecLighting[i] = MAX( lb[bumpSample].m_vecLighting[i], minlight ); } // Do the average light computation, I'm assuming (perhaps incorrectly?) diff --git a/utils/vrad/samplehash.cpp b/utils/vrad/samplehash.cpp index 11c4f509..1939c691 100644 --- a/utils/vrad/samplehash.cpp +++ b/utils/vrad/samplehash.cpp @@ -185,9 +185,9 @@ void PatchSampleData_AddSample( CPatch *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 54e4c591..b59939e5 100644 --- a/utils/vrad/vrad.cpp +++ b/utils/vrad/vrad.cpp @@ -283,7 +283,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); @@ -818,7 +818,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; } } @@ -878,7 +878,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 ); } } } @@ -2619,7 +2619,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/vrad/vrad_dispcoll.cpp b/utils/vrad/vrad_dispcoll.cpp index 6068a4ea..c544c1b7 100644 --- a/utils/vrad/vrad_dispcoll.cpp +++ b/utils/vrad/vrad_dispcoll.cpp @@ -109,7 +109,7 @@ void CVRADDispColl::CalcSampleRadius2AndBox( dface_t *pFace ) m_flSampleRadius2 = flSampleRadius * flSampleRadius; // Calculate the patch radius - the max sample edge length * the number of luxels per edge "chop." - float flSampleSize = max( m_flSampleWidth, m_flSampleHeight ); + float flSampleSize = MAX( m_flSampleWidth, m_flSampleHeight ); float flPatchSampleRadius = flSampleSize * dispchop * 2.2f; if ( flPatchSampleRadius > g_MaxDispPatchRadius ) { @@ -440,7 +440,7 @@ void CVRADDispColl::CreateChildPatchesFromRoot( int iParentPatch, int *pChildPat vecEdges[3] = pParentPatch->winding->p[3] - pParentPatch->winding->p[0]; // Should the patch be subdivided - check the area. - float flMaxLength = max( m_flSampleWidth, m_flSampleHeight ); + float flMaxLength = MAX( m_flSampleWidth, m_flSampleHeight ); float flMinEdgeLength = flMaxLength * dispchop; // Find the longest edge. @@ -551,7 +551,7 @@ void CVRADDispColl::CreateChildPatches( int iParentPatch, int nLevel ) return; // Should the patch be subdivided - check the area. - float flMaxLength = max( m_flSampleWidth, m_flSampleHeight ); + float flMaxLength = MAX( m_flSampleWidth, m_flSampleHeight ); float flMinEdgeLength = flMaxLength * dispchop; // Split along the longest edge. @@ -659,7 +659,7 @@ void CVRADDispColl::CreateChildPatchesSub( int iParentPatch ) return; // Should the patch be subdivided - check the area. - float flMaxLength = max( m_flSampleWidth, m_flSampleHeight ); + float flMaxLength = MAX( m_flSampleWidth, m_flSampleHeight ); float flMinEdgeLength = flMaxLength * dispchop; // Split along the longest edge. @@ -870,8 +870,8 @@ bool CVRADDispColl::InitParentPatch( int iPatch, Vector *pPoints, float &flArea { for ( int iAxis = 0; iAxis < 3; ++iAxis ) { - vecMin[iAxis] = min( vecMin[iAxis], pPoints[iPoint][iAxis] ); - vecMax[iAxis] = max( vecMax[iAxis], pPoints[iPoint][iAxis] ); + vecMin[iAxis] = MIN( vecMin[iAxis], pPoints[iPoint][iAxis] ); + vecMax[iAxis] = MAX( vecMax[iAxis], pPoints[iPoint][iAxis] ); } } @@ -1019,8 +1019,8 @@ bool CVRADDispColl::InitPatch( int iPatch, int iParentPatch, int iChild, Vector { for ( int iAxis = 0; iAxis < 3; ++iAxis ) { - vecMin[iAxis] = min( vecMin[iAxis], pPoints[iPoint][iAxis] ); - vecMax[iAxis] = max( vecMax[iAxis], pPoints[iPoint][iAxis] ); + vecMin[iAxis] = MIN( vecMin[iAxis], pPoints[iPoint][iAxis] ); + vecMax[iAxis] = MAX( vecMax[iAxis], pPoints[iPoint][iAxis] ); } } diff --git a/utils/vrad/vradstaticprops.cpp b/utils/vrad/vradstaticprops.cpp index 082a8c9f..52ba2d95 100644 --- a/utils/vrad/vradstaticprops.cpp +++ b/utils/vrad/vradstaticprops.cpp @@ -606,15 +606,15 @@ public: // HACKHACK: Compute the average coverage for this triangle by sampling the AABB of its texture space float ComputeCoverageForTriangle( int shadowTextureIndex, const Vector2D &t0, const Vector2D &t1, const Vector2D &t2 ) { - float umin = min(t0.x, t1.x); - umin = min(umin, t2.x); - float umax = max(t0.x, t1.x); - umax = max(umax, t2.x); + float umin = MIN(t0.x, t1.x); + umin = MIN(umin, t2.x); + float umax = MAX(t0.x, t1.x); + umax = MAX(umax, t2.x); - float vmin = min(t0.y, t1.y); - vmin = min(vmin, t2.y); - float vmax = max(t0.y, t1.y); - vmax = max(vmax, t2.y); + float vmin = MIN(t0.y, t1.y); + vmin = MIN(vmin, t2.y); + float vmax = MAX(t0.y, t1.y); + vmax = MAX(vmax, t2.y); // UNDONE: Do something about tiling umin = clamp(umin, 0, 1); diff --git a/utils/xwad/xwad.cpp b/utils/xwad/xwad.cpp index cf94e059..c0f73c3f 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/vgui_controls/BitmapImagePanel.cpp b/vgui2/vgui_controls/BitmapImagePanel.cpp index de225559..67d271d5 100644 --- a/vgui2/vgui_controls/BitmapImagePanel.cpp +++ b/vgui2/vgui_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/vgui_controls/BuildGroup.cpp b/vgui2/vgui_controls/BuildGroup.cpp index ec7dba22..4c2a9540 100644 --- a/vgui2/vgui_controls/BuildGroup.cpp +++ b/vgui2/vgui_controls/BuildGroup.cpp @@ -312,8 +312,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/vgui_controls/ComboBox.cpp b/vgui2/vgui_controls/ComboBox.cpp index 9f52d8ce..0cff36cc 100644 --- a/vgui2/vgui_controls/ComboBox.cpp +++ b/vgui2/vgui_controls/ComboBox.cpp @@ -311,7 +311,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/vgui_controls/Frame.cpp b/vgui2/vgui_controls/Frame.cpp index 76e987c6..7869d24d 100644 --- a/vgui2/vgui_controls/Frame.cpp +++ b/vgui2/vgui_controls/Frame.cpp @@ -2265,8 +2265,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/vgui_controls/Label.cpp b/vgui2/vgui_controls/Label.cpp index 9018249a..8862cffd 100644 --- a/vgui2/vgui_controls/Label.cpp +++ b/vgui2/vgui_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 ); @@ -134,7 +134,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); } //----------------------------------------------------------------------------- @@ -381,7 +381,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/vgui_controls/ListPanel.cpp b/vgui2/vgui_controls/ListPanel.cpp index 1b5e4d59..04094f1b 100644 --- a/vgui2/vgui_controls/ListPanel.cpp +++ b/vgui2/vgui_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 @@ -1090,7 +1090,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; @@ -1474,7 +1474,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); @@ -1975,7 +1975,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/vgui_controls/Menu.cpp b/vgui2/vgui_controls/Menu.cpp index 71345aa5..bb49fe61 100644 --- a/vgui2/vgui_controls/Menu.cpp +++ b/vgui2/vgui_controls/Menu.cpp @@ -756,7 +756,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 { @@ -1702,7 +1702,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/vgui_controls/MenuItem.cpp b/vgui2/vgui_controls/MenuItem.cpp index 8837e22f..ad00a722 100644 --- a/vgui2/vgui_controls/MenuItem.cpp +++ b/vgui2/vgui_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/vgui_controls/MessageBox.cpp b/vgui2/vgui_controls/MessageBox.cpp index 88469298..feced5aa 100644 --- a/vgui2/vgui_controls/MessageBox.cpp +++ b/vgui2/vgui_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() @@ -257,8 +257,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; @@ -267,13 +267,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/vgui_controls/MessageDialog.cpp b/vgui2/vgui_controls/MessageDialog.cpp index b5e809ca..fa6f21c8 100644 --- a/vgui2/vgui_controls/MessageDialog.cpp +++ b/vgui2/vgui_controls/MessageDialog.cpp @@ -184,7 +184,7 @@ void CMessageDialog::ApplySchemeSettings( vgui::IScheme *pScheme ) // position the buttons with even horizontal spacing int xpos = 0; - int ypos = GetTall() - max( nButtonTall, nTextTall ) - m_ButtonMargin; + int ypos = GetTall() - MAX( nButtonTall, nTextTall ) - m_ButtonMargin; int nSpacing = ( GetWide() - nTotalWide ) / ( cButtons + 1 ); for ( int i = 0; i < MAX_BUTTONS; ++i ) { @@ -234,7 +234,7 @@ void CMessageDialog::ApplySchemeSettings( vgui::IScheme *pScheme ) // If we're animating, we push our text label in, and reduce its width int iX,iY,iW,iH; m_pMsg->GetBounds( iX, iY, iW, iH ); - m_pMsg->SetBounds( iX + m_ActivityIndent, iY, max(0,iW-m_ActivityIndent), iH ); + m_pMsg->SetBounds( iX + m_ActivityIndent, iY, MAX(0,iW-m_ActivityIndent), iH ); } // Invalidate the scheme on our message label so that it recalculates diff --git a/vgui2/vgui_controls/Panel.cpp b/vgui2/vgui_controls/Panel.cpp index 78257770..08844b39 100644 --- a/vgui2/vgui_controls/Panel.cpp +++ b/vgui2/vgui_controls/Panel.cpp @@ -6411,8 +6411,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/vgui_controls/ProgressBox.cpp b/vgui2/vgui_controls/ProgressBox.cpp index 9295e52d..6a52b9ff 100644 --- a/vgui2/vgui_controls/ProgressBox.cpp +++ b/vgui2/vgui_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/vgui_controls/PropertySheet.cpp b/vgui2/vgui_controls/PropertySheet.cpp index 61236cc7..52b8296b 100644 --- a/vgui2/vgui_controls/PropertySheet.cpp +++ b/vgui2/vgui_controls/PropertySheet.cpp @@ -338,7 +338,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); } @@ -1131,7 +1131,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/vgui_controls/QueryBox.cpp b/vgui2/vgui_controls/QueryBox.cpp index c218bedf..005eea5b 100644 --- a/vgui2/vgui_controls/QueryBox.cpp +++ b/vgui2/vgui_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/vgui_controls/RichText.cpp b/vgui2/vgui_controls/RichText.cpp index 4aad94c1..4798d018 100644 --- a/vgui2/vgui_controls/RichText.cpp +++ b/vgui2/vgui_controls/RichText.cpp @@ -21,7 +21,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 @@ -647,7 +647,7 @@ void RichText::FinishingURL(int x, int y) int px, py; clickPanel->GetPos(px, py); int fontTall = surface()->GetFontTall(_font); - clickPanel->SetSize( max( x - px, 6 ), y - py + fontTall ); + clickPanel->SetSize( MAX( x - px, 6 ), y - py + fontTall ); clickPanel->SetVisible(true); // if we haven't actually advanced any, step back and ignore this one @@ -830,7 +830,7 @@ void RichText::Paint() if ( m_TextStream[i] == '\t' ) { int dxTabWidth = 8 * surface()->GetCharacterWidth(_font, ' '); - dxTabWidth = max( 1, dxTabWidth ); + dxTabWidth = MAX( 1, dxTabWidth ); renderState.x = ( dxTabWidth * ( 1 + ( renderState.x / dxTabWidth ) ) ); } @@ -2448,12 +2448,12 @@ int RichText::ParseTextStringForUrls( const char *text, int startPos, char *pchU // get the url i += Q_strlen( "" ); - Q_strncpy( pchURL, text + i, min( pchURLEnd - text - i + 1, cchURL ) ); + Q_strncpy( pchURL, text + i, MIN( pchURLEnd - text - i + 1, cchURL ) ); i += ( pchURLEnd - text - i + 1 ); // get the url text pchURLEnd = Q_strstr( text, "" ); - Q_strncpy( pchURLText, text + i, min( pchURLEnd - text - i + 1, cchURLText ) ); + Q_strncpy( pchURLText, text + i, MIN( pchURLEnd - text - i + 1, cchURLText ) ); i += ( pchURLEnd - text - i ); i += Q_strlen( "" ); diff --git a/vgui2/vgui_controls/ScalableImagePanel.cpp b/vgui2/vgui_controls/ScalableImagePanel.cpp index d9e36374..a0a432bd 100644 --- a/vgui2/vgui_controls/ScalableImagePanel.cpp +++ b/vgui2/vgui_controls/ScalableImagePanel.cpp @@ -91,8 +91,8 @@ void ScalableImagePanel::PaintBackground() else { //uvh - row 1, is tall - ( 2 * src_corner_height ) ( min 0 ) - uvh = max( 1.0 - 2 * m_flCornerHeightPercent, 0.0f ); - drawH = max( 0, ( tall - 2 * m_iCornerHeight ) ); + uvh = MAX( 1.0 - 2 * m_flCornerHeightPercent, 0.0f ); + drawH = MAX( 0, ( tall - 2 * m_iCornerHeight ) ); } for ( col=0;col<3;col++ ) @@ -106,8 +106,8 @@ void ScalableImagePanel::PaintBackground() else { //uvw - col 1, is wide - ( 2 * src_corner_width ) ( min 0 ) - uvw = max( 1.0 - 2 * m_flCornerWidthPercent, 0.0f ); - drawW = max( 0, ( wide - 2 * m_iCornerWidth ) ); + uvw = MAX( 1.0 - 2 * m_flCornerWidthPercent, 0.0f ); + drawW = MAX( 0, ( wide - 2 * m_iCornerWidth ) ); } Vector2D uv11( uvx, uvy ); diff --git a/vgui2/vgui_controls/TextEntry.cpp b/vgui2/vgui_controls/TextEntry.cpp index f4e12ad8..f1b46b52 100644 --- a/vgui2/vgui_controls/TextEntry.cpp +++ b/vgui2/vgui_controls/TextEntry.cpp @@ -3568,7 +3568,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; } @@ -3581,18 +3581,18 @@ void TextEntry::GetText(wchar_t *wbuf, int bufLenInBytes) void TextEntry::GetTextRange( wchar_t *buf, int from, int numchars ) { int len = m_TextStream.Count(); - int cpChars = max( 0, min( numchars, len - from ) ); + int cpChars = MAX( 0, MIN( numchars, len - from ) ); - wcsncpy( buf, m_TextStream.Base() + max( 0, min( len, from ) ), cpChars ); + wcsncpy( buf, m_TextStream.Base() + MAX( 0, MIN( len, from ) ), cpChars ); buf[ cpChars ] = 0; } void TextEntry::GetTextRange( char *buf, int from, int numchars ) { int len = m_TextStream.Count(); - int cpChars = max( 0, min( numchars, len - from ) ); + int cpChars = MAX( 0, MIN( numchars, len - from ) ); - g_pVGuiLocalize->ConvertUnicodeToANSI( m_TextStream.Base() + max( 0, min( len, from ) ), buf, cpChars + 1 ); + g_pVGuiLocalize->ConvertUnicodeToANSI( m_TextStream.Base() + MAX( 0, MIN( len, from ) ), buf, cpChars + 1 ); buf[ cpChars ] = 0; } diff --git a/vgui2/vgui_controls/TreeView.cpp b/vgui2/vgui_controls/TreeView.cpp index 90029d55..633bf0ed 100644 --- a/vgui2/vgui_controls/TreeView.cpp +++ b/vgui2/vgui_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; @@ -901,7 +901,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/vgui_controls/TreeViewListControl.cpp b/vgui2/vgui_controls/TreeViewListControl.cpp index 076ccd67..e15b9770 100644 --- a/vgui2/vgui_controls/TreeViewListControl.cpp +++ b/vgui2/vgui_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;