mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Add HUD icons for timed NiGHTS powerups
This commit is contained in:
parent
b5c3b30f13
commit
b184067048
1 changed files with 61 additions and 28 deletions
|
@ -108,6 +108,9 @@ static patch_t *sneakers;
|
|||
static patch_t *gravboots;
|
||||
static patch_t *nonicon;
|
||||
static patch_t *nonicon2;
|
||||
static patch_t *nightopianhelper;
|
||||
static patch_t *linkfreeze;
|
||||
static patch_t *superparaloop;
|
||||
static patch_t *bluestat;
|
||||
static patch_t *byelstat;
|
||||
static patch_t *orngstat;
|
||||
|
@ -313,6 +316,10 @@ void ST_LoadGraphics(void)
|
|||
nonicon2 = W_CachePatchName("NONICON2", PU_HUDGFX);
|
||||
|
||||
// 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);
|
||||
byelstat = W_CachePatchName("BYELSTAT", 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)
|
||||
{
|
||||
patch_t *p = NULL;
|
||||
|
@ -1455,7 +1477,6 @@ static void ST_drawPowerupHUD(void)
|
|||
INT32 offs = hudinfo[HUD_POWERUPS].x;
|
||||
const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 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))
|
||||
return;
|
||||
|
@ -1567,15 +1588,7 @@ static void ST_drawPowerupHUD(void)
|
|||
DRAWTIMERICON(invincibility, invulntime)
|
||||
}
|
||||
|
||||
if (invulntime > 7)
|
||||
offs -= ICONSEP;
|
||||
else
|
||||
{
|
||||
UINT8 a = ICONSEP, b = 7-invulntime;
|
||||
while (b--)
|
||||
a = 2*a/3;
|
||||
offs -= a;
|
||||
}
|
||||
offs -= ST_powerupHUDoffset(invulntime);
|
||||
|
||||
// Super Sneakers
|
||||
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])
|
||||
}
|
||||
|
||||
if (stplyr->powers[pw_sneakers] > 7)
|
||||
offs -= ICONSEP;
|
||||
else
|
||||
{
|
||||
UINT8 a = ICONSEP, b = 7-stplyr->powers[pw_sneakers];
|
||||
while (b--)
|
||||
a = 2*a/3;
|
||||
offs -= a;
|
||||
}
|
||||
offs -= ST_powerupHUDoffset(stplyr->powers[pw_sneakers]);
|
||||
|
||||
// Gravity Boots
|
||||
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])
|
||||
}
|
||||
|
||||
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 ICONSEP
|
||||
}
|
||||
|
@ -2740,18 +2775,16 @@ static void ST_overlayDrawer(void)
|
|||
}
|
||||
|
||||
// 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)
|
||||
|| ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase))
|
||||
{
|
||||
if ((stplyr == &players[displayplayer] && !camera.chase)
|
||||
|| ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase))
|
||||
{
|
||||
ST_drawFirstPersonHUD();
|
||||
if (cv_powerupdisplay.value)
|
||||
ST_drawPowerupHUD(); // same as it ever was...
|
||||
}
|
||||
else if (cv_powerupdisplay.value == 2)
|
||||
ST_drawFirstPersonHUD();
|
||||
if (cv_powerupdisplay.value)
|
||||
ST_drawPowerupHUD(); // same as it ever was...
|
||||
}
|
||||
else if (cv_powerupdisplay.value == 2)
|
||||
ST_drawPowerupHUD(); // same as it ever was...
|
||||
|
||||
}
|
||||
else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2)
|
||||
ST_drawPowerupHUD(); // same as it ever was...
|
||||
|
|
Loading…
Reference in a new issue