Skip to content

Commit 55d6e63

Browse files
committed
Implement extended HUD
1 parent c6e0572 commit 55d6e63

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

client/src/cl_cvarlist.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,9 @@ CVAR(hud_feedobits, "1", "Show obituaries in the event feed.", CVARTYPE_BOOL,
577577

578578
CVAR(hud_hordeinfo_debug, "0", "Show debugging information for horde.", CVARTYPE_BOOL, CVAR_NULL)
579579

580+
CVAR_RANGE(hud_extendedinfo, "0", "Show kills, items, and secrets:\n// 0: Off\n// 1: DIGFONT\n// 2: SMALLFONT",
581+
CVARTYPE_INT, CVAR_CLIENTARCHIVE | CVAR_NOENABLEDISABLE, 0.0, 2.0)
582+
580583
#ifdef _XBOX
581584
CVAR (chatmacro0, "Hi.", "", CVARTYPE_STRING, CVAR_CLIENTARCHIVE | CVAR_NOENABLEDISABLE) // A
582585
CVAR (chatmacro1, "I'm ready to kick butt!", "", CVARTYPE_STRING, CVAR_CLIENTARCHIVE | CVAR_NOENABLEDISABLE) // B

client/src/st_new.cpp

+46
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "p_horde.h"
5454
#include "c_dispatch.h"
5555
#include "hu_speedometer.h"
56+
#include "am_map.h"
5657

5758
static const char* medipatches[] = {"MEDIA0", "PSTRA0"};
5859
static const char* armorpatches[] = {"ARM1A0", "ARM2A0"};
@@ -117,6 +118,7 @@ EXTERN_CVAR(hud_targetcount)
117118
EXTERN_CVAR(hud_transparency)
118119
EXTERN_CVAR(hud_anchoring)
119120
EXTERN_CVAR(hud_demobar)
121+
EXTERN_CVAR(hud_extendedinfo)
120122
EXTERN_CVAR(sv_fraglimit)
121123
EXTERN_CVAR(sv_teamsinplay)
122124
EXTERN_CVAR(g_lives)
@@ -789,6 +791,42 @@ void drawNetdemo() {
789791
}
790792
}
791793

794+
static void drawLevelStats() {
795+
if (!G_IsCoopGame())
796+
return;
797+
798+
if (AM_ClassicAutomapVisible() || AM_OverlayAutomapVisible())
799+
return;
800+
801+
std::string line;
802+
803+
if (G_IsHordeMode())
804+
{
805+
StrFormat(line, TEXTCOLOR_RED "K" TEXTCOLOR_NORMAL " %d",
806+
level.killed_monsters);
807+
}
808+
else
809+
{
810+
StrFormat(line, TEXTCOLOR_RED "K" TEXTCOLOR_NORMAL " %d/%d "
811+
TEXTCOLOR_RED "I" TEXTCOLOR_NORMAL " %d/%d "
812+
TEXTCOLOR_RED "S" TEXTCOLOR_NORMAL " %d/%d",
813+
level.killed_monsters,
814+
(level.total_monsters + level.respawned_monsters),
815+
level.found_items, level.total_items,
816+
level.found_secrets, level.total_secrets);
817+
}
818+
819+
int x = 2, y = R_StatusBarVisible() ? statusBarY() + 1 : 24;
820+
821+
if (hud_extendedinfo == 1)
822+
{
823+
V_SetFont("DIGFONT");
824+
}
825+
hud::DrawText(x, y, ::hud_scale, hud::X_LEFT,
826+
hud::Y_BOTTOM, hud::X_LEFT, hud::Y_BOTTOM, line.c_str(), CR_GREY);
827+
V_SetFont("SMALLFONT");
828+
}
829+
792830
// [ML] 9/29/2011: New fullscreen HUD, based on Ralphis's work
793831
void OdamexHUD() {
794832
std::string buf;
@@ -968,6 +1006,10 @@ void OdamexHUD() {
9681006

9691007
// Draw gametype scoreboard
9701008
hud::drawGametype();
1009+
1010+
// Draw level stats
1011+
if (hud_extendedinfo)
1012+
hud::drawLevelStats();
9711013
}
9721014

9731015
struct drawToast_t
@@ -1528,6 +1570,10 @@ void DoomHUD()
15281570

15291571
// Draw gametype scoreboard
15301572
hud::drawGametype();
1573+
1574+
// Draw level stats
1575+
if (hud_extendedinfo)
1576+
hud::drawLevelStats();
15311577
}
15321578

15331579
}

0 commit comments

Comments
 (0)