aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-10 15:37:25 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-10 15:37:25 +0000
commitce41605441c55110aa523250987b50235261a6f6 (patch)
tree9a71b593f93e5ba817a94d40a3a04c0ec379b3d4
parent92f7f50f61dffdfa44d4908f7dc662eee9eedcdf (diff)
downloadioquake3-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
-rw-r--r--README29
-rw-r--r--code/client/cl_main.c7
-rw-r--r--code/client/cl_ui.c9
-rw-r--r--code/client/client.h2
-rw-r--r--code/qcommon/common.c18
-rw-r--r--code/qcommon/files.c33
-rw-r--r--code/qcommon/net_ip.c2
-rw-r--r--code/qcommon/qcommon.h1
-rw-r--r--code/server/sv_ccmds.c7
-rw-r--r--code/server/sv_client.c7
10 files changed, 85 insertions, 30 deletions
diff --git a/README b/README
index d359326..57ccf76 100644
--- a/README
+++ b/README
@@ -129,6 +129,7 @@ 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.
s_backend - read only, indicates the current sound
backend
s_muteWhenMinimized - mute sound when minimized
@@ -195,14 +196,30 @@ Creating mods compatible with Q3 1.32b
still exists when you read this) for more details.
Creating stand-alone games
- As ioquake3 is meant to be a reliable and stable code base, this engine is
- ideal for your stand-alone game project. We made it easier for you to get a
- binary that does not look for the original quake3 assets. The auth server
- specific parts are disabled, too.
- Just run make with the option BUILD_STANDALONE=1
+ Have you finished the daunting task of removing all dependencies on the
+ quake3 game data? Well, you probably now want to give your users the
+ opportunity to play the game without owning a copy of quake3, which
+ consequently means removing cd-key and auth server checks. As ioquake3 is
+ meant to be a reliable and stable code base for your game project, too, we
+ have included means to do that.
+ However, before you start compiling your own version of ioquake3, you have to
+ ask youself: Have we changed anything of importance in the engine at all?
+
+ If you must answer that question with "no", it probably makes no sense to
+ build your own binaries. You can still 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 links/scripts you install for your users to start the game. Note that the
+ com_standalone setting is rendered ineffective, if the binary detects pak
+ files in the directory "baseq3", so you cannot use that one as game dir.
+
+ 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 binary. Just run make with the option BUILD_STANDALONE=1
Don't forget to edit the PRODUCT_NAME and subsequent #defines in
qcommon/q_shared.h and fill in your project info!
- While a lot of work has been put into the ioquake3 that you can benefit from
+
+ While a lot of work has been put into ioquake3 that you can benefit from
free of charge, it does not mean that you have no obligations to fulfill.
Be aware that as soon as you start distributing your game with an engine
based on our sources we expect you to fully comply with the requirements
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index 8df950b..589907d 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -1712,9 +1712,8 @@ void CL_CheckForResend( void ) {
case CA_CONNECTING:
// requesting a challenge .. IPv6 users always get in as authorize server supports no ipv6.
#ifndef STANDALONE
- if ( clc.serverAddress.type == NA_IP && !Sys_IsLANAddress( clc.serverAddress ) ) {
+ if (!Cvar_VariableIntegerValue("com_standalone") && clc.serverAddress.type == NA_IP && !Sys_IsLANAddress( clc.serverAddress ) )
CL_RequestAuthorization();
- }
#endif
NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "getchallenge");
break;
@@ -3695,6 +3694,7 @@ void CL_ShowIP_f(void) {
Sys_ShowIP();
}
+#ifndef STANDALONE
/*
=================
bool CL_CDKeyValidate
@@ -3758,5 +3758,4 @@ qboolean CL_CDKeyValidate( const char *key, const char *checksum ) {
return qfalse;
}
-
-
+#endif
diff --git a/code/client/cl_ui.c b/code/client/cl_ui.c
index 0ca9943..a4d813a 100644
--- a/code/client/cl_ui.c
+++ b/code/client/cl_ui.c
@@ -667,6 +667,7 @@ static void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
CLUI_GetCDKey
====================
*/
+#ifndef STANDALONE
static void CLUI_GetCDKey( char *buf, int buflen ) {
cvar_t *fs;
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
@@ -699,6 +700,7 @@ static void CLUI_SetCDKey( char *buf ) {
cvar_modifiedFlags |= CVAR_ARCHIVE;
}
}
+#endif
/*
====================
@@ -1005,6 +1007,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
+#ifndef STANDALONE
case UI_GET_CDKEY:
CLUI_GetCDKey( VMA(1), args[2] );
return 0;
@@ -1012,6 +1015,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
case UI_SET_CDKEY:
CLUI_SetCDKey( VMA(1) );
return 0;
+#endif
case UI_SET_PBCLSTATUS:
return 0;
@@ -1093,9 +1097,10 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
re.RemapShader( VMA(1), VMA(2), VMA(3) );
return 0;
+#ifndef STANDALONE
case UI_VERIFY_CDKEY:
return CL_CDKeyValidate(VMA(1), VMA(2));
-
+#endif
default:
@@ -1167,6 +1172,7 @@ void CL_InitUI( void ) {
Cvar_SetCheatState();
}
+#ifndef STANDALONE
qboolean UI_usesUniqueCDKey( void ) {
if (uivm) {
return (VM_Call( uivm, UI_HASUNIQUECDKEY) == qtrue);
@@ -1174,6 +1180,7 @@ qboolean UI_usesUniqueCDKey( void ) {
return qfalse;
}
}
+#endif
/*
====================
diff --git a/code/client/client.h b/code/client/client.h
index b68b518..7a0bd53 100644
--- a/code/client/client.h
+++ b/code/client/client.h
@@ -409,7 +409,9 @@ int CL_GetPingQueueCount( void );
void CL_ShutdownRef( void );
void CL_InitRef( void );
+#ifndef STANDALONE
qboolean CL_CDKeyValidate( const char *key, const char *checksum );
+#endif
int CL_ServerStatus( char *serverAddress, char *serverStatusString, int maxLen );
qboolean CL_CheckPaused(void);
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) );
+
/*
==============================================================
diff --git a/code/server/sv_ccmds.c b/code/server/sv_ccmds.c
index 18dcfbc..e2bcd93 100644
--- a/code/server/sv_ccmds.c
+++ b/code/server/sv_ccmds.c
@@ -740,8 +740,11 @@ void SV_AddOperatorCommands( void ) {
Cmd_AddCommand ("heartbeat", SV_Heartbeat_f);
Cmd_AddCommand ("kick", SV_Kick_f);
#ifndef STANDALONE
- Cmd_AddCommand ("banUser", SV_Ban_f);
- Cmd_AddCommand ("banClient", SV_BanNum_f);
+ if(!Cvar_VariableIntegerValue("com_standalone"))
+ {
+ Cmd_AddCommand ("banUser", SV_Ban_f);
+ Cmd_AddCommand ("banClient", SV_BanNum_f);
+ }
#endif
Cmd_AddCommand ("clientkick", SV_KickNum_f);
Cmd_AddCommand ("status", SV_Status_f);
diff --git a/code/server/sv_client.c b/code/server/sv_client.c
index 5345b0e..8230036 100644
--- a/code/server/sv_client.c
+++ b/code/server/sv_client.c
@@ -82,8 +82,11 @@ void SV_GetChallenge( netadr_t from ) {
}
#ifdef STANDALONE
- challenge->pingTime = svs.time;
- NET_OutOfBandPrint( NS_SERVER, from, "challengeResponse %i", challenge->challenge );
+ if(Cvar_VariableIntegerValue("com_standalone"))
+ {
+ challenge->pingTime = svs.time;
+ NET_OutOfBandPrint( NS_SERVER, from, "challengeResponse %i", challenge->challenge );
+ }
#else
// if they are on a lan address, send the challengeResponse immediately
if ( Sys_IsLANAddress( from ) ) {