Revert "Revert "Build in subdirs"", as the issues seem to be ironed out now.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Aug 2013 12:48:18 +0000 (12:48 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Aug 2013 12:48:18 +0000 (12:48 +0000)
Revert "Revert "Make cdda optional, server does not need to play music" because it", as its requirements are there now.
Do not include menu QC support in server builds.

Author: Nikoli

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11992 d7cf8633-e32d-0410-b094-e92efae38249

23 files changed:
.gitignore
BSDmakefile
cl_demo.c
cl_main.c
cl_parse.c
cl_screen.c
gl_rmain.c
host.c
host_cmd.c
keys.c
makefile
makefile.inc
menu.c
netconn.c
progsvm.h
prvm_cmds.c
prvm_edict.c
prvm_exec.c
quakedef.h
snd_main.c
snd_mix.c
vid_shared.c
vid_wgl.c

index de9a5ad..047e418 100644 (file)
@@ -1,3 +1,4 @@
+obj/
 *.d
 *.o
 *.i
index 36f0f82..6ca3c65 100644 (file)
@@ -7,12 +7,13 @@ DP_MAKE_TARGET=bsd
 .endif
 DP_ARCH != uname
 
-
 # Makefile name
 MAKEFILE=BSDmakefile
 
-# Command used to delete files
+# Commands
 CMD_RM=$(CMD_UNIXRM)
+CMD_CP=$(CMD_UNIXCP)
+CMD_MKDIR=$(CMD_UNIXMKDIR)
 
 # default targets
 TARGETS_DEBUG=sv-debug cl-debug sdl-debug
@@ -21,6 +22,25 @@ TARGETS_RELEASE=sv-release cl-release sdl-release
 TARGETS_RELEASE_PROFILE=sv-release-profile cl-release-profile sdl-release-profile
 TARGETS_NEXUIZ=sv-nexuiz cl-nexuiz sdl-nexuiz
 
+###### Optional features #####
+DP_CDDA?=enabled
+.if $(DP_CDDA) == "enabled"
+       OBJ_SDLCD=$(OBJ_CD_COMMON) cd_sdl.o
+       OBJ_BSDCD=$(OBJ_CD_COMMON) cd_bsd.o
+.else
+       OBJ_SDLCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
+       OBJ_BSDCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
+.endif
+
+DP_VIDEO_CAPTURE?=enabled
+.if $(DP_VIDEO_CAPTURE == "enabled"
+       CFLAGS_VIDEO_CAPTURE=-DCONFIG_VIDEO_CAPTURE
+       OBJ_VIDEO_CAPTURE= cap_avi.o cap_ogg.o
+.else
+       CFLAGS_VIDEO_CAPTURE=
+       OBJ_VIDEO_CAPTURE=
+.endif
+
 # X11 libs
 UNIX_X11LIBPATH=/usr/X11R6/lib
 
@@ -129,7 +149,7 @@ CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
 
 MAKE:=$(MAKE) -f BSDmakefile
 
-DO_LD=$(CC) -o $@ $> $(LDFLAGS)
+DO_LD=$(CC) -o ../../../$@ $> $(LDFLAGS)
 
 
 ##### Definitions shared by all makefiles #####
index f30eff8..6d4fb86 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -20,8 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
+#ifdef CONFIG_CAPTURE_VIDEO
 extern cvar_t cl_capturevideo;
 extern cvar_t cl_capturevideo_demo_stop;
+#endif
 int old_vsync = 0;
 
 static void CL_FinishTimeDemo (void);
@@ -79,8 +81,10 @@ Called when a demo file runs out, or the user starts a game
 // LordHavoc: now called only by CL_Disconnect
 void CL_StopPlayback (void)
 {
+#ifdef CONFIG_CAPTURE_VIDEO
        if (cl_capturevideo_demo_stop.integer)
                Cvar_Set("cl_capturevideo", "0");
+#endif
 
        if (!cls.demoplayback)
                return;
index d50d4dd..ec4ca8b 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -428,7 +428,9 @@ void CL_EstablishConnection(const char *host, int firstarg)
                return;
 
        // clear menu's connect error message
+#ifdef CONFIG_MENU
        M_Update_Return_Reason("");
+#endif
        cls.demonum = -1;
 
        // stop demo loop in case this fails
@@ -462,12 +464,16 @@ void CL_EstablishConnection(const char *host, int firstarg)
                        *cls.connect_userinfo = 0;
                }
 
+#ifdef CONFIG_MENU
                M_Update_Return_Reason("Trying to connect...");
+#endif
        }
        else
        {
                Con_Print("Unable to find a suitable network socket to connect to server.\n");
+#ifdef CONFIG_MENU
                M_Update_Return_Reason("No network");
+#endif
        }
 }
 
index e637dca..3ae26aa 100644 (file)
@@ -20,12 +20,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // cl_parse.c  -- parse a message received from the server
 
 #include "quakedef.h"
+#ifdef CONFIG_CD
 #include "cdaudio.h"
+#endif
 #include "cl_collision.h"
 #include "csprogs.h"
 #include "libcurl.h"
 #include "utf8lib.h"
+#ifdef CONFIG_MENU
 #include "menu.h"
+#endif
 #include "cl_video.h"
 
 const char *svc_strings[128] =
@@ -502,8 +506,10 @@ static void CL_SetupWorldModel(void)
        // check memory integrity
        Mem_CheckSentinelsGlobal();
 
+#ifdef CONFIG_MENU
        // make menu know
        MR_NewMap();
+#endif
 
        // load the csqc now
        if (cl.loadcsqc)
@@ -3608,10 +3614,12 @@ void CL_ParseServerMessage(void)
 
                        case qw_svc_cdtrack:
                                cl.cdtrack = cl.looptrack = MSG_ReadByte(&cl_message);
+#ifdef CONFIG_CD
                                if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) )
                                        CDAudio_Play ((unsigned char)cls.forcetrack, true);
                                else
                                        CDAudio_Play ((unsigned char)cl.cdtrack, true);
+#endif
                                break;
 
                        case qw_svc_intermission:
@@ -3730,10 +3738,12 @@ void CL_ParseServerMessage(void)
 
                        case qw_svc_setpause:
                                cl.paused = MSG_ReadByte(&cl_message) != 0;
+#ifdef CONFIG_CD
                                if (cl.paused)
                                        CDAudio_Pause ();
                                else
                                        CDAudio_Resume ();
+#endif
                                S_PauseGameSounds (cl.paused);
                                break;
                        }
@@ -4057,10 +4067,12 @@ void CL_ParseServerMessage(void)
 
                        case svc_setpause:
                                cl.paused = MSG_ReadByte(&cl_message) != 0;
+#ifdef CONFIG_CD
                                if (cl.paused)
                                        CDAudio_Pause ();
                                else
                                        CDAudio_Resume ();
+#endif
                                S_PauseGameSounds (cl.paused);
                                break;
 
@@ -4107,10 +4119,12 @@ void CL_ParseServerMessage(void)
                        case svc_cdtrack:
                                cl.cdtrack = MSG_ReadByte(&cl_message);
                                cl.looptrack = MSG_ReadByte(&cl_message);
+#ifdef CONFIG_CD
                                if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) )
                                        CDAudio_Play ((unsigned char)cls.forcetrack, true);
                                else
                                        CDAudio_Play ((unsigned char)cl.cdtrack, true);
+#endif
                                break;
 
                        case svc_intermission:
index d64a5f6..9b1513b 100644 (file)
@@ -7,8 +7,10 @@
 #include "cl_collision.h"
 #include "libcurl.h"
 #include "csprogs.h"
+#ifdef CONFIG_CAPTURE_VIDEO
 #include "cap_avi.h"
 #include "cap_ogg.h"
+#endif
 
 // we have to include snd_main.h here only to get access to snd_renderbuffer->format.speed when writing the AVI headers
 #include "snd_main.h"
@@ -27,7 +29,9 @@ cvar_t scr_conscroll2_x = {CVAR_SAVE, "scr_conscroll2_x", "0", "scroll speed of
 cvar_t scr_conscroll2_y = {CVAR_SAVE, "scr_conscroll2_y", "0", "scroll speed of gfx/conback2 in y direction"};
 cvar_t scr_conscroll3_x = {CVAR_SAVE, "scr_conscroll3_x", "0", "scroll speed of gfx/conback3 in x direction"};
 cvar_t scr_conscroll3_y = {CVAR_SAVE, "scr_conscroll3_y", "0", "scroll speed of gfx/conback3 in y direction"};
+#ifdef CONFIG_MENU
 cvar_t scr_menuforcewhiledisconnected = {0, "scr_menuforcewhiledisconnected", "0", "forces menu while disconnected"};
+#endif
 cvar_t scr_centertime = {0, "scr_centertime","2", "how long centerprint messages show"};
 cvar_t scr_showram = {CVAR_SAVE, "showram","1", "show ram icon if low on surface cache memory (not used)"};
 cvar_t scr_showturtle = {CVAR_SAVE, "showturtle","0", "show turtle icon when framerate is too low"};
@@ -56,6 +60,7 @@ cvar_t scr_screenshot_hwgamma = {CVAR_SAVE, "scr_screenshot_hwgamma","1", "apply
 cvar_t scr_screenshot_alpha = {0, "scr_screenshot_alpha","0", "try to write an alpha channel to screenshots (debugging feature)"};
 cvar_t scr_screenshot_timestamp = {CVAR_SAVE, "scr_screenshot_timestamp", "1", "use a timestamp based number of the type YYYYMMDDHHMMSSsss instead of sequential numbering"};
 // scr_screenshot_name is defined in fs.c
+#ifdef CONFIG_CAPTURE_VIDEO
 cvar_t cl_capturevideo = {0, "cl_capturevideo", "0", "enables saving of video to a .avi file using uncompressed I420 colorspace and PCM audio, note that scr_screenshot_gammaboost affects the brightness of the output)"};
 cvar_t cl_capturevideo_demo_stop = {CVAR_SAVE, "cl_capturevideo_demo_stop", "1", "automatically stops video recording when demo ends"};
 cvar_t cl_capturevideo_printfps = {CVAR_SAVE, "cl_capturevideo_printfps", "1", "prints the frames per second captured in capturevideo (is only written to the log file, not to the console, as that would be visible on the video)"};
@@ -67,6 +72,7 @@ cvar_t cl_capturevideo_nameformat = {CVAR_SAVE, "cl_capturevideo_nameformat", "d
 cvar_t cl_capturevideo_number = {CVAR_SAVE, "cl_capturevideo_number", "1", "number to append to video filename, incremented each time a capture begins"};
 cvar_t cl_capturevideo_ogg = {CVAR_SAVE, "cl_capturevideo_ogg", "1", "save captured video data as Ogg/Vorbis/Theora streams"};
 cvar_t cl_capturevideo_framestep = {CVAR_SAVE, "cl_capturevideo_framestep", "1", "when set to n >= 1, render n frames to capture one (useful for motion blur like effects)"};
+#endif
 cvar_t r_letterbox = {0, "r_letterbox", "0", "reduces vertical height of view to simulate a letterboxed movie effect (can be used by mods for cutscenes)"};
 cvar_t r_stereo_separation = {0, "r_stereo_separation", "4", "separation distance of eyes in the world (negative values are only useful for cross-eyed viewing)"};
 cvar_t r_stereo_sidebyside = {0, "r_stereo_sidebyside", "0", "side by side views for those who can't afford glasses but can afford eye strain (note: use a negative r_stereo_separation if you want cross-eyed viewing)"};
@@ -692,6 +698,7 @@ static void SCR_SetUpToDrawConsole (void)
 
        Con_CheckResize ();
 
+#ifdef CONFIG_MENU
        if (scr_menuforcewhiledisconnected.integer && key_dest == key_game && cls.state == ca_disconnected)
        {
                if (framecounter >= 2)
@@ -700,6 +707,7 @@ static void SCR_SetUpToDrawConsole (void)
                        framecounter++;
        }
        else
+#endif
                framecounter = 0;
 
        if (scr_conforcewhiledisconnected.integer && key_dest == key_game && cls.signon != SIGNONS)
@@ -1296,10 +1304,14 @@ static void SCR_SizeDown_f (void)
        Cvar_SetValue ("viewsize",scr_viewsize.value-10);
 }
 
+#ifdef CONFIG_CAPTURE_VIDEO
 void SCR_CaptureVideo_EndVideo(void);
+#endif
 void CL_Screen_Shutdown(void)
 {
+#ifdef CONFIG_CAPTURE_VIDEO
        SCR_CaptureVideo_EndVideo();
+#endif
 }
 
 void CL_Screen_Init(void)
@@ -1319,7 +1331,9 @@ void CL_Screen_Init(void)
        Cvar_RegisterVariable (&scr_conscroll3_y);
        Cvar_RegisterVariable (&scr_conbrightness);
        Cvar_RegisterVariable (&scr_conforcewhiledisconnected);
+#ifdef CONFIG_MENU
        Cvar_RegisterVariable (&scr_menuforcewhiledisconnected);
+#endif
        Cvar_RegisterVariable (&scr_loadingscreen_background);
        Cvar_RegisterVariable (&scr_loadingscreen_scale);
        Cvar_RegisterVariable (&scr_loadingscreen_scale_base);
@@ -1348,6 +1362,7 @@ void CL_Screen_Init(void)
        Cvar_RegisterVariable (&scr_screenshot_name_in_mapdir);
        Cvar_RegisterVariable (&scr_screenshot_alpha);
        Cvar_RegisterVariable (&scr_screenshot_timestamp);
+#ifdef CONFIG_CAPTURE_VIDEO
        Cvar_RegisterVariable (&cl_capturevideo);
        Cvar_RegisterVariable (&cl_capturevideo_demo_stop);
        Cvar_RegisterVariable (&cl_capturevideo_printfps);
@@ -1359,6 +1374,7 @@ void CL_Screen_Init(void)
        Cvar_RegisterVariable (&cl_capturevideo_number);
        Cvar_RegisterVariable (&cl_capturevideo_ogg);
        Cvar_RegisterVariable (&cl_capturevideo_framestep);
+#endif
        Cvar_RegisterVariable (&r_letterbox);
        Cvar_RegisterVariable(&r_stereo_separation);
        Cvar_RegisterVariable(&r_stereo_sidebyside);
@@ -1395,7 +1411,9 @@ void CL_Screen_Init(void)
        Cmd_AddCommand ("envmap", R_Envmap_f, "render a cubemap (skybox) of the current scene");
        Cmd_AddCommand ("infobar", SCR_InfoBar_f, "display a text in the infobar (usage: infobar expiretime string)");
 
+#ifdef CONFIG_CAPTURE_VIDEO
        SCR_CaptureVideo_Ogg_Init();
+#endif
 
        scr_initialized = true;
 }
@@ -1523,6 +1541,7 @@ void SCR_ScreenShot_f (void)
        Mem_Free (buffer2);
 }
 
+#ifdef CONFIG_CAPTURE_VIDEO
 static void SCR_CaptureVideo_BeginVideo(void)
 {
        double r, g, b;
@@ -1799,6 +1818,7 @@ static void SCR_CaptureVideo(void)
        else if (cls.capturevideo.active)
                SCR_CaptureVideo_EndVideo();
 }
+#endif
 
 /*
 ===============
@@ -2232,7 +2252,9 @@ static void SCR_DrawScreen (void)
                SCR_CheckDrawCenterString();
        }
        SCR_DrawNetGraph ();
+#ifdef CONFIG_MENU
        MR_Draw();
+#endif
        CL_DrawVideo();
        R_Shadow_EditLights_DrawSelectedLightProperties();
 
@@ -2911,7 +2933,9 @@ void CL_UpdateScreen(void)
                SCR_DrawScreen();
        }
 
+#ifdef CONFIG_CAPTURE_VIDEO
        SCR_CaptureVideo();
+#endif
 
        if (qglFlush)
                qglFlush(); // FIXME: should we really be using qglFlush here?
index 755925c..8f69fb0 100644 (file)
@@ -4470,7 +4470,11 @@ void GL_Init (void)
        VID_CheckExtensions();
 
        // LordHavoc: report supported extensions
+#ifdef CONFIG_MENU
        Con_DPrintf("\nQuakeC extensions for server and client: %s\nQuakeC extensions for menu: %s\n", vm_sv_extensions, vm_m_extensions );
+#else
+       Con_DPrintf("\nQuakeC extensions for server and client: %s\n", vm_sv_extensions );
+#endif
 
        // clear to black (loading plaque will be seen over this)
        GL_Clear(GL_COLOR_BUFFER_BIT, NULL, 1.0f, 128);
diff --git a/host.c b/host.c
index 0b97a45..a54067a 100644 (file)
--- a/host.c
+++ b/host.c
@@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <time.h>
 #include "libcurl.h"
+#ifdef CONFIG_CD
 #include "cdaudio.h"
+#endif
 #include "cl_video.h"
 #include "progsvm.h"
 #include "csprogs.h"
@@ -150,7 +152,9 @@ void Host_Error (const char *error, ...)
        // print out where the crash happened, if it was caused by QC (and do a cleanup)
        PRVM_Crash(SVVM_prog);
        PRVM_Crash(CLVM_prog);
+#ifdef CONFIG_MENU
        PRVM_Crash(MVM_prog);
+#endif
 
        cl.csqc_loaded = false;
        Cvar_SetValueQuick(&csqc_progcrc, -1);
@@ -336,8 +340,10 @@ void Host_LoadConfig_f(void)
 {
        // reset all cvars, commands and aliases to init values
        Cmd_RestoreInitState();
+#ifdef CONFIG_MENU
        // prepend a menu restart command to execute after the config
        Cbuf_InsertText("\nmenu_restart\n");
+#endif
        // reset cvars to their defaults, and then exec startup scripts again
        Host_AddConfigText();
 }
@@ -1024,8 +1030,10 @@ void Host_Main(void)
                        else
                                S_Update(&r_refdef.view.matrix);
 
+#ifdef CONFIG_CD
                        CDAudio_Update();
                        R_TimeReport("audio");
+#endif
 
                        // reset gathering of mouse input
                        in_mouse_x = in_mouse_y = 0;
@@ -1073,7 +1081,9 @@ void Host_StartVideo(void)
                // make sure we open sockets before opening video because the Windows Firewall "unblock?" dialog can screw up the graphics context on some graphics drivers
                NetConn_UpdateSockets();
                VID_Start();
+#ifdef CONFIG_CD
                CDAudio_Startup();
+#endif
        }
 }
 
@@ -1269,12 +1279,16 @@ static void Host_Init (void)
 
                R_Modules_Init();
                Palette_Init();
+#ifdef CONFIG_MENU
                MR_Init_Commands();
+#endif
                VID_Shared_Init();
                VID_Init();
                Render_Init();
                S_Init();
+#ifdef CONFIG_CD
                CDAudio_Init();
+#endif
                Key_Init();
                CL_Init();
        }
@@ -1304,10 +1318,12 @@ static void Host_Init (void)
        // put up the loading image so the user doesn't stare at a black screen...
        SCR_BeginLoadingPlaque(true);
 
+#ifdef CONFIG_MENU
        if (cls.state != ca_dedicated)
        {
                MR_Init();
        }
+#endif
 
        // check for special benchmark mode
 // COMMANDLINEOPTION: Client: -benchmark <demoname> runs a timedemo and quits, results of any timedemo can be found in gamedir/benchmark.log (for example id1/benchmark.log)
@@ -1347,7 +1363,9 @@ static void Host_Init (void)
 
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
        {
+#ifdef CONFIG_MENU
                Cbuf_AddText("togglemenu 1\n");
+#endif
                Cbuf_Execute();
        }
 
@@ -1399,9 +1417,11 @@ void Host_Shutdown(void)
        Host_ShutdownServer ();
        SV_UnlockThreadMutex();
 
+#ifdef CONFIG_MENU
        // Shutdown menu
        if(MR_Shutdown)
                MR_Shutdown();
+#endif
 
        // AK shutdown PRVM
        // AK hmm, no PRVM_Shutdown(); yet
@@ -1410,7 +1430,9 @@ void Host_Shutdown(void)
 
        Host_SaveConfig();
 
+#ifdef CONFIG_CD
        CDAudio_Shutdown ();
+#endif
        S_Terminate ();
        Curl_Shutdown ();
        NetConn_Shutdown ();
index 5e8daba..d14fc90 100644 (file)
@@ -379,9 +379,11 @@ static void Host_Map_f (void)
                svs.clients = (client_t *)Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
        }
 
+#ifdef CONFIG_MENU
        // remove menu
        if (key_dest == key_menu || key_dest == key_menu_grabbed)
                MR_ToggleMenu(0);
+#endif
        key_dest = key_game;
 
        svs.serverflags = 0;                    // haven't completed an episode yet
@@ -414,9 +416,11 @@ static void Host_Changelevel_f (void)
                return;
        }
 
+#ifdef CONFIG_MENU
        // remove menu
        if (key_dest == key_menu || key_dest == key_menu_grabbed)
                MR_ToggleMenu(0);
+#endif
        key_dest = key_game;
 
        SV_SaveSpawnparms ();
@@ -449,9 +453,11 @@ static void Host_Restart_f (void)
                return;
        }
 
+#ifdef CONFIG_MENU
        // remove menu
        if (key_dest == key_menu || key_dest == key_menu_grabbed)
                MR_ToggleMenu(0);
+#endif
        key_dest = key_game;
 
        allowcheats = sv_cheats.integer != 0;
@@ -792,9 +798,11 @@ static void Host_Loadgame_f (void)
        if (cls.demoplayback)
                CL_Disconnect ();
 
+#ifdef CONFIG_MENU
        // remove menu
        if (key_dest == key_menu || key_dest == key_menu_grabbed)
                MR_ToggleMenu(0);
+#endif
        key_dest = key_game;
 
        cls.demonum = -1;               // stop demo loop in case this fails
diff --git a/keys.c b/keys.c
index 30bb4f9..ff8d578 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1848,7 +1848,9 @@ Key_Event (int key, int ascii, qboolean down)
                                        if(key_consoleactive & KEY_CONSOLEACTIVE_FORCED)
                                        {
                                                key_consoleactive &= ~KEY_CONSOLEACTIVE_USER;
+#ifdef CONFIG_MENU
                                                MR_ToggleMenu(1);
+#endif
                                        }
                                        else
                                                Con_ToggleConsole_f();
@@ -1862,14 +1864,18 @@ Key_Event (int key, int ascii, qboolean down)
 
                        case key_menu:
                        case key_menu_grabbed:
+#ifdef CONFIG_MENU
                                MR_KeyEvent (key, ascii, down);
+#endif
                                break;
 
                        case key_game:
                                // csqc has priority over toggle menu if it wants to (e.g. handling escape for UI stuff in-game.. :sick:)
                                q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);
+#ifdef CONFIG_MENU
                                if (!q && down)
                                        MR_ToggleMenu(1);
+#endif
                                break;
 
                        default:
@@ -1937,7 +1943,12 @@ Key_Event (int key, int ascii, qboolean down)
        if (cl_videoplaying)
        {
                if (gamemode == GAME_BLOODOMNICIDE) // menu controls key events
+#ifdef CONFIG_MENU
                        MR_KeyEvent(key, ascii, down);
+#else
+                       {
+                       }
+#endif
                else
                        CL_Video_KeyEvent (key, ascii, keydown[key] != 0);
                return;
@@ -1952,7 +1963,9 @@ Key_Event (int key, int ascii, qboolean down)
                        break;
                case key_menu:
                case key_menu_grabbed:
+#ifdef CONFIG_MENU
                        MR_KeyEvent (key, ascii, down);
+#endif
                        break;
                case key_game:
                        q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);
index cdf4c64..9ff2fba 100644 (file)
--- a/makefile
+++ b/makefile
@@ -32,12 +32,18 @@ ifneq ($(DP_MAKE_TARGET), mingw)
        DP_MACHINE:=$(shell uname -m)
 endif
 
+# Makefile name
+MAKEFILE=makefile
 
-# Command used to delete files
+# Commands
 ifdef windir
        CMD_RM=del
+       CMD_CP=copy /y
+       CMD_MKDIR=mkdir
 else
        CMD_RM=$(CMD_UNIXRM)
+       CMD_CP=$(CMD_UNIXCP)
+       CMD_MKDIR=$(CMD_UNIXMKDIR)
 endif
 
 # 64bits AMD CPUs use another lib directory
@@ -54,6 +60,29 @@ TARGETS_RELEASE=sv-release cl-release sdl-release
 TARGETS_RELEASE_PROFILE=sv-release-profile cl-release-profile sdl-release-profile
 TARGETS_NEXUIZ=sv-nexuiz cl-nexuiz sdl-nexuiz
 
+###### Optional features #####
+DP_CDDA?=enabled
+ifeq ($(DP_CDDA), enabled)
+       OBJ_SDLCD=$(OBJ_CD_COMMON) cd_sdl.o
+       OBJ_LINUXCD=$(OBJ_CD_COMMON) cd_linux.o
+       OBJ_BSDCD=$(OBJ_CD_COMMON) cd_bsd.o
+       OBJ_WINCD=$(OBJ_CD_COMMON) cd_win.o
+else
+       OBJ_SDLCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
+       OBJ_LINUXCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
+       OBJ_BSDCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
+       OBJ_WINCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
+endif
+
+DP_VIDEO_CAPTURE?=enabled
+ifeq ($(DP_VIDEO_CAPTURE), enabled)
+       CFLAGS_VIDEO_CAPTURE=-DCONFIG_VIDEO_CAPTURE
+       OBJ_VIDEO_CAPTURE= cap_avi.o cap_ogg.o
+else
+       CFLAGS_VIDEO_CAPTURE=
+       OBJ_VIDEO_CAPTURE=
+endif
+
 # Linux configuration
 ifeq ($(DP_MAKE_TARGET), linux)
        DEFAULT_SNDAPI=ALSA
@@ -81,6 +110,7 @@ ifeq ($(DP_MAKE_TARGET), linux)
        DP_LINK_ZLIB?=shared
        DP_LINK_JPEG?=shared
        DP_LINK_ODE?=dlopen
+       DP_LINK_CRYPTO?=dlopen
 endif
 
 # Mac OS X configuration
@@ -114,6 +144,7 @@ ifeq ($(DP_MAKE_TARGET), macosx)
        DP_LINK_ZLIB?=shared
        DP_LINK_JPEG?=shared
        DP_LINK_ODE?=dlopen
+       DP_LINK_CRYPTO?=dlopen
 
        # on OS X, we don't build the CL by default because it uses deprecated
        # and not-implemented-in-64bit Carbon
@@ -153,6 +184,7 @@ ifeq ($(DP_MAKE_TARGET), sunos)
        DP_LINK_ZLIB?=shared
        DP_LINK_JPEG?=shared
        DP_LINK_ODE?=dlopen
+       DP_LINK_CRYPTO?=dlopen
 endif
 
 # BSD configuration
@@ -186,6 +218,7 @@ endif
        DP_LINK_ZLIB?=shared
        DP_LINK_JPEG?=shared
        DP_LINK_ODE?=dlopen
+       DP_LINK_CRYPTO?=dlopen
 endif
 
 # Win32 configuration
@@ -243,6 +276,7 @@ ifeq ($(DP_MAKE_TARGET), mingw)
        DP_LINK_ZLIB?=dlopen
        DP_LINK_JPEG?=shared
        DP_LINK_ODE?=dlopen
+       DP_LINK_CRYPTO?=dlopen
 endif
 
 # set these to "" if you want to use dynamic loading instead
@@ -278,15 +312,18 @@ ifeq ($(DP_LINK_ODE), dlopen)
 endif
 
 # d0_blind_id
-# most distros do not have d0_blind_id package, dlopen will used by default
-# LIB_CRYPTO=-ld0_blind_id
-# CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
-# LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
-# CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
-LIB_CRYPTO=
-CFLAGS_CRYPTO=
-LIB_CRYPTO_RIJNDAEL=
-CFLAGS_CRYPTO_RIJNDAEL=
+ifeq ($(DP_LINK_CRYPTO), shared)
+       LIB_CRYPTO=-ld0_blind_id
+       CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
+       LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
+       CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
+endif
+ifeq ($(DP_LINK_CRYPTO), dlopen)
+       LIB_CRYPTO=
+       CFLAGS_CRYPTO=
+       LIB_CRYPTO_RIJNDAEL=
+       CFLAGS_CRYPTO_RIJNDAEL=
+endif
 
 ##### Sound configuration #####
 
@@ -358,7 +395,7 @@ endif
 
 ##### GNU Make specific definitions #####
 
-DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
+DO_LD=$(CC) -o ../../../$@ $^ $(LDFLAGS)
 
 
 ##### Definitions shared by all makefiles #####
index 31ce183..80ab84b 100644 (file)
@@ -71,6 +71,7 @@ OBJ_SND_3DRAS=snd_3dras.o
 LIB_SND_3DRAS=
 
 # CD objects
+OBJ_CD_COMMON=cd_shared.o
 OBJ_NOCD=cd_null.o
 
 
@@ -79,9 +80,6 @@ OBJ_NOCD=cd_null.o
 # Common objects
 OBJ_COMMON= \
        bih.o \
-       cap_avi.o \
-       cap_ogg.o \
-       cd_shared.o \
        crypto.o \
        cl_collision.o \
        cl_demo.o \
@@ -124,7 +122,6 @@ OBJ_COMMON= \
        mathlib.o \
        matrixlib.o \
        mdfour.o \
-       menu.o \
        meshqueue.o \
        mod_skeletal_animatevertices_sse.o \
        mod_skeletal_animatevertices_generic.o \
@@ -132,7 +129,6 @@ OBJ_COMMON= \
        model_brush.o \
        model_shared.o \
        model_sprite.o \
-       mvm_cmds.o \
        netconn.o \
        palette.o \
        polygon.o \
@@ -163,15 +159,21 @@ OBJ_COMMON= \
        world.o \
        zone.o
 
+OBJ_MENU= \
+       menu.o \
+       mvm_cmds.o
+
 # note that builddate.c is very intentionally not compiled to a .o before
 # being linked, because it should be recompiled every time an executable is
 # built to give the executable a proper date string
-OBJ_SV= builddate.c sys_linux.o vid_null.o thread_null.o $(OBJ_SND_NULL) $(OBJ_NOCD) $(OBJ_COMMON)
-OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $(OBJ_COMMON)
+OBJ_SV= builddate.c sys_linux.o vid_null.o thread_null.o $(OBJ_SND_NULL) $(OBJ_COMMON)
+OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_MENU) $(OBJ_SND_COMMON) snd_sdl.o $(OBJ_SDLCD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
 
 
 # Compilation
-CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
+CFLAGS_CLIENT=-DCONFIG_MENU -DCONFIG_CD $(CFLAGS_VIDEO_CAPTURE)
+CFLAGS_SERVER=
 CFLAGS_DEBUG=-ggdb
 CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
 CFLAGS_RELEASE=
@@ -200,7 +202,7 @@ LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`{ test -d .svn && svnversion; }
 
 ##### UNIX specific variables #####
 
-OBJ_GLX= builddate.c sys_linux.o vid_glx.o thread_pthread.o keysym2ucs.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
+OBJ_GLX= builddate.c sys_linux.o vid_glx.o thread_pthread.o keysym2ucs.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
 
 LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL)
 LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm -pthread $(LIB_SOUND)
@@ -218,15 +220,12 @@ EXE_UNIXSVNEXUIZ=nexuiz-dedicated
 EXE_UNIXSDLNEXUIZ=nexuiz-sdl
 
 CMD_UNIXRM=rm -rf
+CMD_UNIXCP=cp -f
+CMD_UNIXMKDIR=mkdir -p
 
 
 ##### Linux specific variables #####
 
-# If you want CD sound in Linux
-OBJ_LINUXCD=cd_linux.o
-# If you want no CD audio
-#OBJ_LINUXCD=$(OBJ_NOCD)
-
 # Link
 LDFLAGS_LINUXCL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl $(LDFLAGS_UNIXCL)
 LDFLAGS_LINUXSV=$(LDFLAGS_UNIXCOMMON) -lrt -ldl
@@ -241,9 +240,9 @@ OBJ_MACOSXCD=$(OBJ_NOCD)
 # Link
 LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit -framework Carbon $(LIB_SOUND)
 LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
-LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit $(SDLCONFIG_STATICLIBS) SDLMain.m
+LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl -framework IOKit $(SDLCONFIG_STATICLIBS) ../../../SDLMain.m
 
-OBJ_AGL= builddate.c sys_linux.o vid_agl.o thread_null.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
+OBJ_AGL= builddate.c sys_linux.o vid_agl.o thread_null.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
 
 EXE_MACOSXCL=darkplaces-agl
 EXE_MACOSXCLNEXUIZ=nexuiz-agl
@@ -264,11 +263,6 @@ LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -lrt -ldl -lsocket -lnsl $(LDFLAGS_UNIXSD
 
 ##### BSD specific variables #####
 
-#if you want CD sound in BSD
-OBJ_BSDCD=cd_bsd.o
-#if you want no CD audio
-#OBJ_BSDCD=$(OBJ_NOCD)
-
 # Link
 LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL)
 LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) 
@@ -278,12 +272,8 @@ LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL)
 ##### Win32 specific variables #####
 
 WINDRES ?= windres
-#if you want CD sound in Win32
-OBJ_WINCD=cd_win.o
-#if you want no CD audio
-#OBJ_WINCD=$(OBJ_NOCD)
 
-OBJ_WGL= builddate.c sys_win.o vid_wgl.o thread_null.o $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_COMMON)
+OBJ_WGL= builddate.c sys_win.o vid_wgl.o thread_null.o $(OBJ_MENU) $(OBJ_SND_WIN) $(OBJ_WINCD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
 
 # Link
 # see LDFLAGS_WINCOMMON in makefile
@@ -297,6 +287,7 @@ EXE_WINCLNEXUIZ=nexuiz.exe
 EXE_WINSVNEXUIZ=nexuiz-dedicated.exe
 EXE_WINSDLNEXUIZ=nexuiz-sdl.exe
 
+VPATH := ../../../
 
 ##### Commands #####
 
@@ -359,116 +350,123 @@ nexuiz :
 cl-debug :
        $(MAKE) bin-debug \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
+               EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
 
 cl-profile :
        $(MAKE) bin-profile \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
+               EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
 
 cl-release :
        $(MAKE) bin-release \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
+               EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
 
 cl-release-profile :
        $(MAKE) bin-release-profile \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_CL)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
+               EXE='$(EXE_CL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
 
 cl-nexuiz :
        $(MAKE) bin-release \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_CLNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_CL)" LEVEL=1
+               EXE='$(EXE_CLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_CL)' LEVEL=1
 
 sv-debug :
        $(MAKE) bin-debug \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
+               EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
 
 sv-profile :
        $(MAKE) bin-profile \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
+               EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
 
 sv-release :
        $(MAKE) bin-release \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
+               EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
 
 sv-release-profile :
        $(MAKE) bin-release-profile \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SV)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
+               EXE='$(EXE_SV)' CFLAGS_FEATURES='$(CFLAGS_SERVER)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
 
 sv-nexuiz :
        $(MAKE) bin-release \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SVNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_SV)" LEVEL=1
+               EXE='$(EXE_SVNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SV)' LEVEL=1
 
 sdl-debug :
        $(MAKE) bin-debug \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
+               EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
 
 sdl-profile :
        $(MAKE) bin-profile \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
+               EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
 
 sdl-release :
        $(MAKE) bin-release \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
+               EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
 
 sdl-release-profile :
        $(MAKE) bin-release-profile \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SDL)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
+               EXE='$(EXE_SDL)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
 
 sdl-nexuiz :
        $(MAKE) bin-release \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               EXE="$(EXE_SDLNEXUIZ)" LDFLAGS_COMMON="$(LDFLAGS_SDL)" LEVEL=1
+               EXE='$(EXE_SDLNEXUIZ)' CFLAGS_FEATURES='$(CFLAGS_CLIENT)' LDFLAGS_COMMON='$(LDFLAGS_SDL)' LEVEL=1
 
 bin-debug :
        $(CHECKLEVEL1)
        @echo
-       @echo "========== $(EXE) (debug) =========="
-       $(MAKE) $(EXE) \
+       @echo '========== $(EXE) (debug) =========='
+       $(MAKE) prepare BUILD_DIR=obj/debug/$(EXE)
+       $(MAKE) -C obj/debug/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
-               LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)" LEVEL=2
+               CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)'\
+               LDFLAGS='$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)' LEVEL=2
 
 bin-profile :
        $(CHECKLEVEL1)
        @echo
-       @echo "========== $(EXE) (profile) =========="
-       $(MAKE) $(EXE) \
+       @echo '========== $(EXE) (profile) =========='
+       $(MAKE) prepare BUILD_DIR=obj/profile/$(EXE)
+       $(MAKE) -C obj/profile/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
-               LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)" LEVEL=2
+               CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)'\
+               LDFLAGS='$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)' LEVEL=2
 
 bin-release :
        $(CHECKLEVEL1)
        @echo
-       @echo "========== $(EXE) (release) =========="
-       $(MAKE) $(EXE) \
+       @echo '========== $(EXE) (release) =========='
+       $(MAKE) prepare BUILD_DIR=obj/release/$(EXE)
+       $(MAKE) -C obj/release/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
-               LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
+               CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)'\
+               LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2
        $(STRIP) $(EXE)
 
 bin-release-profile :
        $(CHECKLEVEL1)
        @echo
-       @echo "========== $(EXE) (release) =========="
-       $(MAKE) $(EXE) \
+       @echo '========== $(EXE) (release) =========='
+       $(MAKE) prepare BUILD_DIR=obj/release-profile/$(EXE)
+       $(MAKE) -C obj/release-profile/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
                DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
-               CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)"\
-               LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
+               CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)'\
+               LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2
        $(STRIP) $(EXE)
 
+prepare :
+       $(CMD_MKDIR) $(BUILD_DIR)
+       $(CMD_CP) makefile.inc $(BUILD_DIR)/
 
 #this checks USEODE when compiling so it needs the ODE flags as well
 prvm_cmds.o: prvm_cmds.c
@@ -568,6 +566,7 @@ clean:
        -$(CMD_RM) $(EXE_SDLNEXUIZ)
        -$(CMD_RM) *.o
        -$(CMD_RM) *.d
+       -$(CMD_RM) obj/
 
 clean-profile: clean
        -$(CMD_RM) *.gcda
diff --git a/menu.c b/menu.c
index 184ae36..34a8de7 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 */
 #include "quakedef.h"
+#ifdef CONFIG_CD
 #include "cdaudio.h"
+#endif
 #include "image.h"
 #include "progsvm.h"
 
@@ -1699,7 +1701,9 @@ static void M_Options_Draw (void)
        M_Options_PrintSlider(  "            Brightness", true, v_contrast.value, 1, 2);
        M_Options_PrintSlider(  "                 Gamma", true, v_gamma.value, 0.5, 3);
        M_Options_PrintSlider(  "          Sound Volume", snd_initialized.integer, volume.value, 0, 1);
+#ifdef CONFIG_CD
        M_Options_PrintSlider(  "          Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1);
+#endif
        M_Options_PrintCommand( "     Customize Effects", true);
        M_Options_PrintCommand( "       Effects:  Quake", true);
        M_Options_PrintCommand( "       Effects: Normal", true);
index abc3501..00adb61 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1460,7 +1460,9 @@ static void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_
 {
        crypto_t *crypto;
        cls.connect_trying = false;
+#ifdef CONFIG_MENU
        M_Update_Return_Reason("");
+#endif
        // the connection request succeeded, stop current connection and set up a new connection
        CL_Disconnect();
        // if we're connecting to a remote server, shut down any local server
@@ -1487,7 +1489,9 @@ static void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_
        }
        Con_Printf("Connection accepted to %s\n", cls.netcon->address);
        key_dest = key_game;
+#ifdef CONFIG_MENU
        m_state = m_none;
+#endif
        cls.demonum = -1;                       // not in the demo loop now
        cls.state = ca_connected;
        cls.signon = 0;                         // need all the signon messages before playing
@@ -1845,7 +1849,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                        char protocolnames[1400];
                        Protocol_Names(protocolnames, sizeof(protocolnames));
                        Con_DPrintf("\"%s\" received, sending connect request back to %s\n", string, addressstring2);
+#ifdef CONFIG_MENU
                        M_Update_Return_Reason("Got challenge response");
+#endif
                        // update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
                        InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), "*ip", addressstring2);
                        // TODO: add userinfo stuff here instead of using NQ commands?
@@ -1855,7 +1861,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                if (length == 6 && !memcmp(string, "accept", 6) && cls.connect_trying)
                {
                        // darkplaces or quake3
+#ifdef CONFIG_MENU
                        M_Update_Return_Reason("Accepted");
+#endif
                        NetConn_ConnectionEstablished(mysocket, peeraddress, PROTOCOL_DARKPLACES3);
                        return true;
                }
@@ -1867,7 +1875,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                        length = min(length - 7, (int)sizeof(rejectreason) - 1);
                        memcpy(rejectreason, string, length);
                        rejectreason[length] = 0;
+#ifdef CONFIG_MENU
                        M_Update_Return_Reason(rejectreason);
+#endif
                        return true;
                }
                if (length >= 15 && !memcmp(string, "statusResponse\x0A", 15))
@@ -2029,7 +2039,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                {
                        // challenge message
                        Con_Printf("challenge %s received, sending QuakeWorld connect request back to %s\n", string + 1, addressstring2);
+#ifdef CONFIG_MENU
                        M_Update_Return_Reason("Got QuakeWorld challenge response");
+#endif
                        cls.qw_qport = qport.integer;
                        // update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
                        InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), "*ip", addressstring2);
@@ -2039,7 +2051,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                if (length >= 1 && string[0] == 'j' && cls.connect_trying)
                {
                        // accept message
+#ifdef CONFIG_MENU
                        M_Update_Return_Reason("QuakeWorld Accepted");
+#endif
                        NetConn_ConnectionEstablished(mysocket, peeraddress, PROTOCOL_QUAKEWORLD);
                        return true;
                }
@@ -2146,7 +2160,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                                        Con_Printf("Connected to ProQuake %.1f server, enabling precise aim\n", cls.proquake_serverversion / 10.0f);
                                // update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
                                InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), "*ip", addressstring2);
+#ifdef CONFIG_MENU
                                M_Update_Return_Reason("Accepted");
+#endif
                                NetConn_ConnectionEstablished(mysocket, &clientportaddress, PROTOCOL_QUAKE);
                        }
                        break;
@@ -2154,7 +2170,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                        if (developer_extra.integer)
                                Con_DPrintf("Datagram_ParseConnectionless: received CCREP_REJECT from %s.\n", addressstring2);
                        cls.connect_trying = false;
+#ifdef CONFIG_MENU
                        M_Update_Return_Reason((char *)MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)));
+#endif
                        break;
                case CCREP_SERVER_INFO:
                        if (developer_extra.integer)
@@ -2306,14 +2324,18 @@ void NetConn_ClientFrame(void)
        NetConn_UpdateSockets();
        if (cls.connect_trying && cls.connect_nextsendtime < realtime)
        {
+#ifdef CONFIG_MENU
                if (cls.connect_remainingtries == 0)
                        M_Update_Return_Reason("Connect: Waiting 10 seconds for reply");
+#endif
                cls.connect_nextsendtime = realtime + 1;
                cls.connect_remainingtries--;
                if (cls.connect_remainingtries <= -10)
                {
                        cls.connect_trying = false;
+#ifdef CONFIG_MENU
                        M_Update_Return_Reason("Connect: Failed");
+#endif
                        return;
                }
                // try challenge first (newer DP server or QW)
@@ -3575,12 +3597,16 @@ void NetConn_QueryMasters(qboolean querydp, qboolean queryqw)
                                {
                                        if (sv_qwmasters[masternum].string && LHNETADDRESS_FromString(&masteraddress, sv_qwmasters[masternum].string, QWMASTER_PORT) && LHNETADDRESS_GetAddressType(&masteraddress) == LHNETADDRESS_GetAddressType(LHNET_AddressFromSocket(cl_sockets[i])))
                                        {
+#ifdef CONFIG_MENU
                                                if (m_state != m_slist)
                                                {
+#endif
                                                        char lookupstring[128];
                                                        LHNETADDRESS_ToString(&masteraddress, lookupstring, sizeof(lookupstring), true);
                                                        Con_Printf("Querying master %s (resolved from %s)\n", lookupstring, sv_qwmasters[masternum].string);
+#ifdef CONFIG_MENU
                                                }
+#endif
                                                masterquerycount++;
                                                NetConn_Write(cl_sockets[i], request, (int)strlen(request) + 1, &masteraddress);
                                        }
@@ -3604,7 +3630,9 @@ void NetConn_QueryMasters(qboolean querydp, qboolean queryqw)
        if (!masterquerycount)
        {
                Con_Print("Unable to query master servers, no suitable network sockets active.\n");
+#ifdef CONFIG_MENU
                M_Update_Return_Reason("No network");
+#endif
        }
 }
 
@@ -3674,12 +3702,16 @@ void Net_Stats_f(void)
 
 void Net_Refresh_f(void)
 {
+#ifdef CONFIG_MENU
        if (m_state != m_slist) {
+#endif
                Con_Print("Sending new requests to master servers\n");
                ServerList_QueryList(false, true, false, true);
                Con_Print("Listening for replies...\n");
+#ifdef CONFIG_MENU
        } else
                ServerList_QueryList(false, true, false, false);
+#endif
 }
 
 void Net_Slist_f(void)
@@ -3687,12 +3719,16 @@ void Net_Slist_f(void)
        ServerList_ResetMasks();
        serverlist_sortbyfield = SLIF_PING;
        serverlist_sortflags = 0;
+#ifdef CONFIG_MENU
     if (m_state != m_slist) {
+#endif
                Con_Print("Sending requests to master servers\n");
                ServerList_QueryList(true, true, false, true);
                Con_Print("Listening for replies...\n");
+#ifdef CONFIG_MENU
        } else
                ServerList_QueryList(true, true, false, false);
+#endif
 }
 
 void Net_SlistQW_f(void)
@@ -3700,13 +3736,17 @@ void Net_SlistQW_f(void)
        ServerList_ResetMasks();
        serverlist_sortbyfield = SLIF_PING;
        serverlist_sortflags = 0;
+#ifdef CONFIG_MENU
     if (m_state != m_slist) {
+#endif
                Con_Print("Sending requests to master servers\n");
                ServerList_QueryList(true, false, true, true);
                serverlist_consoleoutput = true;
                Con_Print("Listening for replies...\n");
+#ifdef CONFIG_MENU
        } else
                ServerList_QueryList(true, false, true, false);
+#endif
 }
 
 void NetConn_Init(void)
index 406a9eb..acaf6df 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -724,7 +724,9 @@ prvm_prog_t *PRVM_FriendlyProgFromString(const char *str); // for console comman
 #define PRVM_ProgLoaded(n) (PRVM_GetProg(n)->loaded)
 #define SVVM_prog (&prvm_prog_list[PRVM_PROG_SERVER])
 #define CLVM_prog (&prvm_prog_list[PRVM_PROG_CLIENT])
+#ifdef CONFIG_MENU
 #define MVM_prog (&prvm_prog_list[PRVM_PROG_MENU])
+#endif
 
 //============================================================================
 // prvm_cmds part
@@ -746,8 +748,10 @@ void SVVM_reset_cmd(prvm_prog_t *prog);
 void CLVM_init_cmd(prvm_prog_t *prog);
 void CLVM_reset_cmd(prvm_prog_t *prog);
 
+#ifdef CONFIG_MENU
 void MVM_init_cmd(prvm_prog_t *prog);
 void MVM_reset_cmd(prvm_prog_t *prog);
+#endif
 
 void VM_Cmd_Init(prvm_prog_t *prog);
 void VM_Cmd_Reset(prvm_prog_t *prog);
@@ -758,11 +762,15 @@ void PRVM_Init (void);
 #ifdef PROFILING
 void SVVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage);
 void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage);
+#ifdef CONFIG_MENU
 void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage);
+#endif
 #else
 #define SVVM_ExecuteProgram PRVM_ExecuteProgram
 #define CLVM_ExecuteProgram PRVM_ExecuteProgram
+#ifdef CONFIG_MENU
 #define MVM_ExecuteProgram PRVM_ExecuteProgram
+#endif
 void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage);
 #endif
 
index 1c9c809..00c9ede 100644 (file)
@@ -2872,7 +2872,9 @@ VM_gettime
 float  gettime(prvm_prog_t *prog)
 =========
 */
+#ifdef CONFIG_CD
 float CDAudio_GetPosition(void);
+#endif
 void VM_gettime(prvm_prog_t *prog)
 {
        int timer_index;
@@ -2900,9 +2902,11 @@ void VM_gettime(prvm_prog_t *prog)
                        case 3: // GETTIME_UPTIME
                                PRVM_G_FLOAT(OFS_RETURN) = realtime;
                                break;
+#ifdef CONFIG_CD
                        case 4: // GETTIME_CDTRACK
                                PRVM_G_FLOAT(OFS_RETURN) = CDAudio_GetPosition();
                                break;
+#endif
                        default:
                                VM_Warning(prog, "VM_gettime: %s: unsupported timer specified, returning realtime\n", prog->name);
                                PRVM_G_FLOAT(OFS_RETURN) = realtime;
index 191197f..cf18789 100644 (file)
@@ -156,8 +156,10 @@ prvm_prog_t *PRVM_ProgFromString(const char *str)
                return SVVM_prog;
        if (!strcmp(str, "client"))
                return CLVM_prog;
+#ifdef CONFIG_MENU
        if (!strcmp(str, "menu"))
                return MVM_prog;
+#endif
        return NULL;
 }
 
index 823c2d3..fee9d82 100644 (file)
@@ -662,6 +662,7 @@ extern cvar_t prvm_statementprofiling;
 extern qboolean prvm_runawaycheck;
 
 #ifdef PROFILING
+#ifdef CONFIG_MENU
 /*
 ====================
 MVM_ExecuteProgram
@@ -766,6 +767,7 @@ cleanup:
        if (prog == SVVM_prog)
                SV_FlushBroadcastMessages();
 }
+#endif
 
 /*
 ====================
index 0edfd69..61ab849 100644 (file)
@@ -396,7 +396,9 @@ extern char engineversion[128];
 #include "input.h"
 #include "keys.h"
 #include "console.h"
+#ifdef CONFIG_MENU
 #include "menu.h"
+#endif
 #include "csprogs.h"
 
 extern qboolean noclip_anglehack;
index 6bda6fd..d79857f 100644 (file)
@@ -25,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "snd_ogg.h"
 #include "csprogs.h"
 #include "cl_collision.h"
+#ifdef CONFIG_CD
 #include "cdaudio.h"
+#endif
 
 
 #define SND_MIN_SPEED 8000
@@ -1818,8 +1820,10 @@ void S_StopAllSounds (void)
        if (snd_renderbuffer == NULL)
                return;
 
+#ifdef CONFIG_CD
        // stop CD audio because it may be using a faketrack
        CDAudio_Stop();
+#endif
 
        if (simsound || SndSys_LockRenderBuffer ())
        {
index 2274f35..2299e3b 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -28,6 +28,7 @@ static portable_sampleframe_t paintbuffer_unswapped[PAINTBUFFER_SIZE];
 
 extern speakerlayout_t snd_speakerlayout; // for querying the listeners
 
+#ifdef CONFIG_CAPTURE_VIDEO
 static void S_CaptureAVISound(const portable_sampleframe_t *paintbuffer, size_t length)
 {
        size_t i;
@@ -46,6 +47,7 @@ static void S_CaptureAVISound(const portable_sampleframe_t *paintbuffer, size_t
 
        SCR_CaptureVideo_SoundFrame(paintbuffer_unswapped, length);
 }
+#endif
 
 extern cvar_t snd_softclip;
 
@@ -520,8 +522,10 @@ void S_MixToBuffer(void *stream, unsigned int bufferframes)
 
                S_SoftClipPaintBuffer(paintbuffer, totalmixframes, snd_renderbuffer->format.width, snd_renderbuffer->format.channels);
 
+#ifdef CONFIG_CAPTURE_VIDEO
                if (!snd_usethreadedmixing)
                        S_CaptureAVISound(paintbuffer, totalmixframes);
+#endif
 
                S_ConvertPaintBuffer(paintbuffer, outbytes, totalmixframes, snd_renderbuffer->format.width, snd_renderbuffer->format.channels);
 
index 719d629..175c751 100644 (file)
@@ -1,6 +1,8 @@
 
 #include "quakedef.h"
+#ifdef CONFIG_CD
 #include "cdaudio.h"
+#endif
 #include "image.h"
 
 #ifdef SUPPORTD3D
@@ -2158,7 +2160,11 @@ void VID_Soft_SharedSetup(void)
        Cvar_SetQuick(&gl_info_driver, gl_driver);
 
        // LordHavoc: report supported extensions
+#ifdef CONFIG_MENU
        Con_DPrintf("\nQuakeC extensions for server and client: %s\nQuakeC extensions for menu: %s\n", vm_sv_extensions, vm_m_extensions );
+#else
+       Con_DPrintf("\nQuakeC extensions for server and client: %s\n", vm_sv_extensions );
+#endif
 
        // clear to black (loading plaque will be seen over this)
        GL_Clear(GL_COLOR_BUFFER_BIT, NULL, 1.0f, 128);
index ffa6658..f427957 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -511,7 +511,9 @@ void Sys_SendKeyEvents (void)
        }
 }
 
+#ifdef CONFIG_CD
 LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+#endif
 
 static keynum_t buttonremap[16] =
 {
@@ -688,7 +690,9 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
                //      break;
 
                case MM_MCINOTIFY:
+#ifdef CONFIG_CD
                        lRet = CDAudio_MessageHandler (hWnd, uMsg, wParam, lParam);
+#endif
                        break;
 
                default: