From f8dc397539f27c601aa6f1f3ea0f6c1f177efd97 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 1 May 2013 09:53:49 +0200 Subject: [PATCH 1/2] Add option to show health bar for all destructible mobjs References: https://github.com/coelckers/prboom-plus/pull/274 The current health bar fails to show for Lost Souls. In addition, showing it for other destructible objects (such as barrels - or DEH modifications in that spirit) can be used to gauge the objects' remaining life. --- prboom2/src/gl_main.c | 10 +++++++++- prboom2/src/m_misc.c | 1 + prboom2/src/r_things.c | 1 + prboom2/src/r_things.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) Index: prboom2/src/gl_main.c =================================================================== --- prboom2/src/gl_main.c.orig +++ prboom2/src/gl_main.c @@ -2467,9 +2467,17 @@ static void gld_DrawSprite(GLSprite *spr } } +static int gld_EvaluateShowBar(mobj_t* thing) +{ + if (health_bar_shootables) + return thing->flags & MF_SHOOTABLE; + return (thing->flags & (MF_COUNTKILL | MF_CORPSE)) == MF_COUNTKILL; +} + static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite) { - if (((thing->flags & (MF_COUNTKILL | MF_CORPSE)) == MF_COUNTKILL) && (thing->health > 0)) + if (thing->info->spawnhealth > 0 && thing->health > 0 && + gld_EvaluateShowBar(thing)) { GLHealthBar hbar; int health_percent = thing->health * 100 / thing->info->spawnhealth; Index: prboom2/src/m_misc.c =================================================================== --- prboom2/src/m_misc.c.orig +++ prboom2/src/m_misc.c @@ -997,6 +997,7 @@ default_t defaults[] = { "screenshot_dir", { NULL, &screenshot_dir }, { 0, "" }, UL, UL, def_str, ss_none }, { "health_bar", { &health_bar }, { 0 }, 0, 1, def_bool, ss_stat }, { "health_bar_full_length", { &health_bar_full_length }, { 1 }, 0, 1, def_bool, ss_stat }, + { "health_bar_shootables", { &health_bar_shootables }, { 0 }, 0, 1, def_bool, ss_stat }, { "health_bar_red", { &health_bar_red }, { 50 }, 0, 100, def_int, ss_stat }, { "health_bar_yellow", { &health_bar_yellow }, { 99 }, 0, 100, def_int, ss_stat }, { "health_bar_green", { &health_bar_green }, { 0 }, 0, 100, def_int, ss_stat }, Index: prboom2/src/r_things.c =================================================================== --- prboom2/src/r_things.c.orig +++ prboom2/src/r_things.c @@ -75,6 +75,7 @@ int sprites_doom_order; int health_bar; int health_bar_full_length; +int health_bar_shootables; int health_bar_red; int health_bar_yellow; int health_bar_green; Index: prboom2/src/r_things.h =================================================================== --- prboom2/src/r_things.h.orig +++ prboom2/src/r_things.h @@ -75,6 +75,7 @@ extern int sprites_doom_order; extern int health_bar; extern int health_bar_full_length; +extern int health_bar_shootables; extern int health_bar_red; extern int health_bar_yellow; extern int health_bar_green;