diff --git a/src/hu_crosshair.c b/src/hu_crosshair.c index a99667f8..19829500 100644 --- a/src/hu_crosshair.c +++ b/src/hu_crosshair.c @@ -130,7 +130,7 @@ void HU_UpdateCrosshair(void) crosshair.y = (screenblocks <= 10) ? (SCREENHEIGHT - ST_HEIGHT) / 2 : SCREENHEIGHT / 2; - boolean invul = (plr->cheats & CF_GODMODE) || plr->powers[pw_invulnerability]; + boolean invul = ST_PlayerInvulnerable(plr); if (hud_crosshair_health) { diff --git a/src/st_stuff.c b/src/st_stuff.c index c087b592..bb08270e 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -880,8 +880,7 @@ static void UpdateBoomColors(sbarelem_t *elem, player_t *player) sbe_number_t *number = elem->subtype.number; - boolean invul = (player->powers[pw_invulnerability] - || player->cheats & CF_GODMODE); + boolean invul = ST_PlayerInvulnerable(player); crange_idx_e cr; diff --git a/src/st_stuff.h b/src/st_stuff.h index 5a935db9..6c858fb2 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -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_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 struct hudfont_s *stcfnt;