mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-26 06:20:16 -04:00
get away with only one invulnerability tracker for status bar and HUD
Just remembered that `ST_ticker()` is *always* called before `HU_Ticker()`.
This commit is contained in:
parent
1a2de565fc
commit
a922c4a0aa
@ -361,7 +361,7 @@ void HU_ResetMessageColors(void)
|
||||
}
|
||||
}
|
||||
|
||||
static boolean hu_invul;
|
||||
extern boolean st_invul;
|
||||
|
||||
static char* ColorByHealth(int health, int maxhealth, boolean invul)
|
||||
{
|
||||
@ -836,7 +836,7 @@ static void HU_widget_build_health (void)
|
||||
sprintf(hud_healthstr + i, "%3d", st_health);
|
||||
|
||||
// set the display color from the amount of health posessed
|
||||
w_health.cr = ColorByHealth(plr->health, 100, hu_invul);
|
||||
w_health.cr = ColorByHealth(plr->health, 100, st_invul);
|
||||
|
||||
// transfer the init string to the widget
|
||||
HUlib_addStringToTextLine(&w_health, hud_healthstr);
|
||||
@ -884,7 +884,7 @@ static void HU_widget_build_armor (void)
|
||||
if (hud_armor_type)
|
||||
{
|
||||
w_armor.cr =
|
||||
hu_invul ? colrngs[CR_GRAY] :
|
||||
st_invul ? colrngs[CR_GRAY] :
|
||||
(plr->armortype == 0) ? colrngs[CR_RED] :
|
||||
(plr->armortype == 1) ? colrngs[CR_GREEN] :
|
||||
colrngs[CR_BLUE];
|
||||
@ -895,7 +895,7 @@ static void HU_widget_build_armor (void)
|
||||
|
||||
// set the display color from the amount of armor posessed
|
||||
w_armor.cr =
|
||||
hu_invul ? colrngs[CR_GRAY] :
|
||||
st_invul ? colrngs[CR_GRAY] :
|
||||
(armor < armor_red) ? colrngs[CR_RED] :
|
||||
(armor < armor_yellow) ? colrngs[CR_GOLD] :
|
||||
(armor <= armor_green) ? colrngs[CR_GREEN] :
|
||||
@ -1271,7 +1271,7 @@ static void HU_UpdateCrosshair(void)
|
||||
crosshair.y = (screenblocks <= 10) ? (ORIGHEIGHT-ST_HEIGHT)/2 : ORIGHEIGHT/2;
|
||||
|
||||
if (hud_crosshair_health)
|
||||
crosshair.cr = ColorByHealth(plr->health, 100, hu_invul);
|
||||
crosshair.cr = ColorByHealth(plr->health, 100, st_invul);
|
||||
else
|
||||
crosshair.cr = colrngs[hud_crosshair_color];
|
||||
|
||||
@ -1475,10 +1475,6 @@ void HU_Ticker(void)
|
||||
HU_disableAllWidgets();
|
||||
draw_crispy_hud = false;
|
||||
|
||||
hu_invul = (plr->powers[pw_invulnerability] > 4*32 ||
|
||||
plr->powers[pw_invulnerability] & 8) ||
|
||||
plr->cheats & CF_GODMODE;
|
||||
|
||||
if ((automapactive && hud_widget_font == 1) || hud_widget_font == 2)
|
||||
{
|
||||
hu_font2 = hu_font;
|
||||
|
@ -816,6 +816,8 @@ static int SmoothCount(int shownval, int realval)
|
||||
}
|
||||
}
|
||||
|
||||
boolean st_invul;
|
||||
|
||||
void ST_Ticker(void)
|
||||
{
|
||||
st_health = SmoothCount(st_health, plyr->health);
|
||||
@ -825,6 +827,10 @@ void ST_Ticker(void)
|
||||
st_randomnumber = M_Random();
|
||||
ST_updateWidgets();
|
||||
st_oldhealth = plyr->health;
|
||||
|
||||
st_invul = (plyr->powers[pw_invulnerability] > 4*32 ||
|
||||
plyr->powers[pw_invulnerability] & 8) ||
|
||||
plyr->cheats & CF_GODMODE;
|
||||
}
|
||||
|
||||
static int st_palette = 0;
|
||||
@ -909,10 +915,6 @@ void ST_drawWidgets(void)
|
||||
// the real values, only ever relevant when using smooth counts
|
||||
const int health = plyr->health, armor = plyr->armorpoints;
|
||||
|
||||
boolean st_invul = (plyr->powers[pw_invulnerability] > 4*32 ||
|
||||
plyr->powers[pw_invulnerability] & 8) ||
|
||||
plyr->cheats & CF_GODMODE;
|
||||
|
||||
// clear area
|
||||
if (!st_crispyhud && st_statusbaron)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user