DEADSOFTWARE

"hlm_ui_scale" convar; "--holmes_ui_scale" cli arg; (fgsfds request)
[d2df-sdl.git] / src / game / g_holmes.pas
index 27fd1691c8ee62058d15c0c97c00ab664fbb265a..9f98ca3172d7c9588605a5d5115aebe4db45f114 100644 (file)
@@ -96,6 +96,7 @@ operator = (const s: AnsiString; constref ev: THMouseEvent): Boolean;
 
 var
   g_holmes_enabled: Boolean = {$IF DEFINED(D2F_DEBUG)}true{$ELSE}false{$ENDIF};
+  g_holmes_ui_scale: Single = 1.0;
 
 
 implementation
@@ -113,14 +114,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}
@@ -1083,15 +1084,18 @@ procedure plrDebugDraw ();
       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;
@@ -1159,16 +1163,21 @@ end;
 
 // ////////////////////////////////////////////////////////////////////////// //
 function g_Holmes_MouseEvent (var ev: THMouseEvent): Boolean;
+var
+  he: THMouseEvent;
 begin
   holmesInitCommands();
   holmesInitBinds();
   result := true;
-  msX := ev.x;
-  msY := ev.y;
+  msX := trunc(ev.x/g_holmes_ui_scale);
+  msY := trunc(ev.y/g_holmes_ui_scale);
   msB := ev.bstate;
   kbS := ev.kstate;
   msB := msB;
-  if not uiMouseEvent(ev) then plrDebugMouse(ev);
+  he := ev;
+  he.x := trunc(he.x/g_holmes_ui_scale);
+  he.y := trunc(he.y/g_holmes_ui_scale);
+  if not uiMouseEvent(he) then plrDebugMouse(he);
 end;
 
 
@@ -1259,8 +1268,11 @@ end;
 procedure g_Holmes_DrawUI ();
 begin
   {$IF not DEFINED(HEADLESS)}
+  glPushMatrix();
+  glScalef(g_holmes_ui_scale, g_holmes_ui_scale, 1.0);
   uiDraw();
   drawCursor();
+  glPopMatrix();
   {$ENDIF}
 end;
 
@@ -1487,4 +1499,6 @@ begin
 end;
 
 
+begin
+  conRegVar('hlm_ui_scale', @g_holmes_ui_scale, 0.01, 5.0, 'Holmes UI scale', '', false);
 end.