From e4add0d07a30c3c405a3029f627e825cbd8c3bd0 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 10 Mar 2023 12:03:35 +0100 Subject: [PATCH] always draw demo status bar with the lightest and darkest color available Fixes visibility in Tetanus --- src/hu_stuff.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 9262ecff..303359e5 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -380,6 +380,16 @@ static char* ColorByHealth(int health, int maxhealth, boolean invul) return colrngs[CR_BLUE]; } +static int lightest_color, darkest_color; + +static void HU_InitDemoProgressBar (void) +{ + byte *playpal = W_CacheLumpName("PLAYPAL", PU_STATIC); + + lightest_color = I_GetPaletteIndex(playpal, 0xFF, 0xFF, 0xFF); + darkest_color = I_GetPaletteIndex(playpal, 0x00, 0x00, 0x00); +} + // // HU_Init() // @@ -481,6 +491,8 @@ void HU_Init(void) // [FG] support crosshair patches from extras.wad HU_InitCrosshair(); + HU_InitDemoProgressBar(); + HU_ParseHUD(); // [Woof!] prepare player messages for colorization @@ -1340,8 +1352,8 @@ boolean HU_DemoProgressBar(boolean force) return false; } - V_DrawHorizLine(0, SCREENHEIGHT - 2, FG, progress, colormaps[0][0]); // [crispy] black - V_DrawHorizLine(0, SCREENHEIGHT - 1, FG, progress, colormaps[0][4]); // [crispy] white + V_DrawHorizLine(0, SCREENHEIGHT - 2, FG, progress, darkest_color); + V_DrawHorizLine(0, SCREENHEIGHT - 1, FG, progress, lightest_color); return true; }