From: DeaDDooMER Date: Sun, 19 Feb 2023 15:03:29 +0000 (+0300) Subject: gl: implement d_health X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=a3ef23c31742fba53271c9a5a4dfe6ea26ea5d68;p=d2df-sdl.git gl: implement d_health --- diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 1f1ed05..2e3b683 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -1053,7 +1053,6 @@ begin AddCommand('d_monoff', DebugCommands); AddCommand('d_botoff', DebugCommands); AddCommand('d_monster', DebugCommands); - AddCommand('d_health', DebugCommands); AddCommand('d_player', DebugCommands); AddCommand('d_joy', DebugCommands); AddCommand('d_mem', DebugCommands); diff --git a/src/game/g_game.pas b/src/game/g_game.pas index a141feb..239cb56 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -315,7 +315,6 @@ var g_debug_WinMsgs: Boolean = False; g_debug_MonsterOff: Boolean = False; g_debug_BotAIOff: Byte = 0; - g_debug_HealthBar: Boolean = False; g_Debug_Player: Boolean = False; gCoopMonstersKilled: Word = 0; gCoopSecretsFound: Word = 0; @@ -1032,7 +1031,6 @@ begin g_debug_WinMsgs := False; g_debug_MonsterOff := False; g_debug_BotAIOff := 0; - g_debug_HealthBar := False; g_Debug_Player := False; end; @@ -4734,14 +4732,6 @@ begin end; end; end - else if (cmd = 'd_health') then - begin - if (Length(P) > 1) and - ((P[1] = '1') or (P[1] = '0')) then - g_debug_HealthBar := (P[1][1] = '1'); - - g_Console_Add(Format('d_health is %d', [Byte(g_debug_HealthBar)])); - end else if (cmd = 'd_player') then begin if (Length(P) > 1) and diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index c2b65b0..fa1d006 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -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.