From 65f2ac04aa129b9e293e5322352915b684bb95e1 Mon Sep 17 00:00:00 2001 From: sezero Date: Wed, 12 Jan 2011 09:32:22 +0000 Subject: [PATCH] changed makefiles to use 1/0 instead of yes/no for the codec options. made quakespasm custom conback embedding optional, still defaulting to 1. the code requires USE_QS_CONBACK preprocessor definition. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@392 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Linux/CodeBlocks/QuakeSpasm.cbp | 1 + MacOSX/QuakeSpasm.xcodeproj/project.pbxproj | 18 +++++++++++++++ Misc/homedir_0.patch | 20 ++++++++--------- Quake/Makefile | 23 ++++++++++++------- Quake/Makefile.darwin | 24 +++++++++++++------- Quake/Makefile.w32 | 25 +++++++++++++-------- Quake/Makefile.w64 | 25 +++++++++++++-------- Quake/common.c | 4 ++++ Quake/conback.c | 3 +++ Quake/draw.h | 2 ++ Quake/gl_draw.c | 9 ++++++++ Quake/gl_texmgr.c | 2 ++ Windows/CodeBlocks/QuakeSpasm.cbp | 1 + Windows/VisualStudio/quakespasm.vcproj | 8 +++---- 14 files changed, 117 insertions(+), 48 deletions(-) diff --git a/Linux/CodeBlocks/QuakeSpasm.cbp b/Linux/CodeBlocks/QuakeSpasm.cbp index c4b073e4..26d7401f 100644 --- a/Linux/CodeBlocks/QuakeSpasm.cbp +++ b/Linux/CodeBlocks/QuakeSpasm.cbp @@ -33,6 +33,7 @@ + diff --git a/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj b/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj index 323c9fc8..02bc880b 100644 --- a/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj +++ b/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj @@ -772,6 +772,9 @@ COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "USE_QS_CONBACK", + ); PRODUCT_NAME = Distribution; }; name = Debug; @@ -782,6 +785,9 @@ COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "USE_QS_CONBACK", + ); PRODUCT_NAME = Distribution; ZERO_LINK = NO; }; @@ -802,6 +808,9 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "USE_QS_CONBACK", + ); HEADER_SEARCH_PATHS = ( /Library/Frameworks/SDL.framework/Headers, /Library/Frameworks/SDL_net.framework/Headers, @@ -827,6 +836,9 @@ FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)\""; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G5; + GCC_PREPROCESSOR_DEFINITIONS = ( + "USE_QS_CONBACK", + ); HEADER_SEARCH_PATHS = ( /Library/Frameworks/SDL.framework/Headers, /Library/Frameworks/SDL_net.framework/Headers, @@ -851,6 +863,9 @@ GCC_MODEL_TUNING = G3; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "USE_QS_CONBACK", + ); HEADER_SEARCH_PATHS = ( /Library/Frameworks/SDL.framework/Headers, "$(HEADER_SEARCH_PATHS)", @@ -872,6 +887,9 @@ GCC_MODEL_TUNING = G3; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "USE_QS_CONBACK", + ); HEADER_SEARCH_PATHS = ( /Library/Frameworks/SDL.framework/Headers, "$(HEADER_SEARCH_PATHS)", diff --git a/Misc/homedir_0.patch b/Misc/homedir_0.patch index ca5b150e..75b5ddb7 100644 --- a/Misc/homedir_0.patch +++ b/Misc/homedir_0.patch @@ -1,14 +1,14 @@ support for user directories, based on a patch by Piotr Szymaniak. -** against quakespasm svn revision 390. +** against quakespasm svn revision 392. ** in alpha state, minimally tested. ** on-the-fly game directory changes not supported yet. ** needs more work. Index: Quake/common.c =================================================================== ---- Quake/common.c (revision 390) +--- Quake/common.c (revision 392) +++ Quake/common.c (working copy) -@@ -1825,32 +1825,36 @@ +@@ -1825,32 +1825,36 @@ pack_t *COM_LoadPackFile (const char *pa COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial ================= */ @@ -49,7 +49,7 @@ Index: Quake/common.c pak = COM_LoadPackFile (pakfile); if (!pak) break; -@@ -1860,6 +1864,14 @@ +@@ -1860,6 +1864,14 @@ void COM_AddGameDirectory (const char *d search->next = com_searchpaths; com_searchpaths = search; } @@ -63,8 +63,8 @@ Index: Quake/common.c + } } - static void kill_id1_conback (void) /* QuakeSpasm customization: */ -@@ -1894,6 +1906,10 @@ + #if defined(USE_QS_CONBACK) +@@ -1896,6 +1908,10 @@ void COM_InitFilesystem (void) //johnfit { int i, j; @@ -75,7 +75,7 @@ Index: Quake/common.c i = COM_CheckParm ("-basedir"); if (i && i < com_argc-1) strcpy (com_basedir, com_argv[i + 1]); -@@ -1908,8 +1924,7 @@ +@@ -1910,8 +1926,7 @@ void COM_InitFilesystem (void) //johnfit } // start up with GAMENAME by default (id1) @@ -83,9 +83,9 @@ Index: Quake/common.c - strcpy (com_gamedir, va("%s/"GAMENAME, com_basedir)); + COM_AddGameDirectory (com_basedir, GAMENAME); + #if defined(USE_QS_CONBACK) if (!fitzmode) - { /* QuakeSpasm customization: */ -@@ -1921,17 +1936,17 @@ +@@ -1925,17 +1940,17 @@ void COM_InitFilesystem (void) //johnfit com_nummissionpacks = 0; if (COM_CheckParm ("-rogue")) { @@ -106,7 +106,7 @@ Index: Quake/common.c com_nummissionpacks++; } //johnfitz -@@ -1940,7 +1955,7 @@ +@@ -1944,7 +1959,7 @@ void COM_InitFilesystem (void) //johnfit if (i && i < com_argc-1) { com_modified = true; diff --git a/Quake/Makefile b/Quake/Makefile index 9b953fc9..45322db1 100644 --- a/Quake/Makefile +++ b/Quake/Makefile @@ -1,4 +1,4 @@ -### GNU Makefile for QuakeSpasm unix targets, Aug. 31, 2010 +### GNU Makefile for QuakeSpasm unix targets, Jan. 12, 2011 # # You need the SDL library fully installed. # "make DEBUG=1" to build a debug client. @@ -7,15 +7,17 @@ # instead of platform specific code. # Build objects are separate from those of codeblocks +### Embed custom Quakespasm console background picture +USE_QS_CONBACK=1 + ### Enable/Disable codecs for streaming music support # # OGG (vorbis) playback requires libvorbis and libogg # MP3 playback requires libmad -USE_CODEC_WAVE=yes -USE_CODEC_MP3=yes -USE_CODEC_VORBIS=yes - +USE_CODEC_WAVE=1 +USE_CODEC_MP3=1 +USE_CODEC_VORBIS=1 # ============================================================================ # Helper functions @@ -23,6 +25,7 @@ USE_CODEC_VORBIS=yes check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;) +# ============================================================================ DEBUG ?= 0 SDLNET ?= 0 @@ -114,15 +117,19 @@ else NET_LIBS := endif +ifeq ($(USE_QS_CONBACK),1) +CFLAGS+= -DUSE_QS_CONBACK +endif + CODECLIBS := -ifeq ($(USE_CODEC_WAVE),yes) +ifeq ($(USE_CODEC_WAVE),1) CFLAGS+= -DUSE_CODEC_WAVE endif -ifeq ($(USE_CODEC_VORBIS),yes) +ifeq ($(USE_CODEC_VORBIS),1) CFLAGS+= -DUSE_CODEC_VORBIS CODECLIBS+= vorbis vorbisfile ogg endif -ifeq ($(USE_CODEC_MP3),yes) +ifeq ($(USE_CODEC_MP3),1) CFLAGS+= -DUSE_CODEC_MP3 CODECLIBS+= mad endif diff --git a/Quake/Makefile.darwin b/Quake/Makefile.darwin index 47015958..cfcc44b7 100644 --- a/Quake/Makefile.darwin +++ b/Quake/Makefile.darwin @@ -1,20 +1,22 @@ -# GNU Makefile for QuakeSpasm for Darwin only, Aug. 31, 2010 +# GNU Makefile for QuakeSpasm for Darwin only, Jan. 12, 2011 # # You need the SDL library fully installed. # "make DEBUG=1" to build a debug client. # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. # "make SDLNET=1" to use SDL_net (not recommended) # instead of platform specific code. -# Build objects are separate from those of codeblocks + +### Embed custom Quakespasm console background picture +USE_QS_CONBACK=1 ### Enable/Disable codecs for streaming music support # # OGG (vorbis) playback requires libvorbis and libogg # MP3 playback requires libmad -USE_CODEC_WAVE=yes -USE_CODEC_MP3=yes -USE_CODEC_VORBIS=yes +USE_CODEC_WAVE=1 +USE_CODEC_MP3=1 +USE_CODEC_VORBIS=1 # ============================================================================ # Helper functions @@ -22,6 +24,8 @@ USE_CODEC_VORBIS=yes check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;) +# ============================================================================ + DEBUG ?= 0 SDLNET ?= 0 @@ -119,17 +123,21 @@ else NET_LIBS := endif +ifeq ($(USE_QS_CONBACK),1) +CFLAGS+= -DUSE_QS_CONBACK +endif + # FIXME: The codec libs stuff are copied over from the unix makefile # They might need adaptations for Darwin CODECLIBS := -ifeq ($(USE_CODEC_WAVE),yes) +ifeq ($(USE_CODEC_WAVE),1) CFLAGS+= -DUSE_CODEC_WAVE endif -ifeq ($(USE_CODEC_VORBIS),yes) +ifeq ($(USE_CODEC_VORBIS),1) CFLAGS+= -DUSE_CODEC_VORBIS CODECLIBS+= -lvorbis -lvorbisfile -logg endif -ifeq ($(USE_CODEC_MP3),yes) +ifeq ($(USE_CODEC_MP3),1) CFLAGS+= -DUSE_CODEC_MP3 CODECLIBS+= -lmad endif diff --git a/Quake/Makefile.w32 b/Quake/Makefile.w32 index 6884fea8..6880a5db 100644 --- a/Quake/Makefile.w32 +++ b/Quake/Makefile.w32 @@ -1,11 +1,19 @@ # GNU Makefile for cross-compiling quakespasm.exe (Win32 : MinGW) -# using cross-toolchains on a linux host / Aug. 31, 2010. +# using cross-toolchains on a linux host / Jan. 12, 2011. # "make DEBUG=1" to build a debug client. # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. # "make WINSOCK2=1" to use WinSock2 api instead of old WinSock 1.1. # "make SDLNET=1" to use SDL_net (not recommended) instead of platform # specific code. +### Embed custom Quakespasm console background picture +USE_QS_CONBACK=1 + +### Enable/disable codecs for streaming music support +USE_CODEC_WAVE=1 +USE_CODEC_MP3=1 +USE_CODEC_VORBIS=1 + # ============================================================================ # Helper functions # ============================================================================ @@ -14,11 +22,6 @@ check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1; # ============================================================================ -# Enable/disable codecs for streaming music support: -USE_CODEC_WAVE=yes -USE_CODEC_MP3=yes -USE_CODEC_VORBIS=yes - DEBUG ?= 0 WINSOCK2 ?= 0 SDLNET ?= 0 @@ -86,19 +89,23 @@ CFLAGS += $(DEFWINSOCK) NET_LIBS := $(LIBWINSOCK) endif +ifeq ($(USE_QS_CONBACK),1) +CFLAGS+= -DUSE_QS_CONBACK +endif + CODECLIBS := -ifeq ($(USE_CODEC_WAVE),yes) +ifeq ($(USE_CODEC_WAVE),1) CFLAGS+= -DUSE_CODEC_WAVE CODEC_INC = -I../Windows/codecs/include CODEC_LINK= -L../Windows/codecs/x86 endif -ifeq ($(USE_CODEC_VORBIS),yes) +ifeq ($(USE_CODEC_VORBIS),1) CFLAGS+= -DUSE_CODEC_VORBIS CODEC_INC = -I../Windows/codecs/include CODEC_LINK= -L../Windows/codecs/x86 CODECLIBS+= -lvorbis -lvorbisfile -logg endif -ifeq ($(USE_CODEC_MP3),yes) +ifeq ($(USE_CODEC_MP3),1) CFLAGS+= -DUSE_CODEC_MP3 CODEC_INC = -I../Windows/codecs/include CODEC_LINK= -L../Windows/codecs/x86 diff --git a/Quake/Makefile.w64 b/Quake/Makefile.w64 index 5e60a4e0..6947c063 100644 --- a/Quake/Makefile.w64 +++ b/Quake/Makefile.w64 @@ -1,11 +1,19 @@ # GNU Makefile for cross-compiling quakespasm.exe (Win64 : MinGW-w64) -# using cross-toolchains on a linux host / Aug. 31, 2010. +# using cross-toolchains on a linux host / Jan. 12, 2011. # "make DEBUG=1" to build a debug client. # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. # "make WINSOCK2=0" to use the old WinSock 1.1 api (not recommended). # "make SDLNET=1" to use SDL_net (not recommended) instead of platform # specific code. +### Embed custom Quakespasm console background picture +USE_QS_CONBACK=1 + +### Enable/disable codecs for streaming music support +USE_CODEC_WAVE=1 +USE_CODEC_MP3=1 +USE_CODEC_VORBIS=1 + # ============================================================================ # Helper functions # ============================================================================ @@ -14,11 +22,6 @@ check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1; # ============================================================================ -# Enable/disable codecs for streaming music support: -USE_CODEC_WAVE=yes -USE_CODEC_MP3=yes -USE_CODEC_VORBIS=yes - DEBUG ?= 0 WINSOCK2 ?= 1 SDLNET ?= 0 @@ -86,19 +89,23 @@ CFLAGS += $(DEFWINSOCK) NET_LIBS := $(LIBWINSOCK) endif +ifeq ($(USE_QS_CONBACK),1) +CFLAGS+= -DUSE_QS_CONBACK +endif + CODECLIBS := -ifeq ($(USE_CODEC_WAVE),yes) +ifeq ($(USE_CODEC_WAVE),1) CFLAGS+= -DUSE_CODEC_WAVE CODEC_INC = -I../Windows/codecs/include CODEC_LINK= -L../Windows/codecs/x64 endif -ifeq ($(USE_CODEC_VORBIS),yes) +ifeq ($(USE_CODEC_VORBIS),1) CFLAGS+= -DUSE_CODEC_VORBIS CODEC_INC = -I../Windows/codecs/include CODEC_LINK= -L../Windows/codecs/x64 CODECLIBS+= -lvorbis -lvorbisfile -logg endif -ifeq ($(USE_CODEC_MP3),yes) +ifeq ($(USE_CODEC_MP3),1) CFLAGS+= -DUSE_CODEC_MP3 CODEC_INC = -I../Windows/codecs/include CODEC_LINK= -L../Windows/codecs/x64 diff --git a/Quake/common.c b/Quake/common.c index 913eec4a..8284c142 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -1862,6 +1862,7 @@ void COM_AddGameDirectory (const char *dir) } } +#if defined(USE_QS_CONBACK) static void kill_id1_conback (void) /* QuakeSpasm customization: */ { searchpath_t *search; @@ -1884,6 +1885,7 @@ static void kill_id1_conback (void) /* QuakeSpasm customization: */ } } } +#endif /* USE_QS_CONBACK */ /* ================= @@ -1911,10 +1913,12 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial COM_AddGameDirectory (va("%s/"GAMENAME, com_basedir)); strcpy (com_gamedir, va("%s/"GAMENAME, com_basedir)); +#if defined(USE_QS_CONBACK) if (!fitzmode) { /* QuakeSpasm customization: */ kill_id1_conback (); } +#endif /* USE_QS_CONBACK */ //johnfitz -- track number of mission packs added //since we don't want to allow the "game" command to strip them away diff --git a/Quake/conback.c b/Quake/conback.c index 7a2b7dd2..aebaff2f 100644 --- a/Quake/conback.c +++ b/Quake/conback.c @@ -4,6 +4,7 @@ #include "quakedef.h" +#if defined(USE_QS_CONBACK) static const byte conback_byte[] = { # include "conback.h" @@ -29,3 +30,5 @@ char *get_conback (void) return custom_conback; } +#endif /* USE_QS_CONBACK */ + diff --git a/Quake/draw.h b/Quake/draw.h index 071ac1b3..b6cc08c7 100644 --- a/Quake/draw.h +++ b/Quake/draw.h @@ -43,7 +43,9 @@ void Draw_NewGame (void); void GL_SetCanvas (canvastype newcanvas); //johnfitz +#if defined(USE_QS_CONBACK) void Draw_CheckConback (void); // QuakeSpasm customization +#endif /* USE_QS_CONBACK */ #endif /* _QUAKE_DRAW_H */ diff --git a/Quake/gl_draw.c b/Quake/gl_draw.c index 154db163..db3b4f2b 100644 --- a/Quake/gl_draw.c +++ b/Quake/gl_draw.c @@ -318,6 +318,12 @@ qpic_t *Draw_CachePic (const char *path) Draw_ConbackPic -- QuakeSpasm custom conback drawing. ================ */ +#if !defined(USE_QS_CONBACK) +static inline qpic_t *Draw_ConbackPic (void) +{ + return Draw_CachePic ("gfx/conback.lmp"); +} +#else extern char *get_conback(void); static qboolean have_mod_conback; void Draw_CheckConback (void) @@ -365,6 +371,7 @@ qpic_t *Draw_ConbackPic (void) return &pic->pic; } /* -- QuakeSpasm */ } +#endif /* USE_QS_CONBACK */ /* ================ @@ -466,8 +473,10 @@ void Draw_Init (void) // load game pics Draw_LoadPics (); +#if defined(USE_QS_CONBACK) /* QuakeSpasm customization: */ Draw_CheckConback (); +#endif /* USE_QS_CONBACK */ } //============================================================================== diff --git a/Quake/gl_texmgr.c b/Quake/gl_texmgr.c index 00d6a537..cafcfe60 100644 --- a/Quake/gl_texmgr.c +++ b/Quake/gl_texmgr.c @@ -502,8 +502,10 @@ void TexMgr_NewGame (void) { TexMgr_FreeTextures (0, TEXPREF_PERSIST); //deletes all textures where TEXPREF_PERSIST is unset TexMgr_LoadPalette (); +#if defined(USE_QS_CONBACK) /* QuakeSpasm customization: */ Draw_CheckConback (); +#endif /* USE_QS_CONBACK */ } /* diff --git a/Windows/CodeBlocks/QuakeSpasm.cbp b/Windows/CodeBlocks/QuakeSpasm.cbp index a44fcbd4..487f0f5a 100644 --- a/Windows/CodeBlocks/QuakeSpasm.cbp +++ b/Windows/CodeBlocks/QuakeSpasm.cbp @@ -32,6 +32,7 @@ + diff --git a/Windows/VisualStudio/quakespasm.vcproj b/Windows/VisualStudio/quakespasm.vcproj index 5ed99341..cd2d7df8 100644 --- a/Windows/VisualStudio/quakespasm.vcproj +++ b/Windows/VisualStudio/quakespasm.vcproj @@ -44,7 +44,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="C:\SDL\include;..\codecs\include;..\..\Quake;.;.." - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_CODEC_MP3;USE_CODEC_VORBIS;USE_CODEC_WAVE" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_QS_CONBACK;USE_CODEC_MP3;USE_CODEC_VORBIS;USE_CODEC_WAVE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -119,7 +119,7 @@