|
|
@ -24,19 +24,25 @@ |
|
|
|
#include "schedule.h" |
|
|
|
#include "schedule.h" |
|
|
|
#include "player.h" |
|
|
|
#include "player.h" |
|
|
|
#include "bullsquid.h" |
|
|
|
#include "bullsquid.h" |
|
|
|
|
|
|
|
#include "decals.h" |
|
|
|
extern int iSquidSpitSprite; |
|
|
|
#include "animation.h" |
|
|
|
|
|
|
|
#include "studio.h" |
|
|
|
|
|
|
|
|
|
|
|
#define GONOME_SPRINT_DIST 256 // how close the squid has to get before starting to sprint and refusing to swerve
|
|
|
|
#define GONOME_SPRINT_DIST 256 // how close the squid has to get before starting to sprint and refusing to swerve
|
|
|
|
|
|
|
|
|
|
|
|
#define GONOME_TOLERANCE_MELEE1_RANGE 95 |
|
|
|
#define GONOME_TOLERANCE_MELEE1_RANGE 85 |
|
|
|
#define GONOME_TOLERANCE_MELEE2_RANGE 85 |
|
|
|
#define GONOME_TOLERANCE_MELEE2_RANGE 65 |
|
|
|
|
|
|
|
|
|
|
|
#define GONOME_TOLERANCE_MELEE1_DOT 0.7 |
|
|
|
#define GONOME_TOLERANCE_MELEE1_DOT 0.7 |
|
|
|
#define GONOME_TOLERANCE_MELEE2_DOT 0.7 |
|
|
|
#define GONOME_TOLERANCE_MELEE2_DOT 0.7 |
|
|
|
|
|
|
|
|
|
|
|
#define GONOME_MELEE_ATTACK_RADIUS 70 |
|
|
|
#define GONOME_MELEE_ATTACK_RADIUS 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
TASK_GONOME_GET_PATH_TO_ENEMY_CORPSE = LAST_COMMON_TASK + 1 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// Monster's Anim Events Go Here
|
|
|
|
// Monster's Anim Events Go Here
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
@ -50,10 +56,87 @@ extern int iSquidSpitSprite; |
|
|
|
#define GONOME_AE_BITE3 ( 21 ) |
|
|
|
#define GONOME_AE_BITE3 ( 21 ) |
|
|
|
#define GONOME_AE_BITE4 ( 22 ) |
|
|
|
#define GONOME_AE_BITE4 ( 22 ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// Gonome's guts projectile
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
class CGonomeGuts : public CSquidSpit |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
void Spawn(void); |
|
|
|
|
|
|
|
static void Shoot(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity); |
|
|
|
|
|
|
|
void Touch(CBaseEntity *pOther); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CGonomeGuts::Spawn() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pev->movetype = MOVETYPE_FLY; |
|
|
|
|
|
|
|
pev->classname = MAKE_STRING( "gonomeguts" ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pev->solid = SOLID_BBOX; |
|
|
|
|
|
|
|
pev->rendermode = kRenderTransAlpha; |
|
|
|
|
|
|
|
pev->renderamt = 255; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET_MODEL( ENT( pev ), "sprites/blood_chnk.spr" ); |
|
|
|
|
|
|
|
pev->frame = 0; |
|
|
|
|
|
|
|
pev->scale = 0.5; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_maxFrame = (float)MODEL_FRAMES( pev->modelindex ) - 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CGonomeGuts::Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CGonomeGuts *pSpit = GetClassPtr( (CGonomeGuts *)NULL ); |
|
|
|
|
|
|
|
pSpit->Spawn(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UTIL_SetOrigin( pSpit->pev, vecStart ); |
|
|
|
|
|
|
|
pSpit->pev->velocity = vecVelocity; |
|
|
|
|
|
|
|
pSpit->pev->owner = ENT( pevOwner ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pSpit->SetThink( &CSquidSpit::Animate ); |
|
|
|
|
|
|
|
pSpit->pev->nextthink = gpGlobals->time + 0.1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CGonomeGuts::Touch( CBaseEntity *pOther ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
TraceResult tr; |
|
|
|
|
|
|
|
int iPitch; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// splat sound
|
|
|
|
|
|
|
|
iPitch = RANDOM_FLOAT( 90, 110 ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "bullchicken/bc_acid1.wav", 1, ATTN_NORM, 0, iPitch ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch( RANDOM_LONG( 0, 1 ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_spithit1.wav", 1, ATTN_NORM, 0, iPitch ); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_spithit2.wav", 1, ATTN_NORM, 0, iPitch ); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !pOther->pev->takedamage ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// make a splat on the wall
|
|
|
|
|
|
|
|
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 10, dont_ignore_monsters, ENT( pev ), &tr ); |
|
|
|
|
|
|
|
UTIL_DecalTrace( &tr, DECAL_BLOOD1 + RANDOM_LONG( 0, 5 ) ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pOther->TakeDamage( pev, pev, gSkillData.gonomeDmgGuts, DMG_GENERIC ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetThink( &CBaseEntity::SUB_Remove ); |
|
|
|
|
|
|
|
pev->nextthink = gpGlobals->time; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// CGonome
|
|
|
|
// CGonome
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
class CGonome : public CBullsquid |
|
|
|
class CGonome : public CBaseMonster |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
@ -61,51 +144,146 @@ public: |
|
|
|
void Precache(void); |
|
|
|
void Precache(void); |
|
|
|
|
|
|
|
|
|
|
|
int Classify(void); |
|
|
|
int Classify(void); |
|
|
|
|
|
|
|
void SetYawSpeed(); |
|
|
|
void HandleAnimEvent(MonsterEvent_t *pEvent); |
|
|
|
void HandleAnimEvent(MonsterEvent_t *pEvent); |
|
|
|
void IdleSound(void); |
|
|
|
void IdleSound(void); |
|
|
|
void PainSound(void); |
|
|
|
void PainSound(void); |
|
|
|
void DeathSound(void); |
|
|
|
void DeathSound(void); |
|
|
|
void AlertSound(void); |
|
|
|
void AlertSound(void); |
|
|
|
void AttackSound(void); |
|
|
|
|
|
|
|
void StartTask(Task_t *pTask); |
|
|
|
void StartTask(Task_t *pTask); |
|
|
|
|
|
|
|
|
|
|
|
BOOL CheckMeleeAttack1(float flDot, float flDist); |
|
|
|
BOOL CheckMeleeAttack1(float flDot, float flDist); |
|
|
|
BOOL CheckMeleeAttack2(float flDot, float flDist); |
|
|
|
BOOL CheckMeleeAttack2(float flDot, float flDist); |
|
|
|
BOOL CheckRangeAttack1(float flDot, float flDist); |
|
|
|
BOOL CheckRangeAttack1(float flDot, float flDist); |
|
|
|
void RunAI(void); |
|
|
|
void RunAI(void); |
|
|
|
|
|
|
|
Schedule_t *GetSchedule(); |
|
|
|
|
|
|
|
Schedule_t *GetScheduleOfType( int Type ); |
|
|
|
|
|
|
|
|
|
|
|
int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); |
|
|
|
int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); |
|
|
|
int IRelationship(CBaseEntity *pTarget); |
|
|
|
|
|
|
|
int IgnoreConditions(void); |
|
|
|
void SetActivity( Activity NewActivity ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Save(CSave &save); |
|
|
|
|
|
|
|
int Restore(CRestore &restore); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CUSTOM_SCHEDULES |
|
|
|
|
|
|
|
static TYPEDESCRIPTION m_SaveData[]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char* pPainSounds[]; |
|
|
|
|
|
|
|
static const char* pIdleSounds[]; |
|
|
|
|
|
|
|
static const char* pDeathSounds[]; |
|
|
|
|
|
|
|
protected: |
|
|
|
|
|
|
|
int GonomeLookupActivity( void *pmodel, int activity ); |
|
|
|
|
|
|
|
float m_flLastHurtTime;// we keep track of this, because if something hurts a squid, it will forget about its love of headcrabs for a while.
|
|
|
|
|
|
|
|
float m_flNextSpitTime;// last time the gonome used the spit attack.
|
|
|
|
|
|
|
|
bool gonnaAttack1; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_gonome, CGonome); |
|
|
|
LINK_ENTITY_TO_CLASS(monster_gonome, CGonome) |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
const char* CGonome::pPainSounds[] = { |
|
|
|
// Classify - indicates this monster's place in the
|
|
|
|
"gonome/gonome_pain1.wav", |
|
|
|
// relationship table.
|
|
|
|
"gonome/gonome_pain2.wav", |
|
|
|
//=========================================================
|
|
|
|
"gonome/gonome_pain3.wav", |
|
|
|
int CGonome::Classify(void) |
|
|
|
"gonome/gonome_pain4.wav" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char* CGonome::pIdleSounds[] = { |
|
|
|
|
|
|
|
"gonome/gonome_idle1.wav", |
|
|
|
|
|
|
|
"gonome/gonome_idle2.wav", |
|
|
|
|
|
|
|
"gonome/gonome_idle3.wav" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char* CGonome::pDeathSounds[] = { |
|
|
|
|
|
|
|
"gonome/gonome_death2.wav", |
|
|
|
|
|
|
|
"gonome/gonome_death3.wav", |
|
|
|
|
|
|
|
"gonome/gonome_death4.wav" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TYPEDESCRIPTION CGonome::m_SaveData[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
return CLASS_ALIEN_MONSTER; |
|
|
|
DEFINE_FIELD( CGonome, m_flLastHurtTime, FIELD_TIME ), |
|
|
|
} |
|
|
|
DEFINE_FIELD( CGonome, m_flNextSpitTime, FIELD_TIME ), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SAVERESTORE( CGonome, CBaseMonster ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Hack to ignore activity weights when choosing melee attack animation |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
int CGonome::GonomeLookupActivity( void *pmodel, int activity ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
studiohdr_t *pstudiohdr; |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
pstudiohdr = (studiohdr_t *)pmodel; |
|
|
|
// IgnoreConditions
|
|
|
|
if( !pstudiohdr ) |
|
|
|
//=========================================================
|
|
|
|
return 0; |
|
|
|
int CGonome::IgnoreConditions(void) |
|
|
|
|
|
|
|
|
|
|
|
mstudioseqdesc_t *pseqdesc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pseqdesc = (mstudioseqdesc_t *)( (byte *)pstudiohdr + pstudiohdr->seqindex ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sameActivityNum = 0; |
|
|
|
|
|
|
|
for( int i = 0; i < pstudiohdr->numseq && sameActivityNum < 2; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( pseqdesc[i].activity == activity ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
sameActivityNum++; |
|
|
|
|
|
|
|
if (sameActivityNum == 1 && gonnaAttack1) { |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
} else if (sameActivityNum == 2) { |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ACTIVITY_NOT_AVAILABLE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CGonome::SetActivity( Activity NewActivity ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return CBaseMonster::IgnoreConditions(); |
|
|
|
if (NewActivity != ACT_MELEE_ATTACK1) { |
|
|
|
|
|
|
|
CBaseMonster::SetActivity(NewActivity); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ASSERT( NewActivity != 0 ); |
|
|
|
|
|
|
|
void *pmodel = GET_MODEL_PTR( ENT( pev ) ); |
|
|
|
|
|
|
|
int iSequence = GonomeLookupActivity( pmodel, NewActivity ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set to the desired anim, or default anim if the desired is not present
|
|
|
|
|
|
|
|
if( iSequence > ACTIVITY_NOT_AVAILABLE ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( pev->sequence != iSequence || !m_fSequenceLoops ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// don't reset frame between walk and run
|
|
|
|
|
|
|
|
if( !( m_Activity == ACT_WALK || m_Activity == ACT_RUN ) || !( NewActivity == ACT_WALK || NewActivity == ACT_RUN ) ) |
|
|
|
|
|
|
|
pev->frame = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pev->sequence = iSequence; // Set to the reset anim (if it's there)
|
|
|
|
|
|
|
|
ResetSequenceInfo(); |
|
|
|
|
|
|
|
SetYawSpeed(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Not available try to get default anim
|
|
|
|
|
|
|
|
ALERT( at_aiconsole, "%s has no sequence for act:%d\n", STRING( pev->classname ), NewActivity ); |
|
|
|
|
|
|
|
pev->sequence = 0; // Set to the reset anim (if it's there)
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_Activity = NewActivity; // Go ahead and set this so it doesn't keep trying when the anim is not present
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// In case someone calls this with something other than the ideal activity
|
|
|
|
|
|
|
|
m_IdealActivity = m_Activity; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// IRelationship - overridden for gonome
|
|
|
|
// Classify - indicates this monster's place in the
|
|
|
|
|
|
|
|
// relationship table.
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
int CGonome::IRelationship(CBaseEntity *pTarget) |
|
|
|
int CGonome::Classify(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return CBaseMonster::IRelationship(pTarget); |
|
|
|
return CLASS_ALIEN_MONSTER; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
@ -117,9 +295,9 @@ int CGonome::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float f |
|
|
|
float flDist; |
|
|
|
float flDist; |
|
|
|
Vector vecApex; |
|
|
|
Vector vecApex; |
|
|
|
|
|
|
|
|
|
|
|
// if the squid is running, has an enemy, was hurt by the enemy, hasn't been hurt in the last 3 seconds, and isn't too close to the enemy,
|
|
|
|
// if the gonome is running, has an enemy, was hurt by the enemy, hasn't been hurt in the last 3 seconds, and isn't too close to the enemy,
|
|
|
|
// it will swerve. (whew).
|
|
|
|
// it will swerve. (whew).
|
|
|
|
if (m_hEnemy != NULL && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3) |
|
|
|
if (m_hEnemy != NULL && IsMoving() && pevAttacker == m_hEnemy->pev) |
|
|
|
{ |
|
|
|
{ |
|
|
|
flDist = (pev->origin - m_hEnemy->pev->origin).Length2D(); |
|
|
|
flDist = (pev->origin - m_hEnemy->pev->origin).Length2D(); |
|
|
|
|
|
|
|
|
|
|
@ -168,7 +346,7 @@ BOOL CGonome::CheckRangeAttack1(float flDot, float flDist) |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
// not moving, so spit again pretty soon.
|
|
|
|
// not moving, so spit again pretty soon.
|
|
|
|
m_flNextSpitTime = gpGlobals->time + 0.5; |
|
|
|
m_flNextSpitTime = gpGlobals->time + 3; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return TRUE; |
|
|
|
return TRUE; |
|
|
@ -178,48 +356,28 @@ BOOL CGonome::CheckRangeAttack1(float flDot, float flDist) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// CheckMeleeAttack1 - bullsquid is a big guy, so has a longer
|
|
|
|
// CheckMeleeAttack1 - gonome is a big guy, so has a longer
|
|
|
|
// melee range than most monsters. This is the tailwhip attack
|
|
|
|
// melee range than most monsters.
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
BOOL CGonome::CheckMeleeAttack1(float flDot, float flDist) |
|
|
|
BOOL CGonome::CheckMeleeAttack1(float flDot, float flDist) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if 1 |
|
|
|
if (flDist <= GONOME_TOLERANCE_MELEE2_RANGE && flDot >= GONOME_TOLERANCE_MELEE2_DOT && RANDOM_LONG(0,1) == 0) { |
|
|
|
if (flDist <= GONOME_TOLERANCE_MELEE1_RANGE && |
|
|
|
gonnaAttack1 = false; |
|
|
|
flDot >= GONOME_TOLERANCE_MELEE1_DOT) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return TRUE; |
|
|
|
return TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
else if (flDist <= GONOME_TOLERANCE_MELEE1_RANGE && flDot >= GONOME_TOLERANCE_MELEE1_DOT) |
|
|
|
if (flDist <= 85 && flDot >= 0.7) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
gonnaAttack1 = true; |
|
|
|
return TRUE; |
|
|
|
return TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// CheckMeleeAttack2 - bullsquid is a big guy, so has a longer
|
|
|
|
// CheckMeleeAttack2 - both gonome's melee attacks are ACT_MELEE_ATTACK1
|
|
|
|
// melee range than most monsters. This is the bite attack.
|
|
|
|
|
|
|
|
// this attack will not be performed if the tailwhip attack
|
|
|
|
|
|
|
|
// is valid.
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
BOOL CGonome::CheckMeleeAttack2(float flDot, float flDist) |
|
|
|
BOOL CGonome::CheckMeleeAttack2(float flDot, float flDist) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if 1 |
|
|
|
|
|
|
|
if (flDist <= GONOME_TOLERANCE_MELEE2_RANGE && |
|
|
|
|
|
|
|
flDot >= GONOME_TOLERANCE_MELEE2_DOT && |
|
|
|
|
|
|
|
!HasConditions(bits_COND_CAN_MELEE_ATTACK1)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
if (flDist <= 85 && flDot >= 0.7 && !HasConditions(bits_COND_CAN_MELEE_ATTACK1)) // The player & bullsquid can be as much as their bboxes
|
|
|
|
|
|
|
|
{ // apart (48 * sqrt(3)) and he can still attack (85 is a little more than 48*sqrt(3))
|
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return FALSE; |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -230,18 +388,7 @@ BOOL CGonome::CheckMeleeAttack2(float flDot, float flDist) |
|
|
|
#define GONOME_ATTN_IDLE (float)1.5 |
|
|
|
#define GONOME_ATTN_IDLE (float)1.5 |
|
|
|
void CGonome::IdleSound(void) |
|
|
|
void CGonome::IdleSound(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (RANDOM_LONG(0, 2)) |
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pIdleSounds), 1, GONOME_ATTN_IDLE); |
|
|
|
{ |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_idle1.wav", 1, GONOME_ATTN_IDLE); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_idle2.wav", 1, GONOME_ATTN_IDLE); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_idle3.wav", 1, GONOME_ATTN_IDLE); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
@ -249,23 +396,8 @@ void CGonome::IdleSound(void) |
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
void CGonome::PainSound(void) |
|
|
|
void CGonome::PainSound(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int iPitch = RANDOM_LONG(85, 120); |
|
|
|
const int iPitch = RANDOM_LONG(85, 120); |
|
|
|
|
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pPainSounds), 1, ATTN_NORM, 0, iPitch); |
|
|
|
switch (RANDOM_LONG(0, 3)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "gonome/gonome_pain1.wav", 1, ATTN_NORM, 0, iPitch); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "gonome/gonome_pain2.wav", 1, ATTN_NORM, 0, iPitch); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "gonome/gonome_pain3.wav", 1, ATTN_NORM, 0, iPitch); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "gonome/gonome_pain4.wav", 1, ATTN_NORM, 0, iPitch); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
@ -274,23 +406,40 @@ void CGonome::PainSound(void) |
|
|
|
void CGonome::AlertSound(void) |
|
|
|
void CGonome::AlertSound(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int iPitch = RANDOM_LONG(140, 160); |
|
|
|
int iPitch = RANDOM_LONG(140, 160); |
|
|
|
|
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pIdleSounds), 1, ATTN_NORM, 0, iPitch); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// SetYawSpeed - allows each sequence to have a different
|
|
|
|
|
|
|
|
// turn rate associated with it.
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CGonome::SetYawSpeed( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int ys; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ys = 0; |
|
|
|
|
|
|
|
|
|
|
|
switch (RANDOM_LONG(0, 2)) |
|
|
|
switch ( m_Activity ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case 0: |
|
|
|
case ACT_WALK: |
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "gonome/gonome_idle1.wav", 1, ATTN_NORM, 0, iPitch); |
|
|
|
ys = 90; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case ACT_RUN: |
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "gonome/gonome_idle2.wav", 1, ATTN_NORM, 0, iPitch); |
|
|
|
ys = 90; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case ACT_IDLE: |
|
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "gonome/gonome_idle3.wav", 1, ATTN_NORM, 0, iPitch); |
|
|
|
ys = 90; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case ACT_RANGE_ATTACK1: |
|
|
|
|
|
|
|
ys = 90; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
ys = 90; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pev->yaw_speed = ys; |
|
|
|
|
|
|
|
} |
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// HandleAnimEvent - catches the monster-specific messages
|
|
|
|
// HandleAnimEvent - catches the monster-specific messages
|
|
|
|
// that occur when tagged animation frames are played.
|
|
|
|
// that occur when tagged animation frames are played.
|
|
|
@ -299,23 +448,19 @@ void CGonome::HandleAnimEvent(MonsterEvent_t *pEvent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (pEvent->event) |
|
|
|
switch (pEvent->event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
case 1011: |
|
|
|
|
|
|
|
// This may play sound twice
|
|
|
|
|
|
|
|
//EMIT_SOUND(ENT(pev), CHAN_VOICE, pEvent->options, 1, ATTN_NORM);
|
|
|
|
|
|
|
|
break; |
|
|
|
case GONOME_AE_THROW: |
|
|
|
case GONOME_AE_THROW: |
|
|
|
{ |
|
|
|
{ |
|
|
|
Vector vecSpitOffset; |
|
|
|
Vector vecSpitOffset; |
|
|
|
Vector vecSpitDir; |
|
|
|
Vector vecSpitDir; |
|
|
|
|
|
|
|
|
|
|
|
UTIL_MakeVectors(pev->angles); |
|
|
|
UTIL_MakeVectors(pev->angles); |
|
|
|
|
|
|
|
|
|
|
|
// !!!HACKHACK - the spot at which the spit originates (in front of the mouth) was measured in 3ds and hardcoded here.
|
|
|
|
|
|
|
|
// we should be able to read the position of bones at runtime for this info.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vector vecArmPos, vecArmAng; |
|
|
|
Vector vecArmPos, vecArmAng; |
|
|
|
GetAttachment(0, vecArmPos, vecArmAng); |
|
|
|
GetAttachment(0, vecArmPos, vecArmAng); |
|
|
|
|
|
|
|
|
|
|
|
//vecSpitOffset = (gpGlobals->v_right * 8 + gpGlobals->v_forward * 37 + gpGlobals->v_up * 23);
|
|
|
|
|
|
|
|
//vecSpitOffset = (pev->origin + vecSpitOffset);
|
|
|
|
|
|
|
|
vecSpitOffset = vecArmPos; |
|
|
|
vecSpitOffset = vecArmPos; |
|
|
|
vecSpitDir = ((m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs) - vecSpitOffset).Normalize(); |
|
|
|
vecSpitDir = ((m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs) - vecSpitOffset).Normalize(); |
|
|
|
|
|
|
|
|
|
|
@ -323,33 +468,13 @@ void CGonome::HandleAnimEvent(MonsterEvent_t *pEvent) |
|
|
|
vecSpitDir.y += RANDOM_FLOAT(-0.05, 0.05); |
|
|
|
vecSpitDir.y += RANDOM_FLOAT(-0.05, 0.05); |
|
|
|
vecSpitDir.z += RANDOM_FLOAT(-0.05, 0); |
|
|
|
vecSpitDir.z += RANDOM_FLOAT(-0.05, 0); |
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
CGonomeGuts::Shoot(pev, vecSpitOffset, vecSpitDir * 1200); // Default: 900
|
|
|
|
// do stuff for this event.
|
|
|
|
|
|
|
|
AttackSound(); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// spew the spittle temporary ents.
|
|
|
|
|
|
|
|
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecSpitOffset); |
|
|
|
|
|
|
|
WRITE_BYTE(TE_SPRITE_SPRAY); |
|
|
|
|
|
|
|
WRITE_COORD(vecSpitOffset.x); // pos
|
|
|
|
|
|
|
|
WRITE_COORD(vecSpitOffset.y); |
|
|
|
|
|
|
|
WRITE_COORD(vecSpitOffset.z); |
|
|
|
|
|
|
|
WRITE_COORD(vecSpitDir.x); // dir
|
|
|
|
|
|
|
|
WRITE_COORD(vecSpitDir.y); |
|
|
|
|
|
|
|
WRITE_COORD(vecSpitDir.z); |
|
|
|
|
|
|
|
WRITE_SHORT(iSquidSpitSprite); // model
|
|
|
|
|
|
|
|
WRITE_BYTE(15); // count
|
|
|
|
|
|
|
|
WRITE_BYTE(210); // speed
|
|
|
|
|
|
|
|
WRITE_BYTE(25); // noise ( client will divide by 100 )
|
|
|
|
|
|
|
|
MESSAGE_END(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CSquidSpit::Shoot(pev, vecSpitOffset, vecSpitDir * 1200); // Default: 900
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case GONOME_AE_SLASH_LEFT: |
|
|
|
case GONOME_AE_SLASH_LEFT: |
|
|
|
{ |
|
|
|
{ |
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack(GONOME_MELEE_ATTACK_RADIUS, gSkillData.gonomeDmgOneSlash, DMG_CLUB); |
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack(GONOME_MELEE_ATTACK_RADIUS, gSkillData.gonomeDmgOneSlash, DMG_SLASH); |
|
|
|
if (pHurt) |
|
|
|
if (pHurt) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pHurt->pev->punchangle.z = 20; |
|
|
|
pHurt->pev->punchangle.z = 20; |
|
|
@ -362,7 +487,7 @@ void CGonome::HandleAnimEvent(MonsterEvent_t *pEvent) |
|
|
|
|
|
|
|
|
|
|
|
case GONOME_AE_SLASH_RIGHT: |
|
|
|
case GONOME_AE_SLASH_RIGHT: |
|
|
|
{ |
|
|
|
{ |
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack(GONOME_MELEE_ATTACK_RADIUS, gSkillData.gonomeDmgOneSlash, DMG_CLUB); |
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack(GONOME_MELEE_ATTACK_RADIUS, gSkillData.gonomeDmgOneSlash, DMG_SLASH); |
|
|
|
if (pHurt) |
|
|
|
if (pHurt) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pHurt->pev->punchangle.z = -20; |
|
|
|
pHurt->pev->punchangle.z = -20; |
|
|
@ -379,8 +504,6 @@ void CGonome::HandleAnimEvent(MonsterEvent_t *pEvent) |
|
|
|
case GONOME_AE_BITE4: |
|
|
|
case GONOME_AE_BITE4: |
|
|
|
{ |
|
|
|
{ |
|
|
|
int iPitch; |
|
|
|
int iPitch; |
|
|
|
|
|
|
|
|
|
|
|
// SOUND HERE!
|
|
|
|
|
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack(GONOME_TOLERANCE_MELEE2_RANGE, gSkillData.gonomeDmgOneBite, DMG_SLASH); |
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack(GONOME_TOLERANCE_MELEE2_RANGE, gSkillData.gonomeDmgOneBite, DMG_SLASH); |
|
|
|
|
|
|
|
|
|
|
|
if (pHurt) |
|
|
|
if (pHurt) |
|
|
@ -430,7 +553,6 @@ void CGonome::Spawn() |
|
|
|
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
|
|
|
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
|
|
|
m_MonsterState = MONSTERSTATE_NONE; |
|
|
|
m_MonsterState = MONSTERSTATE_NONE; |
|
|
|
|
|
|
|
|
|
|
|
m_fCanThreatDisplay = TRUE; |
|
|
|
|
|
|
|
m_flNextSpitTime = gpGlobals->time; |
|
|
|
m_flNextSpitTime = gpGlobals->time; |
|
|
|
|
|
|
|
|
|
|
|
MonsterInit(); |
|
|
|
MonsterInit(); |
|
|
@ -443,30 +565,18 @@ void CGonome::Precache() |
|
|
|
{ |
|
|
|
{ |
|
|
|
PRECACHE_MODEL("models/gonome.mdl"); |
|
|
|
PRECACHE_MODEL("models/gonome.mdl"); |
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_MODEL("sprites/bigspit.spr");// spit projectile.
|
|
|
|
PRECACHE_MODEL("sprites/blood_chnk.spr");// spit projectile.
|
|
|
|
|
|
|
|
|
|
|
|
iSquidSpitSprite = PRECACHE_MODEL("sprites/tinyspit.spr");// client side spittle.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("zombie/claw_miss2.wav");// because we use the basemonster SWIPE animation event
|
|
|
|
PRECACHE_SOUND("zombie/claw_miss2.wav");// because we use the basemonster SWIPE animation event
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_death2.wav"); |
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_death3.wav"); |
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_death4.wav"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_eat.wav"); |
|
|
|
PRECACHE_SOUND("gonome/gonome_eat.wav"); |
|
|
|
PRECACHE_SOUND("gonome/gonome_idle1.wav"); |
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_idle2.wav"); |
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_idle3.wav"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_jumpattack.wav"); |
|
|
|
PRECACHE_SOUND("gonome/gonome_jumpattack.wav"); |
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_melee1.wav"); |
|
|
|
PRECACHE_SOUND("gonome/gonome_melee1.wav"); |
|
|
|
PRECACHE_SOUND("gonome/gonome_melee2.wav"); |
|
|
|
PRECACHE_SOUND("gonome/gonome_melee2.wav"); |
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_pain1.wav"); |
|
|
|
PRECACHE_SOUND_ARRAY(pIdleSounds); |
|
|
|
PRECACHE_SOUND("gonome/gonome_pain2.wav"); |
|
|
|
PRECACHE_SOUND_ARRAY(pPainSounds); |
|
|
|
PRECACHE_SOUND("gonome/gonome_pain3.wav"); |
|
|
|
PRECACHE_SOUND_ARRAY(pDeathSounds); |
|
|
|
PRECACHE_SOUND("gonome/gonome_pain4.wav"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_SOUND("gonome/gonome_run.wav"); |
|
|
|
PRECACHE_SOUND("gonome/gonome_run.wav"); |
|
|
|
|
|
|
|
|
|
|
@ -484,25 +594,7 @@ void CGonome::Precache() |
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
void CGonome::DeathSound(void) |
|
|
|
void CGonome::DeathSound(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (RANDOM_LONG(0, 2)) |
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pDeathSounds), 1, ATTN_NORM); |
|
|
|
{ |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_death2.wav", 1, ATTN_NORM); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_death3.wav", 1, ATTN_NORM); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_death4.wav", 1, ATTN_NORM); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// AttackSound
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CGonome::AttackSound(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//========================================================
|
|
|
|
//========================================================
|
|
|
@ -522,16 +614,163 @@ void CGonome::RunAI(void) |
|
|
|
pev->framerate = 1.25; |
|
|
|
pev->framerate = 1.25; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// GetSchedule
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
Schedule_t *CGonome::GetSchedule( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch( m_MonsterState ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case MONSTERSTATE_COMBAT: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// dead enemy
|
|
|
|
|
|
|
|
if( HasConditions( bits_COND_ENEMY_DEAD ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// call base class, all code to handle dead enemies is centralized there.
|
|
|
|
|
|
|
|
return CBaseMonster::GetSchedule(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( HasConditions( bits_COND_NEW_ENEMY ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_WAKE_ANGRY ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( HasConditions( bits_COND_CAN_RANGE_ATTACK1 ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_RANGE_ATTACK1 ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_MELEE_ATTACK1 ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( HasConditions( bits_COND_CAN_MELEE_ATTACK2 ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_MELEE_ATTACK2 ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_CHASE_ENEMY ); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return CBaseMonster::GetSchedule(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// primary range attack
|
|
|
|
|
|
|
|
Task_t tlGonomeRangeAttack1[] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
{ TASK_STOP_MOVING, 0 }, |
|
|
|
|
|
|
|
{ TASK_FACE_IDEAL, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_RANGE_ATTACK1, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_SET_ACTIVITY, (float)ACT_IDLE }, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Schedule_t slGonomeRangeAttack1[] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tlGonomeRangeAttack1, |
|
|
|
|
|
|
|
ARRAYSIZE( tlGonomeRangeAttack1 ), |
|
|
|
|
|
|
|
bits_COND_NEW_ENEMY | |
|
|
|
|
|
|
|
bits_COND_ENEMY_DEAD | |
|
|
|
|
|
|
|
bits_COND_HEAVY_DAMAGE | |
|
|
|
|
|
|
|
bits_COND_ENEMY_OCCLUDED | |
|
|
|
|
|
|
|
bits_COND_NO_AMMO_LOADED, |
|
|
|
|
|
|
|
0, |
|
|
|
|
|
|
|
"Gonome Range Attack1" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Chase enemy schedule
|
|
|
|
|
|
|
|
Task_t tlGonomeChaseEnemy1[] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_RANGE_ATTACK1 },// !!!OEM - this will stop nasty squid oscillation.
|
|
|
|
|
|
|
|
{ TASK_GET_PATH_TO_ENEMY, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_RUN_PATH, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_WAIT_FOR_MOVEMENT, (float)0 }, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Schedule_t slGonomeChaseEnemy[] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tlGonomeChaseEnemy1, |
|
|
|
|
|
|
|
ARRAYSIZE( tlGonomeChaseEnemy1 ), |
|
|
|
|
|
|
|
bits_COND_NEW_ENEMY | |
|
|
|
|
|
|
|
bits_COND_ENEMY_DEAD | |
|
|
|
|
|
|
|
bits_COND_SMELL_FOOD | |
|
|
|
|
|
|
|
bits_COND_CAN_RANGE_ATTACK1 | |
|
|
|
|
|
|
|
bits_COND_CAN_MELEE_ATTACK1 | |
|
|
|
|
|
|
|
bits_COND_CAN_MELEE_ATTACK2 | |
|
|
|
|
|
|
|
bits_COND_TASK_FAILED, |
|
|
|
|
|
|
|
0, |
|
|
|
|
|
|
|
"Gonome Chase Enemy" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// victory dance (eating body)
|
|
|
|
|
|
|
|
Task_t tlGonomeVictoryDance[] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
{ TASK_STOP_MOVING, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_WAIT, (float)0.1 }, |
|
|
|
|
|
|
|
{ TASK_GONOME_GET_PATH_TO_ENEMY_CORPSE, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_WALK_PATH, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_WAIT_FOR_MOVEMENT, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_FACE_ENEMY, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_PLAY_SEQUENCE, (float)ACT_VICTORY_DANCE }, |
|
|
|
|
|
|
|
{ TASK_PLAY_SEQUENCE, (float)ACT_VICTORY_DANCE }, |
|
|
|
|
|
|
|
{ TASK_PLAY_SEQUENCE, (float)ACT_VICTORY_DANCE } |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Schedule_t slGonomeVictoryDance[] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tlGonomeVictoryDance, |
|
|
|
|
|
|
|
ARRAYSIZE( tlGonomeVictoryDance ), |
|
|
|
|
|
|
|
bits_COND_NEW_ENEMY | |
|
|
|
|
|
|
|
bits_COND_LIGHT_DAMAGE | |
|
|
|
|
|
|
|
bits_COND_HEAVY_DAMAGE, |
|
|
|
|
|
|
|
0, |
|
|
|
|
|
|
|
"GonomeVictoryDance" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFINE_CUSTOM_SCHEDULES( CGonome ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
slGonomeRangeAttack1, |
|
|
|
|
|
|
|
slGonomeChaseEnemy, |
|
|
|
|
|
|
|
slGonomeVictoryDance, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_CUSTOM_SCHEDULES( CGonome, CBaseMonster ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Schedule_t* CGonome::GetScheduleOfType(int Type) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch ( Type ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case SCHED_RANGE_ATTACK1: |
|
|
|
|
|
|
|
return &slGonomeRangeAttack1[0]; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case SCHED_CHASE_ENEMY: |
|
|
|
|
|
|
|
return &slGonomeChaseEnemy[0]; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case SCHED_VICTORY_DANCE: |
|
|
|
|
|
|
|
return &slGonomeVictoryDance[0]; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return CBaseMonster::GetScheduleOfType(Type); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// Start task - selects the correct activity and performs
|
|
|
|
// Start task - selects the correct activity and performs
|
|
|
|
// any necessary calculations to start the next task on the
|
|
|
|
// any necessary calculations to start the next task on the
|
|
|
|
// schedule. OVERRIDDEN for bullsquid because it needs to
|
|
|
|
// schedule.
|
|
|
|
// know explicitly when the last attempt to chase the enemy
|
|
|
|
|
|
|
|
// failed, since that impacts its attack choices.
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
void CGonome::StartTask(Task_t *pTask) |
|
|
|
void CGonome::StartTask(Task_t *pTask) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -541,20 +780,30 @@ void CGonome::StartTask(Task_t *pTask) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case TASK_MELEE_ATTACK1: |
|
|
|
case TASK_MELEE_ATTACK1: |
|
|
|
{ |
|
|
|
{ |
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_melee1.wav", 1, ATTN_NORM); |
|
|
|
if (gonnaAttack1) |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_melee1.wav", 1, ATTN_NORM); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_melee2.wav", 1, ATTN_NORM); |
|
|
|
CBaseMonster::StartTask(pTask); |
|
|
|
CBaseMonster::StartTask(pTask); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case TASK_MELEE_ATTACK2: |
|
|
|
case TASK_GONOME_GET_PATH_TO_ENEMY_CORPSE: |
|
|
|
{ |
|
|
|
{ |
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "gonome/gonome_melee2.wav", 1, ATTN_NORM); |
|
|
|
UTIL_MakeVectors( pev->angles ); |
|
|
|
CBaseMonster::StartTask(pTask); |
|
|
|
if( BuildRoute( m_vecEnemyLKP - gpGlobals->v_forward * 40, bits_MF_TO_LOCATION, NULL ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
TaskComplete(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ALERT( at_aiconsole, "GonomeGetPathToEnemyCorpse failed!!\n" ); |
|
|
|
|
|
|
|
TaskFail(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
CBullsquid::StartTask(pTask); |
|
|
|
CBaseMonster::StartTask(pTask); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -567,28 +816,26 @@ class CDeadGonome : public CBaseMonster |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
public: |
|
|
|
void Spawn(void); |
|
|
|
void Spawn(void); |
|
|
|
int Classify(void) { return CLASS_HUMAN_MILITARY; } |
|
|
|
int Classify(void) { return CLASS_ALIEN_MONSTER; } |
|
|
|
|
|
|
|
void KeyValue( KeyValueData *pkvd ); |
|
|
|
void KeyValue(KeyValueData *pkvd); |
|
|
|
int m_iPose; |
|
|
|
|
|
|
|
static const char *m_szPoses[3]; |
|
|
|
int m_iPose;// which sequence to display -- temporary, don't need to save
|
|
|
|
|
|
|
|
static char *m_szPoses[3]; |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
char *CDeadGonome::m_szPoses[] = { "dead_on_stomach1", "dead_on_back", "dead_on_side" }; |
|
|
|
const char *CDeadGonome::m_szPoses[] = { "dead_on_stomach1", "dead_on_back", "dead_on_side" }; |
|
|
|
|
|
|
|
|
|
|
|
void CDeadGonome::KeyValue(KeyValueData *pkvd) |
|
|
|
void CDeadGonome::KeyValue( KeyValueData *pkvd ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (FStrEq(pkvd->szKeyName, "pose")) |
|
|
|
if( FStrEq( pkvd->szKeyName, "pose" ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_iPose = atoi(pkvd->szValue); |
|
|
|
m_iPose = atoi( pkvd->szValue ); |
|
|
|
pkvd->fHandled = TRUE; |
|
|
|
pkvd->fHandled = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
CBaseMonster::KeyValue(pkvd); |
|
|
|
CBaseMonster::KeyValue( pkvd ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_gonome_dead, CDeadGonome); |
|
|
|
LINK_ENTITY_TO_CLASS(monster_gonome_dead, CDeadGonome) |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// ********** DeadGonome SPAWN **********
|
|
|
|
// ********** DeadGonome SPAWN **********
|
|
|
@ -601,16 +848,12 @@ void CDeadGonome::Spawn(void) |
|
|
|
pev->effects = 0; |
|
|
|
pev->effects = 0; |
|
|
|
pev->yaw_speed = 8; |
|
|
|
pev->yaw_speed = 8; |
|
|
|
pev->sequence = 0; |
|
|
|
pev->sequence = 0; |
|
|
|
pev->body = 1; |
|
|
|
|
|
|
|
m_bloodColor = BLOOD_COLOR_GREEN; |
|
|
|
m_bloodColor = BLOOD_COLOR_GREEN; |
|
|
|
|
|
|
|
|
|
|
|
pev->sequence = LookupSequence(m_szPoses[m_iPose]); |
|
|
|
pev->sequence = LookupSequence( m_szPoses[m_iPose] ); |
|
|
|
|
|
|
|
if( pev->sequence == -1 ) |
|
|
|
if (pev->sequence == -1) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
ALERT(at_console, "Dead Gonome with bad pose\n"); |
|
|
|
ALERT( at_console, "Dead gonome with bad pose\n" ); |
|
|
|
pev->sequence = 0; |
|
|
|
|
|
|
|
pev->effects = EF_BRIGHTFIELD; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Corpses have less health
|
|
|
|
// Corpses have less health
|
|
|
|