r1309 - in trunk: . code/client code/qcommon code/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Apr 10 11:37:26 EDT 2008


Author: thilo
Date: 2008-04-10 11:37:25 -0400 (Thu, 10 Apr 2008)
New Revision: 1309

Modified:
   trunk/README
   trunk/code/client/cl_main.c
   trunk/code/client/cl_ui.c
   trunk/code/client/client.h
   trunk/code/qcommon/common.c
   trunk/code/qcommon/files.c
   trunk/code/qcommon/net_ip.c
   trunk/code/qcommon/qcommon.h
   trunk/code/server/sv_ccmds.c
   trunk/code/server/sv_client.c
Log:
Add com_standalone cvar for at-runtime handling of mods that do not require the original quake3 game data.


Modified: trunk/README
===================================================================
--- trunk/README	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/README	2008-04-10 15:37:25 UTC (rev 1309)
@@ -129,6 +129,7 @@
 
   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 @@
   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

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/client/cl_main.c	2008-04-10 15:37:25 UTC (rev 1309)
@@ -1712,9 +1712,8 @@
 	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 @@
 	Sys_ShowIP();
 }
 
+#ifndef STANDALONE
 /*
 =================
 bool CL_CDKeyValidate
@@ -3758,5 +3758,4 @@
 
 	return qfalse;
 }
-
-
+#endif

Modified: trunk/code/client/cl_ui.c
===================================================================
--- trunk/code/client/cl_ui.c	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/client/cl_ui.c	2008-04-10 15:37:25 UTC (rev 1309)
@@ -667,6 +667,7 @@
 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 @@
 		cvar_modifiedFlags |= CVAR_ARCHIVE;
 	}
 }
+#endif
 
 /*
 ====================
@@ -1005,6 +1007,7 @@
 	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 @@
 	case UI_SET_CDKEY:
 		CLUI_SetCDKey( VMA(1) );
 		return 0;
+#endif
 	
 	case UI_SET_PBCLSTATUS:
 		return 0;	
@@ -1093,10 +1097,11 @@
 		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:
 		Com_Error( ERR_DROP, "Bad UI system trap: %ld", (long int) args[0] );
@@ -1167,6 +1172,7 @@
 		Cvar_SetCheatState();
 }
 
+#ifndef STANDALONE
 qboolean UI_usesUniqueCDKey( void ) {
 	if (uivm) {
 		return (VM_Call( uivm, UI_HASUNIQUECDKEY) == qtrue);
@@ -1174,6 +1180,7 @@
 		return qfalse;
 	}
 }
+#endif
 
 /*
 ====================

Modified: trunk/code/client/client.h
===================================================================
--- trunk/code/client/client.h	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/client/client.h	2008-04-10 15:37:25 UTC (rev 1309)
@@ -409,7 +409,9 @@
 
 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);

Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/qcommon/common.c	2008-04-10 15:37:25 UTC (rev 1309)
@@ -82,6 +82,7 @@
 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 @@
 	* ( 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 @@
 }
 #endif
 
+#endif // STANDALONE
 
 static void Com_DetectAltivec(void)
 {
@@ -2591,6 +2595,7 @@
 
 	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 @@
 	// 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
 }
 
 

Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/qcommon/files.c	2008-04-10 15:37:25 UTC (rev 1309)
@@ -2661,8 +2661,10 @@
 #endif
 }
 
+#ifndef STANDALONE
 void Com_AppendCDKey( const char *filename );
 void Com_ReadCDKey( const char *filename );
+#endif
 
 /*
 ================
@@ -2712,7 +2714,6 @@
 static void FS_Startup( const char *gameName )
 {
 	const char *homePath;
-	cvar_t	*fs;
 
 	Com_Printf( "----- FS_Startup -----\n" );
 
@@ -2764,11 +2765,18 @@
 		}
 	}
 
-	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 @@
 		}
 	}
 
-	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 @@
 			"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
 

Modified: trunk/code/qcommon/net_ip.c
===================================================================
--- trunk/code/qcommon/net_ip.c	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/qcommon/net_ip.c	2008-04-10 15:37:25 UTC (rev 1309)
@@ -921,7 +921,7 @@
 		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;
 	}

Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/qcommon/qcommon.h	2008-04-10 15:37:25 UTC (rev 1309)
@@ -681,6 +681,7 @@
 
 void	FS_FilenameCompletion( const char *dir, const char *ext,
 		qboolean stripExt, void(*callback)(const char *s) );
+
 /*
 ==============================================================
 

Modified: trunk/code/server/sv_ccmds.c
===================================================================
--- trunk/code/server/sv_ccmds.c	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/server/sv_ccmds.c	2008-04-10 15:37:25 UTC (rev 1309)
@@ -740,8 +740,11 @@
 	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);

Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c	2008-04-10 13:12:20 UTC (rev 1308)
+++ trunk/code/server/sv_client.c	2008-04-10 15:37:25 UTC (rev 1309)
@@ -82,8 +82,11 @@
 	}
 
 #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 ) ) {




More information about the quake3-commits mailing list