Implemented emulation of smaller Kline health bars.

This makes it so that Kline's one health bar is displayed as many
smaller health bars, like the original, for Classic difficulty.
This commit is contained in:
Layla Marchant 2020-12-25 21:44:10 -05:00
parent 8ca1cdc42c
commit 6d71317514
No known key found for this signature in database
GPG Key ID: 52FB5C20A8336782
3 changed files with 72 additions and 10 deletions

View File

@ -2212,9 +2212,9 @@ void alien_hurt(Object *alien, Object *attacker, int damage, int ion)
if (game.area == MISN_ELAMALE)
{
if (game.difficulty == DIFFICULTY_ORIGINAL)
stage1_shield = alien->maxShield * 3 / 8;
stage1_shield = KLINE_SHIELD_MEDIUM;
else
stage1_shield = alien->maxShield / 4;
stage1_shield = KLINE_SHIELD_SMALL;
if ((alien->shield <= alien->maxShield - stage1_shield)
&& !(alien->flags & FL_LEAVESECTOR))
@ -2228,9 +2228,9 @@ void alien_hurt(Object *alien, Object *attacker, int damage, int ion)
else if (game.area == MISN_EARTH)
{
if (game.difficulty == DIFFICULTY_ORIGINAL)
stage1_shield = alien->maxShield / 4;
stage1_shield = KLINE_SHIELD_SMALL;
else
stage1_shield = alien->maxShield * 3 / 8;
stage1_shield = KLINE_SHIELD_MEDIUM;
if ((alien->shield <= alien->maxShield - stage1_shield)
&& !(alien->flags & FL_LEAVESECTOR))
@ -2243,9 +2243,9 @@ void alien_hurt(Object *alien, Object *attacker, int damage, int ion)
}
else if (game.area == MISN_VENUS)
{
stage1_shield = alien->maxShield * 3 / 4;
stage2_shield = alien->maxShield / 2;
stage3_shield = alien->maxShield / 4;
stage1_shield = KLINE_STAGE1_SHIELD;
stage2_shield = KLINE_STAGE2_SHIELD;
stage3_shield = KLINE_STAGE3_SHIELD;
if (alien->shield + damage > stage1_shield
&& alien->shield <= stage1_shield)
@ -2271,7 +2271,7 @@ void alien_hurt(Object *alien, Object *attacker, int damage, int ion)
}
else
{
stage1_shield = alien->maxShield / 20;
stage1_shield = KLINE_SHIELD_TINY;
if ((alien->shield <= alien->maxShield - stage1_shield)
&& !(alien->flags & FL_LEAVESECTOR))

View File

@ -107,6 +107,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define JS_DEADZONE 0.05
#define JS_MAX (32767 - JS_DEADZONE*32767)
#define KLINE_STAGE1_SHIELD (aliens[ALIEN_KLINE].maxShield * 3 / 4)
#define KLINE_STAGE2_SHIELD (aliens[ALIEN_KLINE].maxShield / 2)
#define KLINE_STAGE3_SHIELD (aliens[ALIEN_KLINE].maxShield / 4)
#define KLINE_SHIELD_TINY (aliens[ALIEN_KLINE].maxShield / 20)
#define KLINE_SHIELD_SMALL (aliens[ALIEN_KLINE].maxShield / 4)
#define KLINE_SHIELD_MEDIUM (aliens[ALIEN_KLINE].maxShield * 3 / 8)
// Radio life/speed
#define RADIO_LIFE_INSTANT 60
#define RADIO_LIFE_FAST 120

View File

@ -1913,6 +1913,7 @@ static void game_doHud()
int tTextIndex;
char text[STRMAX_SHORT];
float nbars; // A float for the sake of float division
float min_shield, max_shield;
float shield_pct;
int i;
int c;
@ -2144,8 +2145,62 @@ static void game_doHud()
bar.x = screen->w * 11 / 16 + gfx_textSprites[tTextIndex].image->w + 10;
bar.y = screen->h - 50;
nbars = 85.;
if (engine.targetIndex == ALIEN_KLINE
&& game.difficulty == DIFFICULTY_ORIGINAL)
{
if (game.area == MISN_ELAMALE)
{
max_shield = aliens[engine.targetIndex].maxShield;
min_shield = max_shield - KLINE_SHIELD_MEDIUM;
}
else if (game.area == MISN_EARTH)
{
max_shield = aliens[engine.targetIndex].maxShield;
min_shield = max_shield - KLINE_SHIELD_SMALL;
}
else if (game.area == MISN_VENUS)
{
if (aliens[ALIEN_KLINE].shield > KLINE_STAGE1_SHIELD)
{
max_shield = aliens[engine.targetIndex].maxShield;
min_shield = KLINE_STAGE1_SHIELD;
}
else if (aliens[ALIEN_KLINE].shield > KLINE_STAGE2_SHIELD)
{
max_shield = KLINE_STAGE1_SHIELD;
min_shield = KLINE_STAGE2_SHIELD;
}
else if (aliens[ALIEN_KLINE].shield > KLINE_STAGE3_SHIELD)
{
max_shield = KLINE_STAGE2_SHIELD;
min_shield = KLINE_STAGE3_SHIELD;
}
else
{
max_shield = KLINE_STAGE3_SHIELD;
min_shield = 0;
}
}
else
{
max_shield = aliens[engine.targetIndex].maxShield;
min_shield = max_shield - KLINE_SHIELD_TINY;
}
if (min_shield > 0)
shield_pct = (
MAX((float)aliens[engine.targetIndex].shield - min_shield, 1.)
/ (max_shield-min_shield));
else
shield_pct = (
((float)aliens[engine.targetIndex].shield - min_shield)
/ (max_shield-min_shield));
}
else
{
shield_pct = ((float)aliens[engine.targetIndex].shield
/ (float)aliens[engine.targetIndex].maxShield);
}
for (i = 0 ; i < nbars ; i++)
{