|
|
|
@ -21,56 +21,155 @@
@@ -21,56 +21,155 @@
|
|
|
|
|
#include "monsters.h" |
|
|
|
|
#include "schedule.h" |
|
|
|
|
#include "weapons.h" |
|
|
|
|
#include "gman.h" |
|
|
|
|
#include "talkmonster.h" |
|
|
|
|
#include "soundent.h" |
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
// Monster's Anim Events Go Here
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
|
|
class CDrillSergeant : public CGMan |
|
|
|
|
class CDrillSergeant : public CTalkMonster |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
void Spawn(void); |
|
|
|
|
void Precache(void); |
|
|
|
|
void SetYawSpeed(void); |
|
|
|
|
int ISoundMask(void); |
|
|
|
|
virtual int ObjectCaps( void ) { return CTalkMonster::ObjectCaps() | FCAP_IMPULSE_USE; } |
|
|
|
|
void DeathSound( void ); |
|
|
|
|
void PainSound( void ); |
|
|
|
|
|
|
|
|
|
void DeclineFollowing(); |
|
|
|
|
void EXPORT DrillUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); |
|
|
|
|
|
|
|
|
|
virtual int Save( CSave &save ); |
|
|
|
|
virtual int Restore( CRestore &restore ); |
|
|
|
|
static TYPEDESCRIPTION m_SaveData[]; |
|
|
|
|
|
|
|
|
|
float m_painTime; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_drillsergeant, CDrillSergeant); |
|
|
|
|
LINK_ENTITY_TO_CLASS( monster_drillsergeant, CDrillSergeant ) |
|
|
|
|
|
|
|
|
|
TYPEDESCRIPTION CDrillSergeant::m_SaveData[] = |
|
|
|
|
{ |
|
|
|
|
DEFINE_FIELD( CDrillSergeant, m_painTime, FIELD_TIME ), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
IMPLEMENT_SAVERESTORE( CDrillSergeant, CTalkMonster ) |
|
|
|
|
|
|
|
|
|
void CDrillSergeant::Precache() |
|
|
|
|
{ |
|
|
|
|
PRECACHE_MODEL("models/drill.mdl"); |
|
|
|
|
PRECACHE_SOUND("barney/ba_pain1.wav"); |
|
|
|
|
PRECACHE_SOUND("barney/ba_pain2.wav"); |
|
|
|
|
PRECACHE_SOUND("barney/ba_pain3.wav"); |
|
|
|
|
PRECACHE_SOUND("barney/ba_die1.wav"); |
|
|
|
|
PRECACHE_SOUND("barney/ba_die2.wav"); |
|
|
|
|
PRECACHE_SOUND("barney/ba_die3.wav"); |
|
|
|
|
TalkInit(); |
|
|
|
|
CTalkMonster::Precache(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
// Spawn
|
|
|
|
|
//=========================================================
|
|
|
|
|
void CDrillSergeant::Spawn() |
|
|
|
|
{ |
|
|
|
|
Precache(); |
|
|
|
|
|
|
|
|
|
SET_MODEL(ENT(pev), "models/drill.mdl"); |
|
|
|
|
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); |
|
|
|
|
SET_MODEL( ENT(pev), "models/drill.mdl" ); |
|
|
|
|
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX ); |
|
|
|
|
|
|
|
|
|
pev->solid = SOLID_SLIDEBOX; |
|
|
|
|
pev->movetype = MOVETYPE_STEP; |
|
|
|
|
m_bloodColor = DONT_BLEED; |
|
|
|
|
pev->health = 100; |
|
|
|
|
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
|
|
|
|
m_bloodColor = BLOOD_COLOR_RED; |
|
|
|
|
pev->health = gSkillData.barneyHealth; |
|
|
|
|
pev->view_ofs = Vector ( 0, 0, 50 );// position of the eyes relative to monster's origin.
|
|
|
|
|
m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
|
|
|
|
|
m_MonsterState = MONSTERSTATE_NONE; |
|
|
|
|
|
|
|
|
|
m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP; |
|
|
|
|
|
|
|
|
|
MonsterInit(); |
|
|
|
|
SetUse(&CDrillSergeant::DrillUse); |
|
|
|
|
SetUse( &CDrillSergeant::DrillUse ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
// Precache - precaches all resources this monster needs
|
|
|
|
|
//=========================================================
|
|
|
|
|
void CDrillSergeant::Precache() |
|
|
|
|
void CDrillSergeant::DrillUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) |
|
|
|
|
{ |
|
|
|
|
PRECACHE_MODEL("models/drill.mdl"); |
|
|
|
|
if( m_useTime > gpGlobals->time ) |
|
|
|
|
return; |
|
|
|
|
if( pCaller != NULL && pCaller->IsPlayer() && IRelationship(pCaller) < R_DL && IRelationship(pCaller) != R_FR ) |
|
|
|
|
DeclineFollowing(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CDrillSergeant::DeclineFollowing() |
|
|
|
|
{ |
|
|
|
|
PlaySentence( "DR_POK", 2, VOL_NORM, ATTN_NORM ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CDrillSergeant::SetYawSpeed( void ) |
|
|
|
|
{ |
|
|
|
|
int ys = 0; |
|
|
|
|
switch ( m_Activity ) |
|
|
|
|
{ |
|
|
|
|
case ACT_IDLE: |
|
|
|
|
ys = 70; |
|
|
|
|
break; |
|
|
|
|
case ACT_WALK: |
|
|
|
|
ys = 70; |
|
|
|
|
break; |
|
|
|
|
case ACT_RUN: |
|
|
|
|
ys = 90; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
ys = 70; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pev->yaw_speed = ys; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int CDrillSergeant::ISoundMask( void) |
|
|
|
|
{ |
|
|
|
|
return bits_SOUND_WORLD | |
|
|
|
|
bits_SOUND_COMBAT | |
|
|
|
|
bits_SOUND_CARCASS | |
|
|
|
|
bits_SOUND_MEAT | |
|
|
|
|
bits_SOUND_GARBAGE | |
|
|
|
|
bits_SOUND_DANGER | |
|
|
|
|
bits_SOUND_PLAYER; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CDrillSergeant::PainSound( void ) |
|
|
|
|
{ |
|
|
|
|
if( gpGlobals->time < m_painTime ) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 0.75 ); |
|
|
|
|
|
|
|
|
|
switch( RANDOM_LONG( 0, 2 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
// Purpose:
|
|
|
|
|
// DeathSound
|
|
|
|
|
//=========================================================
|
|
|
|
|
void CDrillSergeant::DrillUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) |
|
|
|
|
void CDrillSergeant::DeathSound( void ) |
|
|
|
|
{ |
|
|
|
|
PlaySentence("DR_POK", 2, VOL_NORM, ATTN_NORM); |
|
|
|
|
} |
|
|
|
|
switch( RANDOM_LONG( 0, 2 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die1.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die2.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die3.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|