Index: code/qcommon/files.c =================================================================== --- code/qcommon/files.c (revision 1016) +++ code/qcommon/files.c (working copy) @@ -2755,8 +2755,10 @@ #endif } +#ifdef USE_Q3_DATA void Com_AppendCDKey( const char *filename ); void Com_ReadCDKey( const char *filename ); +#endif // USE_Q3_DATA /* ================ @@ -2805,8 +2807,6 @@ */ static void FS_Startup( const char *gameName ) { const char *homePath; - cvar_t *fs; - Com_Printf( "----- FS_Startup -----\n" ); fs_debug = Cvar_Get( "fs_debug", "0", 0 ); @@ -2861,11 +2861,15 @@ } } +#ifdef USE_Q3_DATA + 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); @@ -2901,6 +2905,7 @@ Q3 media pak0.pk3, you'll want to remove this function =================== */ +#ifdef USE_Q3_DATA static void FS_CheckPak0( void ) { searchpath_t *path; @@ -2938,6 +2943,7 @@ "in the %s directory is present and readable.", BASEGAME); } } +#endif // USE_Q3_DATA /* ===================== @@ -3312,7 +3318,9 @@ // try to start up normally FS_Startup( BASEGAME ); +#ifdef USE_Q3_DATA FS_CheckPak0( ); +#endif // USE_Q3_DATA // if we can't find default.cfg, assume that the paths are // busted and error out now, rather than getting an unreadable @@ -3348,7 +3356,9 @@ // try to start up normally FS_Startup( BASEGAME ); +#ifdef USE_Q3_DATA FS_CheckPak0( ); +#endif // USE_Q3_DATA // if we can't find default.cfg, assume that the paths are // busted and error out now, rather than getting an unreadable Index: code/qcommon/qcommon.h =================================================================== --- code/qcommon/qcommon.h (revision 1016) +++ code/qcommon/qcommon.h (working copy) @@ -700,9 +700,11 @@ #define Q_vsnprintf vsnprintf #endif +#ifdef USE_Q3_DATA // centralizing the declarations for cl_cdkey // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470 extern char cl_cdkey[34]; +#endif // returnbed by Sys_GetProcessorId #define CPUID_GENERIC 0 // any unrecognized processor Index: code/qcommon/common.c =================================================================== --- code/qcommon/common.c (revision 1016) +++ code/qcommon/common.c (working copy) @@ -2252,6 +2252,7 @@ * ( int * ) 0 = 0x12345678; } +#ifdef USE_Q3_DATA // 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 @@ -2368,7 +2369,8 @@ #endif return; } -#endif +#endif // DEDICATED +#endif // USE_Q3_DATA static void Com_DetectAltivec(void) @@ -2599,6 +2601,7 @@ Com_WriteConfigToFile( "q3config.cfg" ); +#ifdef USE_Q3_DATA // bk001119 - tentative "not needed for dedicated" #ifndef DEDICATED fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO ); @@ -2607,7 +2610,8 @@ } else { Com_WriteCDKey( BASEGAME, cl_cdkey ); } -#endif +#endif // DEDICATED +#endif // USE_Q3_DATA } Index: code/client/client.h =================================================================== --- code/client/client.h (revision 1016) +++ code/client/client.h (working copy) @@ -404,7 +404,9 @@ void CL_ShutdownRef( void ); void CL_InitRef( void ); +#ifdef USE_Q3_DATA qboolean CL_CDKeyValidate( const char *key, const char *checksum ); +#endif // USE_Q3_DATA int CL_ServerStatus( char *serverAddress, char *serverStatusString, int maxLen ); qboolean CL_CheckPaused(void); Index: code/client/cl_main.c =================================================================== --- code/client/cl_main.c (revision 1016) +++ code/client/cl_main.c (working copy) @@ -893,7 +893,9 @@ */ void CL_RequestAuthorization( void ) { char nums[64]; +#ifdef USE_Q3_DATA int i, j, l; +#endif cvar_t *fs; if ( !cls.authorizeServer.port ) { @@ -916,6 +918,7 @@ if ( Cvar_VariableValue( "fs_restrict" ) ) { Q_strncpyz( nums, "demota", sizeof( nums ) ); } else { +#ifdef USE_Q3_DATA // only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces j = 0; l = strlen( cl_cdkey ); @@ -932,6 +935,9 @@ } } nums[j] = 0; +#else + nums[0] = 0; +#endif // USE_Q3_DATA } fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO ); @@ -3520,6 +3526,7 @@ Sys_ShowIP(); } +#ifdef USE_Q3_DATA /* ================= bool CL_CDKeyValidate @@ -3583,5 +3590,5 @@ return qfalse; } +#endif // USE_Q3_DATA - Index: code/client/cl_ui.c =================================================================== --- code/client/cl_ui.c (revision 1016) +++ code/client/cl_ui.c (working copy) @@ -681,6 +681,7 @@ } +#ifdef USE_Q3_DATA /* ==================== CLUI_GetCDKey @@ -718,6 +719,7 @@ cvar_modifiedFlags |= CVAR_ARCHIVE; } } +#endif // USE_Q3_DATA /* ==================== @@ -1016,13 +1018,17 @@ return Hunk_MemoryRemaining(); case UI_GET_CDKEY: +#ifdef USE_Q3_DATA CLUI_GetCDKey( VMA(1), args[2] ); +#endif // USE_Q3_DATA return 0; case UI_SET_CDKEY: +#ifdef USE_Q3_DATA CLUI_SetCDKey( VMA(1) ); - return 0; - +#endif // USE_Q3_DATA + return 0; + case UI_SET_PBCLSTATUS: return 0; @@ -1104,7 +1110,11 @@ return 0; case UI_VERIFY_CDKEY: +#ifdef USE_Q3_DATA return CL_CDKeyValidate(VMA(1), VMA(2)); +#else + return 0; +#endif // USE_Q3_DATA @@ -1173,6 +1183,7 @@ } } +#ifdef USE_Q3_DATA qboolean UI_usesUniqueCDKey( void ) { if (uivm) { return (VM_Call( uivm, UI_HASUNIQUECDKEY) == qtrue); @@ -1180,6 +1191,7 @@ return qfalse; } } +#endif // USE_Q3_DATA /* ==================== Index: Makefile =================================================================== --- Makefile (revision 1016) +++ Makefile (working copy) @@ -83,6 +83,10 @@ GENERATE_DEPENDENCIES=1 endif +ifndef USE_Q3_DATA +USE_Q3_DATA=1 +endif + ifndef USE_CCACHE USE_CCACHE=0 endif @@ -218,6 +222,10 @@ GL_CFLAGS = -I/usr/X11R6/include endif + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer ifeq ($(ARCH),x86_64) @@ -403,6 +411,10 @@ #CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm endif + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + OPTIMIZE += -ffast-math -falign-loops=16 ifneq ($(HAVE_VM_COMPILED),true) @@ -450,6 +462,10 @@ BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 endif + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + GL_CFLAGS = MINGW_CFLAGS = -DDONT_TYPEDEF_INT32 @@ -526,6 +542,10 @@ BASE_CFLAGS += $(shell sdl-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 endif + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + ifeq ($(ARCH),axp) CC=gcc BASE_CFLAGS += -DNO_VM_COMPILED @@ -597,6 +617,10 @@ BASE_CFLAGS += -DNO_VM_COMPILED endif + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + BUILD_CLIENT = 0 BUILD_GAME_QVM = 0 @@ -616,6 +640,10 @@ RELEASE_CFLAGS=$(BASE_CFLAGS) -O3 DEBUG_CFLAGS=$(BASE_CFLAGS) -g + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + SHLIBEXT=so SHLIBCFLAGS= SHLIBLDFLAGS=-shared @@ -658,6 +686,10 @@ GL_CFLAGS = -I/usr/openwin/include endif + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + OPTIMIZE = -O3 -ffast-math -funroll-loops ifeq ($(ARCH),sparc) @@ -707,6 +739,11 @@ ############################################################################# CC=cc BASE_CFLAGS=-DNO_VM_COMPILED + + ifeq ($(USE_Q3_DATA),1) + BASE_CFLAGS += -DUSE_Q3_DATA=1 + endif + DEBUG_CFLAGS=$(BASE_CFLAGS) -g RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3