DEADSOFTWARE

new code for blood particles (other particles are turned off temporarily): almost...
[d2df-sdl.git] / src / game / g_holmes.pas
index 54dc90b1056959eaea23d8229b80c579086a3791..570a1d99565d7d6e547b6418880d14011c80b86b 100644 (file)
@@ -113,14 +113,14 @@ var
   msY: Integer = -666;
   msB: Word = 0; // button state
   kbS: Word = 0; // keyboard modifiers state
-  showGrid: Boolean = true;
+  showGrid: Boolean = false;
   showMonsInfo: Boolean = false;
   showMonsLOS2Plr: Boolean = false;
   showAllMonsCells: Boolean = false;
   showMapCurPos: Boolean = false;
   showLayersWindow: Boolean = false;
   showOutlineWindow: Boolean = false;
-  showTriggers: Boolean = {$IF DEFINED(D2F_DEBUG)}true{$ELSE}false{$ENDIF};
+  showTriggers: Boolean = {$IF DEFINED(D2F_DEBUG)}false{$ELSE}false{$ENDIF};
 
 // ////////////////////////////////////////////////////////////////////////// //
 {$INCLUDE g_holmes.inc}
@@ -672,8 +672,8 @@ begin
 end;
 
 
-function pmsCurMapX (): Integer; inline; begin result := msX+vpx; end;
-function pmsCurMapY (): Integer; inline; begin result := msY+vpy; end;
+function pmsCurMapX (): Integer; inline; begin result := round(msX/g_dbg_scale)+vpx; end;
+function pmsCurMapY (): Integer; inline; begin result := round(msY/g_dbg_scale)+vpy; end;
 
 
 procedure plrDebugMouse (var ev: THMouseEvent);
@@ -1041,12 +1041,12 @@ procedure plrDebugDraw ();
 
   procedure drawTrigger (var trig: TTrigger);
 
-    procedure drawPanelDest (var parr: TPanelArray; idx: Integer);
+    procedure drawPanelDest (pguid: Integer);
     var
       pan: TPanel;
     begin
-      if (idx < 0) or (idx >= Length(parr)) then exit;
-      pan := parr[idx];
+      pan := g_Map_PanelByGUID(pguid);
+      if (pan = nil) then exit;
       drawLine(
         trig.trigCenter.x, trig.trigCenter.y,
         pan.x+pan.width div 2, pan.y+pan.height div 2,
@@ -1065,32 +1065,36 @@ procedure plrDebugDraw ();
     tx := trig.x+(trig.width-Length(trig.mapId)*6) div 2;
     darkenRect(tx-2, trig.y-20, Length(trig.mapId)*6+4, 10, 64);
     drawText6(tx, trig.y-19, trig.mapId, 255, 255, 0);
+    drawPanelDest(trig.trigPanelGUID);
     case trig.TriggerType of
       TRIGGER_NONE: begin end;
       TRIGGER_EXIT: begin end;
       TRIGGER_TELEPORT: begin end;
-      TRIGGER_OPENDOOR: begin drawPanelDest(gWalls, trig.trigPanelId); end;
-      TRIGGER_CLOSEDOOR: begin drawPanelDest(gWalls, trig.trigPanelId); end;
-      TRIGGER_DOOR: begin drawPanelDest(gWalls, trig.trigPanelId); end;
-      TRIGGER_DOOR5: begin drawPanelDest(gWalls, trig.trigPanelId); end;
-      TRIGGER_CLOSETRAP: begin drawPanelDest(gWalls, trig.trigPanelId); end;
-      TRIGGER_TRAP: begin drawPanelDest(gWalls, trig.trigPanelId); end;
+      TRIGGER_OPENDOOR: begin end;
+      TRIGGER_CLOSEDOOR: begin end;
+      TRIGGER_DOOR: begin end;
+      TRIGGER_DOOR5: begin end;
+      TRIGGER_CLOSETRAP: begin end;
+      TRIGGER_TRAP: begin end;
       TRIGGER_SECRET: begin end;
-      TRIGGER_LIFTUP: begin drawPanelDest(gLifts, trig.trigPanelId); end;
-      TRIGGER_LIFTDOWN: begin drawPanelDest(gLifts, trig.trigPanelId); end;
-      TRIGGER_LIFT: begin drawPanelDest(gLifts, trig.trigPanelId); end;
+      TRIGGER_LIFTUP: begin end;
+      TRIGGER_LIFTDOWN: begin end;
+      TRIGGER_LIFT: begin end;
       TRIGGER_TEXTURE: begin end;
       TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF, TRIGGER_PRESS:
         begin
-        fillRect(
-          trig.trigData.trigTX, trig.trigData.trigTY,
-          trig.trigData.trigTWidth, trig.trigData.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,
-          255, 0, 255, 220);
+          if (trig.trigData.trigTWidth > 0) and (trig.trigData.trigTHeight > 0) then
+          begin
+            fillRect(
+              trig.trigData.trigTX, trig.trigData.trigTY,
+              trig.trigData.trigTWidth, trig.trigData.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,
+              255, 0, 255, 220);
+          end;
         end;
       TRIGGER_SOUND: begin end;
       TRIGGER_SPAWNMONSTER: begin end;
@@ -1126,7 +1130,7 @@ begin
   glScissor(0, gWinSizeY-gPlayerScreenSize.Y-1, vpw, vph);
 
   glPushMatrix();
-  if g_dbg_scale_05 then glScalef(0.5, 0.5, 1.0);
+  glScalef(g_dbg_scale, g_dbg_scale, 1.0);
   glTranslatef(-vpx, -vpy, 0);
 
   if (showGrid) then drawTileGrid();
@@ -1374,7 +1378,7 @@ procedure cbAtcurToggleWalls ();
   begin
     result := false; // don't stop
     //e_WriteLog(Format('wall #%d(%d); enabled=%d (%d); (%d,%d)-(%d,%d)', [pan.arrIdx, pan.proxyId, Integer(pan.Enabled), Integer(mapGrid.proxyEnabled[pan.proxyId]), pan.X, pan.Y, pan.Width, pan.Height]), MSG_NOTIFY);
-    if pan.Enabled then g_Map_DisableWall(pan.arrIdx) else g_Map_EnableWall(pan.arrIdx);
+    if pan.Enabled then g_Map_DisableWallGUID(pan.guid) else g_Map_EnableWallGUID(pan.guid);
   end;
 begin
   //e_WriteLog('=== TOGGLE WALL ===', MSG_NOTIFY);