- Update prboom-hbar-all.diff, prboom-hbar-gradient.diff from project.
OBS-URL: https://build.opensuse.org/package/show/games/prboom-plus?expand=0&rev=40
This commit is contained in:
parent
bcc22794ec
commit
81ac4d4360
@ -1,29 +1,80 @@
|
||||
From a0bae535928cbce4eb9da8dd5d33b473776c9693 Mon Sep 17 00:00:00 2001
|
||||
From f8dc397539f27c601aa6f1f3ea0f6c1f177efd97 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: Wed, 1 May 2013 09:53:49 +0200
|
||||
Subject: [PATCH 1/2] Show health bar for all destructible mobjs
|
||||
Subject: [PATCH 1/2] Add option to show health bar for all destructible mobjs
|
||||
References: https://github.com/coelckers/prboom-plus/pull/274
|
||||
|
||||
Show the health bar for all destructible items, especially so
|
||||
including barrels and Lost Souls.
|
||||
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 | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
prboom2/src/gl_main.c | 10 +++++++++-
|
||||
prboom2/src/m_misc.c | 2 ++
|
||||
prboom2/src/r_things.c | 1 +
|
||||
prboom2/src/r_things.h | 1 +
|
||||
4 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git prboom2/src/gl_main.c prboom2/src/gl_main.c
|
||||
index 20712b7e..e2402e16 100644
|
||||
index 20712b7e..763bcbae 100644
|
||||
--- prboom2/src/gl_main.c
|
||||
+++ prboom2/src/gl_main.c
|
||||
@@ -2328,7 +2328,8 @@ static void gld_DrawSprite(GLSprite *sprite)
|
||||
@@ -2326,9 +2326,17 @@ static void gld_DrawSprite(GLSprite *sprite)
|
||||
}
|
||||
}
|
||||
|
||||
+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->flags & MF_SHOOTABLE) && thing->info->spawnhealth > 0 &&
|
||||
+ 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;
|
||||
diff --git prboom2/src/m_misc.c prboom2/src/m_misc.c
|
||||
index 0bf3f5b9..e819ad61 100644
|
||||
--- prboom2/src/m_misc.c
|
||||
+++ prboom2/src/m_misc.c
|
||||
@@ -1045,6 +1045,8 @@ default_t defaults[] =
|
||||
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,
|
||||
diff --git prboom2/src/r_things.c prboom2/src/r_things.c
|
||||
index c537dd5e..fd1215fd 100644
|
||||
--- prboom2/src/r_things.c
|
||||
+++ prboom2/src/r_things.c
|
||||
@@ -73,6 +73,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;
|
||||
diff --git prboom2/src/r_things.h prboom2/src/r_things.h
|
||||
index 2267cb83..52e5beea 100644
|
||||
--- prboom2/src/r_things.h
|
||||
+++ 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;
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 6566b0489164957581d091119bdf480d66e9ca20 Mon Sep 17 00:00:00 2001
|
||||
From be1128c66a342ca381532ac3c6bcd286d871fdc3 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: Wed, 1 May 2013 09:53:49 +0200
|
||||
Subject: [PATCH 2/2] Implement color gradient for health bar
|
||||
@ -23,12 +23,14 @@ index b4be8d56..8c44d9a7 100644
|
||||
float x1, x2, x3;
|
||||
float z1, z2, z3;
|
||||
diff --git prboom2/src/gl_main.c prboom2/src/gl_main.c
|
||||
index e2402e16..0a257ecf 100644
|
||||
index 763bcbae..8dcb03fd 100644
|
||||
--- prboom2/src/gl_main.c
|
||||
+++ prboom2/src/gl_main.c
|
||||
@@ -2334,15 +2334,23 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
@@ -2340,16 +2340,24 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
{
|
||||
GLHealthBar hbar;
|
||||
int health_percent = thing->health * 100 / thing->info->spawnhealth;
|
||||
+ int yr = health_bar_yellow - health_bar_red;
|
||||
|
||||
- hbar.cm = -1;
|
||||
- if (health_percent <= health_bar_red)
|
||||
@ -43,10 +45,9 @@ index e2402e16..0a257ecf 100644
|
||||
+ hbar.g = 0.0f;
|
||||
+ } else if (health_percent <= health_bar_red) {
|
||||
+ hbar.r = 1.0f;
|
||||
+ hbar.g = (double)health_percent / (health_bar_yellow - health_bar_red);
|
||||
+ hbar.g = yr == 0 ? 0 : (float)health_percent / yr;
|
||||
+ } else if (health_percent <= health_bar_yellow) {
|
||||
+ hbar.r = (double)(health_bar_yellow - health_percent) /
|
||||
+ (health_bar_yellow - health_bar_red);
|
||||
+ hbar.r = yr == 0 ? 1 : (float)(health_bar_yellow - health_percent) / yr;
|
||||
+ hbar.g = 1.0f;
|
||||
+ } else if (health_percent <= health_bar_green) {
|
||||
+ hbar.r = 0.0f;
|
||||
@ -54,11 +55,11 @@ index e2402e16..0a257ecf 100644
|
||||
+ }
|
||||
|
||||
- if (hbar.cm >= 0)
|
||||
+ if (hbar.r >= 0)
|
||||
+ if (hbar.r >= 0 && hbar.g >= 0)
|
||||
{
|
||||
float sx2 = (float)thing->radius / 2.0f / MAP_SCALE;
|
||||
float sx1 = sx2 - (float)health_percent * (float)thing->radius / 100.0f / MAP_SCALE;
|
||||
@@ -2366,7 +2374,6 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
@@ -2373,7 +2381,6 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
static void gld_DrawHealthBars(void)
|
||||
{
|
||||
int i, count;
|
||||
@ -66,7 +67,7 @@ index e2402e16..0a257ecf 100644
|
||||
|
||||
count = gld_drawinfo.num_items[GLDIT_HBAR];
|
||||
if (count > 0)
|
||||
@@ -2377,11 +2384,7 @@ static void gld_DrawHealthBars(void)
|
||||
@@ -2384,11 +2391,7 @@ static void gld_DrawHealthBars(void)
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
{
|
||||
GLHealthBar *hbar = gld_drawinfo.items[GLDIT_HBAR][i].item.hbar;
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat May 1 11:55:16 UTC 2021 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
- Update prboom-hbar-all.diff, prboom-hbar-gradient.diff
|
||||
from project.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 9 23:53:06 UTC 2021 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user