- added option to show the level stats on the automap.

This commit is contained in:
Christoph Oelckers 2022-10-15 16:37:12 +02:00
parent 0f5d66a4a7
commit b202cf7a12
8 changed files with 79 additions and 41 deletions

View file

@ -179,7 +179,10 @@ CUSTOM_CVARD(Float, hud_statscale, 0.5, CVAR_ARCHIVE, "change the scale of the s
} }
CVARD(Bool, hud_stats, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable level statistics display") CUSTOM_CVARD(Int, hud_stats, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable level statistics display")
{
if (self < 0 || self > 3) self = 0;
}
CVARD(Bool, hud_showmapname, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable map name display on load") CVARD(Bool, hud_showmapname, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable map name display on load")
CVARD(Bool, hud_position, false, CVAR_ARCHIVE, "aligns the status bar to the bottom/top") CVARD(Bool, hud_position, false, CVAR_ARCHIVE, "aligns the status bar to the bottom/top")
CVARD(Bool, hud_bgstretch, false, CVAR_ARCHIVE, "enable/disable background image stretching in wide resolutions") CVARD(Bool, hud_bgstretch, false, CVAR_ARCHIVE, "enable/disable background image stretching in wide resolutions")

View file

@ -59,7 +59,6 @@ EXTERN_CVAR(Int, hud_size)
EXTERN_CVAR(Float, hud_statscale) EXTERN_CVAR(Float, hud_statscale)
EXTERN_CVAR(Int, hud_custom) EXTERN_CVAR(Int, hud_custom)
EXTERN_CVAR(Bool, hud_stats)
EXTERN_CVAR(Bool, hud_showmapname) EXTERN_CVAR(Bool, hud_showmapname)
EXTERN_CVAR(Bool, hud_position) EXTERN_CVAR(Bool, hud_position)
EXTERN_CVAR(Bool, hud_bgstretch) EXTERN_CVAR(Bool, hud_bgstretch)

View file

@ -1227,6 +1227,7 @@ OptionMenu "AutomapOptions"
Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff"
Slider "$AUTOMAPMNU_LINEALPHA", "am_linealpha", 0.1, 1.0, 0.1, 1 Slider "$AUTOMAPMNU_LINEALPHA", "am_linealpha", 0.1, 1.0, 0.1, 1
Slider "$AUTOMAPMNU_LINETHICKNESS", "am_linethickness", 1, 8, 1, 0 Slider "$AUTOMAPMNU_LINETHICKNESS", "am_linethickness", 1, 8, 1, 0
StaticText ""
// todo: // todo:
//CVAR(Bool, am_textfont, false, CVAR_ARCHIVE) //CVAR(Bool, am_textfont, false, CVAR_ARCHIVE)
@ -1293,6 +1294,14 @@ OptionValue CrosshairHealthTypes
2.0, "$OPTVAL_YES_ENHANCED" 2.0, "$OPTVAL_YES_ENHANCED"
} }
OptionValue HudStats
{
0.0, "$OPTVAL_OFF"
1.0, "$OPTVAL_HUD"
2.0, "$OPTVAL_AUTOMAP"
3.0, "$OPTVAL_HUDANDMAP"
}
OptionMenu "HUDOptions" protected OptionMenu "HUDOptions" protected
{ {
Title "$OPTMNU_HUD" Title "$OPTMNU_HUD"
@ -1300,7 +1309,7 @@ OptionMenu "HUDOptions" protected
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 9.0, 1.0, -1 Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 9.0, 1.0, -1
Slider "$DSPLYMNU_SBSCALE", "hud_scalefactor", 0.36, 1.0, 0.04, 2 Slider "$DSPLYMNU_SBSCALE", "hud_scalefactor", 0.36, 1.0, 0.04, 2
StaticText "" StaticText ""
Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "OnOff" Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "HudStats"
Slider "$DSPLYMNU_STATSCALE", "hud_statscale", 0.36, 1.0, 0.04, 2 Slider "$DSPLYMNU_STATSCALE", "hud_statscale", 0.36, 1.0, 0.04, 2
StaticText "" StaticText ""

View file

@ -139,24 +139,28 @@ class BloodStatusBar : RazeStatusBar
stats.fontscale = 1.; stats.fontscale = 1.;
stats.screenbottomspace = bottomy; stats.screenbottomspace = bottomy;
stats.statfont = SmallFont;
stats.letterColor = TEXTCOLOR_DARKRED; stats.letterColor = TEXTCOLOR_DARKRED;
stats.standardColor = TEXTCOLOR_DARKGRAY; stats.standardColor = TEXTCOLOR_DARKGRAY;
int y = -1;
int mask = 1;
if (automapMode == am_full) if (automapMode == am_full)
{ {
stats.statfont = SmallFont2; stats.statfont = SmallFont2;
stats.spacing = 6; stats.spacing = 6;
stats.altspacing = SmallFont.GetHeight() + 2; stats.altspacing = SmallFont.GetHeight() + 2;
if (hud_size <= Hud_StbarOverlay) stats.screenbottomspace = 56; if (hud_size <= Hud_StbarOverlay) stats.screenbottomspace = 56;
PrintAutomapInfo(stats, false); y = PrintAutomapInfo(stats, summary, false);
mask = 2;
} }
if (automapMode == am_off && hud_stats) // Blood does not use am_overlay.
if (hud_stats & mask)
{ {
stats.statfont = SmallFont;
stats.completeColor = TEXTCOLOR_DARKGREEN; stats.completeColor = TEXTCOLOR_DARKGREEN;
stats.spacing = SmallFont.GetHeight() + 2; stats.spacing = SmallFont.GetHeight() + 2;
PrintLevelStats(stats, summary); PrintLevelStats(stats, summary, y);
} }
} }

View file

@ -164,14 +164,9 @@ class DukeCommonStatusBar : RazeStatusBar
StatsPrintInfo stats; StatsPrintInfo stats;
stats.fontscale = Raze.isRR() ? 0.5 : 1.; stats.fontscale = Raze.isRR() ? 0.5 : 1.;
stats.screenbottomspace = bottomy; stats.screenbottomspace = bottomy;
stats.statfont = SmallFont;
if (Raze.isNamWW2GI())
{
// The stock font of these games is totally unusable for this.
stats.statfont = ConFont;
stats.spacing = ConFont.GetHeight() + 1;
}
int y = -1;
int mask = 1;
if (automapMode == am_full) if (automapMode == am_full)
{ {
stats.statfont = SmallFont2; stats.statfont = SmallFont2;
@ -182,13 +177,16 @@ class DukeCommonStatusBar : RazeStatusBar
stats.standardColor = Font.TEXTCOLOR_UNTRANSLATED; stats.standardColor = Font.TEXTCOLOR_UNTRANSLATED;
stats.letterColor = Font.TEXTCOLOR_GOLD; stats.letterColor = Font.TEXTCOLOR_GOLD;
PrintAutomapInfo(stats, false); y = PrintAutomapInfo(stats, info, false);
mask = 2;
} }
else if (hud_stats) if (hud_stats & mask)
{ {
stats.statfont = SmallFont;
stats.letterColor = Font.TEXTCOLOR_ORANGE; stats.letterColor = Font.TEXTCOLOR_ORANGE;
if (Raze.isNamWW2GI()) if (Raze.isNamWW2GI())
{ {
stats.statfont = ConFont;
stats.spacing = 8; stats.spacing = 8;
stats.standardColor = Font.TEXTCOLOR_YELLOW; stats.standardColor = Font.TEXTCOLOR_YELLOW;
stats.completeColor = Font.TEXTCOLOR_FIRE; stats.completeColor = Font.TEXTCOLOR_FIRE;
@ -205,7 +203,7 @@ class DukeCommonStatusBar : RazeStatusBar
stats.standardColor = stats.standardColor =
stats.completeColor = Font.TEXTCOLOR_UNTRANSLATED; stats.completeColor = Font.TEXTCOLOR_UNTRANSLATED;
} }
PrintLevelStats(stats, info); PrintLevelStats(stats, info, y);
} }
} }

View file

@ -455,19 +455,22 @@ class ExhumedStatusBar : RazeStatusBar
stats.fontscale = 1.; stats.fontscale = 1.;
stats.altspacing = stats.spacing = SmallFont.GetHeight(); stats.altspacing = stats.spacing = SmallFont.GetHeight();
stats.screenbottomspace = bottomy; stats.screenbottomspace = bottomy;
stats.statfont = SmallFont;
stats.letterColor = TEXTCOLOR_RED; stats.letterColor = TEXTCOLOR_RED;
stats.standardColor = TEXTCOLOR_UNTRANSLATED; stats.standardColor = TEXTCOLOR_UNTRANSLATED;
int y = -1;
int mask = 1;
if (automapMode == am_full) if (automapMode == am_full)
{ {
stats.statfont = Raze.PickSmallFont(); stats.statfont = Raze.PickSmallFont();
PrintAutomapInfo(stats, true); y = PrintAutomapInfo(stats, summary, true);
mask = 2;
} }
else if (automapMode == am_off && hud_stats) if (hud_stats & mask)
{ {
stats.statfont = SmallFont;
stats.completeColor = TEXTCOLOR_DARKGREEN; stats.completeColor = TEXTCOLOR_DARKGREEN;
PrintLevelStats(stats, summary); PrintLevelStats(stats, summary, y);
} }
} }

View file

@ -892,10 +892,10 @@ class SWStatusBar : RazeStatusBar
{ {
StatsPrintInfo stats; StatsPrintInfo stats;
stats.fontscale = 1; stats.fontscale = 1;
stats.spacing = 7;
stats.screenbottomspace = bottomy; stats.screenbottomspace = bottomy;
stats.statfont = SmallFont;
int y = -1;
int mask = 1;
if (automapMode == am_full) if (automapMode == am_full)
{ {
stats.letterColor = Font.TEXTCOLOR_SAPPHIRE; stats.letterColor = Font.TEXTCOLOR_SAPPHIRE;
@ -904,15 +904,17 @@ class SWStatusBar : RazeStatusBar
stats.statfont = SmallFont2; stats.statfont = SmallFont2;
stats.spacing = 6; stats.spacing = 6;
stats.altspacing = SmallFont.GetHeight() + 1; stats.altspacing = SmallFont.GetHeight() + 1;
PrintAutomapInfo(stats, false); y = PrintAutomapInfo(stats, info, false);
mask = 2;
} }
// JBF 20040124: display level stats in screen corner if (hud_stats & mask)
else if (hud_stats && !(netgame /*|| numplayers > 1*/))
{ {
stats.statfont = SmallFont;
stats.spacing = 7;
stats.letterColor = Font.TEXTCOLOR_RED; stats.letterColor = Font.TEXTCOLOR_RED;
stats.standardColor = Font.TEXTCOLOR_TAN; stats.standardColor = Font.TEXTCOLOR_TAN;
stats.completeColor = Font.TEXTCOLOR_FIRE; stats.completeColor = Font.TEXTCOLOR_FIRE;
PrintLevelStats(stats, info); PrintLevelStats(stats, info, y);
} }
} }

View file

@ -43,13 +43,14 @@ class RazeStatusBar : StatusBarCore
// //
//============================================================================ //============================================================================
void PrintLevelStats(StatsPrintInfo info, SummaryInfo stats) void PrintLevelStats(StatsPrintInfo info, SummaryInfo stats, double y = -1)
{ {
double y;
double scale = info.fontscale * hud_statscale; double scale = info.fontscale * hud_statscale;
if (info.spacing <= 0) info.spacing = info.statfont.GetHeight() * info.fontscale; if (info.spacing <= 0) info.spacing = info.statfont.GetHeight() * info.fontscale;
double spacing = info.spacing * hud_statscale; double spacing = info.spacing * hud_statscale;
if (y < 0)
{
if (hud_size == Hud_Nothing) if (hud_size == Hud_Nothing)
{ {
y = 198 - spacing; y = 198 - spacing;
@ -62,6 +63,7 @@ class RazeStatusBar : StatusBarCore
{ {
y = 200 - info.screenbottomspace * hud_scalefactor - spacing; y = 200 - info.screenbottomspace * hud_scalefactor - spacing;
} }
}
double y1, y2, y3; double y1, y2, y3;
@ -109,7 +111,7 @@ class RazeStatusBar : StatusBarCore
// //
//============================================================================ //============================================================================
void PrintAutomapInfo(StatsPrintInfo info, bool forcetextfont = false) int PrintAutomapInfo(StatsPrintInfo info, SummaryInfo stats, bool forcetextfont = false)
{ {
let TEXTCOLOR_ESCAPESTR = "\034"; let TEXTCOLOR_ESCAPESTR = "\034";
let lev = currentLevel; let lev = currentLevel;
@ -145,9 +147,19 @@ class RazeStatusBar : StatusBarCore
double y; double y;
double st_y = -1;
if (am_nameontop) if (am_nameontop)
{ {
y = spacing + 1; y = spacing + 1;
if (info.screenbottomspace < 0)
{
st_y = (200 - RelTop) * hud_scalefactor - spacing;
}
else
{
st_y = 200 - info.screenbottomspace * hud_scalefactor - spacing;
}
} }
else if (info.screenbottomspace < 0) else if (info.screenbottomspace < 0)
{ {
@ -163,8 +175,16 @@ class RazeStatusBar : StatusBarCore
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true); DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true);
y -= spacing; y -= spacing;
if (volname.length() > 0) if (volname.length() > 0)
{
Screen.DrawText(myfont, Font.CR_UNTRANSLATED, 2 * hud_statscale, y, volname, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, Screen.DrawText(myfont, Font.CR_UNTRANSLATED, 2 * hud_statscale, y, volname, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true); DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true);
y -= spacing;
}
if (!am_nameontop)
{
st_y = y;
}
return st_y;
} }
//============================================================================ //============================================================================