diff options
author | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-04-10 15:37:25 +0000 |
---|---|---|
committer | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-04-10 15:37:25 +0000 |
commit | ce41605441c55110aa523250987b50235261a6f6 (patch) | |
tree | 9a71b593f93e5ba817a94d40a3a04c0ec379b3d4 /code/qcommon | |
parent | 92f7f50f61dffdfa44d4908f7dc662eee9eedcdf (diff) | |
download | ioquake3-aero-ce41605441c55110aa523250987b50235261a6f6.tar.gz ioquake3-aero-ce41605441c55110aa523250987b50235261a6f6.zip |
Add com_standalone cvar for at-runtime handling of mods that do not require the original quake3 game data.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1309 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r-- | code/qcommon/common.c | 18 | ||||
-rw-r--r-- | code/qcommon/files.c | 33 | ||||
-rw-r--r-- | code/qcommon/net_ip.c | 2 | ||||
-rw-r--r-- | code/qcommon/qcommon.h | 1 |
4 files changed, 39 insertions, 15 deletions
diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 8fb492f..d7b6cb2 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -82,6 +82,7 @@ cvar_t *com_cameraMode; cvar_t *com_ansiColor; cvar_t *com_unfocused; cvar_t *com_minimized; +cvar_t *com_standalone; // com_speeds times int time_game; @@ -2351,6 +2352,8 @@ static void Com_Crash_f( void ) { * ( int * ) 0 = 0x12345678; } +#ifndef STANDALONE + // TTimo: centralizing the cl_cdkey stuff after I discovered a buffer overflow problem with the dedicated server version // not sure it's necessary to have different defaults for regular and dedicated, but I don't want to risk it // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470 @@ -2469,6 +2472,7 @@ out: } #endif +#endif // STANDALONE static void Com_DetectAltivec(void) { @@ -2591,6 +2595,7 @@ void Com_Init( char *commandLine ) { com_unfocused = Cvar_Get( "com_unfocused", "0", CVAR_ROM ); com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM ); + com_standalone = Cvar_Get( "com_standalone", "0", CVAR_INIT ); com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE); @@ -2697,12 +2702,17 @@ void Com_WriteConfiguration( void ) { // not needed for dedicated #ifndef DEDICATED fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO ); - if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) { - Com_WriteCDKey( fs->string, &cl_cdkey[16] ); - } else { - Com_WriteCDKey( BASEGAME, cl_cdkey ); +#ifndef STANDALONE + if(!Cvar_VariableIntegerValue("com_standalone")) + { + if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) { + Com_WriteCDKey( fs->string, &cl_cdkey[16] ); + } else { + Com_WriteCDKey( BASEGAME, cl_cdkey ); + } } #endif +#endif } diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 32a24da..a5efb7e 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -2661,8 +2661,10 @@ void FS_Shutdown( qboolean closemfp ) { #endif } +#ifndef STANDALONE void Com_AppendCDKey( const char *filename ); void Com_ReadCDKey( const char *filename ); +#endif /* ================ @@ -2712,7 +2714,6 @@ FS_Startup static void FS_Startup( const char *gameName ) { const char *homePath; - cvar_t *fs; Com_Printf( "----- FS_Startup -----\n" ); @@ -2764,11 +2765,18 @@ static void FS_Startup( const char *gameName ) } } - Com_ReadCDKey(BASEGAME); - fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO ); - if (fs && fs->string[0] != 0) { - Com_AppendCDKey( fs->string ); +#ifndef STANDALONE + if(!Cvar_VariableIntegerValue("com_standalone")) + { + cvar_t *fs; + + Com_ReadCDKey(BASEGAME); + fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO ); + if (fs && fs->string[0] != 0) { + Com_AppendCDKey( fs->string ); + } } +#endif // add our commands Cmd_AddCommand ("path", FS_Path_f); @@ -2865,7 +2873,12 @@ static void FS_CheckPak0( void ) } } - if(!founddemo && (foundPak & 0x1ff) != 0x1ff ) + if( (!Cvar_VariableIntegerValue("com_standalone") || + !fs_gamedirvar->string[0] || + !Q_stricmp(fs_gamedirvar->string, BASEGAME) || + !Q_stricmp(fs_gamedirvar->string, "missionpack") ) + && + (!founddemo && (foundPak & 0x1ff) != 0x1ff) ) { if((foundPak&1) != 1 ) { @@ -2886,11 +2899,11 @@ static void FS_CheckPak0( void ) "the correct place and that every file\n" "in the %s directory is present and readable.\n", BASEGAME); - if(!fs_gamedirvar->string[0] - || !Q_stricmp( fs_gamedirvar->string, BASEGAME ) - || !Q_stricmp( fs_gamedirvar->string, "missionpack" )) - Com_Error(ERR_FATAL, "You need to install Quake III Arena in order to play"); + Com_Error(ERR_FATAL, "You need to install Quake III Arena in order to play"); } + + if(foundPak & 1) + Cvar_Set("com_standalone", "0"); } #endif diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c index 22c1273..c481add 100644 --- a/code/qcommon/net_ip.c +++ b/code/qcommon/net_ip.c @@ -921,7 +921,7 @@ void NET_SetMulticast6(void) Com_Printf("WARNING: NET_JoinMulticast6: Incorrect multicast address given, " "please set cvar %s to a sane value.\n", net_mcast6addr->name); - Cvar_Set(net_enabled->name, va("%d", net_enabled->integer | NET_DISABLEMCAST)); + Cvar_SetValue(net_enabled->name, net_enabled->integer | NET_DISABLEMCAST); return; } diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 1bd1c3d..0fe6a47 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -681,6 +681,7 @@ void FS_HomeRemove( const char *homePath ); void FS_FilenameCompletion( const char *dir, const char *ext, qboolean stripExt, void(*callback)(const char *s) ); + /* ============================================================== |