1
0
forked from pool/prboom-plus
Jan Engelhardt 2021-04-10 17:03:21 +00:00 committed by Git OBS Bridge
parent f16fbe1737
commit 5d507841cf
5 changed files with 35 additions and 86 deletions

View File

@ -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> From: Jan Engelhardt <jengelh@inai.de>
Date: Wed, 1 May 2013 09:53:49 +0200 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 Show the health bar for all destructible items, especially so
including barrels and Lost Souls. including barrels and Lost Souls.
@ -10,10 +11,10 @@ including barrels and Lost Souls.
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git prboom2/src/gl_main.c prboom2/src/gl_main.c 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
+++ 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) static void gld_AddHealthBar(mobj_t* thing, GLSprite *sprite)
{ {
@ -24,5 +25,5 @@ index 8fbceb4f..0a52a0b5 100644
GLHealthBar hbar; GLHealthBar hbar;
int health_percent = thing->health * 100 / thing->info->spawnhealth; int health_percent = thing->health * 100 / thing->info->spawnhealth;
-- --
2.30.2 2.31.1

View File

@ -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

View File

@ -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> From: Jan Engelhardt <jengelh@inai.de>
Date: Wed, 1 May 2013 14:27:39 +0200 Date: Wed, 1 May 2013 09:53:49 +0200
Subject: [PATCH 4/4] Make the health bar gradually change from green to red 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_intern.h | 2 +-
prboom2/src/gl_main.c | 44 ++++++++++++++++------------------------- prboom2/src/gl_main.c | 31 +++++++++++++++++--------------
2 files changed, 18 insertions(+), 28 deletions(-) 2 files changed, 18 insertions(+), 15 deletions(-)
diff --git prboom2/src/gl_intern.h prboom2/src/gl_intern.h diff --git prboom2/src/gl_intern.h prboom2/src/gl_intern.h
index b4be8d56..8c44d9a7 100644 index b4be8d56..8c44d9a7 100644
@ -22,10 +23,10 @@ index b4be8d56..8c44d9a7 100644
float x1, x2, x3; float x1, x2, x3;
float z1, z2, z3; float z1, z2, z3;
diff --git prboom2/src/gl_main.c prboom2/src/gl_main.c 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
+++ 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; GLHealthBar hbar;
int health_percent = thing->health * 100 / thing->info->spawnhealth; int health_percent = thing->health * 100 / thing->info->spawnhealth;
@ -36,25 +37,28 @@ index 0a52a0b5..4f42ec46 100644
- hbar.cm = CR_YELLOW; - hbar.cm = CR_YELLOW;
- else if (health_percent <= health_bar_green) - else if (health_percent <= health_bar_green)
- hbar.cm = CR_GREEN; - hbar.cm = CR_GREEN;
+ if (health_percent <= health_bar_red) { + hbar.r = hbar.g = -1.0f;
+ hbar.r = 1; + if (health_percent <= 0) {
+ hbar.g = 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) { + } else if (health_percent <= health_bar_yellow) {
+ hbar.r = 1; + hbar.r = (double)(health_bar_yellow - health_percent) /
+ hbar.g = (double)(health_percent - health_bar_red) /
+ (health_bar_yellow - health_bar_red); + (health_bar_yellow - health_bar_red);
+ hbar.g = 1.0f;
+ } else if (health_percent <= health_bar_green) { + } else if (health_percent <= health_bar_green) {
+ /* FullSimplify[1-((percent-yellow)/(green-yellow))] */ + hbar.r = 0.0f;
+ hbar.r = (double)(health_bar_green - health_percent) / + hbar.g = 1.0f;
+ (health_bar_green - health_bar_yellow);
+ hbar.g = 1;
+ } + }
- if (hbar.cm >= 0) - if (hbar.cm >= 0)
+ if (hbar.r >= 0)
{ {
float sx2 = (float)thing->radius / 2.0f / MAP_SCALE; float sx2 = (float)thing->radius / 2.0f / MAP_SCALE;
float sx1 = sx2 - (float)health_percent * (float)thing->radius / 100.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) static void gld_DrawHealthBars(void)
{ {
int i, count; int i, count;
@ -62,7 +66,7 @@ index 0a52a0b5..4f42ec46 100644
count = gld_drawinfo.num_items[GLDIT_HBAR]; count = gld_drawinfo.num_items[GLDIT_HBAR];
if (count > 0) 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--) for (i = count - 1; i >= 0; i--)
{ {
GLHealthBar *hbar = gld_drawinfo.items[GLDIT_HBAR][i].item.hbar; GLHealthBar *hbar = gld_drawinfo.items[GLDIT_HBAR][i].item.hbar;
@ -71,33 +75,10 @@ index 0a52a0b5..4f42ec46 100644
- cm = hbar->cm; - cm = hbar->cm;
- glColor4f(cm2RGB[cm][0], cm2RGB[cm][1], cm2RGB[cm][2], 1.0f); - 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->x1, hbar->y, hbar->z1);
glVertex3f(hbar->x2, hbar->y, hbar->z2); 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

View File

@ -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. * Add ALSA sequencer API backend for ALSA MIDI support.
- Drop 0001-fix-heap-buffer-overflows-in-UDP-code-CVE-2019-20797.patch - Drop 0001-fix-heap-buffer-overflows-in-UDP-code-CVE-2019-20797.patch
(merged), prboom-types1.diff (obsolete), (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> Tue Jun 9 20:32:48 UTC 2020 - Jan Engelhardt <jengelh@inai.de>

View File

@ -27,10 +27,9 @@ URL: http://prboom-plus.sf.net/
#Git-Clone: https://github.com/coelckers/prboom-plus #Git-Clone: https://github.com/coelckers/prboom-plus
Source: %name-%version.tar.xz Source: %name-%version.tar.xz
Patch1: prboom-nodatetime.diff Patch1: prboom-nodatetime.diff
Patch5: prboom-enable-tessellation.diff Patch2: prboom-enable-tessellation.diff
Patch6: prboom-hbar-color.diff Patch3: prboom-hbar-all.diff
Patch7: prboom-hbar-all.diff Patch4: prboom-hbar-gradient.diff
Patch8: prboom-hbar-gradient.diff
BuildRequires: Mesa-devel BuildRequires: Mesa-devel
BuildRequires: c++_compiler BuildRequires: c++_compiler
BuildRequires: cmake BuildRequires: cmake