mirror of
https://github.com/ENSL/NS.git
synced 2024-12-18 08:41:37 +00:00
b5590dd5d9
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@144 67975925-1194-0748-b3d5-c16f83f1a3a1
219 lines
5.7 KiB
C++
219 lines
5.7 KiB
C++
/***
|
|
*
|
|
* Copyright (c) 1999, 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 );
|
|
int Classify ( void );
|
|
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
|
|
|
void PainSound( void );
|
|
void AlertSound( void );
|
|
void IdleSound( void );
|
|
void AttackSnd( void );
|
|
|
|
// 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_bloater, CBloater );
|
|
|
|
//=========================================================
|
|
// Classify - indicates this monster's place in the
|
|
// relationship table.
|
|
//=========================================================
|
|
int CBloater :: Classify ( void )
|
|
{
|
|
return CLASS_ALIEN_MONSTER;
|
|
}
|
|
|
|
//=========================================================
|
|
// SetYawSpeed - allows each sequence to have a different
|
|
// turn rate associated with it.
|
|
//=========================================================
|
|
void CBloater :: SetYawSpeed ( void )
|
|
{
|
|
int ys;
|
|
|
|
ys = 120;
|
|
|
|
#if 0
|
|
switch ( m_Activity )
|
|
{
|
|
}
|
|
#endif
|
|
|
|
pev->yaw_speed = ys;
|
|
}
|
|
|
|
int CBloater :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
|
{
|
|
PainSound();
|
|
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
|
}
|
|
|
|
void CBloater :: PainSound( void )
|
|
{
|
|
#if 0
|
|
int pitch = 95 + RANDOM_LONG(0,9);
|
|
|
|
switch (RANDOM_LONG(0,5))
|
|
{
|
|
case 0:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_pain1.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
case 1:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_pain2.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void CBloater :: AlertSound( void )
|
|
{
|
|
#if 0
|
|
int pitch = 95 + RANDOM_LONG(0,9);
|
|
|
|
switch (RANDOM_LONG(0,2))
|
|
{
|
|
case 0:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_alert10.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
case 1:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_alert20.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
case 2:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_alert30.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void CBloater :: IdleSound( void )
|
|
{
|
|
#if 0
|
|
int pitch = 95 + RANDOM_LONG(0,9);
|
|
|
|
switch (RANDOM_LONG(0,2))
|
|
{
|
|
case 0:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_idle1.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
case 1:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_idle2.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
case 2:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_idle3.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void CBloater :: AttackSnd( void )
|
|
{
|
|
#if 0
|
|
int pitch = 95 + RANDOM_LONG(0,9);
|
|
|
|
switch (RANDOM_LONG(0,1))
|
|
{
|
|
case 0:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_attack1.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
case 1:
|
|
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "zombie/zo_attack2.wav", 1.0, ATTN_NORM, 0, pitch);
|
|
break;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
|
|
//=========================================================
|
|
// HandleAnimEvent - catches the monster-specific messages
|
|
// that occur when tagged animation frames are played.
|
|
//=========================================================
|
|
void CBloater :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
|
{
|
|
switch( pEvent->event )
|
|
{
|
|
case BLOATER_AE_ATTACK_MELEE1:
|
|
{
|
|
// do stuff for this event.
|
|
AttackSnd();
|
|
}
|
|
break;
|
|
|
|
default:
|
|
CBaseMonster::HandleAnimEvent( pEvent );
|
|
break;
|
|
}
|
|
}
|
|
|
|
//=========================================================
|
|
// Spawn
|
|
//=========================================================
|
|
void CBloater :: Spawn()
|
|
{
|
|
Precache( );
|
|
|
|
SET_MODEL(ENT(pev), "models/floater.mdl");
|
|
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
|
|
|
|
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;
|
|
|
|
MonsterInit();
|
|
}
|
|
|
|
//=========================================================
|
|
// Precache - precaches all resources this monster needs
|
|
//=========================================================
|
|
void CBloater :: Precache()
|
|
{
|
|
PRECACHE_MODEL("models/floater.mdl");
|
|
}
|
|
|
|
//=========================================================
|
|
// AI Schedules Specific to this monster
|
|
//=========================================================
|
|
|