This repository has been archived by the owner on Sep 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
g_spawn.h
254 lines (213 loc) · 6.87 KB
/
g_spawn.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_spawn.h $
// $Revision:: 18 $
// $Author:: Jimdose $
// $Date:: 11/07/98 10:01p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/g_spawn.h $
//
// 18 11/07/98 10:01p Jimdose
// added G_GetClassFromArgs
//
// 17 10/25/98 11:53p Jimdose
// added EXPORT_TEMPLATE
//
// 16 10/17/98 8:12p Jimdose
// Changed G_CallSpawn2 to G_CallSpawn
//
// 15 10/17/98 12:21a Jimdose
// Added G_ResetEdicts
//
// 14 10/15/98 7:13p Jimdose
// Overrode = for SpawnArgGroup. Fixes crash on level change with multiplayer
//
// 13 10/14/98 10:58p Jimdose
// added archive functions to spawnargs classes
// G_MapInit now accepts mapname
//
// 12 10/14/98 1:20a Jimdose
// Got cross-level persistant info working
//
// 11 10/10/98 1:33a Jimdose
// Added G_LevelStart and G_Precache
//
// 10 10/07/98 11:47p Jimdose
// Added G_LevelShutdown and G_MapInit
//
// 9 8/29/98 9:49p Jimdose
// Moved prototypes from g_local.h
//
// 8 8/27/98 9:05p Jimdose
// Moved some prototypes that didn't belong here to g_utils.h
//
// 7 8/12/98 3:19p Aldie
// Added G_CallSpawn2 that returns pointer to entity created.
//
// 6 5/24/98 8:46p Jimdose
// Made a lot of functions more str-friendly.
// Got rid of a lot of char * based strings
// Cleaned up get spawn arg functions and sound functions
// sound functions now use consistant syntax
//
// 5 5/24/98 4:48p Jimdose
// Made char *'s const
//
// 4 5/24/98 2:46p Markd
// Made char *'s into const char *'s
//
// 3 3/13/98 7:25p Aldie
// Added GetVector
//
// 2 2/03/98 11:06a Jimdose
// Converted to work with Sin progs
//
// DESCRIPTION:
//
#ifndef __G_SPAWN_H__
#define __G_SPAWN_H__
#ifdef __cplusplus
#include "entity.h"
// spawnflags
// these are set with checkboxes on each entity in the map editor
#define SPAWNFLAG_NOT_EASY 0x00000100
#define SPAWNFLAG_NOT_MEDIUM 0x00000200
#define SPAWNFLAG_NOT_HARD 0x00000400
#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800
#define SPAWNFLAG_NOT_COOP 0x00001000
#define SPAWNFLAG_DEVELOPMENT 0x00002000
#define SPAWNFLAG_DETAIL 0x00004000
class EXPORT_FROM_DLL SpawnArg : public Class
{
public:
char key[ 64 ];
char value[ 256 ];
CLASS_PROTOTYPE( SpawnArg );
SpawnArg();
SpawnArg( SpawnArg &arg );
friend int operator==( SpawnArg a, SpawnArg b );
virtual void Archive( Archiver &arc );
virtual void Unarchive( Archiver &arc );
};
inline int operator==
(
SpawnArg a,
SpawnArg b
)
{
int i;
i = strcmp( a.key, b.key );
if ( i )
{
return i;
}
return strcmp( a.value, b.value );
}
#ifdef EXPORT_TEMPLATE
template class EXPORT_FROM_DLL Container<SpawnArg>;
#endif
class EXPORT_FROM_DLL SpawnArgs : public Class
{
public:
Container<SpawnArg> argList;
CLASS_PROTOTYPE( SpawnArgs );
SpawnArgs();
SpawnArgs( SpawnArgs &arglist );
int NumArgs( void );
void SetArgs( void );
void RestoreArgs( void );
void operator=( SpawnArgs &a );
friend int operator==( SpawnArgs a, SpawnArgs b );
virtual void Archive( Archiver &arc );
virtual void Unarchive( Archiver &arc );
};
inline int operator==
(
SpawnArgs a,
SpawnArgs b
)
{
return -1;
}
#ifdef EXPORT_TEMPLATE
template class EXPORT_FROM_DLL Container<SpawnArgs>;
#endif
class EXPORT_FROM_DLL SpawnArgGroup : public Class
{
public:
Container<SpawnArgs> spawnArgList;
CLASS_PROTOTYPE( SpawnArgGroup );
SpawnArgGroup();
SpawnArgGroup( SpawnArgGroup &group );
int NumInGroup( void );
void AddArgs( void );
void RestoreArgs( int i );
void operator=( SpawnArgGroup &a );
friend int operator==( SpawnArgGroup a, SpawnArgGroup b );
virtual void Archive( Archiver &arc );
virtual void Unarchive( Archiver &arc );
};
inline int operator==
(
SpawnArgGroup a,
SpawnArgGroup b
)
{
return -1;
}
#ifdef EXPORT_TEMPLATE
template class EXPORT_FROM_DLL Container<SpawnArgGroup>;
#endif
class EXPORT_FROM_DLL SpawnArgsForEntity : public Class
{
public:
Container<SpawnArgGroup> groupList;
Container<int> entnumList;
CLASS_PROTOTYPE( SpawnArgsForEntity );
void Reset( void );
void AddEnt( Entity *ent );
qboolean RestoreEnt( Entity *ent );
void RestoreEnts( void );
virtual void Archive( Archiver &arc );
virtual void Unarchive( Archiver &arc );
};
extern SpawnArgsForEntity PersistantData;
void G_SetFloatArg( const char *key, double value );
void G_SetIntArg( const char *key, int value );
qboolean G_SetSpawnArg( const char *keyname, const char *value );
void G_DefaultArg( const char *key, const char *defaultvalue );
void G_DefaultFloatArg( const char *key, double defaultvalue );
void G_DefaultIntArg( const char *key, int defaultvalue );
float G_GetFloatArg( const char *key, double defaultvalue = 0 );
Vector G_GetVectorArg( const char *key, Vector defaultvalue = Vector( 0, 0, 0 ) );
int G_GetIntArg( const char *key, int defaultvalue = 0 );
str G_GetStringArg( const char *key, const char *defaultvalue = NULL );
const char *G_GetSpawnArg( const char *key, const char *defaultvalue = NULL );
void G_InitSpawnArguments( void );
int G_GetNumSpawnArgs( void );
void G_InitClientPersistant( gclient_t *client );
void G_InitClientResp( gclient_t *client );
ClassDef *G_GetClassFromArgs( void );
Entity *G_CallSpawn( void );
const char *G_ParseEdict( const char *data, edict_t *ent);
void G_FindTeams( void );
void G_LevelShutdown( void );
void G_ResetEdicts( void );
void G_MapInit( const char *mapname );
void G_LevelStart( void );
void G_Precache( void );
#endif
#ifdef __cplusplus
extern "C" {
#endif
EXPORT_FROM_DLL void G_SpawnEntities( const char *mapname, const char *entities, const char *spawnpoint );
#ifdef __cplusplus
}
#endif
#endif