mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-26 22:44:30 -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)
|
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);
|
sprintf(hud_healthstr + i, "%3d", st_health);
|
||||||
|
|
||||||
// set the display color from the amount of health posessed
|
// 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
|
// transfer the init string to the widget
|
||||||
HUlib_addStringToTextLine(&w_health, hud_healthstr);
|
HUlib_addStringToTextLine(&w_health, hud_healthstr);
|
||||||
@ -884,7 +884,7 @@ static void HU_widget_build_armor (void)
|
|||||||
if (hud_armor_type)
|
if (hud_armor_type)
|
||||||
{
|
{
|
||||||
w_armor.cr =
|
w_armor.cr =
|
||||||
hu_invul ? colrngs[CR_GRAY] :
|
st_invul ? colrngs[CR_GRAY] :
|
||||||
(plr->armortype == 0) ? colrngs[CR_RED] :
|
(plr->armortype == 0) ? colrngs[CR_RED] :
|
||||||
(plr->armortype == 1) ? colrngs[CR_GREEN] :
|
(plr->armortype == 1) ? colrngs[CR_GREEN] :
|
||||||
colrngs[CR_BLUE];
|
colrngs[CR_BLUE];
|
||||||
@ -895,7 +895,7 @@ static void HU_widget_build_armor (void)
|
|||||||
|
|
||||||
// set the display color from the amount of armor posessed
|
// set the display color from the amount of armor posessed
|
||||||
w_armor.cr =
|
w_armor.cr =
|
||||||
hu_invul ? colrngs[CR_GRAY] :
|
st_invul ? colrngs[CR_GRAY] :
|
||||||
(armor < armor_red) ? colrngs[CR_RED] :
|
(armor < armor_red) ? colrngs[CR_RED] :
|
||||||
(armor < armor_yellow) ? colrngs[CR_GOLD] :
|
(armor < armor_yellow) ? colrngs[CR_GOLD] :
|
||||||
(armor <= armor_green) ? colrngs[CR_GREEN] :
|
(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;
|
crosshair.y = (screenblocks <= 10) ? (ORIGHEIGHT-ST_HEIGHT)/2 : ORIGHEIGHT/2;
|
||||||
|
|
||||||
if (hud_crosshair_health)
|
if (hud_crosshair_health)
|
||||||
crosshair.cr = ColorByHealth(plr->health, 100, hu_invul);
|
crosshair.cr = ColorByHealth(plr->health, 100, st_invul);
|
||||||
else
|
else
|
||||||
crosshair.cr = colrngs[hud_crosshair_color];
|
crosshair.cr = colrngs[hud_crosshair_color];
|
||||||
|
|
||||||
@ -1475,10 +1475,6 @@ void HU_Ticker(void)
|
|||||||
HU_disableAllWidgets();
|
HU_disableAllWidgets();
|
||||||
draw_crispy_hud = false;
|
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)
|
if ((automapactive && hud_widget_font == 1) || hud_widget_font == 2)
|
||||||
{
|
{
|
||||||
hu_font2 = hu_font;
|
hu_font2 = hu_font;
|
||||||
|
@ -816,6 +816,8 @@ static int SmoothCount(int shownval, int realval)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean st_invul;
|
||||||
|
|
||||||
void ST_Ticker(void)
|
void ST_Ticker(void)
|
||||||
{
|
{
|
||||||
st_health = SmoothCount(st_health, plyr->health);
|
st_health = SmoothCount(st_health, plyr->health);
|
||||||
@ -825,6 +827,10 @@ void ST_Ticker(void)
|
|||||||
st_randomnumber = M_Random();
|
st_randomnumber = M_Random();
|
||||||
ST_updateWidgets();
|
ST_updateWidgets();
|
||||||
st_oldhealth = plyr->health;
|
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;
|
static int st_palette = 0;
|
||||||
@ -909,10 +915,6 @@ void ST_drawWidgets(void)
|
|||||||
// the real values, only ever relevant when using smooth counts
|
// the real values, only ever relevant when using smooth counts
|
||||||
const int health = plyr->health, armor = plyr->armorpoints;
|
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
|
// clear area
|
||||||
if (!st_crispyhud && st_statusbaron)
|
if (!st_crispyhud && st_statusbaron)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user