From fe1782e13a7cf88bbbefdc8191b18271ee858985 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 29 Jan 2022 22:17:14 +0300 Subject: [PATCH] game: less references to HEADLESS --- src/game/Doom2DF.lpr | 6 ------ src/game/g_console.pas | 6 ------ src/game/g_corpses.pas | 4 ++-- src/game/g_game.pas | 13 +++++++------ src/game/g_holmes.pas | 18 ++++++++---------- src/game/opengl/r_game.pas | 4 ---- src/game/sdl2/g_system.pas | 16 +++++++--------- src/shared/a_modes.inc | 12 +++++++++--- 8 files changed, 33 insertions(+), 46 deletions(-) diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr index 4aecd40..4d4edc3 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -390,7 +390,6 @@ begin begin itmp := 0; val(ParamStr(idx), itmp, valres); - {$IFNDEF HEADLESS} if (valres = 0) and (not g_holmes_imfunctional) then begin case itmp of @@ -399,11 +398,6 @@ begin 16: uiContext.font := 'win16'; end; end; - {$ELSE} - // fuck off, fpc! - itmp := itmp; - valres := valres; - {$ENDIF} Inc(idx); end; end; diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 033f16c..c9cc11e 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -1625,12 +1625,6 @@ begin //SetLength(ConsoleHistory, Length(ConsoleHistory)+1); //ConsoleHistory[High(ConsoleHistory)] := L; - - (* -{$IFDEF HEADLESS} - e_WriteLog('CON: ' + L, MSG_NOTIFY); -{$ENDIF} - *) end; diff --git a/src/game/g_corpses.pas b/src/game/g_corpses.pas index d4c6c50..3f08d79 100644 --- a/src/game/g_corpses.pas +++ b/src/game/g_corpses.pas @@ -70,7 +70,7 @@ interface procedure g_Corpses_RemoveAll; procedure g_Corpses_Update; - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_RENDER} function g_Corpses_GetCameraObj (Player: TPlayer): TObj; {$ENDIF} @@ -372,7 +372,7 @@ implementation SetLength(gCorpses, MaxCorpses); end; -{$IFNDEF HEADLESS} +{$IFDEF ENABLE_RENDER} function g_Corpses_GetCameraObj (Player: TPlayer): TObj; begin {$IFDEF ENABLE_CORPSES} diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 9fdc66e..d1e15d1 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -159,9 +159,10 @@ procedure SortGameStat(var stat: TPlayerStatArray); {$IFDEF ENABLE_MENU} procedure g_Game_InGameMenu(Show: Boolean); {$ENDIF} -{$IFNDEF HEADLESS} +{$IFDEF ENABLE_SYSTEM} procedure CharPress (C: AnsiChar); {$ENDIF} + procedure KeyPress (K: Word); { procedure SetWinPause(Enable: Boolean); } @@ -811,7 +812,7 @@ end; end; {$ENDIF} -{$IFNDEF HEADLESS} +{$IFDEF ENABLE_SYSTEM} procedure CharPress (C: AnsiChar); {$IFDEF ENABLE_MENU} var Msg: g_gui.TMessage; @@ -2349,7 +2350,7 @@ begin // Нужно сменить разрешение: if gResolutionChange then begin - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_RENDER} e_WriteLog('Changing resolution', TMsgType.Notify); r_Render_Apply; {$ENDIF} @@ -2586,9 +2587,9 @@ begin gMusic.Free(); g_Game_FreeData(); g_PlayerModel_FreeData(); -{$IFNDEF HEADLESS} - //g_Menu_Free(); //k8: this segfaults after resolution change; who cares? -{$ENDIF} + {$IFDEF ENABLE_MENU} + // g_Menu_Free(); //k8: this segfaults after resolution change; who cares? + {$ENDIF} if NetInitDone then g_Net_Free; diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas index 06cc707..2c15447 100644 --- a/src/game/g_holmes.pas +++ b/src/game/g_holmes.pas @@ -1406,12 +1406,8 @@ end; // ////////////////////////////////////////////////////////////////////////// // procedure g_Holmes_OnEvent (var ev: TFUIEvent); -{$IF not DEFINED(HEADLESS)} -var - doeat: Boolean = false; -{$ENDIF} + var doeat: Boolean = false; begin -{$IF not DEFINED(HEADLESS)} if g_Game_IsNet then exit; if not g_holmes_enabled then exit; if g_holmes_imfunctional then exit; @@ -1424,12 +1420,14 @@ begin if (ev.key) then begin +{$IFDEF USE_SDL2} case ev.scan of SDL_SCANCODE_LCTRL, SDL_SCANCODE_RCTRL, SDL_SCANCODE_LALT, SDL_SCANCODE_RALT, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_RSHIFT: doeat := true; end; +{$ENDIF} end else if (ev.mouse) then begin @@ -1455,7 +1453,6 @@ begin end; if (doeat) then ev.eat(); -{$ENDIF} end; @@ -1466,10 +1463,10 @@ begin if not g_holmes_enabled then exit; if g_holmes_imfunctional then exit; - {$IF not DEFINED(HEADLESS)} holmesInitCommands(); holmesInitBinds(); +{$IFDEF ENABLE_RENDER} glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // modify color buffer glDisable(GL_STENCIL_TEST); glDisable(GL_BLEND); @@ -1477,7 +1474,7 @@ begin glDisable(GL_TEXTURE_2D); if gGameOn then plrDebugDraw(); - {$ENDIF} +{$ENDIF} laserSet := false; end; @@ -1489,8 +1486,9 @@ begin if not g_holmes_enabled then exit; if g_holmes_imfunctional then exit; - {$IF not DEFINED(HEADLESS)} gGfxDoClear := false; + +{$IFDEF ENABLE_RENDER} //if assigned(prerenderFrameCB) then prerenderFrameCB(); uiDraw(); glMatrixMode(GL_MODELVIEW); @@ -1501,7 +1499,7 @@ begin finally glPopMatrix(); end; - {$ENDIF} +{$ENDIF} end; diff --git a/src/game/opengl/r_game.pas b/src/game/opengl/r_game.pas index 672ceb4..ae631e1 100644 --- a/src/game/opengl/r_game.pas +++ b/src/game/opengl/r_game.pas @@ -810,9 +810,7 @@ begin // HACK: take stats screenshot immediately after the first frame of the stats showing if gScreenshotStats and (not StatShotDone) and (Length(CustomStat.PlayerStat) > 1) then begin -{$IFNDEF HEADLESS} g_TakeScreenShot('stats/' + StatFilename); -{$ENDIF} StatShotDone := True; end; end; @@ -2170,9 +2168,7 @@ begin end; {$ENDIF} -{$IFNDEF HEADLESS} r_Console_Draw(); -{$ENDIF} if g_debug_Sounds and gGameOn then begin diff --git a/src/game/sdl2/g_system.pas b/src/game/sdl2/g_system.pas index 08cb80e..daec5d9 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -392,15 +392,13 @@ implementation procedure sys_ShowKeyboard (yes: Boolean); begin - {$IFNDEF HEADLESS} - if g_dbg_input then - e_LogWritefln('g_Touch_ShowKeyboard(%s)', [yes]); - (* on desktop we always receive text (needed for cheats) *) - if yes or (SDL_HasScreenKeyboardSupport() = SDL_FALSE) then - SDL_StartTextInput - else - SDL_StopTextInput - {$ENDIF} + if g_dbg_input then + e_LogWritefln('g_Touch_ShowKeyboard(%s)', [yes]); + (* on desktop we always receive text (needed for cheats) *) + if yes or (SDL_HasScreenKeyboardSupport() = SDL_FALSE) then + SDL_StartTextInput + else + SDL_StopTextInput end; procedure HandleTouch (const ev: TSDL_TouchFingerEvent); diff --git a/src/shared/a_modes.inc b/src/shared/a_modes.inc index c500a34..9250c11 100644 --- a/src/shared/a_modes.inc +++ b/src/shared/a_modes.inc @@ -288,17 +288,23 @@ {$IF DEFINED(USE_GLSTUB) OR DEFINED(USE_GLES1)} {$ERROR Only one render driver must be selected!} {$ENDIF} -{$ELSE} +{$ELSEIF DEFINED(ENABLE_RENDER)} {$DEFINE USE_OPENGL} {.$ERROR Render driver not selected. Use -dUSE_GLSTUB or -dUSE_GLES1 or -dUSE_OPENGL} {$ENDIF} {$IFDEF ENABLE_HOLMES} + {$IFDEF DISABLE_SYSTEM} + {$FATAL System driver required for current Holmes implementation} + {$ENDIF} + {$IFDEF DISABLE_RENDER} + {$FATAL Render driver required for current Holmes implementation} + {$ENDIF} {$IFNDEF USE_SDL2} - {$ERROR Holmes supported only with SDL2} + {$FATAL SDL2 required for current Holmes implementation} {$ENDIF} {$IFNDEF USE_OPENGL} - {$ERROR Holmes supported only with desktop OpenGL} + {$FATAL Desktop OpenGL required for current Holmes implementation} {$ENDIF} {$ENDIF} -- 2.29.2