Cleanup for 3.1 linux server

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@93 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2005-05-03 09:08:22 +00:00
parent 1c44645c9b
commit 8184bf4ccb
22 changed files with 383 additions and 1035 deletions

View file

@ -376,7 +376,8 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
mstudiobonecontroller_t *pbonecontroller = (mstudiobonecontroller_t *)((byte *)pstudiohdr + pstudiohdr->bonecontrollerindex);
// find first controller that matches the index
for (int i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++)
int i=0;
for (i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++)
{
if (pbonecontroller->index == iController)
break;

View file

@ -442,7 +442,8 @@ void Host_Say( edict_t *pEntity, int teamonly )
}
// make sure the text has content
for ( char *pc = p; pc != NULL && *pc != 0; pc++ )
char *pc=p;
for ( pc = p; pc != NULL && *pc != 0; pc++ )
{
if ( isprint( *pc ) && !isspace( *pc ) )
{
@ -862,7 +863,8 @@ void ClientPrecache( void )
// Precache sound lists for all player types
gSoundListManager.Clear();
for(int i = ((int)AVH_USER3_NONE + 1); i < (int)AVH_USER3_ALIEN_EMBRYO; i++)
int i=0;
for(i = ((int)AVH_USER3_NONE + 1); i < (int)AVH_USER3_ALIEN_EMBRYO; i++)
{
char theSoundListName[256];
bool theIsAlien = (i > 3);
@ -1950,9 +1952,9 @@ 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 = max( gun->m_flTimeWeaponIdle, -0.001f );
item->m_flNextPrimaryAttack = max( gun->m_flNextPrimaryAttack, -0.001f );
item->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack, -0.001f );
item->m_fInReload = gun->m_fInReload;
//thePlayer->SetDebugCSP(item);

View file

@ -1736,7 +1736,7 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
if ( distance > BALANCE_VAR(kShotgunDamageRange) )
{
float fallOffDistance=distance-BALANCE_VAR(kShotgunDamageRange);
float fallOff=max(0.0, 1.0f-(fallOffDistance/(kSGRange/2)));
float fallOff=max(0.0f, 1.0f-(fallOffDistance/(kSGRange/2)));
theAdjustedDamage*=fallOff;
}
}

View file

@ -229,7 +229,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 = min(pPlayer->pev->armorvalue, (float)MAX_NORMAL_BATTERY);
EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM );

View file

@ -654,8 +654,8 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller,
killer_weapon_name += 8;
else if ( strncmp( killer_weapon_name, "func_", 5 ) == 0 )
killer_weapon_name += 5;
NetMsg_DeathMsg( killer_index, ENTINDEX( pVictim->edict() ), string( killer_weapon_name ) );
string tmpstr(killer_weapon_name);
NetMsg_DeathMsg( killer_index, ENTINDEX( pVictim->edict() ), tmpstr);
// replace the code names with the 'real' names
if ( !strcmp( killer_weapon_name, "egon" ) )

View file

@ -2062,8 +2062,8 @@ void CBasePlayer::UpdateStatusBar()
//newSBarState[ SBAR_ID_TARGETARMOR ] = pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max.
float theHealthPercent = pEntity->pev->health/AvHPlayerUpgrade::GetMaxHealth(pEntity->pev->iuser4, (AvHUser3)pEntity->pev->iuser3, theLevel);
float theArmorPercent = pEntity->pev->armorvalue/AvHPlayerUpgrade::GetMaxArmorLevel(pEntity->pev->iuser4, (AvHUser3)pEntity->pev->iuser3);
newSBarState[ SBAR_ID_TARGETHEALTH ] = max(theHealthPercent*100+0.5, 0);
newSBarState[ SBAR_ID_TARGETARMOR ] = max(theArmorPercent*100+0.5, 0);
newSBarState[ SBAR_ID_TARGETHEALTH ] = max(theHealthPercent*100+0.5f, 0.0f);
newSBarState[ SBAR_ID_TARGETARMOR ] = max(theArmorPercent*100+0.5f, 0.0f);
newSBarState[ SBAR_ID_TARGETLEVEL ] = theLevel;
}
}
@ -2091,7 +2091,7 @@ void CBasePlayer::UpdateStatusBar()
strcpy( sbuf1, "2 (health: %i2%%)\n" );
float theHealthPercentage = pEntity->pev->health/pEntity->pev->max_health;
newSBarState[ SBAR_ID_TARGETHEALTH ] = max(theHealthPercentage*100+0.5, 0);
newSBarState[ SBAR_ID_TARGETHEALTH ] = max(theHealthPercentage*100+0.5f, 0.0f);
}
}
@ -2978,23 +2978,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 = max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0f );
gun->m_flNextSecondaryAttack = max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001f );
if ( gun->m_flTimeWeaponIdle != 1000 )
{
gun->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 );
gun->m_flTimeWeaponIdle = max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001f );
}
if ( gun->pev->fuser1 != 1000 )
{
gun->pev->fuser1 = max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 );
gun->pev->fuser1 = max( gun->pev->fuser1 - gpGlobals->frametime, -0.001f );
}
// 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 = max( gun->m_flPumpTime - gpGlobals->frametime, -0.001f );
// }
}
@ -4175,7 +4175,7 @@ void CBasePlayer :: UpdateClientData( void )
if ((int)pev->health != m_iClientHealth) //voogru: this cast to int is important, otherwise we spam the message, this is just a quick and easy fix.
{
NetMsg_Health( pev, max( pev->health, 0 ) );
NetMsg_Health( pev, max( pev->health, 0.0f ) );
m_iClientHealth = (int)pev->health;
}

View file

@ -1,617 +0,0 @@
/***
*
* Copyright (c) 1999, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( OEM_BUILD )
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "gamerules.h"
enum rpg_e {
RPG_IDLE = 0,
RPG_FIDGET,
RPG_RELOAD, // to reload
RPG_FIRE2, // to empty
RPG_HOLSTER1, // loaded
RPG_DRAW1, // loaded
RPG_HOLSTER2, // unloaded
RPG_DRAW_UL, // unloaded
RPG_IDLE_UL, // unloaded idle
RPG_FIDGET_UL, // unloaded fidget
};
LINK_ENTITY_TO_CLASS( weapon_rpg, CRpg );
#ifndef CLIENT_DLL
LINK_ENTITY_TO_CLASS( laser_spot, CLaserSpot );
//=========================================================
//=========================================================
CLaserSpot *CLaserSpot::CreateSpot( void )
{
CLaserSpot *pSpot = GetClassPtr( (CLaserSpot *)NULL );
pSpot->Spawn();
pSpot->pev->classname = MAKE_STRING("laser_spot");
return pSpot;
}
//=========================================================
//=========================================================
void CLaserSpot::Spawn( void )
{
Precache( );
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT;
pev->rendermode = kRenderGlow;
pev->renderfx = kRenderFxNoDissipation;
pev->renderamt = 255;
SET_MODEL(ENT(pev), "sprites/laserdot.spr");
UTIL_SetOrigin( pev, pev->origin );
};
//=========================================================
// Suspend- make the laser sight invisible.
//=========================================================
void CLaserSpot::Suspend( float flSuspendTime )
{
pev->effects |= EF_NODRAW;
SetThink( &CLaserSpot::Revive );
pev->nextthink = gpGlobals->time + flSuspendTime;
}
//=========================================================
// Revive - bring a suspended laser sight back.
//=========================================================
void CLaserSpot::Revive( void )
{
pev->effects &= ~EF_NODRAW;
SetThink( NULL );
}
void CLaserSpot::Precache( void )
{
PRECACHE_MODEL("sprites/laserdot.spr");
};
LINK_ENTITY_TO_CLASS( rpg_rocket, CRpgRocket );
//=========================================================
//=========================================================
CRpgRocket *CRpgRocket::CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CRpg *pLauncher )
{
CRpgRocket *pRocket = GetClassPtr( (CRpgRocket *)NULL );
UTIL_SetOrigin( pRocket->pev, vecOrigin );
pRocket->pev->angles = vecAngles;
pRocket->Spawn();
pRocket->SetTouch( &CRpgRocket::RocketTouch );
pRocket->m_pLauncher = pLauncher;// remember what RPG fired me.
pRocket->m_pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
pRocket->pev->owner = pOwner->edict();
return pRocket;
}
//=========================================================
//=========================================================
void CRpgRocket :: Spawn( void )
{
Precache( );
// motor
pev->movetype = MOVETYPE_BOUNCE;
pev->solid = SOLID_BBOX;
SET_MODEL(ENT(pev), "models/rpgrocket.mdl");
UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0));
UTIL_SetOrigin( pev, pev->origin );
pev->classname = MAKE_STRING("rpg_rocket");
SetThink( &CRpgRocket::IgniteThink );
SetTouch( &CRpgRocket::ExplodeTouch );
pev->angles.x -= 30;
UTIL_MakeVectors( pev->angles );
pev->angles.x = -(pev->angles.x + 30);
pev->velocity = gpGlobals->v_forward * 250;
pev->gravity = 0.5;
pev->nextthink = gpGlobals->time + 0.4;
pev->dmg = gSkillData.plrDmgRPG;
}
//=========================================================
//=========================================================
void CRpgRocket :: RocketTouch ( CBaseEntity *pOther )
{
if ( m_pLauncher )
{
// my launcher is still around, tell it I'm dead.
m_pLauncher->m_cActiveRockets--;
}
STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );
ExplodeTouch( pOther );
}
//=========================================================
//=========================================================
void CRpgRocket :: Precache( void )
{
PRECACHE_MODEL("models/rpgrocket.mdl");
m_iTrail = PRECACHE_MODEL("sprites/smoke.spr");
PRECACHE_SOUND ("weapons/rocket1.wav");
}
void CRpgRocket :: IgniteThink( void )
{
// pev->movetype = MOVETYPE_TOSS;
pev->movetype = MOVETYPE_FLY;
pev->effects |= EF_LIGHT;
// make rocket sound
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5 );
// rocket trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMFOLLOW );
WRITE_SHORT(entindex()); // entity
WRITE_SHORT(m_iTrail ); // model
WRITE_BYTE( 40 ); // life
WRITE_BYTE( 5 ); // width
WRITE_BYTE( 224 ); // r, g, b
WRITE_BYTE( 224 ); // r, g, b
WRITE_BYTE( 255 ); // r, g, b
WRITE_BYTE( 255 ); // brightness
MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)
m_flIgniteTime = gpGlobals->time;
// set to follow laser spot
SetThink( &CRpgRocket::FollowThink );
pev->nextthink = gpGlobals->time + 0.1;
}
void CRpgRocket :: FollowThink( void )
{
CBaseEntity *pOther = NULL;
Vector vecTarget;
Vector vecDir;
float flDist, flMax, flDot;
TraceResult tr;
UTIL_MakeAimVectors( pev->angles );
vecTarget = gpGlobals->v_forward;
flMax = 4096;
// Examine all entities within a reasonable radius
while ((pOther = UTIL_FindEntityByClassname( pOther, "laser_spot" )) != NULL)
{
UTIL_TraceLine ( pev->origin, pOther->pev->origin, dont_ignore_monsters, ENT(pev), &tr );
// ALERT( at_console, "%f\n", tr.flFraction );
if (tr.flFraction >= 0.90)
{
vecDir = pOther->pev->origin - pev->origin;
flDist = vecDir.Length( );
vecDir = vecDir.Normalize( );
flDot = DotProduct( gpGlobals->v_forward, vecDir );
if ((flDot > 0) && (flDist * (1 - flDot) < flMax))
{
flMax = flDist * (1 - flDot);
vecTarget = vecDir;
}
}
}
pev->angles = UTIL_VecToAngles( vecTarget );
// this acceleration and turning math is totally wrong, but it seems to respond well so don't change it.
float flSpeed = pev->velocity.Length();
if (gpGlobals->time - m_flIgniteTime < 1.0)
{
pev->velocity = pev->velocity * 0.2 + vecTarget * (flSpeed * 0.8 + 400);
if (pev->waterlevel == 3)
{
// go slow underwater
if (pev->velocity.Length() > 300)
{
pev->velocity = pev->velocity.Normalize() * 300;
}
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 4 );
}
else
{
if (pev->velocity.Length() > 2000)
{
pev->velocity = pev->velocity.Normalize() * 2000;
}
}
}
else
{
if (pev->effects & EF_LIGHT)
{
pev->effects = 0;
STOP_SOUND( ENT(pev), CHAN_VOICE, "weapons/rocket1.wav" );
}
pev->velocity = pev->velocity * 0.2 + vecTarget * flSpeed * 0.798;
if (pev->waterlevel == 0 && pev->velocity.Length() < 1500)
{
Detonate( );
}
}
// ALERT( at_console, "%.0f\n", flSpeed );
pev->nextthink = gpGlobals->time + 0.1;
}
#endif
void CRpg::Reload( void )
{
int iResult;
if ( m_iClip == 1 )
{
// don't bother with any of this if don't need to reload.
return;
}
if ( m_pPlayer->ammo_rockets <= 0 )
return;
// because the RPG waits to autoreload when no missiles are active while the LTD is on, the
// weapons code is constantly calling into this function, but is often denied because
// a) missiles are in flight, but the LTD is on
// or
// b) player is totally out of ammo and has nothing to switch to, and should be allowed to
// shine the designator around
//
// Set the next attack time into the future so that WeaponIdle will get called more often
// than reload, allowing the RPG LTD to be updated
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
if ( m_cActiveRockets && m_fSpotActive )
{
// no reloading when there are active missiles tracking the designator.
// ward off future autoreload attempts by setting next attack time into the future for a bit.
return;
}
#ifndef CLIENT_DLL
if ( m_pSpot && m_fSpotActive )
{
m_pSpot->Suspend( 2.1 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.1;
}
#endif
if ( m_iClip == 0 )
iResult = DefaultReload( RPG_MAX_CLIP, RPG_RELOAD, 2 );
if ( iResult )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
void CRpg::Spawn( )
{
Precache( );
m_iId = WEAPON_RPG;
SET_MODEL(ENT(pev), "models/w_rpg.mdl");
m_fSpotActive = 1;
#ifdef CLIENT_DLL
if ( bIsMultiplayer() )
#else
if ( g_pGameRules->IsMultiplayer() )
#endif
{
// more default ammo in multiplay.
m_iDefaultAmmo = RPG_DEFAULT_GIVE * 2;
}
else
{
m_iDefaultAmmo = RPG_DEFAULT_GIVE;
}
FallInit();// get ready to fall down.
}
void CRpg::Precache( void )
{
PRECACHE_MODEL("models/w_rpg.mdl");
PRECACHE_MODEL("models/v_rpg.mdl");
PRECACHE_MODEL("models/p_rpg.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
UTIL_PrecacheOther( "laser_spot" );
UTIL_PrecacheOther( "rpg_rocket" );
PRECACHE_SOUND("weapons/rocketfire1.wav");
PRECACHE_SOUND("weapons/glauncher.wav"); // alternative fire sound
m_usRpg = PRECACHE_EVENT ( 1, "events/rpg.sc" );
}
int CRpg::GetItemInfo(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = "rockets";
p->iMaxAmmo1 = ROCKET_MAX_CARRY;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = RPG_MAX_CLIP;
p->iSlot = 3;
p->iPosition = 0;
p->iId = m_iId = WEAPON_RPG;
p->iFlags = 0;
p->iWeight = RPG_WEIGHT;
return 1;
}
int CRpg::AddToPlayer( CBasePlayer *pPlayer )
{
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId );
MESSAGE_END();
return TRUE;
}
return FALSE;
}
BOOL CRpg::Deploy( )
{
if ( m_iClip == 0 )
{
return DefaultDeploy( "models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW_UL, "rpg" );
}
return DefaultDeploy( "models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW1, "rpg" );
}
BOOL CRpg::CanHolster( void )
{
if ( m_fSpotActive && m_cActiveRockets )
{
// can't put away while guiding a missile.
return FALSE;
}
return TRUE;
}
void CRpg::Holster( int skiplocal /* = 0 */ )
{
m_fInReload = FALSE;// cancel any reload in progress.
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( RPG_HOLSTER1 );
#ifndef CLIENT_DLL
if (m_pSpot)
{
m_pSpot->Killed( NULL, GIB_NEVER );
m_pSpot = NULL;
}
#endif
}
void CRpg::PrimaryAttack()
{
if ( m_iClip )
{
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
#ifndef CLIENT_DLL
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
Vector vecSrc = m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -8;
CRpgRocket *pRocket = CRpgRocket::CreateRpgRocket( vecSrc, m_pPlayer->pev->v_angle, m_pPlayer, this );
UTIL_MakeVectors( m_pPlayer->pev->v_angle );// RpgRocket::Create stomps on globals, so remake.
pRocket->pev->velocity = pRocket->pev->velocity + gpGlobals->v_forward * DotProduct( m_pPlayer->pev->velocity, gpGlobals->v_forward );
#endif
// firing RPG no longer turns on the designator. ALT fire is a toggle switch for the LTD.
// Ken signed up for this as a global change (sjb)
int flags;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
#else
flags = 0;
#endif
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usRpg );
m_iClip--;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
}
else
{
PlayEmptySound( );
}
UpdateSpot( );
}
void CRpg::SecondaryAttack()
{
m_fSpotActive = ! m_fSpotActive;
#ifndef CLIENT_DLL
if (!m_fSpotActive && m_pSpot)
{
m_pSpot->Killed( NULL, GIB_NORMAL );
m_pSpot = NULL;
}
#endif
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2;
}
void CRpg::WeaponIdle( void )
{
UpdateSpot( );
ResetEmptySound( );
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
return;
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
{
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if (flRand <= 0.75 || m_fSpotActive)
{
if ( m_iClip == 0 )
iAnim = RPG_IDLE_UL;
else
iAnim = RPG_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 15.0;
}
else
{
if ( m_iClip == 0 )
iAnim = RPG_FIDGET_UL;
else
iAnim = RPG_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;
}
SendWeaponAnim( iAnim );
}
else
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1;
}
}
void CRpg::UpdateSpot( void )
{
#ifndef CLIENT_DLL
if (m_fSpotActive)
{
if (!m_pSpot)
{
m_pSpot = CLaserSpot::CreateSpot();
}
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
Vector vecSrc = m_pPlayer->GetGunPosition( );;
Vector vecAiming = gpGlobals->v_forward;
TraceResult tr;
UTIL_TraceLine ( vecSrc, vecSrc + vecAiming * 8192, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr );
UTIL_SetOrigin( m_pSpot->pev, tr.vecEndPos );
}
#endif
}
class CRpgAmmo : public CBasePlayerAmmo
{
void Spawn( void )
{
Precache( );
SET_MODEL(ENT(pev), "models/w_rpgammo.mdl");
CBasePlayerAmmo::Spawn( );
}
void Precache( void )
{
PRECACHE_MODEL ("models/w_rpgammo.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
BOOL AddAmmo( CBaseEntity *pOther )
{
int iGive;
#ifdef CLIENT_DLL
if ( bIsMultiplayer() )
#else
if ( g_pGameRules->IsMultiplayer() )
#endif
{
// hand out more ammo per rocket in multiplayer.
iGive = AMMO_RPGCLIP_GIVE * 2;
}
else
{
iGive = AMMO_RPGCLIP_GIVE;
}
if (pOther->GiveAmmo( iGive, "rockets", ROCKET_MAX_CARRY ) != -1)
{
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
return TRUE;
}
return FALSE;
}
};
LINK_ENTITY_TO_CLASS( ammo_rpgclip, CRpgAmmo );
#endif

View file

@ -326,7 +326,8 @@ void CHalfLifeTeamplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, e
{
if ( (pk != pVictim) && (PlayerRelationship( pVictim, pk ) == GR_TEAMMATE) )
{
NetMsg_DeathMsg( ENTINDEX(ENT(pKiller)), ENTINDEX(pVictim->edict()), string("teammate") );
string tmpstr("teammate");
NetMsg_DeathMsg( ENTINDEX(ENT(pKiller)), ENTINDEX(pVictim->edict()), tmpstr);
return;
}
}

View file

@ -12,22 +12,18 @@ ARCH=i386
CC=gcc
LD=gcc
CURL_SRCDIR=../curl/lib
LIBBASE=../../../libraries/current
DLL_SRCDIR=../dlls
GAME_SHARED_SRCDIR = ../game_shared
LUA_SRCDIR = ../lua/src
LUA_AUX_SRCDIR = ../lua/src/lib
MOD_SRCDIR = ../mod
PARTICLES_SRCDIR = ../particles
PM_SHARED_SRCDIR=../pm_shared
TEXT_SRCDIR = ../textrep
UTIL_SRCDIR = ../util
CURL_OBJDIR=$(CURL_SRCDIR)/obj
DLL_OBJDIR=$(DLL_SRCDIR)/obj
GAME_SHARED_OBJDIR=$(GAME_SHARED_SRCDIR)/obj
LUA_OBJDIR=$(LUA_SRCDIR)/obj
LUA_AUX_OBJDIR=$(LUA_AUX_SRCDIR)/obj
MOD_OBJDIR=$(MOD_SRCDIR)/obj
PARTICLES_OBJDIR=$(PARTICLES_SRCDIR)/obj
PM_SHARED_OBJDIR=$(PM_SHARED_SRCDIR)/obj
@ -38,15 +34,15 @@ OUTPUT_DIR=../../hlds_l/ns/dlls
BASE_CFLAGS=-Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DAVH_SERVER -DLINUX -DVALVE_DLL -DQUIVER -DVOXEL -DQUAKE2 -DDEDICATED -DSWDS -D_STLP_USE_GLIBC
#full optimization
CFLAGS=$(BASE_CFLAGS) -w -Wall -nostdinc++ -fPIC -mcpu=i486 -O3 -pipe -fno-for-scope -funroll-loops -fdelayed-branch -malign-loops=4 -malign-jumps=4 -malign-functions=4
CFLAGS=$(BASE_CFLAGS) -w -Wall -nostdinc++ -ffor-scope -fPIC -mcpu=i486 -O3 -pipe -funroll-loops -fdelayed-branch -malign-loops=4 -malign-jumps=4 -malign-functions=4
#use these when debugging
#CFLAGS=$(BASE_CFLAGS) -fPIC -fno-for-scope
# add base directory (CGC)
INCLUDEDIRS=-I../stlport/stlport -I. -I../curl/include -I../dlls -I../engine -I../common -I../mod -I../game_shared -I../lua/include -I../pm_shared -I.. -I/usr/include/c++/3.2/i386-redhat-linux -I/usr/include/c++/3.2 -I/usr/include/c++
LINKDIRS= -L../curl/lib/.libs -L../stlport/lib
INCLUDEDIRS=-I$(LIBBASE) -I. -I$(LIBBASE)/include -I$(LIBBASE)/include/stlport -I$(LIBBASE)/include/particle -I$(LIBBASE)/include/lua -I../dlls -I../engine -I../common -I../mod -I../game_shared -I../pm_shared -I.. -I/usr/include/c++/3.3/i486-linux -I/usr/include/c++/3.3 -I/usr/include/c++
LINKDIRS= -L$(LIBBASE)/release
SHLIBEXT=so
@ -54,8 +50,8 @@ LDPRELIBS= $(CFLAGS) -shared \
-Wl,-Map,ns_map.txt \
$(LINKDIRS)
LDPOSTLIBS= -Wl,-Bstatic -lcurl -lstlport_gcc -lstdc++ -lsupc++ \
-Wl,-Bdynamic -lm -lgcc -lgcc_eh -Wl,-Bstatic -lc
LDPOSTLIBS= -Wl,-Bstatic -lstlport_gcc -lstdc++ -lsupc++ -llua -llualib\
-Wl,-Bdynamic -lm -lgcc -lgcc_eh
# -lgcc -lgcc_eh -lelf
DO_CC=$(CC) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
@ -73,12 +69,6 @@ $(DLL_OBJDIR)/%.o: $(DLL_SRCDIR)/%.cpp
$(GAME_SHARED_OBJDIR)/%.o: $(GAME_SHARED_SRCDIR)/%.cpp
$(DO_CC)
$(LUA_OBJDIR)/%.o: $(LUA_SRCDIR)/%.c
$(DO_CC)
$(LUA_AUX_OBJDIR)/%.o: $(LUA_AUX_SRCDIR)/%.c
$(DO_CC)
$(MOD_OBJDIR)/%.o: $(MOD_SRCDIR)/%.cpp
$(DO_CC)
@ -127,7 +117,6 @@ OBJ = \
$(DLL_OBJDIR)/plane.o \
$(DLL_OBJDIR)/plats.o \
$(DLL_OBJDIR)/player.o \
$(DLL_OBJDIR)/rpg.o \
$(DLL_OBJDIR)/satchel.o \
$(DLL_OBJDIR)/shotgun.o \
$(DLL_OBJDIR)/singleplay_gamerules.o \
@ -146,32 +135,6 @@ OBJ = \
$(DLL_OBJDIR)/xen.o \
$(GAME_SHARED_OBJDIR)/voice_banmgr.o \
$(GAME_SHARED_OBJDIR)/voice_gamemgr.o \
$(LUA_OBJDIR)/lapi.o \
$(LUA_AUX_OBJDIR)/lauxlib.o \
$(LUA_AUX_OBJDIR)/lbaselib.o \
$(LUA_OBJDIR)/lcode.o \
$(LUA_AUX_OBJDIR)/ldblib.o \
$(LUA_OBJDIR)/ldebug.o \
$(LUA_OBJDIR)/ldo.o \
$(LUA_OBJDIR)/lfunc.o \
$(LUA_OBJDIR)/lgc.o \
$(LUA_AUX_OBJDIR)/liolib.o \
$(LUA_OBJDIR)/llex.o \
$(LUA_AUX_OBJDIR)/lmathlib.o \
$(LUA_OBJDIR)/lmem.o \
$(LUA_OBJDIR)/lobject.o \
$(LUA_OBJDIR)/lparser.o \
$(LUA_OBJDIR)/lstate.o \
$(LUA_OBJDIR)/lstring.o \
$(LUA_AUX_OBJDIR)/lstrlib.o \
$(LUA_OBJDIR)/ltable.o \
$(LUA_OBJDIR)/ltests.o \
$(LUA_OBJDIR)/ltm.o \
$(LUA_OBJDIR)/lundump.o \
$(LUA_OBJDIR)/lvm.o \
$(LUA_OBJDIR)/lzio.o \
$(LUA_OBJDIR)/lopcodes.o \
$(LUA_OBJDIR)/ldump.o \
$(PM_SHARED_OBJDIR)/pm_debug.o \
$(PM_SHARED_OBJDIR)/pm_math.o \
$(PM_SHARED_OBJDIR)/pm_shared.o \
@ -182,7 +145,6 @@ OBJ = \
$(MOD_OBJDIR)/AvHAlienTurret.o \
$(MOD_OBJDIR)/AvHAlienWeapon.o \
$(MOD_OBJDIR)/AvHAssert.o \
$(MOD_OBJDIR)/AvHBalance.o \
$(MOD_OBJDIR)/AvHBaseBuildable.o \
$(MOD_OBJDIR)/AvHBaseInfoLocation.o \
$(MOD_OBJDIR)/AvHBasePlayerWeapon.o \
@ -197,7 +159,6 @@ OBJ = \
$(MOD_OBJDIR)/AvHConsoleCommands.o \
$(MOD_OBJDIR)/AvHConstants.o \
$(MOD_OBJDIR)/AvHCombat.o \
$(MOD_OBJDIR)/AvHCurl.o \
$(MOD_OBJDIR)/AvHDevour.o \
$(MOD_OBJDIR)/AvHDivineWind.o \
$(MOD_OBJDIR)/AvHEntities.o \
@ -219,6 +180,7 @@ OBJ = \
$(MOD_OBJDIR)/AvHMine.o \
$(MOD_OBJDIR)/AvHMiniMap.o \
$(MOD_OBJDIR)/AvHMovementUtil.o \
$(MOD_OBJDIR)/AvHNetworkMessages.o \
$(MOD_OBJDIR)/AvHOrder.o \
$(MOD_OBJDIR)/AvHParasiteGun.o \
$(MOD_OBJDIR)/AvHParticleSystem.o \
@ -251,8 +213,9 @@ OBJ = \
$(MOD_OBJDIR)/AvHStomp.o \
$(MOD_OBJDIR)/AvHSwipe.o \
$(MOD_OBJDIR)/AvHTeam.o \
$(MOD_OBJDIR)/AvHTechNodes.o \
$(MOD_OBJDIR)/AvHTechNode.o \
$(MOD_OBJDIR)/AvHTurret.o \
$(MOD_OBJDIR)/AvHTechTree.o \
$(MOD_OBJDIR)/AvHUmbraGun.o \
$(MOD_OBJDIR)/AvHVisibleBlipList.o \
$(MOD_OBJDIR)/AvHVoiceHelper.o \
@ -266,12 +229,10 @@ OBJ = \
$(MOD_OBJDIR)/CollisionChecker.o \
$(MOD_OBJDIR)/CollisionChecker_ServerOnly.o \
$(MOD_OBJDIR)/NetworkMeter.o \
$(PARTICLES_OBJDIR)/action_api.o \
$(PARTICLES_OBJDIR)/actions.o \
$(PARTICLES_OBJDIR)/system.o \
$(TEXT_OBJDIR)/TRDescription.o \
$(TEXT_OBJDIR)/TRFactory.o \
$(UTIL_OBJDIR)/Checksum.o \
$(UTIL_OBJDIR)/Balance.o \
$(UTIL_OBJDIR)/LinuxSupport.o \
$(UTIL_OBJDIR)/Mat3.o \
$(UTIL_OBJDIR)/MathUtil.o \
@ -279,10 +240,13 @@ OBJ = \
$(UTIL_OBJDIR)/STLUtil.o \
$(UTIL_OBJDIR)/Tokenizer.o
# $(PARTICLES_OBJDIR)/action_api.o
# $(PARTICLES_OBJDIR)/actions.o
# $(PARTICLES_OBJDIR)/system.o
$(DLLNAME)_$(ARCH).$(SHLIBEXT) : neat $(OBJ)
$(LD) $(LDPRELIBS) -o $@ $(OBJ) $(LDPOSTLIBS)
cp $(DLLNAME)_$(ARCH).$(SHLIBEXT) /usr/steam/hlds_l/ns/dlls/
release: $(DLLNAME)_$(ARCH).$(SHLIBEXT)
release: $(DLLNAME)_$(ARCH).$(SHLIBEXT)
strip $(DLLNAME)_$(ARCH).$(SHLIBEXT)
zip $(DLLNAME)_$(ARCH).zip $(DLLNAME)_$(ARCH).$(SHLIBEXT)
curl:
@ -291,8 +255,6 @@ neat:
-mkdir $(CURL_OBJDIR)
-mkdir $(DLL_OBJDIR)
-mkdir $(GAME_SHARED_OBJDIR)
-mkdir $(LUA_OBJDIR)
-mkdir $(LUA_AUX_OBJDIR)
-mkdir $(MOD_OBJDIR)
-mkdir $(PARTICLES_OBJDIR)
-mkdir $(PM_SHARED_OBJDIR)
@ -306,8 +268,6 @@ spotless: clean
-rm -r $(CURL_OBJDIR)
-rm -r $(DLL_OBJDIR)
-rm -r $(GAME_SHARED_OBJDIR)
-rm -r $(LUA_OBJDIR)
-rm -r $(LUA_AUX_OBJDIR)
-rm -r $(MOD_OBJDIR)
-rm -r $(PARTICLES_OBJDIR)
-rm -r $(PM_SHARED_OBJDIR)

View file

@ -235,7 +235,7 @@ void AvHBaseBuildable::ConstructUse( CBaseEntity *pActivator, CBaseEntity *pCall
const float kDefaultInterval = .1f;
float theTimeOfLastConstructUse = thePlayer->GetTimeOfLastConstructUse();
float theInterval = min(max(gpGlobals->time - theTimeOfLastConstructUse, 0), kDefaultInterval);
float theInterval = min(max(gpGlobals->time - theTimeOfLastConstructUse, 0.0f), kDefaultInterval);
thePercentage += (theInterval/(float)theBuildTime);
thePlayer->SetTimeOfLastConstructUse(gpGlobals->time);
@ -474,7 +474,7 @@ void AvHBaseBuildable::SetNormalizedBuildPercentage(float inPercentage, bool inF
if(theDiff > 0)
{
this->pev->health += theDiff*(1.0f - kBaseHealthPercentage)*this->mBaseHealth;
this->pev->health = min(max(0.0f, this->pev->health), this->mBaseHealth);
this->pev->health = min(max(0.0f, this->pev->health), (float)this->mBaseHealth);
}
else
{

View file

@ -1211,17 +1211,17 @@ void TriggerPresence::KeyValue(KeyValueData* pkvd)
}
else if(FStrEq(pkvd->szKeyName, "timebeforeleave"))
{
this->mTimeBeforeLeave = max(atof(pkvd->szValue), 0.0f);
this->mTimeBeforeLeave = fmax(atof(pkvd->szValue), 0.0f);
pkvd->fHandled = TRUE;
}
else if(FStrEq(pkvd->szKeyName, "momentaryopentime"))
{
this->mMomentaryOpenTime = max(atof(pkvd->szValue), 0.01f);
this->mMomentaryOpenTime = fmax(atof(pkvd->szValue), 0.01f);
pkvd->fHandled = TRUE;
}
else if(FStrEq(pkvd->szKeyName, "momentaryclosetime"))
{
this->mMomentaryCloseTime = max(atof(pkvd->szValue), 0.01f);
this->mMomentaryCloseTime = fmax(atof(pkvd->szValue), 0.01f);
pkvd->fHandled = TRUE;
}
else if(FStrEq(pkvd->szKeyName, "spawnflags"))

View file

@ -1011,7 +1011,7 @@ bool AvHGamerules::GetCanJoinTeamInFuture(AvHPlayer* inPlayer, AvHTeamNumber inT
theWouldBeNumPlayersOnOtherTeam--;
}
int theDiscrepancyAllowed = max(1, avh_limitteams.value);
int theDiscrepancyAllowed = max(1.0f, avh_limitteams.value);
if(((theWouldBeNumPlayersOnTeam - theWouldBeNumPlayersOnOtherTeam) <= theDiscrepancyAllowed) || this->GetIsTournamentMode() || this->GetCheatsEnabled())
{
// tankefugl: 0000953
@ -2271,7 +2271,7 @@ int AvHGamerules::GetVotesNeededForMapChange() const
if(theMapVoteRatio > 0)
{
theMapVoteRatio = min(max(0.0f, theMapVoteRatio), 1.0f);
theNumVotes = max(theMapVoteRatio*this->GetNumberOfPlayers(), 1);
theNumVotes = max(theMapVoteRatio*this->GetNumberOfPlayers(), 1.0f);
}
return theNumVotes;

View file

@ -407,7 +407,7 @@ void AvHHive::ProcessHealing()
float theHiveRegenAmount = BALANCE_VAR(kHiveRegenerationAmount);
float theCombatModeScalar = /*GetGameRules()->GetIsCombatMode() ? (1.0f/BALANCE_VAR(kCombatModeTimeScalar)) :*/ 1.0f;
this->pev->health = min(this->mMaxHitPoints, this->pev->health + theHiveRegenAmount*theCombatModeScalar);
this->pev->health = min((float)this->mMaxHitPoints, this->pev->health + theHiveRegenAmount*theCombatModeScalar);
theDidHeal = true;
}

View file

@ -1714,7 +1714,7 @@ float AvHInfantryPortal::GetReinforceTime() const
theReinforceTime = 2;
}
theReinforceTime = max(0, theReinforceTime);
theReinforceTime = max(0.0f, theReinforceTime);
return theReinforceTime;
}

View file

@ -148,7 +148,8 @@ bool AvHMiniMap::Process()
uint8 theSampleArray[kNumPixelsPerCall];
memset(theSampleArray, 0, kNumPixelsPerCall);
for(int i = 0; (i < kNumPixelsPerCall) && (this->mNumSamplesProcessed < this->mNumSamplesToProcess); i++)
int i=0;
for(i = 0; (i < kNumPixelsPerCall) && (this->mNumSamplesProcessed < this->mNumSamplesToProcess); i++)
{
int theSampleIndex = this->mNumSamplesProcessed;
int theX = theSampleIndex % this->mMapWidth;

View file

@ -32,8 +32,8 @@
#include "AvHTechSlotManager.h"
#include "AvHVisibleBlipList.h"
#include "AvHEntityHierarchy.h"
#include "..\engine\shake.h"
#include "..\common\weaponinfo.h"
#include "../engine/shake.h"
#include "../common/weaponinfo.h"
//FUNCTION PROTOTYPES
#ifdef AVH_SERVER

View file

@ -3401,7 +3401,7 @@ void AvHPlayer::InitializeFromTeam(float inHealthPercentage, float inArmorPercen
{
// Set base health and armor
int theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(this->pev->iuser4, (AvHUser3)this->pev->iuser3, this->GetExperienceLevel());
this->pev->health = this->pev->max_health = max(theMaxHealth*inHealthPercentage,1);//voogru: prevent bug with players evolving down from higher lifeform from getting negative health but still "alive"
this->pev->health = this->pev->max_health = max(theMaxHealth*inHealthPercentage,1.0f);//voogru: prevent bug with players evolving down from higher lifeform from getting negative health but still "alive"
this->pev->armorvalue = AvHPlayerUpgrade::GetMaxArmorLevel(this->pev->iuser4, (AvHUser3)this->pev->iuser3)*inArmorPercentage;
@ -4842,10 +4842,10 @@ void AvHPlayer::RevertHealthArmorPercentages()
{
// Preserve armor and health percentages
int theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(this->pev->iuser4, (AvHUser3)this->pev->iuser3, this->GetExperienceLevel());
this->pev->health = max(this->mHealthPercentBefore*theMaxHealth,1);//voogru: prevent bug with players evolving down from higher lifeform from getting negative health but still "alive"
this->pev->health = max(this->mHealthPercentBefore*theMaxHealth,1.0f);//voogru: prevent bug with players evolving down from higher lifeform from getting negative health but still "alive"
int theMaxArmor = AvHPlayerUpgrade::GetMaxArmorLevel(this->pev->iuser4, (AvHUser3)this->pev->iuser3);
this->pev->armorvalue = max(this->mArmorPercentBefore*theMaxArmor, 0);
this->pev->armorvalue = max(this->mArmorPercentBefore*theMaxArmor, 0.0f);
// Assumes a push/pop kind of deal
this->mHealthPercentBefore = this->mArmorPercentBefore = 1.0f;
@ -4855,11 +4855,11 @@ void AvHPlayer::SaveHealthArmorPercentages()
{
int theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(this->pev->iuser4, (AvHUser3)this->pev->iuser3, this->GetExperienceLevel());
this->mHealthPercentBefore = this->pev->health/(float)theMaxHealth;
this->mHealthPercentBefore = min(max(0, this->mHealthPercentBefore), 1);
this->mHealthPercentBefore = min(max(0.0f, this->mHealthPercentBefore), 1.0f);
int theMaxArmor = AvHPlayerUpgrade::GetMaxArmorLevel(this->pev->iuser4, (AvHUser3)this->pev->iuser3);
this->mArmorPercentBefore = this->pev->armorvalue/(float)theMaxArmor;
this->mArmorPercentBefore = min(max(0, this->mArmorPercentBefore), 1);
this->mArmorPercentBefore = min(max(0.0f, this->mArmorPercentBefore), 1.0f);
}
void AvHPlayer::ProcessResourceAdjustment(AvHMessageID inMessageID)
@ -5094,7 +5094,7 @@ void AvHPlayer::Research(AvHMessageID inUpgrade, int inEntityIndex)
ASSERT(thePercentageComplete < 1.0f);
const float kRefundFactor = 1.0f;
float theRefund = kRefundFactor*(1.0f - thePercentageComplete)*theResearchCost;
theRefund = min(theRefund, theResearchCost);
theRefund = min(theRefund, (float)theResearchCost);
this->SetResources(this->GetResources() + theRefund);
}
@ -6332,9 +6332,9 @@ void AvHPlayer::InternalCommonThink()
// Players keep their health in fuser2
int theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(this->pev->iuser4, (AvHUser3)this->pev->iuser3, this->GetExperienceLevel());
int theCurrentHealth = max(0, this->pev->health);
int theCurrentHealth = max(0.0f, this->pev->health);
int theMaxArmor = AvHPlayerUpgrade::GetMaxArmorLevel(this->pev->iuser4, (AvHUser3)this->pev->iuser3);
int theCurrentArmor = max(0, this->pev->armorvalue);
int theCurrentArmor = max(0.0f, this->pev->armorvalue);
// Draw ring to take into account health and armor for aliens, just health for marines (so gorge and comm know when to heal)
float theScalar = (float)theCurrentHealth/theMaxHealth;
@ -6456,7 +6456,7 @@ void AvHPlayer::InternalMarineThink()
int theMaxArmor = AvHPlayerUpgrade::GetMaxArmorLevel(this->pev->iuser4, (AvHUser3)this->pev->iuser3);
if(this->pev->armorvalue < theMaxArmor)
{
this->pev->armorvalue = min(theMaxArmor, this->pev->armorvalue + kPowerRegenRate*theTimePassed);
this->pev->armorvalue = min((float)theMaxArmor, this->pev->armorvalue + kPowerRegenRate*theTimePassed);
}
}
}
@ -8234,12 +8234,12 @@ bool AvHPlayer::Heal(float inAmount, bool inPlaySound)
{
int theAmountToGive = theAmount;
theAmount -= (theMaxHealth - this->pev->health); //store relative amount compared to that necessary for complete heal
this->pev->health = min(theMaxHealth, this->pev->health + theAmountToGive);
this->pev->health = min((float)theMaxHealth, this->pev->health + theAmountToGive);
theDidHeal = true;
}
else if(this->pev->armorvalue < theMaxArmor)
{
this->pev->armorvalue = min(theMaxArmor, this->pev->armorvalue + theAmount);
this->pev->armorvalue = min((float)theMaxArmor, this->pev->armorvalue + theAmount);
theDidHeal = true;
}

View file

@ -1086,7 +1086,7 @@ void AvHSUKnockPlayerAbout(CBaseEntity* inAttcker, CBaseEntity* inVictim, int in
inVictim->pev->punchangle.z = -18;
inVictim->pev->punchangle.x = 5;
inVictim->pev->velocity = VecDir * max(0, 120 - VecDir.Length() ) * inForce/75;
inVictim->pev->velocity = VecDir * max(0.0f, 120 - VecDir.Length() ) * inForce/75;
}
}
@ -1441,7 +1441,7 @@ void AvHSUExplosiveForce(const Vector& inOrigin, int inRadius, float inForceScal
float theForceScalar = inForceScalar;
float theDistanceToExplosion = theForceVector.Length();
theDistanceToExplosion = min(max(theDistanceToExplosion, 0), inRadius);
theDistanceToExplosion = min(max(theDistanceToExplosion, 0.0f), (float)inRadius);
float thePercentForce = (1.0f - (theDistanceToExplosion/(float)inRadius));
theForceScalar *= thePercentForce;

View file

@ -11,7 +11,7 @@ const int kHiveInfoStatusBuildingStage5 = 5;
const int kHiveInfoStatusBuilt = 6;
const int kHiveInfoStatusUnderAttack = 7;
#define CHECK_EQUAL(x) (this->##x == inHiveInfo.##x)
#define CHECK_EQUAL(x) (this->x == inHiveInfo.x )
class AvHHiveInfo
{
public:

View file

@ -874,7 +874,7 @@ void AvHTeam::ResetGame()
this->mFunSoundsPlayed.clear();
this->mPlayedSeeDeadPeople = false;
int theEasterEggChance = max(0, avh_eastereggchance.value);
int theEasterEggChance = max(0.0f, avh_eastereggchance.value);
this->mPlayFunSoundsThisGame = (RANDOM_LONG(0, theEasterEggChance) == 0);
// Don't give hints right away
@ -1769,7 +1769,7 @@ void AvHTeam::UpdateVoting()
// If we have enough votes to kick commander
float theVotePercent = avh_votepercentneeded.value;
int theMinVotesRequired = (int)avh_minvotesneeded.value;
int theVotesNeeded = max(theMinVotesRequired, this->mPlayerList.size()*theVotePercent);
int theVotesNeeded = max((float)theMinVotesRequired, this->mPlayerList.size()*theVotePercent);
// #545: If the voting has changed, indicate so in the HUD
if ((this->mVotesNeeded != theVotesNeeded) || (this->mVotes != this->mPreviousVotes)) {

View file

@ -15,7 +15,7 @@
#include "mod/AvHTechNode.h"
//for use in operator==
#define CHECK_EQUAL(x) (this->##x == other.##x)
#define CHECK_EQUAL(x) (this->x == other.x)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// AvHTechNode

View file

@ -234,7 +234,7 @@ void AvHVisibleBlipList::VidInit()
}
#endif
#define CHECK_EQUAL(x) (this->##x == inList.##x)
#define CHECK_EQUAL(x) (this->x == inList.x)
bool AvHVisibleBlipList::operator==(const AvHVisibleBlipList& inList)
{
bool theAreEqual = CHECK_EQUAL(mNumBlips);