Merge branch 'sdk-update' into rebellion

This commit is contained in:
Night Owl 2017-10-15 18:23:34 +05:00
commit 795af828fc
25 changed files with 119 additions and 62 deletions

View File

@ -305,7 +305,7 @@ void CHudAmmo::Reset( void )
gHR.Reset(); gHR.Reset();
//VidInit(); //VidInit();
wrect_t nullrc = {}; wrect_t nullrc = {0,};
SetCrosshair( 0, nullrc, 0, 0, 0 ); // reset crosshair SetCrosshair( 0, nullrc, 0, 0, 0 ); // reset crosshair
m_pWeapon = NULL; // reset last weapon m_pWeapon = NULL; // reset last weapon
} }
@ -539,7 +539,7 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
if( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) if( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
{ {
wrect_t nullrc = {}; wrect_t nullrc = {0,};
gpActiveSel = NULL; gpActiveSel = NULL;
SetCrosshair( 0, nullrc, 0, 0, 0 ); SetCrosshair( 0, nullrc, 0, 0, 0 );
} }
@ -559,7 +559,7 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
// //
int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf ) int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
{ {
wrect_t nullrc = {}; wrect_t nullrc = {0,};
int fOnTarget = FALSE; int fOnTarget = FALSE;
BEGIN_READ( pbuf, iSize ); BEGIN_READ( pbuf, iSize );

View File

@ -1208,7 +1208,13 @@ enum crowbar_e
CROWBAR_ATTACK2MISS, CROWBAR_ATTACK2MISS,
CROWBAR_ATTACK2HIT, CROWBAR_ATTACK2HIT,
CROWBAR_ATTACK3MISS, CROWBAR_ATTACK3MISS,
#ifndef CROWBAR_IDLE_ANIM
CROWBAR_ATTACK3HIT CROWBAR_ATTACK3HIT
#else
CROWBAR_ATTACK3HIT,
CROWBAR_IDLE2,
CROWBAR_IDLE3
#endif
}; };
int g_iSwing; int g_iSwing;

View File

@ -152,7 +152,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
return FALSE; 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 ) if( j == 0 )
return FALSE; return FALSE;

View File

@ -804,13 +804,13 @@ BOOL CApache::FireGun()
angles.x = angles.x + 360; angles.x = angles.x + 360;
if( angles.x > m_angGun.x ) 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 ) 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 ) 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 ) 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.y = SetBoneController( 0, m_angGun.y );
m_angGun.x = SetBoneController( 1, m_angGun.x ); 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_iId = II.iId;
item->m_iClip = gun->m_iClip; item->m_iClip = gun->m_iClip;
item->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle, -0.001 ); item->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle, -0.001 );
item->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack, -0.001 ); item->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack, -0.001 );
item->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack, -0.001 ); item->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack, -0.001 );
item->m_fInReload = gun->m_fInReload; item->m_fInReload = gun->m_fInReload;
item->m_fInSpecialReload = gun->m_fInSpecialReload; 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->fuser2 = gun->m_flStartThrow;
item->fuser3 = gun->m_flReleaseThrow; item->fuser3 = gun->m_flReleaseThrow;
item->iuser1 = gun->m_chargeReady; item->iuser1 = gun->m_chargeReady;

View File

@ -727,7 +727,7 @@ void CGib::BounceGibTouch( CBaseEntity *pOther )
float volume; float volume;
float zvel = fabs( pev->velocity.z ); 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 ); CBreakable::MaterialSoundRandom( edict(), (Materials)m_material, volume );
} }

View File

@ -37,7 +37,13 @@ enum crowbar_e
CROWBAR_ATTACK2MISS, CROWBAR_ATTACK2MISS,
CROWBAR_ATTACK2HIT, CROWBAR_ATTACK2HIT,
CROWBAR_ATTACK3MISS, CROWBAR_ATTACK3MISS,
#ifndef CROWBAR_IDLE_ANIM
CROWBAR_ATTACK3HIT CROWBAR_ATTACK3HIT
#else
CROWBAR_ATTACK3HIT,
CROWBAR_IDLE2,
CROWBAR_IDLE3
#endif
}; };
void CCrowbar::Spawn() void CCrowbar::Spawn()
@ -208,7 +214,9 @@ int CCrowbar::Swing( int fFirst )
{ {
// miss // miss
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 ); m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
#ifdef CROWBAR_IDLE_ANIM
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
#endif
// player "shoot" animation // player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
} }
@ -324,5 +332,38 @@ int CCrowbar::Swing( int fFirst )
#endif #endif
m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 ); m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 );
} }
#ifdef CROWBAR_IDLE_ANIM
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
#endif
return fDidHit; return fDidHit;
} }
#ifdef CROWBAR_IDLE_ANIM
void CCrowbar::WeaponIdle( void )
{
if( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
{
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand > 0.9 )
{
iAnim = CROWBAR_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
}
else
{
if( flRand > 0.5 )
{
iAnim = CROWBAR_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0 / 30.0;
}
else
{
iAnim = CROWBAR_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
}
}
SendWeaponAnim( iAnim );
}
}
#endif

View File

@ -280,12 +280,12 @@ void CBeam::RelinkBeam( void )
{ {
const Vector &startPos = GetStartPos(), &endPos = GetEndPos(); const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
pev->mins.x = min( startPos.x, endPos.x ); pev->mins.x = Q_min( startPos.x, endPos.x );
pev->mins.y = min( startPos.y, endPos.y ); pev->mins.y = Q_min( startPos.y, endPos.y );
pev->mins.z = min( startPos.z, endPos.z ); pev->mins.z = Q_min( startPos.z, endPos.z );
pev->maxs.x = max( startPos.x, endPos.x ); pev->maxs.x = Q_max( startPos.x, endPos.x );
pev->maxs.y = max( startPos.y, endPos.y ); pev->maxs.y = Q_max( startPos.y, endPos.y );
pev->maxs.z = max( startPos.z, endPos.z ); pev->maxs.z = Q_max( startPos.z, endPos.z );
pev->mins = pev->mins - pev->origin; pev->mins = pev->mins - pev->origin;
pev->maxs = pev->maxs - 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 // Shared header between the client DLL and the game DLLs
#include "cdll_dll.h" #include "cdll_dll.h"
#ifndef min #ifndef Q_min
#define min(a,b) (((a) < (b)) ? (a) : (b)) #define Q_min(a,b) (((a) < (b)) ? (a) : (b))
#endif #endif
#ifndef max #ifndef Q_max
#define max(a,b) (((a) > (b)) ? (a) : (b)) #define Q_max(a,b) (((a) > (b)) ? (a) : (b))
#endif #endif
#endif //EXTDLL_H #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 ); 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; pev->rendermode = kRenderTransTexture;
} }
else if( pev->renderamt < m_iTargetRanderamt ) 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 ) if( pev->renderamt == 255 )
pev->rendermode = kRenderNormal; pev->rendermode = kRenderNormal;
} }

View File

@ -227,7 +227,7 @@ class CItemBattery : public CItem
char szcharge[64]; char szcharge[64];
pPlayer->pev->armorvalue += gSkillData.batteryCapacity; 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 ); 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_weaponNames[i] = ALLOC_STRING( tmp );
m_weaponCount[i] = atoi( pkvd->szValue ); 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; pkvd->fHandled = TRUE;
break; break;
} }

View File

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

View File

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

View File

@ -478,7 +478,7 @@ void CNihilanth::DyingThink( void )
{ {
if( m_pBall->pev->renderamt > 0 ) 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 else
{ {
@ -895,7 +895,7 @@ void CNihilanth::HuntThink( void )
} }
else 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; int Temp = 2 * Goal - Best;
if( Best > Goal ) if( Best > Goal )
{ {
Lower = max( 0, Temp ); Lower = Q_max( 0, Temp );
Upper = Best; Upper = Best;
} }
else else
{ {
Upper = min( 255, Temp ); Upper = Q_min( 255, Temp );
Lower = Best; 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++ ) 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++ ) 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++ ) 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++ ) 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++ ) for( j = m_RangeStart[2][i]; j <= m_RangeEnd[2][i]; j++ )
{ {

View File

@ -666,7 +666,7 @@ void CBasePlayer::PackDeadPlayerItems( void )
int iWeaponRules; int iWeaponRules;
int iAmmoRules; int iAmmoRules;
int i; int i;
CBasePlayerWeapon *rgpPackWeapons[MAX_WEAPONS] = {}; CBasePlayerWeapon *rgpPackWeapons[MAX_WEAPONS] = {0,};
int iPackAmmo[MAX_AMMO_SLOTS]; int iPackAmmo[MAX_AMMO_SLOTS];
int iPW = 0;// index into packweapons array int iPW = 0;// index into packweapons array
int iPA = 0;// index into packammo array int iPA = 0;// index into packammo array
@ -2049,7 +2049,7 @@ void CBasePlayer::CheckTimeBasedDamage()
// after the player has been drowning and finally takes a breath // after the player has been drowning and finally takes a breath
if( m_idrowndmg > m_idrownrestored ) 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 ); TakeHealth( idif, DMG_GENERIC );
m_idrownrestored += idif; m_idrownrestored += idif;
@ -2586,6 +2586,11 @@ void CBasePlayer::PostThink()
UpdatePlayerSound(); UpdatePlayerSound();
pt_end: pt_end:
if( pev->deadflag == DEAD_NO )
m_vecLastViewAngles = pev->angles;
else
pev->angles = m_vecLastViewAngles;
// Track button info so we can detect 'pressed' and 'released' buttons next frame // Track button info so we can detect 'pressed' and 'released' buttons next frame
m_afButtonLast = pev->button; m_afButtonLast = pev->button;
@ -2606,23 +2611,23 @@ pt_end:
if( gun && gun->UseDecrement() ) if( gun && gun->UseDecrement() )
{ {
gun->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 ); gun->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
gun->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 ); gun->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
if( gun->m_flTimeWeaponIdle != 1000 ) 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 ) 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 // Only decrement if not flagged as NO_DECREMENT
/*if( gun->m_flPumpTime != 1000 ) /*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 );
}*/ }*/
} }
@ -3707,7 +3712,7 @@ int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax )
if( i < 0 || i >= MAX_AMMO_SLOTS ) if( i < 0 || i >= MAX_AMMO_SLOTS )
return -1; return -1;
int iAdd = min( iCount, iMax - m_rgAmmo[i] ); int iAdd = Q_min( iCount, iMax - m_rgAmmo[i] );
if( iAdd < 1 ) if( iAdd < 1 )
return i; return i;
@ -3828,7 +3833,7 @@ void CBasePlayer::SendAmmoUpdate( void )
// send "Ammo" update message // send "Ammo" update message
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev ); MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev );
WRITE_BYTE( i ); 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(); MESSAGE_END();
} }
} }

View File

@ -306,6 +306,8 @@ public:
void TabulateAmmo( void ); void TabulateAmmo( void );
Vector m_vecLastViewAngles;
float m_flStartCharge; float m_flStartCharge;
float m_flAmmoStartCharge; float m_flAmmoStartCharge;
float m_flPlayAftershock; float m_flPlayAftershock;

View File

@ -467,7 +467,7 @@ void CScientist::StartTask( Task_t *pTask )
//The enemy can be null here. - Solokiller //The enemy can be null here. - Solokiller
//Discovered while testing the barnacle grapple on headcrabs with scientists in view. //Discovered while testing the barnacle grapple on headcrabs with scientists in view.
if( m_hEnemy && m_hEnemy->IsPlayer() ) if( m_hEnemy != 0 && m_hEnemy->IsPlayer() )
PlaySentence( "SC_PLFEAR", 5, VOL_NORM, ATTN_NORM ); PlaySentence( "SC_PLFEAR", 5, VOL_NORM, ATTN_NORM );
else else
PlaySentence( "SC_FEAR", 5, VOL_NORM, ATTN_NORM ); PlaySentence( "SC_FEAR", 5, VOL_NORM, ATTN_NORM );

View File

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

View File

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

View File

@ -454,7 +454,7 @@ void CBaseTurret::EyeOff()
{ {
if( m_eyeBrightness > 0 ) if( m_eyeBrightness > 0 )
{ {
m_eyeBrightness = max( 0, m_eyeBrightness - 30 ); m_eyeBrightness = Q_max( 0, m_eyeBrightness - 30 );
m_pEyeGlow->SetBrightness( m_eyeBrightness ); 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.y );
WRITE_COORD( direction.z ); WRITE_COORD( direction.z );
WRITE_BYTE( color ); WRITE_BYTE( color );
WRITE_BYTE( min( amount, 255 ) ); WRITE_BYTE( Q_min( amount, 255 ) );
MESSAGE_END(); 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_sModelIndexBloodSpray ); // initial sprite model
WRITE_SHORT( g_sModelIndexBloodDrop ); // droplet sprite models WRITE_SHORT( g_sModelIndexBloodDrop ); // droplet sprite models
WRITE_BYTE( color ); // color index into host_basepal 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(); MESSAGE_END();
} }

View File

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

View File

@ -509,6 +509,9 @@ public:
int Swing( int fFirst ); int Swing( int fFirst );
BOOL Deploy( void ); BOOL Deploy( void );
void Holster( int skiplocal = 0 ); void Holster( int skiplocal = 0 );
#ifdef CROWBAR_IDLE_ANIM
void WeaponIdle();
#endif
int m_iSwing; int m_iSwing;
TraceResult m_trHit; TraceResult m_trHit;