From: DeaDDooMER Date: Sat, 23 Jun 2018 08:14:49 +0000 (+0300) Subject: Holmes now optional at compile-time X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=3a2594735abd86e583b35da46526b9d16a9cd0ed;p=d2df-sdl.git Holmes now optional at compile-time --- diff --git a/README b/README index 2b86f9d..7cedece 100644 --- a/README +++ b/README @@ -20,6 +20,7 @@ fpc -O3 -Fi../lib/vampimg -Fi../lib/vampimg/JpegLib -Fi../lib/vampimg/ZLib -Fu.. If you want SDL_mixer instead of FMOD, add -dUSE_SDLMIXER. If you want the server to be able to forward ports via UPNP, add -dUSE_MINIUPNPC. +If you want to debug game with Holmes, add -dENABLE_HOLMES. To build a headless (no video/audio, for dedicated servers) executable, add -dHEADLESS. Replace -O3 with -g -gl to enable debugging features. Run the game with --gdb when using a debugger to prevent it from eating exceptions. diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr index 0b62430..91fd3a6 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -96,7 +96,6 @@ uses g_triggers in 'g_triggers.pas', g_weapons in 'g_weapons.pas', g_window in 'g_window.pas', - g_holmes in 'g_holmes.pas', SysUtils, {$IFDEF USE_FMOD} fmod in '../lib/FMOD/fmod.pas', @@ -115,6 +114,9 @@ uses g_panel in 'g_panel.pas', g_language in 'g_language.pas', +{$IFDEF ENABLE_HOLMES} + g_holmes in 'g_holmes.pas', + sdlcarcass in '../flexui/sdlcarcass.pas', //sdlstandalone in '../flexui/sdlstandalone.pas', @@ -125,6 +127,7 @@ uses fui_style in '../flexui/fui_style.pas', fui_flexlay in '../flexui/fui_flexlay.pas', fui_ctls in '../flexui/fui_ctls.pas', +{$ENDIF} ImagingTypes, Imaging, diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 4414740..83da686 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -358,6 +358,9 @@ uses nanoGL, {$ELSE} GL, GLExt, +{$ENDIF} +{$IFDEF ENABLE_HOLMES} + g_holmes, {$ENDIF} e_texture, g_textures, g_main, g_window, g_menu, e_input, e_log, g_console, g_items, g_map, g_panel, @@ -365,7 +368,7 @@ uses g_triggers, g_monsters, e_sound, CONFIG, g_language, g_net, ENet, e_msg, g_netmsg, g_netmaster, - sfs, wadreader, g_holmes; + sfs, wadreader; var @@ -3393,11 +3396,13 @@ begin p.viewPortW := sWidth; p.viewPortH := sHeight; +{$IFDEF ENABLE_HOLMES} if (p = gPlayer1) then begin g_Holmes_plrViewPos(sX, sY); g_Holmes_plrViewSize(sWidth, sHeight); end; +{$ENDIF} renderMapInternal(-c, -d, true); @@ -3587,8 +3592,10 @@ begin e_DrawLine(2, 0, gScreenHeight div 2, gScreenWidth, gScreenHeight div 2, 0, 0, 0); end; +{$IFDEF ENABLE_HOLMES} // draw inspector if (g_holmes_enabled) then g_Holmes_Draw(); +{$ENDIF} if MessageText <> '' then begin @@ -3800,7 +3807,9 @@ begin if gGameOn then drawProfilers(); +{$IFDEF ENABLE_HOLMES} g_Holmes_DrawUI(); +{$ENDIF} g_Touch_Draw; end; @@ -7596,7 +7605,9 @@ begin conRegVar('los_enabled', @gmon_dbg_los_enabled, 'enable/disable monster LOS calculations', 'monster LOS', true); conRegVar('mon_think', @gmon_debug_think, 'enable/disable monster thinking', 'monster thinking', true); +{$IFDEF ENABLE_HOLMES} conRegVar('dbg_holmes', @g_holmes_enabled, 'enable/disable Holmes', 'Holmes', true); +{$ENDIF} conRegVar('dbg_ignore_level_bounds', @g_dbg_ignore_bounds, 'ignore level bounds', '', false); diff --git a/src/game/g_main.pas b/src/game/g_main.pas index b564911..874907e 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -41,14 +41,17 @@ uses nanoGL, {$ELSE} GL, GLExt, +{$ENDIF} +{$IFDEF ENABLE_HOLMES} + g_holmes, fui_wadread, fui_style, fui_gfx_gl, {$ENDIF} SDL2, wadreader, e_log, g_window, e_graphics, e_input, g_game, g_console, g_gui, e_sound, g_options, g_sound, g_player, g_basic, g_weapons, SysUtils, g_triggers, MAPDEF, g_map, - g_menu, g_language, g_net, g_holmes, g_touch, - utils, conbuf, envvars, fui_wadread, fui_style, - fui_gfx_gl, xparser; + g_menu, g_language, g_net, g_touch, + utils, conbuf, envvars, + xparser; var @@ -124,7 +127,7 @@ begin {$ENDIF} {$ENDIF} -{$IFNDEF HEADLESS} +{$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)} flexloaded := true; if not fuiAddWad('flexui.wad') then begin diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 8c64fd0..8c62656 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -592,11 +592,14 @@ uses nanoGL, {$ELSE} GL, +{$ENDIF} +{$IFDEF ENABLE_HOLMES} + g_holmes, {$ENDIF} e_log, g_map, g_items, g_console, g_gfx, Math, g_options, g_triggers, g_menu, g_game, g_grid, wadreader, g_main, g_monsters, CONFIG, g_language, - g_net, g_netmsg, g_window, g_holmes, + g_net, g_netmsg, g_window, utils, xstreams; const PLR_SAVE_VERSION = 0; @@ -2414,10 +2417,13 @@ procedure TPlayer.DrawAim(); var ex, ey: Integer; begin + +{$IFDEF ENABLE_HOLMES} if isValidViewPort and (self = gPlayer1) then begin g_Holmes_plrLaser(ax0, ay0, ax1, ay1); end; +{$ENDIF} e_DrawLine(sz, ax0, ay0, ax1, ay1, 255, 0, 0, 96); if (g_Map_traceToNearestWall(ax0, ay0, ax1, ay1, @ex, @ey) <> nil) then diff --git a/src/game/g_window.pas b/src/game/g_window.pas index ac21148..7f54250 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -55,13 +55,15 @@ uses nanoGL, {$ELSE} GL, GLExt, +{$ENDIF} +{$IFDEF ENABLE_HOLMES} + g_holmes, sdlcarcass, fui_ctls, {$ENDIF} SysUtils, Classes, MAPDEF, SDL2, e_graphics, e_log, e_texture, g_main, g_console, e_input, g_options, g_game, g_basic, g_textures, e_sound, g_sound, g_menu, ENet, g_net, - g_map, g_gfx, g_monsters, g_holmes, xprofiler, - sdlcarcass, fui_ctls, + g_map, g_gfx, g_monsters, xprofiler, g_touch; @@ -90,7 +92,9 @@ var procedure KillGLWindow (preserveGL: Boolean); begin +{$IFDEF ENABLE_HOLMES} if (h_GL <> nil) and (not preserveGL) then begin if (assigned(oglDeinitCB)) then oglDeinitCB(); end; +{$ENDIF} if (h_Wnd <> nil) then SDL_DestroyWindow(h_Wnd); if (h_GL <> nil) and (not preserveGL) then begin @@ -182,9 +186,12 @@ begin e_WriteLog('SDL: fullscreen window got invalid size: '+IntToStr(nw)+'x'+IntToStr(nh), TMsgType.Notify); end; end; - fuiScrWdt := gScreenWidth; - fuiScrHgt := gScreenHeight; - if (h_GL <> nil) and (not preserveGL) then begin if (assigned(oglInitCB)) then oglInitCB(); end; + + {$IFDEF ENABLE_HOLMES} + fuiScrWdt := gScreenWidth; + fuiScrHgt := gScreenHeight; + if (h_GL <> nil) and (not preserveGL) then begin if (assigned(oglInitCB)) then oglInitCB(); end; + {$ENDIF} {$ENDIF} result := true; @@ -231,8 +238,10 @@ begin gWinSizeX := gScreenWidth; gWinSizeY := gScreenHeight; {$IF not DEFINED(HEADLESS)} - fuiScrWdt := gScreenWidth; - fuiScrHgt := gScreenHeight; + {$IFDEF ENABLE_HOLMES} + fuiScrWdt := gScreenWidth; + fuiScrHgt := gScreenHeight; + {$ENDIF} e_ResizeWindow(gScreenWidth, gScreenHeight); g_Game_SetupScreenSize(); g_Menu_Reset(); @@ -411,7 +420,9 @@ begin gWinActive := false; - if assigned(winBlurCB) then winBlurCB(); + {$IFDEF ENABLE_HOLMES} + if assigned(winBlurCB) then winBlurCB(); + {$ENDIF} end; end else if wActivate then @@ -434,7 +445,10 @@ begin end; gWinActive := true; - if assigned(winFocusCB) then winFocusCB(); + + {$IFDEF ENABLE_HOLMES} + if assigned(winFocusCB) then winFocusCB(); + {$ENDIF} end; end; end; @@ -475,7 +489,7 @@ begin if key = SDL_SCANCODE_AC_BACK then key := SDL_SCANCODE_ESCAPE; down := (ev.type_ = SDL_KEYDOWN); - {$IF not DEFINED(HEADLESS)} + {$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)} if fuiOnSDLEvent(ev) then begin // event eaten, but... @@ -487,7 +501,7 @@ begin if down then KeyPress(key); end; - {$IF not DEFINED(HEADLESS)} + {$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)} SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_MOUSEWHEEL, SDL_MOUSEMOTION: fuiOnSDLEvent(ev); {$ENDIF} @@ -538,8 +552,10 @@ begin {$IF not DEFINED(HEADLESS)} h_GL := SDL_GL_CreateContext(h_Wnd); if (h_GL = nil) then exit; - fuiScrWdt := gScreenWidth; - fuiScrHgt := gScreenHeight; + {$IFDEF ENABLE_HOLMES} + fuiScrWdt := gScreenWidth; + fuiScrHgt := gScreenHeight; + {$ENDIF} SDL_GL_MakeCurrent(h_Wnd, h_GL); {$IFDEF USE_NANOGL} if nanoGL_Init() = 0 then @@ -549,7 +565,9 @@ begin exit; end; {$ENDIF} - if (assigned(oglInitCB)) then oglInitCB(); + {$IFDEF ENABLE_HOLMES} + if (assigned(oglInitCB)) then oglInitCB(); + {$ENDIF} if (h_GL <> nil) then g_SetVSync(gVSync); {$ENDIF} @@ -875,11 +893,13 @@ begin {$IFDEF HEADLESS} e_NoGraphics := true; {$ELSE} - if (not g_holmes_imfunctional) then - begin - uiInitialize(); - uiContext.font := 'win14'; - end; + {$IFDEF ENABLE_HOLMES} + if (not g_holmes_imfunctional) then + begin + uiInitialize(); + uiContext.font := 'win14'; + end; + {$ENDIF} {$ENDIF} idx := 1; @@ -908,6 +928,7 @@ begin if arg = '--aimline' then g_dbg_aimline_on := true; {.$ENDIF} +{$IFDEF ENABLE_HOLMES} if arg = '--holmes' then begin g_holmes_enabled := true; g_Game_SetDebugMode(); end; if (arg = '--holmes-ui-scale') or (arg = '-holmes-ui-scale') then @@ -942,6 +963,7 @@ begin Inc(idx); end; end; +{$ENDIF} if (arg = '--game-scale') or (arg = '-game-scale') then begin