DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
com_game.h File Reference
#include "qdefs.h"
+ Include dependency graph for com_game.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IS_NEXUIZ_DERIVED(g)
 
#define IS_OLDNEXUIZ_DERIVED(g)
 

Enumerations

enum  gamemode_t {
  GAME_NORMAL , GAME_HIPNOTIC , GAME_ROGUE , GAME_QUOTH ,
  GAME_NEHAHRA , GAME_NEXUIZ , GAME_XONOTIC , GAME_TRANSFUSION ,
  GAME_GOODVSBAD2 , GAME_TEU , GAME_BATTLEMECH , GAME_ZYMOTIC ,
  GAME_SETHERAL , GAME_TENEBRAE , GAME_NEOTERIC , GAME_OPENQUARTZ ,
  GAME_PRYDON , GAME_DELUXEQUAKE , GAME_THEHUNTED , GAME_DEFEATINDETAIL2 ,
  GAME_DARSANA , GAME_CONTAGIONTHEORY , GAME_EDU2P , GAME_PROPHECY ,
  GAME_BLOODOMNICIDE , GAME_STEELSTORM , GAME_STEELSTORM2 , GAME_SSAMMO ,
  GAME_STEELSTORMREVENANTS , GAME_TOMESOFMEPHISTOPHELES , GAME_STRAPBOMB , GAME_MOONHELM ,
  GAME_VORETOURNAMENT , GAME_DOOMBRINGER , GAME_BATTLEMETAL , GAME_QUAKE15 ,
  GAME_AD , GAME_CTSJ2 , GAME_COUNT
}
 

Functions

int COM_ChangeGameTypeForGameDirs (unsigned numgamedirs, const char *gamedirs[], qbool failmissing, qbool init)
 
void COM_InitGameType (void)
 

Variables

char com_modname [MAX_OSPATH]
 
gamemode_t com_startupgamegroup
 
const char * gamedirname1
 
const char * gamedirname2
 
gamemode_t gamemode
 
const char * gamename
 
const char * gamenetworkfiltername
 
const char * gamescreenshotname
 
const char * gameuserdirname
 

Macro Definition Documentation

◆ IS_NEXUIZ_DERIVED

#define IS_NEXUIZ_DERIVED ( g)

◆ IS_OLDNEXUIZ_DERIVED

Enumeration Type Documentation

◆ gamemode_t

enum gamemode_t
Enumerator
GAME_NORMAL 
GAME_HIPNOTIC 
GAME_ROGUE 
GAME_QUOTH 
GAME_NEHAHRA 
GAME_NEXUIZ 
GAME_XONOTIC 
GAME_TRANSFUSION 
GAME_GOODVSBAD2 
GAME_TEU 
GAME_BATTLEMECH 
GAME_ZYMOTIC 
GAME_SETHERAL 
GAME_TENEBRAE 

full of evil hackery

GAME_NEOTERIC 
GAME_OPENQUARTZ 

this game sucks

GAME_PRYDON 
GAME_DELUXEQUAKE 
GAME_THEHUNTED 
GAME_DEFEATINDETAIL2 
GAME_DARSANA 
GAME_CONTAGIONTHEORY 
GAME_EDU2P 
GAME_PROPHECY 
GAME_BLOODOMNICIDE 
GAME_STEELSTORM 

added by motorsep

GAME_STEELSTORM2 

added by motorsep

GAME_SSAMMO 

added by motorsep

GAME_STEELSTORMREVENANTS 

added by motorsep 07/19/2015

GAME_TOMESOFMEPHISTOPHELES 

added by motorsep

GAME_STRAPBOMB 

added by motorsep for Urre

GAME_MOONHELM 
GAME_VORETOURNAMENT 
GAME_DOOMBRINGER 

added by Cloudwalk for kristus

GAME_BATTLEMETAL 

added by Cloudwalk for Subject9x

GAME_QUAKE15 

added by bones_was_here as it depends on an old bug and a workaround

GAME_AD 

added by bones_was_here as it depends on old DP behaviour or csqc_lowres

GAME_CTSJ2 

added by bones_was_here as it has a race condition that requires a workaound

GAME_COUNT 

Definition at line 26 of file com_game.h.

27{
64 GAME_AD,
67}
@ GAME_TEU
Definition com_game.h:37
@ GAME_SETHERAL
Definition com_game.h:40
@ GAME_BATTLEMECH
Definition com_game.h:38
@ GAME_CONTAGIONTHEORY
Definition com_game.h:49
@ GAME_BATTLEMETAL
added by Cloudwalk for Subject9x
Definition com_game.h:62
@ GAME_STEELSTORMREVENANTS
added by motorsep 07/19/2015
Definition com_game.h:56
@ GAME_DOOMBRINGER
added by Cloudwalk for kristus
Definition com_game.h:61
@ GAME_BLOODOMNICIDE
Definition com_game.h:52
@ GAME_QUOTH
Definition com_game.h:31
@ GAME_COUNT
Definition com_game.h:66
@ GAME_EDU2P
Definition com_game.h:50
@ GAME_ROGUE
Definition com_game.h:30
@ GAME_TRANSFUSION
Definition com_game.h:35
@ GAME_STEELSTORM
added by motorsep
Definition com_game.h:53
@ GAME_MOONHELM
Definition com_game.h:59
@ GAME_STEELSTORM2
added by motorsep
Definition com_game.h:54
@ GAME_PROPHECY
Definition com_game.h:51
@ GAME_DARSANA
Definition com_game.h:48
@ GAME_OPENQUARTZ
this game sucks
Definition com_game.h:43
@ GAME_QUAKE15
added by bones_was_here as it depends on an old bug and a workaround
Definition com_game.h:63
@ GAME_TOMESOFMEPHISTOPHELES
added by motorsep
Definition com_game.h:57
@ GAME_GOODVSBAD2
Definition com_game.h:36
@ GAME_NEOTERIC
Definition com_game.h:42
@ GAME_THEHUNTED
Definition com_game.h:46
@ GAME_NEHAHRA
Definition com_game.h:32
@ GAME_STRAPBOMB
added by motorsep for Urre
Definition com_game.h:58
@ GAME_NORMAL
Definition com_game.h:28
@ GAME_CTSJ2
added by bones_was_here as it has a race condition that requires a workaound
Definition com_game.h:65
@ GAME_TENEBRAE
full of evil hackery
Definition com_game.h:41
@ GAME_AD
added by bones_was_here as it depends on old DP behaviour or csqc_lowres
Definition com_game.h:64
@ GAME_PRYDON
Definition com_game.h:44
@ GAME_SSAMMO
added by motorsep
Definition com_game.h:55
@ GAME_ZYMOTIC
Definition com_game.h:39
@ GAME_DELUXEQUAKE
Definition com_game.h:45
@ GAME_HIPNOTIC
Definition com_game.h:29
@ GAME_DEFEATINDETAIL2
Definition com_game.h:47

Function Documentation

◆ COM_ChangeGameTypeForGameDirs()

int COM_ChangeGameTypeForGameDirs ( unsigned numgamedirs,
const char * gamedirs[],
qbool failmissing,
qbool init )

Definition at line 122 of file com_game.c.

123{
124 unsigned i, gamemode_count = sizeof(gamemode_info) / sizeof(gamemode_info[0]);
125 int j, index = -1;
127 // this will not not change the gamegroup
128
129 // first check if a base game (single gamedir) matches
130 for (i = 0; i < gamemode_count; i++)
131 {
133 {
134 index = i;
135 break;
136 }
137 }
138 if (index < 0)
139 Sys_Error("BUG: failed to find the base game!");
140
141 // See if there is a derivative game matching the startup one (two gamedirs),
142 // this prevents a Quake expansion (eg Rogue) getting switched to Quake during startup,
143 // not used when changing gamedirs later so that it's possible to change from the startup mod to the base one.
144 if (init)
145 {
146 for (i = 0; i < gamemode_count; i++)
147 {
149 {
150 index = i;
151 break;
152 }
153 }
154 }
155
156 // See if the base game or mod can be identified by a gamedir,
157 // if more than one matches the last is used because the last gamedir is the primary.
158 for (j = numgamedirs - 1; j >= 0; --j)
159 {
160 for (i = 0; i < gamemode_count; i++)
161 {
163 if ((gamemode_info[i].gamedirname2 && gamemode_info[i].gamedirname2[0] && !strcasecmp(gamedirs[j], gamemode_info[i].gamedirname2))
164 || (!gamemode_info[i].gamedirname2 && !strcasecmp(gamedirs[j], gamemode_info[i].gamedirname1)))
165 {
166 index = i;
167 goto double_break;
168 }
169 }
170 }
171double_break:
172
173 // we now have a good guess at which game this is meant to be...
175
176 ret = FS_SetGameDirs(numgamedirs, gamedirs, failmissing, !init);
177 if (ret == GAMEDIRS_SUCCESS)
178 {
179 Con_Printf("Game is %s using %s", gamename, fs_numgamedirs > 1 ? "gamedirs" : "gamedir");
180 for (j = 0; j < fs_numgamedirs; ++j)
181 Con_Printf(" %s%s", (strcasecmp(fs_gamedirs[j], gamedirname1) && (!gamedirname2 || strcasecmp(fs_gamedirs[j], gamedirname2))) ? "^7" : "^9", fs_gamedirs[j]);
182 Con_Printf("\n");
183
184 Con_Printf("gamename for server filtering: %s\n", gamenetworkfiltername);
185
187 }
188 return ret;
189}
const char * gamedirname2
Definition com_game.c:30
const char * gamedirname1
Definition com_game.c:29
const char * gamenetworkfiltername
Definition com_game.c:28
static const gamemode_info_t gamemode_info[GAME_COUNT]
Definition com_game.c:52
static void COM_SetGameType(int index)
Definition com_game.c:191
gamemode_t com_startupgamegroup
Definition com_game.c:36
gamemode_t com_startupgamemode
Definition com_game.c:35
const char * gamename
Definition com_game.c:27
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
addgamedirs_t FS_SetGameDirs(int numgamedirs, const char *gamedirs[], qbool failmissing, qbool abortonfail)
Definition fs.c:1633
char fs_gamedirs[MAX_GAMEDIRS][MAX_QPATH]
Definition fs.c:449
int fs_numgamedirs
Definition fs.c:448
addgamedirs_t
Definition fs.h:102
@ GAMEDIRS_SUCCESS
Definition fs.h:105
GLenum mode
Definition glquake.h:718
GLuint index
Definition glquake.h:629
void Host_UpdateVersion(void)
Definition host.c:162
int i
return ret
void Sys_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Causes the entire program to exit ASAP.
Definition sys_shared.c:724

References COM_SetGameType(), com_startupgamegroup, com_startupgamemode, Con_Printf(), fs_gamedirs, fs_numgamedirs, FS_SetGameDirs(), gamedirname1, gamedirname2, GAMEDIRS_SUCCESS, gamemode_info, gamename, gamenetworkfiltername, Host_UpdateVersion(), i, index, mode, ret, and Sys_Error().

Referenced by FS_ChangeGameDirs(), and FS_Init_Dir().

◆ COM_InitGameType()

void COM_InitGameType ( void )

Definition at line 95 of file com_game.c.

96{
97 char name [MAX_OSPATH];
98 int i;
99 int index = GAME_NORMAL;
100
101#ifdef FORCEGAME
102 COM_ToLowerString(FORCEGAME, name, sizeof (name));
103#else
104 // check executable filename for keywords, but do it SMARTLY - only check the last path element
106 COM_ToLowerString(name, name, sizeof (name));
107#endif
108 for (i = 1;i < (int)(sizeof (gamemode_info) / sizeof (gamemode_info[0]));i++)
109 if (gamemode_info[i].prog_name && gamemode_info[i].prog_name[0] && strstr (name, gamemode_info[i].prog_name))
110 index = i;
111
112 // check commandline options for keywords
113 for (i = 0;i < (int)(sizeof (gamemode_info) / sizeof (gamemode_info[0]));i++)
115 index = i;
116
120}
cvar_t cmdline
Definition common.c:33
size_t COM_ToLowerString(const char *in, char *out, size_t size_out)
Returns the number of bytes written to *out excluding the \0 terminator.
Definition common.c:1051
const char * FS_FileWithoutPath(const char *in)
Definition fs.c:1431
static int(ZEXPORT *qz_inflate)(z_stream *strm
void FS_StripExtension(const char *in, char *out, size_t size_out)
Definition fs.c:3611
const GLchar * name
Definition glquake.h:601
#define MAX_OSPATH
max length of a filesystem pathname
Definition qdefs.h:175
gamemode_t group
different games with same group can switch automatically when gamedirs change
Definition com_game.c:41
gamemode_t mode
this gamemode
Definition com_game.c:40
const char ** argv
Definition sys.h:147
sys_t sys
Definition sys_shared.c:42
int Sys_CheckParm(const char *parm)
Definition sys_shared.c:327

References sys_t::argv, cmdline, COM_SetGameType(), com_startupgamegroup, com_startupgamemode, COM_ToLowerString(), FS_FileWithoutPath(), FS_StripExtension(), GAME_NORMAL, gamemode_info, gamemode_info_t::group, i, index, int(), MAX_OSPATH, gamemode_info_t::mode, name, sys, and Sys_CheckParm().

Referenced by FS_Init().

Variable Documentation

◆ com_modname

char com_modname[MAX_OSPATH]
extern

Definition at line 33 of file com_game.c.

Referenced by FS_Rescan(), and NetConn_BuildStatusResponse().

◆ com_startupgamegroup

gamemode_t com_startupgamegroup
extern

◆ gamedirname1

◆ gamedirname2

const char* gamedirname2
extern

◆ gamemode

gamemode_t gamemode
extern

◆ gamename

const char* gamename
extern

◆ gamenetworkfiltername

const char* gamenetworkfiltername
extern

◆ gamescreenshotname

const char* gamescreenshotname
extern

Definition at line 31 of file com_game.c.

Referenced by COM_SetGameType(), and FS_Rescan().

◆ gameuserdirname

const char* gameuserdirname
extern

Definition at line 32 of file com_game.c.

Referenced by COM_SetGameType(), FS_ChooseUserDir(), and FS_Init_Dir().