Skip to content

Commit

Permalink
- Change runtime standalone detection:
Browse files Browse the repository at this point in the history
  * com_standalone now read-only
  * add new cvars com_basegame, com_homepath
  * standalone now automatically detected when com_basegame is set to something different than baseq3 and no id pak pk3s are found
  * This fixes https://bugzilla.icculus.org/show_bug.cgi?id=4699
- Replace a few hardcoded string literals with macros
- Add checks for Team Arena PK3s to FS_CheckPak0()
  • Loading branch information
Thilo Schulz committed Feb 4, 2011
1 parent 774955c commit 3148416
Show file tree
Hide file tree
Showing 13 changed files with 223 additions and 70 deletions.
30 changes: 24 additions & 6 deletions README
Expand Up @@ -141,7 +141,14 @@ New cvars

com_ansiColor - enable use of ANSI escape codes in the tty
com_altivec - enable use of altivec on PowerPC systems
com_standalone - Run in standalone mode
com_standalone (read only) - If set to 1, quake3 is running in
standalone mode.
com_basegame - Use a different base than baseq3. If no
original Quake3 or TeamArena pak files
are found, this will enable running in
standalone mode.
com_homepath - Specify name that is to be appended to the
home path
com_maxfpsUnfocused - Maximum frames per second when unfocused
com_maxfpsMinimized - Maximum frames per second when minimized
com_busyWait - Will use a busy loop to wait for rendering
Expand Down Expand Up @@ -334,11 +341,22 @@ Creating standalone games
your own binaries. Instead, you can just use the pre-built binaries on the
website. Just make sure the game is called with:

+set com_standalone 1 +set fs_game <yourgamedir>

in any links/scripts you install for your users to start the game. Note that
the com_standalone setting is rendered ineffective, if the binary detects pk3
files in the directory "baseq3", so you cannot use that one as game dir.
+set com_basegame <yournewbase>

in any links/scripts you install for your users to start the game. The
binary must not detect any original quake3 game pak files. If this
condition is met, the game will set com_standalone to 1 and is then running
in stand alone mode.

If you want the engine to use a different directory in your homepath than
e.g. "Quake3" on Windows or ".q3a" on Linux, then set a new name at startup
by adding

+set com_homepath <homedirname>

to the command line. Example line:

+set com_basegame basefoo +set com_homepath .foo

If you really changed parts that would make vanilla ioquake3 incompatible with
your mod, we have included another way to conveniently build a stand-alone
Expand Down
5 changes: 4 additions & 1 deletion code/botlib/be_interface.c
Expand Up @@ -144,16 +144,19 @@ int Export_BotLibSetup(void)

if(botDeveloper)
{
char *homedir, *gamedir;
char *homedir, *gamedir, *basedir;
char logfilename[MAX_OSPATH];

homedir = LibVarGetString("homedir");
gamedir = LibVarGetString("gamedir");
basedir = LibVarGetString("com_basegame");

if (*homedir)
{
if(*gamedir)
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, gamedir, PATH_SEP);
else if(*basedir)
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, basedir, PATH_SEP);
else
Com_sprintf(logfilename, sizeof(logfilename), "%s%c" BASEGAME "%cbotlib.log", homedir, PATH_SEP, PATH_SEP);
}
Expand Down
2 changes: 1 addition & 1 deletion code/client/cl_main.c
Expand Up @@ -2106,7 +2106,7 @@ void CL_CheckForResend( void ) {
case CA_CONNECTING:
// requesting a challenge .. IPv6 users always get in as authorize server supports no ipv6.
#ifndef STANDALONE
if (!Cvar_VariableIntegerValue("com_standalone") && clc.serverAddress.type == NA_IP && !Sys_IsLANAddress( clc.serverAddress ) )
if (!com_standalone->integer && clc.serverAddress.type == NA_IP && !Sys_IsLANAddress( clc.serverAddress ) )
CL_RequestAuthorization();
#endif

Expand Down
4 changes: 2 additions & 2 deletions code/q3_ui/ui_menu.c
Expand Up @@ -121,7 +121,7 @@ void Main_MenuEvent (void* ptr, int event) {
break;

case ID_TEAMARENA:
trap_Cvar_Set( "fs_game", "missionpack");
trap_Cvar_Set( "fs_game", BASETA);
trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" );
break;

Expand Down Expand Up @@ -248,7 +248,7 @@ static qboolean UI_TeamArenaExists( void ) {
for( i = 0; i < numdirs; i++ ) {
dirlen = strlen( dirptr ) + 1;
descptr = dirptr + dirlen;
if (Q_stricmp(dirptr, "missionpack") == 0) {
if (Q_stricmp(dirptr, BASETA) == 0) {
return qtrue;
}
dirptr += dirlen + strlen(descptr) + 1;
Expand Down
14 changes: 11 additions & 3 deletions code/qcommon/common.c
Expand Up @@ -83,6 +83,8 @@ cvar_t *com_minimized;
cvar_t *com_maxfpsMinimized;
cvar_t *com_abnormalExit;
cvar_t *com_standalone;
cvar_t *com_basegame;
cvar_t *com_homepath;
cvar_t *com_busyWait;

// com_speeds times
Expand Down Expand Up @@ -2616,12 +2618,19 @@ void Com_Init( char *commandLine ) {
Cmd_Init ();

// get the developer cvar set as early as possible
Com_StartupVariable( "developer" );
com_developer = Cvar_Get("developer", "0", CVAR_TEMP);

// done early so bind command exists
CL_InitKeyCommands();

com_standalone = Cvar_Get("com_standalone", "0", CVAR_ROM);
com_basegame = Cvar_Get("com_basegame", BASEGAME, CVAR_INIT);
com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT);

if(!com_basegame->string[0])
Cvar_ForceReset("com_basegame");

// Com_StartupVariable(
FS_InitFilesystem ();

Com_InitJournaling();
Expand Down Expand Up @@ -2690,7 +2699,6 @@ void Com_Init( char *commandLine ) {
com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );
com_maxfpsMinimized = Cvar_Get( "com_maxfpsMinimized", "0", CVAR_ARCHIVE );
com_abnormalExit = Cvar_Get( "com_abnormalExit", "0", CVAR_ROM );
com_standalone = Cvar_Get( "com_standalone", "0", CVAR_INIT );
com_busyWait = Cvar_Get("com_busyWait", "0", CVAR_ARCHIVE);

com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
Expand Down Expand Up @@ -2806,7 +2814,7 @@ void Com_WriteConfiguration( void ) {
#ifndef DEDICATED
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
#ifndef STANDALONE
if(!Cvar_VariableIntegerValue("com_standalone"))
if(!com_standalone->integer)
{
if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
Com_WriteCDKey( fs->string, &cl_cdkey[16] );
Expand Down

0 comments on commit 3148416

Please sign in to comment.