Skip to content

Commit

Permalink
Adding Crispy-Hud for Hexen and align Heretic Crispy-Hud (#1236)
Browse files Browse the repository at this point in the history
* 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:
#1234

* Restructuered DrawFullScreenStuff in sb_bar.c

Added "return" in crispy hud condition to keep indentation of original code intact.

* Adding rough Hexen crispy HUD

First rough version of Hexen crispy HUD, without shifting widgets or considering widescreendelta.

* Refine Hexen Crispy Hud

Shift widgets to the left and right, make it align with aspect ratio, fixing indentation.

* Shifting down Hexen Crispy Hud

Shifting down Hexen Crispy Hud by 7px. Cleanup comments.

* Refinement Hexen Crispy Hud

Shifting up by 1px again, shifting item widget to the left instead of right.

* Cirspy Hexen Hud - Inventory Bar Refinement

Only draw health and ammo widget once the inventory is open.

* Intersect check for Hexen Crispy Hud

Display frags even when inventory open, adding intersect check between ManaPatch2 and Gem1.

* Fix Hexen Crispy-Hud Item-Alignment

Fix Hexen Crispy-Hud Item-Alignment to match standard HUD.

* Align Heretic Crispy-HUD Bar with Hexen

To be consistent with the Hexen Crispy-Hud:
- Align height of Heretic HUD Item Selection Bar with vanilla fullscreen hud
- Don't draw Ammo and Jewels when Gem2 overlaps with Jewels

* Fixing PatchSELECTBOX Pos for Hexen Crispy-Hud

Fixing PatchSELECTBOX Pos for Hexen Crispy-Hud by moving it 2px to the left to align with non-fullscreen standard hud.
  • Loading branch information
Noseey authored Nov 21, 2024
1 parent 5fe5332 commit f665d01
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 32 deletions.
70 changes: 42 additions & 28 deletions src/heretic/sb_bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,13 @@ void DrawFullScreenStuff(void)
// TODO Do not always render, only if update needed
if(screenblocks == 12)
{
int xPosGem2;
int xPosKeys;

xPosGem2 = 270;
xPosKeys = 214 + WIDESCREENDELTA;

// Health
temp = CPlayer->mo->health;
if (temp > 0)
{
Expand All @@ -1070,30 +1077,9 @@ void DrawFullScreenStuff(void)
{
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);
// Frags
if (deathmatch)
{
temp = 0;
Expand All @@ -1106,6 +1092,7 @@ void DrawFullScreenStuff(void)
}
DrINumber(temp, 5 - WIDESCREENDELTA, 165);
}
// Items, Itemflash and Selection Bar
if (!inventory)
{
if (ArtifactFlash)
Expand All @@ -1126,29 +1113,56 @@ void DrawFullScreenStuff(void)
x = inv_ptr - curpos;
for (i = 0; i < 7; i++)
{
V_DrawPatch(50 + i * 31, 170,
V_DrawPatch(50 + i * 31, 168,
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,
V_DrawPatch(50 + i * 31, 168,
W_CacheLumpName(patch, PU_CACHE));
DrSmallNumber(CPlayer->inventory[x + i].count, 69 + i * 31,
192);
190);
}
}
V_DrawPatch(50 + curpos * 31, 199, PatchSELECTBOX);
V_DrawPatch(50 + curpos * 31, 197, PatchSELECTBOX);
if (x != 0)
{
V_DrawPatch(38, 169, !(leveltime & 4) ? PatchINVLFGEM1 :
V_DrawPatch(38, 167, !(leveltime & 4) ? PatchINVLFGEM1 :
PatchINVLFGEM2);
}
if (CPlayer->inventorySlotNum - x > 7)
{
V_DrawPatch(269, 169, !(leveltime & 4) ?
V_DrawPatch(xPosGem2, 167, !(leveltime & 4) ?
PatchINVRTGEM1 : PatchINVRTGEM2);
}
// Check for Intersect
if (xPosGem2 + 10 >= xPosKeys)
{
return; // Stop drawing further widgets
}
}
// 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(xPosKeys, 174, W_CacheLumpName(DEH_String("ykeyicon"), PU_CACHE));
}
if (CPlayer->keys[key_green])
{
V_DrawPatch(xPosKeys, 182, W_CacheLumpName(DEH_String("gkeyicon"), PU_CACHE));
}
if (CPlayer->keys[key_blue])
{
V_DrawPatch(xPosKeys, 190, W_CacheLumpName(DEH_String("bkeyicon"), PU_CACHE));
}
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/hexen/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,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);
}
Expand Down Expand Up @@ -1569,7 +1569,7 @@ static void SCScreenSize(int option)
{
if (option == RIGHT_DIR)
{
if (screenblocks < 11)
if (screenblocks < 12)
{
screenblocks++;
}
Expand All @@ -1578,7 +1578,7 @@ static void SCScreenSize(int option)
{
screenblocks--;
}
R_SetViewSize(screenblocks, detailLevel);
R_SetViewSize(BETWEEN(3, 11, screenblocks), detailLevel);
}

//---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/hexen/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ void R_Init(void)
R_InitPointToAngle();
R_InitTables();
// viewwidth / viewheight / detailLevel are set by the defaults
R_SetViewSize(screenblocks, detailLevel);
R_SetViewSize(BETWEEN(3, 11, screenblocks), detailLevel);
R_InitPlanes();
R_InitLightTables();
R_InitSkyMap();
Expand Down
223 changes: 223 additions & 0 deletions src/hexen/sb_bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,229 @@ void DrawFullScreenStuff(void)
int temp;

UpdateState |= I_FULLSCRN;
// [crispy] Crispy Hud
// TODO Do not always render, only if update needed
if(screenblocks == 12)
{
int j, k;
int xPosGem1;
int xPosManaPatch2;
patch_t *manaPatch1, *manaPatch2;
patch_t *manaVialPatch1, *manaVialPatch2;

manaPatch1 = NULL;
manaPatch2 = NULL;
manaVialPatch1 = NULL;
manaVialPatch2 = NULL;
xPosGem1 = 40;
xPosManaPatch2 = 75 - WIDESCREENDELTA;

// Health
temp = CPlayer->mo->health;
if (temp >= 25)
{
DrINumber(temp, 5 - WIDESCREENDELTA, 182);
}
else
{
DrRedINumber(temp, 5 - WIDESCREENDELTA, 182);
}
// Armor
temp = AutoArmorSave[CPlayer->class]
+ CPlayer->armorpoints[ARMOR_ARMOR] +
CPlayer->armorpoints[ARMOR_SHIELD] +
CPlayer->armorpoints[ARMOR_HELMET] +
CPlayer->armorpoints[ARMOR_AMULET];
oldarmor = temp;
DrINumber(FixedDiv(temp, 5 * FRACUNIT) >> FRACBITS, 288 + WIDESCREENDELTA, 182);
// Frags
if (deathmatch)
{
temp = 0;
for (i = 0; i < maxplayers; i++)
{
if (playeringame[i])
{
temp += CPlayer->frags[i];
}
}
DrINumber(temp, 5 - WIDESCREENDELTA, 165);
}
// Items, Itemflash and Selection Bar
if (!inventory)
{
if (ArtifactFlash)
{
V_DrawPatch(113 - WIDESCREENDELTA, 170, W_CacheLumpNum(W_GetNumForName("useartia")
+ ArtifactFlash - 1, PU_CACHE));
ArtifactFlash--;
}
else if (CPlayer->readyArtifact > 0)
{
V_DrawPatch(108 - WIDESCREENDELTA, 169,
W_CacheLumpName(patcharti[CPlayer->readyArtifact],
PU_CACHE));
if (CPlayer->inventory[inv_ptr].count > 1)
{
DrSmallNumber(CPlayer->inventory[inv_ptr].count, 127 - WIDESCREENDELTA, 190);
}
}
}
else
{
x = inv_ptr - curpos;
for (i = 0; i < 7; i++)
{
V_DrawPatch(50 + i * 31, 168, W_CacheLumpName("ARTIBOX",
PU_CACHE));
if (CPlayer->inventorySlotNum > x + i
&& CPlayer->inventory[x + i].type != arti_none)
{
V_DrawPatch(48 + i * 31, 167,
W_CacheLumpName(patcharti
[CPlayer->inventory[x + i].type],
PU_CACHE));
if (CPlayer->inventory[x + i].count > 1)
{
DrSmallNumber(CPlayer->inventory[x + i].count,
66 + i * 31, 189);
}
}
}
V_DrawPatch(48 + curpos * 31, 167, PatchSELECTBOX);
if (x != 0)
{
V_DrawPatch(xPosGem1, 167, !(leveltime & 4) ? PatchINVLFGEM1 :
PatchINVLFGEM2);
}
if (CPlayer->inventorySlotNum - x > 7)
{
V_DrawPatch(268, 167, !(leveltime & 4) ?
PatchINVRTGEM1 : PatchINVRTGEM2);
}
// Check for Intersect
if (xPosManaPatch2 + 15 >= xPosGem1)
{
return; // Stop drawing further widgets
}
}
// Mana
temp = CPlayer->mana[0];
DrSmallNumber(temp, 44 - WIDESCREENDELTA, 187);
manaVialPatch1 = (patch_t *) 1; // force a vial update
if (temp == 0)
{ // Draw Dim Mana icon
manaPatch1 = PatchMANADIM1;
}
else if (oldmana1 == 0)
{
manaPatch1 = PatchMANABRIGHT1;
}
temp = CPlayer->mana[1];
DrSmallNumber(temp, 76 - WIDESCREENDELTA, 187);
manaVialPatch1 = (patch_t *) 1; // force a vial update
if (temp == 0)
{ // Draw Dim Mana icon
manaPatch2 = PatchMANADIM2;
}
else if (oldmana2 == 0)
{
manaPatch2 = PatchMANABRIGHT2;
}
// Update mana graphics based upon mana count/weapon type
if (CPlayer->readyweapon == WP_FIRST)
{
manaPatch1 = PatchMANADIM1;
manaPatch2 = PatchMANADIM2;
manaVialPatch1 = PatchMANAVIALDIM1;
manaVialPatch2 = PatchMANAVIALDIM2;
}
else if (CPlayer->readyweapon == WP_SECOND)
{
if (!manaPatch1)
{
manaPatch1 = PatchMANABRIGHT1;
}
manaVialPatch1 = PatchMANAVIAL1;
manaPatch2 = PatchMANADIM2;
manaVialPatch2 = PatchMANAVIALDIM2;
}
else if (CPlayer->readyweapon == WP_THIRD)
{
manaPatch1 = PatchMANADIM1;
manaVialPatch1 = PatchMANAVIALDIM1;
if (!manaPatch2)
{
manaPatch2 = PatchMANABRIGHT2;
}
manaVialPatch2 = PatchMANAVIAL2;
}
else
{
manaVialPatch1 = PatchMANAVIAL1;
manaVialPatch2 = PatchMANAVIAL2;
if (!manaPatch1)
{
manaPatch1 = PatchMANABRIGHT1;
}
if (!manaPatch2)
{
manaPatch2 = PatchMANABRIGHT2;
}
}
V_DrawPatch(42 - WIDESCREENDELTA, 170, manaPatch1);
V_DrawPatch(xPosManaPatch2, 170, manaPatch2);
V_DrawPatch(59 - WIDESCREENDELTA, 170, manaVialPatch1);
for (i = 171; i < 193 - (22 * CPlayer->mana[0]) / MAX_MANA; i++)
{
for (j = 0; j <= crispy->hires; j++)
for (k = 0; k <= crispy->hires; k++)
{
I_VideoBuffer[SCREENWIDTH * ((i << crispy->hires) + j)
+ (60 << crispy->hires) + k] = 0;
I_VideoBuffer[SCREENWIDTH * ((i << crispy->hires) + j)
+ (61 << crispy->hires) + k] = 0;
I_VideoBuffer[SCREENWIDTH * ((i << crispy->hires) + j)
+ (62 << crispy->hires) + k] = 0;
}
}
V_DrawPatch(67 - WIDESCREENDELTA, 170, manaVialPatch2);
for (i = 171; i < 193 - (22 * CPlayer->mana[1]) / MAX_MANA; i++)
{
for (j = 0; j <= crispy->hires; j++)
for (k = 0; k <= crispy->hires; k++)
{
I_VideoBuffer[SCREENWIDTH * ((i << crispy->hires) + j)
+ (68 << crispy->hires) + k] = 0;
I_VideoBuffer[SCREENWIDTH * ((i << crispy->hires) + j)
+ (69 << crispy->hires) + k] = 0;
I_VideoBuffer[SCREENWIDTH * ((i << crispy->hires) + j)
+ (70 << crispy->hires) + k] = 0;
}
}
// Weapon Pieces
if (CPlayer->pieces == 7)
{
V_DrawPatch(228 + WIDESCREENDELTA, 168, PatchWEAPONFULL);
}
else
{
V_DrawPatch(228 + WIDESCREENDELTA, 168, PatchWEAPONSLOT);
if (CPlayer->pieces & WPIECE1)
{
V_DrawPatch(PieceX[PlayerClass[consoleplayer]][0] + 38 + WIDESCREENDELTA, 168, PatchPIECE1);
}
if (CPlayer->pieces & WPIECE2)
{
V_DrawPatch(PieceX[PlayerClass[consoleplayer]][1] + 38 + WIDESCREENDELTA, 168, PatchPIECE2);
}
if (CPlayer->pieces & WPIECE3)
{
V_DrawPatch(PieceX[PlayerClass[consoleplayer]][2] + 38 + WIDESCREENDELTA, 168, PatchPIECE3);
}
}
return;
}
if (CPlayer->mo->health > 0)
{
DrBNumber(CPlayer->mo->health, 5, 180);
Expand Down

0 comments on commit f665d01

Please sign in to comment.