UFO: Alien Invasion
Loading...
Searching...
No Matches
g_main.cpp
Go to the documentation of this file.
1
5
6/*
7All original material Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9Original file from Quake 2 v3.21: quake2-2.31/game/g_main.c
10Copyright (C) 1997-2001 Id Software, Inc.
11
12This program is free software; you can redistribute it and/or
13modify it under the terms of the GNU General Public License
14as published by the Free Software Foundation; either version 2
15of the License, or (at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
21See the GNU General Public License for more details.
22
23You should have received a copy of the GNU General Public License
24along with this program; if not, write to the Free Software
25Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
27*/
28
29#include "g_local.h"
30#include "g_ai.h"
31#include "g_client.h"
32#include "g_edicts.h"
33#include "g_match.h"
34#include "g_spawn.h"
35#include "g_utils.h"
36
41
42#ifndef HARD_LINKED_GAME
46#endif
47
50
66
68
75
76/* morale cvars */
85
86/*everyone gets this times morale damage */
88
89/*at this distance the following two get halfed (exponential scale) */
91
92/*at this distance the following two get halfed (exponential scale) */
94
95/*at this distance the following two get halfed (exponential scale) */
97
98/* how much the morale depends on the size of the damaged team */
100
105
110
124
126
127static const int TAG_INVENTORY = 2389;
128
129static void G_FreeInventory (void* data)
130{
132}
133
134static void* G_AllocInventoryMemory (size_t size)
135{
137}
138
139static void G_FreeAllInventory (void)
140{
142}
143
145
146
151static void G_Init (void)
152{
153 gi.DPrintf("==== InitGame ====\n");
154
155 /* noset vars */
156 sv_dedicated = gi.Cvar_Get("sv_dedicated", "0", CVAR_SERVERINFO | CVAR_NOSET, "Is this a dedicated server?");
157
158 /* latched vars */
159 sv_cheats = gi.Cvar_Get("sv_cheats", "0", CVAR_SERVERINFO | CVAR_LATCH, "Activate cheats");
160 gi.Cvar_Get("gamename", GAMEVERSION, CVAR_SERVERINFO | CVAR_LATCH, nullptr);
161 gi.Cvar_Get("gamedate", "May 14 2025", CVAR_SERVERINFO | CVAR_LATCH, nullptr);
162 developer = gi.Cvar_Get("developer", "0", 0, "Print out a lot of developer debug messages - useful to track down bugs");
163 logstats = gi.Cvar_Get("logstats", "1", CVAR_ARCHIVE, "Server logfile output for kills");
164
165 /* max. players per team (original quake) */
166 sv_maxplayersperteam = gi.Cvar_Get("sv_maxplayersperteam", "8", CVAR_SERVERINFO | CVAR_LATCH, "How many players (humans) may a team have");
167 /* max. soldiers per team */
168 sv_maxsoldiersperteam = gi.Cvar_Get("sv_maxsoldiersperteam", "4", CVAR_ARCHIVE | CVAR_SERVERINFO, "How many soldiers may one team have");
169 /* max soldiers per player */
170 sv_maxsoldiersperplayer = gi.Cvar_Get("sv_maxsoldiersperplayer", DOUBLEQUOTE(MAX_ACTIVETEAM), CVAR_ARCHIVE | CVAR_SERVERINFO, "How many soldiers one player is able to control in a given team");
171 /* enable moralestates in multiplayer */
172 sv_enablemorale = gi.Cvar_Get("sv_enablemorale", "1", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH, "Enable morale behaviour for actors");
173 sv_roundtimelimit = gi.Cvar_Get("sv_roundtimelimit", "90", CVAR_ARCHIVE | CVAR_SERVERINFO, "Timelimit in seconds for multiplayer rounds");
174 sv_roundtimelimit->modified = false;
175 sv_maxentities = gi.Cvar_Get("sv_maxentities", "1024", CVAR_LATCH, nullptr);
176
177 sv_maxteams = gi.Cvar_Get("sv_maxteams", "2", CVAR_SERVERINFO, "How many teams for current running map");
178 sv_maxteams->modified = false;
179
180 /* change anytime vars */
181 password = gi.Cvar_Get("password", "", CVAR_USERINFO, nullptr);
182 sv_needpass = gi.Cvar_Get("sv_needpass", "0", CVAR_SERVERINFO, nullptr);
183 sv_filterban = gi.Cvar_Get("sv_filterban", "1", 0, nullptr);
184 sv_ai = gi.Cvar_Get("sv_ai", "1", 0, "Activate or deativate the ai");
185 sv_teamplay = gi.Cvar_Get("sv_teamplay", "0", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SERVERINFO, "Is teamplay activated? see sv_maxclients, sv_maxplayersperteam, sv_maxsoldiersperteam and sv_maxsoldiersperplayer");
186 /* how many connected clients */
187 sv_maxclients = gi.Cvar_Get("sv_maxclients", "1", CVAR_SERVERINFO, "If sv_maxclients is 1 we are in singleplayer - otherwise we are mutliplayer mode (see sv_teamplay)");
188 sv_shot_origin = gi.Cvar_Get("sv_shot_origin", "8", 0, "Assumed distance of muzzle from model");
189 sv_send_edicts = gi.Cvar_Get("sv_send_edicts", "0", CVAR_ARCHIVE | CVAR_CHEAT, "Send server side edicts for client display like triggers");
190 sv_hurtaliens = gi.Cvar_Get("sv_hurtaliens", "0", CVAR_SERVERINFO, "Spawn hurt aliens");
191
192 ai_alienteam = gi.Cvar_Get("ai_alienteam", "ortnok", 0, "Alien team");
193 ai_civilianteam = gi.Cvar_Get("ai_civilianteam", "europe", 0, "Civilian team");
194 /* this cvar is set in singleplayer via campaign definition */
195 ai_equipment = gi.Cvar_Get("ai_equipment", "multiplayer_alien", 0, "Initial equipment definition for aliens");
196 /* aliens in singleplayer (can differ each mission) */
197 ai_singleplayeraliens = gi.Cvar_Get("ai_singleplayeraliens", "30", 0, "How many aliens in this battle (singleplayer)");
198 /* civilians for singleplayer */
199 ai_numcivilians = gi.Cvar_Get("ai_numcivilians", "10", 0, "How many civilians in this battle");
200 /* aliens in multiplayer */
201 ai_multiplayeraliens = gi.Cvar_Get("ai_multiplayeraliens", "8", CVAR_ARCHIVE, "How many (ai controlled) actors in this battle (multiplayer)");
202
203 mob_death = gi.Cvar_Get("mob_death", "10", CVAR_LATCH|CVAR_NOSET, nullptr);
204 mob_wound = gi.Cvar_Get("mob_wound", "0.1", CVAR_LATCH|CVAR_NOSET, nullptr);
205 mob_shoot = gi.Cvar_Get("mob_shoot", "0.1", CVAR_LATCH|CVAR_NOSET, nullptr);
206 mof_watching = gi.Cvar_Get("mof_watching", "1.7", CVAR_LATCH|CVAR_NOSET, nullptr);
207 mof_teamkill = gi.Cvar_Get("mof_teamkill", "2.0", CVAR_LATCH|CVAR_NOSET, nullptr);
208 mof_civilian = gi.Cvar_Get("mof_civilian", "0.3", CVAR_LATCH|CVAR_NOSET, nullptr);
209 mof_enemy = gi.Cvar_Get("mof_ememy", "0.5", CVAR_LATCH|CVAR_NOSET, nullptr);
210 mor_pain = gi.Cvar_Get("mof_pain", "3.6", CVAR_LATCH|CVAR_NOSET, nullptr);
211 /* everyone gets this times morale damage */
212 mor_default = gi.Cvar_Get("mor_default", "0.3", CVAR_LATCH|CVAR_NOSET, "Everyone gets this times morale damage");
213 /* at this distance the following two get halved (exponential scale) */
214 mor_distance = gi.Cvar_Get("mor_distance", "120", CVAR_LATCH|CVAR_NOSET, "At this distance the following two get halved (exponential scale)");
215 /* at this distance the following two get halved (exponential scale) */
216 mor_victim = gi.Cvar_Get("mor_victim", "0.7", CVAR_LATCH|CVAR_NOSET, "At this distance the following two get halved (exponential scale)");
217 /* at this distance the following two get halved (exponential scale) */
218 mor_attacker = gi.Cvar_Get("mor_attacker", "0.3", CVAR_LATCH|CVAR_NOSET, "At this distance the following two get halved (exponential scale)");
219 /* how much the morale depends on the size of the damaged team */
220 mon_teamfactor = gi.Cvar_Get("mon_teamfactor", "0.6", CVAR_LATCH|CVAR_NOSET, "How much the morale depends on the size of the damaged team");
221
222 mor_regeneration = gi.Cvar_Get("mor_regeneration", "15", CVAR_LATCH|CVAR_NOSET, nullptr);
223 mor_shaken = gi.Cvar_Get("mor_shaken", "50", CVAR_LATCH|CVAR_NOSET, nullptr);
224 mor_panic = gi.Cvar_Get("mor_panic", "30", CVAR_LATCH|CVAR_NOSET, nullptr);
225 mor_brave = gi.Cvar_Get("mor_brave", "85", CVAR_LATCH|CVAR_NOSET, nullptr);
226
227 m_sanity = gi.Cvar_Get("m_sanity", "1.0", CVAR_LATCH|CVAR_NOSET, nullptr);
228 m_rage = gi.Cvar_Get("m_rage", "0.6", CVAR_LATCH|CVAR_NOSET, nullptr);
229 m_rage_stop = gi.Cvar_Get("m_rage_stop", "2.0", CVAR_LATCH|CVAR_NOSET, nullptr);
230 m_panic_stop = gi.Cvar_Get("m_panic_stop", "1.0", CVAR_LATCH|CVAR_NOSET, nullptr);
231
232 g_endlessaliens = gi.Cvar_Get("g_endlessaliens", "0", CVAR_LATCH|CVAR_SERVERINFO, "Spawn endless aliens");
233 g_ailua = gi.Cvar_Get("g_ailua", "0", 0, "Activate or deactivate the LUA AI");
234 g_aihumans = gi.Cvar_Get("g_aihumans", "0", CVAR_DEVELOPER, "Activate or deactivate the ai for human actors");
235 g_aidebug = gi.Cvar_Get("g_aidebug", "0", CVAR_DEVELOPER|CVAR_CHEAT, "All AI actors are visible");
236 g_drawtraces = gi.Cvar_Get("g_drawtraces", "0", CVAR_DEVELOPER, "All traces will be rendered");
237 g_nodamage = gi.Cvar_Get("g_nodamage", "0", CVAR_DEVELOPER|CVAR_CHEAT, "No damage in developer mode");
238 g_notu = gi.Cvar_Get("g_notu", "0", CVAR_DEVELOPER|CVAR_CHEAT, "No TU costs while performing any action");
239 g_actorspeed = gi.Cvar_Get("g_actorspeed", "1.0", CVAR_ARCHIVE|CVAR_SERVERINFO, "Moving speed of the actor");
240 g_lastseen = gi.Cvar_Get("g_lastseen", "20", CVAR_ARCHIVE|CVAR_SERVERINFO, "Quit the match if no player was seen in this amount of rounds");
241 g_nospawn = gi.Cvar_Get("g_nospawn", "0", CVAR_DEVELOPER|CVAR_CHEAT, "Do not spawn a soldier");
242
243 /* flood control */
244 flood_msgs = gi.Cvar_Get("flood_msgs", "4", 0, nullptr);
245 flood_persecond = gi.Cvar_Get("flood_persecond", "4", 0, nullptr);
246 flood_waitdelay = gi.Cvar_Get("flood_waitdelay", "10", 0, "Delay until someone is unlocked from talking again");
247
248 g_difficulty = gi.Cvar_Get("g_difficulty", "0", CVAR_NOSET, "Singleplayer difficulty level");
249
250 game.sv_maxentities = sv_maxentities->integer;
251 game.sv_maxplayersperteam = sv_maxplayersperteam->integer;
252
253 /* initialize the entity storage */
254 globals.edicts = G_EdictsConstruct();
255 globals.max_edicts = game.sv_maxentities;
256 globals.num_edicts = game.sv_maxplayersperteam;
257
258 /* initialize all players for this game */
259 /* game.sv_maxplayersperteam for human controlled players
260 * + game.sv_maxplayer for ai */
261 game.players = static_cast<player_t*>(G_TagMalloc(game.sv_maxplayersperteam * 2 * sizeof(game.players[0]), TAG_GAME));
262 globals.players = game.players;
263 globals.maxplayersperteam = game.sv_maxplayersperteam;
264
265 /* init csi and inventory */
266 INVSH_InitCSI(gi.csi);
267 game.invi.initInventory("game", gi.csi, &inventoryImport);
268
269 if (logstats->integer)
270 logstatsfile = gi.Sys_Fopen(va("%s/stats.log", gi.FS_Gamedir()), "a");
271 else
272 logstatsfile = nullptr;
273
274 AI_Init();
275 AIL_Init();
276}
277
282static void G_Shutdown (void)
283{
284 gi.DPrintf("==== ShutdownGame ====\n");
285
286 AIL_Shutdown();
287
288 if (logstatsfile)
289 fclose(logstatsfile);
290 logstatsfile = nullptr;
291
295
296 Com_Printf("Used inventory slots in game on shutdown: %i\n", game.invi.GetUsedSlots());
297}
298
302static void CheckNeedPass (void)
303{
304 if (password->modified) {
305 password->modified = false;
306
307 const int need = Q_strvalid(password->string) && Q_strcasecmp(password->string, "none") ? 1 : 0;
308 gi.Cvar_Set("sv_needpass", "%i", need);
309 }
310}
311
312static void G_SendBoundingBoxes (void)
313{
314 if (!sv_send_edicts->integer)
315 return;
316
317 Edict* ent = G_EdictsGetFirst(); /* skip the world */
318 while ((ent = G_EdictsGetNextInUse(ent)))
319 G_EventSendEdict(*ent);
320}
321
328static bool G_RunFrame (void)
329{
330 level.framenum++;
331 /* server is running at 10 fps */
332 level.time = level.framenum * SERVER_FRAME_SECONDS;
333
334 /* this doesn't belong here, but it works */
335 if (!level.routed) {
336 level.routed = true;
338 }
339
340 /* still waiting for other players */
341 if (!G_MatchIsRunning()) {
342 if (sv_maxteams->modified) {
343 /* inform the client */
344 gi.ConfigString(CS_MAXTEAMS, "%i", sv_maxteams->integer);
345 sv_maxteams->modified = false;
346 }
347 }
348
349 if (G_IsMultiPlayer()) {
350 if (sv_roundtimelimit->modified) {
351 /* some played around here - restart the count down */
352 level.roundstartTime = level.time;
353 /* don't allow smaller values here */
354 if (sv_roundtimelimit->integer < 30 && sv_roundtimelimit->integer > 0) {
355 gi.DPrintf("The minimum value for sv_roundtimelimit is 30\n");
356 gi.Cvar_Set("sv_roundtimelimit", "30");
357 }
358 sv_roundtimelimit->modified = false;
359 }
361 }
362
363 /* end this game? */
364 if (G_MatchDoEnd())
365 return true;
366
368
369 /* run ai */
370 AI_Run();
371
372 /* not all teams are spawned or game has already ended */
373 if (G_MatchIsRunning())
375
377
378 return false;
379}
380
385{
386 gi = *import;
387 srand(gi.seed);
388
389 globals.apiversion = GAME_API_VERSION;
390 globals.Init = G_Init;
391 globals.Shutdown = G_Shutdown;
392 globals.SpawnEntities = G_SpawnEntities;
393
394 globals.ClientConnect = G_ClientConnect;
395 globals.ClientUserinfoChanged = G_ClientUserinfoChanged;
396 globals.ClientDisconnect = G_ClientDisconnect;
397 globals.ClientBegin = G_ClientBegin;
398 globals.ClientStartMatch = G_ClientStartMatch;
399 globals.ClientCommand = G_ClientCommand;
400 globals.ClientAction = G_ClientAction;
401 globals.ClientEndRound = G_ClientEndRound;
402 globals.ClientTeamInfo = G_ClientTeamInfo;
403 globals.ClientInitActorStates = G_ClientInitActorStates;
404 globals.ClientGetTeamNum = G_ClientGetTeamNum;
405 globals.ClientIsReady = G_ClientIsReady;
406 globals.ClientGetName = G_GetPlayerName;
407 globals.ClientGetActiveTeam = G_GetActiveTeam;
408
409 globals.RunFrame = G_RunFrame;
410
411 globals.ServerCommand = G_ServerCommand;
412
413 globals.edict_size = sizeof(Edict);
414 globals.player_size = sizeof(player_t);
415
416 return &globals;
417}
418
419#ifndef HARD_LINKED_GAME
420/* this is only here so the functions in the shared code can link */
421void Sys_Error (const char* error, ...)
422{
423 va_list argptr;
424 char text[1024];
425
426 va_start(argptr, error);
427 Q_vsnprintf(text, sizeof(text), error, argptr);
428 va_end(argptr);
429
430 gi.Error("%s", text);
431}
432
433void Com_Printf (const char* msg, ...)
434{
435 va_list argptr;
436 char text[1024];
437
438 va_start(argptr, msg);
439 Q_vsnprintf(text, sizeof(text), msg, argptr);
440 va_end(argptr);
441
442 gi.DPrintf("%s", text);
443}
444
445void Com_DPrintf (int level, const char* msg, ...)
446{
447 va_list argptr;
448 char text[1024];
449
450 /* don't confuse non-developers with techie stuff... */
451 if (!developer || developer->integer == 0)
452 return;
453
454 if (!(developer->integer & level))
455 return;
456
457 va_start(argptr, msg);
458 Q_vsnprintf(text, sizeof(text), msg, argptr);
459 va_end(argptr);
460
461 gi.DPrintf("%s", text);
462}
463#endif
static const int TAG_INVENTORY
Definition cl_game.cpp:880
static const inventoryImport_t inventoryImport
Definition cl_game.cpp:898
cvar_t * sv_dedicated
Definition common.cpp:51
cvar_t * developer
Definition common.cpp:46
cvar_t * sv_maxclients
Definition g_main.cpp:43
#define CVAR_DEVELOPER
Definition cvar.h:45
#define CVAR_CHEAT
Definition cvar.h:46
#define CVAR_USERINFO
Definition cvar.h:41
#define CVAR_SERVERINFO
Definition cvar.h:42
#define CVAR_ARCHIVE
Definition cvar.h:40
#define CVAR_NOSET
Definition cvar.h:43
#define CVAR_LATCH
Definition cvar.h:44
#define MAX_ACTIVETEAM
Definition defines.h:41
void AI_Init(void)
Definition g_ai.cpp:266
void AI_Run(void)
Every server frame one single actor is handled - always in the same order.
Definition g_ai.cpp:1713
Artificial Intelligence functions.
void AIL_Init(void)
void AIL_Shutdown(void)
void G_ClientUserinfoChanged(Player &player, const char *userinfo)
called whenever the player updates a userinfo variable.
int G_GetActiveTeam(void)
Returns the current active team to the server.
Definition g_client.cpp:327
bool G_ClientIsReady(const Player *player)
Definition g_client.cpp:905
void G_ClientDisconnect(Player &player)
bool G_ClientBegin(Player &player)
This functions starts the client.
int G_ClientGetTeamNum(const Player &player)
Returns the assigned team number of the player.
Definition g_client.cpp:889
int G_ClientAction(Player &player)
The client sent us a message that he did something. We now execute the related function(s) and notify...
Definition g_client.cpp:638
bool G_ClientConnect(Player *player, char *userinfo, size_t userinfoSize)
Checks whether the connection is valid or invalid and set some user info keys.
void G_ClientStartMatch(Player &player)
Sets the team, init the TU and sends the player stats.
void G_ClientInitActorStates(const Player &player)
This is called after the actors are spawned and will set actor states without consuming TUs.
void G_ClientTeamInfo(const Player &player)
The client lets the server spawn the actors for a given player by sending their information (models,...
Interface for g_client.cpp.
void G_ClientCommand(Player &player)
Definition g_cmds.cpp:423
Edict * G_EdictsGetFirst(void)
Returns the first entity.
Definition g_edicts.cpp:98
Edict * G_EdictsConstruct(void)
Allocate space for the entity pointers.
Definition g_edicts.cpp:39
Edict * G_EdictsGetNextInUse(Edict *lastEnt)
Iterate through the entities that are in use.
Definition g_edicts.cpp:166
void G_EdictsThink(void)
Called every frame to let the edicts tick.
Definition g_edicts.cpp:306
functions to handle the storage and lifecycle of all edicts in the game module.
void G_EventSendEdict(const Edict &ent)
Send the bounding box info to the client.
Definition g_events.cpp:457
Local definitions for game module.
cvar_t * mor_pain
Definition g_main.cpp:84
cvar_t * m_panic_stop
Definition g_main.cpp:109
cvar_t * flood_msgs
Definition g_main.cpp:121
#define TAG_LEVEL
Definition g_local.h:59
cvar_t * mor_attacker
Definition g_main.cpp:96
cvar_t * ai_singleplayeraliens
Definition g_main.cpp:72
cvar_t * flood_persecond
Definition g_main.cpp:122
cvar_t * g_lastseen
Definition g_main.cpp:120
cvar_t * mor_shaken
Definition g_main.cpp:102
cvar_t * sv_hurtaliens
Definition g_main.cpp:62
#define G_FreeTags(tag)
Definition g_local.h:63
game_locals_t game
Definition g_main.cpp:37
cvar_t * sv_shot_origin
Definition g_main.cpp:63
level_locals_t level
Definition g_main.cpp:38
cvar_t * mor_panic
Definition g_main.cpp:103
cvar_t * sv_needpass
Definition g_main.cpp:51
cvar_t * ai_numcivilians
Definition g_main.cpp:73
cvar_t * mob_shoot
Definition g_main.cpp:79
#define SERVER_FRAME_SECONDS
Definition g_local.h:55
cvar_t * g_aidebug
Definition g_main.cpp:114
cvar_t * ai_equipment
Definition g_main.cpp:71
cvar_t * sv_teamplay
Definition g_main.cpp:61
cvar_t * g_notu
Definition g_main.cpp:117
cvar_t * mor_default
Definition g_main.cpp:87
cvar_t * ai_civilianteam
Definition g_main.cpp:70
#define G_MemFree(ptr)
Definition g_local.h:65
cvar_t * sv_maxplayersperteam
Definition g_main.cpp:52
cvar_t * mof_enemy
Definition g_main.cpp:83
cvar_t * m_rage
Definition g_main.cpp:107
cvar_t * mon_teamfactor
Definition g_main.cpp:99
cvar_t * sv_maxentities
Definition g_main.cpp:57
cvar_t * sv_filterban
Definition g_main.cpp:58
#define TAG_GAME
Definition g_local.h:58
cvar_t * m_sanity
Definition g_main.cpp:106
game_import_t gi
Definition g_main.cpp:39
void G_ServerCommand(void)
ServerCommand will be called when an "sv" command is issued. The game can issue gi....
Definition g_svcmds.cpp:337
cvar_t * mor_distance
Definition g_main.cpp:90
#define G_TagMalloc(size, tag)
Definition g_local.h:64
cvar_t * g_aihumans
Definition g_main.cpp:113
cvar_t * mor_brave
Definition g_main.cpp:104
FILE * logstatsfile
Definition g_main.cpp:49
cvar_t * mor_victim
Definition g_main.cpp:93
cvar_t * sv_enablemorale
Definition g_main.cpp:55
#define G_IsMultiPlayer()
Definition g_local.h:145
cvar_t * ai_alienteam
Definition g_main.cpp:69
void G_ClientEndRound(Player &player)
Definition g_round.cpp:184
cvar_t * sv_maxsoldiersperplayer
Definition g_main.cpp:54
cvar_t * g_endlessaliens
Definition g_main.cpp:111
cvar_t * m_rage_stop
Definition g_main.cpp:108
cvar_t * mof_teamkill
Definition g_main.cpp:81
game_export_t globals
Definition g_main.cpp:40
cvar_t * ai_multiplayeraliens
Definition g_main.cpp:74
#define GAMEVERSION
Definition g_local.h:49
cvar_t * mof_civilian
Definition g_main.cpp:82
cvar_t * sv_roundtimelimit
Definition g_main.cpp:56
cvar_t * g_nospawn
Definition g_main.cpp:118
cvar_t * flood_waitdelay
Definition g_main.cpp:123
cvar_t * logstats
Definition g_main.cpp:48
cvar_t * sv_ai
Definition g_main.cpp:60
cvar_t * g_ailua
Definition g_main.cpp:112
cvar_t * g_difficulty
Definition g_main.cpp:125
cvar_t * mob_wound
Definition g_main.cpp:78
cvar_t * mof_watching
Definition g_main.cpp:80
cvar_t * sv_maxsoldiersperteam
Definition g_main.cpp:53
cvar_t * g_drawtraces
Definition g_main.cpp:115
cvar_t * g_nodamage
Definition g_main.cpp:116
cvar_t * password
Definition g_main.cpp:67
cvar_t * mor_regeneration
Definition g_main.cpp:101
cvar_t * g_actorspeed
Definition g_main.cpp:119
cvar_t * mob_death
Definition g_main.cpp:77
cvar_t * sv_maxteams
Definition g_main.cpp:59
void G_CheckForceEndRound(void)
Check whether a forced turn end should be executed.
Definition g_round.cpp:39
static void G_Init(void)
This will be called when the game library is first loaded.
Definition g_main.cpp:151
void Sys_Error(const char *error,...)
Definition g_main.cpp:421
game_export_t * GetGameAPI(game_import_t *import)
Returns a pointer to the structure with all entry points and global variables.
Definition g_main.cpp:384
static cvar_t * sv_send_edicts
Definition g_main.cpp:65
static void G_SendBoundingBoxes(void)
Definition g_main.cpp:312
static void * G_AllocInventoryMemory(size_t size)
Definition g_main.cpp:134
static void G_Shutdown(void)
Free the tags TAG_LEVEL and TAG_GAME.
Definition g_main.cpp:282
static void G_FreeAllInventory(void)
Definition g_main.cpp:139
static void G_FreeInventory(void *data)
Definition g_main.cpp:129
static cvar_t * sv_cheats
Definition g_main.cpp:64
void Com_Printf(const char *msg,...)
Definition g_main.cpp:433
static void CheckNeedPass(void)
If password has changed, update sv_needpass cvar as needed.
Definition g_main.cpp:302
void Com_DPrintf(int level, const char *msg,...)
Definition g_main.cpp:445
static bool G_RunFrame(void)
Definition g_main.cpp:328
bool G_MatchIsRunning(void)
Checks whether the game is running (active team and no intermission time).
Definition g_match.cpp:320
bool G_MatchDoEnd(void)
Checks whether a match is over.
Definition g_match.cpp:253
Match related functions.
void G_SpawnEntities(const char *mapname, bool day, const char *entities)
Creates a server's entity / program execution context by parsing textual entity definitions out of an...
Definition g_spawn.cpp:331
Brings new objects into the world.
void G_CompleteRecalcRouting(void)
Definition g_utils.cpp:464
const char * G_GetPlayerName(int pnum)
Returns the player name for a give player number.
Definition g_utils.cpp:275
Misc utility functions for game module.
SrvPlayer player_t
Definition game.h:72
#define GAME_API_VERSION
Definition game.h:35
void INVSH_InitCSI(const csi_t *import)
Initializes client server shared data pointer. This works because the client and the server are both ...
voidpf void uLong size
Definition ioapi.h:42
#define CS_MAXTEAMS
Definition q_shared.h:316
QGL_EXTERN GLsizei const GLvoid * data
Definition r_gl.h:89
#define Q_strvalid(string)
Definition shared.h:141
#define Q_strcasecmp(a, b)
Definition shared.h:131
#define DOUBLEQUOTE(x)
Definition shared.h:90
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap)
Safe (null terminating) vsnprintf implementation.
Definition shared.cpp:535
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
Definition shared.cpp:410
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
Definition cvar.h:71
functions exported by the game subsystem
Definition game.h:317
functions provided by the main engine
Definition game.h:173
this structure is left intact through an entire game it should be initialized at game library load ti...
Definition g_local.h:69
this structure is cleared as each map is entered
Definition g_local.h:80
#define FILE