DEADSOFTWARE

gl: implement d_health
[d2df-sdl.git] / src / game / renders / opengl / r_map.pas
index c2b65b01dcb39c5d2b2813505cd03aa7537f0f17..fa1d00656dda1775f0d3213e85953b82275ce18c 100644 (file)
@@ -233,6 +233,7 @@ implementation
 
   var
     DebugFrames: Boolean;
+    DebugHealth: Boolean;
     DebugCameraScale: Single;
     FillOutsizeArea: Boolean;
     SkyTexture: TGLTexture;
@@ -745,6 +746,17 @@ implementation
         0, 255, 0, 255
       );
     end;
+    if DebugHealth and mon.alive then
+    begin
+      r_Common_DrawText(
+        IntToStr(mon.MonsterHealth),
+        xx + mon.obj.rect.x + mon.obj.rect.width div 2,
+        yy + mon.obj.rect.y,
+        255, 255, 255, 255,
+        stdfont,
+        TBasePoint.BP_DOWN
+      );
+    end;
   end;
 
   procedure r_Map_DrawMonsters (x, y, w, h: Integer);
@@ -990,6 +1002,18 @@ implementation
       );
     end;
 
+    if DebugHealth and p.alive then
+    begin
+      r_Common_DrawText(
+        IntToStr(p.health) + '/' + IntToStr(p.armor),
+        x + p.obj.rect.x + p.obj.rect.width div 2,
+        y - 24,
+        255, 255, 255, 255,
+        stdfont,
+        TBasePoint.BP_DOWN
+      );
+    end;
+
     if (gChatBubble > 0) and p.FKeys[KEY_CHAT].Pressed and (p.Ghost = false) then
       if (p.FMegaRulez[MR_INVIS] <= gTime) or ((drawed <> nil) and ((p = drawed) or (p.Team = drawed.Team) and (gGameSettings.GameMode <> GM_DM))) then
         r_Map_DrawTalkBubble(p);
@@ -1616,8 +1640,6 @@ implementation
       r_Map_DrawPlayerIndicators(player, cx, cy, cw, ch);
     end;
 
-    // TODO draw g_debug_player
-
     //glTranslatef(-x, -y, 0);
     r_Draw_SetRect(l, t, r, b);
     glPopMatrix;
@@ -1646,7 +1668,9 @@ initialization
   conRegVar('r_debug_camera_scale', @DebugCameraScale, 0.0001, 1000.0, '', '');
   conRegVar('r_gl_fill_outside', @FillOutsizeArea, '', '');
   conRegVar('d_frames', @DebugFrames, '', '');
+  conRegVar('d_health', @DebugHealth, '', '');
   DebugCameraScale := 1.0;
   FillOutsizeArea := true;
   DebugFrames := false;
+  DebugHealth := false;
 end.