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

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

This commit is contained in:
Scott Ehlert 2011-04-28 01:29:54 -05:00
parent d529bf38f5
commit 85773fe42c
300 changed files with 1041 additions and 1084 deletions

View File

@ -890,8 +890,8 @@ void ByteswapAnimData( mstudioanimdesc_t *pAnimDesc, int section, byte *&pDataSr
int iStartFrame = section * sectionFrames; int iStartFrame = section * sectionFrames;
int iEndFrame = (section + 1) * sectionFrames; int iEndFrame = (section + 1) * sectionFrames;
iStartFrame = min( iStartFrame, totalFrames - 1 ); iStartFrame = MIN( iStartFrame, totalFrames - 1 );
iEndFrame = min( iEndFrame, totalFrames - 1 ); iEndFrame = MIN( iEndFrame, totalFrames - 1 );
totalFrames = iEndFrame - iStartFrame + 1; totalFrames = iEndFrame - iStartFrame + 1;
} }

View File

@ -215,9 +215,9 @@ void CAchievementNotificationPanel::ShowNextNotification()
int iHeadingWidth = UTIL_ComputeStringWidth( hFontHeading, notification.szHeading ); int iHeadingWidth = UTIL_ComputeStringWidth( hFontHeading, notification.szHeading );
int iTitleWidth = UTIL_ComputeStringWidth( hFontTitle, notification.szTitle ); int iTitleWidth = UTIL_ComputeStringWidth( hFontTitle, notification.szTitle );
// use the widest string // use the widest string
int iTextWidth = max( iHeadingWidth, iTitleWidth ); int iTextWidth = MAX( iHeadingWidth, iTitleWidth );
// don't let it be insanely wide // don't let it be insanely wide
iTextWidth = min( iTextWidth, XRES( 300 ) ); iTextWidth = MIN( iTextWidth, XRES( 300 ) );
int iIconWidth = m_pIcon->GetWide(); int iIconWidth = m_pIcon->GetWide();
int iSpacing = XRES( 10 ); int iSpacing = XRES( 10 );
int iPanelWidth = iSpacing + iIconWidth + iSpacing + iTextWidth + iSpacing; int iPanelWidth = iSpacing + iIconWidth + iSpacing + iTextWidth + iSpacing;

View File

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

View File

@ -520,7 +520,7 @@ void C_ClientRagdoll::FadeOut( void )
int iAlpha = GetRenderColor().a; int iAlpha = GetRenderColor().a;
int iFadeSpeed = ( g_RagdollLVManager.IsLowViolence() ) ? g_ragdoll_lvfadespeed.GetInt() : g_ragdoll_fadespeed.GetInt(); 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 ); SetRenderMode( kRenderTransAlpha );
SetRenderColorA( iAlpha ); 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 ); 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, p1 );
VectorMA( estGround, -pTarget->est.height, up, p2 ); 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 // don't IK to other characters
ray.Init( p1, p2, Vector(-r,-r,0), Vector(r,r,r*2) ); 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 #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; return flInterval;
} }
@ -4841,7 +4841,7 @@ float C_BaseAnimating::FrameAdvance( float flInterval )
addcycle = (serverAdvance + addcycle) / 2; addcycle = (serverAdvance + addcycle) / 2;
const float MAX_CYCLE_ADJUSTMENT = 0.1f; 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", DevMsg( 2, "(%d): Cycle latch used to correct %.2f in to %.2f instead of %.2f.\n",
entindex(), GetCycle(), GetCycle() + addcycle, GetCycle() + originalAdvance ); entindex(), GetCycle(), GetCycle() + addcycle, GetCycle() + originalAdvance );

View File

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

View File

@ -688,7 +688,7 @@ void C_BaseFlex::ComputeBlendedSetting( Emphasized_Phoneme *classes, float empha
} }
else 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; classes[ PHONEME_CLASS_NORMAL ].amount = 2.0f * emphasis_intensity;
} }
} }
@ -705,7 +705,7 @@ void C_BaseFlex::ComputeBlendedSetting( Emphasized_Phoneme *classes, float empha
} }
else 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; 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 ); const CBasePhonemeTag *next = sentence->GetRuntimePhoneme( k + 1 );
if ( next ) 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_strncpy( name, "right_" ,sizeof(name));
Q_strncat( name, track->GetFlexControllerName(),sizeof(name), COPY_ALL_CHARACTERS ); 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_strncpy( name, "left_" ,sizeof(name));
Q_strncat( name, track->GetFlexControllerName(),sizeof(name), COPY_ALL_CHARACTERS ); 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 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 ) 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; return m_flWeight;
} }

View File

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

View File

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

View File

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

View File

@ -165,7 +165,7 @@ static void CreateFleckParticles( const Vector& origin, const Vector &color, tra
// Handle increased scale // Handle increased scale
float flMaxSpeed = FLECK_MAX_SPEED * iScale; 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 // Setup our collision information
fleckEmitter->m_ParticleCollision.Setup( spawnOffset, &trace->plane.normal, flAngularSpray, FLECK_MIN_SPEED, flMaxSpeed, FLECK_GRAVITY, FLECK_DAMPEN ); 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pFleckParticle->m_uchColor[0] = min( 1.0f, color[0]*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[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
pFleckParticle->m_uchColor[2] = min( 1.0f, color[2]*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 // Ramp the color
colorRamp = random->RandomFloat( 0.5f, 1.25f ); colorRamp = random->RandomFloat( 0.5f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
// scaled // scaled
pParticle->m_uchStartSize = (iScale*0.5f) * random->RandomInt( 3, 4 ) * (i+1); 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 ); colorRamp = random->RandomFloat( 0.5f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 4, 8 ); pParticle->m_uchStartSize = random->RandomInt( 4, 8 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4; 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 ); float colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*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[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f; newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, g_Mat_DustPuff[0] ); 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 ); float colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*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[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f; newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, g_Mat_BloodPuff[0] ); 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 ); float colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*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[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f; newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, g_Mat_DustPuff[0] ); 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 ); colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*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[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f; newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, g_Mat_BloodPuff[0] ); 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 ); colorRamp = random->RandomFloat( 0.5f, 1.25f );
newParticle.m_uchColor[0] = min( 1.0f, color[0]*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[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
newParticle.m_uchColor[2] = min( 1.0f, color[2]*colorRamp )*255.0f; newParticle.m_uchColor[2] = MIN( 1.0f, color[2]*colorRamp )*255.0f;
AddSimpleParticle( &newParticle, g_Mat_DustPuff[0] ); 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 ); colorRamp = random->RandomFloat( 0.5f, 1.0f );
pParticle->m_uchColor[0] = min( 1.0f, color[0]*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[1] = MIN( 1.0f, color[1]*colorRamp )*255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2]*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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
// scaled // scaled
pParticle->m_uchStartSize = iScale * random->RandomInt( 3, 4 ) * (i+1); 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(); pParticle->m_vecVelocity.Init();
colorRamp = random->RandomFloat( 0.75f, 1.25f ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 4, 8 ); pParticle->m_uchStartSize = random->RandomInt( 4, 8 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4; 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
// scaled // scaled
pParticle->m_uchStartSize = ( unsigned char )( flScale * random->RandomInt( 3, 4 ) * (i+1) ); 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * 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_uchStartSize = random->RandomInt( 2, 4 ) * (i+1);
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2; 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 1, 4 ); pParticle->m_uchStartSize = random->RandomInt( 1, 4 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4; pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4;

View File

@ -662,7 +662,7 @@ inline void C_ParticleSmokeGrenade::ApplyDynamicLight( const Vector &vParticlePo
} }
// Rescale the color.. // 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 ) if ( flMax > 1 )
{ {
color /= flMax; color /= flMax;

View File

@ -38,7 +38,7 @@ float PixelVisibility_DrawProxy( IMatRenderContext *pRenderContext, OcclusionQue
float forwardScale = scale; float forwardScale = scale;
// draw a pyramid of points touching a sphere of radius "scale" at origin // draw a pyramid of points touching a sphere of radius "scale" at origin
float pixelsPerUnit = pRenderContext->ComputePixelDiameterOfSphere( origin, 1.0f ); float pixelsPerUnit = pRenderContext->ComputePixelDiameterOfSphere( origin, 1.0f );
pixelsPerUnit = max( pixelsPerUnit, 1e-4f ); pixelsPerUnit = MAX( pixelsPerUnit, 1e-4f );
if ( screenspace ) if ( screenspace )
{ {
// Force this to be the size of a sphere of diameter "scale" at some reference distance (1.0 unit) // 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 // compute area and screen-clipped area
float w = screen[1].x - screen[0].x; float w = screen[1].x - screen[0].x;
float h = screen[0].y - screen[3].y; float h = screen[0].y - screen[3].y;
float ws = min(1.0f, screen[1].x) - max(-1.0f, screen[0].x); 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 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 area = w*h; // area can be zero when we ALT-TAB
float areaClipped = ws*hs; float areaClipped = ws*hs;
float ratio = 0.0f; float ratio = 0.0f;

View File

@ -235,7 +235,7 @@ void C_Plasma::AddEntity( void )
m_flGlowScale = m_flScaleRegister; m_flGlowScale = m_flScaleRegister;
// Note: Sprite renderer assumes scale of 0.0 is 1.0 // 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 ) ); 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]; offset[2] = m_entFlames[i].GetAbsOrigin()[2];
// Note: Sprite render assumes 0 scale means 1.0 // 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 ) if ( i != 0 )
{ {

View File

@ -899,7 +899,7 @@ void C_RopeKeyframe::CPhysicsDelegate::ApplyConstraints( CSimplePhysics::CNode *
AngleVectors( angles, &forward ); AngleVectors( angles, &forward );
int parity = 1; int parity = 1;
int nFalloffNodes = min( 2, nNodes - 2 ); int nFalloffNodes = MIN( 2, nNodes - 2 );
LockNodeDirection( pNodes, parity, nFalloffNodes, g_flLockAmount, g_flLockFalloff, forward ); LockNodeDirection( pNodes, parity, nFalloffNodes, g_flLockAmount, g_flLockFalloff, forward );
} }
} }
@ -913,7 +913,7 @@ void C_RopeKeyframe::CPhysicsDelegate::ApplyConstraints( CSimplePhysics::CNode *
AngleVectors( angles, &forward ); AngleVectors( angles, &forward );
int parity = -1; 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 ); 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. // 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 ); 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; float flScreenSpaceWidth = m_Width * flHalfScreenWidth / zCoord;
if ( flScreenSpaceWidth < flMinScreenSpaceWidth ) if ( flScreenSpaceWidth < flMinScreenSpaceWidth )
@ -1671,7 +1671,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData, const Vector &vCurr
} }
else 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++ ) for ( int iSide=0; iSide < 6; iSide++ )
{ {
float flLen = boxColors[iSide].Length(); float flLen = boxColors[iSide].Length();
flMaxIntensity = max( flMaxIntensity, flLen ); flMaxIntensity = MAX( flMaxIntensity, flLen );
} }
VectorNormalize( m_LightValues[i] ); VectorNormalize( m_LightValues[i] );
m_LightValues[i] *= flMaxIntensity; 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 ) if ( flMax > 1 )
m_LightValues[i] /= flMax; m_LightValues[i] /= flMax;
} }

View File

@ -625,7 +625,7 @@ void C_SceneEntity::DispatchStartSpeak( CChoreoScene *scene, C_BaseFlex *actor,
float endtime = event->GetLastSlaveEndTime(); float endtime = event->GetLastSlaveEndTime();
float durationShort = event->GetDuration(); float durationShort = event->GetDuration();
float durationLong = endtime - event->GetStartTime(); float durationLong = endtime - event->GetStartTime();
float duration = max( durationShort, durationLong ); float duration = MAX( durationShort, durationLong );
CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption ); CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption );
if ( hudCloseCaption ) if ( hudCloseCaption )

View File

@ -213,7 +213,7 @@ void C_SlideshowDisplay::BuildSlideShowImagesList( void )
return; 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 ); int iBytesRead = g_pFullFileSystem->Read( szFileBuffer, iFileSize, fh );
g_pFullFileSystem->Close( fh ); g_pFullFileSystem->Close( fh );

View File

@ -323,7 +323,7 @@ void C_SmokeTrail::Update( float fTimeDelta )
VectorMA( pParticle->m_vecVelocity, flDirectedVel, vecForward, pParticle->m_vecVelocity ); VectorMA( pParticle->m_vecVelocity, flDirectedVel, vecForward, pParticle->m_vecVelocity );
offsetColor = m_StartColor; 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] ) if ( flMaxVal < m_StartColor[2] )
{ {
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 ); VectorMA( pParticle->m_vecVelocity, flDirectedVel, vecForward, pParticle->m_vecVelocity );
offsetColor = m_Color; 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] ) if ( flMaxVal < m_Color[2] )
{ {
flMaxVal = m_Color[2]; flMaxVal = m_Color[2];

View File

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

View File

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

View File

@ -57,7 +57,7 @@ void C_Sun::OnDataChanged( DataUpdateType_t updateType )
// for the sun, which should always be completely opaque at its core. Here, we renormalize the // for the sun, which should always be completely opaque at its core. Here, we renormalize the
// components to make sure only hue is altered. // 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 vOverlayColor;
Vector vMainColor; Vector vMainColor;

View File

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

View File

@ -110,7 +110,7 @@ public:
static const ConVar *pMin = dynamic_cast< const ConVar* >( g_pCVar->FindCommandBase( "sv_client_min_interp_ratio" ) ); static const ConVar *pMin = dynamic_cast< const ConVar* >( g_pCVar->FindCommandBase( "sv_client_min_interp_ratio" ) );
if ( pUpdateRate && pMin && pMin->GetFloat() != -1 ) if ( pUpdateRate && pMin && pMin->GetFloat() != -1 )
{ {
return max( GetBaseFloatValue(), pMin->GetFloat() / pUpdateRate->GetFloat() ); return MAX( GetBaseFloatValue(), pMin->GetFloat() / pUpdateRate->GetFloat() );
} }
else else
{ {
@ -128,7 +128,7 @@ float GetClientInterpAmount()
if ( pUpdateRate ) if ( pUpdateRate )
{ {
// #define FIXME_INTERP_RATIO // #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 else
{ {

View File

@ -360,8 +360,8 @@ void DefaultRenderBoundsWorldspace( IClientRenderable *pRenderable, Vector &absM
// if our origin is actually farther away than that, expand again // if our origin is actually farther away than that, expand again
float radius = pEnt->GetLocalOrigin().Length(); float radius = pEnt->GetLocalOrigin().Length();
float flBloatSize = max( vAddMins.Length(), vAddMaxs.Length() ); float flBloatSize = MAX( vAddMins.Length(), vAddMaxs.Length() );
flBloatSize = max(flBloatSize, radius); flBloatSize = MAX(flBloatSize, radius);
absMins -= Vector( flBloatSize, flBloatSize, flBloatSize ); absMins -= Vector( flBloatSize, flBloatSize, flBloatSize );
absMaxs += Vector( flBloatSize, flBloatSize, flBloatSize ); absMaxs += Vector( flBloatSize, flBloatSize, flBloatSize );
return; return;
@ -420,8 +420,8 @@ void CalcRenderableWorldSpaceAABB_Fast( IClientRenderable *pRenderable, Vector &
// if our origin is actually farther away than that, expand again // if our origin is actually farther away than that, expand again
float radius = pEnt->GetLocalOrigin().Length(); float radius = pEnt->GetLocalOrigin().Length();
float flBloatSize = max( vAddMins.Length(), vAddMaxs.Length() ); float flBloatSize = MAX( vAddMins.Length(), vAddMaxs.Length() );
flBloatSize = max(flBloatSize, radius); flBloatSize = MAX(flBloatSize, radius);
absMin -= Vector( flBloatSize, flBloatSize, flBloatSize ); absMin -= Vector( flBloatSize, flBloatSize, flBloatSize );
absMax += Vector( flBloatSize, flBloatSize, flBloatSize ); absMax += Vector( flBloatSize, flBloatSize, flBloatSize );
} }
@ -1618,7 +1618,7 @@ void CClientLeafSystem::CollateRenderablesInLeaf( int leaf, int worldListLeafInd
Vector dims; Vector dims;
VectorSubtract( absMaxs, absMins, 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 ); group = DetectBucketedRenderGroup( group, fDimension );
Assert( group >= RENDER_GROUP_OPAQUE_STATIC_HUGE && group <= RENDER_GROUP_OPAQUE_ENTITY ); Assert( group >= RENDER_GROUP_OPAQUE_STATIC_HUGE && group <= RENDER_GROUP_OPAQUE_ENTITY );

View File

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

View File

@ -180,7 +180,7 @@ void CCommentaryModelViewer::HandleMovementInput( void )
{ {
m_flYawSpeed = 0; m_flYawSpeed = 0;
} }
m_flYawSpeed = max(m_flYawSpeed-flAccel, -3.0); m_flYawSpeed = MAX(m_flYawSpeed-flAccel, -3.0);
} }
else if ( bRightDown ) else if ( bRightDown )
{ {
@ -188,7 +188,7 @@ void CCommentaryModelViewer::HandleMovementInput( void )
{ {
m_flYawSpeed = 0; m_flYawSpeed = 0;
} }
m_flYawSpeed = min(m_flYawSpeed+flAccel, 3.0); m_flYawSpeed = MIN(m_flYawSpeed+flAccel, 3.0);
} }
if ( m_flYawSpeed != 0 ) if ( m_flYawSpeed != 0 )
{ {
@ -203,7 +203,7 @@ void CCommentaryModelViewer::HandleMovementInput( void )
if ( !bLeftDown && !bRightDown ) 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 = 0;
} }
m_flZoomSpeed = max(m_flZoomSpeed-flAccel, -3.0); m_flZoomSpeed = MAX(m_flZoomSpeed-flAccel, -3.0);
} }
else if ( bBackDown ) else if ( bBackDown )
{ {
@ -222,7 +222,7 @@ void CCommentaryModelViewer::HandleMovementInput( void )
{ {
m_flZoomSpeed = 0; m_flZoomSpeed = 0;
} }
m_flZoomSpeed = min(m_flZoomSpeed+flAccel, 3.0); m_flZoomSpeed = MIN(m_flZoomSpeed+flAccel, 3.0);
} }
if ( m_flZoomSpeed != 0 ) if ( m_flZoomSpeed != 0 )
{ {
@ -239,7 +239,7 @@ void CCommentaryModelViewer::HandleMovementInput( void )
if ( !bForwardDown && !bBackDown ) 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);
} }
} }
} }

View File

@ -145,7 +145,7 @@ void CHudDeathNotice::Paint()
continue; 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 // Draw the death notice
y = DEATHNOTICE_TOP + (20 * i) + 100; //!!! y = DEATHNOTICE_TOP + (20 * i) + 100; //!!!

View File

@ -1518,8 +1518,8 @@ void CDetailObjectSystem::LevelInitPostEntity()
if ( GetDetailController() ) if ( GetDetailController() )
{ {
cl_detailfade.SetValue( min( m_flDefaultFadeStart, GetDetailController()->m_flFadeStartDist ) ); cl_detailfade.SetValue( MIN( m_flDefaultFadeStart, GetDetailController()->m_flFadeStartDist ) );
cl_detaildist.SetValue( min( m_flDefaultFadeEnd, GetDetailController()->m_flFadeEndDist ) ); cl_detaildist.SetValue( MIN( m_flDefaultFadeEnd, GetDetailController()->m_flFadeEndDist ) );
} }
else else
{ {
@ -1678,8 +1678,8 @@ void CDetailObjectSystem::ScanForCounts( CUtlBuffer& buf,
{ {
// need to pad nfast to next sse boundary // need to pad nfast to next sse boundary
nFast += ( 0 - nFast ) & 3; nFast += ( 0 - nFast ) & 3;
nMaxFast = max( nMaxFast, nNumFastInLeaf ); nMaxFast = MAX( nMaxFast, nNumFastInLeaf );
nMaxOld = max( nMaxOld, nNumOldInLeaf ); nMaxOld = MAX( nMaxOld, nNumOldInLeaf );
nNumOldInLeaf = 0; nNumOldInLeaf = 0;
nNumFastInLeaf = 0; nNumFastInLeaf = 0;
detailObjectLeaf = lump.m_Leaf; detailObjectLeaf = lump.m_Leaf;
@ -1700,8 +1700,8 @@ void CDetailObjectSystem::ScanForCounts( CUtlBuffer& buf,
// need to pad nfast to next sse boundary // need to pad nfast to next sse boundary
nFast += ( 0 - nFast ) & 3; nFast += ( 0 - nFast ) & 3;
nMaxFast = max( nMaxFast, nNumFastInLeaf ); nMaxFast = MAX( nMaxFast, nNumFastInLeaf );
nMaxOld = max( nMaxOld, nNumOldInLeaf ); nMaxOld = MAX( nMaxOld, nNumOldInLeaf );
buf.SeekGet( CUtlBuffer::SEEK_HEAD, oldpos ); buf.SeekGet( CUtlBuffer::SEEK_HEAD, oldpos );
*pNumFastSpritesToAllocate = nFast; *pNumFastSpritesToAllocate = nFast;
@ -1987,7 +1987,7 @@ int CDetailObjectSystem::CountFastSpritesInLeafList( int nLeafCount, LeafIndex_t
if ( pData ) if ( pData )
{ {
nCount += pData->m_nNumSprites; nCount += pData->m_nNumSprites;
nMax = max( nMax, pData->m_nNumSprites ); nMax = MAX( nMax, pData->m_nNumSprites );
} }
} }
*nMaxFoundInLeaf = ( nMax + 3 ) & ~3; // round up *nMaxFoundInLeaf = ( nMax + 3 ) & ~3; // round up
@ -2265,7 +2265,7 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec
nMaxQuadsToDraw = nMaxVerts / 4; nMaxQuadsToDraw = nMaxVerts / 4;
} }
int nQuadsToDraw = min( nQuadCount, nMaxQuadsToDraw ); int nQuadsToDraw = MIN( nQuadCount, nMaxQuadsToDraw );
int nQuadsRemaining = nQuadsToDraw; int nQuadsRemaining = nQuadsToDraw;
meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw );
@ -2303,7 +2303,7 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec
nQuadsRemaining = nQuadsToDraw; nQuadsRemaining = nQuadsToDraw;
meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw );
} }
int nToDraw = min( nCount, nQuadsRemaining ); int nToDraw = MIN( nCount, nQuadsRemaining );
nCount -= nToDraw; nCount -= nToDraw;
nQuadsRemaining -= nToDraw; nQuadsRemaining -= nToDraw;
while( nToDraw-- ) while( nToDraw-- )
@ -2510,7 +2510,7 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector
nMaxQuadsToDraw = nMaxVerts / 4; nMaxQuadsToDraw = nMaxVerts / 4;
} }
int nQuadsToDraw = min( nCount, nMaxQuadsToDraw ); int nQuadsToDraw = MIN( nCount, nMaxQuadsToDraw );
int nQuadsRemaining = nQuadsToDraw; int nQuadsRemaining = nQuadsToDraw;
meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw );
@ -2529,7 +2529,7 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector
nQuadsRemaining = nQuadsToDraw; nQuadsRemaining = nQuadsToDraw;
meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw ); meshBuilder.Begin( pMesh, MATERIAL_QUADS, nQuadsToDraw );
} }
int nToDraw = min( nCount, nQuadsRemaining ); int nToDraw = MIN( nCount, nQuadsRemaining );
nCount -= nToDraw; nCount -= nToDraw;
nQuadsRemaining -= nToDraw; nQuadsRemaining -= nToDraw;
while( nToDraw-- ) while( nToDraw-- )
@ -2783,7 +2783,7 @@ void CDetailObjectSystem::BuildDetailObjectRenderLists( const Vector &vViewOrigi
{ {
m_flCurFadeSqDist = 0; 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 ); m_flCurFalloffFactor = 255.0f / ( m_flCurMaxSqDist - m_flCurFadeSqDist );

View File

@ -665,8 +665,8 @@ public:
int color[3][2]; int color[3][2];
for( int i = 0; i < 3; ++i ) for( int i = 0; i < 3; ++i )
{ {
color[i][0] = max( 0, m_SpurtColor[i] - 64 ); color[i][0] = MAX( 0, m_SpurtColor[i] - 64 );
color[i][1] = min( 255, 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[0] = random->RandomInt( color[0][0], color[0][1] );
pParticle->m_uchColor[1] = random->RandomInt( color[1][0], color[1][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 ); totalDist = VectorNormalize( shotDir );
// Make short tracers in close quarters // Make short tracers in close quarters
// float flMinLength = min( totalDist, 128.0f ); // float flMinLength = MIN( totalDist, 128.0f );
// float flMaxLength = min( totalDist, 128.0f ); // float flMaxLength = MIN( totalDist, 128.0f );
float length = 128.0f;//random->RandomFloat( flMinLength, flMaxLength ); float length = 128.0f;//random->RandomFloat( flMinLength, flMaxLength );
float life = ( totalDist + length ) / velocity; // NOTENOTE: We want the tail to finish its run as well 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; pParticle->m_vecVelocity = vec3_origin;
Vector color( 1,1,1 ); Vector color( 1,1,1 );
float colorRamp = RandomFloat( 0.75f, 1.25f ); float colorRamp = RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = RandomFloat( 6,13 ); pParticle->m_uchStartSize = RandomFloat( 6,13 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize - 2; pParticle->m_uchEndSize = pParticle->m_uchStartSize - 2;
pParticle->m_uchStartAlpha = 255; pParticle->m_uchStartAlpha = 255;

View File

@ -229,9 +229,9 @@ void FX_BloodSpray( const Vector &origin, const Vector &normal, float scale, uns
colorRamp = random->RandomFloat( 0.75f, 1.25f ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * 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_uchStartSize = random->RandomFloat( scale * 0.25, scale );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 2; 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * 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_uchStartSize = random->RandomFloat( scale * 1.5f, scale * 2.0f );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4; 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 ); colorRamp = random->RandomFloat( 0.75f, 2.0f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 2, 4 ); pParticle->m_uchStartSize = random->RandomInt( 2, 4 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 8; 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 ); colorRamp = random->RandomFloat( 0.75f, 2.0f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * colorRamp ) * 255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, color[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = random->RandomInt( 2, 4 ); pParticle->m_uchStartSize = random->RandomInt( 2, 4 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4; pParticle->m_uchEndSize = pParticle->m_uchStartSize * 4;

View File

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

View File

@ -678,9 +678,9 @@ void C_BaseExplosionEffect::CreateDebris( void )
pParticle->m_flRollDelta = random->RandomFloat( 0, 360 ); pParticle->m_flRollDelta = random->RandomFloat( 0, 360 );
float colorRamp = random->RandomFloat( 0.5f, 1.5f ); float colorRamp = random->RandomFloat( 0.5f, 1.5f );
pParticle->m_uchColor[0] = 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[1] = MIN( 1.0f, 0.25f*colorRamp )*255.0f;
pParticle->m_uchColor[2] = min( 1.0f, 0.25f*colorRamp )*255.0f; pParticle->m_uchColor[2] = MIN( 1.0f, 0.25f*colorRamp )*255.0f;
} }
#endif // !_XBOX #endif // !_XBOX
} }
@ -1208,7 +1208,7 @@ void C_WaterExplosionEffect::CreateMisc( void )
colorRamp = random->RandomFloat( 1.5f, 2.0f ); 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 //Dump out drops
@ -1236,7 +1236,7 @@ void C_WaterExplosionEffect::CreateMisc( void )
colorRamp = random->RandomFloat( 1.5f, 2.0f ); 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 #endif
@ -1267,12 +1267,12 @@ void C_WaterExplosionEffect::CreateMisc( void )
colorRamp = random->RandomFloat( 0.75f, 1.25f ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, m_vecColor[0] * 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[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[2] = MIN( 1.0f, m_vecColor[2] * colorRamp ) * 255.0f;
pParticle->m_uchStartSize = 24 * flScale * RemapValClamped( i, 7, 0, 1, 0.5f ); 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_uchStartAlpha = RemapValClamped( i, 7, 0, 255, 32 ) * m_flLuminosity;
pParticle->m_uchEndAlpha = 0; pParticle->m_uchEndAlpha = 0;

View File

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

View File

@ -66,7 +66,7 @@ void UTIL_GetNormalizedColorTintAndLuminosity( const Vector &color, Vector *tint
} }
else else
{ {
float maxComponent = max( color.x, max( color.y, color.z ) ); float maxComponent = MAX( color.x, MAX( color.y, color.z ) );
*tint = color / maxComponent; *tint = color / maxComponent;
} }
} }
@ -90,7 +90,7 @@ inline void FX_GetSplashLighting( Vector position, Vector *color, float *luminos
// Fake a specular highlight (too dim otherwise) // Fake a specular highlight (too dim otherwise)
if ( luminosity != NULL ) 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 // Clamp so that we never go completely translucent
if ( *luminosity < 0.25f ) 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
tParticle->m_color.r = min( 1.0f, color[0] * 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.g = MIN( 1.0f, color[1] * colorRamp ) * 255;
tParticle->m_color.b = min( 1.0f, color[2] * colorRamp ) * 255; tParticle->m_color.b = MIN( 1.0f, color[2] * colorRamp ) * 255;
tParticle->m_color.a = luminosity * 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * 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_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_uchStartAlpha = RemapValClamped( i, 7, 0, 255, 32 ) * luminosity;
pParticle->m_uchEndAlpha = 0; pParticle->m_uchEndAlpha = 0;
@ -297,7 +297,7 @@ void FX_GunshotSlimeSplash( const Vector &origin, const Vector &normal, float sc
#if 0 #if 0
float colorRamp; 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 hMaterial = ParticleMgr()->GetPMaterial( "effects/slime1" );
PMaterialHandle hMaterial2 = ParticleMgr()->GetPMaterial( "effects/splash4" ); 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
tParticle->m_color.r = min( 1.0f, color.x * 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.g = MIN( 1.0f, color.y * colorRamp ) * 255;
tParticle->m_color.b = min( 1.0f, color.z * colorRamp ) * 255; tParticle->m_color.b = MIN( 1.0f, color.z * colorRamp ) * 255;
tParticle->m_color.a = 255 * luminosity; 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 ); colorRamp = random->RandomFloat( 0.75f, 1.25f );
pParticle->m_uchColor[0] = min( 1.0f, color[0] * 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[1] = MIN( 1.0f, color[1] * colorRamp ) * 255.0f;
pParticle->m_uchColor[2] = min( 1.0f, color[2] * 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_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_uchStartAlpha = RemapValClamped( i, 7, 0, 255, 32 ) * luminosity;
pParticle->m_uchEndAlpha = 0; pParticle->m_uchEndAlpha = 0;

View File

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

View File

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

View File

@ -447,8 +447,8 @@ void CBaseModelPanel::LookAtBounds( const Vector &vecBoundsMin, const Vector &ve
float flDistZ = fabs( aXFormPoints[iPoint].z / flTanFOVy ) - aXFormPoints[iPoint].x; float flDistZ = fabs( aXFormPoints[iPoint].z / flTanFOVy ) - aXFormPoints[iPoint].x;
dist[iPoint].x = flDistY; dist[iPoint].x = flDistY;
dist[iPoint].y = flDistZ; dist[iPoint].y = flDistZ;
float flTestDist = max( flDistZ, flDistY ); float flTestDist = MAX( flDistZ, flDistY );
flDist = max( flDist, flTestDist ); flDist = MAX( flDist, flTestDist );
} }
// Screen space points. // 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 ); Vector2D vecScreenMin( 99999.0f, 99999.0f ), vecScreenMax( -99999.0f, -99999.0f );
for ( int iPoint = 0; iPoint < 8; ++iPoint ) for ( int iPoint = 0; iPoint < 8; ++iPoint )
{ {
vecScreenMin.x = min( vecScreenMin.x, aScreenPoints[iPoint].x ); vecScreenMin.x = MIN( vecScreenMin.x, aScreenPoints[iPoint].x );
vecScreenMin.y = min( vecScreenMin.y, aScreenPoints[iPoint].y ); vecScreenMin.y = MIN( vecScreenMin.y, aScreenPoints[iPoint].y );
vecScreenMax.x = max( vecScreenMax.x, aScreenPoints[iPoint].x ); vecScreenMax.x = MAX( vecScreenMax.x, aScreenPoints[iPoint].x );
vecScreenMax.y = max( vecScreenMax.y, aScreenPoints[iPoint].y ); vecScreenMax.y = MAX( vecScreenMax.y, aScreenPoints[iPoint].y );
} }
// Offset the model to the be the correct distance away from the camera. // Offset the model to the be the correct distance away from the camera.

View File

@ -781,8 +781,8 @@ void CModelPanel::CalculateFrameDistanceInternal( const model_t *pModel )
{ {
float flDistZ = fabs( aXFormPoints[iPoint].z / flTanFOVy - aXFormPoints[iPoint].x ); float flDistZ = fabs( aXFormPoints[iPoint].z / flTanFOVy - aXFormPoints[iPoint].x );
float flDistY = fabs( aXFormPoints[iPoint].y / flTanFOVx - aXFormPoints[iPoint].x ); float flDistY = fabs( aXFormPoints[iPoint].y / flTanFOVx - aXFormPoints[iPoint].x );
float flTestDist = max( flDistZ, flDistY ); float flTestDist = MAX( flDistZ, flDistY );
flDist = max( flDist, flTestDist ); flDist = MAX( flDist, flTestDist );
} }
// Scale the object down by 10%. // 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 ); Vector2D vecScreenMin( 99999.0f, 99999.0f ), vecScreenMax( -99999.0f, -99999.0f );
for ( int iPoint = 0; iPoint < 8; ++iPoint ) for ( int iPoint = 0; iPoint < 8; ++iPoint )
{ {
vecScreenMin.x = min( vecScreenMin.x, aScreenPoints[iPoint].x ); vecScreenMin.x = MIN( vecScreenMin.x, aScreenPoints[iPoint].x );
vecScreenMin.y = min( vecScreenMin.y, aScreenPoints[iPoint].y ); vecScreenMin.y = MIN( vecScreenMin.y, aScreenPoints[iPoint].y );
vecScreenMax.x = max( vecScreenMax.x, aScreenPoints[iPoint].x ); vecScreenMax.x = MAX( vecScreenMax.x, aScreenPoints[iPoint].x );
vecScreenMax.y = max( vecScreenMax.y, aScreenPoints[iPoint].y ); vecScreenMax.y = MAX( vecScreenMax.y, aScreenPoints[iPoint].y );
} }
vecScreenMin.x = clamp( vecScreenMin.x, 0.0f, flW ); vecScreenMin.x = clamp( vecScreenMin.x, 0.0f, flW );

View File

@ -213,7 +213,7 @@ void CTextWindow::ShowFile( const char *filename )
char buffer[2048]; 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->Read( buffer, size, f );
g_pFullFileSystem->Close( f ); g_pFullFileSystem->Close( f );

View File

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

View File

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

View File

@ -100,7 +100,7 @@ float C_BaseHLPlayer::GetFOV()
int min_fov = ( gpGlobals->maxClients == 1 ) ? 5 : default_fov.GetInt(); int min_fov = ( gpGlobals->maxClients == 1 ) ? 5 : default_fov.GetInt();
// Don't let it go too low // Don't let it go too low
flFOVOffset = max( min_fov, flFOVOffset ); flFOVOffset = MAX( min_fov, flFOVOffset );
return flFOVOffset; return flFOVOffset;
} }
@ -267,7 +267,7 @@ void C_BaseHLPlayer::PerformClientSideObstacleAvoidance( float flFrameTime, CUse
if ( curspeed > 150.0f ) if ( curspeed > 150.0f )
{ {
curspeed = min( 2048.0f, curspeed ); curspeed = MIN( 2048.0f, curspeed );
factor = ( 1.0f + ( curspeed - 150.0f ) / 150.0f ); factor = ( 1.0f + ( curspeed - 150.0f ) / 150.0f );
//engine->Con_NPrintf( slot++, "scaleup (%f) to radius %f\n", factor, radius * factor ); //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 ); flSideScale = fabs( cl_sidespeed.GetFloat() ) / fabs( pCmd->sidemove );
} }
float flScale = min( flForwardScale, flSideScale ); float flScale = MIN( flForwardScale, flSideScale );
pCmd->forwardmove *= flScale; pCmd->forwardmove *= flScale;
pCmd->sidemove *= flScale; pCmd->sidemove *= flScale;

View File

@ -117,7 +117,7 @@ void C_PropCombineBall::DrawMotionBlur( void )
speed = clamp( speed, 0, 32 ); 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 spawnPos = GetAbsOrigin();
Vector spawnStep = -vecDir * stepSize; Vector spawnStep = -vecDir * stepSize;

View File

@ -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)); tint = (tint * 0.25f)+(Vector(0.75f,0.75f,0.75f));
// Rescale to a character range // Rescale to a character range
luminosity = max( 200, luminosity*255 ); luminosity = MAX( 200, luminosity*255 );
CSmartPtr<CSplashParticle> pSimple = CSplashParticle::Create( "splish" ); CSmartPtr<CSplashParticle> pSimple = CSplashParticle::Create( "splish" );
pSimple->SetSortOrigin( origin ); pSimple->SetSortOrigin( origin );

View File

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

View File

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

View File

@ -92,7 +92,7 @@ int C_CrossbowBolt::DrawModel( int flags )
if ( speed > 0 ) 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 spawnPos = GetAbsOrigin() + ( vecDir * 24.0f );
Vector spawnStep = -vecDir * stepSize; Vector spawnStep = -vecDir * stepSize;

View File

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

View File

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

View File

@ -127,7 +127,7 @@ void CHudBonusProgress::OnThink()
} }
// Never below zero // Never below zero
newBonusProgress = max( local->GetBonusProgress(), 0 ); newBonusProgress = MAX( local->GetBonusProgress(), 0 );
iBonusChallenge = local->GetBonusChallenge(); iBonusChallenge = local->GetBonusChallenge();
// Only update the fade if we've changed bonusProgress // Only update the fade if we've changed bonusProgress

View File

@ -328,7 +328,7 @@ void CHudCredits::DrawOutroCreditsName( void )
} }
} }
cColor[3] = max( 0, m_Alpha ); cColor[3] = MAX( 0, m_Alpha );
} }
} }
else else
@ -374,7 +374,7 @@ void CHudCredits::DrawLogo( void )
{ {
float flDeltaTime = ( m_flFadeTime - gpGlobals->curtime ); 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 ) if ( flDeltaTime <= 0.0f )
{ {

View File

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

View File

@ -451,7 +451,7 @@ void CHudWeaponSelection::Paint()
// interpolate the selected box size between the small box size and the large box size // 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 // 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 largeBoxWide = m_flSmallBoxSize + ((m_flLargeBoxWide - m_flSmallBoxSize) * percentageDone);
int largeBoxTall = m_flSmallBoxSize + ((m_flLargeBoxTall - m_flSmallBoxSize) * percentageDone); int largeBoxTall = m_flSmallBoxSize + ((m_flLargeBoxTall - m_flSmallBoxSize) * percentageDone);
Color selectedColor; Color selectedColor;

View File

@ -194,7 +194,7 @@ void CHudZoom::Paint( void )
{ {
surface()->DrawFilledRect(xpos, ypos, xpos + 1, ypos + m_flDashHeight); surface()->DrawFilledRect(xpos, ypos, xpos + 1, ypos + m_flDashHeight);
surface()->DrawFilledRect(wide - xpos, ypos, wide - 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 // draw the darkened edges, with a rotated texture in the four corners

View File

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

View File

@ -90,9 +90,9 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
int y = 0; int y = 0;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y1 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = y + coord[NumSegments]; y2 = y + coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
@ -111,9 +111,9 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
yMult = 1; yMult = 1;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y1 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = y + coord[NumSegments]; y2 = y + coord[NumSegments];
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir; xIndex += xDir;
@ -131,10 +131,10 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
yMult = -1; yMult = -1;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = y - coord[NumSegments]; y1 = y - coord[NumSegments];
y2 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y2 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir; xIndex += xDir;
yIndex += yDir; yIndex += yDir;
@ -151,10 +151,10 @@ void CHL2MPClientScoreBoardDialog::PaintBackground()
yMult = -1; yMult = -1;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = y - coord[NumSegments]; y1 = y - coord[NumSegments];
y2 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y2 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir; xIndex += xDir;
yIndex += yDir; yIndex += yDir;
@ -207,10 +207,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
int y = 0; int y = 0;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir; xIndex += xDir;
@ -228,10 +228,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
yMult = 1; yMult = 1;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir; xIndex += xDir;
yIndex += yDir; yIndex += yDir;
@ -248,10 +248,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
yMult = -1; yMult = -1;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir; xIndex += xDir;
yIndex += yDir; yIndex += yDir;
@ -268,10 +268,10 @@ void CHL2MPClientScoreBoardDialog::PaintBorder()
yMult = -1; yMult = -1;
for ( i=0; i<NumSegments; ++i ) for ( i=0; i<NumSegments; ++i )
{ {
x1 = min( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x1 = MIN( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
x2 = max( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult ); x2 = MAX( x + coord[xIndex]*xMult, x + coord[xIndex+1]*xMult );
y1 = min( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y1 = MIN( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
y2 = max( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult ); y2 = MAX( y + coord[yIndex]*yMult, y + coord[yIndex+1]*yMult );
surface()->DrawFilledRect( x1, y1, x2, y2 ); surface()->DrawFilledRect( x1, y1, x2, y2 );
xIndex += xDir; xIndex += xDir;
yIndex += yDir; yIndex += yDir;

View File

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

View File

@ -1027,7 +1027,7 @@ void CHudCloseCaption::Paint( void )
float desiredAlpha = visibleitems.Count() >= 1 ? 1.0f : 0.0f; float desiredAlpha = visibleitems.Count() >= 1 ? 1.0f : 0.0f;
// Always return at least one line height for drawing the surrounding box // 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 // Trigger box growing
if ( totalheight != m_nGoalHeight ) if ( totalheight != m_nGoalHeight )
@ -1083,7 +1083,7 @@ void CHudCloseCaption::Paint( void )
Color bgColor = GetBgColor(); Color bgColor = GetBgColor();
bgColor[3] = m_flBackgroundAlpha; 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() ) if ( !visibleitems.Count() )
{ {
@ -1115,7 +1115,7 @@ void CHudCloseCaption::Paint( void )
{ {
float ttl = si->item->GetTimeToLive(); float ttl = si->item->GetTimeToLive();
ttl -= si->item->GetAddedTime(); ttl -= si->item->GetAddedTime();
ttl = max( 0.0f, ttl ); ttl = MAX( 0.0f, ttl );
si->item->SetTimeToLive( ttl ); si->item->SetTimeToLive( ttl );
si->item->SetAddedTime( 0.0f ); si->item->SetAddedTime( 0.0f );
} }
@ -1248,7 +1248,7 @@ void CHudCloseCaption::OnTick( void )
if ( predisplay > 0.0f ) if ( predisplay > 0.0f )
{ {
predisplay -= dt; predisplay -= dt;
predisplay = max( 0.0f, predisplay ); predisplay = MAX( 0.0f, predisplay );
item->SetPreDisplayTime( predisplay ); item->SetPreDisplayTime( predisplay );
} }
else else
@ -1256,7 +1256,7 @@ void CHudCloseCaption::OnTick( void )
// remove time from actual playback // remove time from actual playback
float ttl = item->GetTimeToLive(); float ttl = item->GetTimeToLive();
ttl -= dt; ttl -= dt;
ttl = max( 0.0f, ttl ); ttl = MAX( 0.0f, ttl );
item->SetTimeToLive( ttl ); item->SetTimeToLive( ttl );
} }
} }
@ -1504,7 +1504,7 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
addedlife = prevlife - lifespan; addedlife = prevlife - lifespan;
} }
lifespan = max( lifespan, prevlife ); lifespan = MAX( lifespan, prevlife );
} }
float delay = 0.0f; float delay = 0.0f;
@ -1548,7 +1548,7 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
out = phrase; out = phrase;
// Delay must be positive // Delay must be positive
delay = max( 0.0f, (float)wcstod( args, NULL ) ); delay = MAX( 0.0f, (float)wcstod( args, NULL ) );
continue; continue;
} }
@ -1601,7 +1601,7 @@ void CHudCloseCaption::CreateFonts( void )
m_hFonts[CCFONT_SMALL] = pScheme->GetFont( "CloseCaption_Small" ); 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 struct WorkUnitParams
@ -1686,8 +1686,8 @@ void CHudCloseCaption::AddWorkUnit( CCloseCaptionItem *item,
int curheight = item->GetHeight(); int curheight = item->GetHeight();
int curwidth = item->GetWidth(); int curwidth = item->GetWidth();
curheight = max( curheight, params.y + wu->GetHeight() ); curheight = MAX( curheight, params.y + wu->GetHeight() );
curwidth = max( curwidth, params.x + params.width ); curwidth = MAX( curwidth, params.x + params.width );
item->SetHeight( curheight ); item->SetHeight( curheight );
item->SetWidth( curwidth ); item->SetWidth( curwidth );
@ -2706,7 +2706,7 @@ CON_COMMAND( cc_random, "Emits a random caption" )
int count = 1; int count = 1;
if ( args.ArgC() == 2 ) if ( args.ArgC() == 2 )
{ {
count = max( 1, atoi( args[ 1 ] ) ); count = MAX( 1, atoi( args[ 1 ] ) );
} }
CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption ); CHudCloseCaption *hudCloseCaption = GET_HUDELEMENT( CHudCloseCaption );
if ( hudCloseCaption ) if ( hudCloseCaption )
@ -2864,7 +2864,7 @@ void CHudCloseCaption::FindSound( char const *pchANSI )
// Now we have the data // Now we have the data
const wchar_t *pIn = ( const wchar_t *)&block[ lu.offset ]; 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 // Now search for search text
g_pVGuiLocalize->ConvertUnicodeToANSI( stream, streamANSI, sizeof( streamANSI ) ); g_pVGuiLocalize->ConvertUnicodeToANSI( stream, streamANSI, sizeof( streamANSI ) );

View File

@ -175,7 +175,7 @@ public:
{ {
if ( m_flFinishCapAnimStart && gpGlobals->curtime > m_flFinishCapAnimStart ) 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()) if (GetImage())
{ {
surface()->DrawSetColor(255, 255, 255, 255); surface()->DrawSetColor(255, 255, 255, 255);

View File

@ -176,7 +176,7 @@ void CHudHintDisplay::PerformLayout()
int iDesiredLabelWide = 0; int iDesiredLabelWide = 0;
for ( i=0; i < m_Labels.Count(); ++i ) 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 // find the total height
@ -216,10 +216,10 @@ void CHudHintDisplay::PerformLayout()
y = (tall - labelTall) / 2; y = (tall - labelTall) / 2;
} }
x = max(x,0); x = MAX(x,0);
y = max(y,0); y = MAX(y,0);
iDesiredLabelWide = min(iDesiredLabelWide,wide); iDesiredLabelWide = MIN(iDesiredLabelWide,wide);
m_pLabel->SetBounds( x, y, iDesiredLabelWide, labelTall ); m_pLabel->SetBounds( x, y, iDesiredLabelWide, labelTall );
// now lay out the sub-labels // 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 // position the labels
int col1_x = m_iTextX; int col1_x = m_iTextX;

View File

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

View File

@ -533,7 +533,7 @@ void CInput::CAM_Think( void )
} }
else 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() ) if( camOffset[ YAW ] - viewangles[ YAW ] != cam_idealyaw.GetFloat() )
camOffset[ YAW ] = MoveToward( camOffset[ YAW ], cam_idealyaw.GetFloat() + viewangles[ YAW ], lag ); camOffset[ YAW ] = MoveToward( camOffset[ YAW ], cam_idealyaw.GetFloat() + viewangles[ YAW ], lag );
@ -644,7 +644,7 @@ void CInput::CAM_CameraThirdThink( void )
VectorCopy( m_vecCameraOffset, vecCamOffset ); VectorCopy( m_vecCameraOffset, vecCamOffset );
// Move the camera. // 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 ) if( vecCamOffset[PITCH] - angView[PITCH] != m_pCameraThirdData->m_flPitch )
{ {
vecCamOffset[PITCH] = MoveToward( vecCamOffset[PITCH], ( m_pCameraThirdData->m_flPitch + angView[PITCH] ), flLag ); vecCamOffset[PITCH] = MoveToward( vecCamOffset[PITCH], ( m_pCameraThirdData->m_flPitch + angView[PITCH] ), flLag );

View File

@ -385,7 +385,7 @@ static float ResponseCurveLookAccelerated( float x, int axis, float otherAxis, f
// this axis is pressed farther than the acceleration filter // this axis is pressed farther than the acceleration filter
// Take the lowmap value, or the input, whichever is higher, since // Take the lowmap value, or the input, whichever is higher, since
// we don't necesarily know whether this is the axis which is pegged // 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; bDoAcceleration = true;
} }
else else
@ -654,7 +654,7 @@ void CInput::JoyStickMove( float frametime, CUserCmd *cmd )
if ( m_flRemainingJoystickSampleTime <= 0 ) if ( m_flRemainingJoystickSampleTime <= 0 )
return; return;
frametime = min(m_flRemainingJoystickSampleTime, frametime); frametime = MIN(m_flRemainingJoystickSampleTime, frametime);
m_flRemainingJoystickSampleTime -= frametime; m_flRemainingJoystickSampleTime -= frametime;
QAngle viewangles; QAngle viewangles;

View File

@ -621,7 +621,7 @@ float CInput::DetermineKeySpeed( float frametime )
if ( m_flKeyboardSampleTime <= 0 ) if ( m_flKeyboardSampleTime <= 0 )
return 0.0f; return 0.0f;
frametime = min( m_flKeyboardSampleTime, frametime ); frametime = MIN( m_flKeyboardSampleTime, frametime );
m_flKeyboardSampleTime -= frametime; m_flKeyboardSampleTime -= frametime;
} }

View File

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

View File

@ -833,7 +833,7 @@ inline bool CInterpolatedVarArrayBase<Type, IS_ARRAY>::GetInterpolationInfo(
if ( dt > 0.0001f ) if ( dt > 0.0001f )
{ {
pInfo->frac = ( targettime - older_change_time ) / ( newer_change_time - older_change_time ); 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; int oldestindex = i+1;
@ -1254,7 +1254,7 @@ inline void CInterpolatedVarArrayBase<Type, IS_ARRAY>::SetMaxCount( int newmax )
bool changed = ( newmax != m_nMaxCount ) ? true : false; bool changed = ( newmax != m_nMaxCount ) ? true : false;
// BUGBUG: Support 0 length properly? // BUGBUG: Support 0 length properly?
newmax = max(1,newmax); newmax = MAX(1,newmax);
m_nMaxCount = newmax; m_nMaxCount = newmax;
// Wipe everything any time this changes!!! // Wipe everything any time this changes!!!
@ -1330,7 +1330,7 @@ inline void CInterpolatedVarArrayBase<Type, IS_ARRAY>::_Extrapolate(
} }
else else
{ {
float flExtrapolationAmount = min( flDestinationTime - pNew->changetime, flMaxExtrapolationAmount ); float flExtrapolationAmount = MIN( flDestinationTime - pNew->changetime, flMaxExtrapolationAmount );
float divisor = 1.0f / (pNew->changetime - pOld->changetime); float divisor = 1.0f / (pNew->changetime - pOld->changetime);
for ( int i=0; i < m_nMaxCount; i++ ) for ( int i=0; i < m_nMaxCount; i++ )

View File

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

View File

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

View File

@ -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; float flProjRadius = ( lSqr > flCullRadiusSqr ) ? 0.5f * flFocalDist * flCullRadius / sqrt( lSqr - flCullRadiusSqr ) : 1.0f;
flProjRadius *= view.width; flProjRadius *= view.width;
float flMinX = max( view.x, vecScreenCenter.x - flProjRadius ); float flMinX = MAX( view.x, vecScreenCenter.x - flProjRadius );
float flMaxX = min( view.x + view.width, vecScreenCenter.x + flProjRadius ); float flMaxX = MIN( view.x + view.width, vecScreenCenter.x + flProjRadius );
float flMinY = max( view.y, vecScreenCenter.y - flProjRadius ); float flMinY = MAX( view.y, vecScreenCenter.y - flProjRadius );
float flMaxY = min( view.y + view.height, vecScreenCenter.y + flProjRadius ); float flMaxY = MIN( view.y + view.height, vecScreenCenter.y + flProjRadius );
float flArea = ( flMaxX - flMinX ) * ( flMaxY - flMinY ); float flArea = ( flMaxX - flMinX ) * ( flMaxY - flMinY );
Assert( flArea <= flMaxPixels ); Assert( flArea <= flMaxPixels );

View File

@ -526,7 +526,7 @@ Vector CFireParticle::UpdateColor( const SimpleParticle *pParticle )
for ( int i = 0; i < 3; i++ ) for ( int i = 0; i < 3; i++ )
{ {
//FIXME: This is frame dependant... but I don't want to store off start/end colors yet //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 ); return CSimpleEmitter::UpdateColor( pParticle );

View File

@ -110,7 +110,7 @@ inline void CParticleSphereRenderer::AddLightColor(
inline void CParticleSphereRenderer::ClampColor( Vector &vColor ) 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 ) if( flMax > 1 )
{ {
vColor *= 255.0f / flMax; vColor *= 255.0f / flMax;

View File

@ -1381,9 +1381,9 @@ int CPrediction::ComputeFirstCommandToExecute( bool received_new_world_update, i
// this is where we would normally start // this is where we would normally start
int start = incoming_acknowledged + 1; int start = incoming_acknowledged + 1;
// outgoing_command is where we really want to start // 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 // 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 // Always restore since otherwise we might start prediction using an "interpolated" value instead of a purely predicted value
RestoreEntityToPredictedFrame( skipahead - 1 ); RestoreEntityToPredictedFrame( skipahead - 1 );

View File

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

View File

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

View File

@ -217,7 +217,7 @@ void CHudWeaponSelection::Paint()
// interpolate the selected box size between the small box size and the large box size // 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 // 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 largeBoxWide = m_flSmallBoxSize + ((m_flLargeBoxWide - m_flSmallBoxSize) * percentageDone);
int largeBoxTall = m_flSmallBoxSize + ((m_flLargeBoxTall - m_flSmallBoxSize) * percentageDone); int largeBoxTall = m_flSmallBoxSize + ((m_flLargeBoxTall - m_flSmallBoxSize) * percentageDone);
Color selectedColor; Color selectedColor;

View File

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

View File

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

View File

@ -102,7 +102,7 @@ void CEntityPanel::ComputeAndSetSize( void )
// Get distance to entity // Get distance to entity
float flDistance = (m_pBaseEntity->GetRenderOrigin() - MainViewOrigin()).Length(); float flDistance = (m_pBaseEntity->GetRenderOrigin() - MainViewOrigin()).Length();
flDistance *= 2; 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 // Update the size

View File

@ -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 historyWide = ( int ) ( w * hfrac + 0.5f );
int spikeWide = ( int ) ( w * spikefrac + 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()->DrawSetColor( Color( 0, 0, 0, 31 ) );
vgui::surface()->DrawFilledRect( x, y, x + w, y + h ); vgui::surface()->DrawFilledRect( x, y, x + w, y + h );

View File

@ -344,7 +344,7 @@ void CNetGraphPanel::ComputeNetgraphHeight()
{ {
lines = 4; 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 ; a<w ; a++) for (a=0 ; a<w ; a++)
{ {
i = ( m_OutgoingSequence - a ) & ( TIMINGS - 1 ); i = ( m_OutgoingSequence - a ) & ( TIMINGS - 1 );
h = min( ( cmdinfo[i].cmd_lerp / 3.0 ) * LERP_HEIGHT, LERP_HEIGHT ); h = MIN( ( cmdinfo[i].cmd_lerp / 3.0 ) * LERP_HEIGHT, LERP_HEIGHT );
rcFill.x = x + w -a - 1; rcFill.x = x + w -a - 1;
rcFill.width = 1; rcFill.width = 1;
@ -593,7 +593,7 @@ void CNetGraphPanel::GetFrameData( INetChannelInfo *netchannel, int *biggest_me
} }
// Can't be below zero // Can't be below zero
m_AvgLatency = max( 0.0, m_AvgLatency ); m_AvgLatency = MAX( 0.0, m_AvgLatency );
flAdjust *= 1000.0f; flAdjust *= 1000.0f;
@ -614,7 +614,7 @@ void CNetGraphPanel::GetFrameData( INetChannelInfo *netchannel, int *biggest_me
if ( lat->latency < 9995 ) if ( lat->latency < 9995 )
{ {
lat->latency += flAdjust; lat->latency += flAdjust;
lat->latency = max( lat->latency, 0 ); lat->latency = MAX( lat->latency, 0 );
} }
for ( int i=0; i<=INetChannelInfo::TOTAL; i++ ) for ( int i=0; i<=INetChannelInfo::TOTAL; i++ )
@ -970,7 +970,7 @@ void CNetGraphPanel::DrawHatches( int x, int y, int maxmsgbytes )
byte color[3]; byte color[3];
ystep = (int)( 10.0 / net_scale.GetFloat() ); ystep = (int)( 10.0 / net_scale.GetFloat() );
ystep = max( ystep, 1 ); ystep = MAX( ystep, 1 );
rcHatch.y = y; rcHatch.y = y;
rcHatch.height = 1; 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 ]; int nTotalBytes = m_Graph[ i ].msgbytes[ INetChannelInfo::TOTAL ];
if ( warning_threshold != 0.0f && if ( warning_threshold != 0.0f &&
nTotalBytes > max( 300, warning_threshold ) ) nTotalBytes > MAX( 300, warning_threshold ) )
{ {
char sz[ 32 ]; char sz[ 32 ];
Q_snprintf( sz, sizeof( sz ), "%i", nTotalBytes ); 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; int textx, texty;
textx = rcFill.x - len / 2; 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 ); g_pMatSystemSurface->DrawColoredText( m_hFont, textx, texty, 255, 255, 255, 255, sz );
} }
@ -1157,7 +1157,7 @@ void CNetGraphPanel::Paint()
vrect.height = sh; vrect.height = sh;
w = min( (int)TIMINGS, m_EstimatedWidth ); w = MIN( (int)TIMINGS, m_EstimatedWidth );
if ( vrect.width < w + 10 ) if ( vrect.width < w + 10 )
{ {
w = vrect.width - 10; w = vrect.width - 10;

View File

@ -426,7 +426,7 @@ void CViewRender::OnRenderStart()
int min_fov = player->GetMinFOV(); int min_fov = player->GetMinFOV();
// Don't let it go too low // Don't let it go too low
localFOV = max( min_fov, localFOV ); localFOV = MAX( min_fov, localFOV );
gHUD.m_flFOVSensitivityAdjust = 1.0f; gHUD.m_flFOVSensitivityAdjust = 1.0f;
#ifndef _XBOX #ifndef _XBOX

View File

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

View File

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

View File

@ -351,8 +351,8 @@ static void DrawScreenSpaceRectangleWithSlop(
) )
{ {
// add slop // add slop
int slopwidth = width + FILTER_KERNEL_SLOP; //min(dest_rt->GetActualWidth()-destx,width+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); int slopheight = height + FILTER_KERNEL_SLOP; //MIN(dest_rt->GetActualHeight()-desty,height+FILTER_KERNEL_SLOP);
// adjust coordinates for slop // adjust coordinates for slop
src_texture_x1 = FLerp( src_texture_x0, src_texture_x1, destx, destx + width - 1, destx + slopwidth - 1 ); 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 flPercentOfThesePixelsNeeded = flPixelPercentNeeded / flThisBinPercentOfTotalPixels;
float flPercentLocationOfBorder = 1.0f - ( flTotalPercentRangeTested + ( flThisBinLuminanceRange * flPercentOfThesePixelsNeeded ) ); 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; return flPercentLocationOfBorder;
} }
@ -674,7 +674,7 @@ float CLuminanceHistogramSystem::GetTargetTonemapScalar( bool bGetIdealTargetFor
} }
// Make sure this is > 0.0f // Make sure this is > 0.0f
flPercentLocationOfTarget = max( 0.0001f, flPercentLocationOfTarget ); flPercentLocationOfTarget = MAX( 0.0001f, flPercentLocationOfTarget );
// Compute target scalar // Compute target scalar
float flTargetScalar = ( mat_tonemap_percent_target.GetFloat() / 100.0f ) / flPercentLocationOfTarget; float flTargetScalar = ( mat_tonemap_percent_target.GetFloat() / 100.0f ) / flPercentLocationOfTarget;
@ -697,7 +697,7 @@ float CLuminanceHistogramSystem::GetTargetTonemapScalar( bool bGetIdealTargetFor
float flLastScale = pRenderContext->GetToneMappingScaleLinear().x; float flLastScale = pRenderContext->GetToneMappingScaleLinear().x;
flTargetScalar *= flLastScale; flTargetScalar *= flLastScale;
flTargetScalar = max( 0.001f, flTargetScalar ); flTargetScalar = MAX( 0.001f, flTargetScalar );
return flTargetScalar; return flTargetScalar;
} }
else // Original tonemapping else // Original tonemapping
@ -739,7 +739,7 @@ float CLuminanceHistogramSystem::GetTargetTonemapScalar( bool bGetIdealTargetFor
average_luminance = 0.5; average_luminance = 0.5;
// Make sure this is > 0.0f // Make sure this is > 0.0f
average_luminance = max( 0.0001f, average_luminance ); average_luminance = MAX( 0.0001f, average_luminance );
// Compute target scalar // Compute target scalar
float flTargetScalar = 0.005 / average_luminance; 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; nTotalGraphPixelsWide += width + 2;
} }
@ -935,7 +935,7 @@ void CLuminanceHistogramSystem::DisplayHistogram( void )
engine->Con_NPrintf( 17, "(All values in linear space)" ); 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%%)", 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 ) ) ); 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", 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() ); 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]; CHistogram_entry_t &e = CurHistogram[l];
if ( e.ContainsValidData() ) if ( e.ContainsValidData() )
np += e.m_npixels_in_range; 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 ); //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 ) 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->ClearColor3ub( 255, 0, 0 );
pRenderContext->Viewport( xp, 4 + HISTOGRAM_BAR_SIZE - height, width, height ); 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 += weight * s_MovingAverageToneMapScale[i];
} }
avg *= ( 1.0 / sumweights ); avg *= ( 1.0 / sumweights );
avg = min( maxvalue, max( minvalue, avg )); avg = MIN( maxvalue, MAX( minvalue, avg ));
pRenderContext->SetGoalToneMappingScale( avg ); pRenderContext->SetGoalToneMappingScale( avg );
mat_hdr_tonemapscale.SetValue( 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() ) if ( mat_dynamic_tonemapping.GetInt() || mat_show_histogram.GetInt() )
{ {
float flTargetScalar = g_HDR_HistogramSystem.GetTargetTonemapScalar(); float flTargetScalar = g_HDR_HistogramSystem.GetTargetTonemapScalar();
float flTargetScalarClamped = max( flAutoExposureMin, min( flAutoExposureMax, flTargetScalar ) ); float flTargetScalarClamped = MAX( flAutoExposureMin, MIN( flAutoExposureMax, flTargetScalar ) );
flTargetScalarClamped = max( 0.001f, flTargetScalarClamped ); // Don't let this go to 0! flTargetScalarClamped = MAX( 0.001f, flTargetScalarClamped ); // Don't let this go to 0!
if ( mat_dynamic_tonemapping.GetInt() ) if ( mat_dynamic_tonemapping.GetInt() )
{ {
SetToneMapScale( pRenderContext, flTargetScalarClamped, flAutoExposureMin, flAutoExposureMax ); 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()); // Warning("avg_lum=%f\n",g_HDR_HistogramSystem.GetTargetTonemapScalar());
if ( mat_dynamic_tonemapping.GetInt() ) if ( mat_dynamic_tonemapping.GetInt() )
{ {
float avg_lum = max( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() ); float avg_lum = MAX( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() );
float scalevalue = max( flAutoExposureMin, float scalevalue = MAX( flAutoExposureMin,
min( flAutoExposureMax, 0.18 / avg_lum )); MIN( flAutoExposureMax, 0.18 / avg_lum ));
pRenderContext->SetGoalToneMappingScale( scalevalue ); pRenderContext->SetGoalToneMappingScale( scalevalue );
mat_hdr_tonemapscale.SetValue( 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(); g_HDR_HistogramSystem.DisplayHistogram();
if ( mat_dynamic_tonemapping.GetInt() ) if ( mat_dynamic_tonemapping.GetInt() )
{ {
float avg_lum = max( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() ); float avg_lum = MAX( 0.0001, g_HDR_HistogramSystem.GetTargetTonemapScalar() );
float scalevalue = max( flAutoExposureMin, float scalevalue = MAX( flAutoExposureMin,
min( flAutoExposureMax, 0.023 / avg_lum )); MIN( flAutoExposureMax, 0.023 / avg_lum ));
SetToneMapScale( pRenderContext, scalevalue, flAutoExposureMin, flAutoExposureMax ); SetToneMapScale( pRenderContext, scalevalue, flAutoExposureMin, flAutoExposureMax );
} }
pRenderContext->SetRenderTarget( NULL ); pRenderContext->SetRenderTarget( NULL );

View File

@ -3066,7 +3066,7 @@ void CRendering3dView::SetupRenderablesList( int viewID )
float fMaxDist = cl_maxrenderable_dist.GetFloat(); float fMaxDist = cl_maxrenderable_dist.GetFloat();
// Shadowing light typically has a smaller farz than cl_maxrenderable_dist // 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; setupInfo.m_flRenderDistSq *= setupInfo.m_flRenderDistSq;
ClientLeafSystem()->BuildRenderablesList( setupInfo ); ClientLeafSystem()->BuildRenderablesList( setupInfo );
@ -4744,8 +4744,8 @@ void CFreezeFrameView::Draw( void )
int iFadeAlpha = FREEZECAM_SNAPSHOT_FADE_SPEED * ( g_flFreezeFlash - gpGlobals->curtime ); int iFadeAlpha = FREEZECAM_SNAPSHOT_FADE_SPEED * ( g_flFreezeFlash - gpGlobals->curtime );
iFadeAlpha = min( iFadeAlpha, 255 ); iFadeAlpha = MIN( iFadeAlpha, 255 );
iFadeAlpha = max( 0, iFadeAlpha ); iFadeAlpha = MAX( 0, iFadeAlpha );
pMaterial->AlphaModulate( iFadeAlpha * ( 1.0f / 255.0f ) ); pMaterial->AlphaModulate( iFadeAlpha * ( 1.0f / 255.0f ) );
pMaterial->ColorModulate( 1.0f, 1.0f, 1.0f ); pMaterial->ColorModulate( 1.0f, 1.0f, 1.0f );

View File

@ -474,8 +474,8 @@ const char *SplitContext( const char *raw, char *key, int keylen, char *value, i
} }
int len = colon1 - raw; int len = colon1 - raw;
Q_strncpy( key, raw, min( len + 1, keylen ) ); Q_strncpy( key, raw, MIN( len + 1, keylen ) );
key[ min( len, keylen - 1 ) ] = 0; key[ MIN( len, keylen - 1 ) ] = 0;
bool last = false; bool last = false;
char *end = Q_strstr( colon1 + 1, "," ); 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 ) if ( duration )
*duration = atof( colon2 + 1 ); *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 ); Q_strncpy( value, colon1 + 1, len + 1 );
value[ len ] = 0; value[ len ] = 0;
} }
@ -501,7 +501,7 @@ const char *SplitContext( const char *raw, char *key, int keylen, char *value, i
if ( duration ) if ( duration )
*duration = 0.0; *duration = 0.0;
len = min( end - ( colon1 + 1 ), valuelen - 1 ); len = MIN( end - ( colon1 + 1 ), valuelen - 1 );
Q_strncpy( value, colon1 + 1, len + 1 ); Q_strncpy( value, colon1 + 1, len + 1 );
value[ len ] = 0; value[ len ] = 0;
} }

View File

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

View File

@ -685,7 +685,7 @@ int CBaseAnimatingOverlay::AllocateLayer( int iPriority )
{ {
if (m_AnimOverlay[i].m_nPriority <= 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()) else if (m_AnimOverlay[ i ].IsDying())
@ -779,7 +779,7 @@ void CBaseAnimatingOverlay::SetLayerPriority( int iLayer, int iPriority )
{ {
if (m_AnimOverlay[i].m_nPriority <= iPriority) if (m_AnimOverlay[i].m_nPriority <= iPriority)
{ {
iNewOrder = max( iNewOrder, m_AnimOverlay[i].m_nOrder + 1 ); iNewOrder = MAX( iNewOrder, m_AnimOverlay[i].m_nOrder + 1 );
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@ bool BasicGameStatsRecord_t::ParseFromBuffer( CUtlBuffer &buf, int iBufferStatsV
m_nSeconds = buf.GetInt(); m_nSeconds = buf.GetInt();
// Note, don't put the buf.GetInt() in the macro since it'll get evaluated twice!!! // 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(); m_nCommentary = buf.GetInt();
if ( m_nCommentary < 0 || m_nCommentary > 100000 ) if ( m_nCommentary < 0 || m_nCommentary > 100000 )

View File

@ -227,9 +227,9 @@ float CPointAngularVelocitySensor::SampleAngularVelocity(CBaseEntity *pEntity)
else else
{ {
QAngle vecAngVel = pEntity->GetLocalAngularVelocity(); 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; return 0;

View File

@ -254,7 +254,7 @@ bool CAI_BaseActor::StartSceneEvent( CSceneEventInfo *info, CChoreoScene *scene,
Blink(); Blink();
// don't blink for duration, or next random blink time // don't blink for duration, or next random blink time
float flDuration = (event->GetEndTime() - scene->GetTime()); 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) else if (stricmp( event->GetParameters(), "AI_HOLSTER") == 0)
{ {
@ -422,8 +422,8 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
{ {
dir = 1; dir = 1;
} }
flSpineYaw = min( diff, 30 ); flSpineYaw = MIN( diff, 30 );
flBodyYaw = min( diff - flSpineYaw, 30 ); flBodyYaw = MIN( diff - flSpineYaw, 30 );
m_goalSpineYaw = m_goalSpineYaw * (1.0 - intensity) + intensity * flSpineYaw * dir; m_goalSpineYaw = m_goalSpineYaw * (1.0 - intensity) + intensity * flSpineYaw * dir;
m_goalBodyYaw = m_goalBodyYaw * (1.0 - intensity) + intensity * flBodyYaw * 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 // 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 // force spine to full if not in scene or locked
if (!bInScene || event->IsLockBodyFacing() ) if (!bInScene || event->IsLockBodyFacing() )
{ {
spineintensity = 1.0; spineintensity = 1.0;
} }
flSpineYaw = min( diff * spineintensity, 30 ); flSpineYaw = MIN( diff * spineintensity, 30 );
flBodyYaw = min( diff * spineintensity - flSpineYaw, 30 ); flBodyYaw = MIN( diff * spineintensity - flSpineYaw, 30 );
info->m_flFacingYaw = info->m_flInitialYaw + (diff - flBodyYaw - flSpineYaw) * dir; info->m_flFacingYaw = info->m_flInitialYaw + (diff - flBodyYaw - flSpineYaw) * dir;
if (!event->IsLockBodyFacing()) if (!event->IsLockBodyFacing())
@ -490,7 +490,7 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
{ {
// keep eyes not blinking for duration // keep eyes not blinking for duration
float flDuration = (event->GetEndTime() - scene->GetTime()); float flDuration = (event->GetEndTime() - scene->GetTime());
m_flBlinktime = max( m_flBlinktime, gpGlobals->curtime + flDuration ); m_flBlinktime = MAX( m_flBlinktime, gpGlobals->curtime + flDuration );
} }
return true; return true;
case SCENE_AI_HOLSTER: case SCENE_AI_HOLSTER:
@ -522,7 +522,7 @@ bool CAI_BaseActor::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scen
{ {
float flDuration = (event->GetEndTime() - scene->GetTime()); float flDuration = (event->GetEndTime() - scene->GetTime());
int i = m_syntheticLookQueue.Count() - 1; 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; m_syntheticLookQueue[i].m_flInterest = 0.1;
} }
} }
@ -1603,7 +1603,7 @@ void CAI_BaseActor::MaintainLookTargets( float flInterval )
// no target, decay all head control direction // no target, decay all head control direction
m_goalHeadDirection = m_goalHeadDirection * 0.8 + vHead * 0.2; 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 ); VectorNormalize( m_goalHeadDirection );
UpdateHeadControl( vEyePosition + m_goalHeadDirection * 100, m_goalHeadInfluence ); UpdateHeadControl( vEyePosition + m_goalHeadDirection * 100, m_goalHeadInfluence );

View File

@ -3608,7 +3608,7 @@ void CAI_BaseNPC::RebalanceThinks()
int iMaxThinkersPerTick = (int)ceil( (float)((rebalanceCandidates.Count() + 1) / iTicksPer10Hz) ); // +1 to account for "this" 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 int iRemainingThinksToDistribute = iMaxThinkersPerTick - 1; // Start with one fewer first time because "this" is
// always gets a slot in the current tick to avoid complications // always gets a slot in the current tick to avoid complications
// in the calculation of "last think" // in the calculation of "last think"
@ -5674,7 +5674,7 @@ void CAI_BaseNPC::GatherEnemyConditions( CBaseEntity *pEnemy )
float tooFar = m_flDistTooFar; float tooFar = m_flDistTooFar;
if ( GetActiveWeapon() && HasCondition(COND_SEE_ENEMY) ) if ( GetActiveWeapon() && HasCondition(COND_SEE_ENEMY) )
{ {
tooFar = max( m_flDistTooFar, GetActiveWeapon()->m_fMaxRange1 ); tooFar = MAX( m_flDistTooFar, GetActiveWeapon()->m_fMaxRange1 );
} }
if ( flDistToEnemy >= tooFar ) if ( flDistToEnemy >= tooFar )

View File

@ -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; }; void ClearSceneLock( float flDuration = 0.2f ) { m_flSceneTime = gpGlobals->curtime + flDuration; };
bool IsInLockedScene( void ) { return m_flSceneTime > gpGlobals->curtime; }; bool IsInLockedScene( void ) { return m_flSceneTime > gpGlobals->curtime; };
float m_flSceneTime; float m_flSceneTime;

View File

@ -895,11 +895,11 @@ bool CAI_BaseNPC::FindCoverPos( CSound *pSound, Vector *pResult )
{ {
if ( !GetTacticalServices()->FindCoverPos( pSound->GetSoundReactOrigin(), if ( !GetTacticalServices()->FindCoverPos( pSound->GetSoundReactOrigin(),
pSound->GetSoundReactOrigin(), pSound->GetSoundReactOrigin(),
min( pSound->Volume(), 120.0 ), MIN( pSound->Volume(), 120.0 ),
CoverRadius(), CoverRadius(),
pResult ) ) 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; return true;
@ -1088,7 +1088,7 @@ float CAI_BaseNPC::GetReasonableFacingDist( void )
if ( GetEnemy() ) if ( GetEnemy() )
{ {
float distEnemy = ( GetEnemy()->GetAbsOrigin().AsVector2D() - GetAbsOrigin().AsVector2D() ).Length() - 1.0; float distEnemy = ( GetEnemy()->GetAbsOrigin().AsVector2D() - GetAbsOrigin().AsVector2D() ).Length() - 1.0;
return min( distEnemy, dist ); return MIN( distEnemy, dist );
} }
return dist; return dist;
@ -1862,7 +1862,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
} }
else if ( GetActiveWeapon() ) else if ( GetActiveWeapon() )
{ {
flRange = max( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 ); flRange = MAX( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
} }
else else
{ {
@ -1905,8 +1905,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
if ( GetActiveWeapon() ) if ( GetActiveWeapon() )
{ {
flMaxRange = max( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 ); flMaxRange = MAX( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
flMinRange = min( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 ); flMinRange = MIN( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 );
} }
else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 ) else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 )
{ {
@ -2073,8 +2073,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
if ( GetActiveWeapon() ) if ( GetActiveWeapon() )
{ {
flMaxRange = max( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 ); flMaxRange = MAX( GetActiveWeapon()->m_fMaxRange1, GetActiveWeapon()->m_fMaxRange2 );
flMinRange = min( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 ); flMinRange = MIN( GetActiveWeapon()->m_fMinRange1, GetActiveWeapon()->m_fMinRange2 );
} }
else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 ) else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 )
{ {
@ -2229,8 +2229,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
float flMinRange = 0; float flMinRange = 0;
if ( GetActiveWeapon() ) if ( GetActiveWeapon() )
{ {
flMaxRange = max(GetActiveWeapon()->m_fMaxRange1,GetActiveWeapon()->m_fMaxRange2); flMaxRange = MAX(GetActiveWeapon()->m_fMaxRange1,GetActiveWeapon()->m_fMaxRange2);
flMinRange = min(GetActiveWeapon()->m_fMinRange1,GetActiveWeapon()->m_fMinRange2); flMinRange = MIN(GetActiveWeapon()->m_fMinRange1,GetActiveWeapon()->m_fMinRange2);
} }
else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 ) else if ( CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 )
{ {
@ -3694,7 +3694,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
#else #else
AngleVectors( ang, &move ); AngleVectors( ang, &move );
#endif //HL2_EPISODIC #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(); TaskComplete();
} }
@ -3703,7 +3703,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
ang.y = GetMotor()->GetIdealYaw() + 91; ang.y = GetMotor()->GetIdealYaw() + 91;
AngleVectors( ang, &move ); 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(); TaskComplete();
} }
@ -3720,7 +3720,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
ang.y = GetMotor()->GetIdealYaw() + 271; ang.y = GetMotor()->GetIdealYaw() + 271;
AngleVectors( ang, &move ); 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(); TaskComplete();
} }
@ -3742,7 +3742,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
AngleVectors( ang, &move ); 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(); TaskComplete();
} }

View File

@ -505,14 +505,14 @@ bool CAI_FollowBehavior::IsFollowTargetInRange( float rangeMultiplier )
if( GetNpcState() == NPC_STATE_COMBAT ) 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; return true;
} }
} }
else 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 ) 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 ); hintCriteria.SetFlag( bits_HINT_NODE_VISIBLE | bits_HINT_NODE_NEAREST );
// Add the search position // 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()); hintCriteria.AddExcludePosition( GetGoalPosition(), (GetFollowTarget()->WorldAlignMins().AsVector2D() - GetFollowTarget()->WorldAlignMaxs().AsVector2D()).Length());
return CAI_HintManager::FindHint( GetOuter(), hintCriteria ); return CAI_HintManager::FindHint( GetOuter(), hintCriteria );
@ -946,7 +946,7 @@ bool CAI_FollowBehavior::IsFollowPointInRange()
{ {
return ( GetHintNode() && return ( GetHintNode() &&
GetHintNode()->HintType() == HINT_FOLLOW_WAIT_POINT && 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 ) if ( pLeader )
{ {
Vector coverPos = vec3_invalid; Vector coverPos = vec3_invalid;
float coverRadius = min( GetOuter()->CoverRadius(), m_FollowNavGoal.coverTolerance ); float coverRadius = MIN( GetOuter()->CoverRadius(), m_FollowNavGoal.coverTolerance );
if ( FindCoverFromEnemyAtFollowTarget( coverRadius, &coverPos ) ) if ( FindCoverFromEnemyAtFollowTarget( coverRadius, &coverPos ) )
{ {
@ -1607,7 +1607,7 @@ void CAI_FollowBehavior::RunTask( const Task_t *pTask )
{ {
Assert( GetOuter()->m_vInterruptSavePosition == vec3_invalid ); Assert( GetOuter()->m_vInterruptSavePosition == vec3_invalid );
Vector coverPos = 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 ) ) if ( FindCoverFromEnemyAtFollowTarget( coverRadius, &coverPos ) )
{ {
GetOuter()->m_vInterruptSavePosition = coverPos; GetOuter()->m_vInterruptSavePosition = coverPos;

View File

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

View File

@ -314,7 +314,7 @@ void CAI_BlendedMotor::SetMoveScriptAnim( float flNewSpeed )
flWeight = 0.0; flWeight = 0.0;
} }
// Msg("weight %.3f rate %.3f\n", flWeight, m_flCurrRate ); // 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) if (m_nSavedGoalActivity == ACT_INVALID)
{ {
@ -392,7 +392,7 @@ void CAI_BlendedMotor::SetMoveScriptAnim( float flNewSpeed )
m_flSecondaryWeight = 0.0; 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) 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 minJumpHeight = 0;
float maxHorzVel = max( GetCurSpeed(), 100 ); float maxHorzVel = MAX( GetCurSpeed(), 100 );
float gravity = sv_gravity.GetFloat() * GetOuter()->GetGravity(); float gravity = sv_gravity.GetFloat() * GetOuter()->GetGravity();
Vector vecApex; Vector vecApex;
Vector rawJumpVel = GetMoveProbe()->CalcJumpLaunchVelocity(script.vecLocation, pNext->vecLocation, gravity, &minJumpHeight, maxHorzVel, &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 // clamp min velocities
for (i = 0; i < m_scriptMove.Count(); i++) 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 // 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 // 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 )) 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 else
{ {
@ -1746,7 +1746,7 @@ bool CAI_BlendedMotor::AddTurnGesture( float flYD )
float speed = (diff / (turnCompletion * actualDuration / rate)) * 0.1; float speed = (diff / (turnCompletion * actualDuration / rate)) * 0.1;
speed = clamp( speed, 15, 35 ); speed = clamp( speed, 15, 35 );
speed = min( speed, diff ); speed = MIN( speed, diff );
actualDuration = (diff / (turnCompletion * speed)) * 0.1 ; actualDuration = (diff / (turnCompletion * speed)) * 0.1 ;
@ -1759,7 +1759,7 @@ bool CAI_BlendedMotor::AddTurnGesture( float flYD )
Remember( bits_MEMORY_TURNING ); Remember( bits_MEMORY_TURNING );
// don't overlap the turn portion of the gestures, and don't play them too often // 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 ) if ( GetOuter()->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT )

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