2
===========================================================================
3
Copyright (C) 1999-2005 Id Software, Inc.
5
This file is part of Quake III Arena source code.
7
Quake III Arena source code is free software; you can redistribute it
8
and/or modify it under the terms of the GNU General Public License as
9
published by the Free Software Foundation; either version 2 of the License,
10
or (at your option) any later version.
12
Quake III Arena source code is distributed in the hope that it will be
13
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with Quake III Arena source code; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
===========================================================================
24
// g_public.h -- game module information visible to server
26
#define GAME_API_VERSION 8
29
// the server does not know how to interpret most of the values
30
// in entityStates (level eType), so the game must explicitly flag
31
// special server behaviors
32
#define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects
35
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=551
36
#define SVF_CLIENTMASK 0x00000002
38
#define SVF_BOT 0x00000008 // set if the entity is a bot
39
#define SVF_BROADCAST 0x00000020 // send to all connected clients
40
#define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
41
#define SVF_USE_CURRENT_ORIGIN 0x00000080 // entity->r.currentOrigin instead of entity->s.origin
42
// for link position (missiles and movers)
43
#define SVF_SINGLECLIENT 0x00000100 // only send to a single client (entityShared_t->singleClient)
44
#define SVF_NOSERVERINFO 0x00000200 // don't send CS_SERVERINFO updates to this client
45
// so that it can be updated for ping tools without
47
#define SVF_CAPSULE 0x00000400 // use capsule for collision detection instead of bbox
48
#define SVF_NOTSINGLECLIENT 0x00000800 // send entity to everyone but one client
49
// (entityShared_t->singleClient)
53
//===============================================================
57
entityState_t s; // communicated by server to clients
59
qboolean linked; // qfalse if not in any good cluster
62
int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc
64
// only send to this client when SVF_SINGLECLIENT is set
65
// if SVF_CLIENTMASK is set, use bitmask for clients to send to (maxclients must be <= 32, up to the mod to enforce this)
68
qboolean bmodel; // if false, assume an explicit mins / maxs bounding box
69
// only set by trap_SetBrushModel
71
int contents; // CONTENTS_TRIGGER, CONTENTS_SOLID, CONTENTS_BODY, etc
72
// a non-solid entity should set to 0
74
vec3_t absmin, absmax; // derived from mins/maxs and origin + rotation
76
// currentOrigin will be used for all collision detection and world linking.
77
// it will not necessarily be the same as the trajectory evaluation for the current
78
// time, because each entity must be moved one at a time after time is advanced
79
// to avoid simultanious collision issues
83
// when a trace call is made and passEntityNum != ENTITYNUM_NONE,
84
// an ent will be excluded from testing if:
85
// ent->s.number == passEntityNum (don't interact with self)
86
// ent->s.ownerNum = passEntityNum (don't interact with your own missiles)
87
// entity[ent->s.ownerNum].ownerNum = passEntityNum (don't interact with other missiles from owner)
93
// the server looks at a sharedEntity, which is the start of the game's gentity_t structure
95
entityState_t s; // communicated by server to clients
96
entityShared_t r; // shared by both the server system and game
101
//===============================================================
104
// system traps provided by the main engine
107
//============== general Quake services ==================
109
G_PRINT, // ( const char *string );
110
// print message on the local console
112
G_ERROR, // ( const char *string );
115
G_MILLISECONDS, // ( void );
116
// get current time for profiling reasons
117
// this should NOT be used for any game related tasks,
118
// because it is not journaled
120
// console variable interaction
121
G_CVAR_REGISTER, // ( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
122
G_CVAR_UPDATE, // ( vmCvar_t *vmCvar );
123
G_CVAR_SET, // ( const char *var_name, const char *value );
124
G_CVAR_VARIABLE_INTEGER_VALUE, // ( const char *var_name );
126
G_CVAR_VARIABLE_STRING_BUFFER, // ( const char *var_name, char *buffer, int bufsize );
129
// ClientCommand and ServerCommand parameter access
131
G_ARGV, // ( int n, char *buffer, int bufferLength );
133
G_FS_FOPEN_FILE, // ( const char *qpath, fileHandle_t *file, fsMode_t mode );
134
G_FS_READ, // ( void *buffer, int len, fileHandle_t f );
135
G_FS_WRITE, // ( const void *buffer, int len, fileHandle_t f );
136
G_FS_FCLOSE_FILE, // ( fileHandle_t f );
138
G_SEND_CONSOLE_COMMAND, // ( const char *text );
139
// add commands to the console as if they were typed in
140
// for map changing, etc
143
//=========== server specific functionality =============
145
G_LOCATE_GAME_DATA, // ( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t,
146
// playerState_t *clients, int sizeofGameClient );
147
// the game needs to let the server system know where and how big the gentities
148
// are, so it can look at them directly without going through an interface
150
G_DROP_CLIENT, // ( int clientNum, const char *reason );
151
// kick a client off the server with a message
153
G_SEND_SERVER_COMMAND, // ( int clientNum, const char *fmt, ... );
154
// reliably sends a command string to be interpreted by the given
155
// client. If clientNum is -1, it will be sent to all clients
157
G_SET_CONFIGSTRING, // ( int num, const char *string );
158
// config strings hold all the index strings, and various other information
159
// that is reliably communicated to all clients
160
// All of the current configstrings are sent to clients when
161
// they connect, and changes are sent to all connected clients.
162
// All confgstrings are cleared at each level start.
164
G_GET_CONFIGSTRING, // ( int num, char *buffer, int bufferSize );
166
G_GET_USERINFO, // ( int num, char *buffer, int bufferSize );
167
// userinfo strings are maintained by the server system, so they
168
// are persistant across level loads, while all other game visible
169
// data is completely reset
171
G_SET_USERINFO, // ( int num, const char *buffer );
173
G_GET_SERVERINFO, // ( char *buffer, int bufferSize );
174
// the serverinfo info string has all the cvars visible to server browsers
176
G_SET_BRUSH_MODEL, // ( gentity_t *ent, const char *name );
177
// sets mins and maxs based on the brushmodel name
179
G_TRACE, // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
180
// collision detection against all linked entities
182
G_POINT_CONTENTS, // ( const vec3_t point, int passEntityNum );
183
// point contents against all linked entities
185
G_IN_PVS, // ( const vec3_t p1, const vec3_t p2 );
187
G_IN_PVS_IGNORE_PORTALS, // ( const vec3_t p1, const vec3_t p2 );
189
G_ADJUST_AREA_PORTAL_STATE, // ( gentity_t *ent, qboolean open );
191
G_AREAS_CONNECTED, // ( int area1, int area2 );
193
G_LINKENTITY, // ( gentity_t *ent );
194
// an entity will never be sent to a client or used for collision
195
// if it is not passed to linkentity. If the size, position, or
196
// solidity changes, it must be relinked.
198
G_UNLINKENTITY, // ( gentity_t *ent );
199
// call before removing an interactive entity
201
G_ENTITIES_IN_BOX, // ( const vec3_t mins, const vec3_t maxs, gentity_t **list, int maxcount );
202
// EntitiesInBox will return brush models based on their bounding box,
203
// so exact determination must still be done with EntityContact
205
G_ENTITY_CONTACT, // ( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
206
// perform an exact check against inline brush models of non-square shape
208
// access for bots to get and free a server client (FIXME?)
209
G_BOT_ALLOCATE_CLIENT, // ( void );
211
G_BOT_FREE_CLIENT, // ( int clientNum );
213
G_GET_USERCMD, // ( int clientNum, usercmd_t *cmd )
215
G_GET_ENTITY_TOKEN, // qboolean ( char *buffer, int bufferSize )
216
// Retrieves the next string token from the entity spawn text, returning
217
// false when all tokens have been parsed.
218
// This should only be done at GAME_INIT time.
221
G_DEBUG_POLYGON_CREATE,
222
G_DEBUG_POLYGON_DELETE,
226
G_TRACECAPSULE, // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
227
G_ENTITY_CONTACTCAPSULE, // ( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
232
BOTLIB_SETUP = 200, // ( void );
233
BOTLIB_SHUTDOWN, // ( void );
236
BOTLIB_PC_ADD_GLOBAL_DEFINE,
242
BOTLIB_GET_SNAPSHOT_ENTITY, // ( int client, int ent );
243
BOTLIB_GET_CONSOLE_MESSAGE, // ( int client, char *message, int size );
244
BOTLIB_USER_COMMAND, // ( int client, usercmd_t *ucmd );
246
BOTLIB_AAS_ENABLE_ROUTING_AREA = 300,
247
BOTLIB_AAS_BBOX_AREAS,
248
BOTLIB_AAS_AREA_INFO,
249
BOTLIB_AAS_ENTITY_INFO,
251
BOTLIB_AAS_INITIALIZED,
252
BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX,
255
BOTLIB_AAS_POINT_AREA_NUM,
256
BOTLIB_AAS_TRACE_AREAS,
258
BOTLIB_AAS_POINT_CONTENTS,
259
BOTLIB_AAS_NEXT_BSP_ENTITY,
260
BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY,
261
BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY,
262
BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY,
263
BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY,
265
BOTLIB_AAS_AREA_REACHABILITY,
267
BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA,
270
BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT,
285
BOTLIB_EA_MOVE_FORWARD,
288
BOTLIB_EA_MOVE_RIGHT,
290
BOTLIB_EA_SELECT_WEAPON,
292
BOTLIB_EA_DELAYED_JUMP,
296
BOTLIB_EA_END_REGULAR,
298
BOTLIB_EA_RESET_INPUT,
301
BOTLIB_AI_LOAD_CHARACTER = 500,
302
BOTLIB_AI_FREE_CHARACTER,
303
BOTLIB_AI_CHARACTERISTIC_FLOAT,
304
BOTLIB_AI_CHARACTERISTIC_BFLOAT,
305
BOTLIB_AI_CHARACTERISTIC_INTEGER,
306
BOTLIB_AI_CHARACTERISTIC_BINTEGER,
307
BOTLIB_AI_CHARACTERISTIC_STRING,
309
BOTLIB_AI_ALLOC_CHAT_STATE,
310
BOTLIB_AI_FREE_CHAT_STATE,
311
BOTLIB_AI_QUEUE_CONSOLE_MESSAGE,
312
BOTLIB_AI_REMOVE_CONSOLE_MESSAGE,
313
BOTLIB_AI_NEXT_CONSOLE_MESSAGE,
314
BOTLIB_AI_NUM_CONSOLE_MESSAGE,
315
BOTLIB_AI_INITIAL_CHAT,
316
BOTLIB_AI_REPLY_CHAT,
317
BOTLIB_AI_CHAT_LENGTH,
318
BOTLIB_AI_ENTER_CHAT,
319
BOTLIB_AI_STRING_CONTAINS,
320
BOTLIB_AI_FIND_MATCH,
321
BOTLIB_AI_MATCH_VARIABLE,
322
BOTLIB_AI_UNIFY_WHITE_SPACES,
323
BOTLIB_AI_REPLACE_SYNONYMS,
324
BOTLIB_AI_LOAD_CHAT_FILE,
325
BOTLIB_AI_SET_CHAT_GENDER,
326
BOTLIB_AI_SET_CHAT_NAME,
328
BOTLIB_AI_RESET_GOAL_STATE,
329
BOTLIB_AI_RESET_AVOID_GOALS,
332
BOTLIB_AI_EMPTY_GOAL_STACK,
333
BOTLIB_AI_DUMP_AVOID_GOALS,
334
BOTLIB_AI_DUMP_GOAL_STACK,
336
BOTLIB_AI_GET_TOP_GOAL,
337
BOTLIB_AI_GET_SECOND_GOAL,
338
BOTLIB_AI_CHOOSE_LTG_ITEM,
339
BOTLIB_AI_CHOOSE_NBG_ITEM,
340
BOTLIB_AI_TOUCHING_GOAL,
341
BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE,
342
BOTLIB_AI_GET_LEVEL_ITEM_GOAL,
343
BOTLIB_AI_AVOID_GOAL_TIME,
344
BOTLIB_AI_INIT_LEVEL_ITEMS,
345
BOTLIB_AI_UPDATE_ENTITY_ITEMS,
346
BOTLIB_AI_LOAD_ITEM_WEIGHTS,
347
BOTLIB_AI_FREE_ITEM_WEIGHTS,
348
BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC,
349
BOTLIB_AI_ALLOC_GOAL_STATE,
350
BOTLIB_AI_FREE_GOAL_STATE,
352
BOTLIB_AI_RESET_MOVE_STATE,
353
BOTLIB_AI_MOVE_TO_GOAL,
354
BOTLIB_AI_MOVE_IN_DIRECTION,
355
BOTLIB_AI_RESET_AVOID_REACH,
356
BOTLIB_AI_RESET_LAST_AVOID_REACH,
357
BOTLIB_AI_REACHABILITY_AREA,
358
BOTLIB_AI_MOVEMENT_VIEW_TARGET,
359
BOTLIB_AI_ALLOC_MOVE_STATE,
360
BOTLIB_AI_FREE_MOVE_STATE,
361
BOTLIB_AI_INIT_MOVE_STATE,
363
BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON,
364
BOTLIB_AI_GET_WEAPON_INFO,
365
BOTLIB_AI_LOAD_WEAPON_WEIGHTS,
366
BOTLIB_AI_ALLOC_WEAPON_STATE,
367
BOTLIB_AI_FREE_WEAPON_STATE,
368
BOTLIB_AI_RESET_WEAPON_STATE,
370
BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION,
371
BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC,
372
BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC,
373
BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL,
374
BOTLIB_AI_GET_MAP_LOCATION_GOAL,
375
BOTLIB_AI_NUM_INITIAL_CHATS,
376
BOTLIB_AI_GET_CHAT_MESSAGE,
377
BOTLIB_AI_REMOVE_FROM_AVOID_GOALS,
378
BOTLIB_AI_PREDICT_VISIBLE_POSITION,
380
BOTLIB_AI_SET_AVOID_GOAL_TIME,
381
BOTLIB_AI_ADD_AVOID_SPOT,
382
BOTLIB_AAS_ALTERNATIVE_ROUTE_GOAL,
383
BOTLIB_AAS_PREDICT_ROUTE,
384
BOTLIB_AAS_POINT_REACHABILITY_AREA_INDEX,
386
BOTLIB_PC_LOAD_SOURCE,
387
BOTLIB_PC_FREE_SOURCE,
388
BOTLIB_PC_READ_TOKEN,
389
BOTLIB_PC_SOURCE_FILE_AND_LINE
395
// functions exported by the game subsystem
398
GAME_INIT, // ( int levelTime, int randomSeed, int restart );
399
// init and shutdown will be called every single level
400
// The game should call G_GET_ENTITY_TOKEN to parse through all the
401
// entity configuration text and spawn gentities.
403
GAME_SHUTDOWN, // (void);
405
GAME_CLIENT_CONNECT, // ( int clientNum, qboolean firstTime, qboolean isBot );
406
// return NULL if the client is allowed to connect, otherwise return
407
// a text string with the reason for denial
409
GAME_CLIENT_BEGIN, // ( int clientNum );
411
GAME_CLIENT_USERINFO_CHANGED, // ( int clientNum );
413
GAME_CLIENT_DISCONNECT, // ( int clientNum );
415
GAME_CLIENT_COMMAND, // ( int clientNum );
417
GAME_CLIENT_THINK, // ( int clientNum );
419
GAME_RUN_FRAME, // ( int levelTime );
421
GAME_CONSOLE_COMMAND, // ( void );
422
// ConsoleCommand will be called when a command has been issued
423
// that is not recognized as a builtin function.
424
// The game can issue trap_argc() / trap_argv() commands to get the command
425
// and parameters. Return qfalse if the game doesn't recognize it as a command.
427
BOTAI_START_FRAME // ( int time );