2016-06-04 15:24:23 +02:00
/***
*
* Copyright ( c ) 1996 - 2002 , 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 .
*
* This source code contains proprietary and confidential information of
* Valve LLC and its suppliers . Access to this code is restricted to
* persons who have executed a written SDK license with Valve . Any access ,
* use or distribution of this code by or to any unlicensed person is illegal .
*
* * * */
//=========================================================
// barnacle - stationary ceiling mounted 'fishing' monster
//=========================================================
# include "extdll.h"
# include "util.h"
# include "cbase.h"
# include "monsters.h"
# include "schedule.h"
# define BARNACLE_BODY_HEIGHT 44 // how 'tall' the barnacle's model is.
# define BARNACLE_PULL_SPEED 8
# define BARNACLE_KILL_VICTIM_DELAY 5 // how many seconds after pulling prey in to gib them.
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
# define BARNACLE_AE_PUKEGIB 2
class CBarnacle : public CBaseMonster
{
public :
void Spawn ( void ) ;
void Precache ( void ) ;
2016-07-31 15:48:50 +02:00
CBaseEntity * TongueTouchEnt ( float * pflLength ) ;
int Classify ( void ) ;
2016-06-04 15:24:23 +02:00
void HandleAnimEvent ( MonsterEvent_t * pEvent ) ;
2016-07-31 15:48:50 +02:00
void EXPORT BarnacleThink ( void ) ;
void EXPORT WaitTillDead ( void ) ;
2016-06-04 15:24:23 +02:00
void Killed ( entvars_t * pevAttacker , int iGib ) ;
int TakeDamage ( entvars_t * pevInflictor , entvars_t * pevAttacker , float flDamage , int bitsDamageType ) ;
2016-07-31 15:48:50 +02:00
virtual int Save ( CSave & save ) ;
virtual int Restore ( CRestore & restore ) ;
static TYPEDESCRIPTION m_SaveData [ ] ;
2016-06-04 15:24:23 +02:00
float m_flAltitude ;
float m_flCachedLength ; // tongue cached length
float m_flKillVictimTime ;
2016-07-31 15:48:50 +02:00
int m_cGibs ; // barnacle loads up on gibs each time it kills something.
BOOL m_fTongueExtended ;
BOOL m_fLiftingPrey ;
2016-06-04 15:24:23 +02:00
float m_flTongueAdj ;
// FIXME: need a custom barnacle model with non-generic hitgroup
// otherwise we can apply to damage to tongue instead of body
2021-06-07 02:05:58 +02:00
# if BARNACLE_FIX_VISIBILITY
2016-06-04 15:24:23 +02:00
void SetObjectCollisionBox ( void )
{
2019-10-13 13:49:25 +02:00
pev - > absmin = pev - > origin + Vector ( - 16.0f , - 16.0f , - m_flCachedLength ) ;
pev - > absmax = pev - > origin + Vector ( 16.0f , 16.0f , 0.0f ) ;
2016-06-04 15:24:23 +02:00
}
# endif
} ;
2016-06-25 18:33:39 +02:00
LINK_ENTITY_TO_CLASS ( monster_barnacle , CBarnacle )
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
TYPEDESCRIPTION CBarnacle : : m_SaveData [ ] =
2016-06-04 15:24:23 +02:00
{
DEFINE_FIELD ( CBarnacle , m_flAltitude , FIELD_FLOAT ) ,
DEFINE_FIELD ( CBarnacle , m_flKillVictimTime , FIELD_TIME ) ,
DEFINE_FIELD ( CBarnacle , m_cGibs , FIELD_INTEGER ) , // barnacle loads up on gibs each time it kills something.
DEFINE_FIELD ( CBarnacle , m_fTongueExtended , FIELD_BOOLEAN ) ,
DEFINE_FIELD ( CBarnacle , m_fLiftingPrey , FIELD_BOOLEAN ) ,
DEFINE_FIELD ( CBarnacle , m_flTongueAdj , FIELD_FLOAT ) ,
DEFINE_FIELD ( CBarnacle , m_flCachedLength , FIELD_FLOAT ) ,
} ;
2016-06-25 18:33:39 +02:00
IMPLEMENT_SAVERESTORE ( CBarnacle , CBaseMonster )
2016-06-04 15:24:23 +02:00
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
2016-07-31 15:48:50 +02:00
int CBarnacle : : Classify ( void )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
return CLASS_ALIEN_MONSTER ;
2016-06-04 15:24:23 +02:00
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//
// Returns number of events handled, 0 if none.
//=========================================================
2016-07-31 15:48:50 +02:00
void CBarnacle : : HandleAnimEvent ( MonsterEvent_t * pEvent )
2016-06-04 15:24:23 +02:00
{
switch ( pEvent - > event )
{
case BARNACLE_AE_PUKEGIB :
CGib : : SpawnRandomGibs ( pev , 1 , 1 ) ;
break ;
default :
CBaseMonster : : HandleAnimEvent ( pEvent ) ;
break ;
}
}
//=========================================================
// Spawn
//=========================================================
2016-07-31 15:48:50 +02:00
void CBarnacle : : Spawn ( )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
Precache ( ) ;
SET_MODEL ( ENT ( pev ) , " models/barnacle.mdl " ) ;
2019-10-13 13:49:25 +02:00
UTIL_SetSize ( pev , Vector ( - 16.0f , - 16.0f , - 32.0f ) , Vector ( 16.0f , 16.0f , 0.0f ) ) ;
2016-07-31 15:48:50 +02:00
pev - > solid = SOLID_SLIDEBOX ;
pev - > movetype = MOVETYPE_NONE ;
pev - > takedamage = DAMAGE_AIM ;
m_bloodColor = BLOOD_COLOR_RED ;
pev - > effects = EF_INVLIGHT ; // take light from the ceiling
pev - > health = 25 ;
2019-10-13 13:49:25 +02:00
m_flFieldOfView = 0.5f ; // indicates the width of this monster's forward view cone ( as a dotproduct result )
2016-07-31 15:48:50 +02:00
m_MonsterState = MONSTERSTATE_NONE ;
2019-10-13 13:49:25 +02:00
m_flKillVictimTime = 0.0f ;
m_flCachedLength = 32.0f ; // mins.z
2016-07-31 15:48:50 +02:00
m_cGibs = 0 ;
m_fLiftingPrey = FALSE ;
2019-10-13 13:49:25 +02:00
m_flTongueAdj = - 100.0f ;
2016-06-04 15:24:23 +02:00
InitBoneControllers ( ) ;
2016-07-31 15:48:50 +02:00
SetActivity ( ACT_IDLE ) ;
2016-06-04 15:24:23 +02:00
SetThink ( & CBarnacle : : BarnacleThink ) ;
2019-10-13 13:49:25 +02:00
pev - > nextthink = gpGlobals - > time + 0.5f ;
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
UTIL_SetOrigin ( pev , pev - > origin ) ;
2016-06-04 15:24:23 +02:00
}
int CBarnacle : : TakeDamage ( entvars_t * pevInflictor , entvars_t * pevAttacker , float flDamage , int bitsDamageType )
{
2016-07-31 15:48:50 +02:00
if ( bitsDamageType & DMG_CLUB )
2016-06-04 15:24:23 +02:00
{
flDamage = pev - > health ;
}
return CBaseMonster : : TakeDamage ( pevInflictor , pevAttacker , flDamage , bitsDamageType ) ;
}
//=========================================================
//=========================================================
2016-07-31 15:48:50 +02:00
void CBarnacle : : BarnacleThink ( void )
2016-06-04 15:24:23 +02:00
{
CBaseEntity * pTouchEnt ;
CBaseMonster * pVictim ;
float flLength ;
2021-06-07 02:05:58 +02:00
# if BARNACLE_FIX_VISIBILITY
2016-07-31 15:48:50 +02:00
if ( m_flCachedLength ! = ( m_flAltitude + m_flTongueAdj ) | | ( pev - > absmin . z ! = pev - > origin . z + - m_flCachedLength ) )
2016-06-04 15:24:23 +02:00
{
// recalc collision box here to avoid barnacle disappears bug
2016-07-31 15:48:50 +02:00
m_flCachedLength = m_flAltitude + m_flTongueAdj ;
2016-06-04 15:24:23 +02:00
UTIL_SetOrigin ( pev , pev - > origin ) ;
}
# endif
2019-10-13 13:49:25 +02:00
pev - > nextthink = gpGlobals - > time + 0.1f ;
2016-06-04 15:24:23 +02:00
2017-06-29 15:56:03 +02:00
if ( m_hEnemy ! = 0 )
2016-06-04 15:24:23 +02:00
{
2016-06-25 18:33:39 +02:00
// barnacle has prey.
2016-07-31 15:48:50 +02:00
if ( ! m_hEnemy - > IsAlive ( ) )
2016-06-04 15:24:23 +02:00
{
// someone (maybe even the barnacle) killed the prey. Reset barnacle.
m_fLiftingPrey = FALSE ; // indicate that we're not lifting prey.
m_hEnemy = NULL ;
return ;
}
2016-07-31 15:48:50 +02:00
if ( m_fLiftingPrey )
2016-06-04 15:24:23 +02:00
{
2017-06-29 15:56:03 +02:00
if ( m_hEnemy ! = 0 & & m_hEnemy - > pev - > deadflag ! = DEAD_NO )
2016-06-04 15:24:23 +02:00
{
// crap, someone killed the prey on the way up.
m_hEnemy = NULL ;
m_fLiftingPrey = FALSE ;
return ;
}
2016-06-25 18:33:39 +02:00
// still pulling prey.
2016-06-04 15:24:23 +02:00
Vector vecNewEnemyOrigin = m_hEnemy - > pev - > origin ;
vecNewEnemyOrigin . x = pev - > origin . x ;
vecNewEnemyOrigin . y = pev - > origin . y ;
// guess as to where their neck is
2019-10-13 13:49:25 +02:00
vecNewEnemyOrigin . x - = 6.0f * cos ( m_hEnemy - > pev - > angles . y * M_PI_F / 180.0f ) ;
vecNewEnemyOrigin . y - = 6.0f * sin ( m_hEnemy - > pev - > angles . y * M_PI_F / 180.0f ) ;
2016-06-04 15:24:23 +02:00
m_flAltitude - = BARNACLE_PULL_SPEED ;
vecNewEnemyOrigin . z + = BARNACLE_PULL_SPEED ;
2016-07-31 15:48:50 +02:00
if ( fabs ( pev - > origin . z - ( vecNewEnemyOrigin . z + m_hEnemy - > pev - > view_ofs . z - 8 ) ) < BARNACLE_BODY_HEIGHT )
2016-06-04 15:24:23 +02:00
{
2016-06-25 18:33:39 +02:00
// prey has just been lifted into position ( if the victim origin + eye height + 8 is higher than the bottom of the barnacle, it is assumed that the head is within barnacle's body )
2016-06-04 15:24:23 +02:00
m_fLiftingPrey = FALSE ;
2016-07-31 15:48:50 +02:00
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_bite3.wav " , 1 , ATTN_NORM ) ;
2016-06-04 15:24:23 +02:00
pVictim = m_hEnemy - > MyMonsterPointer ( ) ;
2019-10-13 13:49:25 +02:00
m_flKillVictimTime = gpGlobals - > time + 10.0f ; // now that the victim is in place, the killing bite will be administered in 10 seconds.
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
if ( pVictim )
2016-06-04 15:24:23 +02:00
{
pVictim - > BarnacleVictimBitten ( pev ) ;
2016-07-31 15:48:50 +02:00
SetActivity ( ACT_EAT ) ;
2016-06-04 15:24:23 +02:00
}
}
2016-07-31 15:48:50 +02:00
UTIL_SetOrigin ( m_hEnemy - > pev , vecNewEnemyOrigin ) ;
2016-06-04 15:24:23 +02:00
}
else
{
2016-06-25 18:33:39 +02:00
// prey is lifted fully into feeding position and is dangling there.
2016-06-04 15:24:23 +02:00
pVictim = m_hEnemy - > MyMonsterPointer ( ) ;
2019-10-13 13:49:25 +02:00
if ( m_flKillVictimTime ! = - 1.0f & & gpGlobals - > time > m_flKillVictimTime )
2016-06-04 15:24:23 +02:00
{
// kill!
2016-07-31 15:48:50 +02:00
if ( pVictim )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
pVictim - > TakeDamage ( pev , pev , pVictim - > pev - > health , DMG_SLASH | DMG_ALWAYSGIB ) ;
2016-06-04 15:24:23 +02:00
m_cGibs = 3 ;
}
return ;
}
// bite prey every once in a while
2016-07-31 15:48:50 +02:00
if ( pVictim & & ( RANDOM_LONG ( 0 , 49 ) = = 0 ) )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
switch ( RANDOM_LONG ( 0 , 2 ) )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
case 0 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_chew1.wav " , 1 , ATTN_NORM ) ;
break ;
case 1 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_chew2.wav " , 1 , ATTN_NORM ) ;
break ;
case 2 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_chew3.wav " , 1 , ATTN_NORM ) ;
break ;
2016-06-04 15:24:23 +02:00
}
pVictim - > BarnacleVictimBitten ( pev ) ;
}
}
}
else
{
2016-06-25 18:33:39 +02:00
// barnacle has no prey right now, so just idle and check to see if anything is touching the tongue.
2016-06-04 15:24:23 +02:00
// If idle and no nearby client, don't think so often
2016-07-31 15:48:50 +02:00
if ( FNullEnt ( FIND_CLIENT_IN_PVS ( edict ( ) ) ) )
2019-10-13 13:49:25 +02:00
pev - > nextthink = gpGlobals - > time + RANDOM_FLOAT ( 1.0f , 1.5f ) ; // Stagger a bit to keep barnacles from thinking on the same frame
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
if ( m_fSequenceFinished )
2016-06-25 18:33:39 +02:00
{
// this is done so barnacle will fidget.
2016-06-04 15:24:23 +02:00
SetActivity ( ACT_IDLE ) ;
m_flTongueAdj = - 100 ;
}
2016-07-31 15:48:50 +02:00
if ( m_cGibs & & RANDOM_LONG ( 0 , 99 ) = = 1 )
2016-06-04 15:24:23 +02:00
{
// cough up a gib.
CGib : : SpawnRandomGibs ( pev , 1 , 1 ) ;
m_cGibs - - ;
2016-07-31 15:48:50 +02:00
switch ( RANDOM_LONG ( 0 , 2 ) )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
case 0 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_chew1.wav " , 1 , ATTN_NORM ) ;
break ;
case 1 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_chew2.wav " , 1 , ATTN_NORM ) ;
break ;
case 2 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_chew3.wav " , 1 , ATTN_NORM ) ;
break ;
2016-06-04 15:24:23 +02:00
}
}
pTouchEnt = TongueTouchEnt ( & flLength ) ;
2016-07-31 15:48:50 +02:00
if ( pTouchEnt ! = NULL & & m_fTongueExtended )
2016-06-04 15:24:23 +02:00
{
// tongue is fully extended, and is touching someone.
2016-07-31 15:48:50 +02:00
if ( pTouchEnt - > FBecomeProne ( ) )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_alert2.wav " , 1 , ATTN_NORM ) ;
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
SetSequenceByName ( " attack1 " ) ;
2019-10-13 13:49:25 +02:00
m_flTongueAdj = - 20.0f ;
2016-06-04 15:24:23 +02:00
m_hEnemy = pTouchEnt ;
pTouchEnt - > pev - > movetype = MOVETYPE_FLY ;
pTouchEnt - > pev - > velocity = g_vecZero ;
pTouchEnt - > pev - > basevelocity = g_vecZero ;
pTouchEnt - > pev - > origin . x = pev - > origin . x ;
pTouchEnt - > pev - > origin . y = pev - > origin . y ;
m_fLiftingPrey = TRUE ; // indicate that we should be lifting prey.
m_flKillVictimTime = - 1 ; // set this to a bogus time while the victim is lifted.
2016-07-31 15:48:50 +02:00
m_flAltitude = pev - > origin . z - pTouchEnt - > EyePosition ( ) . z ;
2016-06-04 15:24:23 +02:00
}
}
else
{
// calculate a new length for the tongue to be clear of anything else that moves under it.
2016-07-31 15:48:50 +02:00
if ( m_flAltitude < flLength )
2016-06-04 15:24:23 +02:00
{
// if tongue is higher than is should be, lower it kind of slowly.
m_flAltitude + = BARNACLE_PULL_SPEED ;
m_fTongueExtended = FALSE ;
}
else
{
m_flAltitude = flLength ;
m_fTongueExtended = TRUE ;
}
}
}
// ALERT( at_console, "tounge %f\n", m_flAltitude + m_flTongueAdj );
2016-07-31 15:48:50 +02:00
SetBoneController ( 0 , - ( m_flAltitude + m_flTongueAdj ) ) ;
2019-10-13 13:49:25 +02:00
StudioFrameAdvance ( 0.1f ) ;
2016-06-04 15:24:23 +02:00
}
//=========================================================
// Killed.
//=========================================================
2016-07-31 15:48:50 +02:00
void CBarnacle : : Killed ( entvars_t * pevAttacker , int iGib )
2016-06-04 15:24:23 +02:00
{
CBaseMonster * pVictim ;
pev - > solid = SOLID_NOT ;
pev - > takedamage = DAMAGE_NO ;
2017-06-29 15:56:03 +02:00
if ( m_hEnemy ! = 0 )
2016-06-04 15:24:23 +02:00
{
pVictim = m_hEnemy - > MyMonsterPointer ( ) ;
2016-07-31 15:48:50 +02:00
if ( pVictim )
2016-06-04 15:24:23 +02:00
{
pVictim - > BarnacleVictimReleased ( ) ;
}
}
2016-07-31 15:48:50 +02:00
//CGib::SpawnRandomGibs( pev, 4, 1 );
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
switch ( RANDOM_LONG ( 0 , 1 ) )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
case 0 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_die1.wav " , 1 , ATTN_NORM ) ;
break ;
case 1 :
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " barnacle/bcl_die3.wav " , 1 , ATTN_NORM ) ;
break ;
2016-06-04 15:24:23 +02:00
}
2016-07-31 15:48:50 +02:00
SetActivity ( ACT_DIESIMPLE ) ;
2016-06-04 15:24:23 +02:00
SetBoneController ( 0 , 0 ) ;
2019-10-13 13:49:25 +02:00
StudioFrameAdvance ( 0.1f ) ;
2016-06-04 15:24:23 +02:00
2019-10-13 13:49:25 +02:00
pev - > nextthink = gpGlobals - > time + 0.1f ;
2016-06-04 15:24:23 +02:00
SetThink ( & CBarnacle : : WaitTillDead ) ;
}
//=========================================================
//=========================================================
2016-07-31 15:48:50 +02:00
void CBarnacle : : WaitTillDead ( void )
2016-06-04 15:24:23 +02:00
{
2019-10-13 13:49:25 +02:00
pev - > nextthink = gpGlobals - > time + 0.1f ;
2016-06-04 15:24:23 +02:00
2019-10-13 13:49:25 +02:00
float flInterval = StudioFrameAdvance ( 0.1f ) ;
2016-07-31 15:48:50 +02:00
DispatchAnimEvents ( flInterval ) ;
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
if ( m_fSequenceFinished )
2016-06-04 15:24:23 +02:00
{
// death anim finished.
StopAnimation ( ) ;
SetThink ( NULL ) ;
}
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
2016-07-31 15:48:50 +02:00
void CBarnacle : : Precache ( )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
PRECACHE_MODEL ( " models/barnacle.mdl " ) ;
PRECACHE_SOUND ( " barnacle/bcl_alert2.wav " ) ; //happy, lifting food up
PRECACHE_SOUND ( " barnacle/bcl_bite3.wav " ) ; //just got food to mouth
PRECACHE_SOUND ( " barnacle/bcl_chew1.wav " ) ;
PRECACHE_SOUND ( " barnacle/bcl_chew2.wav " ) ;
PRECACHE_SOUND ( " barnacle/bcl_chew3.wav " ) ;
PRECACHE_SOUND ( " barnacle/bcl_die1.wav " ) ;
PRECACHE_SOUND ( " barnacle/bcl_die3.wav " ) ;
2016-06-04 15:24:23 +02:00
}
//=========================================================
// TongueTouchEnt - does a trace along the barnacle's tongue
// to see if any entity is touching it. Also stores the length
// of the trace in the int pointer provided.
//=========================================================
2019-10-13 13:49:25 +02:00
# define BARNACLE_CHECK_SPACING 8.0f
2016-07-31 15:48:50 +02:00
CBaseEntity * CBarnacle : : TongueTouchEnt ( float * pflLength )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
TraceResult tr ;
float length ;
2016-06-04 15:24:23 +02:00
// trace once to hit architecture and see if the tongue needs to change position.
2019-10-13 13:49:25 +02:00
UTIL_TraceLine ( pev - > origin , pev - > origin - Vector ( 0.0f , 0.0f , 2048.0f ) , ignore_monsters , ENT ( pev ) , & tr ) ;
2016-06-04 15:24:23 +02:00
length = fabs ( pev - > origin . z - tr . vecEndPos . z ) ;
2016-07-31 15:48:50 +02:00
if ( pflLength )
2016-06-04 15:24:23 +02:00
{
* pflLength = length ;
}
2019-10-13 13:49:25 +02:00
Vector delta = Vector ( BARNACLE_CHECK_SPACING , BARNACLE_CHECK_SPACING , 0.0f ) ;
2016-06-04 15:24:23 +02:00
Vector mins = pev - > origin - delta ;
Vector maxs = pev - > origin + delta ;
maxs . z = pev - > origin . z ;
mins . z - = length ;
CBaseEntity * pList [ 10 ] ;
2016-07-31 15:48:50 +02:00
int count = UTIL_EntitiesInBox ( pList , 10 , mins , maxs , ( FL_CLIENT | FL_MONSTER ) ) ;
if ( count )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
for ( int i = 0 ; i < count ; i + + )
2016-06-04 15:24:23 +02:00
{
// only clients and monsters
2016-07-31 15:48:50 +02:00
if ( pList [ i ] ! = this & & IRelationship ( pList [ i ] ) > R_NO & & pList [ i ] - > pev - > deadflag = = DEAD_NO ) // this ent is one of our enemies. Barnacle tries to eat it.
2016-06-04 15:24:23 +02:00
{
return pList [ i ] ;
}
}
}
return NULL ;
}