DEADSOFTWARE

save/load UI cosmetix
[d2df-sdl.git] / src / game / g_holmes.pas
index 9d215455e8fbbafe8c72f0ed67d3e9c1042fae61..e23d6c74722e265135164ee32d165f186f963d37 100644 (file)
@@ -19,6 +19,7 @@ unit g_holmes;
 interface
 
 uses
+  mempool,
   e_log, e_input,
   g_textures, g_basic, e_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,
@@ -103,7 +104,7 @@ var
 implementation
 
 uses
-  {rttiobj,} typinfo,
+  {rttiobj,} typinfo, e_texture,
   SysUtils, Classes, GL, SDL2,
   MAPDEF, g_main, g_options,
   utils, hashtable, xparser;
@@ -967,6 +968,8 @@ procedure plrDebugDraw ();
   procedure hilightCell1 (cx, cy: Integer);
   begin
     //e_WriteLog(Format('h1: (%d,%d)', [cx, cy]), MSG_NOTIFY);
+    cx := cx and (not (monsGrid.tileSize-1));
+    cy := cy and (not (monsGrid.tileSize-1));
     fillRect(cx, cy, monsGrid.tileSize, monsGrid.tileSize, 255, 255, 0, 92);
   end;
 
@@ -1037,7 +1040,7 @@ procedure plrDebugDraw ();
       mon.getMapBox(mx, my, mw, mh);
       drawLine(mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, 255, 0, 0, 255);
       {$IF DEFINED(D2F_DEBUG)}
-      //mapGrid.dbgRayTraceTileHitCB := hilightCell1;
+      mapGrid.dbgRayTraceTileHitCB := hilightCell1;
       {$ENDIF}
       if (g_Map_traceToNearestWall(mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, @ex, @ey) <> nil) then
       //if (mapGrid.traceRay(ex, ey, mx+mw div 2, my+mh div 2, emx+emw div 2, emy+emh div 2, hilightWallTrc, (GridTagWall or GridTagDoor)) <> nil) then
@@ -1045,7 +1048,7 @@ procedure plrDebugDraw ();
         drawLine(mx+mw div 2, my+mh div 2, ex, ey, 0, 255, 0, 255);
       end;
       {$IF DEFINED(D2F_DEBUG)}
-      //mapGrid.dbgRayTraceTileHitCB := nil;
+      mapGrid.dbgRayTraceTileHitCB := nil;
       {$ENDIF}
     end;
 
@@ -1148,16 +1151,16 @@ procedure plrDebugDraw ();
       TRIGGER_TEXTURE: begin end;
       TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF, TRIGGER_PRESS:
         begin
-          if (trig.trigData.trigTWidth > 0) and (trig.trigData.trigTHeight > 0) then
+          if (trig.trigDataRec.trigTWidth > 0) and (trig.trigDataRec.trigTHeight > 0) then
           begin
             fillRect(
-              trig.trigData.trigTX, trig.trigData.trigTY,
-              trig.trigData.trigTWidth, trig.trigData.trigTHeight,
+              trig.trigDataRec.trigTX, trig.trigDataRec.trigTY,
+              trig.trigDataRec.trigTWidth, trig.trigDataRec.trigTHeight,
               0, 255, 255, 42);
             drawLine(
               trig.trigCenter.x, trig.trigCenter.y,
-              trig.trigData.trigTX+trig.trigData.trigTWidth div 2,
-              trig.trigData.trigTY+trig.trigData.trigTHeight div 2,
+              trig.trigDataRec.trigTX+trig.trigDataRec.trigTWidth div 2,
+              trig.trigDataRec.trigTY+trig.trigDataRec.trigTHeight div 2,
               255, 0, 255, 220);
           end;
         end;
@@ -1205,6 +1208,8 @@ procedure plrDebugDraw ();
 var
   mon: TMonster;
   mx, my, mw, mh: Integer;
+  //pan: TPanel;
+  //ex, ey: Integer;
 begin
   if (gPlayer1 = nil) then exit;
 
@@ -1241,6 +1246,22 @@ begin
 
   //drawGibsBoxes();
 
+
+  //pan := g_Map_traceToNearest(16, 608, 16, 8, (GridTagObstacle or GridTagLiquid), @ex, @ey);
+  (*
+  {$IF DEFINED(D2F_DEBUG)}
+  mapGrid.dbgRayTraceTileHitCB := hilightCell1;
+  {$ENDIF}
+  pan := mapGrid.traceRay(ex, ey, 16, 608, 16, 8, nil, (GridTagObstacle or GridTagLiquid));
+  if (pan <> nil) then writeln('end=(', ex, ',', ey, ')');
+  {$IF DEFINED(D2F_DEBUG)}
+  mapGrid.dbgRayTraceTileHitCB := nil;
+  {$ENDIF}
+
+  pan := g_Map_PanelAtPoint(16, 608, (GridTagObstacle or GridTagLiquid));
+  if (pan <> nil) then writeln('hit!');
+  *)
+
   glPopMatrix();
 
   glDisable(GL_SCISSOR_TEST);