DEADSOFTWARE

render: use only r_render to access render-specific info
[d2df-sdl.git] / src / game / g_holmes.pas
index 7b1463be9619c519e59d1dbb4c93e4ecec6cac65..414a30fe1ba40f1049230fe614de323a78fa3ea2 100644 (file)
@@ -20,8 +20,8 @@ interface
 uses
   mempool, geom,
   e_log, e_input,
-  g_textures, g_basic, r_graphics, g_phys, g_grid, g_player, g_monsters,
-  g_window, g_map, g_triggers, g_items, g_game, g_panel, g_console, g_gfx,
+  g_basic, g_phys, g_grid, g_player, g_monsters,
+  g_map, g_triggers, g_items, g_game, g_panel, g_console,
   xprofiler,
   sdlcarcass,
   fui_common, fui_events, fui_ctls,
@@ -48,9 +48,15 @@ implementation
 
 uses
   {$INCLUDE ../nogl/noGLuses.inc}
-  {rttiobj,} typinfo, e_texture, e_res,
+  {$IFDEF ENABLE_GFX}
+    g_gfx,
+  {$ENDIF}
+  {$IFDEF ENABLE_GIBS}
+    g_gibs,
+  {$ENDIF}
+  {rttiobj,} typinfo, e_res,
   SysUtils, Classes, SDL2,
-  MAPDEF, g_main, g_options,
+  MAPDEF, g_options,
   utils, hashtable, xparser;
 
 
@@ -916,6 +922,7 @@ procedure plrDebugDraw ();
     end;
   end;
 
+{$IFDEF ENABLE_GFX}
   procedure drawAwakeCells ();
   var
     x, y: Integer;
@@ -932,6 +939,7 @@ procedure plrDebugDraw ();
       end;
     end;
   end;
+{$ENDIF}
 
   procedure drawTraceBox ();
   var
@@ -1224,6 +1232,7 @@ procedure plrDebugDraw ();
     for f := 0 to High(gTriggers) do drawTrigger(gTriggers[f]);
   end;
 
+{$IFDEF ENABLE_GIBS}
   procedure drawGibsBoxes ();
   var
     f: Integer;
@@ -1241,6 +1250,7 @@ procedure plrDebugDraw ();
       end;
     end;
   end;
+{$ENDIF}
 
 var
   mon: TMonster;
@@ -1297,12 +1307,15 @@ begin
     if showTriggers then drawTriggers();
     if showGrid then drawSelectedPlatformCells();
 
-    //drawAwakeCells();
+    {$IFDEF ENABLE_GFX}
+      // drawAwakeCells();
+    {$ENDIF}
 
     if showTraceBox then drawTraceBox();
 
-    //drawGibsBoxes();
-
+    {$IFDEF ENABLE_GIBS}
+      // drawGibsBoxes();
+    {$ENDIF}
 
     //pan := g_Map_traceToNearest(16, 608, 16, 8, (GridTagObstacle or GridTagLiquid), @ex, @ey);
     (*
@@ -1393,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;
@@ -1411,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
@@ -1442,7 +1453,6 @@ begin
   end;
 
   if (doeat) then ev.eat();
-{$ENDIF}
 end;
 
 
@@ -1453,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);
@@ -1464,7 +1474,7 @@ begin
   glDisable(GL_TEXTURE_2D);
 
   if gGameOn then plrDebugDraw();
-  {$ENDIF}
+{$ENDIF}
 
   laserSet := false;
 end;
@@ -1476,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);
@@ -1488,7 +1499,7 @@ begin
   finally
     glPopMatrix();
   end;
-  {$ENDIF}
+{$ENDIF}
 end;