From 5fe53320ae3e07a106c27b7b46282d8efc490378 Mon Sep 17 00:00:00 2001 From: Noseey Date: Tue, 5 Nov 2024 09:57:34 +0100 Subject: [PATCH] Adding Crispy-Hud for Heretic (#1234) * Updated Crispy Hud Raw Version of Crispy Hud * Alignment Keys and Armor in Fullscreen Hud Alignment Keys and Armor in Fullscreen Hud * Update Comment Update Comment * Expanding Screenblocks to 12 Expanding Screenblocks to 12. * Removal of unnecessary files. Removal of unnecessary files. * Delete .project * Conservative Crispy Hud Conservative Crispy Hud with moved jewels between Item and Ammo, height of widgets from the original hud. * Adjusted Jewels Adjusted Jewels with original spacing to item * Update sb_bar.c to fix height of item selector Update sb_bar.c to fix height of item selector * Update sb_bar.c Cleanup comments and use non-transparent patch for item selector background. * Update sb_bar.c Move Frags to be visible above health. * Update sb_bar.c Moving Hud down by 10px * Fixing Findings for Pull-Request #1234 Fixing Findings for Pull-Request #1234 Crispy-Hud: https://github.com/fabiangreffrath/crispy-doom/pull/1234 * Restructuered DrawFullScreenStuff in sb_bar.c Added "return" in crispy hud condition to keep indentation of original code intact. --- src/heretic/mn_menu.c | 6 +-- src/heretic/r_main.c | 2 +- src/heretic/sb_bar.c | 95 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 4 deletions(-) diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 0ae7d94ae..f527d3c7f 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -1125,7 +1125,7 @@ static void DrawOptionsMenu(void) static void DrawOptions2Menu(void) { - DrawSlider(&Options2Menu, 1, 9, screenblocks - 3); + DrawSlider(&Options2Menu, 1, 9, BETWEEN(3, 11, screenblocks) - 3); DrawSlider(&Options2Menu, 3, 16, snd_MaxVolume); DrawSlider(&Options2Menu, 5, 16, snd_MusicVolume); } @@ -1531,7 +1531,7 @@ static boolean SCScreenSize(int option) { if (option == RIGHT_DIR) { - if (screenblocks < 11) + if (screenblocks < 12) { screenblocks++; } @@ -1540,7 +1540,7 @@ static boolean SCScreenSize(int option) { screenblocks--; } - R_SetViewSize(screenblocks, detailLevel); + R_SetViewSize(BETWEEN(3, 11, screenblocks), detailLevel); return true; } diff --git a/src/heretic/r_main.c b/src/heretic/r_main.c index 4846eefb2..b8e793eba 100644 --- a/src/heretic/r_main.c +++ b/src/heretic/r_main.c @@ -840,7 +840,7 @@ void R_Init(void) R_InitTables(); // viewwidth / viewheight / detailLevel are set by the defaults printf ("."); - R_SetViewSize(screenblocks, detailLevel); + R_SetViewSize(BETWEEN(3, 11, screenblocks), detailLevel); //tprintf("R_InitPlanes\n", 0); R_InitPlanes(); printf ("."); diff --git a/src/heretic/sb_bar.c b/src/heretic/sb_bar.c index 426509613..3499eaa21 100644 --- a/src/heretic/sb_bar.c +++ b/src/heretic/sb_bar.c @@ -1057,6 +1057,101 @@ void DrawFullScreenStuff(void) int temp; UpdateState |= I_FULLSCRN; + // [crispy] Crispy Hud + // TODO Do not always render, only if update needed + if(screenblocks == 12) + { + temp = CPlayer->mo->health; + if (temp > 0) + { + DrINumber(temp, 5 - WIDESCREENDELTA, 180); + } + else + { + DrINumber(0, 5 - WIDESCREENDELTA, 180); + } + // Ammo + temp = CPlayer->ammo[wpnlev1info[CPlayer->readyweapon].ammo]; + if (temp && CPlayer->readyweapon > 0 && CPlayer->readyweapon < 7) + { + V_DrawPatch(55 - WIDESCREENDELTA, 182, + W_CacheLumpName(DEH_String(ammopic[CPlayer->readyweapon - 1]), + PU_CACHE)); + DrINumber(temp, 53 - WIDESCREENDELTA, 172); + } + // Keys + if (CPlayer->keys[key_yellow]) + { + V_DrawPatch(214 + WIDESCREENDELTA, 174, W_CacheLumpName(DEH_String("ykeyicon"), PU_CACHE)); + } + if (CPlayer->keys[key_green]) + { + V_DrawPatch(214 + WIDESCREENDELTA, 182, W_CacheLumpName(DEH_String("gkeyicon"), PU_CACHE)); + } + if (CPlayer->keys[key_blue]) + { + V_DrawPatch(214 + WIDESCREENDELTA, 190, W_CacheLumpName(DEH_String("bkeyicon"), PU_CACHE)); + } + // Armor + DrINumber(CPlayer->armorpoints, 286 + WIDESCREENDELTA, 180); + if (deathmatch) + { + temp = 0; + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i]) + { + temp += CPlayer->frags[i]; + } + } + DrINumber(temp, 5 - WIDESCREENDELTA, 165); + } + if (!inventory) + { + if (ArtifactFlash) + { + temp = W_GetNumForName(DEH_String("useartia")) + ArtifactFlash - 1; + V_DrawPatch(243 + WIDESCREENDELTA, 171, W_CacheLumpNum(temp, PU_CACHE)); + ArtifactFlash--; + } + else if (CPlayer->readyArtifact > 0) + { + patch = DEH_String(patcharti[CPlayer->readyArtifact]); + V_DrawPatch(240 + WIDESCREENDELTA, 170, W_CacheLumpName(patch, PU_CACHE)); + DrSmallNumber(CPlayer->inventory[inv_ptr].count, 262 + WIDESCREENDELTA, 192); + } + } + else + { + x = inv_ptr - curpos; + for (i = 0; i < 7; i++) + { + V_DrawPatch(50 + i * 31, 170, + W_CacheLumpName(DEH_String("ARTIBOX"), PU_CACHE)); + if (CPlayer->inventorySlotNum > x + i + && CPlayer->inventory[x + i].type != arti_none) + { + patch = DEH_String(patcharti[CPlayer->inventory[x + i].type]); + V_DrawPatch(50 + i * 31, 170, + W_CacheLumpName(patch, PU_CACHE)); + DrSmallNumber(CPlayer->inventory[x + i].count, 69 + i * 31, + 192); + } + } + V_DrawPatch(50 + curpos * 31, 199, PatchSELECTBOX); + if (x != 0) + { + V_DrawPatch(38, 169, !(leveltime & 4) ? PatchINVLFGEM1 : + PatchINVLFGEM2); + } + if (CPlayer->inventorySlotNum - x > 7) + { + V_DrawPatch(269, 169, !(leveltime & 4) ? + PatchINVRTGEM1 : PatchINVRTGEM2); + } + } + return; + } if (CPlayer->mo->health > 0) { DrBNumber(CPlayer->mo->health, 5, 180);