|
|
@ -1,4 +1,3 @@ |
|
|
|
//This will be remake
|
|
|
|
|
|
|
|
/***
|
|
|
|
/***
|
|
|
|
* |
|
|
|
* |
|
|
|
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. |
|
|
|
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. |
|
|
@ -14,86 +13,121 @@ |
|
|
|
* |
|
|
|
* |
|
|
|
****/ |
|
|
|
****/ |
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// Zombie
|
|
|
|
// Alien slave monster
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
|
|
|
|
// UNDONE: Don't flinch every time you get hit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "extdll.h" |
|
|
|
#include "extdll.h" |
|
|
|
#include "util.h" |
|
|
|
#include "util.h" |
|
|
|
#include "cbase.h" |
|
|
|
#include "cbase.h" |
|
|
|
#include "monsters.h" |
|
|
|
#include "monsters.h" |
|
|
|
|
|
|
|
#include "squadmonster.h" |
|
|
|
#include "schedule.h" |
|
|
|
#include "schedule.h" |
|
|
|
|
|
|
|
#include "effects.h" |
|
|
|
|
|
|
|
#include "weapons.h" |
|
|
|
|
|
|
|
#include "soundent.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern DLL_GLOBAL int g_iSkillLevel; |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// Monster's Anim Events Go Here
|
|
|
|
// Monster's Anim Events Go Here
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
#define ZOMBIE_AE_ATTACK_RIGHT 0x01 |
|
|
|
#define ISLAVE_AE_CLAW ( 1 ) |
|
|
|
#define ZOMBIE_AE_ATTACK_LEFT 0x02 |
|
|
|
#define ISLAVE_AE_CLAWRAKE ( 2 ) |
|
|
|
#define ZOMBIE_AE_ATTACK_BOTH 0x03 |
|
|
|
#define ISLAVE_AE_ZAP_POWERUP ( 3 ) |
|
|
|
|
|
|
|
#define ISLAVE_AE_ZAP_SHOOT ( 4 ) |
|
|
|
|
|
|
|
#define ISLAVE_AE_ZAP_DONE ( 5 ) |
|
|
|
|
|
|
|
|
|
|
|
#define ZOMBIE_FLINCH_DELAY 2 // at most one flinch every n secs
|
|
|
|
#define ISLAVE_MAX_BEAMS 8 |
|
|
|
|
|
|
|
|
|
|
|
class CSkrillex : public CBaseMonster |
|
|
|
class CSkrillex : public CSquadMonster |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
public: |
|
|
|
void Spawn( void ); |
|
|
|
void Spawn( void ); |
|
|
|
void Precache( void ); |
|
|
|
void Precache( void ); |
|
|
|
void SetYawSpeed( void ); |
|
|
|
void SetYawSpeed( void ); |
|
|
|
|
|
|
|
int ISoundMask( void ); |
|
|
|
int Classify( void ); |
|
|
|
int Classify( void ); |
|
|
|
|
|
|
|
int IRelationship( CBaseEntity *pTarget ); |
|
|
|
void HandleAnimEvent( MonsterEvent_t *pEvent ); |
|
|
|
void HandleAnimEvent( MonsterEvent_t *pEvent ); |
|
|
|
int IgnoreConditions( void ); |
|
|
|
BOOL CheckRangeAttack1( float flDot, float flDist ); |
|
|
|
|
|
|
|
BOOL CheckRangeAttack2( float flDot, float flDist ); |
|
|
|
float m_flNextFlinch; |
|
|
|
void CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ); |
|
|
|
|
|
|
|
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ); |
|
|
|
|
|
|
|
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ); |
|
|
|
|
|
|
|
|
|
|
|
void PainSound( void ); |
|
|
|
|
|
|
|
void AlertSound( void ); |
|
|
|
|
|
|
|
void IdleSound( void ); |
|
|
|
void IdleSound( void ); |
|
|
|
void AttackSound( void ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char *pAttackSounds[]; |
|
|
|
void Killed( entvars_t *pevAttacker, int iGib ); |
|
|
|
static const char *pIdleSounds[]; |
|
|
|
|
|
|
|
static const char *pAlertSounds[]; |
|
|
|
void StartTask( Task_t *pTask ); |
|
|
|
static const char *pPainSounds[]; |
|
|
|
Schedule_t *GetSchedule( void ); |
|
|
|
|
|
|
|
Schedule_t *GetScheduleOfType( int Type ); |
|
|
|
|
|
|
|
CUSTOM_SCHEDULES |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Save( CSave &save ); |
|
|
|
|
|
|
|
int Restore( CRestore &restore ); |
|
|
|
|
|
|
|
static TYPEDESCRIPTION m_SaveData[]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ClearBeams(); |
|
|
|
|
|
|
|
void ArmBeam( int side ); |
|
|
|
|
|
|
|
void WackBeam( int side, CBaseEntity *pEntity ); |
|
|
|
|
|
|
|
void ZapBeam( int side ); |
|
|
|
|
|
|
|
void BeamGlow( void ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int m_iBravery; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CBeam *m_pBeam[ISLAVE_MAX_BEAMS]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int m_iBeams; |
|
|
|
|
|
|
|
float m_flNextAttack; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int m_voicePitch; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EHANDLE m_hDead; |
|
|
|
|
|
|
|
|
|
|
|
static const char *pAttackHitSounds[]; |
|
|
|
static const char *pAttackHitSounds[]; |
|
|
|
static const char *pAttackMissSounds[]; |
|
|
|
static const char *pAttackMissSounds[]; |
|
|
|
|
|
|
|
static const char *pPainSounds[]; |
|
|
|
// No range attacks
|
|
|
|
static const char *pDeathSounds[]; |
|
|
|
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; } |
|
|
|
|
|
|
|
BOOL CheckRangeAttack2( float flDot, float flDist ) { return FALSE; } |
|
|
|
|
|
|
|
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS( monster_skrillex, CSkrillex ) |
|
|
|
LINK_ENTITY_TO_CLASS( monster_skrillex, CSkrillex ) |
|
|
|
|
|
|
|
|
|
|
|
const char *CSkrillex::pAttackHitSounds[] = |
|
|
|
TYPEDESCRIPTION CSkrillex::m_SaveData[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
"skrillex/fire.wav", |
|
|
|
DEFINE_FIELD( CSkrillex, m_iBravery, FIELD_INTEGER ), |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
DEFINE_ARRAY( CSkrillex, m_pBeam, FIELD_CLASSPTR, ISLAVE_MAX_BEAMS ), |
|
|
|
|
|
|
|
DEFINE_FIELD( CSkrillex, m_iBeams, FIELD_INTEGER ), |
|
|
|
|
|
|
|
DEFINE_FIELD( CSkrillex, m_flNextAttack, FIELD_TIME ), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFINE_FIELD( CSkrillex, m_voicePitch, FIELD_INTEGER ), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFINE_FIELD( CSkrillex, m_hDead, FIELD_EHANDLE ), |
|
|
|
|
|
|
|
|
|
|
|
const char *CSkrillex::pAttackMissSounds[] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"skrillex/fire.wav", |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const char *CSkrillex::pAttackSounds[] = |
|
|
|
IMPLEMENT_SAVERESTORE( CSkrillex, CSquadMonster ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *CSkrillex::pAttackHitSounds[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
"skrillex/fire.wav", |
|
|
|
"skrillex/charge.wav", |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const char *CSkrillex::pIdleSounds[] = |
|
|
|
const char *CSkrillex::pAttackMissSounds[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
"turret/tu_alert.wav", |
|
|
|
"skrillex/charge.wav", |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const char *CSkrillex::pAlertSounds[] = |
|
|
|
const char *CSkrillex::pPainSounds[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
"turret/tu_alert.wav", |
|
|
|
"aslave/slv_null.wav", |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const char *CSkrillex::pPainSounds[] = |
|
|
|
const char *CSkrillex::pDeathSounds[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
"turret/tu_alert.wav", |
|
|
|
"aslave/slv_null.wav", |
|
|
|
|
|
|
|
"aslave/slv_null.wav", |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
@ -102,152 +136,327 @@ const char *CSkrillex::pPainSounds[] = |
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
int CSkrillex::Classify( void ) |
|
|
|
int CSkrillex::Classify( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return CLASS_ALIEN_MONSTER; |
|
|
|
return CLASS_ALIEN_MILITARY; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
int CSkrillex::IRelationship( CBaseEntity *pTarget ) |
|
|
|
// SetYawSpeed - allows each sequence to have a different
|
|
|
|
|
|
|
|
// turn rate associated with it.
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::SetYawSpeed( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
int ys; |
|
|
|
if( ( pTarget->IsPlayer() ) ) |
|
|
|
|
|
|
|
if( ( pev->spawnflags & SF_MONSTER_WAIT_UNTIL_PROVOKED ) && ! ( m_afMemory & bits_MEMORY_PROVOKED ) ) |
|
|
|
|
|
|
|
return R_NO; |
|
|
|
|
|
|
|
return CBaseMonster::IRelationship( pTarget ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ys = 120; |
|
|
|
void CSkrillex::CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ) |
|
|
|
#if 0 |
|
|
|
{ |
|
|
|
switch ( m_Activity ) |
|
|
|
// ALERT( at_aiconsole, "help " );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// skip ones not on my netname
|
|
|
|
|
|
|
|
if( FStringNull( pev->netname ) ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CBaseEntity *pEntity = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while( ( pEntity = UTIL_FindEntityByString( pEntity, "netname", STRING( pev->netname ) ) ) != NULL) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
float d = ( pev->origin - pEntity->pev->origin ).Length(); |
|
|
|
|
|
|
|
if( d < flDist ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CBaseMonster *pMonster = pEntity->MyMonsterPointer(); |
|
|
|
|
|
|
|
if( pMonster ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
pMonster->m_afMemory |= bits_MEMORY_PROVOKED; |
|
|
|
|
|
|
|
pMonster->PushEnemy( hEnemy, vecLocation ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
pev->yaw_speed = ys; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int CSkrillex::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) |
|
|
|
|
|
|
|
|
|
|
|
void CSkrillex::IdleSound( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Take 30% damage from bullets
|
|
|
|
if( RANDOM_LONG( 0, 2 ) == 0 ) |
|
|
|
if( bitsDamageType == DMG_BULLET ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5; |
|
|
|
SENTENCEG_PlayRndSz( ENT( pev ), "SLV_IDLE", 0.85, ATTN_NORM, 0, m_voicePitch ); |
|
|
|
vecDir = vecDir.Normalize(); |
|
|
|
|
|
|
|
float flForce = DamageForce( flDamage ); |
|
|
|
|
|
|
|
pev->velocity = pev->velocity + vecDir * flForce; |
|
|
|
|
|
|
|
flDamage *= 0.3; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if 0 |
|
|
|
// HACK HACK -- until we fix this.
|
|
|
|
int side = RANDOM_LONG( 0, 1 ) * 2 - 1; |
|
|
|
if( IsAlive() ) |
|
|
|
|
|
|
|
PainSound(); |
|
|
|
ClearBeams(); |
|
|
|
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType ); |
|
|
|
ArmBeam( side ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UTIL_MakeAimVectors( pev->angles ); |
|
|
|
|
|
|
|
Vector vecSrc = pev->origin + gpGlobals->v_right * 2 * side; |
|
|
|
|
|
|
|
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc ); |
|
|
|
|
|
|
|
WRITE_BYTE( TE_DLIGHT ); |
|
|
|
|
|
|
|
WRITE_COORD( vecSrc.x ); // X
|
|
|
|
|
|
|
|
WRITE_COORD( vecSrc.y ); // Y
|
|
|
|
|
|
|
|
WRITE_COORD( vecSrc.z ); // Z
|
|
|
|
|
|
|
|
WRITE_BYTE( 8 ); // radius * 0.1
|
|
|
|
|
|
|
|
WRITE_BYTE( 255 ); // r
|
|
|
|
|
|
|
|
WRITE_BYTE( 180 ); // g
|
|
|
|
|
|
|
|
WRITE_BYTE( 96 ); // b
|
|
|
|
|
|
|
|
WRITE_BYTE( 10 ); // time * 10
|
|
|
|
|
|
|
|
WRITE_BYTE( 0 ); // decay * 0.1
|
|
|
|
|
|
|
|
MESSAGE_END(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "debris/flesh1.wav", 1, ATTN_NORM, 0, 100 ); |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CSkrillex::PainSound( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int pitch = 95 + RANDOM_LONG( 0, 9 ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( RANDOM_LONG( 0, 5 ) < 2 ) |
|
|
|
//=========================================================
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch ); |
|
|
|
// ISoundMask - returns a bit mask indicating which types
|
|
|
|
|
|
|
|
// of sounds this monster regards.
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
int CSkrillex::ISoundMask( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return bits_SOUND_WORLD | |
|
|
|
|
|
|
|
bits_SOUND_COMBAT | |
|
|
|
|
|
|
|
bits_SOUND_DANGER | |
|
|
|
|
|
|
|
bits_SOUND_PLAYER; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CSkrillex::AlertSound( void ) |
|
|
|
void CSkrillex::Killed( entvars_t *pevAttacker, int iGib ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int pitch = 95 + RANDOM_LONG( 0, 9 ); |
|
|
|
ClearBeams(); |
|
|
|
|
|
|
|
CSquadMonster::Killed( pevAttacker, iGib ); |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CSkrillex::IdleSound( void ) |
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// SetYawSpeed - allows each sequence to have a different
|
|
|
|
|
|
|
|
// turn rate associated with it.
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::SetYawSpeed( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int pitch = 95 + RANDOM_LONG( 0, 9 ); |
|
|
|
int ys; |
|
|
|
|
|
|
|
|
|
|
|
// Play a random idle sound
|
|
|
|
switch( m_Activity ) |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); |
|
|
|
{ |
|
|
|
|
|
|
|
case ACT_WALK: |
|
|
|
|
|
|
|
ys = 50; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case ACT_RUN: |
|
|
|
|
|
|
|
ys = 70; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case ACT_IDLE: |
|
|
|
|
|
|
|
ys = 50; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
ys = 90; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CSkrillex::AttackSound( void ) |
|
|
|
pev->yaw_speed = ys; |
|
|
|
{ |
|
|
|
|
|
|
|
// Play a random attack sound
|
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Returns number of events handled, 0 if none.
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
void CSkrillex::HandleAnimEvent( MonsterEvent_t *pEvent ) |
|
|
|
void CSkrillex::HandleAnimEvent( MonsterEvent_t *pEvent ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
// ALERT( at_console, "event %d : %f\n", pEvent->event, pev->frame );
|
|
|
|
switch( pEvent->event ) |
|
|
|
switch( pEvent->event ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case ZOMBIE_AE_ATTACK_RIGHT: |
|
|
|
case ISLAVE_AE_CLAW: |
|
|
|
{ |
|
|
|
{ |
|
|
|
// do stuff for this event.
|
|
|
|
// SOUND HERE!
|
|
|
|
//ALERT( at_console, "Slash right!\n" );
|
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.slaveDmgClaw, DMG_SLASH ); |
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH ); |
|
|
|
|
|
|
|
if( pHurt ) |
|
|
|
if( pHurt ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) |
|
|
|
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pHurt->pev->punchangle.z = -18; |
|
|
|
pHurt->pev->punchangle.z = -18; |
|
|
|
pHurt->pev->punchangle.x = 5; |
|
|
|
pHurt->pev->punchangle.x = 5; |
|
|
|
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// Play a random attack hit sound
|
|
|
|
// Play a random attack hit sound
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5 , 5 ) ); |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Play a random attack miss sound
|
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch ); |
|
|
|
} |
|
|
|
} |
|
|
|
else // Play a random attack miss sound
|
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( RANDOM_LONG( 0, 1 ) ) |
|
|
|
|
|
|
|
AttackSound(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ZOMBIE_AE_ATTACK_LEFT: |
|
|
|
case ISLAVE_AE_CLAWRAKE: |
|
|
|
{ |
|
|
|
{ |
|
|
|
// do stuff for this event.
|
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.slaveDmgClawrake, DMG_SLASH ); |
|
|
|
//ALERT( at_console, "Slash left!\n" );
|
|
|
|
|
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH ); |
|
|
|
|
|
|
|
if( pHurt ) |
|
|
|
if( pHurt ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) |
|
|
|
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pHurt->pev->punchangle.z = 18; |
|
|
|
pHurt->pev->punchangle.z = -18; |
|
|
|
pHurt->pev->punchangle.x = 5; |
|
|
|
pHurt->pev->punchangle.x = 5; |
|
|
|
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 100; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); |
|
|
|
{ |
|
|
|
|
|
|
|
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case ISLAVE_AE_ZAP_POWERUP: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// speed up attack when on hard
|
|
|
|
|
|
|
|
if( g_iSkillLevel == SKILL_HARD ) |
|
|
|
|
|
|
|
pev->framerate = 1.5; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UTIL_MakeAimVectors( pev->angles ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( m_iBeams == 0 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Vector vecSrc = pev->origin + gpGlobals->v_forward * 2; |
|
|
|
|
|
|
|
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc ); |
|
|
|
|
|
|
|
WRITE_BYTE( TE_DLIGHT ); |
|
|
|
|
|
|
|
WRITE_COORD( vecSrc.x ); // X
|
|
|
|
|
|
|
|
WRITE_COORD( vecSrc.y ); // Y
|
|
|
|
|
|
|
|
WRITE_COORD( vecSrc.z ); // Z
|
|
|
|
|
|
|
|
WRITE_BYTE( 12 ); // radius * 0.1
|
|
|
|
|
|
|
|
WRITE_BYTE( 255 ); // r
|
|
|
|
|
|
|
|
WRITE_BYTE( 180 ); // g
|
|
|
|
|
|
|
|
WRITE_BYTE( 96 ); // b
|
|
|
|
|
|
|
|
WRITE_BYTE( 20 / pev->framerate ); // time * 10
|
|
|
|
|
|
|
|
WRITE_BYTE( 0 ); // decay * 0.1
|
|
|
|
|
|
|
|
MESSAGE_END(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if( m_hDead != NULL ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
WackBeam( -1, m_hDead ); |
|
|
|
|
|
|
|
WackBeam( 1, m_hDead ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ArmBeam( -1 ); |
|
|
|
|
|
|
|
ArmBeam( 1 ); |
|
|
|
|
|
|
|
BeamGlow(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( RANDOM_LONG( 0, 1 ) ) |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "skrillex/fire.wav", 1, ATTN_NORM, 0, 100 + m_iBeams * 10 ); |
|
|
|
AttackSound(); |
|
|
|
pev->skin = m_iBeams / 2; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ZOMBIE_AE_ATTACK_BOTH: |
|
|
|
case ISLAVE_AE_ZAP_SHOOT: |
|
|
|
{ |
|
|
|
{ |
|
|
|
// do stuff for this event.
|
|
|
|
ClearBeams(); |
|
|
|
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgBothSlash, DMG_SLASH ); |
|
|
|
|
|
|
|
if( pHurt ) |
|
|
|
if( m_hDead != NULL ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) ) |
|
|
|
Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 ); |
|
|
|
|
|
|
|
TraceResult trace; |
|
|
|
|
|
|
|
UTIL_TraceHull( vecDest, vecDest, dont_ignore_monsters, human_hull, m_hDead->edict(), &trace ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !trace.fStartSolid ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pHurt->pev->punchangle.x = 5; |
|
|
|
CBaseEntity *pNew = Create( "monster_skrillex", m_hDead->pev->origin, m_hDead->pev->angles ); |
|
|
|
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -100; |
|
|
|
CBaseMonster *pNewMonster = pNew->MyMonsterPointer( ); |
|
|
|
|
|
|
|
pNew->pev->spawnflags |= 1; |
|
|
|
|
|
|
|
WackBeam( -1, pNew ); |
|
|
|
|
|
|
|
WackBeam( 1, pNew ); |
|
|
|
|
|
|
|
UTIL_Remove( m_hDead ); |
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
CBaseEntity *pEffect = Create( "test_effect", pNew->Center(), pev->angles ); |
|
|
|
|
|
|
|
pEffect->Use( this, this, USE_ON, 1 ); |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
ClearMultiDamage(); |
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) ); |
|
|
|
|
|
|
|
|
|
|
|
UTIL_MakeAimVectors( pev->angles ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ZapBeam( -1 ); |
|
|
|
|
|
|
|
ZapBeam( 1 ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// STOP_SOUND( ENT( pev ), CHAN_WEAPON, "debris/zap4.wav" );
|
|
|
|
|
|
|
|
ApplyMultiDamage( pev, pev ); |
|
|
|
|
|
|
|
|
|
|
|
if( RANDOM_LONG( 0, 1 ) ) |
|
|
|
m_flNextAttack = gpGlobals->time + RANDOM_FLOAT( 0.5, 4.0 ); |
|
|
|
AttackSound(); |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case ISLAVE_AE_ZAP_DONE: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ClearBeams(); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
CBaseMonster::HandleAnimEvent( pEvent ); |
|
|
|
CSquadMonster::HandleAnimEvent( pEvent ); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// CheckRangeAttack1 - normal beam attack
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
BOOL CSkrillex::CheckRangeAttack1( float flDot, float flDist ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( m_flNextAttack > gpGlobals->time ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return CSquadMonster::CheckRangeAttack1( flDot, flDist ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// CheckRangeAttack2 - check bravery and try to resurect dead comrades
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
BOOL CSkrillex::CheckRangeAttack2( float flDot, float flDist ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( m_flNextAttack > gpGlobals->time ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_hDead = NULL; |
|
|
|
|
|
|
|
m_iBravery = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CBaseEntity *pEntity = NULL; |
|
|
|
|
|
|
|
while( ( pEntity = UTIL_FindEntityByClassname( pEntity, "monster_skrillex" ) ) != NULL ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
TraceResult tr; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UTIL_TraceLine( EyePosition(), pEntity->EyePosition(), ignore_monsters, ENT( pev ), &tr ); |
|
|
|
|
|
|
|
if( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( pEntity->pev->deadflag == DEAD_DEAD ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
float d = ( pev->origin - pEntity->pev->origin ).Length(); |
|
|
|
|
|
|
|
if( d < flDist ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_hDead = pEntity; |
|
|
|
|
|
|
|
flDist = d; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
m_iBravery--; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_iBravery++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if( m_hDead != NULL ) |
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// StartTask
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::StartTask( Task_t *pTask ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ClearBeams(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CSquadMonster::StartTask( pTask ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// Spawn
|
|
|
|
// Spawn
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
@ -261,11 +470,14 @@ void CSkrillex::Spawn() |
|
|
|
pev->solid = SOLID_SLIDEBOX; |
|
|
|
pev->solid = SOLID_SLIDEBOX; |
|
|
|
pev->movetype = MOVETYPE_STEP; |
|
|
|
pev->movetype = MOVETYPE_STEP; |
|
|
|
m_bloodColor = BLOOD_COLOR_RED; |
|
|
|
m_bloodColor = BLOOD_COLOR_RED; |
|
|
|
pev->health = 6000; |
|
|
|
pev->effects = 0; |
|
|
|
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
|
|
|
|
pev->health = 2000; |
|
|
|
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
|
|
|
pev->view_ofs = Vector( 0, 0, 64 );// 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_MonsterState = MONSTERSTATE_NONE; |
|
|
|
m_afCapability = bits_CAP_DOORS_GROUP; |
|
|
|
m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_RANGE_ATTACK2 | bits_CAP_DOORS_GROUP; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_voicePitch = RANDOM_LONG( 85, 110 ); |
|
|
|
|
|
|
|
|
|
|
|
MonsterInit(); |
|
|
|
MonsterInit(); |
|
|
|
} |
|
|
|
} |
|
|
@ -278,6 +490,9 @@ void CSkrillex::Precache() |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
PRECACHE_MODEL( "models/skrillex.mdl" ); |
|
|
|
PRECACHE_MODEL( "models/skrillex.mdl" ); |
|
|
|
|
|
|
|
PRECACHE_MODEL( "sprites/shit.spr" ); |
|
|
|
|
|
|
|
PRECACHE_SOUND( "skrillex/fire.wav" ); |
|
|
|
|
|
|
|
PRECACHE_SOUND( "skrillex/charge.wav" ); |
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ ) |
|
|
|
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ ) |
|
|
|
PRECACHE_SOUND( (char *)pAttackHitSounds[i] ); |
|
|
|
PRECACHE_SOUND( (char *)pAttackHitSounds[i] ); |
|
|
@ -285,43 +500,284 @@ void CSkrillex::Precache() |
|
|
|
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ ) |
|
|
|
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ ) |
|
|
|
PRECACHE_SOUND( (char *)pAttackMissSounds[i] ); |
|
|
|
PRECACHE_SOUND( (char *)pAttackMissSounds[i] ); |
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ ) |
|
|
|
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ ) |
|
|
|
PRECACHE_SOUND( (char *)pAttackSounds[i] ); |
|
|
|
PRECACHE_SOUND((char *)pPainSounds[i] ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < ARRAYSIZE( pDeathSounds ); i++ ) |
|
|
|
|
|
|
|
PRECACHE_SOUND( (char *)pDeathSounds[i] ); |
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ ) |
|
|
|
UTIL_PrecacheOther( "test_effect" ); |
|
|
|
PRECACHE_SOUND( (char *)pIdleSounds[i] ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ ) |
|
|
|
//=========================================================
|
|
|
|
PRECACHE_SOUND( (char *)pAlertSounds[i] ); |
|
|
|
// TakeDamage - get provoked when injured
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ ) |
|
|
|
int CSkrillex::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) |
|
|
|
PRECACHE_SOUND( (char *)pPainSounds[i] ); |
|
|
|
{ |
|
|
|
|
|
|
|
// don't slash one of your own
|
|
|
|
|
|
|
|
if( ( bitsDamageType & DMG_SLASH ) && pevAttacker && IRelationship( Instance( pevAttacker ) ) < R_DL ) |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_afMemory |= bits_MEMORY_PROVOKED; |
|
|
|
|
|
|
|
return CSquadMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSkrillex::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( bitsDamageType & DMG_SHOCK ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CSquadMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
// AI Schedules Specific to this monster
|
|
|
|
// AI Schedules Specific to this monster
|
|
|
|
//=========================================================
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
|
|
|
|
int CSkrillex::IgnoreConditions( void ) |
|
|
|
// primary range attack
|
|
|
|
|
|
|
|
Task_t tlSkrillexAttack1[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
int iIgnore = CBaseMonster::IgnoreConditions(); |
|
|
|
{ TASK_STOP_MOVING, 0 }, |
|
|
|
|
|
|
|
{ TASK_FACE_IDEAL, (float)0 }, |
|
|
|
|
|
|
|
{ TASK_RANGE_ATTACK1, (float)0 }, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if( ( m_Activity == ACT_MELEE_ATTACK1 ) || ( m_Activity == ACT_MELEE_ATTACK1 ) ) |
|
|
|
Schedule_t slSkrillexAttack1[] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
#if 0 |
|
|
|
{ |
|
|
|
if( pev->health < 20 ) |
|
|
|
tlSkrillexAttack1, |
|
|
|
iIgnore |= ( bits_COND_LIGHT_DAMAGE| bits_COND_HEAVY_DAMAGE ); |
|
|
|
ARRAYSIZE ( tlSkrillexAttack1 ), |
|
|
|
else |
|
|
|
bits_COND_CAN_MELEE_ATTACK1 | |
|
|
|
#endif |
|
|
|
bits_COND_HEAR_SOUND | |
|
|
|
if( m_flNextFlinch >= gpGlobals->time ) |
|
|
|
bits_COND_HEAVY_DAMAGE, |
|
|
|
iIgnore |= ( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ); |
|
|
|
|
|
|
|
|
|
|
|
bits_SOUND_DANGER, |
|
|
|
|
|
|
|
"Slave Range Attack1" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFINE_CUSTOM_SCHEDULES( CSkrillex ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
slSkrillexAttack1, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_CUSTOM_SCHEDULES( CSkrillex, CSquadMonster ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
Schedule_t *CSkrillex::GetSchedule( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ClearBeams(); |
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
if( pev->spawnflags ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pev->spawnflags = 0; |
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_RELOAD ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
if( HasConditions( bits_COND_HEAR_SOUND ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CSound *pSound; |
|
|
|
|
|
|
|
pSound = PBestSound(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT( pSound != NULL ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( pSound && ( pSound->m_iType & bits_SOUND_DANGER ) ) |
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_BEST_SOUND ); |
|
|
|
|
|
|
|
if( pSound->m_iType & bits_SOUND_COMBAT ) |
|
|
|
|
|
|
|
m_afMemory |= bits_MEMORY_PROVOKED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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( pev->health < 20 || m_iBravery < 0 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( !HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_failSchedule = SCHED_CHASE_ENEMY; |
|
|
|
|
|
|
|
if( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if( HasConditions( bits_COND_SEE_ENEMY ) && HasConditions( bits_COND_ENEMY_FACING_ME ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// ALERT( at_console, "exposed\n");
|
|
|
|
|
|
|
|
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return CSquadMonster::GetSchedule(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Schedule_t *CSkrillex::GetScheduleOfType( int Type ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch( Type ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case SCHED_FAIL: |
|
|
|
|
|
|
|
if( HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return CSquadMonster::GetScheduleOfType( SCHED_MELEE_ATTACK1 ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case SCHED_RANGE_ATTACK1: |
|
|
|
|
|
|
|
return slSkrillexAttack1; |
|
|
|
|
|
|
|
case SCHED_RANGE_ATTACK2: |
|
|
|
|
|
|
|
return slSkrillexAttack1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return CSquadMonster::GetScheduleOfType( Type ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( ( m_Activity == ACT_SMALL_FLINCH ) || ( m_Activity == ACT_BIG_FLINCH ) ) |
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// ArmBeam - small beam from arm to nearby geometry
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::ArmBeam( int side ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
TraceResult tr; |
|
|
|
|
|
|
|
float flDist = 1.0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( m_iBeams >= ISLAVE_MAX_BEAMS ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UTIL_MakeAimVectors( pev->angles ); |
|
|
|
|
|
|
|
Vector vecSrc = pev->origin + gpGlobals->v_up * 36 + gpGlobals->v_right * side * 16 + gpGlobals->v_forward * 32; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( int i = 0; i < 3; i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( m_flNextFlinch < gpGlobals->time ) |
|
|
|
Vector vecAim = gpGlobals->v_right * side * RANDOM_FLOAT( 0, 1 ) + gpGlobals->v_up * RANDOM_FLOAT( -1, 1 ); |
|
|
|
m_flNextFlinch = gpGlobals->time + ZOMBIE_FLINCH_DELAY; |
|
|
|
TraceResult tr1; |
|
|
|
|
|
|
|
UTIL_TraceLine( vecSrc, vecSrc + vecAim * 512, dont_ignore_monsters, ENT( pev ), &tr1 ); |
|
|
|
|
|
|
|
if( flDist > tr1.flFraction ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tr = tr1; |
|
|
|
|
|
|
|
flDist = tr.flFraction; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Couldn't find anything close enough
|
|
|
|
|
|
|
|
if( flDist == 1.0 ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DecalGunshot( &tr, BULLET_PLAYER_CROWBAR ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/shit.spr", 30 ); |
|
|
|
|
|
|
|
if( !m_pBeam[m_iBeams] ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, entindex() ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 ); |
|
|
|
|
|
|
|
// m_pBeam[m_iBeams]->SetColor( 180, 255, 96 );
|
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetColor( 6, 0, 106 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetBrightness( 64 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetNoise( 80 ); |
|
|
|
|
|
|
|
m_iBeams++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return iIgnore; |
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// BeamGlow - brighten all beams
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::BeamGlow() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int b = m_iBeams * 32; |
|
|
|
|
|
|
|
if( b > 255 ) |
|
|
|
|
|
|
|
b = 255; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( int i = 0; i < m_iBeams; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( m_pBeam[i]->GetBrightness() != 255 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_pBeam[i]->SetBrightness( b ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// WackBeam - regenerate dead colleagues
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::WackBeam( int side, CBaseEntity *pEntity ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Vector vecDest; |
|
|
|
|
|
|
|
float flDist = 1.0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( m_iBeams >= ISLAVE_MAX_BEAMS ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( pEntity == NULL ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/shit.spr", 30 ); |
|
|
|
|
|
|
|
if( !m_pBeam[m_iBeams] ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->PointEntInit( pEntity->Center(), entindex() ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetColor( 0, 5, 196 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetBrightness( 55 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetNoise( 80 ); |
|
|
|
|
|
|
|
m_iBeams++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// ZapBeam - heavy damage directly forward
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::ZapBeam( int side ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Vector vecSrc, vecAim; |
|
|
|
|
|
|
|
TraceResult tr; |
|
|
|
|
|
|
|
CBaseEntity *pEntity; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( m_iBeams >= ISLAVE_MAX_BEAMS ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vecSrc = pev->origin + gpGlobals->v_up * 36; |
|
|
|
|
|
|
|
vecAim = ShootAtEnemy( vecSrc ); |
|
|
|
|
|
|
|
float deflection = 0.01; |
|
|
|
|
|
|
|
vecAim = vecAim + side * gpGlobals->v_right * RANDOM_FLOAT( 0, deflection ) + gpGlobals->v_up * RANDOM_FLOAT( -deflection, deflection ); |
|
|
|
|
|
|
|
UTIL_TraceLine( vecSrc, vecSrc + vecAim * 1024, dont_ignore_monsters, ENT( pev ), &tr ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/shit.spr", 50 ); |
|
|
|
|
|
|
|
if( !m_pBeam[m_iBeams] ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, entindex() ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetColor( 0, 0, 206 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetBrightness( 55 ); |
|
|
|
|
|
|
|
m_pBeam[m_iBeams]->SetNoise( 20 ); |
|
|
|
|
|
|
|
m_iBeams++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pEntity = CBaseEntity::Instance( tr.pHit ); |
|
|
|
|
|
|
|
if( pEntity != NULL && pEntity->pev->takedamage ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pEntity->TraceAttack( pev, gSkillData.slaveDmgZap, vecAim, &tr, DMG_SHOCK ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
// ClearBeams - remove all beams
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
void CSkrillex::ClearBeams() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for( int i = 0; i < ISLAVE_MAX_BEAMS; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( m_pBeam[i] ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UTIL_Remove( m_pBeam[i] ); |
|
|
|
|
|
|
|
m_pBeam[i] = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
m_iBeams = 0; |
|
|
|
|
|
|
|
pev->skin = 0; |
|
|
|
} |
|
|
|
} |
|
|
|