This commit is contained in:
parent
f16fbe1737
commit
5d507841cf
@ -1,7 +1,8 @@
|
||||
From 814146aab795b0c2d693e03027993d91c9db6f3e Mon Sep 17 00:00:00 2001
|
||||
From a0bae535928cbce4eb9da8dd5d33b473776c9693 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: Wed, 1 May 2013 09:53:49 +0200
|
||||
Subject: [PATCH 3/4] Show health bar for all destructible mobjs
|
||||
Subject: [PATCH 1/2] 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.
|
||||
@ -10,10 +11,10 @@ including barrels and Lost Souls.
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git prboom2/src/gl_main.c prboom2/src/gl_main.c
|
||||
index 8fbceb4f..0a52a0b5 100644
|
||||
index 20712b7e..e2402e16 100644
|
||||
--- prboom2/src/gl_main.c
|
||||
+++ prboom2/src/gl_main.c
|
||||
@@ -2331,7 +2331,8 @@ static void gld_DrawSprite(GLSprite *sprite)
|
||||
@@ -2328,7 +2328,8 @@ static void gld_DrawSprite(GLSprite *sprite)
|
||||
|
||||
static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
{
|
||||
@ -24,5 +25,5 @@ index 8fbceb4f..0a52a0b5 100644
|
||||
GLHealthBar hbar;
|
||||
int health_percent = thing->health * 100 / thing->info->spawnhealth;
|
||||
--
|
||||
2.30.2
|
||||
2.31.1
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
From ebebaebb619ef64d4243eb5066fa0b786b42a951 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: Wed, 1 May 2013 09:42:45 +0200
|
||||
Subject: [PATCH 2/4] Redistribute health bar colors
|
||||
|
||||
With the current value of health_hbar_green=0, green will never
|
||||
be shown for monsters, which feels incorrect.
|
||||
---
|
||||
prboom2/src/m_misc.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git prboom2/src/m_misc.c prboom2/src/m_misc.c
|
||||
index 0bf3f5b9..c83f23df 100644
|
||||
--- prboom2/src/m_misc.c
|
||||
+++ prboom2/src/m_misc.c
|
||||
@@ -1045,11 +1045,11 @@ default_t defaults[] =
|
||||
def_bool,ss_stat},
|
||||
{"health_bar_full_length", {&health_bar_full_length}, {1},0,1,
|
||||
def_bool,ss_stat},
|
||||
- {"health_bar_red", {&health_bar_red}, {50},0,100,
|
||||
+ {"health_bar_red", {&health_bar_red}, {25},0,100,
|
||||
def_int,ss_stat},
|
||||
- {"health_bar_yellow", {&health_bar_yellow}, {99},0,100,
|
||||
+ {"health_bar_yellow", {&health_bar_yellow}, {50},0,100,
|
||||
def_int,ss_stat},
|
||||
- {"health_bar_green", {&health_bar_green}, {0},0,100,
|
||||
+ {"health_bar_green", {&health_bar_green}, {99},0,100,
|
||||
def_int,ss_stat},
|
||||
|
||||
// NSM
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,12 +1,13 @@
|
||||
From be6b2259e2a150e6713d79574c2f64eaf7a25bd8 Mon Sep 17 00:00:00 2001
|
||||
From 6566b0489164957581d091119bdf480d66e9ca20 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Engelhardt <jengelh@inai.de>
|
||||
Date: Wed, 1 May 2013 14:27:39 +0200
|
||||
Subject: [PATCH 4/4] Make the health bar gradually change from green to red
|
||||
Date: Wed, 1 May 2013 09:53:49 +0200
|
||||
Subject: [PATCH 2/2] Implement color gradient for health bar
|
||||
References: https://github.com/coelckers/prboom-plus/pull/274
|
||||
|
||||
---
|
||||
prboom2/src/gl_intern.h | 2 +-
|
||||
prboom2/src/gl_main.c | 44 ++++++++++++++++-------------------------
|
||||
2 files changed, 18 insertions(+), 28 deletions(-)
|
||||
prboom2/src/gl_main.c | 31 +++++++++++++++++--------------
|
||||
2 files changed, 18 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git prboom2/src/gl_intern.h prboom2/src/gl_intern.h
|
||||
index b4be8d56..8c44d9a7 100644
|
||||
@ -22,10 +23,10 @@ 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 0a52a0b5..4f42ec46 100644
|
||||
index e2402e16..0a257ecf 100644
|
||||
--- prboom2/src/gl_main.c
|
||||
+++ prboom2/src/gl_main.c
|
||||
@@ -2337,15 +2337,20 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
@@ -2334,15 +2334,23 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
GLHealthBar hbar;
|
||||
int health_percent = thing->health * 100 / thing->info->spawnhealth;
|
||||
|
||||
@ -36,25 +37,28 @@ index 0a52a0b5..4f42ec46 100644
|
||||
- hbar.cm = CR_YELLOW;
|
||||
- else if (health_percent <= health_bar_green)
|
||||
- hbar.cm = CR_GREEN;
|
||||
+ if (health_percent <= health_bar_red) {
|
||||
+ hbar.r = 1;
|
||||
+ hbar.g = 0;
|
||||
+ hbar.r = hbar.g = -1.0f;
|
||||
+ if (health_percent <= 0) {
|
||||
+ hbar.r = 1.0f;
|
||||
+ 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);
|
||||
+ } else if (health_percent <= health_bar_yellow) {
|
||||
+ hbar.r = 1;
|
||||
+ hbar.g = (double)(health_percent - health_bar_red) /
|
||||
+ hbar.r = (double)(health_bar_yellow - health_percent) /
|
||||
+ (health_bar_yellow - health_bar_red);
|
||||
+ hbar.g = 1.0f;
|
||||
+ } else if (health_percent <= health_bar_green) {
|
||||
+ /* FullSimplify[1-((percent-yellow)/(green-yellow))] */
|
||||
+ hbar.r = (double)(health_bar_green - health_percent) /
|
||||
+ (health_bar_green - health_bar_yellow);
|
||||
+ hbar.g = 1;
|
||||
+ hbar.r = 0.0f;
|
||||
+ hbar.g = 1.0f;
|
||||
+ }
|
||||
|
||||
- if (hbar.cm >= 0)
|
||||
+ if (hbar.r >= 0)
|
||||
{
|
||||
float sx2 = (float)thing->radius / 2.0f / MAP_SCALE;
|
||||
float sx1 = sx2 - (float)health_percent * (float)thing->radius / 100.0f / MAP_SCALE;
|
||||
@@ -2369,7 +2374,6 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
@@ -2366,7 +2374,6 @@ static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
|
||||
static void gld_DrawHealthBars(void)
|
||||
{
|
||||
int i, count;
|
||||
@ -62,7 +66,7 @@ index 0a52a0b5..4f42ec46 100644
|
||||
|
||||
count = gld_drawinfo.num_items[GLDIT_HBAR];
|
||||
if (count > 0)
|
||||
@@ -2380,31 +2384,17 @@ static void gld_DrawHealthBars(void)
|
||||
@@ -2377,11 +2384,7 @@ static void gld_DrawHealthBars(void)
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
{
|
||||
GLHealthBar *hbar = gld_drawinfo.items[GLDIT_HBAR][i].item.hbar;
|
||||
@ -71,33 +75,10 @@ index 0a52a0b5..4f42ec46 100644
|
||||
- cm = hbar->cm;
|
||||
- glColor4f(cm2RGB[cm][0], cm2RGB[cm][1], cm2RGB[cm][2], 1.0f);
|
||||
- }
|
||||
+ glColor4f(hbar->r, hbar->g, 0, 1);
|
||||
+ glColor4f(hbar->r, hbar->g, 0.0f, 1.0f);
|
||||
|
||||
glVertex3f(hbar->x1, hbar->y, hbar->z1);
|
||||
glVertex3f(hbar->x2, hbar->y, hbar->z2);
|
||||
- }
|
||||
- glEnd();
|
||||
-
|
||||
- if (health_bar_full_length)
|
||||
- {
|
||||
- glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
- glBegin(GL_LINES);
|
||||
- for (i = count - 1; i >= 0; i--)
|
||||
- {
|
||||
- GLHealthBar *hbar = gld_drawinfo.items[GLDIT_HBAR][i].item.hbar;
|
||||
-
|
||||
+ if (health_bar_full_length) {
|
||||
+ glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
glVertex3f(hbar->x1, hbar->y, hbar->z1);
|
||||
glVertex3f(hbar->x3, hbar->y, hbar->z3);
|
||||
}
|
||||
- glEnd();
|
||||
}
|
||||
-
|
||||
+ glEnd();
|
||||
gld_EnableTexture2D(GL_TEXTURE0_ARB, true);
|
||||
}
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
2.31.1
|
||||
|
||||
|
@ -18,7 +18,8 @@ Fri Apr 9 23:53:06 UTC 2021 - Jan Engelhardt <jengelh@inai.de>
|
||||
* Add ALSA sequencer API backend for ALSA MIDI support.
|
||||
- Drop 0001-fix-heap-buffer-overflows-in-UDP-code-CVE-2019-20797.patch
|
||||
(merged), prboom-types1.diff (obsolete),
|
||||
prboom-types2.diff (obsolete)
|
||||
prboom-types2.diff (obsolete), prboom-hbar-color.diff (folded
|
||||
into prboom-hbar-gradient.diff)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 9 20:32:48 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
@ -27,10 +27,9 @@ URL: http://prboom-plus.sf.net/
|
||||
#Git-Clone: https://github.com/coelckers/prboom-plus
|
||||
Source: %name-%version.tar.xz
|
||||
Patch1: prboom-nodatetime.diff
|
||||
Patch5: prboom-enable-tessellation.diff
|
||||
Patch6: prboom-hbar-color.diff
|
||||
Patch7: prboom-hbar-all.diff
|
||||
Patch8: prboom-hbar-gradient.diff
|
||||
Patch2: prboom-enable-tessellation.diff
|
||||
Patch3: prboom-hbar-all.diff
|
||||
Patch4: prboom-hbar-gradient.diff
|
||||
BuildRequires: Mesa-devel
|
||||
BuildRequires: c++_compiler
|
||||
BuildRequires: cmake
|
||||
|
Loading…
Reference in New Issue
Block a user