Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
5.5 KiB

9 years ago
/***
*
* 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.
*
****/
//=========================================================
// Bloater
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
#define BLOATER_AE_ATTACK_MELEE1 0x01
class CBloater : public CBaseMonster
{
public:
void Spawn( void );
void Precache( void );
void SetYawSpeed( void );
9 years ago
int Classify( void );
9 years ago
void HandleAnimEvent( MonsterEvent_t *pEvent );
void PainSound( void );
void AlertSound( void );
void IdleSound( void );
void AttackSnd( void );
// No range attacks
9 years ago
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
BOOL CheckRangeAttack2( float flDot, float flDist ) { return FALSE; }
9 years ago
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
};
LINK_ENTITY_TO_CLASS( monster_bloater, CBloater )
9 years ago
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
9 years ago
int CBloater::Classify( void )
9 years ago
{
9 years ago
return CLASS_ALIEN_MONSTER;
9 years ago
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
9 years ago
void CBloater::SetYawSpeed( void )
9 years ago
{
int ys;
ys = 120;
#if 0
9 years ago
switch( m_Activity )
9 years ago
{
}
#endif
pev->yaw_speed = ys;
}
9 years ago
int CBloater::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
9 years ago
{
PainSound();
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
9 years ago
void CBloater::PainSound( void )
9 years ago
{
#if 0
9 years ago
int pitch = 95 + RANDOM_LONG( 0, 9 );
9 years ago
9 years ago
switch( RANDOM_LONG( 0, 5 ) )
9 years ago
{
case 0:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_pain1.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
case 1:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_pain2.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
default:
break;
}
#endif
}
9 years ago
void CBloater::AlertSound( void )
9 years ago
{
#if 0
9 years ago
int pitch = 95 + RANDOM_LONG( 0, 9 );
9 years ago
9 years ago
switch( RANDOM_LONG( 0, 2 ) )
9 years ago
{
case 0:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_alert10.wav", 1.0, ATTN_NORM, 0, pitch );
break;
9 years ago
case 1:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_alert20.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
case 2:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_alert30.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
}
#endif
}
9 years ago
void CBloater::IdleSound( void )
9 years ago
{
#if 0
9 years ago
int pitch = 95 + RANDOM_LONG( 0, 9 );
9 years ago
9 years ago
switch( RANDOM_LONG( 0, 2 ) )
9 years ago
{
case 0:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_idle1.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
case 1:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_idle2.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
case 2:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_idle3.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
}
#endif
}
9 years ago
void CBloater::AttackSnd( void )
9 years ago
{
#if 0
9 years ago
int pitch = 95 + RANDOM_LONG( 0, 9 );
9 years ago
9 years ago
switch( RANDOM_LONG( 0, 1 ) )
9 years ago
{
case 0:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_attack1.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
case 1:
9 years ago
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_attack2.wav", 1.0, ATTN_NORM, 0, pitch );
9 years ago
break;
}
#endif
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
9 years ago
void CBloater::HandleAnimEvent( MonsterEvent_t *pEvent )
9 years ago
{
switch( pEvent->event )
{
case BLOATER_AE_ATTACK_MELEE1:
{
// do stuff for this event.
AttackSnd();
}
break;
9 years ago
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
//=========================================================
// Spawn
//=========================================================
9 years ago
void CBloater::Spawn()
9 years ago
{
9 years ago
Precache();
9 years ago
9 years ago
SET_MODEL( ENT( pev ), "models/floater.mdl" );
9 years ago
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
9 years ago
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_FLY;
pev->spawnflags |= FL_FLY;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->health = 40;
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;
9 years ago
MonsterInit();
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
9 years ago
void CBloater::Precache()
9 years ago
{
9 years ago
PRECACHE_MODEL( "models/floater.mdl" );
9 years ago
}
//=========================================================
// AI Schedules Specific to this monster
//=========================================================