Debian Codegraph @

code/game/g_local.h

raw ◀ ▶
1 Debian patch touch this file
1 /*
2 ===========================================================================
3 Copyright (C) 1999-2005 Id Software, Inc.
4
5 This file is part of Quake III Arena source code.
6
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.
11
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.
16
17 You should have received a copyPl 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 ===========================================================================
21 */
22 //
23 // g_local.h -- local definitions for game module
24
25 #include "../qcommon/q_shared.h"
26 #include "bg_public.h"
27 #include "g_public.h"
28 #include "challenges.h"
29
30 //==================================================================
31
32 // the "gameversion" client command will print this plus compile date
33 #define GAMEVERSION BASEGAME
34
35 #define BODY_QUEUE_SIZE 8
36
37 #define INFINITE 1000000
38
39 #define FRAMETIME 100 // msec
40 #define CARNAGE_REWARD_TIME 3000
41 #define REWARD_SPRITE_TIME 2000
42
43 #define INTERMISSION_DELAY_TIME 1000
44 #define SP_INTERMISSION_DELAY_TIME 5000
45
46 //Domination how many seconds between awarded a point (multiplied by two if more than 3 points)
47 #define DOM_SECSPERPOINT 2000
48
49 //limit of the votemaps.cfg file and other custom map files
50 #define MAX_MAPS_TEXT 8192
51
52 // gentity->flags
53 #define FL_GODMODE 0x00000010
54 #define FL_NOTARGET 0x00000020
55 #define FL_TEAMSLAVE 0x00000400 // not the first on the team
56 #define FL_NO_KNOCKBACK 0x00000800
57 #define FL_DROPPED_ITEM 0x00001000
58 #define FL_NO_BOTS 0x00002000 // spawn point not for bot use
59 #define FL_NO_HUMANS 0x00004000 // spawn point just for bots
60 #define FL_FORCE_GESTURE 0x00008000 // force gesture on client
61
62 // movers are things like doors, plats, buttons, etc
63 typedef enum {
64 MOVER_POS1,
65 MOVER_POS2,
66 MOVER_1TO2,
67 MOVER_2TO1
68 } moverState_t;
69
70 #define SP_PODIUM_MODEL "models/mapobjects/podium/podium4.md3"
71
72 //============================================================================
73
74 typedef struct gentity_s gentity_t;
75 typedef struct gclient_s gclient_t;
76
77 struct gentity_s {
78 entityState_t s; // communicated by server to clients
79 entityShared_t r; // shared by both the server system and game
80
81 // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
82 // EXPECTS THE FIELDS IN THAT ORDER!
83 //================================
84
85 struct gclient_s *client; // NULL if not a client
86
87 qboolean inuse;
88
89 char *classname; // set in QuakeEd
90 int spawnflags; // set in QuakeEd
91
92 qboolean neverFree; // if true, FreeEntity will only unlink
93 // bodyque uses this
94
95 int flags; // FL_* variables
96
97 char *model;
98 char *model2;
99 int freetime; // level.time when the object was freed
100
101 int eventTime; // events will be cleared EVENT_VALID_MSEC after set
102 qboolean freeAfterEvent;
103 qboolean unlinkAfterEvent;
104
105 qboolean physicsObject; // if true, it can be pushed by movers and fall off edges
106 // all game items are physicsObjects,
107 float physicsBounce; // 1.0 = continuous bounce, 0.0 = no bounce
108 int clipmask; // brushes with this content value will be collided against
109 // when moving. items and corpses do not collide against
110 // players, for instance
111
112 // movers
113 moverState_t moverState;
114 int soundPos1;
115 int sound1to2;
116 int sound2to1;
117 int soundPos2;
118 int soundLoop;
119 gentity_t *parent;
120 gentity_t *nextTrain;
121 gentity_t *prevTrain;
122 vec3_t pos1, pos2;
123
124 char *message;
125
126 int timestamp; // body queue sinking, etc
127
128 float angle; // set in editor, -1 = up, -2 = down
129 char *target;
130 char *targetname;
131 char *team;
132 char *targetShaderName;
133 char *targetShaderNewName;
134 gentity_t *target_ent;
135
136 float speed;
137 vec3_t movedir;
138
139 int nextthink;
140 void (*think)(gentity_t *self);
141 void (*reached)(gentity_t *self); // movers call this when hitting endpoint
142 void (*blocked)(gentity_t *self, gentity_t *other);
143 void (*touch)(gentity_t *self, gentity_t *other, trace_t *trace);
144 void (*use)(gentity_t *self, gentity_t *other, gentity_t *activator);
145 void (*pain)(gentity_t *self, gentity_t *attacker, int damage);
146 void (*die)(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
147
148 int pain_debounce_time;
149 int fly_sound_debounce_time; // wind tunnel
150 int last_move_time;
151
152 int health;
153
154 qboolean takedamage;
155
156 int damage;
157 int splashDamage; // quad will increase this without increasing radius
158 int splashRadius;
159 int methodOfDeath;
160 int splashMethodOfDeath;
161
162 int count;
163
164 gentity_t *chain;
165 gentity_t *enemy;
166 gentity_t *activator;
167 gentity_t *teamchain; // next entity in team
168 gentity_t *teammaster; // master of the team
169
170 int kamikazeTime;
171 int kamikazeShockTime;
172
173 int watertype;
174 int waterlevel;
175
176 int noise_index;
177
178 // timing variables
179 float wait;
180 float random;
181
182 gitem_t *item; // for bonus items
183 };
184
185
186 typedef enum {
187 CON_DISCONNECTED,
188 CON_CONNECTING,
189 CON_CONNECTED
190 } clientConnected_t;
191
192 typedef enum {
193 SPECTATOR_NOT,
194 SPECTATOR_FREE,
195 SPECTATOR_FOLLOW,
196 SPECTATOR_SCOREBOARD
197 } spectatorState_t;
198
199 typedef enum {
200 TEAM_BEGIN, // Beginning a team game, spawn at base
201 TEAM_ACTIVE // Now actively playing
202 } playerTeamStateState_t;
203
204 typedef struct {
205 playerTeamStateState_t state;
206
207 int location;
208
209 int captures;
210 int basedefense;
211 int carrierdefense;
212 int flagrecovery;
213 int fragcarrier;
214 int assists;
215
216 float lasthurtcarrier;
217 float lastreturnedflag;
218 float flagsince;
219 float lastfraggedcarrier;
220 } playerTeamState_t;
221
222 // the auto following clients don't follow a specific client
223 // number, but instead follow the first two active players
224 #define FOLLOW_ACTIVE1 -1
225 #define FOLLOW_ACTIVE2 -2
226
227 // client data that stays across multiple levels or tournament restarts
228 // this is achieved by writing all the data to cvar strings at game shutdown
229 // time and reading them back at connection time. Anything added here
230 // MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
231 typedef struct {
232 team_t sessionTeam;
233 int spectatorNum; // for determining next-in-line to play
234 spectatorState_t spectatorState;
235 int spectatorClient; // for chasecam and follow mode
236 int wins, losses; // tournament stats
237 qboolean teamLeader; // true when this client is a team leader
238 } clientSession_t;
239
240 //
241 #define MAX_NETNAME 36
242 #define MAX_VOTE_COUNT "3"
243
244 //unlagged - true ping
245 #define NUM_PING_SAMPLES 64
246 //unlagged - true ping
247
248 // client data that stays across multiple respawns, but is cleared
249 // on each level change or team change at ClientBegin()
250 typedef struct {
251 clientConnected_t connected;
252 usercmd_t cmd; // we would lose angles if not persistant
253 qboolean localClient; // true if "ip" info key is "localhost"
254 qboolean initialSpawn; // the first spawn should be at a cool location
255 qboolean predictItemPickup; // based on cg_predictItems userinfo
256 qboolean pmoveFixed; //
257 char netname[MAX_NETNAME];
258 int maxHealth; // for handicapping
259 int enterTime; // level.time the client entered the game
260 playerTeamState_t teamState; // status in teamplay games
261 int voteCount; // to prevent people from constantly calling votes
262 int teamVoteCount; // to prevent people from constantly calling votes
263 qboolean teamInfo; // send team overlay updates?
264 //elimination:
265 int roundReached; //Only spawn if we are new to this round
266 int livesLeft; //lives in LMS
267
268 //unlagged - client options
269 // these correspond with variables in the userinfo string
270 int delag;
271 // int debugDelag;
272 int cmdTimeNudge;
273 //unlagged - client options
274 //unlagged - lag simulation #2
275 /* int latentSnaps;
276 int latentCmds;
277 int plOut;
278 usercmd_t cmdqueue[MAX_LATENT_CMDS];
279 int cmdhead;*/
280 //unlagged - lag simulation #2
281 //unlagged - true ping
282 int realPing;
283 int pingsamples[NUM_PING_SAMPLES];
284 int samplehead;
285 //unlagged - true ping
286 //KK-OAX Killing Sprees/Multikills
287 int killstreak;
288 int deathstreak;
289 qboolean onSpree;
290 int multiKillCount;
291
292 //KK-OAX Admin Stuff
293 char guid[ 33 ];
294 char ip[ 40 ];
295 qboolean muted;
296 qboolean disoriented;
297 qboolean wasdisoriented;
298 int adminLevel;
299
300 // flood protection
301 int floodDemerits;
302 int floodTime;
303
304 //Used To Track Name Changes
305 int nameChangeTime;
306 int nameChanges;
307
308 } clientPersistant_t;
309
310 //unlagged - backward reconciliation #1
311 // the size of history we'll keep
312 #define NUM_CLIENT_HISTORY 17
313
314 // everything we need to know to backward reconcile
315 typedef struct {
316 vec3_t mins, maxs;
317 vec3_t currentOrigin;
318 int leveltime;
319 } clientHistory_t;
320 //unlagged - backward reconciliation #1
321
322 // this structure is cleared on each ClientSpawn(),
323 // except for 'client->pers' and 'client->sess'
324 struct gclient_s {
325 // ps MUST be the first element, because the server expects it
326 playerState_t ps; // communicated by server to clients
327
328 // the rest of the structure is private to game
329 clientPersistant_t pers;
330 clientSession_t sess;
331
332 qboolean readyToExit; // wishes to leave the intermission
333
334 qboolean noclip;
335
336 //Unlagged - commented out - handled differently
337 //int lastCmdTime; // level.time of last usercmd_t, for EF_CONNECTION
338 // we can't just use pers.lastCommand.time, because
339 // of the g_sycronousclients case
340 int buttons;
341 int oldbuttons;
342 int latched_buttons;
343
344 vec3_t oldOrigin;
345
346 // sum up damage over an entire frame, so
347 // shotgun blasts give a single big kick
348 int damage_armor; // damage absorbed by armor
349 int damage_blood; // damage taken out of health
350 int damage_knockback; // impact damage
351 vec3_t damage_from; // origin for vector calculation
352 qboolean damage_fromWorld; // if true, don't use the damage_from vector
353
354 int accurateCount; // for "impressive" reward sound
355
356 int accuracy_shots; // total number of shots
357 int accuracy_hits; // total number of hits
358
359 //
360 int lastkilled_client; // last client that this client killed
361 int lasthurt_client; // last client that damaged this client
362 int lasthurt_mod; // type of damage the client did
363
364 // timers
365 int respawnTime; // can respawn when time > this, force after g_forcerespwan
366 int inactivityTime; // kick players when time > this
367 qboolean inactivityWarning; // qtrue if the five seoond warning has been given
368 int rewardTime; // clear the EF_AWARD_IMPRESSIVE, etc when time > this
369
370 int airOutTime;
371
372 int lastKillTime; // for multiple kill rewards
373
374 qboolean fireHeld; // used for hook
375 gentity_t *hook; // grapple hook if out
376
377 int switchTeamTime; // time the player switched teams
378
379 // timeResidual is used to handle events that happen every second
380 // like health / armor countdowns and regeneration
381 int timeResidual;
382
383 gentity_t *persistantPowerup;
384 int portalID;
385 int ammoTimes[WP_NUM_WEAPONS];
386 int invulnerabilityTime;
387
388
389 char *areabits;
390
391 qboolean isEliminated; //Has been killed in this round
392
393 //New vote system. The votes are saved in the client info, so we know who voted on what and can cancel votes on leave.
394 //0=not voted, 1=voted yes, -1=voted no
395 int vote;
396
397 int lastSentFlying; //The last client that sent the player flying
398 int lastSentFlyingTime; //So we can time out
399
400
401 //unlagged - backward reconciliation #1
402 // the serverTime the button was pressed
403 // (stored before pmove_fixed changes serverTime)
404 int attackTime;
405 // the head of the history queue
406 int historyHead;
407 // the history queue
408 clientHistory_t history[NUM_CLIENT_HISTORY];
409 // the client's saved position
410 clientHistory_t saved; // used to restore after time shift
411 // an approximation of the actual server time we received this
412 // command (not in 50ms increments)
413 int frameOffset;
414 //unlagged - backward reconciliation #1
415
416 //unlagged - smooth clients #1
417 // the last frame number we got an update from this client
418 int lastUpdateFrame;
419 //unlagged - smooth clients #1
420 qboolean spawnprotected;
421
422 int accuracy[WP_NUM_WEAPONS][2];
423 };
424
425
426 //
427 // this structure is cleared as each map is entered
428 //
429 #define MAX_SPAWN_VARS 64
430 #define MAX_SPAWN_VARS_CHARS 4096
431
432 typedef struct {
433 struct gclient_s *clients; // [maxclients]
434
435 struct gentity_s *gentities;
436 int gentitySize;
437 int num_entities; // current number, <= MAX_GENTITIES
438
439 int warmupTime; // restart match at this time
440
441 fileHandle_t logFile;
442
443 // store latched cvars here that we want to get at often
444 int maxclients;
445
446 int framenum;
447 int time; // in msec
448 int previousTime; // so movers can back up when blocked
449
450 int startTime; // level.time the map was started
451
452 int teamScores[TEAM_NUM_TEAMS];
453 int lastTeamLocationTime; // last time of client team location update
454
455 qboolean newSession; // don't use any old session data, because
456 // we changed gametype
457
458 qboolean restarted; // waiting for a map_restart to fire
459
460 int numConnectedClients;
461 int numNonSpectatorClients; // includes connecting clients
462 int numPlayingClients; // connected, non-spectators
463 int sortedClients[MAX_CLIENTS]; // sorted by score
464 int follow1, follow2; // clientNums for auto-follow spectators
465
466 int snd_fry; // sound index for standing in lava
467
468 int warmupModificationCount; // for detecting if g_warmup is changed
469
470 // voting state
471 char voteString[MAX_STRING_CHARS];
472 char voteDisplayString[MAX_STRING_CHARS];
473 int voteTime; // level.time vote was called
474 int voteExecuteTime; // time the vote is executed
475 int voteYes;
476 int voteNo;
477 int numVotingClients; // set by CountVotes
478 int voteKickClient; // if non-negative the current vote is about this client.
479 int voteKickType; // if 1 = ban (execute ban)
480
481 // team voting state
482 char teamVoteString[2][MAX_STRING_CHARS];
483 int teamVoteTime[2]; // level.time vote was called
484 int teamVoteYes[2];
485 int teamVoteNo[2];
486 int numteamVotingClients[TEAM_NUM_TEAMS];// set by CalculateRanks
487
488 // spawn variables
489 qboolean spawning; // the G_Spawn*() functions are valid
490 int numSpawnVars;
491 char *spawnVars[MAX_SPAWN_VARS][2]; // key / value pairs
492 int numSpawnVarChars;
493 char spawnVarChars[MAX_SPAWN_VARS_CHARS];
494
495 // intermission state
496 int intermissionQueued; // intermission was qualified, but
497 // wait INTERMISSION_DELAY_TIME before
498 // actually going there so the last
499 // frag can be watched. Disable future
500 // kills during this delay
501 int intermissiontime; // time the intermission was started
502 char *changemap;
503 qboolean readyToExit; // at least one client wants to exit
504 int exitTime;
505 vec3_t intermission_origin; // also used for spectator spawns
506 vec3_t intermission_angle;
507
508 qboolean locationLinked; // target_locations get linked
509 gentity_t *locationHead; // head of the location list
510 int bodyQueIndex; // dead bodies
511 gentity_t *bodyQue[BODY_QUEUE_SIZE];
512 int portalSequence;
513 //Added for elimination:
514 int roundStartTime; //time the current round was started
515 int roundNumber; //The round number we have reached
516 int roundNumberStarted; //1 less than roundNumber if we are allowed to spawn
517 int roundRedPlayers; //How many players was there at start of round
518 int roundBluePlayers; //used to find winners in a draw.
519 qboolean roundRespawned; //We have respawned for this round!
520 int eliminationSides; //Random, change red/blue bases
521
522 //Added for Double Domination
523 //Points get status: TEAM_FREE for not taking, TEAM_RED/TEAM_BLUE for taken and TEAM_NONE for not spawned yet
524 int pointStatusA; //Status of the RED (A) domination point
525 int pointStatusB; //Status of the BLUE (B) doimination point
526 int timeTaken; //Time team started having both points
527 //use roundStartTime for telling, then the points respawn
528
529 //Added for standard domination
530 int pointStatusDom[MAX_DOMINATION_POINTS]; //Holds the owner of all the points
531 int dom_scoreGiven; //Number of times we have provided scores
532 int domination_points_count;
533 char domination_points_names[MAX_DOMINATION_POINTS][MAX_DOMINATION_POINTS_NAMES];
534
535 //Added to keep track of challenges (can only be completed against humanplayers)
536 qboolean hadBots; //There was bots in the level
537 int teamSize; //The highest number of players on the least populated team when there was most players
538
539 //unlagged - backward reconciliation #4
540 // actual time this server frame started
541 int frameStartTime;
542 //unlagged - backward reconciliation #4
543 //KK-OAX Storing upper bounds of spree/multikill arrays
544 int kSpreeUBound;
545 int dSpreeUBound;
546 int mKillUBound;
547 //KK-OAX Storing g_spreeDiv to avoid dividing by 0.
548 int spreeDivisor;
549
550 qboolean RedTeamLocked;
551 qboolean BlueTeamLocked;
552 qboolean FFALocked;
553
554 //Obelisk tell
555 int healthRedObelisk; //health in percent
556 int healthBlueObelisk; //helth in percent
557 qboolean MustSendObeliskHealth; //Health has changed
558
559 } level_locals_t;
560
561 //KK-OAX These are some Print Shortcuts for KillingSprees and Admin
562 //KK-Moved to g_admin.h
563 //Prints to All when using "va()" in conjunction.
564 //#define AP(x) trap_SendServerCommand(-1, x)
565
566 //
567 // g_spawn.c
568 //
569 qboolean G_SpawnString( const char *key, const char *defaultString, char **out );
570 // spawn string returns a temporary reference, you must CopyString() if you want to keep it
571 qboolean G_SpawnFloat( const char *key, const char *defaultString, float *out );
572 qboolean G_SpawnInt( const char *key, const char *defaultString, int *out );
573 qboolean G_SpawnVector( const char *key, const char *defaultString, float *out );
574 void G_SpawnEntitiesFromString( void );
575 char *G_NewString( const char *string );
576
577 //
578 // g_cmds.c
579 //
580 void Cmd_Score_f (gentity_t *ent);
581 void StopFollowing( gentity_t *ent );
582 void BroadcastTeamChange( gclient_t *client, int oldTeam );
583 void SetTeam( gentity_t *ent, char *s );
584 void Cmd_FollowCycle_f( gentity_t *ent ); //KK-OAX Changed to match definition
585 char *ConcatArgs( int start ); //KK-OAX This declaration moved from g_svccmds.c
586 //KK-OAX Added this to make accessible from g_svcmds_ext.c
587 void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText );
588
589
590 // KK-OAX Added these in a seperate file to keep g_cmds.c familiar.
591 // g_cmds_ext.c
592 //
593
594 int G_SayArgc( void );
595 qboolean G_SayArgv( int n, char *buffer, int bufferLength );
596 char *G_SayConcatArgs( int start );
597 void G_DecolorString( char *in, char *out, int len );
598 void G_MatchOnePlayer( int *plist, int num, char *err, int len );
599 void G_SanitiseString( char *in, char *out, int len );
600 int G_ClientNumbersFromString( char *s, int *plist, int max );
601 int G_FloodLimited( gentity_t *ent );
602 //void QDECL G_AdminMessage( const char *prefix, const char *fmt, ... )
603 // ^^ Do Not Need to Declare--Just for Documentation of where it is.
604 void Cmd_AdminMessage_f( gentity_t *ent );
605 int G_ClientNumberFromString( char *s );
606 qboolean G_ClientIsLagging( gclient_t *client );
607 void SanitizeString( char *in, char *out );
608
609 // KK-OAX Added this for common file stuff between Admin and Sprees.
610 // g_fileops.c
611 //
612 void readFile_int( char **cnf, int *v );
613 void readFile_string( char **cnf, char *s, int size );
614 void writeFile_int( int v, fileHandle_t f );
615 void writeFile_string( char *s, fileHandle_t f );
616
617 //
618 // g_items.c
619 //
620 void G_CheckTeamItems( void );
621 void G_RunItem( gentity_t *ent );
622 void RespawnItem( gentity_t *ent );
623
624 void UseHoldableItem( gentity_t *ent );
625 void PrecacheItem (gitem_t *it);
626 gentity_t *Drop_Item( gentity_t *ent, gitem_t *item, float angle );
627 gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity );
628 void SetRespawn (gentity_t *ent, float delay);
629 void G_SpawnItem (gentity_t *ent, gitem_t *item);
630 void FinishSpawningItem( gentity_t *ent );
631 void Think_Weapon (gentity_t *ent);
632 int ArmorIndex (gentity_t *ent);
633 void Add_Ammo (gentity_t *ent, int weapon, int count);
634 void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace);
635
636 void ClearRegisteredItems( void );
637 void RegisterItem( gitem_t *item );
638 void SaveRegisteredItems( void );
639
640 //
641 // g_utils.c
642 //
643 int G_ModelIndex( char *name );
644 int G_SoundIndex( char *name );
645 void G_TeamCommand( team_t team, char *cmd );
646 void G_KillBox (gentity_t *ent);
647 gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match);
648 gentity_t *G_PickTarget (char *targetname);
649 void G_UseTargets (gentity_t *ent, gentity_t *activator);
650 void G_SetMovedir ( vec3_t angles, vec3_t movedir);
651
652 void G_InitGentity( gentity_t *e );
653 gentity_t *G_Spawn (void);
654 gentity_t *G_TempEntity( vec3_t origin, int event );
655 void G_Sound( gentity_t *ent, int channel, int soundIndex );
656
657 //KK-OAX For Playing Sounds Globally
658 void G_GlobalSound( int soundIndex );
659
660 void G_FreeEntity( gentity_t *e );
661 qboolean G_EntitiesFree( void );
662
663 void G_TouchTriggers (gentity_t *ent);
664 void G_TouchSolids (gentity_t *ent);
665
666 float *tv (float x, float y, float z);
667 char *vtos( const vec3_t v );
668
669 float vectoyaw( const vec3_t vec );
670
671 void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm );
672 void G_AddEvent( gentity_t *ent, int event, int eventParm );
673 void G_SetOrigin( gentity_t *ent, vec3_t origin );
674 void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
675 const char *BuildShaderStateConfig( void );
676
677 //
678 // g_combat.c
679 //
680 qboolean CanDamage (gentity_t *targ, vec3_t origin);
681 void G_Damage (gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod);
682 qboolean G_RadiusDamage (vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, int mod);
683 int G_InvulnerabilityEffect( gentity_t *targ, vec3_t dir, vec3_t point, vec3_t impactpoint, vec3_t bouncedir );
684 void body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath );
685 void TossClientItems( gentity_t *self );
686 void TossClientPersistantPowerups( gentity_t *self );
687 void TossClientCubes( gentity_t *self );
688
689 // damage flags
690 #define DAMAGE_RADIUS 0x00000001 // damage was indirect
691 #define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage
692 #define DAMAGE_NO_KNOCKBACK 0x00000004 // do not affect velocity, just view angles
693 #define DAMAGE_NO_PROTECTION 0x00000008 // armor, shields, invulnerability, and godmode have no effect
694 #define DAMAGE_NO_TEAM_PROTECTION 0x00000010 // armor, shields, invulnerability, and godmode have no effect
695
696 //
697 // g_missile.c
698 //
699 void G_RunMissile( gentity_t *ent );
700 void ProximityMine_RemoveAll( void );
701
702 gentity_t *fire_blaster (gentity_t *self, vec3_t start, vec3_t aimdir);
703 gentity_t *fire_plasma (gentity_t *self, vec3_t start, vec3_t aimdir);
704 gentity_t *fire_grenade (gentity_t *self, vec3_t start, vec3_t aimdir);
705 gentity_t *fire_rocket (gentity_t *self, vec3_t start, vec3_t dir);
706 gentity_t *fire_bfg (gentity_t *self, vec3_t start, vec3_t dir);
707 gentity_t *fire_grapple (gentity_t *self, vec3_t start, vec3_t dir);
708 gentity_t *fire_nail( gentity_t *self, vec3_t start, vec3_t forward, vec3_t right, vec3_t up );
709 gentity_t *fire_prox( gentity_t *self, vec3_t start, vec3_t aimdir );
710
711
712 //
713 // g_mover.c
714 //
715 void G_RunMover( gentity_t *ent );
716 void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace );
717
718 //
719 // g_trigger.c
720 //
721 void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace );
722
723
724 //
725 // g_misc.c
726 //
727 void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles );
728 void DropPortalSource( gentity_t *ent );
729 void DropPortalDestination( gentity_t *ent );
730
731
732 //
733 // g_weapon.c
734 //
735 qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker );
736 void CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint );
737 //unlagged - attack prediction #3
738 // we're making this available to both games
739 void SnapVectorTowards( vec3_t v, vec3_t to );
740 //unlagged - attack prediction #3
741 qboolean CheckGauntletAttack( gentity_t *ent );
742 void Weapon_HookFree (gentity_t *ent);
743 void Weapon_HookThink (gentity_t *ent);
744
745 //unlagged - g_unlagged.c
746 void G_ResetHistory( gentity_t *ent );
747 void G_StoreHistory( gentity_t *ent );
748 void G_TimeShiftAllClients( int time, gentity_t *skip );
749 void G_UnTimeShiftAllClients( gentity_t *skip );
750 void G_DoTimeShiftFor( gentity_t *ent );
751 void G_UndoTimeShiftFor( gentity_t *ent );
752 void G_UnTimeShiftClient( gentity_t *client );
753 void G_PredictPlayerMove( gentity_t *ent, float frametime );
754 //unlagged - g_unlagged.c
755
756 //
757 // g_client.c
758 //
759 team_t TeamCount( int ignoreClientNum, int team );
760 team_t TeamLivingCount( int ignoreClientNum, int team ); //Elimination
761 team_t TeamHealthCount( int ignoreClientNum, int team ); //Elimination
762 void RespawnAll(void); //For round elimination
763 void RespawnDead(void);
764 void EnableWeapons(void);
765 void DisableWeapons(void);
766 void EndEliminationRound(void);
767 void LMSpoint(void);
768 //void wins2score(void);
769 int TeamLeader( int team );
770 team_t PickTeam( int ignoreClientNum );
771 void SetClientViewAngle( gentity_t *ent, vec3_t angle );
772 gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles );
773 void CopyToBodyQue( gentity_t *ent );
774 void ClientRespawn(gentity_t *ent);
775 void BeginIntermission (void);
776 void InitClientPersistant (gclient_t *client);
777 void InitClientResp (gclient_t *client);
778 void InitBodyQue (void);
779 void ClientSpawn( gentity_t *ent );
780 void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
781 void AddScore( gentity_t *ent, vec3_t origin, int score );
782 void CalculateRanks( void );
783 qboolean SpotWouldTelefrag( gentity_t *spot );
784
785 //
786 // g_svcmds.c
787 //
788 qboolean ConsoleCommand( void );
789 void G_ProcessIPBans(void);
790 qboolean G_FilterPacket (char *from);
791
792 //KK-OAX Added this to make accessible from g_svcmds_ext.c
793 gclient_t *ClientForString( const char *s );
794
795 //
796 // g_weapon.c
797 //
798 void FireWeapon( gentity_t *ent );
799 void G_StartKamikaze( gentity_t *ent );
800
801 //
802 // p_hud.c
803 //
804 void MoveClientToIntermission (gentity_t *client);
805 void G_SetStats (gentity_t *ent);
806
807 //
808 // g_cmds.c
809 // Also another place /Sago
810
811 void DoubleDominationScoreTimeMessage( gentity_t *ent );
812 void YourTeamMessage( gentity_t *ent);
813 void AttackingTeamMessage( gentity_t *ent );
814 void ObeliskHealthMessage( void );
815 void DeathmatchScoreboardMessage (gentity_t *client);
816 void EliminationMessage (gentity_t *client);
817 void RespawnTimeMessage(gentity_t *ent, int time);
818 void DominationPointNamesMessage (gentity_t *client);
819 void DominationPointStatusMessage( gentity_t *ent );
820 void ChallengeMessage( gentity_t *ent, int challengeNumber );
821 void SendCustomVoteCommands(int clientNum);
822
823 //
824 // g_pweapon.c
825 //
826
827
828 //
829 // g_main.c
830 //
831 void FindIntermissionPoint( void );
832 void SetLeader(int team, int client);
833 void CheckTeamLeader( int team );
834 void G_RunThink (gentity_t *ent);
835 void AddTournamentQueue(gclient_t *client);
836 void ExitLevel( void );
837 void QDECL G_LogPrintf( const char *fmt, ... );
838 void SendScoreboardMessageToAllClients( void );
839 void SendEliminationMessageToAllClients( void );
840 void SendDDtimetakenMessageToAllClients( void );
841 void SendDominationPointsStatusMessageToAllClients( void );
842 void SendYourTeamMessageToTeam( team_t team );
843 void QDECL G_Printf( const char *fmt, ... );
844 void QDECL G_Error( const char *fmt, ... ) __attribute__((noreturn));
845 //KK-OAX Made Accessible for g_admin.c
846 void LogExit( const char *string );
847 void CheckTeamVote( int team );
848
849 //
850 // g_client.c
851 //
852 char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot );
853 void ClientUserinfoChanged( int clientNum );
854 void ClientDisconnect( int clientNum );
855 void ClientBegin( int clientNum );
856 void ClientCommand( int clientNum );
857
858 //
859 // g_active.c
860 //
861 void ClientThink( int clientNum );
862 void ClientEndFrame( gentity_t *ent );
863 void G_RunClient( gentity_t *ent );
864
865 //
866 // g_team.c
867 //
868 qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
869 void Team_CheckDroppedItem( gentity_t *dropped );
870 qboolean CheckObeliskAttack( gentity_t *obelisk, gentity_t *attacker );
871 void ShuffleTeams(void);
872 //KK-OAX Added for Command Handling Changes (r24)
873 team_t G_TeamFromString( char *str );
874
875 //KK-OAX Removed these in Code in favor of bg_alloc.c from Tremulous
876 // g_mem.c
877 //
878 //void *G_Alloc( int size );
879 //void G_InitMemory( void );
880
881 //KK-OAX This was moved
882 // bg_alloc.c
883 //
884 void Svcmd_GameMem_f( void );
885
886 //
887 // g_session.c
888 //
889 void G_ReadSessionData( gclient_t *client );
890 void G_InitSessionData( gclient_t *client, char *userinfo );
891
892 void G_InitWorldSession( void );
893 void G_WriteSessionData( void );
894
895 //
896 // g_arenas.c
897 //
898 void UpdateTournamentInfo( void );
899 void SpawnModelsOnVictoryPads( void );
900 void Svcmd_AbortPodium_f( void );
901
902 //
903 // g_bot.c
904 //
905 void G_InitBots( qboolean restart );
906 char *G_GetBotInfoByNumber( int num );
907 char *G_GetBotInfoByName( const char *name );
908 void G_CheckBotSpawn( void );
909 void G_RemoveQueuedBotBegin( int clientNum );
910 qboolean G_BotConnect( int clientNum, qboolean restart );
911 void Svcmd_AddBot_f( void );
912 void Svcmd_BotList_f( void );
913 void BotInterbreedEndMatch( void );
914
915 //
916 // g_playerstore.c
917 //
918
919 void PlayerStoreInit( void );
920 void PlayerStore_store(char* guid, playerState_t ps);
921 void PlayerStore_restore(char* guid, playerState_t *ps);
922
923 //
924 // g_vote.c
925 //
•926 int allowedVote(const char *commandStr);
927 void CheckVote( void );
928 void CountVotes( void );
929 void ClientLeaving(int clientNumber);
930
931 #define MAX_MAPNAME 32
932 #define MAPS_PER_PAGE 10
933 #define MAX_MAPNAME_BUFFER MAX_MAPNAME*600
934 #define MAX_MAPNAME_LENGTH 34
935 #define MAX_CUSTOMNAME MAX_MAPNAME
936 #define MAX_CUSTOMCOMMAND 100
937 #define MAX_CUSTOMDISPLAYNAME 50
938
939 typedef struct {
940 int pagenumber;
941 char mapname[MAPS_PER_PAGE][MAX_MAPNAME];
942 } t_mappage;
943
944 typedef struct {
945 char votename[MAX_CUSTOMNAME]; //Used like "/callvote custom VOTENAME"
946 char displayname[MAX_CUSTOMDISPLAYNAME]; //Displayed during voting
947 char command[MAX_CUSTOMCOMMAND]; //The command executed
948 } t_customvote;
949
950 extern char custom_vote_info[1024];
951
952 extern t_mappage getMappage(int page);
•953 extern int allowedMap(const char *mapname);
954 extern int allowedGametype(const char *gametypeStr);
955 extern int allowedTimelimit(int limit);
956 extern int allowedFraglimit(int limit);
957 extern int VoteParseCustomVotes( void );
958 extern t_customvote getCustomVote(char* votecommand);
959
960 // ai_main.c
961 #define MAX_FILEPATH 144
962
963 //bot settings
964 typedef struct bot_settings_s
965 {
966 char characterfile[MAX_FILEPATH];
967 float skill;
968 char team[MAX_FILEPATH];
969 } bot_settings_t;
970
971 int BotAISetup( int restart );
972 int BotAIShutdown( int restart );
973 int BotAILoadMap( int restart );
974 int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean restart);
975 int BotAIShutdownClient( int client, qboolean restart );
976 int BotAIStartFrame( int time );
977 void BotTestAAS(vec3_t origin);
978
979 #include "g_team.h" // teamplay specific stuff
980
981
982 extern level_locals_t level;
983 extern gentity_t g_entities[MAX_GENTITIES];
984
985 #define FOFS(x) ((size_t)&(((gentity_t *)0)->x))
986
987 //CVARS
988 extern vmCvar_t g_gametype;
989 extern vmCvar_t g_dedicated;
990 extern vmCvar_t g_cheats;
991 extern vmCvar_t g_maxclients; // allow this many total, including spectators
992 extern vmCvar_t g_maxGameClients; // allow this many active
993 extern vmCvar_t g_restarted;
994
995 extern vmCvar_t g_dmflags;
996 extern vmCvar_t g_videoflags;
997 extern vmCvar_t g_elimflags;
998 extern vmCvar_t g_voteflags;
999 extern vmCvar_t g_fraglimit;
1000 extern vmCvar_t g_timelimit;
1001 extern vmCvar_t g_capturelimit;
1002 extern vmCvar_t g_friendlyFire;
1003 extern vmCvar_t g_password;
1004 extern vmCvar_t g_needpass;
1005 extern vmCvar_t g_gravity;
1006 extern vmCvar_t g_gravityModifier;
1007 extern vmCvar_t g_damageModifier;
1008 extern vmCvar_t g_speed;
1009 extern vmCvar_t g_knockback;
1010 extern vmCvar_t g_quadfactor;
1011 extern vmCvar_t g_forcerespawn;
1012 extern vmCvar_t g_respawntime;
1013 extern vmCvar_t g_inactivity;
1014 extern vmCvar_t g_debugMove;
1015 extern vmCvar_t g_debugAlloc;
1016 extern vmCvar_t g_debugDamage;
1017 extern vmCvar_t g_weaponRespawn;
1018 extern vmCvar_t g_weaponTeamRespawn;
1019 extern vmCvar_t g_synchronousClients;
1020 extern vmCvar_t g_motd;
1021 extern vmCvar_t g_motdfile;
1022 extern vmCvar_t g_votemaps;
1023 extern vmCvar_t g_votecustom;
1024 extern vmCvar_t g_warmup;
1025 extern vmCvar_t g_doWarmup;
1026 extern vmCvar_t g_blood;
1027 extern vmCvar_t g_allowVote;
1028 extern vmCvar_t g_teamAutoJoin;
1029 extern vmCvar_t g_teamForceBalance;
1030 extern vmCvar_t g_banIPs;
1031 extern vmCvar_t g_filterBan;
1032 extern vmCvar_t g_obeliskHealth;
1033 extern vmCvar_t g_obeliskRegenPeriod;
1034 extern vmCvar_t g_obeliskRegenAmount;
1035 extern vmCvar_t g_obeliskRespawnDelay;
1036 extern vmCvar_t g_cubeTimeout;
1037 extern vmCvar_t g_smoothClients;
1038 extern vmCvar_t pmove_fixed;
1039 extern vmCvar_t pmove_msec;
1040 extern vmCvar_t pmove_float;
1041 extern vmCvar_t g_rankings;
1042 #ifdef MISSIONPACK
1043 extern vmCvar_t g_singlePlayer;
1044 extern vmCvar_t g_redteam;
1045 extern vmCvar_t g_blueteam;
1046 #endif
1047 extern vmCvar_t g_enableDust;
1048 extern vmCvar_t g_enableBreath;
1049 extern vmCvar_t g_proxMineTimeout;
1050 extern vmCvar_t g_music;
1051 extern vmCvar_t g_spawnprotect;
1052
1053 //elimination:
1054 extern vmCvar_t g_elimination_selfdamage;
1055 extern vmCvar_t g_elimination_startHealth;
1056 extern vmCvar_t g_elimination_startArmor;
1057 extern vmCvar_t g_elimination_bfg;
1058 extern vmCvar_t g_elimination_grapple;
1059 extern vmCvar_t g_elimination_roundtime;
1060 extern vmCvar_t g_elimination_warmup;
1061 extern vmCvar_t g_elimination_activewarmup;
1062 extern vmCvar_t g_elimination_allgametypes;
1063 extern vmCvar_t g_elimination_machinegun;
1064 extern vmCvar_t g_elimination_shotgun;
1065 extern vmCvar_t g_elimination_grenade;
1066 extern vmCvar_t g_elimination_rocket;
1067 extern vmCvar_t g_elimination_railgun;
1068 extern vmCvar_t g_elimination_lightning;
1069 extern vmCvar_t g_elimination_plasmagun;
1070 extern vmCvar_t g_elimination_chain;
1071 extern vmCvar_t g_elimination_mine;
1072 extern vmCvar_t g_elimination_nail;
1073
1074 //If lockspectator: 0=no limit, 1 = cannot follow enemy, 2 = must follow friend
1075 extern vmCvar_t g_elimination_lockspectator;
1076
1077 extern vmCvar_t g_rockets;
1078
1079 //new in elimination Beta2
1080 extern vmCvar_t g_instantgib;
1081 extern vmCvar_t g_vampire;
1082 extern vmCvar_t g_vampireMaxHealth;
1083 //new in elimination Beta3
1084 extern vmCvar_t g_regen;
1085 //Free for all gametype
1086 extern int g_ffa_gt; //0 = TEAM GAME, 1 = FFA, 2 = TEAM GAME without bases
1087
1088 extern vmCvar_t g_lms_lives;
1089
1090 extern vmCvar_t g_lms_mode; //How do we score: 0 = One Survivor get a point, 1 = same but without overtime, 2 = one point for each player killed (+overtime), 3 = same without overtime
1091
1092 extern vmCvar_t g_elimination_ctf_oneway; //Only attack in one direction (level.eliminationSides+level.roundNumber)%2 == 0 red attacks
1093
1094 extern vmCvar_t g_awardpushing; //The server can decide if players are awarded for pushing people in lave etc.
1095
1096 extern vmCvar_t g_persistantpowerups;
1097
1098 extern vmCvar_t g_catchup; //Favors the week players
1099
1100 extern vmCvar_t g_autonextmap; //Autochange map
1101 extern vmCvar_t g_mappools; //mappools to be used for autochange
1102
1103 extern vmCvar_t g_voteNames;
1104 extern vmCvar_t g_voteBan;
1105 extern vmCvar_t g_voteGametypes;
1106 extern vmCvar_t g_voteMinTimelimit;
1107 extern vmCvar_t g_voteMaxTimelimit;
1108 extern vmCvar_t g_voteMinFraglimit;
1109 extern vmCvar_t g_voteMaxFraglimit;
1110 extern vmCvar_t g_maxvotes;
1111
1112 extern vmCvar_t g_humanplayers;
1113
1114 //used for voIP
1115 extern vmCvar_t g_redTeamClientNumbers;
1116 extern vmCvar_t g_blueTeamClientNumbers;
1117
1118 //unlagged - server options
1119 // some new server-side variables
1120 extern vmCvar_t g_delagHitscan;
1121 extern vmCvar_t g_truePing;
1122 // this is for convenience - using "sv_fps.integer" is nice :)
1123 extern vmCvar_t sv_fps;
1124 extern vmCvar_t g_lagLightning;
1125 //unlagged - server options
1126 //KK-OAX Killing Sprees
1127 extern vmCvar_t g_sprees; //Used for specifiying the config file
1128 extern vmCvar_t g_altExcellent; //Turns on Multikills instead of Excellent
1129 extern vmCvar_t g_spreeDiv; // Interval of a "streak" that form the spree triggers
1130 //KK-OAX Command/Chat Flooding/Spamming
1131 extern vmCvar_t g_floodMaxDemerits;
1132 extern vmCvar_t g_floodMinTime;
1133 //KK-OAX Admin
1134 extern vmCvar_t g_admin;
1135 extern vmCvar_t g_adminLog;
1136 extern vmCvar_t g_adminParseSay;
1137 extern vmCvar_t g_adminNameProtect;
1138 extern vmCvar_t g_adminTempBan;
1139 extern vmCvar_t g_adminMaxBan;
1140 //KK-OAX Admin-Like
1141 extern vmCvar_t g_specChat;
1142 extern vmCvar_t g_publicAdminMessages;
1143
1144 extern vmCvar_t g_maxWarnings;
1145 extern vmCvar_t g_warningExpire;
1146
1147 extern vmCvar_t g_minNameChangePeriod;
1148 extern vmCvar_t g_maxNameChanges;
1149
1150
1151 void trap_Printf( const char *fmt );
1152 void trap_Error( const char *fmt ) __attribute__((noreturn));
1153 int trap_Milliseconds( void );
1154 int trap_RealTime( qtime_t *qtime );
1155 int trap_Argc( void );
1156 void trap_Argv( int n, char *buffer, int bufferLength );
1157 void trap_Args( char *buffer, int bufferLength );
1158 int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
1159 void trap_FS_Read( void *buffer, int len, fileHandle_t f );
1160 void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
1161 void trap_FS_FCloseFile( fileHandle_t f );
1162 int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
1163 int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
1164 void trap_SendConsoleCommand( int exec_when, const char *text );
1165 void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags );
1166 void trap_Cvar_Update( vmCvar_t *cvar );
1167 void trap_Cvar_Set( const char *var_name, const char *value );
1168 int trap_Cvar_VariableIntegerValue( const char *var_name );
1169 float trap_Cvar_VariableValue( const char *var_name );
1170 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
1171 void trap_LocateGameData( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *gameClients, int sizeofGameClient );
1172 void trap_DropClient( int clientNum, const char *reason );
1173 void trap_SendServerCommand( int clientNum, const char *text );
1174 void trap_SetConfigstring( int num, const char *string );
1175 void trap_GetConfigstring( int num, char *buffer, int bufferSize );
1176 void trap_GetUserinfo( int num, char *buffer, int bufferSize );
1177 void trap_SetUserinfo( int num, const char *buffer );
1178 void trap_GetServerinfo( char *buffer, int bufferSize );
1179 void trap_SetBrushModel( gentity_t *ent, const char *name );
1180 void trap_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
1181 int trap_PointContents( const vec3_t point, int passEntityNum );
1182 qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 );
1183 qboolean trap_InPVSIgnorePortals( const vec3_t p1, const vec3_t p2 );
1184 void trap_AdjustAreaPortalState( gentity_t *ent, qboolean open );
1185 qboolean trap_AreasConnected( int area1, int area2 );
1186 void trap_LinkEntity( gentity_t *ent );
1187 void trap_UnlinkEntity( gentity_t *ent );
1188 int trap_EntitiesInBox( const vec3_t mins, const vec3_t maxs, int *entityList, int maxcount );
1189 qboolean trap_EntityContact( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
1190 int trap_BotAllocateClient( void );
1191 void trap_BotFreeClient( int clientNum );
1192 void trap_GetUsercmd( int clientNum, usercmd_t *cmd );
1193 qboolean trap_GetEntityToken( char *buffer, int bufferSize );
1194
1195 int trap_DebugPolygonCreate(int color, int numPoints, vec3_t *points);
1196 void trap_DebugPolygonDelete(int id);
1197
1198 int trap_BotLibSetup( void );
1199 int trap_BotLibShutdown( void );
1200 int trap_BotLibVarSet(char *var_name, char *value);
1201 int trap_BotLibVarGet(char *var_name, char *value, int size);
1202 int trap_BotLibDefine(char *string);
1203 int trap_BotLibStartFrame(float time);
1204 int trap_BotLibLoadMap(const char *mapname);
1205 int trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue);
1206 int trap_BotLibTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3);
1207
1208 int trap_BotGetSnapshotEntity( int clientNum, int sequence );
1209 int trap_BotGetServerCommand(int clientNum, char *message, int size);
1210 void trap_BotUserCommand(int client, usercmd_t *ucmd);
1211
1212 int trap_AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas);
1213 int trap_AAS_AreaInfo( int areanum, void /* struct aas_areainfo_s */ *info );
1214 void trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info);
1215
1216 int trap_AAS_Initialized(void);
1217 void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs);
1218 float trap_AAS_Time(void);
1219
1220 int trap_AAS_PointAreaNum(vec3_t point);
1221 int trap_AAS_PointReachabilityAreaIndex(vec3_t point);
1222 int trap_AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas);
1223
1224 int trap_AAS_PointContents(vec3_t point);
1225 int trap_AAS_NextBSPEntity(int ent);
1226 int trap_AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size);
1227 int trap_AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v);
1228 int trap_AAS_FloatForBSPEpairKey(int ent, char *key, float *value);
1229 int trap_AAS_IntForBSPEpairKey(int ent, char *key, int *value);
1230
1231 int trap_AAS_AreaReachability(int areanum);
1232
1233 int trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags);
1234 int trap_AAS_EnableRoutingArea( int areanum, int enable );
1235 int trap_AAS_PredictRoute(void /*struct aas_predictroute_s*/ *route, int areanum, vec3_t origin,
1236 int goalareanum, int travelflags, int maxareas, int maxtime,
1237 int stopevent, int stopcontents, int stoptfl, int stopareanum);
1238
1239 int trap_AAS_AlternativeRouteGoals(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
1240 void /*struct aas_altroutegoal_s*/ *altroutegoals, int maxaltroutegoals,
1241 int type);
1242 int trap_AAS_Swimming(vec3_t origin);
1243 int trap_AAS_PredictClientMovement(void /* aas_clientmove_s */ *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize);
1244
1245
1246 void trap_EA_Say(int client, char *str);
1247 void trap_EA_SayTeam(int client, char *str);
1248 void trap_EA_Command(int client, char *command);
1249
1250 void trap_EA_Action(int client, int action);
1251 void trap_EA_Gesture(int client);
1252 void trap_EA_Talk(int client);
1253 void trap_EA_Attack(int client);
1254 void trap_EA_Use(int client);
1255 void trap_EA_Respawn(int client);
1256 void trap_EA_Crouch(int client);
1257 void trap_EA_MoveUp(int client);
1258 void trap_EA_MoveDown(int client);
1259 void trap_EA_MoveForward(int client);
1260 void trap_EA_MoveBack(int client);
1261 void trap_EA_MoveLeft(int client);
1262 void trap_EA_MoveRight(int client);
1263 void trap_EA_SelectWeapon(int client, int weapon);
1264 void trap_EA_Jump(int client);
1265 void trap_EA_DelayedJump(int client);
1266 void trap_EA_Move(int client, vec3_t dir, float speed);
1267 void trap_EA_View(int client, vec3_t viewangles);
1268
1269 void trap_EA_EndRegular(int client, float thinktime);
1270 void trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input);
1271 void trap_EA_ResetInput(int client);
1272
1273
1274 int trap_BotLoadCharacter(char *charfile, float skill);
1275 void trap_BotFreeCharacter(int character);
1276 float trap_Characteristic_Float(int character, int index);
1277 float trap_Characteristic_BFloat(int character, int index, float min, float max);
1278 int trap_Characteristic_Integer(int character, int index);
1279 int trap_Characteristic_BInteger(int character, int index, int min, int max);
1280 void trap_Characteristic_String(int character, int index, char *buf, int size);
1281
1282 int trap_BotAllocChatState(void);
1283 void trap_BotFreeChatState(int handle);
1284 void trap_BotQueueConsoleMessage(int chatstate, int type, char *message);
1285 void trap_BotRemoveConsoleMessage(int chatstate, int handle);
1286 int trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm);
1287 int trap_BotNumConsoleMessages(int chatstate);
1288 void trap_BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
1289 int trap_BotNumInitialChats(int chatstate, char *type);
1290 int trap_BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
1291 int trap_BotChatLength(int chatstate);
1292 void trap_BotEnterChat(int chatstate, int client, int sendto);
1293 void trap_BotGetChatMessage(int chatstate, char *buf, int size);
1294 int trap_StringContains(char *str1, char *str2, int casesensitive);
1295 int trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context);
1296 void trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size);
1297 void trap_UnifyWhiteSpaces(char *string);
1298 void trap_BotReplaceSynonyms(char *string, unsigned long int context);
1299 int trap_BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
1300 void trap_BotSetChatGender(int chatstate, int gender);
1301 void trap_BotSetChatName(int chatstate, char *name, int client);
1302 void trap_BotResetGoalState(int goalstate);
1303 void trap_BotRemoveFromAvoidGoals(int goalstate, int number);
1304 void trap_BotResetAvoidGoals(int goalstate);
1305 void trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal);
1306 void trap_BotPopGoal(int goalstate);
1307 void trap_BotEmptyGoalStack(int goalstate);
1308 void trap_BotDumpAvoidGoals(int goalstate);
1309 void trap_BotDumpGoalStack(int goalstate);
1310 void trap_BotGoalName(int number, char *name, int size);
1311 int trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal);
1312 int trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal);
1313 int trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags);
1314 int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime);
1315 int trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal);
1316 int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal);
1317 int trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal);
1318 int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal);
1319 int trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal);
1320 float trap_BotAvoidGoalTime(int goalstate, int number);
1321 void trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime);
1322 void trap_BotInitLevelItems(void);
1323 void trap_BotUpdateEntityItems(void);
1324 int trap_BotLoadItemWeights(int goalstate, char *filename);
1325 void trap_BotFreeItemWeights(int goalstate);
1326 void trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
1327 void trap_BotSaveGoalFuzzyLogic(int goalstate, char *filename);
1328 void trap_BotMutateGoalFuzzyLogic(int goalstate, float range);
1329 int trap_BotAllocGoalState(int state);
1330 void trap_BotFreeGoalState(int handle);
1331
1332 void trap_BotResetMoveState(int movestate);
1333 void trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags);
1334 int trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
1335 void trap_BotResetAvoidReach(int movestate);
1336 void trap_BotResetLastAvoidReach(int movestate);
1337 int trap_BotReachabilityArea(vec3_t origin, int testground);
1338 int trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target);
1339 int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target);
1340 int trap_BotAllocMoveState(void);
1341 void trap_BotFreeMoveState(int handle);
1342 void trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove);
1343 void trap_BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
1344
1345 int trap_BotChooseBestFightWeapon(int weaponstate, int *inventory);
1346 void trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo);
1347 int trap_BotLoadWeaponWeights(int weaponstate, char *filename);
1348 int trap_BotAllocWeaponState(void);
1349 void trap_BotFreeWeaponState(int weaponstate);
1350 void trap_BotResetWeaponState(int weaponstate);
1351
1352 int trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child);
1353
1354 void trap_SnapVector( float *v );
1355
1356 //KK-OAX
1357 //These enable the simplified command handling.
1358
1359 #define CMD_CHEAT 0x0001
1360 #define CMD_CHEAT_TEAM 0x0002 // is a cheat when used on a team
1361 #define CMD_MESSAGE 0x0004 // sends message to others (skip when muted)
1362 #define CMD_TEAM 0x0008 // must be on a team
1363 #define CMD_NOTEAM 0x0010 // must not be on a team
1364 #define CMD_RED 0x0020 // must be on the red team (useless right now)
1365 #define CMD_BLUE 0x0040 // must be on the blue team (useless right now)
1366 #define CMD_LIVING 0x0080
1367 #define CMD_INTERMISSION 0x0100 // valid during intermission
1368
1369
1370 typedef struct
1371 {
1372 char *cmdName;
1373 int cmdFlags;
1374 void ( *cmdHandler )( gentity_t *ent );
1375 } commands_t;
1376
1377 //
1378 // g_svcmds_ext.c
1379 // These were added to a seperate file to keep g_svcmds.c navigable.
1380 void Svcmd_Status_f( void );
1381 void Svcmd_TeamMessage_f( void );
1382 void Svcmd_CenterPrint_f( void );
1383 void Svcmd_BannerPrint_f( void );
1384 void Svcmd_EjectClient_f( void );
1385 void Svcmd_DumpUser_f( void );
1386 void Svcmd_Chat_f( void );
1387 void Svcmd_ListIP_f( void );
1388 void Svcmd_MessageWrapper( void );
1389
1390 #include "g_killspree.h"
1391 #include "g_admin.h"