min->Q_min, max->Q_max.

This commit is contained in:
Night Owl 2017-10-15 00:57:55 +05:00
parent e7989d438a
commit f78471ad1d
19 changed files with 56 additions and 56 deletions

View File

@ -151,7 +151,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
return FALSE;
int j = min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
int j = Q_min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
if( j == 0 )
return FALSE;

View File

@ -804,13 +804,13 @@ BOOL CApache::FireGun()
angles.x = angles.x + 360;
if( angles.x > m_angGun.x )
m_angGun.x = min( angles.x, m_angGun.x + 12 );
m_angGun.x = Q_min( angles.x, m_angGun.x + 12 );
if( angles.x < m_angGun.x )
m_angGun.x = max( angles.x, m_angGun.x - 12 );
m_angGun.x = Q_max( angles.x, m_angGun.x - 12 );
if( angles.y > m_angGun.y )
m_angGun.y = min( angles.y, m_angGun.y + 12 );
m_angGun.y = Q_min( angles.y, m_angGun.y + 12 );
if( angles.y < m_angGun.y )
m_angGun.y = max( angles.y, m_angGun.y - 12 );
m_angGun.y = Q_max( angles.y, m_angGun.y - 12 );
m_angGun.y = SetBoneController( 0, m_angGun.y );
m_angGun.x = SetBoneController( 1, m_angGun.x );

View File

@ -1656,12 +1656,12 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
item->m_iId = II.iId;
item->m_iClip = gun->m_iClip;
item->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle, -0.001 );
item->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack, -0.001 );
item->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack, -0.001 );
item->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle, -0.001 );
item->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack, -0.001 );
item->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack, -0.001 );
item->m_fInReload = gun->m_fInReload;
item->m_fInSpecialReload = gun->m_fInSpecialReload;
item->fuser1 = max( gun->pev->fuser1, -0.001 );
item->fuser1 = Q_max( gun->pev->fuser1, -0.001 );
item->fuser2 = gun->m_flStartThrow;
item->fuser3 = gun->m_flReleaseThrow;
item->iuser1 = gun->m_chargeReady;

View File

@ -727,7 +727,7 @@ void CGib::BounceGibTouch( CBaseEntity *pOther )
float volume;
float zvel = fabs( pev->velocity.z );
volume = 0.8 * min( 1.0, ( (float)zvel ) / 450.0 );
volume = 0.8 * Q_min( 1.0, ( (float)zvel ) / 450.0 );
CBreakable::MaterialSoundRandom( edict(), (Materials)m_material, volume );
}

View File

@ -280,12 +280,12 @@ void CBeam::RelinkBeam( void )
{
const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
pev->mins.x = min( startPos.x, endPos.x );
pev->mins.y = min( startPos.y, endPos.y );
pev->mins.z = min( startPos.z, endPos.z );
pev->maxs.x = max( startPos.x, endPos.x );
pev->maxs.y = max( startPos.y, endPos.y );
pev->maxs.z = max( startPos.z, endPos.z );
pev->mins.x = Q_min( startPos.x, endPos.x );
pev->mins.y = Q_min( startPos.y, endPos.y );
pev->mins.z = Q_min( startPos.z, endPos.z );
pev->maxs.x = Q_max( startPos.x, endPos.x );
pev->maxs.y = Q_max( startPos.y, endPos.y );
pev->maxs.z = Q_max( startPos.z, endPos.z );
pev->mins = pev->mins - pev->origin;
pev->maxs = pev->maxs - pev->origin;

View File

@ -88,11 +88,11 @@ typedef float vec_t; // needed before including progdefs.h
// Shared header between the client DLL and the game DLLs
#include "cdll_dll.h"
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#ifndef Q_min
#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#ifndef Q_max
#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#endif //EXTDLL_H

View File

@ -699,12 +699,12 @@ void CHAssassin::RunAI( void )
EMIT_SOUND( ENT( pev ), CHAN_BODY, "debris/beamstart1.wav", 0.2, ATTN_NORM );
}
pev->renderamt = max( pev->renderamt - 50, m_iTargetRanderamt );
pev->renderamt = Q_max( pev->renderamt - 50, m_iTargetRanderamt );
pev->rendermode = kRenderTransTexture;
}
else if( pev->renderamt < m_iTargetRanderamt )
{
pev->renderamt = min( pev->renderamt + 50, m_iTargetRanderamt );
pev->renderamt = Q_min( pev->renderamt + 50, m_iTargetRanderamt );
if( pev->renderamt == 255 )
pev->rendermode = kRenderNormal;
}

View File

@ -227,7 +227,7 @@ class CItemBattery : public CItem
char szcharge[64];
pPlayer->pev->armorvalue += gSkillData.batteryCapacity;
pPlayer->pev->armorvalue = min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY );
pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY );
EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM );

View File

@ -768,7 +768,7 @@ void CGamePlayerEquip::KeyValue( KeyValueData *pkvd )
m_weaponNames[i] = ALLOC_STRING( tmp );
m_weaponCount[i] = atoi( pkvd->szValue );
m_weaponCount[i] = max( 1, m_weaponCount[i] );
m_weaponCount[i] = Q_max( 1, m_weaponCount[i] );
pkvd->fHandled = TRUE;
break;
}

View File

@ -1959,7 +1959,7 @@ void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, f
while( flTotal > 0.001 )
{
// don't walk more than 16 units or stairs stop working
flStep = min( 16.0, flTotal );
flStep = Q_min( 16.0, flTotal );
UTIL_MoveToOrigin( ENT( pev ), m_Route[m_iRouteIndex].vecLocation, flStep, MOVE_NORMAL );
flTotal -= flStep;
}

View File

@ -1368,15 +1368,15 @@ int ReloadMapCycleFile( const char *filename, mapcycle_t *cycle )
if( s && s[0] )
{
item->minplayers = atoi( s );
item->minplayers = max( item->minplayers, 0 );
item->minplayers = min( item->minplayers, gpGlobals->maxClients );
item->minplayers = Q_max( item->minplayers, 0 );
item->minplayers = Q_min( item->minplayers, gpGlobals->maxClients );
}
s = g_engfuncs.pfnInfoKeyValue( szBuffer, "maxplayers" );
if( s && s[0] )
{
item->maxplayers = atoi( s );
item->maxplayers = max( item->maxplayers, 0 );
item->maxplayers = min( item->maxplayers, gpGlobals->maxClients );
item->maxplayers = Q_max( item->maxplayers, 0 );
item->maxplayers = Q_min( item->maxplayers, gpGlobals->maxClients );
}
// Remove keys

View File

@ -478,7 +478,7 @@ void CNihilanth::DyingThink( void )
{
if( m_pBall->pev->renderamt > 0 )
{
m_pBall->pev->renderamt = max( 0, m_pBall->pev->renderamt - 2 );
m_pBall->pev->renderamt = Q_max( 0, m_pBall->pev->renderamt - 2 );
}
else
{
@ -895,7 +895,7 @@ void CNihilanth::HuntThink( void )
}
else
{
m_flAdj = min( m_flAdj + 10, 1000 );
m_flAdj = Q_min( m_flAdj + 10, 1000 );
}
}

View File

@ -793,12 +793,12 @@ void inline CalcBounds( int &Lower, int &Upper, int Goal, int Best )
int Temp = 2 * Goal - Best;
if( Best > Goal )
{
Lower = max( 0, Temp );
Lower = Q_max( 0, Temp );
Upper = Best;
}
else
{
Upper = min( 255, Temp );
Upper = Q_min( 255, Temp );
Lower = Best;
}
}
@ -962,7 +962,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
}
}
for( i = max( m_minY, halfY + 1 ); i <= m_maxY; i++ )
for( i = Q_max( m_minY, halfY + 1 ); i <= m_maxY; i++ )
{
for( j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++ )
{
@ -987,7 +987,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
}
}
for( i = min( m_maxZ, halfZ ); i >= m_minZ; i-- )
for( i = Q_min( m_maxZ, halfZ ); i >= m_minZ; i-- )
{
for( j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++ )
{
@ -1012,7 +1012,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
}
}
for( i = max( m_minX, halfX + 1 ); i <= m_maxX; i++ )
for( i = Q_max( m_minX, halfX + 1 ); i <= m_maxX; i++ )
{
for( j = m_RangeStart[0][i]; j <= m_RangeEnd[0][i]; j++ )
{
@ -1034,7 +1034,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
}
}
for( i = min( m_maxY, halfY ); i >= m_minY; i-- )
for( i = Q_min( m_maxY, halfY ); i >= m_minY; i-- )
{
for( j = m_RangeStart[1][i]; j <= m_RangeEnd[1][i]; j++ )
{
@ -1055,7 +1055,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
}
}
for( i = max( m_minZ, halfZ + 1 ); i <= m_maxZ; i++ )
for( i = Q_max( m_minZ, halfZ + 1 ); i <= m_maxZ; i++ )
{
for( j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++ )
{

View File

@ -2049,7 +2049,7 @@ void CBasePlayer::CheckTimeBasedDamage()
// after the player has been drowning and finally takes a breath
if( m_idrowndmg > m_idrownrestored )
{
int idif = min( m_idrowndmg - m_idrownrestored, 10 );
int idif = Q_min( m_idrowndmg - m_idrownrestored, 10 );
TakeHealth( idif, DMG_GENERIC );
m_idrownrestored += idif;
@ -2606,23 +2606,23 @@ pt_end:
if( gun && gun->UseDecrement() )
{
gun->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
gun->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
gun->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
gun->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
if( gun->m_flTimeWeaponIdle != 1000 )
{
gun->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 );
gun->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 );
}
if( gun->pev->fuser1 != 1000 )
{
gun->pev->fuser1 = max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 );
gun->pev->fuser1 = Q_max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 );
}
// Only decrement if not flagged as NO_DECREMENT
/*if( gun->m_flPumpTime != 1000 )
{
gun->m_flPumpTime = max( gun->m_flPumpTime - gpGlobals->frametime, -0.001 );
gun->m_flPumpTime = Q_max( gun->m_flPumpTime - gpGlobals->frametime, -0.001 );
}*/
}
@ -3705,7 +3705,7 @@ int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax )
if( i < 0 || i >= MAX_AMMO_SLOTS )
return -1;
int iAdd = min( iCount, iMax - m_rgAmmo[i] );
int iAdd = Q_min( iCount, iMax - m_rgAmmo[i] );
if( iAdd < 1 )
return i;
@ -3826,7 +3826,7 @@ void CBasePlayer::SendAmmoUpdate( void )
// send "Ammo" update message
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev );
WRITE_BYTE( i );
WRITE_BYTE( max( min( m_rgAmmo[i], 254 ), 0 ) ); // clamp the value to one byte
WRITE_BYTE( Q_max( Q_min( m_rgAmmo[i], 254 ), 0 ) ); // clamp the value to one byte
MESSAGE_END();
}
}

View File

@ -1567,7 +1567,7 @@ void TEXTURETYPE_Init()
continue;
// null-terminate name and save in sentences array
j = min( j, CBTEXTURENAMEMAX - 1 + i );
j = Q_min( j, CBTEXTURENAMEMAX - 1 + i );
buffer[j] = 0;
strcpy( &( grgszTextureName[gcTextures++][0] ), &( buffer[i] ) );
}

View File

@ -403,11 +403,11 @@ void CTalkMonster::StartTask( Task_t *pTask )
if( yaw < 0 )
{
pev->ideal_yaw = min( yaw + 45, 0 ) + pev->angles.y;
pev->ideal_yaw = Q_min( yaw + 45, 0 ) + pev->angles.y;
}
else
{
pev->ideal_yaw = max( yaw - 45, 0 ) + pev->angles.y;
pev->ideal_yaw = Q_max( yaw - 45, 0 ) + pev->angles.y;
}
}
TaskComplete();

View File

@ -454,7 +454,7 @@ void CBaseTurret::EyeOff()
{
if( m_eyeBrightness > 0 )
{
m_eyeBrightness = max( 0, m_eyeBrightness - 30 );
m_eyeBrightness = Q_max( 0, m_eyeBrightness - 30 );
m_pEyeGlow->SetBrightness( m_eyeBrightness );
}
}

View File

@ -1112,7 +1112,7 @@ void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color,
WRITE_COORD( direction.y );
WRITE_COORD( direction.z );
WRITE_BYTE( color );
WRITE_BYTE( min( amount, 255 ) );
WRITE_BYTE( Q_min( amount, 255 ) );
MESSAGE_END();
}
@ -1144,7 +1144,7 @@ void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color,
WRITE_SHORT( g_sModelIndexBloodSpray ); // initial sprite model
WRITE_SHORT( g_sModelIndexBloodDrop ); // droplet sprite models
WRITE_BYTE( color ); // color index into host_basepal
WRITE_BYTE( min( max( 3, amount / 10 ), 16 ) ); // size
WRITE_BYTE( Q_min( Q_max( 3, amount / 10 ), 16 ) ); // size
MESSAGE_END();
}

View File

@ -607,7 +607,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase() ) )
{
// complete the reload.
int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]);
int j = Q_min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]);
// Add them to the clip
m_iClip += j;
@ -850,7 +850,7 @@ BOOL CBasePlayerWeapon::AddPrimaryAmmo( int iCount, char *szName, int iMaxClip,
else if( m_iClip == 0 )
{
int i;
i = min( m_iClip + iCount, iMaxClip ) - m_iClip;
i = Q_min( m_iClip + iCount, iMaxClip ) - m_iClip;
m_iClip += i;
iIdAmmo = m_pPlayer->GiveAmmo( iCount - i, szName, iMaxCarry );
}
@ -964,7 +964,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
return FALSE;
int j = min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
int j = Q_min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
if( j == 0 )
return FALSE;
@ -1428,7 +1428,7 @@ int CWeaponBox::GiveAmmo( int iCount, const char *szName, int iMax, int *pIndex/
if( pIndex )
*pIndex = i;
int iAdd = min( iCount, iMax - m_rgAmmo[i] );
int iAdd = Q_min( iCount, iMax - m_rgAmmo[i] );
if( iCount == 0 || iAdd > 0 )
{
m_rgAmmo[i] += iAdd;