OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
g_public.h
1/*
2===========================================================================
3Copyright (C) 1999-2005 Id Software, Inc.
4
5This file is part of Quake III Arena source code.
6
7Quake III Arena source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12Quake III Arena source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with Quake III Arena source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22//
23
24// g_public.h -- game module information visible to server
25
26#pragma once
27
28#include "bg_public.h"
29
30// Version 11 is >= 0.05 and <= 1.00
31// Version 12 is >= 1.10
32// Version 15 is >= 2.0
33#define GAME_API_VERSION 15
34
35// entity->svFlags
36// the server does not know how to interpret most of the values
37// in entityStates (level eType), so the game must explicitly flag
38// special server behaviors
39#define SVF_NOCLIENT (1<<0) // don't send entity to clients, even if it has effects
40#define SVF_BOT (1<<1)
41#define SVF_BROADCAST (1<<2) // send to all connected clients
42#define SVF_PORTAL (1<<3) // merge a second pvs at origin2 into snapshots
43#define SVF_SENDPVS (1<<4) // even though it doesn't have a sound or modelindex, still run it through the pvs
44#define SVF_USE_CURRENT_ORIGIN (1<<5) // entity->currentOrigin instead of entity->s.origin
45 // for link position (missiles and movers)
46#define SVF_NOTSINGLECLIENT (1<<6) // send entity to everyone but one client
47 // (entityShared_t->singleClient)
48#define SVF_MONSTER (1<<7) // treat as CONTENTS_MONSTER for collision
49#define SVF_SINGLECLIENT (1<<8) // only send to a single client (entityShared_t->singleClient)
50#define SVF_USEBBOX (1<<9) // do not perform perfect collision use the bbox instead
51#define SVF_NOFARPLANE (1<<10) // only send this entity to its parent
52#define SVF_HIDEOWNER (1<<11) // hide the owner of the client
53#define SVF_MONSTERCLIP (1<<12) // treat as CONTENTS_MONSTERCLIP for collision
54#define SVF_PLAYERCLIP (1<<13) // treat as CONTENTS_PLAYERCLIP for collision
55#define SVF_SENDONCE (1<<14) // Send this entity over the network at least one time
56#define SVF_SENT (1<<15) // This flag is set when the entity has been sent over at least one time
57
58#define SVF_NOSERVERINFO (1<<16) // don't send CS_SERVERINFO updates to this client
59 // so that it can be updated for ping tools without
60 // lagging clients
61
62typedef struct gclient_s gclient_t;
63typedef struct dtiki_s dtiki_t;
64typedef struct tiki_cmd_s tiki_cmd_t;
65typedef struct dtikianim_s dtikianim_t;
66typedef struct tiki_s tiki_t;
67
68typedef struct tikiAnim_s tikiAnim_t;
69typedef struct baseshader_s baseshader_t;
70typedef struct AliasListNode_s AliasListNode_t;
71typedef void (*xcommand_t)(void);
72
73#define MAX_NONPVS_SOUNDS 4
74
75typedef struct {
76 int index;
77 float volume;
78 float minDist;
79 float maxDist;
80 float pitch;
82
83typedef struct {
84 // su44: sharedEntity_t::s is used instead of it
85 //entityState_t s; // communicated by server to clients
86
87 qboolean linked; // qfalse if not in any good cluster
88 int linkcount;
89
90 int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc
91
92 // only send to this client when SVF_SINGLECLIENT is set
93 // if SVF_CLIENTMASK is set, use bitmask for clients to send to (maxclients must be <= 32, up to the mod to enforce this)
94 int singleClient;
95
96 int lastNetTime;
97
98 qboolean bmodel; // if false, assume an explicit mins / maxs bounding box
99 // only set by gi.SetBrushModel
100 vec3_t mins, maxs;
101 int contents; // CONTENTS_TRIGGER, CONTENTS_SOLID, CONTENTS_BODY, etc
102 // a non-solid entity should set to 0
103
104 vec3_t absmin, absmax; // derived from mins/maxs and origin + rotation
105 float radius;
106 // centroid will be used for all collision detection and world linking.
107 // it will not necessarily be the same as the trajectory evaluation for the current
108 // time, because each entity must be moved one at a time after time is advanced
109 // to avoid simultanious collision issues
110 vec3_t centroid; // centroid, to be used with radius
111
112 int areanum;
113
114 vec3_t currentAngles;
115
116 // when a trace call is made and passEntityNum != ENTITYNUM_NONE,
117 // an ent will be excluded from testing if:
118 // ent->s.number == passEntityNum (don't interact with self)
119 // ent->s.ownerNum = passEntityNum (don't interact with your own missiles)
120 // entity[ent->s.ownerNum].ownerNum = passEntityNum (don't interact with other missiles from owner)
121 int ownerNum;
122
123 // whether or not this entity emitted a sound this frame
124 // (used for when the entity shouldn't be sent to clients)
125 nonpvs_sound_t nonpvs_sounds[MAX_NONPVS_SOUNDS];
126 int num_nonpvs_sounds;
128
129// client data that stays across multiple respawns, but is cleared
130// on each level change or team change at ClientBegin()
131typedef struct {
132 char userinfo[MAX_INFO_STRING];
133 char netname[MAX_NAME_LENGTH];
134 char dm_playermodel[MAX_QPATH];
135 char dm_playergermanmodel[MAX_QPATH];
136 char dm_primary[MAX_QPATH];
137
138 float enterTime;
139
140 teamtype_t teamnum;
141 int round_kills;
142
143 char ip[17];
144 int port;
146
147// this structure is cleared on each ClientSpawn(),
148// except for 'client->pers' and 'client->sess'
149struct gclient_s {
150 // ps MUST be the first element, because the server expects it
151 playerState_t ps; // communicated by server to clients
152
153#ifdef GAME_DLL
154 // the rest of the structure is private to game
155 int ping;
157 float cmd_angles[3];
158
159 int lastActiveTime;
160 int activeWarning;
161
162 struct gentity_s *ent;
163 struct gclient_s *next;
164 struct gclient_s *prev;
165#endif
166};
167
168typedef struct gentity_s {
169 entityState_t s; // communicated by server to clients
170
171 struct gclient_s *client; // NULL if not a client
172 qboolean inuse;
173
174 entityShared_t r; // shared by both the server system and game
175
176 solid_t solid;
177 dtiki_t *tiki;
178 float mat[3][3];
179
180 // Leave reminder to the game dll
181#if defined(GAME_DLL)
182 class Entity *entity;
183 float freetime;
184 float spawntime;
185 float radius2;
186 char entname[64];
187 int clipmask;
188
189 struct gentity_s *next;
190 struct gentity_s *prev;
191#endif
192} gentity_t;
193
194// movers are things like doors, plats, buttons, etc
195typedef enum {
196 MOVER_POS1,
197 MOVER_POS2,
198 MOVER_1TO2,
199 MOVER_2TO1
200} moverState_t;
201
202typedef struct profVar_s {
203 int start;
204 int clockCycles;
205 int calls;
206 float time;
207 float totTime;
208 float avgTime;
209 float low;
210 float high;
211
212} profVar_t;
213
214typedef struct profGame_s {
215 profVar_t AI;
216 profVar_t MmoveSingle;
217 profVar_t thread_timingList;
218 profVar_t gamescripts;
219 profVar_t GProbe1;
220 profVar_t GProbe2;
221 profVar_t GProbe3;
222 profVar_t FindPath;
223 profVar_t vector_length;
224 profVar_t script_trace;
225 profVar_t internal_trace;
226 profVar_t PreAnimate;
227 profVar_t PostAnimate;
228
229} profGame_t;
230
231//===============================================================
232
233typedef struct gameImport_s {
234 void (*Printf)(const char *format, ...);
235 void (*DPrintf)(const char *format, ...);
236 void (*DPrintf2)(const char *format, ...);
237 void (*DebugPrintf)(const char *format, ...);
238 void (*Error)(int level, const char *format, ...);
239 int (*Milliseconds)();
240 const char *(*LV_ConvertString)(const char *string);
241
242 // Added in 2.0
243 const char *(*CL_LV_ConvertString)(const char *string);
244
245 void *(*Malloc)(size_t size);
246 void (*Free)(void *ptr);
247 cvar_t *(*Cvar_Get)(const char *varName, const char *varValue, int varFlags);
248 void (*cvar_set)(const char *varName, const char *varValue);
249 cvar_t *(*cvar_set2)(const char *varName, const char *varValue, qboolean force);
250 cvar_t *(*NextCvar)(cvar_t *var);
251 void (*Cvar_CheckRange)(cvar_t* var, float min, float max, qboolean integral);
252
253 int (*Argc)();
254 char *(*Argv)(int arg);
255 char *(*Args)();
256 void (*AddCommand)(const char *cmdName, xcommand_t cmdFunction);
257 long (*FS_ReadFile)(const char *qpath, void **buffer, qboolean quiet);
258 void (*FS_FreeFile)(void *buffer);
259 int (*FS_WriteFile)(const char *qpath, const void *buffer, int size);
260 fileHandle_t (*FS_FOpenFileWrite)(const char *fileName);
261 fileHandle_t (*FS_FOpenFileAppend)(const char *fileName);
262 long (*FS_FOpenFile)(const char* qpath, fileHandle_t *file, qboolean uniqueFILE, qboolean quiet);
263 const char *(*FS_PrepFileWrite)(const char *fileName);
264 size_t (*FS_Write)(const void *buffer, size_t size, fileHandle_t fileHandle);
265 size_t (*FS_Read)(void *buffer, size_t len, fileHandle_t fileHandle);
266 void (*FS_FCloseFile)(fileHandle_t fileHandle);
267 int (*FS_Tell)(fileHandle_t fileHandle);
268 int (*FS_Seek)(fileHandle_t fileHandle, long int offset, int origin);
269 void (*FS_Flush)(fileHandle_t fileHandle);
270 int (*FS_FileNewer)(const char *source, const char *destination);
271 void (*FS_CanonicalFilename)(char *fileName);
272 char **(*FS_ListFiles)(const char *qpath, const char *extension, qboolean wantSubs, int *numFiles);
273 void (*FS_FreeFileList)(char **list);
274 const char *(*GetArchiveFileName)(const char *fileName, const char *extension);
275 void (*SendConsoleCommand)(const char *text);
276
277 // Added in 2.0
278 void (*ExecuteConsoleCommand)(int exec_when, const char *text);
279
280 void (*DebugGraph)(float value);
281 void (*SendServerCommand)(int client, const char *format, ...);
282 void (*DropClient)(int client, const char *reason);
283 void (*MSG_WriteBits)(int value, int bits);
284 void (*MSG_WriteChar)(int c);
285 void (*MSG_WriteByte)(int c);
286 void (*MSG_WriteSVC)(int c);
287 void (*MSG_WriteShort)(int c);
288 void (*MSG_WriteLong)(int c);
289 void (*MSG_WriteFloat)(float f);
290 void (*MSG_WriteString)(const char *s);
291 void (*MSG_WriteAngle8)(float f);
292 void (*MSG_WriteAngle16)(float f);
293 void (*MSG_WriteCoord)(float f);
294 void (*MSG_WriteDir)(vec3_t dir);
295 void (*MSG_StartCGM)(int type);
296 void (*MSG_EndCGM)();
297 void (*MSG_SetClient)(int client);
298 void (*SetBroadcastVisible)(const vec3_t pos, const vec3_t posB);
299 void (*SetBroadcastHearable)(const vec3_t pos, const vec3_t posB);
300 void (*SetBroadcastAll)();
301 void (*setConfigstring)(int index, const char *val);
302 char *(*getConfigstring)(int index);
303 void (*SetUserinfo)(int index, const char *val);
304 void (*GetUserinfo)(int index, char *buffer, int bufferSize);
305 void (*SetBrushModel)(gentity_t *ent, const char *name);
306 void (*ModelBoundsFromName)(const char *name, vec3_t mins, vec3_t maxs);
307 qboolean (*SightTraceEntity)(
308 gentity_t *touch,
309 const vec3_t start,
310 const vec3_t mins,
311 const vec3_t maxs,
312 const vec3_t end,
313 int contentMask,
314 qboolean cylinder
315 );
316 qboolean (*SightTrace)(
317 const vec3_t start,
318 const vec3_t mins,
319 const vec3_t maxs,
320 const vec3_t end,
321 int passEntityNum,
322 int passEntityNum2,
323 int contentMask,
324 qboolean cylinder
325 );
326 void (*trace)(
327 trace_t *results,
328 const vec3_t start,
329 const vec3_t mins,
330 const vec3_t maxs,
331 const vec3_t end,
332 int passEntityNum,
333 int contentMask,
334 qboolean cylinder,
335 qboolean traceDeep
336 );
337
338 // Added in 2.0
339 float (*CM_VisualObfuscation)(const vec3_t start, const vec3_t end);
340
341 baseshader_t *(*GetShader)(int shaderNum);
342 int (*pointcontents)(const vec3_t p, int passEntityNum);
343 int (*PointBrushnum)(const vec3_t p, clipHandle_t model);
344 void (*AdjustAreaPortalState)(gentity_t *ent, qboolean open);
345 int (*AreaForPoint)(vec3_t pos);
346 qboolean (*AreasConnected)(int area1, int area2);
347 qboolean (*InPVS)(float *p1, float *p2);
348 void (*linkentity)(gentity_t *gEnt);
349 void (*unlinkentity)(gentity_t *gEnt);
350 int (*AreaEntities)(const vec3_t mins, const vec3_t maxs, int *list, int maxcount);
351 void (*ClipToEntity)(
352 trace_t *tr,
353 const vec3_t start,
354 const vec3_t mins,
355 const vec3_t maxs,
356 const vec3_t end,
357 int entityNum,
358 int contentMask
359 );
360
361 // Added in 2.0
362 qboolean (*HitEntity)(gentity_t *pEnt, gentity_t *pOther);
363
364 int (*imageindex)(const char *name);
365 int (*itemindex)(const char *name);
366 int (*soundindex)(const char *name, int streamed);
367 dtiki_t *(*TIKI_RegisterModel)(const char *path);
368 dtiki_t *(*modeltiki)(const char *name);
369 dtikianim_t *(*modeltikianim)(const char *name);
370 void (*SetLightStyle)(int index, const char *data);
371 const char *(*GameDir)();
372 qboolean (*setmodel)(gentity_t *ent, const char *name);
373 void (*clearmodel)(gentity_t *ent);
374 int (*TIKI_NumAnims)(dtiki_t *tiki);
375 int (*TIKI_NumSurfaces)(dtiki_t *tiki);
376 int (*TIKI_NumTags)(dtiki_t *tiki);
377 void (*TIKI_CalculateBounds)(dtiki_t *tiki, float scale, vec3_t mins, vec3_t maxs);
378 void *(*TIKI_GetSkeletor)(dtiki_t *tiki, int entNum);
379 const char *(*Anim_NameForNum)(dtiki_t *tiki, int animNum);
380 int (*Anim_NumForName)(dtiki_t *tiki, const char *name);
381 int (*Anim_Random)(dtiki_t *tiki, const char *name);
382 int (*Anim_NumFrames)(dtiki_t *tiki, int animNum);
383 float (*Anim_Time)(dtiki_t *tiki, int animNum);
384 float (*Anim_Frametime)(dtiki_t *tiki, int animNum);
385 float (*Anim_CrossTime)(dtiki_t *tiki, int animNum);
386 void (*Anim_Delta)(dtiki_t *tiki, int animNum, float *delta);
387
388 // Added in 2.0
389 void (*Anim_AngularDelta)(dtiki_t *tiki, int animNum, float *delta);
390
391 qboolean (*Anim_HasDelta)(dtiki_t *tiki, int animNum);
392 void (*Anim_DeltaOverTime)(dtiki_t *tiki, int animNum, float time1, float time2, float *delta);
393
394 // Added in 2.0
395 void (*Anim_AngularDeltaOverTime)(dtiki_t *tiki, int animNum, float time1, float time2, float *delta);
396
397 int (*Anim_Flags)(dtiki_t *tiki, int animNum);
398 int (*Anim_FlagsSkel)(dtiki_t *tiki, int animNum);
399 qboolean (*Anim_HasCommands)(dtiki_t *tiki, int animNum);
400 qboolean (*Anim_HasCommands_Client)(dtiki_t *tiki, int animNum);
401 int (*NumHeadModels)(const char *model);
402 void (*GetHeadModel)(const char *model, int num, char *name);
403 int (*NumHeadSkins)(const char *model);
404 void (*GetHeadSkin)(const char *model, int num, char *name);
405 qboolean (*Frame_Commands)(dtiki_t *tiki, int animNum, int frameNum, tiki_cmd_t *tikiCmds);
406 qboolean (*Frame_Commands_Client)(dtiki_t *tiki, int animNum, int frameNum, tiki_cmd_t *tikiCmds);
407 int (*Surface_NameToNum)(dtiki_t *tiki, const char *name);
408 const char *(*Surface_NumToName)(dtiki_t *tiki, int surfacenum);
409 int (*Tag_NumForName)(dtiki_t *pmdl, const char *name);
410 const char *(*Tag_NameForNum)(dtiki_t *pmdl, int tagNum);
411 orientation_t (*TIKI_OrientationInternal)(dtiki_t *tiki, int entNum, int tagNum, float scale);
412 void *(*TIKI_TransformInternal)(dtiki_t *tiki, int entNum, int tagNum);
413 qboolean (*TIKI_IsOnGroundInternal)(dtiki_t *tiki, int entNum, int num, float threshold);
414 void (*TIKI_SetPoseInternal)(
415 dtiki_t *tiki, int entNum, const frameInfo_t *frameInfo, int *boneTag, vec4_t *boneQuat, float actionWeight
416 );
417 const char *(*CM_GetHitLocationInfo)(int location, float *radius, float *offset);
418 const char *(*CM_GetHitLocationInfoSecondary)(int location, float *radius, float *offset);
419
420 qboolean (*Alias_Add)(dtiki_t *pmdl, const char *alias, const char *name, const char *parameters);
421 const char *(*Alias_FindRandom)(dtiki_t *tiki, const char *alias, AliasListNode_t **ret);
422 void (*Alias_Dump)(dtiki_t *tiki);
423 void (*Alias_Clear)(dtiki_t *tiki);
424 void (*Alias_UpdateDialog)(dtikianim_t *tiki, const char *alias);
425
426 const char *(*TIKI_NameForNum)(dtiki_t *tiki);
427
428 qboolean (*GlobalAlias_Add)(const char *alias, const char *name, const char *parameters);
429 const char *(*GlobalAlias_FindRandom)(const char *alias, AliasListNode_t **ret);
430 void (*GlobalAlias_Dump)();
431 void (*GlobalAlias_Clear)();
432
433 void (*centerprintf)(gentity_t *ent, const char *format, ...);
434 void (*locationprintf)(gentity_t *ent, int x, int y, const char *format, ...);
435 void (*Sound)(
436 vec3_t *org,
437 int entNum,
438 int channel,
439 const char *soundName,
440 float volume,
441 float minDist,
442 float pitch,
443 float maxDist,
444 int streamed
445 );
446 void (*StopSound)(int entNum, int channel);
447 float (*SoundLength)(int channel, const char *name);
448 unsigned char *(*SoundAmplitudes)(int channel, const char *name);
449 int (*S_IsSoundPlaying)(int channel, const char *name);
450 short unsigned int (*CalcCRC)(unsigned char *start, int count);
451
452 debugline_t **DebugLines;
453 int *numDebugLines;
454 debugstring_t **DebugStrings;
455 int *numDebugStrings;
456
457 void (*LocateGameData)(
458 gentity_t *gEnts, int numGEntities, int sizeofGEntity, playerState_t *clients, int sizeofGameClient
459 );
460 void (*SetFarPlane)(int farPlane);
461 void (*SetSkyPortal)(qboolean skyPortal);
462 void (*Popmenu)(int client, int i);
463 void (*Showmenu)(int client, const char *name, qboolean force);
464 void (*Hidemenu)(int client, const char *name, qboolean force);
465 void (*Pushmenu)(int client, const char *name);
466 void (*HideMouseCursor)(int client);
467 void (*ShowMouseCursor)(int client);
468 const char *(*MapTime)();
469 void (*LoadResource)(const char *name);
470 void (*ClearResource)();
471 int (*Key_StringToKeynum)(const char *str);
472 const char *(*Key_KeynumToBindString)(int keyNum);
473 void (*Key_GetKeysForCommand)(const char *command, int *key1, int *key2);
474 void (*ArchiveLevel)(qboolean loading);
475 void (*AddSvsTimeFixup)(int *piTime);
476 void (*HudDrawShader)(int info, const char *name);
477 void (*HudDrawAlign)(int info, int horizontalAlign, int verticalAlign);
478 void (*HudDrawRect)(int info, int x, int y, int width, int height);
479 void (*HudDrawVirtualSize)(int info, qboolean virtualScreen);
480 void (*HudDrawColor)(int info, float *color);
481 void (*HudDrawAlpha)(int info, float alpha);
482 void (*HudDrawString)(int info, const char *string);
483 void (*HudDrawFont)(int info, const char *fontName);
484 qboolean (*SanitizeName)(const char *oldName, char *newName, size_t bufferSize);
485
486 //
487 // Added in OPM
488 //
489
493 void (*PrintfClient)(int clientNum, const char *fmt, ...);
494
495 int (*pvssoundindex)(const char* name, int streamed);
496
497 cvar_t *fsDebug;
498
499 //
500 // New functions will start from here
501 //
502
503} game_import_t;
504
505typedef struct gameExport_s {
506 int apiversion;
507
508 // the init function will only be called when a game starts,
509 // not each time a level is loaded. Persistant data for clients
510 // and the server can be allocated in init
511 void (*Init)(int startTime, int randomSeed);
512 void (*Shutdown)(void);
513 void (*Cleanup)(qboolean samemap);
514 void (*Precache)(void);
515
516 void (*SetMap)(const char *mapName);
517 void (*Restart)();
518 void (*SetTime)(int svsStartTime, int svsTime);
519
520 // each new level entered will cause a call to SpawnEntities
521 void (*SpawnEntities)(char *entstring, int levelTime);
522
523 // return NULL if the client is allowed to connect, otherwise return
524 // a text string with the reason for denial
525 const char *(*ClientConnect)(int clientNum, qboolean firstTime, qboolean differentMap);
526
527 void (*ClientBegin)(gentity_t *ent, usercmd_t *cmd);
528 void (*ClientUserinfoChanged)(gentity_t *ent, const char *userinfo);
529 void (*ClientDisconnect)(gentity_t *ent);
530 void (*ClientCommand)(gentity_t *ent);
531 void (*ClientThink)(gentity_t *ent, usercmd_t *cmd, usereyes_t *eyeinfo);
532
533 void (*BotBegin)(gentity_t *ent);
534 void (*BotThink)(gentity_t *ent, int msec);
535
536 void (*PrepFrame)(void);
537 void (*RunFrame)(int levelTime, int frameTime);
538
539 void (*ServerSpawned)(void);
540
541 void (*RegisterSounds)();
542 qboolean (*AllowPaused)();
543
544 // ConsoleCommand will be called when a command has been issued
545 // that is not recognized as a builtin function.
546 // The game can issue gi.argc() / gi.argv() commands to get the command
547 // and parameters. Return qfalse if the game doesn't recognize it as a command.
548 qboolean (*ConsoleCommand)(void);
549
550 void (*ArchivePersistant)(const char *name, qboolean loading);
551
552 // ReadLevel is called after the default map information has been
553 // loaded with SpawnEntities, so any stored client spawn spots will
554 // be used when the clients reconnect.
555 void (*WriteLevel)(const char *filename, qboolean autosave, byte** savedCgameState, size_t* savedCgameStateSize);
556 qboolean (*ReadLevel)(const char *filename, byte** savedCgameState, size_t* savedCgameStateSize);
557 qboolean (*LevelArchiveValid)(const char *filename);
558
559 void (*ArchiveInteger)(int *i);
560 void (*ArchiveFloat)(float *fl);
561 void (*ArchiveString)(char *s);
562 void (*ArchiveSvsTime)(int *pi);
563 orientation_t (*TIKI_Orientation)(gentity_t *edict, int num);
564 void (*DebugCircle)(float *org, float radius, float r, float g, float b, float alpha, qboolean horizontal);
565 void (*SetFrameNumber)(int frameNumber);
566 void (*SoundCallback)(int entNum, soundChannel_t channelNumber, const char *name);
567
568 //
569 // global variables shared between game and server
570 //
571
572 // The gentities array is allocated in the game dll so it
573 // can vary in size from one game to another.
574 //
575 // The size will be fixed when ge->Init() is called
576 // the server can't just use pointer arithmetic on gentities, because the
577 // server's sizeof(struct gentity_s) doesn't equal gentitySize
578 profGame_t *profStruct;
579 struct gentity_s *gentities;
580 int gentitySize;
581 int num_entities; // current number, <= max_entities
582 int max_entities;
583
584 const char *errorMessage;
585} game_export_t;
586
587#ifdef __cplusplus
588extern "C"
589#endif
590
591#ifdef GAME_DLL
592# ifdef WIN32
593 __declspec(dllexport)
594# else
595__attribute__((visibility("default")))
596# endif
597#endif
598 game_export_t *GetGameAPI(game_import_t *import);
599
600#if 0
601//
602// system traps provided by the main engine
603//
604typedef enum {
605 //============== general Quake services ==================
606
607 G_PRINT, // )( const char *string );
608 // print message on the local console
609
610 G_ERROR, // )( const char *string );
611 // abort the game
612
613 G_MILLISECONDS, // )( void );
614 // get current time for profiling reasons
615 // this should NOT be used for any game related tasks,
616 // because it is not journaled
617
618 // console variable interaction
619 G_CVAR_REGISTER, // )( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
620 G_CVAR_UPDATE, // )( vmCvar_t *vmCvar );
621 G_CVAR_SET, // )( const char *var_name, const char *value );
622 G_CVAR_VARIABLE_INTEGER_VALUE, // )( const char *var_name );
623
624 G_CVAR_VARIABLE_STRING_BUFFER, // )( const char *var_name, char *buffer, int bufsize );
625
626 G_ARGC, // )( void );
627 // ClientCommand and ServerCommand parameter access
628
629 G_ARGV, // )( int n, char *buffer, int bufferLength );
630
631 G_FS_FOPEN_FILE, // )( const char *qpath, fileHandle_t *file, fsMode_t mode );
632 G_FS_READ, // )( void *buffer, int len, fileHandle_t f );
633 G_FS_WRITE, // )( const void *buffer, int len, fileHandle_t f );
634 G_FS_FCLOSE_FILE, // )( fileHandle_t f );
635
636 G_SEND_CONSOLE_COMMAND, // )( const char *text );
637 // add commands to the console as if they were typed in
638 // for map changing, etc
639
640
641 //=========== server specific functionality =============
642
643 G_LOCATE_GAME_DATA, // )( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t,
644 // playerState_t *clients, int sizeofGameClient );
645 // the game needs to let the server system know where and how big the gentities
646 // are, so it can look at them directly without going through an interface
647
648 G_DROP_CLIENT, // )( int clientNum, const char *reason );
649 // kick a client off the server with a message
650
651 G_SEND_SERVER_COMMAND, // )( int clientNum, const char *fmt, ... );
652 // reliably sends a command string to be interpreted by the given
653 // client. If clientNum is -1, it will be sent to all clients
654
655 G_SET_CONFIGSTRING, // )( int num, const char *string );
656 // config strings hold all the index strings, and various other information
657 // that is reliably communicated to all clients
658 // All of the current configstrings are sent to clients when
659 // they connect, and changes are sent to all connected clients.
660 // All confgstrings are cleared at each level start.
661
662 G_GET_CONFIGSTRING, // )( int num, char *buffer, int bufferSize );
663
664 G_GET_USERINFO, // )( int num, char *buffer, int bufferSize );
665 // userinfo strings are maintained by the server system, so they
666 // are persistant across level loads, while all other game visible
667 // data is completely reset
668
669 G_SET_USERINFO, // )( int num, const char *buffer );
670
671 G_GET_SERVERINFO, // )( char *buffer, int bufferSize );
672 // the serverinfo info string has all the cvars visible to server browsers
673
674 G_SET_BRUSH_MODEL, // )( gentity_t *ent, const char *name );
675 // sets mins and maxs based on the brushmodel name
676
677 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 );
678 // collision detection against all linked entities
679
680 G_POINT_CONTENTS, // )( const vec3_t point, int passEntityNum );
681 // point contents against all linked entities
682
683 G_IN_PVS, // )( const vec3_t p1, const vec3_t p2 );
684
685 G_IN_PVS_IGNORE_PORTALS, // )( const vec3_t p1, const vec3_t p2 );
686
687 G_ADJUST_AREA_PORTAL_STATE, // )( gentity_t *ent, qboolean open );
688
689 G_AREAS_CONNECTED, // )( int area1, int area2 );
690
691 G_LINKENTITY, // )( gentity_t *ent );
692 // an entity will never be sent to a client or used for collision
693 // if it is not passed to linkentity. If the size, position, or
694 // solidity changes, it must be relinked.
695
696 G_UNLINKENTITY, // )( gentity_t *ent );
697 // call before removing an interactive entity
698
699 g_entities_IN_BOX, // )( const vec3_t mins, const vec3_t maxs, gentity_t **list, int maxcount );
700 // EntitiesInBox will return brush models based on their bounding box,
701 // so exact determination must still be done with EntityContact
702
703 G_ENTITY_CONTACT, // )( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
704 // perform an exact check against inline brush models of non-square shape
705
706 // access for bots to get and free a server client (FIXME?)
707 G_BOT_ALLOCATE_CLIENT, // )( void );
708
709 G_BOT_FREE_CLIENT, // )( int clientNum );
710
711 G_GET_USERCMD, // )( int clientNum, usercmd_t *cmd )
712
713 G_GET_ENTITY_TOKEN, // qboolean )( char *buffer, int bufferSize )
714 // Retrieves the next string token from the entity spawn text, returning
715 // false when all tokens have been parsed.
716 // This should only be done at GAME_INIT time.
717
718 G_FS_GETFILELIST,
719 G_DEBUG_POLYGON_CREATE,
720 G_DEBUG_POLYGON_DELETE,
721 G_REAL_TIME,
722 G_SNAPVECTOR,
723
724 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 );
725 G_ENTITY_CONTACTCAPSULE, // )( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
726
727 // 1.32
728 G_FS_SEEK,
729
730 BOTLIB_SETUP = 200, // )( void );
731 BOTLIB_SHUTDOWN, // )( void );
732 BOTLIB_LIBVAR_SET,
733 BOTLIB_LIBVAR_GET,
734 BOTLIB_PC_ADD_GLOBAL_DEFINE,
735 BOTLIB_START_FRAME,
736 BOTLIB_LOAD_MAP,
737 BOTLIB_UPDATENTITY,
738 BOTLIB_TEST,
739
740 BOTLIB_GET_SNAPSHOT_ENTITY, // )( int client, int ent );
741 BOTLIB_GET_CONSOLE_MESSAGE, // )( int client, char *message, int size );
742 BOTLIB_USER_COMMAND, // )( int client, usercmd_t *ucmd );
743
744 BOTLIB_AAS_ENABLE_ROUTING_AREA = 300,
745 BOTLIB_AAS_BBOX_AREAS,
746 BOTLIB_AAS_AREA_INFO,
747 BOTLIB_AAS_ENTITY_INFO,
748
749 BOTLIB_AAS_INITIALIZED,
750 BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX,
751 BOTLIB_AAS_TIME,
752
753 BOTLIB_AAS_POINT_AREA_NUM,
754 BOTLIB_AAS_TRACE_AREAS,
755
756 BOTLIB_AAS_POINT_CONTENTS,
757 BOTLIB_AAS_NEXT_BSP_ENTITY,
758 BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY,
759 BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY,
760 BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY,
761 BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY,
762
763 BOTLIB_AAS_AREA_REACHABILITY,
764
765 BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA,
766
767 BOTLIB_AAS_SWIMMING,
768 BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT,
769
770 BOTLIB_EA_SAY = 400,
771 BOTLIB_EA_SAY_TEAM,
772 BOTLIB_EA_COMMAND,
773
774 BOTLIB_EA_ACTION,
775 BOTLIB_EA_GESTURE,
776 BOTLIB_EA_TALK,
777 BOTLIB_EA_ATTACK,
778 BOTLIB_EA_USE,
779 BOTLIB_EA_RESPAWN,
780 BOTLIB_EA_CROUCH,
781 BOTLIB_EA_MOVE_UP,
782 BOTLIB_EA_MOVE_DOWN,
783 BOTLIB_EA_MOVE_FORWARD,
784 BOTLIB_EA_MOVE_BACK,
785 BOTLIB_EA_MOVE_LEFT,
786 BOTLIB_EA_MOVE_RIGHT,
787
788 BOTLIB_EA_SELECT_WEAPON,
789 BOTLIB_EA_JUMP,
790 BOTLIB_EA_DELAYED_JUMP,
791 BOTLIB_EA_MOVE,
792 BOTLIB_EA_VIEW,
793
794 BOTLIB_EA_END_REGULAR,
795 BOTLIB_EA_GET_INPUT,
796 BOTLIB_EA_RESET_INPUT,
797
798
799 BOTLIB_AI_LOAD_CHARACTER = 500,
800 BOTLIB_AI_FREE_CHARACTER,
801 BOTLIB_AI_CHARACTERISTIC_FLOAT,
802 BOTLIB_AI_CHARACTERISTIC_BFLOAT,
803 BOTLIB_AI_CHARACTERISTIC_INTEGER,
804 BOTLIB_AI_CHARACTERISTIC_BINTEGER,
805 BOTLIB_AI_CHARACTERISTIC_STRING,
806
807 BOTLIB_AI_ALLOC_CHAT_STATE,
808 BOTLIB_AI_FREE_CHAT_STATE,
809 BOTLIB_AI_QUEUE_CONSOLE_MESSAGE,
810 BOTLIB_AI_REMOVE_CONSOLE_MESSAGE,
811 BOTLIB_AI_NEXT_CONSOLE_MESSAGE,
812 BOTLIB_AI_NUM_CONSOLE_MESSAGE,
813 BOTLIB_AI_INITIAL_CHAT,
814 BOTLIB_AI_REPLY_CHAT,
815 BOTLIB_AI_CHAT_LENGTH,
816 BOTLIB_AI_ENTER_CHAT,
817 BOTLIB_AI_STRING_CONTAINS,
818 BOTLIB_AI_FIND_MATCH,
819 BOTLIB_AI_MATCH_VARIABLE,
820 BOTLIB_AI_UNIFY_WHITE_SPACES,
821 BOTLIB_AI_REPLACE_SYNONYMS,
822 BOTLIB_AI_LOAD_CHAT_FILE,
823 BOTLIB_AI_SET_CHAT_GENDER,
824 BOTLIB_AI_SET_CHAT_NAME,
825
826 BOTLIB_AI_RESET_GOAL_STATE,
827 BOTLIB_AI_RESET_AVOID_GOALS,
828 BOTLIB_AI_PUSH_GOAL,
829 BOTLIB_AI_POP_GOAL,
830 BOTLIB_AI_EMPTY_GOAL_STACK,
831 BOTLIB_AI_DUMP_AVOID_GOALS,
832 BOTLIB_AI_DUMP_GOAL_STACK,
833 BOTLIB_AI_GOAL_NAME,
834 BOTLIB_AI_GET_TOP_GOAL,
835 BOTLIB_AI_GET_SECOND_GOAL,
836 BOTLIB_AI_CHOOSE_LTG_ITEM,
837 BOTLIB_AI_CHOOSE_NBG_ITEM,
838 BOTLIB_AI_TOUCHING_GOAL,
839 BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE,
840 BOTLIB_AI_GET_LEVEL_ITEM_GOAL,
841 BOTLIB_AI_AVOID_GOAL_TIME,
842 BOTLIB_AI_INIT_LEVEL_ITEMS,
843 BOTLIB_AI_UPDATE_ENTITY_ITEMS,
844 BOTLIB_AI_LOAD_ITEM_WEIGHTS,
845 BOTLIB_AI_FREE_ITEM_WEIGHTS,
846 BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC,
847 BOTLIB_AI_ALLOC_GOAL_STATE,
848 BOTLIB_AI_FREE_GOAL_STATE,
849
850 BOTLIB_AI_RESET_MOVE_STATE,
851 BOTLIB_AI_MOVE_TO_GOAL,
852 BOTLIB_AI_MOVE_IN_DIRECTION,
853 BOTLIB_AI_RESET_AVOID_REACH,
854 BOTLIB_AI_RESET_LAST_AVOID_REACH,
855 BOTLIB_AI_REACHABILITY_AREA,
856 BOTLIB_AI_MOVEMENT_VIEW_TARGET,
857 BOTLIB_AI_ALLOC_MOVE_STATE,
858 BOTLIB_AI_FREE_MOVE_STATE,
859 BOTLIB_AI_INIT_MOVE_STATE,
860
861 BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON,
862 BOTLIB_AI_GET_WEAPON_INFO,
863 BOTLIB_AI_LOAD_WEAPON_WEIGHTS,
864 BOTLIB_AI_ALLOC_WEAPON_STATE,
865 BOTLIB_AI_FREE_WEAPON_STATE,
866 BOTLIB_AI_RESET_WEAPON_STATE,
867
868 BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION,
869 BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC,
870 BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC,
871 BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL,
872 BOTLIB_AI_GET_MAP_LOCATION_GOAL,
873 BOTLIB_AI_NUM_INITIAL_CHATS,
874 BOTLIB_AI_GET_CHAT_MESSAGE,
875 BOTLIB_AI_REMOVE_FROM_AVOID_GOALS,
876 BOTLIB_AI_PREDICT_VISIBLE_POSITION,
877
878 BOTLIB_AI_SET_AVOID_GOAL_TIME,
879 BOTLIB_AI_ADD_AVOID_SPOT,
880 BOTLIB_AAS_ALTERNATIVE_ROUTE_GOAL,
881 BOTLIB_AAS_PREDICT_ROUTE,
882 BOTLIB_AAS_POINT_REACHABILITY_AREA_INDEX,
883
884 BOTLIB_PC_LOAD_SOURCE,
885 BOTLIB_PC_FREE_SOURCE,
886 BOTLIB_PC_READ_TOKEN,
887 BOTLIB_PC_SOURCE_FILE_AND_LINE,
888
889 G_TIKI_REGISTERMODEL,
890 G_TIKI_GETBONES,
891 G_TIKI_SETCHANNELS,
892 G_TIKI_APPENDFRAMEBOUNDSANDRADIUS,
893 G_TIKI_ANIMATE,
894 G_TIKI_GETBONENAMEINDEX,
895 G_MSG_WRITEBITS,
896 G_MSG_WRITECHAR,
897 G_MSG_WRITEBYTE,
898 G_MSG_WRITESVC,
899 G_MSG_WRITESHORT,
900 G_MSG_WRITELONG,
901 G_MSG_WRITEFLOAT,
902 G_MSG_WRITESTR,
903 G_MSG_WRITEANGLE8,
904 G_MSG_WRITEANGLE16,
905 G_MSG_WRITECOORD,
906 G_MSG_WRITEDIR,
907 G_MSG_STARTCGM,
908 G_MSG_ENDCGM,
909 G_MSG_SETCLIENT,
910 G_MSG_BROADCASTALL,
911 G_MSG_BROADCASTVISIBLE,
912 G_MSG_BROADCASTHEARABLE,
913} game_import_t;
914
915
916//
917// functions exported by the game subsystem
918//
919typedef enum {
920 GAME_INIT, // )( int levelTime, int randomSeed, int restart );
921 // init and shutdown will be called every single level
922 // The game should call G_GET_ENTITY_TOKEN to parse through all the
923 // entity configuration text and spawn gentities.
924
925 GAME_SHUTDOWN, // (void);
926
927 GAME_CLIENT_CONNECT, // )( int clientNum, qboolean firstTime, qboolean isBot );
928 // return NULL if the client is allowed to connect, otherwise return
929 // a text string with the reason for denial
930
931 GAME_CLIENT_BEGIN, // )( int clientNum );
932
933 GAME_CLIENT_USERINFO_CHANGED, // )( int clientNum );
934
935 GAME_CLIENT_DISCONNECT, // )( int clientNum );
936
937 GAME_CLIENT_COMMAND, // )( int clientNum );
938
939 GAME_CLIENT_THINK, // )( int clientNum );
940
941 GAME_RUN_FRAME, // )( int levelTime );
942
943 GAME_CONSOLE_COMMAND, // )( void );
944 // ConsoleCommand will be called when a command has been issued
945 // that is not recognized as a builtin function.
946 // The game can issue gi.argc() / gi.argv() commands to get the command
947 // and parameters. Return qfalse if the game doesn't recognize it as a command.
948
949 BOTAI_START_FRAME // )( int time );
950} game_export_t;
951#endif
Definition entity.h:203
Definition str.h:77
Definition alias.h:40
Definition qfiles.h:551
Definition g_public.h:131
Definition q_shared.h:2095
Definition q_shared.h:2105
Definition tiki_shared.h:176
Definition tiki_shared.h:157
Definition g_public.h:83
Definition g_public.h:505
Definition g_public.h:233
void(* PrintfClient)(int clientNum, const char *fmt,...)
Definition g_public.h:493
Definition g_public.h:149
Definition g_public.h:168
Definition g_public.h:75
Definition q_shared.h:1524
Definition g_public.h:214
Definition g_public.h:202
Definition tiki_shared.h:112
Definition q_shared.h:1452