Browse Source

Fixed some monsters sounds

clcampaign
RAINBOW2000 8 years ago
parent
commit
008b8e12d4
  1. 90
      dlls/skeleton.cpp
  2. 248
      dlls/skeleton.cpp~
  3. 1
      dlls/skrillex.cpp
  4. 326
      dlls/skrillex.cpp~
  5. 45
      dlls/sniper.cpp
  6. 85
      dlls/terror.cpp
  7. 54
      dlls/zombozo.cpp
  8. 289
      dlls/zombozo.cpp~

90
dlls/skeleton.cpp

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
//fixed
//No added (Die sounds)
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
@ -12,10 +14,6 @@ @@ -12,10 +14,6 @@
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
//=========================================================
// Zombie
//=========================================================
// UNDONE: Don't flinch every time you get hit
#include "extdll.h"
@ -46,16 +44,9 @@ public: @@ -46,16 +44,9 @@ public:
float m_flNextFlinch;
void PainSound( void );
void AlertSound( void );
void IdleSound( void );
void AttackSound( void );
static const char *pAttackSounds[];
static const char *pIdleSounds[];
static const char *pAlertSounds[];
static const char *pPainSounds[];
static const char *pAttackHitSounds[];
static const char *pAttackMissSounds[];
// No range attacks
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
@ -65,32 +56,6 @@ public: @@ -65,32 +56,6 @@ public:
LINK_ENTITY_TO_CLASS( monster_skeleton, CSkeleton )
const char *CSkeleton::pAttackHitSounds[] =
{
"skeleton/s_pain1.wav",
};
const char *CSkeleton::pAttackMissSounds[] =
{
"turret/tu_alert.wav",
};
const char *CSkeleton::pAttackSounds[] =
{
"turret/tu_alert.wav",
};
const char *CSkeleton::pIdleSounds[] =
{
"skeleton/s_die1.wav",
"skeleton/s_die2.wav",
"skeleton/s_die3.wav",
};
const char *CSkeleton::pAlertSounds[] =
{
"turret/tu_alert.wav",
};
const char *CSkeleton::pPainSounds[] =
{
@ -150,26 +115,7 @@ void CSkeleton::PainSound( void ) @@ -150,26 +115,7 @@ void CSkeleton::PainSound( void )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
}
void CSkeleton::AlertSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
}
void CSkeleton::IdleSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
// Play a random idle sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
void CSkeleton::AttackSound( void )
{
// 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
@ -192,14 +138,10 @@ void CSkeleton::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -192,14 +138,10 @@ void CSkeleton::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
}
// 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 ) );
}
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;
case ZOMBIE_AE_ATTACK_LEFT:
@ -215,13 +157,9 @@ void CSkeleton::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -215,13 +157,9 @@ void CSkeleton::HandleAnimEvent( MonsterEvent_t *pEvent )
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 ) );
}
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 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
}
break;
case ZOMBIE_AE_ATTACK_BOTH:
@ -235,13 +173,10 @@ void CSkeleton::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -235,13 +173,10 @@ void CSkeleton::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -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 ) );
}
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 ) );
\
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
}
break;
default:
@ -281,21 +216,6 @@ void CSkeleton::Precache() @@ -281,21 +216,6 @@ void CSkeleton::Precache()
PRECACHE_MODEL( "models/skellington.mdl" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( (char *)pIdleSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( (char *)pAlertSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( (char *)pPainSounds[i] );
}

248
dlls/skeleton.cpp~

@ -0,0 +1,248 @@ @@ -0,0 +1,248 @@
//No added (Die sounds)
/***
*
* 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.
*
****/
// UNDONE: Don't flinch every time you get hit
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
#define ZOMBIE_AE_ATTACK_RIGHT 0x01
#define ZOMBIE_AE_ATTACK_LEFT 0x02
#define ZOMBIE_AE_ATTACK_BOTH 0x03
#define ZOMBIE_FLINCH_DELAY 2 // at most one flinch every n secs
class CSkeleton : public CBaseMonster
{
public:
void Spawn( void );
void Precache( void );
void SetYawSpeed( void );
int Classify( void );
void HandleAnimEvent( MonsterEvent_t *pEvent );
int IgnoreConditions( void );
float m_flNextFlinch;
void PainSound( void );
static const char *pPainSounds[];
// No range attacks
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_skeleton, CSkeleton )
const char *CSkeleton::pPainSounds[] =
{
"skeleton/s_pain1.wav",
"skeleton/s_pain2.wav",
"sleletons/s_pain3.wav"
};
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int CSkeleton::Classify( void )
{
return CLASS_ALIEN_MONSTER;
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
void CSkeleton::SetYawSpeed( void )
{
int ys;
ys = 120;
#if 0
switch ( m_Activity )
{
}
#endif
pev->yaw_speed = ys;
}
int CSkeleton::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,float flDamage, int bitsDamageType )
{
// Take 30% damage from bullets
if( bitsDamageType == DMG_BULLET )
{
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
vecDir = vecDir.Normalize();
float flForce = DamageForce( 0 );
pev->velocity = pev->velocity + vecDir * flForce;
}
// HACK HACK -- until we fix this.
if( IsAlive() )
PainSound();
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker,flDamage, bitsDamageType);
}
void CSkeleton::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 );
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void CSkeleton::HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
{
case ZOMBIE_AE_ATTACK_RIGHT:
{
// do stuff for this event.
//ALERT( at_console, "Slash right!\n" );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
}
}
else // Play a random attack miss sound
if( RANDOM_LONG( 0, 1 ) )
}
break;
case ZOMBIE_AE_ATTACK_LEFT:
{
// do stuff for this event.
//ALERT( at_console, "Slash left!\n" );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.z = 18;
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 100;
}
}
else
if( RANDOM_LONG( 0, 1 ) )
}
break;
case ZOMBIE_AE_ATTACK_BOTH:
{
// do stuff for this event.
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgBothSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -100;
}
}
else
\
if( RANDOM_LONG( 0, 1 ) )
}
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
//=========================================================
// Spawn
//=========================================================
void CSkeleton::Spawn()
{
Precache();
SET_MODEL( ENT(pev), "models/skellington.mdl" );
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
pev->health = 80;
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
m_bloodColor = DONT_BLEED;
m_flFieldOfView = 0;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
m_afCapability = bits_CAP_DOORS_GROUP;
MonsterInit();
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
void CSkeleton::Precache()
{
int i;
PRECACHE_MODEL( "models/skellington.mdl" );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( (char *)pPainSounds[i] );
}
//=========================================================
// AI Schedules Specific to this monster
//=========================================================
int CSkeleton::IgnoreConditions( void )
{
int iIgnore = CBaseMonster::IgnoreConditions();
if( ( m_Activity == ACT_MELEE_ATTACK1 ) || ( m_Activity == ACT_MELEE_ATTACK1 ) )
{
#if 0
if( pev->health < 20 )
iIgnore |= ( bits_COND_LIGHT_DAMAGE| bits_COND_HEAVY_DAMAGE );
else
#endif
if( m_flNextFlinch >= gpGlobals->time )
iIgnore |= ( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE );
}
if( ( m_Activity == ACT_SMALL_FLINCH ) || ( m_Activity == ACT_BIG_FLINCH ) )
{
if( m_flNextFlinch < gpGlobals->time )
m_flNextFlinch = gpGlobals->time + ZOMBIE_FLINCH_DELAY;
}
return iIgnore;
}

1
dlls/skrillex.cpp

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
//This will be remake
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.

326
dlls/skrillex.cpp~

@ -0,0 +1,326 @@ @@ -0,0 +1,326 @@
/***
*
* 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.
*
****/
//=========================================================
// Zombie
//=========================================================
// UNDONE: Don't flinch every time you get hit
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
#define ZOMBIE_AE_ATTACK_RIGHT 0x01
#define ZOMBIE_AE_ATTACK_LEFT 0x02
#define ZOMBIE_AE_ATTACK_BOTH 0x03
#define ZOMBIE_FLINCH_DELAY 2 // at most one flinch every n secs
class CSkrillex : public CBaseMonster
{
public:
void Spawn( void );
void Precache( void );
void SetYawSpeed( void );
int Classify( void );
void HandleAnimEvent( MonsterEvent_t *pEvent );
int IgnoreConditions( void );
float m_flNextFlinch;
void PainSound( void );
void AlertSound( void );
void IdleSound( void );
void AttackSound( void );
static const char *pAttackSounds[];
static const char *pIdleSounds[];
static const char *pAlertSounds[];
static const char *pPainSounds[];
static const char *pAttackHitSounds[];
static const char *pAttackMissSounds[];
// No range attacks
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 )
const char *CSkrillex::pAttackHitSounds[] =
{
"skrillex/fire.wav",
};
const char *CSkrillex::pAttackMissSounds[] =
{
"skrillex/fire.wav",
};
const char *CSkrillex::pAttackSounds[] =
{
"skrillex/fire.wav",
};
const char *CSkrillex::pIdleSounds[] =
{
"turret/tu_alert.wav",
};
const char *CSkrillex::pAlertSounds[] =
{
"turret/tu_alert.wav",
};
const char *CSkrillex::pPainSounds[] =
{
"turret/tu_alert.wav",
};
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int CSkrillex::Classify( void )
{
return CLASS_ALIEN_MONSTER;
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
void CSkrillex::SetYawSpeed( void )
{
int ys;
ys = 120;
#if 0
switch ( m_Activity )
{
}
#endif
pev->yaw_speed = ys;
}
int CSkrillex::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
// Take 30% damage from bullets
if( bitsDamageType == DMG_BULLET )
{
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
vecDir = vecDir.Normalize();
float flForce = DamageForce( flDamage );
pev->velocity = pev->velocity + vecDir * flForce;
flDamage *= 0.3;
}
// HACK HACK -- until we fix this.
if( IsAlive() )
PainSound();
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
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 );
}
void CSkrillex::AlertSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
}
void CSkrillex::IdleSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
// Play a random idle sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
void CSkrillex::AttackSound( void )
{
// 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
// that occur when tagged animation frames are played.
//=========================================================
void CSkrillex::HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
{
case ZOMBIE_AE_ATTACK_RIGHT:
{
// do stuff for this event.
//ALERT( at_console, "Slash right!\n" );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
}
// 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 ) );
}
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;
case ZOMBIE_AE_ATTACK_LEFT:
{
// do stuff for this event.
//ALERT( at_console, "Slash left!\n" );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.z = 18;
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 ) );
}
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 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
}
break;
case ZOMBIE_AE_ATTACK_BOTH:
{
// do stuff for this event.
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgBothSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -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 ) );
}
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 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
}
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
//=========================================================
// Spawn
//=========================================================
void CSkrillex::Spawn()
{
Precache();
SET_MODEL( ENT(pev), "models/skrillex.mdl" );
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_RED;
pev->health = 6000;
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
m_afCapability = bits_CAP_DOORS_GROUP;
MonsterInit();
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
void CSkrillex::Precache()
{
int i;
PRECACHE_MODEL( "models/skrillex.mdl" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( (char *)pIdleSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( (char *)pAlertSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( (char *)pPainSounds[i] );
}
//=========================================================
// AI Schedules Specific to this monster
//=========================================================
int CSkrillex::IgnoreConditions( void )
{
int iIgnore = CBaseMonster::IgnoreConditions();
if( ( m_Activity == ACT_MELEE_ATTACK1 ) || ( m_Activity == ACT_MELEE_ATTACK1 ) )
{
#if 0
if( pev->health < 20 )
iIgnore |= ( bits_COND_LIGHT_DAMAGE| bits_COND_HEAVY_DAMAGE );
else
#endif
if( m_flNextFlinch >= gpGlobals->time )
iIgnore |= ( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE );
}
if( ( m_Activity == ACT_SMALL_FLINCH ) || ( m_Activity == ACT_BIG_FLINCH ) )
{
if( m_flNextFlinch < gpGlobals->time )
m_flNextFlinch = gpGlobals->time + ZOMBIE_FLINCH_DELAY;
}
return iIgnore;
}

45
dlls/sniper.cpp

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
//fixed (maybe)
#if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD )
#include "extdll.h"
@ -69,13 +70,14 @@ PRECACHE_MODEL("models/v_sniper.mdl"); @@ -69,13 +70,14 @@ PRECACHE_MODEL("models/v_sniper.mdl");
PRECACHE_MODEL("models/w_sniper.mdl");
PRECACHE_MODEL("models/p_sniper.mdl");
PRECACHE_MODEL("models/w_sniper_clip.mdl");
PRECACHE_MODEL("models/w_357ammo.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
PRECACHE_SOUND ("weapons/sniper_cock1.wav");
PRECACHE_SOUND ("weapons/sniper_fire1.wav");
PRECACHE_SOUND ("weapons/sniper_zoomout.wav");
PRECACHE_SOUND ("weapons/sniper_zoomin.wav");
PRECACHE_SOUND ("weapons/sniper_shoot1.wav");
PRECACHE_SOUND ("weapons/sniper_shoot2.wav");
PRECACHE_SOUND ("weapons/sniper_shoot3.wav");
PRECACHE_SOUND ("weapons/sniper_shoot4.wav");
PRECACHE_SOUND ("weapons/sniper_shoot5.wav");
m_usFireSniper = PRECACHE_EVENT( 1, "events/glock2.sc" );
}
@ -104,22 +106,43 @@ if ( m_pPlayer->pev->fov != 0 ) @@ -104,22 +106,43 @@ if ( m_pPlayer->pev->fov != 0 )
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0;
m_fInZoom = 0;
#ifndef CLIENT_DLL UTIL_ScreenFade( m_pPlayer, Vector(0,0,0), 0.5, 0.25, 255, FFADE_IN );
#endif EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/sniper_zoomout.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
#endif
}
else if ( m_pPlayer->pev->fov != 15 )
{
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 15;
m_fInZoom = 1;
#ifndef CLIENT_DLL UTIL_ScreenFade( m_pPlayer, Vector(0,0,0), 0.5, 0.25, 255, FFADE_IN );
#endif EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/sniper_zoomin.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
#endif
}
pev->nextthink = UTIL_WeaponTimeBase() + 0.1;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
}
void CSnipars::PrimaryAttack( void )
{
Shoot( 0.0001, 1.5, TRUE );
{
if(m_iClip > 0)
{
Shoot( 0.0001, 1.5, TRUE );
switch( RANDOM_LONG( 0, 3 ) )
{
case 0:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/sniper_shoot1.wav", 1, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/sniper_shoot2.wav", 1, ATTN_NORM );
break;
case 2:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/sniper_shoot3.wav", 1, ATTN_NORM );
break;
case 3:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/sniper_shoot4.wav", 1, ATTN_NORM );
break;
case 4:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/sniper_shoot5.wav", 1, ATTN_NORM );
break;
};
}
}
void CSnipars::Shoot( float flSpread , float flCycleTime, BOOL fUseAutoAim )
@ -133,7 +156,6 @@ if (m_iClip <= 0) @@ -133,7 +156,6 @@ if (m_iClip <= 0)
{
if (m_fFireOnEmpty)
{
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/sniper_cock1.wav", 0.8, ATTN_NORM);
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
}
return;
@ -175,7 +197,6 @@ PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireSniper : m @@ -175,7 +197,6 @@ PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireSniper : m
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime;
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}
@ -233,7 +254,7 @@ CBasePlayerAmmo::Spawn( ); @@ -233,7 +254,7 @@ CBasePlayerAmmo::Spawn( );
}
void Precache( void )
{
PRECACHE_MODEL ("models/w_sniper.mdl");
PRECACHE_MODEL ("models/w_357ammo.mdl");
PRECACHE_SOUND("items/9mmclip1.wav");
}
BOOL AddAmmo( CBaseEntity *pOther )

85
dlls/terror.cpp

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
//Allready fixed
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
@ -12,12 +13,6 @@ @@ -12,12 +13,6 @@
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
//=========================================================
// Zombie
//=========================================================
// UNDONE: Don't flinch every time you get hit
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -46,17 +41,9 @@ public: @@ -46,17 +41,9 @@ public:
float m_flNextFlinch;
void PainSound( void );
void AlertSound( void );
void IdleSound( void );
void AttackSound( void );
static const char *pAttackSounds[];
static const char *pIdleSounds[];
static const char *pAlertSounds[];
static const char *pPainSounds[];
static const char *pAttackHitSounds[];
static const char *pAttackMissSounds[];
// No range attacks
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
@ -66,35 +53,12 @@ public: @@ -66,35 +53,12 @@ public:
LINK_ENTITY_TO_CLASS( monster_terror, CTerror )
const char *CTerror::pAttackHitSounds[] =
{
"turret/tu_alert.wav",
};
const char *CTerror::pAttackMissSounds[] =
{
"turret/tu_alert.wav",
};
const char *CTerror::pAttackSounds[] =
{
"terror/allahuakbar.wav",
};
const char *CTerror::pIdleSounds[] =
{
"turret/tu_alert.wav",
"terror/allahuakbar.wav",
};
const char *CTerror::pAlertSounds[] =
{
"turret/tu_alert.wav",
};
const char *CTerror::pPainSounds[] =
{
"turret/tu_alert.wav",
};
//=========================================================
// Classify - indicates this monster's place in the
@ -136,24 +100,9 @@ int CTerror::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float @@ -136,24 +100,9 @@ int CTerror::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
// HACK HACK -- until we fix this.
if( IsAlive() )
PainSound();
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void CTerror::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 );
}
void CTerror::AlertSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
}
void CTerror::IdleSound( void )
{
@ -163,11 +112,6 @@ void CTerror::IdleSound( void ) @@ -163,11 +112,6 @@ void CTerror::IdleSound( void )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
void CTerror::AttackSound( void )
{
// 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 ) );
}
void CTerror::HandleAnimEvent( MonsterEvent_t *pEvent )
{
@ -175,21 +119,17 @@ void CTerror::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -175,21 +119,17 @@ void CTerror::HandleAnimEvent( MonsterEvent_t *pEvent )
{
case ZOMBIE_AE_ATTACK_RIGHT:
{
ExplosionCreate(pev->origin ,pev->origin ,edict() ,50 , true );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
ExplosionCreate(pev->origin ,pev->origin ,edict() ,60 , true );
}
break;
case ZOMBIE_AE_ATTACK_LEFT:
{
ExplosionCreate(pev->origin ,pev->origin,edict() ,50 , true );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
ExplosionCreate(pev->origin ,pev->origin,edict() ,60 , true );
}
break;
case ZOMBIE_AE_ATTACK_BOTH:
{
ExplosionCreate(pev->origin ,pev->origin,edict() ,50, true);
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
ExplosionCreate(pev->origin ,pev->origin,edict() ,60, true);
}
break;
default:
@ -227,23 +167,8 @@ void CTerror::Precache() @@ -227,23 +167,8 @@ void CTerror::Precache()
PRECACHE_MODEL( "models/terror.mdl" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( (char *)pIdleSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( (char *)pAlertSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( (char *)pPainSounds[i] );
}
//=========================================================

54
dlls/zombozo.cpp

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
//Already Fixed
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
@ -48,14 +49,11 @@ public: @@ -48,14 +49,11 @@ public:
void PainSound( void );
void AlertSound( void );
void IdleSound( void );
void AttackSound( void );
static const char *pAttackSounds[];
static const char *pIdleSounds[];
static const char *pAlertSounds[];
static const char *pPainSounds[];
static const char *pAttackHitSounds[];
static const char *pAttackMissSounds[];
// No range attacks
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
@ -65,20 +63,7 @@ public: @@ -65,20 +63,7 @@ public:
LINK_ENTITY_TO_CLASS( monster_zombozo,Czombozo )
const char *Czombozo::pAttackHitSounds[] =
{
"turret/tu_alert.wav",
};
const char *Czombozo::pAttackMissSounds[] =
{
"turret/tu_alert.wav",
};
const char *Czombozo::pAttackSounds[] =
{
"turret/tu_alert.wav",
};
const char *Czombozo::pIdleSounds[] =
{
@ -165,11 +150,7 @@ void Czombozo::IdleSound( void ) @@ -165,11 +150,7 @@ void Czombozo::IdleSound( void )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
void Czombozo::AttackSound( void )
{
// 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
@ -192,14 +173,9 @@ void Czombozo::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -192,14 +173,9 @@ void Czombozo::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
}
// 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 ) );
}
}
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;
case ZOMBIE_AE_ATTACK_LEFT:
@ -215,13 +191,9 @@ void Czombozo::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -215,13 +191,9 @@ void Czombozo::HandleAnimEvent( MonsterEvent_t *pEvent )
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 ) );
}
l }
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 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
}
break;
case ZOMBIE_AE_ATTACK_BOTH:
@ -235,13 +207,10 @@ void Czombozo::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -235,13 +207,10 @@ void Czombozo::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -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 ) );
}
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 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
}
break;
default:
@ -263,7 +232,7 @@ void Czombozo::Spawn() @@ -263,7 +232,7 @@ void Czombozo::Spawn()
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->health = 1500;
pev->health = 500;
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
@ -281,15 +250,6 @@ void Czombozo::Precache() @@ -281,15 +250,6 @@ void Czombozo::Precache()
PRECACHE_MODEL( "models/zombozo.mdl" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( (char *)pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( (char *)pIdleSounds[i] );

289
dlls/zombozo.cpp~

@ -0,0 +1,289 @@ @@ -0,0 +1,289 @@
//Already Fixed
/***
*
* 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.
*
****/
//=========================================================
// Zombie
//=========================================================
// UNDONE: Don't flinch every time you get hit
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
#define ZOMBIE_AE_ATTACK_RIGHT 0x01
#define ZOMBIE_AE_ATTACK_LEFT 0x02
#define ZOMBIE_AE_ATTACK_BOTH 0x03
#define ZOMBIE_FLINCH_DELAY 2 // at most one flinch every n secs
class Czombozo : public CBaseMonster
{
public:
void Spawn( void );
void Precache( void );
void SetYawSpeed( void );
int Classify( void );
void HandleAnimEvent( MonsterEvent_t *pEvent );
int IgnoreConditions( void );
float m_flNextFlinch;
void PainSound( void );
void AlertSound( void );
void IdleSound( void );
static const char *pIdleSounds[];
static const char *pAlertSounds[];
static const char *pPainSounds[];
// No range attacks
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_zombozo,Czombozo )
const char *Czombozo::pIdleSounds[] =
{
"zombozo/idle.wav"
};
const char *Czombozo::pAlertSounds[] =
{
"zombozo/alert1.wav",
"zombozo/alert2.wav",
};
const char *Czombozo::pPainSounds[] =
{
"zombozo/death1.wav",
"zombozo/death2.wav",
"zombozo/death3.wav",
};
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int Czombozo::Classify( void )
{
return CLASS_ALIEN_MONSTER;
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
void Czombozo::SetYawSpeed( void )
{
int ys;
ys = 120;
#if 0
switch ( m_Activity )
{
}
#endif
pev->yaw_speed = ys;
}
int Czombozo::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
// Take 30% damage from bullets
if( bitsDamageType == DMG_BULLET )
{
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
vecDir = vecDir.Normalize();
float flForce = DamageForce( flDamage );
pev->velocity = pev->velocity + vecDir * flForce;
flDamage *= 0.3;
}
// HACK HACK -- until we fix this.
if( IsAlive() )
PainSound();
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
void Czombozo::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 );
}
void Czombozo::AlertSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
}
void Czombozo::IdleSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
// Play a random idle sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void Czombozo::HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
{
case ZOMBIE_AE_ATTACK_RIGHT:
{
// do stuff for this event.
//ALERT( at_console, "Slash right!\n" );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
}
}
else // Play a random attack miss sound
if( RANDOM_LONG( 0, 1 ) )
}
break;
case ZOMBIE_AE_ATTACK_LEFT:
{
// do stuff for this event.
//ALERT( at_console, "Slash left!\n" );
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgOneSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.z = 18;
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 100;
}
l }
else
if( RANDOM_LONG( 0, 1 ) )
}
break;
case ZOMBIE_AE_ATTACK_BOTH:
{
// do stuff for this event.
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.zombieDmgBothSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
{
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -100;
}
}
else
if( RANDOM_LONG( 0, 1 ) )
}
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
//=========================================================
// Spawn
//=========================================================
void Czombozo::Spawn()
{
Precache();
SET_MODEL( ENT(pev), "models/zombozo.mdl" );
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->health = 1500;
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
m_afCapability = bits_CAP_DOORS_GROUP;
MonsterInit();
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
void Czombozo::Precache()
{
int i;
PRECACHE_MODEL( "models/zombozo.mdl" );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( (char *)pIdleSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( (char *)pAlertSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( (char *)pPainSounds[i] );
}
//=========================================================
// AI Schedules Specific to this monster
//=========================================================
int Czombozo::IgnoreConditions( void )
{
int iIgnore = CBaseMonster::IgnoreConditions();
if( ( m_Activity == ACT_MELEE_ATTACK1 ) || ( m_Activity == ACT_MELEE_ATTACK1 ) )
{
#if 0
if( pev->health < 20 )
iIgnore |= ( bits_COND_LIGHT_DAMAGE| bits_COND_HEAVY_DAMAGE );
else
#endif
if( m_flNextFlinch >= gpGlobals->time )
iIgnore |= ( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE );
}
if( ( m_Activity == ACT_SMALL_FLINCH ) || ( m_Activity == ACT_BIG_FLINCH ) )
{
if( m_flNextFlinch < gpGlobals->time )
m_flNextFlinch = gpGlobals->time + ZOMBIE_FLINCH_DELAY;
}
return iIgnore;
}
Loading…
Cancel
Save