2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 09:57:21 +01:00
hlsdk-xash3d/dlls/playermonster.cpp

124 lines
3.3 KiB
C++
Raw Normal View History

2018-01-19 18:00:32 +01:00
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
2016-06-04 15:24:23 +02:00
//
// Purpose: New version of the slider bar
//
// $NoKeywords: $
//=============================================================================
//=========================================================
// playermonster - for scripted sequence use.
//=========================================================
2016-06-04 15:24:23 +02:00
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
// For holograms, make them not solid so the player can walk through them
#define SF_MONSTERPLAYER_NOTSOLID 4
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
class CPlayerMonster : 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 );
2016-07-31 15:48:50 +02:00
int ISoundMask( void );
2016-06-04 15:24:23 +02:00
};
LINK_ENTITY_TO_CLASS( monster_player, CPlayerMonster )
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 CPlayerMonster::Classify( void )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
return CLASS_PLAYER_ALLY;
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 CPlayerMonster::SetYawSpeed( void )
2016-06-04 15:24:23 +02:00
{
int ys;
2016-07-31 15:48:50 +02:00
switch( m_Activity )
2016-06-04 15:24:23 +02:00
{
case ACT_IDLE:
default:
ys = 90;
}
pev->yaw_speed = ys;
}
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void CPlayerMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
{
case 0:
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
//=========================================================
// ISoundMask - player monster can't hear.
//=========================================================
2016-07-31 15:48:50 +02:00
int CPlayerMonster::ISoundMask( void )
2016-06-04 15:24:23 +02:00
{
return 0;
2016-06-04 15:24:23 +02:00
}
//=========================================================
// Spawn
//=========================================================
2016-07-31 15:48:50 +02:00
void CPlayerMonster::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/player.mdl" );
UTIL_SetSize( pev, VEC_HULL_MIN, VEC_HULL_MAX );
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_RED;
pev->health = 8;
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();
2016-07-31 15:48:50 +02:00
if( pev->spawnflags & SF_MONSTERPLAYER_NOTSOLID )
2016-06-04 15:24:23 +02:00
{
pev->solid = SOLID_NOT;
pev->takedamage = DAMAGE_NO;
}
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
2016-07-31 15:48:50 +02:00
void CPlayerMonster::Precache()
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
PRECACHE_MODEL( "models/player.mdl" );
}
2016-06-04 15:24:23 +02:00
//=========================================================
// AI Schedules Specific to this monster
//=========================================================