Source code

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
// CSquadMonster - all the extra data for monsters that
17
// form squads.
18
//=========================================================
19
20
#define SF_SQUADMONSTER_LEADER 32
21
22
23
#define bits_NO_SLOT 0
24
25
// HUMAN GRUNT SLOTS
26
#define bits_SLOT_HGRUNT_ENGAGE1 ( 1 << 0 )
27
#define bits_SLOT_HGRUNT_ENGAGE2 ( 1 << 1 )
28
#define bits_SLOTS_HGRUNT_ENGAGE ( bits_SLOT_HGRUNT_ENGAGE1 | bits_SLOT_HGRUNT_ENGAGE2 )
29
30
#define bits_SLOT_HGRUNT_GRENADE1 ( 1 << 2 )
31
#define bits_SLOT_HGRUNT_GRENADE2 ( 1 << 3 )
32
#define bits_SLOTS_HGRUNT_GRENADE ( bits_SLOT_HGRUNT_GRENADE1 | bits_SLOT_HGRUNT_GRENADE2 )
33
34
// ALIEN GRUNT SLOTS
35
#define bits_SLOT_AGRUNT_HORNET1 ( 1 << 4 )
36
#define bits_SLOT_AGRUNT_HORNET2 ( 1 << 5 )
37
#define bits_SLOT_AGRUNT_CHASE ( 1 << 6 )
38
#define bits_SLOTS_AGRUNT_HORNET ( bits_SLOT_AGRUNT_HORNET1 | bits_SLOT_AGRUNT_HORNET2 )
39
40
// HOUNDEYE SLOTS
41
#define bits_SLOT_HOUND_ATTACK1 ( 1 << 7 )
42
#define bits_SLOT_HOUND_ATTACK2 ( 1 << 8 )
43
#define bits_SLOT_HOUND_ATTACK3 ( 1 << 9 )
44
#define bits_SLOTS_HOUND_ATTACK ( bits_SLOT_HOUND_ATTACK1 | bits_SLOT_HOUND_ATTACK2 | bits_SLOT_HOUND_ATTACK3 )
45
46
// global slots
47
#define bits_SLOT_SQUAD_SPLIT ( 1 << 10 )// squad members don't all have the same enemy
48
49
#define NUM_SLOTS 11// update this every time you add/remove a slot.
50
51
#define MAX_SQUAD_MEMBERS 5
52
53
//=========================================================
54
// CSquadMonster - for any monster that forms squads.
55
//=========================================================
56
class CSquadMonster : public CBaseMonster
57
{
58
public:
59
// squad leader info
60
EHANDLE m_hSquadLeader; // who is my leader
61
EHANDLE m_hSquadMember[MAX_SQUAD_MEMBERS-1]; // valid only for leader
62
int m_afSquadSlots;
63
float m_flLastEnemySightTime; // last time anyone in the squad saw the enemy
64
BOOL m_fEnemyEluded;
65
66
// squad member info
67
int m_iMySlot;// this is the behaviour slot that the monster currently holds in the squad.
68
69
int CheckEnemy ( CBaseEntity *pEnemy );
70
void StartMonster ( void );
71
void VacateSlot( void );
72
void ScheduleChange( void );
73
void Killed( entvars_t *pevAttacker, int iGib );
74
BOOL OccupySlot( int iDesiredSlot );
75
BOOL NoFriendlyFire( void );
76
77
// squad functions still left in base class
78
CSquadMonster *MySquadLeader( )
79
{
80
CSquadMonster *pSquadLeader = (CSquadMonster *)((CBaseEntity *)m_hSquadLeader);
81
if (pSquadLeader != NULL)
82
return pSquadLeader;
83
return this;
84
}
85
CSquadMonster *MySquadMember( int i )
86
{
87
if (i >= MAX_SQUAD_MEMBERS-1)
88
return this;
89
else
90
return (CSquadMonster *)((CBaseEntity *)m_hSquadMember[i]);
91
}
92
int InSquad ( void ) { return m_hSquadLeader != 0; }
93
int IsLeader ( void ) { return m_hSquadLeader == this; }
94
int SquadJoin ( int searchRadius );
95
int SquadRecruit ( int searchRadius, int maxMembers );
96
int SquadCount( void );
97
void SquadRemove( CSquadMonster *pRemove );
98
void SquadUnlink( void );
99
BOOL SquadAdd( CSquadMonster *pAdd );
100
void SquadDisband( void );
101
void SquadAddConditions ( int iConditions );
102
void SquadMakeEnemy ( CBaseEntity *pEnemy );
103
void SquadPasteEnemyInfo ( void );
104
void SquadCopyEnemyInfo ( void );
105
BOOL SquadEnemySplit ( void );
106
BOOL SquadMemberInRange( const Vector &vecLocation, float flDist );
107
108
virtual CSquadMonster *MySquadMonsterPointer( void ) { return this; }
109
110
static TYPEDESCRIPTION m_SaveData[];
111
112
int Save( CSave &save );
113
int Restore( CRestore &restore );
114
115
BOOL FValidateCover ( const Vector &vecCoverLocation );
116
117
MONSTERSTATE GetIdealState ( void );
118
Schedule_t *GetScheduleOfType ( int iType );
119
};
120