From b3ada01bbdf5a697471dbd1ed75086d8df4a347d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 22 Dec 2012 22:37:58 +0000 Subject: [PATCH] - Added Gez's patch to show the berserk icon on the alt. HUD and added a menu option for this setting. SVN r4002 (trunk) --- src/g_shared/shared_hud.cpp | 26 +++++++++++++++++++++----- wadsrc/static/menudef.txt | 1 + 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 1c98b1808..5bdca34e7 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -78,13 +78,15 @@ CVAR (Int, hud_armor_red, 25, CVAR_ARCHIVE) // armor amount less than which CVAR (Int, hud_armor_yellow, 50, CVAR_ARCHIVE) // armor amount less than which status is yellow CVAR (Int, hud_armor_green, 100, CVAR_ARCHIVE) // armor amount above is blue, below is green +CVAR (Bool, hud_berserk_health, true, CVAR_ARCHIVE); // when found berserk pack instead of health box + CVAR (Int, hudcolor_titl, CR_YELLOW, CVAR_ARCHIVE) // color of automap title CVAR (Int, hudcolor_time, CR_RED, CVAR_ARCHIVE) // color of level/hub time CVAR (Int, hudcolor_ltim, CR_ORANGE, CVAR_ARCHIVE) // color of single level time CVAR (Int, hudcolor_ttim, CR_GOLD, CVAR_ARCHIVE) // color of total time CVAR (Int, hudcolor_xyco, CR_GREEN, CVAR_ARCHIVE) // color of coordinates -CVAR (Int, hudcolor_statnames, CR_RED, CVAR_ARCHIVE) // For the letters befóre the stats +CVAR (Int, hudcolor_statnames, CR_RED, CVAR_ARCHIVE) // For the letters before the stats CVAR (Int, hudcolor_stats, CR_GREEN, CVAR_ARCHIVE) // For the stats values themselves @@ -95,6 +97,7 @@ static FFont * IndexFont; // The font for the inventory indices // Icons static FTexture * healthpic; // Health icon +static FTexture * berserkpic; // Berserk icon (Doom only) static FTexture * fragpic; // Frags icon static FTexture * invgems[4]; // Inventory arrows @@ -267,16 +270,22 @@ static void DrawStatus(player_t * CPlayer, int x, int y) // //=========================================================================== -static void DrawHealth(int health, int x, int y) +static void DrawHealth(player_t *CPlayer, int x, int y) { + int health = CPlayer->health; + // decide on the color first int fontcolor = health < hud_health_red ? CR_RED : health < hud_health_yellow ? CR_GOLD : health <= hud_health_green ? CR_GREEN : CR_BLUE; - - DrawImageToBox(healthpic, x, y, 31, 17); + + const bool haveBerserk = hud_berserk_health + && NULL != berserkpic + && NULL != CPlayer->mo->FindInventory< APowerStrength >(); + + DrawImageToBox(haveBerserk ? berserkpic : healthpic, x, y, 31, 17); DrawHudNumber(HudFont, fontcolor, health, x + 33, y + 17); } @@ -858,7 +867,7 @@ void DrawHUD() DrawStatus(CPlayer, 5, hudheight-75); DrawFrags(CPlayer, 5, hudheight-70); } - DrawHealth(CPlayer->health, 5, hudheight-45); + DrawHealth(CPlayer, 5, hudheight-45); DrawArmor(CPlayer->mo->FindInventory(), CPlayer->mo->FindInventory(), 5, hudheight-20); i=DrawKeys(CPlayer, hudwidth-4, hudheight-10); @@ -936,6 +945,7 @@ void HUD_InitHud() default: healthpic = TexMan.FindTexture("MEDIA0"); + berserkpic = TexMan.FindTexture("PSTRA0"); HudFont=FFont::FindFont("HUDFONT_DOOM"); break; } @@ -973,6 +983,12 @@ void HUD_InitHud() FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch); if (tex.isValid()) healthpic = TexMan[tex]; } + else if (sc.Compare("Berserk")) + { + sc.MustGetString(); + FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch); + if (tex.isValid()) berserkpic = TexMan[tex]; + } else { const PClass * ti = PClass::FindClass(sc.String); diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 8f22fdfb2..55332c595 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -790,6 +790,7 @@ OptionMenu "AltHUDOptions" Option "Show monster count", "hud_showmonsters", "OnOff" Option "Show item count", "hud_showitems", "OnOff" Option "Show stamina and accuracy", "hud_showstats", "OnOff" + Option "Show berserk", "hud_berserk_health", "OnOff" Slider "Red ammo display below %", "hud_ammo_red", 0, 100, 1, 0 Slider "Yellow ammo display below %", "hud_ammo_yellow", 0, 100, 1, 0 Slider "Red health display below", "hud_health_red", 0, 100, 1, 0