Add HUD icons for timed NiGHTS powerups

This commit is contained in:
spherallic 2023-03-14 14:19:53 +01:00
parent b5c3b30f13
commit b184067048

View file

@ -108,6 +108,9 @@ static patch_t *sneakers;
static patch_t *gravboots; static patch_t *gravboots;
static patch_t *nonicon; static patch_t *nonicon;
static patch_t *nonicon2; static patch_t *nonicon2;
static patch_t *nightopianhelper;
static patch_t *linkfreeze;
static patch_t *superparaloop;
static patch_t *bluestat; static patch_t *bluestat;
static patch_t *byelstat; static patch_t *byelstat;
static patch_t *orngstat; static patch_t *orngstat;
@ -313,6 +316,10 @@ void ST_LoadGraphics(void)
nonicon2 = W_CachePatchName("NONICON2", PU_HUDGFX); nonicon2 = W_CachePatchName("NONICON2", PU_HUDGFX);
// NiGHTS HUD things // NiGHTS HUD things
nightopianhelper = W_CachePatchName("NHLPICON", PU_HUDGFX);
linkfreeze = W_CachePatchName("NLFZICON", PU_HUDGFX);
superparaloop = W_CachePatchName("NSPRICON", PU_HUDGFX);
bluestat = W_CachePatchName("BLUESTAT", PU_HUDGFX); bluestat = W_CachePatchName("BLUESTAT", PU_HUDGFX);
byelstat = W_CachePatchName("BYELSTAT", PU_HUDGFX); byelstat = W_CachePatchName("BYELSTAT", PU_HUDGFX);
orngstat = W_CachePatchName("ORNGSTAT", PU_HUDGFX); orngstat = W_CachePatchName("ORNGSTAT", PU_HUDGFX);
@ -1448,6 +1455,21 @@ void ST_drawWipeTitleCard(void)
} }
} }
#define ICONSEP (16+4) // matches weapon rings HUD
static INT32 ST_powerupHUDoffset(UINT16 timer)
{
if (timer > 7)
return ICONSEP;
else
{
UINT8 a = ICONSEP, b = 7-timer;
while (b--)
a = 2*a/3;
return a;
}
}
static void ST_drawPowerupHUD(void) static void ST_drawPowerupHUD(void)
{ {
patch_t *p = NULL; patch_t *p = NULL;
@ -1455,7 +1477,6 @@ static void ST_drawPowerupHUD(void)
INT32 offs = hudinfo[HUD_POWERUPS].x; INT32 offs = hudinfo[HUD_POWERUPS].x;
const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 0); const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 0);
static INT32 flagoffs[2] = {0, 0}, shieldoffs[2] = {0, 0}, finishoffs[2] = {0, 0}; static INT32 flagoffs[2] = {0, 0}, shieldoffs[2] = {0, 0}, finishoffs[2] = {0, 0};
#define ICONSEP (16+4) // matches weapon rings HUD
if (F_GetPromptHideHud(hudinfo[HUD_POWERUPS].y)) if (F_GetPromptHideHud(hudinfo[HUD_POWERUPS].y))
return; return;
@ -1567,15 +1588,7 @@ static void ST_drawPowerupHUD(void)
DRAWTIMERICON(invincibility, invulntime) DRAWTIMERICON(invincibility, invulntime)
} }
if (invulntime > 7) offs -= ST_powerupHUDoffset(invulntime);
offs -= ICONSEP;
else
{
UINT8 a = ICONSEP, b = 7-invulntime;
while (b--)
a = 2*a/3;
offs -= a;
}
// Super Sneakers // Super Sneakers
if (stplyr->powers[pw_sneakers] > 3*TICRATE || (stplyr->powers[pw_sneakers] && leveltime & 1)) if (stplyr->powers[pw_sneakers] > 3*TICRATE || (stplyr->powers[pw_sneakers] && leveltime & 1))
@ -1583,15 +1596,7 @@ static void ST_drawPowerupHUD(void)
DRAWTIMERICON(sneakers, stplyr->powers[pw_sneakers]) DRAWTIMERICON(sneakers, stplyr->powers[pw_sneakers])
} }
if (stplyr->powers[pw_sneakers] > 7) offs -= ST_powerupHUDoffset(stplyr->powers[pw_sneakers]);
offs -= ICONSEP;
else
{
UINT8 a = ICONSEP, b = 7-stplyr->powers[pw_sneakers];
while (b--)
a = 2*a/3;
offs -= a;
}
// Gravity Boots // Gravity Boots
if (stplyr->powers[pw_gravityboots] > 3*TICRATE || (stplyr->powers[pw_gravityboots] && leveltime & 1)) if (stplyr->powers[pw_gravityboots] > 3*TICRATE || (stplyr->powers[pw_gravityboots] && leveltime & 1))
@ -1599,6 +1604,36 @@ static void ST_drawPowerupHUD(void)
DRAWTIMERICON(gravboots, stplyr->powers[pw_gravityboots]) DRAWTIMERICON(gravboots, stplyr->powers[pw_gravityboots])
} }
offs -= ST_powerupHUDoffset(stplyr->powers[pw_gravityboots]);
// --------------------
// NiGHTS timer-based powerups
// --------------------
// Nightopian Helper
if (stplyr->powers[pw_nights_helper] > 3*TICRATE || (stplyr->powers[pw_nights_helper] && leveltime & 1))
{
DRAWTIMERICON(nightopianhelper, stplyr->powers[pw_nights_helper])
}
offs -= ST_powerupHUDoffset(stplyr->powers[pw_nights_helper]);
// Link Freeze
if (stplyr->powers[pw_nights_linkfreeze] > 3*TICRATE || (stplyr->powers[pw_nights_linkfreeze] && leveltime & 1))
{
DRAWTIMERICON(linkfreeze, stplyr->powers[pw_nights_linkfreeze])
}
offs -= ST_powerupHUDoffset(stplyr->powers[pw_nights_linkfreeze]);
// Super Paraloop
if (stplyr->powers[pw_nights_superloop] > 3*TICRATE || (stplyr->powers[pw_nights_superloop] && leveltime & 1))
{
DRAWTIMERICON(superparaloop, stplyr->powers[pw_nights_superloop])
}
//offs -= ST_powerupHUDoffset(stplyr->powers[pw_nights_superloop]);
#undef DRAWTIMERICON #undef DRAWTIMERICON
#undef ICONSEP #undef ICONSEP
} }
@ -2740,8 +2775,6 @@ static void ST_overlayDrawer(void)
} }
// This is where we draw all the fun cheese if you have the chasecam off! // This is where we draw all the fun cheese if you have the chasecam off!
if (!(maptol & TOL_NIGHTS))
{
if ((stplyr == &players[displayplayer] && !camera.chase) if ((stplyr == &players[displayplayer] && !camera.chase)
|| ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase)) || ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase))
{ {
@ -2751,7 +2784,7 @@ static void ST_overlayDrawer(void)
} }
else if (cv_powerupdisplay.value == 2) else if (cv_powerupdisplay.value == 2)
ST_drawPowerupHUD(); // same as it ever was... ST_drawPowerupHUD(); // same as it ever was...
}
} }
else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2) else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2)
ST_drawPowerupHUD(); // same as it ever was... ST_drawPowerupHUD(); // same as it ever was...