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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Apr 9 19:43:30 EDT 2008


Author: thilo
Date: 2008-04-09 19:43:30 -0400 (Wed, 09 Apr 2008)
New Revision: 1307

Modified:
   trunk/Makefile
   trunk/README
   trunk/code/client/cl_main.c
   trunk/code/qcommon/files.c
   trunk/code/qcommon/q_shared.h
   trunk/code/qcommon/qcommon.h
   trunk/code/server/server.h
   trunk/code/server/sv_ccmds.c
   trunk/code/server/sv_client.c
   trunk/code/server/sv_main.c
Log:
Include #ifdef to make it easier to create a stand-alone binary.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/Makefile	2008-04-09 23:43:30 UTC (rev 1307)
@@ -23,6 +23,9 @@
   endif
 endif
 
+ifndef BUILD_STANDALONE
+  BUILD_STANDALONE =
+endif
 ifndef BUILD_CLIENT
   BUILD_CLIENT     =
 endif
@@ -151,9 +154,16 @@
 TEMPDIR=/tmp
 
 # extract version info
-VERSION=$(shell grep "\#define *PRODUCT_VERSION" $(CMDIR)/q_shared.h | \
-  sed -e 's/[^"]*"\(.*\)"/\1/')
+# echo $(BUILD_CLIENT)
 
+ifeq ($(BUILD_STANDALONE),1)
+  VERSION=$(shell grep "\#define *PRODUCT_VERSION" $(CMDIR)/q_shared.h | head -n 1 | \
+    sed -e 's/[^"]*"\(.*\)"/\1/')
+else
+  VERSION=$(shell grep "\#define *PRODUCT_VERSION" $(CMDIR)/q_shared.h | tail -n 1 | \
+    sed -e 's/[^"]*"\(.*\)"/\1/')
+endif
+
 USE_SVN=
 ifeq ($(wildcard .svn),.svn)
   SVN_REV=$(shell LANG=C svnversion .)
@@ -760,6 +770,10 @@
   BASE_CFLAGS += -DUSE_LOCAL_HEADERS
 endif
 
+ifeq ($(BUILD_STANDALONE),1)
+  BASE_CFLAGS += -DSTANDALONE
+endif
+
 ifeq ($(GENERATE_DEPENDENCIES),1)
   DEPEND_CFLAGS = -MMD
 else

Modified: trunk/README
===================================================================
--- trunk/README	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/README	2008-04-09 23:43:30 UTC (rev 1307)
@@ -83,6 +83,7 @@
   BUILD_CLIENT_SMP  - build the 'ioquake3-smp' client binary
   BUILD_GAME_SO     - build the game shared libraries
   BUILD_GAME_QVM    - build the game qvms
+  BUILD_STANDALONE  - build binaries suited for stand-alone games
   USE_OPENAL        - use OpenAL where available
   USE_OPENAL_DLOPEN - link with OpenAL at runtime
   USE_CURL          - use libcurl for http/ftp download support
@@ -193,6 +194,25 @@
   compiler. See http://www.quakesrc.org/forums/viewtopic.php?t=5665 (if it
   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
+  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
+  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
+  as stated in the GPL. That includes making sources and modifications you made
+  to the ioquake3 engine as well as the game-code used to compile the .qvm
+  files for the game logic freely available to everyone.
+  This does NOT mean that you cannot market this game commercially. All assets
+  (e.g. textures, sounds, maps) created by yourself are your property and can
+  be sold like every other game you find in stores.
+
 cl_guid Support
   cl_guid is a cvar which is part of the client's USERINFO string.  Its value
   is a 32 character string made up of [a-f] and [0-9] characters.  This

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/client/cl_main.c	2008-04-09 23:43:30 UTC (rev 1307)
@@ -1004,6 +1004,7 @@
 in anyway.
 ===================
 */
+#ifndef STANDALONE
 void CL_RequestAuthorization( void ) {
 	char	nums[64];
 	int		i, j, l;
@@ -1047,7 +1048,7 @@
 
 	NET_OutOfBandPrint(NS_CLIENT, cls.authorizeServer, "getKeyAuthorize %i %s", fs->integer, nums );
 }
-
+#endif
 /*
 ======================================================================
 
@@ -1710,9 +1711,11 @@
 	switch ( cls.state ) {
 	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 ) ) {
 			CL_RequestAuthorization();
 		}
+#endif
 		NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "getchallenge");
 		break;
 		

Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/qcommon/files.c	2008-04-09 23:43:30 UTC (rev 1307)
@@ -2795,6 +2795,7 @@
 	Com_Printf( "%d files in pk3 files\n", fs_packFiles );
 }
 
+#ifndef STANDALONE
 /*
 ===================
 FS_CheckPak0
@@ -2891,6 +2892,7 @@
 			Com_Error(ERR_FATAL, "You need to install Quake III Arena in order to play");
 	}
 }
+#endif
 
 /*
 =====================
@@ -3262,7 +3264,9 @@
 	// try to start up normally
 	FS_Startup( BASEGAME );
 
+#ifndef STANDALONE
 	FS_CheckPak0( );
+#endif
 
 	// if we can't find default.cfg, assume that the paths are
 	// busted and error out now, rather than getting an unreadable
@@ -3295,7 +3299,9 @@
 	// try to start up normally
 	FS_Startup( BASEGAME );
 
+#ifndef STANDALONE
 	FS_CheckPak0( );
+#endif
 
 	// if we can't find default.cfg, assume that the paths are
 	// busted and error out now, rather than getting an unreadable

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/qcommon/q_shared.h	2008-04-09 23:43:30 UTC (rev 1307)
@@ -26,8 +26,19 @@
 // q_shared.h -- included first by ALL program modules.
 // A user mod should never modify this file
 
-#define PRODUCT_NAME            "ioq3"
-#define PRODUCT_VERSION         "1.35"
+#ifdef STANDALONE
+  #define PRODUCT_NAME			"iofoo3"
+  #define PRODUCT_VERSION		"-1"
+  #define BASEGAME			"foobar"
+  #define CLIENT_WINDOW_TITLE     	"changeme"
+  #define CLIENT_WINDOW_MIN_TITLE 	"changeme2"
+#else
+  #define PRODUCT_NAME			"ioq3"
+  #define PRODUCT_VERSION		"1.35"
+  #define BASEGAME			"baseq3"
+  #define CLIENT_WINDOW_TITLE     	"ioquake3"
+  #define CLIENT_WINDOW_MIN_TITLE 	"ioq3"
+#endif
 
 #ifdef SVN_VERSION
 # define Q3_VERSION PRODUCT_NAME " " SVN_VERSION
@@ -35,12 +46,6 @@
 # define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
 #endif
 
-#define CLIENT_WINDOW_TITLE     "ioquake3"
-#define CLIENT_WINDOW_MIN_TITLE "ioq3"
-// 1.32 released 7-10-2002
-
-#define BASEGAME              "baseq3"
-
 #define MAX_TEAMNAME 32
 
 #ifdef _MSC_VER

Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/qcommon/qcommon.h	2008-04-09 23:43:30 UTC (rev 1307)
@@ -243,15 +243,18 @@
 #ifndef MASTER_SERVER_NAME
 #define MASTER_SERVER_NAME	"master.quake3arena.com"
 #endif
-#ifndef AUTHORIZE_SERVER_NAME
-#define	AUTHORIZE_SERVER_NAME	"authorize.quake3arena.com"
+
+#ifndef STANDALONE
+  #ifndef AUTHORIZE_SERVER_NAME
+    #define	AUTHORIZE_SERVER_NAME	"authorize.quake3arena.com"
+  #endif
+  #ifndef PORT_AUTHORIZE
+  #define	PORT_AUTHORIZE		27952
+  #endif
 #endif
 
 #define	PORT_MASTER			27950
 #define	PORT_UPDATE			27951
-#ifndef PORT_AUTHORIZE
-#define	PORT_AUTHORIZE		27952
-#endif
 #define	PORT_SERVER			27960
 #define	NUM_SERVER_PORTS	4		// broadcast scan this many ports after
 									// PORT_SERVER so a single machine can

Modified: trunk/code/server/server.h
===================================================================
--- trunk/code/server/server.h	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/server/server.h	2008-04-09 23:43:30 UTC (rev 1307)
@@ -290,7 +290,9 @@
 
 void SV_DirectConnect( netadr_t from );
 
+#ifndef STANDALONE
 void SV_AuthorizeIpPacket( netadr_t from );
+#endif
 
 void SV_ExecuteClientMessage( client_t *cl, msg_t *msg );
 void SV_UserinfoChanged( client_t *cl );

Modified: trunk/code/server/sv_ccmds.c
===================================================================
--- trunk/code/server/sv_ccmds.c	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/server/sv_ccmds.c	2008-04-09 23:43:30 UTC (rev 1307)
@@ -397,6 +397,9 @@
 	cl->lastPacketTime = svs.time;	// in case there is a funny zombie
 }
 
+#ifndef STANDALONE
+// these functions require the auth server which of course is not available anymore for stand-alone games.
+
 /*
 ==================
 SV_Ban_f
@@ -506,6 +509,7 @@
 		Com_Printf("%s was banned from coming back\n", cl->name);
 	}
 }
+#endif
 
 /*
 ==================
@@ -735,8 +739,10 @@
 
 	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);
+#endif
 	Cmd_AddCommand ("clientkick", SV_KickNum_f);
 	Cmd_AddCommand ("status", SV_Status_f);
 	Cmd_AddCommand ("serverinfo", SV_Serverinfo_f);

Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/server/sv_client.c	2008-04-09 23:43:30 UTC (rev 1307)
@@ -81,6 +81,10 @@
 		i = oldest;
 	}
 
+#ifdef 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 ) ) {
 		challenge->pingTime = svs.time;
@@ -144,8 +148,10 @@
 		NET_OutOfBandPrint( NS_SERVER, challenge->adr, 
 			"challengeResponse %i", challenge->challenge );
 	}
+#endif
 }
 
+#ifndef STANDALONE
 /*
 ====================
 SV_AuthorizeIpPacket
@@ -216,6 +222,7 @@
 	// clear the challenge record so it won't timeout and let them through
 	Com_Memset( &svs.challenges[i], 0, sizeof( svs.challenges[i] ) );
 }
+#endif
 
 /*
 ==================
@@ -225,10 +232,6 @@
 ==================
 */
 
-#define PB_MESSAGE "PunkBuster Anti-Cheat software must be installed " \
-				"and Enabled in order to join this server. An updated game patch can be downloaded from " \
-				"www.idsoftware.com"
-
 void SV_DirectConnect( netadr_t from ) {
 	char		userinfo[MAX_INFO_STRING];
 	int			i;

Modified: trunk/code/server/sv_main.c
===================================================================
--- trunk/code/server/sv_main.c	2008-04-09 22:20:04 UTC (rev 1306)
+++ trunk/code/server/sv_main.c	2008-04-09 23:43:30 UTC (rev 1307)
@@ -534,8 +534,10 @@
 		SV_GetChallenge( from );
 	} else if (!Q_stricmp(c, "connect")) {
 		SV_DirectConnect( from );
+#ifndef STANDALONE
 	} else if (!Q_stricmp(c, "ipAuthorize")) {
 		SV_AuthorizeIpPacket( from );
+#endif
 	} else if (!Q_stricmp(c, "rcon")) {
 		SVC_RemoteCommand( from, msg );
 	} else if (!Q_stricmp(c, "disconnect")) {




More information about the quake3-commits mailing list