From 221a6cb74c3a3b30b9e60247d6e42d7a6fcdebf0 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 3 Aug 2013 12:48:18 +0000 Subject: [PATCH] Revert "Revert "Build in subdirs"", as the issues seem to be ironed out now. 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 --- .gitignore | 1 + BSDmakefile | 26 ++++++++++-- cl_demo.c | 4 ++ cl_main.c | 6 +++ cl_parse.c | 14 +++++++ cl_screen.c | 24 +++++++++++ gl_rmain.c | 4 ++ host.c | 22 ++++++++++ host_cmd.c | 8 ++++ keys.c | 13 ++++++ makefile | 59 ++++++++++++++++++++++----- makefile.inc | 113 +++++++++++++++++++++++++-------------------------- menu.c | 4 ++ netconn.c | 40 ++++++++++++++++++ progsvm.h | 8 ++++ prvm_cmds.c | 4 ++ prvm_edict.c | 2 + prvm_exec.c | 2 + quakedef.h | 2 + snd_main.c | 4 ++ snd_mix.c | 4 ++ vid_shared.c | 6 +++ vid_wgl.c | 4 ++ 23 files changed, 303 insertions(+), 71 deletions(-) diff --git a/.gitignore b/.gitignore index de9a5adf..047e418e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +obj/ *.d *.o *.i diff --git a/BSDmakefile b/BSDmakefile index 36f0f82b..6ca3c655 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -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 ##### diff --git a/cl_demo.c b/cl_demo.c index f30eff8b..6d4fb869 100644 --- 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; diff --git a/cl_main.c b/cl_main.c index d50d4dd6..ec4ca8b6 100644 --- 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 } } diff --git a/cl_parse.c b/cl_parse.c index e637dcaf..3ae26aa9 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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: diff --git a/cl_screen.c b/cl_screen.c index d64a5f62..9b1513b4 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -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? diff --git a/gl_rmain.c b/gl_rmain.c index 755925c9..8f69fb09 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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 0b97a454..a54067af 100644 --- a/host.c +++ b/host.c @@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #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 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 (); diff --git a/host_cmd.c b/host_cmd.c index 5e8daba3..d14fc907 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -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 30bb4f9e..ff8d5786 100644 --- 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); diff --git a/makefile b/makefile index cdf4c641..9ff2fba1 100644 --- 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 ##### diff --git a/makefile.inc b/makefile.inc index 31ce1831..80ab84b7 100644 --- a/makefile.inc +++ b/makefile.inc @@ -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 184ae366..34a8de7f 100644 --- 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); diff --git a/netconn.c b/netconn.c index abc3501e..00adb61a 100755 --- 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) diff --git a/progsvm.h b/progsvm.h index 406a9eb2..acaf6df0 100644 --- 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 diff --git a/prvm_cmds.c b/prvm_cmds.c index 1c9c8099..00c9ede9 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -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; diff --git a/prvm_edict.c b/prvm_edict.c index 191197f5..cf187899 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -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; } diff --git a/prvm_exec.c b/prvm_exec.c index 823c2d38..fee9d829 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -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 /* ==================== diff --git a/quakedef.h b/quakedef.h index 0edfd695..61ab8491 100644 --- a/quakedef.h +++ b/quakedef.h @@ -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; diff --git a/snd_main.c b/snd_main.c index 6bda6fd0..d79857f4 100644 --- a/snd_main.c +++ b/snd_main.c @@ -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 ()) { diff --git a/snd_mix.c b/snd_mix.c index 2274f353..2299e3bf 100644 --- 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); diff --git a/vid_shared.c b/vid_shared.c index 719d6299..175c7512 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -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); diff --git a/vid_wgl.c b/vid_wgl.c index ffa66589..f4279570 100644 --- 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: -- 2.39.2