fix indicators flashing when invulnerability powerup fades out (#2217)

* fix indicators flashing when invulnerability powerup fades out

https://www.doomworld.com/forum/topic/112333-this-is-woof-1520-jan-31-2025/?page=106&tab=comments#comment-2902657

* use player_t instead of struct player_s
This commit is contained in:
Fabian Greffrath 2025-03-01 14:00:33 +01:00 committed by GitHub
parent 40d413183c
commit 0df430ad78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -130,7 +130,7 @@ void HU_UpdateCrosshair(void)
crosshair.y = (screenblocks <= 10) ? (SCREENHEIGHT - ST_HEIGHT) / 2 crosshair.y = (screenblocks <= 10) ? (SCREENHEIGHT - ST_HEIGHT) / 2
: SCREENHEIGHT / 2; : SCREENHEIGHT / 2;
boolean invul = (plr->cheats & CF_GODMODE) || plr->powers[pw_invulnerability]; boolean invul = ST_PlayerInvulnerable(plr);
if (hud_crosshair_health) if (hud_crosshair_health)
{ {

View File

@ -880,8 +880,7 @@ static void UpdateBoomColors(sbarelem_t *elem, player_t *player)
sbe_number_t *number = elem->subtype.number; sbe_number_t *number = elem->subtype.number;
boolean invul = (player->powers[pw_invulnerability] boolean invul = ST_PlayerInvulnerable(player);
|| player->cheats & CF_GODMODE);
crange_idx_e cr; crange_idx_e cr;

View File

@ -66,6 +66,13 @@ extern int health_red; // health amount less than which status is red
extern int health_yellow; // health amount less than which status is yellow extern int health_yellow; // health amount less than which status is yellow
extern int health_green; // health amount above is blue, below is green extern int health_green; // health amount above is blue, below is green
static inline boolean ST_PlayerInvulnerable(player_t *player)
{
return (player->cheats & CF_GODMODE) ||
(player->powers[pw_invulnerability] > 4 * 32) ||
(player->powers[pw_invulnerability] & 8);
}
extern boolean palette_changes; extern boolean palette_changes;
extern struct hudfont_s *stcfnt; extern struct hudfont_s *stcfnt;