Revision control

1
/***
2
*
3
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
4
*
5
* This product contains software technology licensed from Id
6
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
7
* All Rights Reserved.
8
*
9
* This source code contains proprietary and confidential information of
10
* Valve LLC and its suppliers. Access to this code is restricted to
11
* persons who have executed a written SDK license with Valve. Any access,
12
* use or distribution of this code by or to any unlicensed person is illegal.
13
*
14
****/
15
//=========================================================
16
// Generic Monster - purely for scripted sequence work.
17
//=========================================================
18
#include "extdll.h"
19
#include "util.h"
20
#include "cbase.h"
21
#include "monsters.h"
22
#include "schedule.h"
23
24
// For holograms, make them not solid so the player can walk through them
25
#define SF_GENERICMONSTER_NOTSOLID 4
26
27
//=========================================================
28
// Monster's Anim Events Go Here
29
//=========================================================
30
31
class CGenericMonster : public CBaseMonster
32
{
33
public:
34
void Spawn( void );
35
void Precache( void );
36
void SetYawSpeed( void );
37
int Classify ( void );
38
void HandleAnimEvent( MonsterEvent_t *pEvent );
39
int ISoundMask ( void );
40
};
41
LINK_ENTITY_TO_CLASS( monster_generic, CGenericMonster );
42
43
//=========================================================
44
// Classify - indicates this monster's place in the
45
// relationship table.
46
//=========================================================
47
int CGenericMonster :: Classify ( void )
48
{
49
return CLASS_PLAYER_ALLY;
50
}
51
52
//=========================================================
53
// SetYawSpeed - allows each sequence to have a different
54
// turn rate associated with it.
55
//=========================================================
56
void CGenericMonster :: SetYawSpeed ( void )
57
{
58
int ys;
59
60
switch ( m_Activity )
61
{
62
case ACT_IDLE:
63
default:
64
ys = 90;
65
}
66
67
pev->yaw_speed = ys;
68
}
69
70
//=========================================================
71
// HandleAnimEvent - catches the monster-specific messages
72
// that occur when tagged animation frames are played.
73
//=========================================================
74
void CGenericMonster :: HandleAnimEvent( MonsterEvent_t *pEvent )
75
{
76
switch( pEvent->event )
77
{
78
case 0:
79
default:
80
CBaseMonster::HandleAnimEvent( pEvent );
81
break;
82
}
83
}
84
85
//=========================================================
86
// ISoundMask - generic monster can't hear.
87
//=========================================================
88
int CGenericMonster :: ISoundMask ( void )
89
{
90
return 0;
91
}
92
93
//=========================================================
94
// Spawn
95
//=========================================================
96
void CGenericMonster :: Spawn()
97
{
98
Precache();
99
100
SET_MODEL( ENT(pev), STRING(pev->model) );
101
102
/*
103
if ( FStrEq( STRING(pev->model), "models/player.mdl" ) )
104
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
105
else
106
UTIL_SetSize(pev, VEC_HULL_MIN, VEC_HULL_MAX);
107
*/
108
109
if ( FStrEq( STRING(pev->model), "models/player.mdl" ) || FStrEq( STRING(pev->model), "models/holo.mdl" ) )
110
UTIL_SetSize(pev, VEC_HULL_MIN, VEC_HULL_MAX);
111
else
112
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
113
114
pev->solid = SOLID_SLIDEBOX;
115
pev->movetype = MOVETYPE_STEP;
116
m_bloodColor = BLOOD_COLOR_RED;
117
pev->health = 8;
118
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
119
m_MonsterState = MONSTERSTATE_NONE;
120
121
MonsterInit();
122
123
if ( pev->spawnflags & SF_GENERICMONSTER_NOTSOLID )
124
{
125
pev->solid = SOLID_NOT;
126
pev->takedamage = DAMAGE_NO;
127
}
128
}
129
130
//=========================================================
131
// Precache - precaches all resources this monster needs
132
//=========================================================
133
void CGenericMonster :: Precache()
134
{
135
PRECACHE_MODEL( (char *)STRING(pev->model) );
136
}
137
138
//=========================================================
139
// AI Schedules Specific to this monster
140
//=========================================================