Merge pull request #1306 from fabiangreffrath/maxhealthbonus

fix Max Health setting in Dehacked using complevel 2
This commit is contained in:
Fabian Greffrath 2023-12-06 13:25:38 +01:00 committed by GitHub
commit fd645bea1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 3 deletions

View File

@ -129,6 +129,9 @@ boolean deh_pars = false; // in wi_stuff to allow pars in modified games
boolean deh_set_blood_color = false;
int deh_maxhealth;
boolean deh_set_maxhealth = false;
char **dehfiles = NULL; // filenames of .deh files for demo footer
// #include "d_deh.h" -- we don't do that here but we declare the
@ -2777,7 +2780,10 @@ void deh_procMisc(DEHFILE *fpin, FILE* fpout, char *line) // done
initial_bullets = value;
else
if (!strcasecmp(key,deh_misc[2])) // Max Health
maxhealth = value;
{
deh_maxhealth = value;
deh_set_maxhealth = true;
}
else
if (!strcasecmp(key,deh_misc[3])) // Max Armor
max_armor = value;

View File

@ -68,6 +68,7 @@
#include "i_endoom.h"
#include "d_quit.h"
#include "r_bmaps.h"
#include "p_inter.h" // maxhealthbonus
#include "dsdhacked.h"
@ -1838,6 +1839,23 @@ static void D_InitTables(void)
states[i].flags |= STATEF_SKILL5FAST;
}
void D_SetMaxHealth(void)
{
extern boolean deh_set_maxhealth;
extern int deh_maxhealth;
if (demo_compatibility)
{
maxhealth = 100;
maxhealthbonus = deh_set_maxhealth ? deh_maxhealth : 200;
}
else
{
maxhealth = deh_set_maxhealth ? deh_maxhealth : 100;
maxhealthbonus = maxhealth * 2;
}
}
void D_SetBloodColor(void)
{
extern boolean deh_set_blood_color;

View File

@ -39,6 +39,7 @@ extern boolean clrespawnparm; // checkparm of -respawn
extern boolean clfastparm; // checkparm of -fast
//jff end of external declaration of command line playmode
void D_SetMaxHealth(void);
void D_SetBloodColor(void);
void D_SetPredefinedTranslucency(void);
void D_DehChangePredefinedTranslucency(int index);

View File

@ -3113,6 +3113,8 @@ void G_ReloadDefaults(boolean keep_demover)
G_MBF21Defaults();
}
D_SetMaxHealth();
D_SetBloodColor();
D_SetPredefinedTranslucency();

View File

@ -39,6 +39,7 @@
int initial_health = 100;
int initial_bullets = 50;
int maxhealth = 100; // was MAXHEALTH as a #define, used only in this module
int maxhealthbonus = 200;
int max_armor = 200;
int green_armor_class = 1; // these are involved with armortype below
int blue_armor_class = 2;
@ -334,8 +335,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher)
}
player->health++; // can go over 100%
if (player->health > (maxhealth * 2))
player->health = (maxhealth * 2);
if (player->health > maxhealthbonus)
player->health = maxhealthbonus;
player->mo->health = player->health;
pickupmsg(player, "%s", s_GOTHTHBONUS); // Ty 03/22/98 - externalized
break;

View File

@ -46,6 +46,7 @@ extern int idkfa_armor_class; // Ty - end
extern int initial_health;
extern int initial_bullets;
extern int maxhealth;
extern int maxhealthbonus;
extern int max_armor;
extern int green_armor_class;
extern int blue_armor_class;