mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-21 18:31:10 +00:00
Add Voodoo Zombie Compatflag
This commit is contained in:
parent
ca0db39027
commit
1589afb46e
7 changed files with 51 additions and 7 deletions
|
@ -625,7 +625,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
|||
COMPATF_TRACE | COMPATF_MISSILECLIP | COMPATF_SOUNDTARGET | COMPATF_NO_PASSMOBJ | COMPATF_LIMITPAIN |
|
||||
COMPATF_DEHHEALTH | COMPATF_INVISIBILITY | COMPATF_CROSSDROPOFF | COMPATF_VILEGHOSTS | COMPATF_HITSCAN |
|
||||
COMPATF_WALLRUN | COMPATF_NOTOSSDROPS | COMPATF_LIGHT | COMPATF_MASKEDMIDTEX;
|
||||
w = COMPATF2_BADANGLES | COMPATF2_FLOORMOVE | COMPATF2_POINTONLINE | COMPATF2_EXPLODE2 | COMPATF2_NOMBF21;
|
||||
w = COMPATF2_BADANGLES | COMPATF2_FLOORMOVE | COMPATF2_POINTONLINE | COMPATF2_EXPLODE2 | COMPATF2_NOMBF21 | COMPATF2_VOODOO_ZOMBIES;
|
||||
break;
|
||||
|
||||
case 3: // Boom compat mode
|
||||
|
|
|
@ -233,6 +233,7 @@ enum : unsigned int
|
|||
COMPATF2_AVOID_HAZARDS = 1 << 12, // another MBF thing.
|
||||
COMPATF2_STAYONLIFT = 1 << 13, // yet another MBF thing.
|
||||
COMPATF2_NOMBF21 = 1 << 14, // disable MBF21 features that may clash with certain maps
|
||||
COMPATF2_VOODOO_ZOMBIES = 1 << 15, // [RL0] allow playerinfo, playerpawn, and voodoo health to all be different, and skip killing the player's mobj if a voodoo doll dies to allow voodoo zombies
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1842,6 +1842,7 @@ MapFlagHandlers[] =
|
|||
{ "compat_avoidhazards", MITYPE_COMPATFLAG, 0, COMPATF2_AVOID_HAZARDS },
|
||||
{ "compat_stayonlift", MITYPE_COMPATFLAG, 0, COMPATF2_STAYONLIFT },
|
||||
{ "compat_nombf21", MITYPE_COMPATFLAG, 0, COMPATF2_NOMBF21 },
|
||||
{ "compat_voodoozombies", MITYPE_COMPATFLAG, 0, COMPATF2_VOODOO_ZOMBIES },
|
||||
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
|
||||
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
|
||||
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },
|
||||
|
|
|
@ -171,6 +171,7 @@ static FCompatOption Options[] =
|
|||
{ "railing", COMPATF2_RAILING, SLOT_COMPAT2 },
|
||||
{ "scriptwait", COMPATF2_SCRIPTWAIT, SLOT_COMPAT2 },
|
||||
{ "nombf21", COMPATF2_NOMBF21, SLOT_COMPAT2 },
|
||||
{ "voodoozombies", COMPATF2_VOODOO_ZOMBIES, SLOT_COMPAT2 },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -1335,13 +1335,24 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
}
|
||||
}
|
||||
|
||||
bool compat_voodoo_zombie = target->Level->i_compatflags2 & COMPATF2_VOODOO_ZOMBIES;
|
||||
|
||||
player->health -= damage; // mirror mobj health here for Dave
|
||||
// [RH] Make voodoo dolls and real players record the same health
|
||||
target->health = player->mo->health -= damage;
|
||||
if(compat_voodoo_zombie)
|
||||
{ // [RL0] To allow voodoo zombies, don't set the voodoo doll to the player mobj's health and don't change the player mobj's health on damage
|
||||
target->health -= damage;
|
||||
}
|
||||
else
|
||||
{ // [RH] Make voodoo dolls and real players record the same health
|
||||
target->health = player->mo->health -= damage;
|
||||
}
|
||||
if (player->health < 50 && !deathmatch && !(flags & DMG_FORCED))
|
||||
{
|
||||
P_AutoUseStrifeHealth (player);
|
||||
player->mo->health = player->health;
|
||||
if(!compat_voodoo_zombie)
|
||||
{ // [RL0] To match vanilla behavior, don't set the player mo's health to 0 if voodoo zombies compat is enabled
|
||||
player->mo->health = player->health;
|
||||
}
|
||||
}
|
||||
if (player->health <= 0)
|
||||
{
|
||||
|
|
|
@ -85,6 +85,11 @@ class PlayerPawn : Actor
|
|||
flagdef CanSuperMorph: PlayerFlags, 1;
|
||||
flagdef CrouchableMorph: PlayerFlags, 2;
|
||||
flagdef WeaponLevel2Ended: PlayerFlags, 3;
|
||||
|
||||
enum EPrivatePlayerFlags
|
||||
{
|
||||
PF_VOODOO_ZOMBIE = 1<<4,
|
||||
}
|
||||
|
||||
Default
|
||||
{
|
||||
|
@ -777,14 +782,16 @@ class PlayerPawn : Actor
|
|||
Super.Die (source, inflictor, dmgflags, MeansOfDeath);
|
||||
|
||||
if (player != NULL && player.mo == self) player.bonuscount = 0;
|
||||
|
||||
if (player != NULL && player.mo != self)
|
||||
|
||||
// [RL0] To allow voodoo zombies, don't kill the player together with voodoo dolls if the compat flag is enabled
|
||||
if (player != NULL && player.mo != self && !(Level.compatflags2 & COMPATF2_VOODOO_ZOMBIES))
|
||||
{ // Make the real player die, too
|
||||
player.mo.Die (source, inflictor, dmgflags, MeansOfDeath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player != NULL && sv_weapondrop)
|
||||
// [RL0] player.mo == self will always be true if COMPATF2_VOODOO_ZOMBIES is false, so there's no need to check the compatflag here too, just self
|
||||
if (player != NULL && sv_weapondrop && player.mo == self)
|
||||
{ // Voodoo dolls don't drop weapons
|
||||
let weap = player.ReadyWeapon;
|
||||
if (weap != NULL)
|
||||
|
@ -1609,6 +1616,12 @@ class PlayerPawn : Actor
|
|||
{
|
||||
let player = self.player;
|
||||
UserCmd cmd = player.cmd;
|
||||
|
||||
// [RL0] Mark players that became zombies (this stays even if they 'revive' by healing, until a level change)
|
||||
if((Level.compatflags2 & COMPATF2_VOODOO_ZOMBIES) && player.health <= 0 && player.mo.health > 0)
|
||||
{
|
||||
PlayerFlags |= PF_VOODOO_ZOMBIE;
|
||||
}
|
||||
|
||||
CheckFOV();
|
||||
|
||||
|
@ -1692,6 +1705,9 @@ class PlayerPawn : Actor
|
|||
|
||||
void BringUpWeapon ()
|
||||
{
|
||||
// [RL0] Don't bring up weapon when in a voodoo zombie state
|
||||
if(PlayerFlags & PF_VOODOO_ZOMBIE) return;
|
||||
|
||||
let player = self.player;
|
||||
if (player.PendingWeapon == WP_NOCHANGE)
|
||||
{
|
||||
|
@ -2007,6 +2023,19 @@ class PlayerPawn : Actor
|
|||
|
||||
void PlayerFinishLevel (int mode, int flags)
|
||||
{
|
||||
// [RL0] Handle player exit behavior for voodoo zombies
|
||||
if(PlayerFlags & PF_VOODOO_ZOMBIE)
|
||||
{
|
||||
if(player.health > 0)
|
||||
{
|
||||
PlayerFlags &= ~PF_VOODOO_ZOMBIE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bShootable = false;
|
||||
bKilled = true;
|
||||
}
|
||||
}
|
||||
Inventory item, next;
|
||||
let p = player;
|
||||
|
||||
|
|
|
@ -1429,6 +1429,7 @@ enum ECompatFlags
|
|||
COMPATF2_EXPLODE1 = 1 << 8, // No vertical explosion thrust
|
||||
COMPATF2_EXPLODE2 = 1 << 9, // Use original explosion code throughout.
|
||||
COMPATF2_RAILING = 1 << 10, // Bugged Strife railings.
|
||||
COMPATF2_VOODOO_ZOMBIES = 1 << 15, // allow playerinfo, playerpawn, and voodoo health to all be different, and allow monster targetting of 'dead' players that have positive health
|
||||
};
|
||||
|
||||
const M_E = 2.7182818284590452354; // e
|
||||
|
|
Loading…
Reference in a new issue