2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-16 23:19:49 +01:00
hlsdk-xash3d/dlls/bloater.cpp

213 lines
5.5 KiB
C++
Raw Normal View History

2016-06-04 15:24:23 +02:00
/***
*
* 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 );
2016-07-31 15:48:50 +02:00
int Classify( void );
2016-06-04 15:24:23 +02:00
void HandleAnimEvent( MonsterEvent_t *pEvent );
void PainSound( void );
void AlertSound( void );
void IdleSound( void );
void AttackSnd( void );
// No range attacks
2016-07-31 15:48:50 +02:00
BOOL CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
BOOL CheckRangeAttack2( float flDot, float flDist ) { return FALSE; }
2016-06-04 15:24:23 +02:00
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
};
LINK_ENTITY_TO_CLASS( monster_bloater, CBloater )
2016-06-04 15:24:23 +02:00
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
2016-07-31 15:48:50 +02:00
int CBloater::Classify( void )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
return CLASS_ALIEN_MONSTER;
2016-06-04 15:24:23 +02:00
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
2016-07-31 15:48:50 +02:00
void CBloater::SetYawSpeed( void )
2016-06-04 15:24:23 +02:00
{
int ys;
ys = 120;
#if 0
2016-07-31 15:48:50 +02:00
switch( m_Activity )
2016-06-04 15:24:23 +02:00
{
}
#endif
pev->yaw_speed = ys;
}
2016-07-31 15:48:50 +02:00
int CBloater::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
2016-06-04 15:24:23 +02:00
{
PainSound();
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
}
2016-07-31 15:48:50 +02:00
void CBloater::PainSound( void )
2016-06-04 15:24:23 +02:00
{
#if 0
2016-07-31 15:48:50 +02:00
int pitch = 95 + RANDOM_LONG( 0, 9 );
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
switch( RANDOM_LONG( 0, 5 ) )
2016-06-04 15:24:23 +02:00
{
case 0:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_pain1.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
case 1:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_pain2.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
default:
break;
}
#endif
}
2016-07-31 15:48:50 +02:00
void CBloater::AlertSound( void )
2016-06-04 15:24:23 +02:00
{
#if 0
2016-07-31 15:48:50 +02:00
int pitch = 95 + RANDOM_LONG( 0, 9 );
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
switch( RANDOM_LONG( 0, 2 ) )
2016-06-04 15:24:23 +02:00
{
case 0:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_alert10.wav", 1.0, ATTN_NORM, 0, pitch );
break;
2016-06-04 15:24:23 +02:00
case 1:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_alert20.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
case 2:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_alert30.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
}
#endif
}
2016-07-31 15:48:50 +02:00
void CBloater::IdleSound( void )
2016-06-04 15:24:23 +02:00
{
#if 0
2016-07-31 15:48:50 +02:00
int pitch = 95 + RANDOM_LONG( 0, 9 );
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
switch( RANDOM_LONG( 0, 2 ) )
2016-06-04 15:24:23 +02:00
{
case 0:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_idle1.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
case 1:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_idle2.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
case 2:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_idle3.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
}
#endif
}
2016-07-31 15:48:50 +02:00
void CBloater::AttackSnd( void )
2016-06-04 15:24:23 +02:00
{
#if 0
2016-07-31 15:48:50 +02:00
int pitch = 95 + RANDOM_LONG( 0, 9 );
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
switch( RANDOM_LONG( 0, 1 ) )
2016-06-04 15:24:23 +02:00
{
case 0:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_attack1.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
case 1:
2016-07-31 15:48:50 +02:00
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "zombie/zo_attack2.wav", 1.0, ATTN_NORM, 0, pitch );
2016-06-04 15:24:23 +02:00
break;
}
#endif
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
2016-07-31 15:48:50 +02:00
void CBloater::HandleAnimEvent( MonsterEvent_t *pEvent )
2016-06-04 15:24:23 +02:00
{
switch( pEvent->event )
{
case BLOATER_AE_ATTACK_MELEE1:
{
// do stuff for this event.
AttackSnd();
}
break;
2016-06-04 15:24:23 +02:00
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
//=========================================================
// Spawn
//=========================================================
2016-07-31 15:48:50 +02:00
void CBloater::Spawn()
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
Precache();
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
SET_MODEL( ENT( pev ), "models/floater.mdl" );
2016-06-04 15:24:23 +02:00
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
2016-07-31 15:48:50 +02:00
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;
2016-06-04 15:24:23 +02:00
MonsterInit();
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
2016-07-31 15:48:50 +02:00
void CBloater::Precache()
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
PRECACHE_MODEL( "models/floater.mdl" );
2016-06-04 15:24:23 +02:00
}
//=========================================================
// AI Schedules Specific to this monster
//=========================================================