From ff0d6ee82618de8dcfda806a334defa2227fad44 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 5a06f52..63c895f 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -387,7 +387,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 @@ -396,11 +395,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 687a412..ab2099a 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -1542,12 +1542,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 de56a17..13020b7 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -154,9 +154,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); } @@ -802,7 +803,7 @@ end; end; {$ENDIF} -{$IFNDEF HEADLESS} +{$IFDEF ENABLE_SYSTEM} procedure CharPress (C: AnsiChar); {$IFDEF ENABLE_MENU} var Msg: g_gui.TMessage; @@ -2305,7 +2306,7 @@ begin // Нужно сменить разрешение: if gResolutionChange then begin - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_RENDER} e_WriteLog('Changing resolution', TMsgType.Notify); r_Render_Apply; {$ENDIF} @@ -2542,9 +2543,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 314c7e7..6b25a4f 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 74e8d03..d426128 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -391,15 +391,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 13ee251..4ba0007 100644 --- a/src/shared/a_modes.inc +++ b/src/shared/a_modes.inc @@ -291,17 +291,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