Browse Source

min->Q_min, max->Q_max.

residual_point
Night Owl 7 years ago
parent
commit
f78471ad1d
  1. 2
      cl_dll/hl/hl_weapons.cpp
  2. 8
      dlls/apache.cpp
  3. 8
      dlls/client.cpp
  4. 2
      dlls/combat.cpp
  5. 12
      dlls/effects.cpp
  6. 8
      dlls/extdll.h
  7. 4
      dlls/hassassin.cpp
  8. 2
      dlls/items.cpp
  9. 2
      dlls/maprules.cpp
  10. 2
      dlls/monsters.cpp
  11. 8
      dlls/multiplay_gamerules.cpp
  12. 4
      dlls/nihilanth.cpp
  13. 14
      dlls/nodes.cpp
  14. 16
      dlls/player.cpp
  15. 2
      dlls/sound.cpp
  16. 4
      dlls/talkmonster.cpp
  17. 2
      dlls/turret.cpp
  18. 4
      dlls/util.cpp
  19. 8
      dlls/weapons.cpp

2
cl_dll/hl/hl_weapons.cpp

@ -151,7 +151,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i @@ -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;

8
dlls/apache.cpp

@ -804,13 +804,13 @@ BOOL CApache::FireGun() @@ -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 );

8
dlls/client.cpp

@ -1656,12 +1656,12 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) @@ -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;

2
dlls/combat.cpp

@ -727,7 +727,7 @@ void CGib::BounceGibTouch( CBaseEntity *pOther ) @@ -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 );
}

12
dlls/effects.cpp

@ -280,12 +280,12 @@ void CBeam::RelinkBeam( void ) @@ -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;

8
dlls/extdll.h

@ -88,11 +88,11 @@ typedef float vec_t; // needed before including progdefs.h @@ -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

4
dlls/hassassin.cpp

@ -699,12 +699,12 @@ void CHAssassin::RunAI( void ) @@ -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;
}

2
dlls/items.cpp

@ -227,7 +227,7 @@ class CItemBattery : public CItem @@ -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 );

2
dlls/maprules.cpp

@ -768,7 +768,7 @@ void CGamePlayerEquip::KeyValue( KeyValueData *pkvd ) @@ -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;
}

2
dlls/monsters.cpp

@ -1959,7 +1959,7 @@ void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, f @@ -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;
}

8
dlls/multiplay_gamerules.cpp

@ -1368,15 +1368,15 @@ int ReloadMapCycleFile( const char *filename, mapcycle_t *cycle ) @@ -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

4
dlls/nihilanth.cpp

@ -478,7 +478,7 @@ void CNihilanth::DyingThink( void ) @@ -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 ) @@ -895,7 +895,7 @@ void CNihilanth::HuntThink( void )
}
else
{
m_flAdj = min( m_flAdj + 10, 1000 );
m_flAdj = Q_min( m_flAdj + 10, 1000 );
}
}

14
dlls/nodes.cpp

@ -793,12 +793,12 @@ void inline CalcBounds( int &Lower, int &Upper, int Goal, int Best ) @@ -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 ) @@ -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 ) @@ -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 ) @@ -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 ) @@ -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 ) @@ -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++ )
{

16
dlls/player.cpp

@ -2049,7 +2049,7 @@ void CBasePlayer::CheckTimeBasedDamage() @@ -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: @@ -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 ) @@ -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 ) @@ -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();
}
}

2
dlls/sound.cpp

@ -1567,7 +1567,7 @@ void TEXTURETYPE_Init() @@ -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] ) );
}

4
dlls/talkmonster.cpp

@ -403,11 +403,11 @@ void CTalkMonster::StartTask( Task_t *pTask ) @@ -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();

2
dlls/turret.cpp

@ -454,7 +454,7 @@ void CBaseTurret::EyeOff() @@ -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 );
}
}

4
dlls/util.cpp

@ -1112,7 +1112,7 @@ void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, @@ -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, @@ -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();
}

8
dlls/weapons.cpp

@ -607,7 +607,7 @@ void CBasePlayerWeapon::ItemPostFrame( void ) @@ -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, @@ -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 @@ -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/ @@ -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;

Loading…
Cancel
Save