From 7e95a45a2ba7624d92ac9ce5fdc996e994ccbcb2 Mon Sep 17 00:00:00 2001 From: Brad Harding Date: Mon, 3 Jul 2023 16:20:01 +1000 Subject: [PATCH] Support `compat_zombie` in `MAPINFO` lumps --- releasenotes.md | 1 + src/p_setup.c | 78 ++++++++++++++++++++++++++++--------------------- src/p_setup.h | 1 + src/p_spec.c | 18 ++++++++++-- src/p_switch.c | 14 +++++++++ 5 files changed, 76 insertions(+), 36 deletions(-) diff --git a/releasenotes.md b/releasenotes.md index a1166fe41f..41c827b5b3 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -31,6 +31,7 @@ * `MAPINFO` lumps are now parsed if either `NERVE.WAD` or `SIGIL.WAD` are loaded. * `bossaction` is now recognized. * `compat_stairs` is now recognized. + * `compat_zombie` is now recognized. * Friendly monsters spawned using the `spawn` CCMD will now follow the player into the next map. * Minor improvements have been made to the support of [*MBF21*](https://doomwiki.org/wiki/MBF21)-compatible WADs. * The mouse pointer is no longer displayed on the intermission or finale screens when the player moves the mouse and the `m_pointer` CVAR is `on`. diff --git a/src/p_setup.c b/src/p_setup.c index 37bb884ef1..6d677c8ef9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -76,40 +76,41 @@ #define MCMD_COMPAT_STAIRS 10 #define MCMD_COMPAT_USEBLOCKING 11 #define MCMD_COMPAT_VILEGHOSTS 12 -#define MCMD_ENDBUNNY 13 -#define MCMD_ENDCAST 14 -#define MCMD_ENDGAME 15 -#define MCMD_ENDPIC 16 -#define MCMD_ENTERPIC 17 -#define MCMD_EPISODE 18 -#define MCMD_EXITPIC 19 -#define MCMD_INTERBACKDROP 20 -#define MCMD_INTERMUSIC 21 -#define MCMD_INTERTEXT 22 -#define MCMD_INTERTEXTSECRET 23 -#define MCMD_LABEL 24 -#define MCMD_LEVELNAME 25 -#define MCMD_LEVELPIC 26 -#define MCMD_LIQUID 27 -#define MCMD_MUSIC 28 -#define MCMD_MUSICARTIST 29 -#define MCMD_MUSICTITLE 30 -#define MCMD_NEXT 31 -#define MCMD_NEXTSECRET 32 -#define MCMD_NOBRIGHTMAP 33 -#define MCMD_NOFREELOOK 34 -#define MCMD_NOGRADUALLIGHTING 35 -#define MCMD_NOINTERMISSION 36 -#define MCMD_NOJUMP 37 -#define MCMD_NOLIQUID 38 -#define MCMD_NOMOUSELOOK 39 -#define MCMD_PAR 40 -#define MCMD_PARTIME 41 -#define MCMD_PISTOLSTART 42 -#define MCMD_SECRETNEXT 43 -#define MCMD_SKY1 44 -#define MCMD_SKYTEXTURE 45 -#define MCMD_TITLEPATCH 46 +#define MCMD_COMPAT_ZOMBIE 13 +#define MCMD_ENDBUNNY 14 +#define MCMD_ENDCAST 15 +#define MCMD_ENDGAME 16 +#define MCMD_ENDPIC 17 +#define MCMD_ENTERPIC 18 +#define MCMD_EPISODE 19 +#define MCMD_EXITPIC 20 +#define MCMD_INTERBACKDROP 21 +#define MCMD_INTERMUSIC 22 +#define MCMD_INTERTEXT 23 +#define MCMD_INTERTEXTSECRET 24 +#define MCMD_LABEL 25 +#define MCMD_LEVELNAME 26 +#define MCMD_LEVELPIC 27 +#define MCMD_LIQUID 28 +#define MCMD_MUSIC 29 +#define MCMD_MUSICARTIST 30 +#define MCMD_MUSICTITLE 31 +#define MCMD_NEXT 32 +#define MCMD_NEXTSECRET 33 +#define MCMD_NOBRIGHTMAP 34 +#define MCMD_NOFREELOOK 35 +#define MCMD_NOGRADUALLIGHTING 36 +#define MCMD_NOINTERMISSION 37 +#define MCMD_NOJUMP 38 +#define MCMD_NOLIQUID 39 +#define MCMD_NOMOUSELOOK 40 +#define MCMD_PAR 41 +#define MCMD_PARTIME 42 +#define MCMD_PISTOLSTART 43 +#define MCMD_SECRETNEXT 44 +#define MCMD_SKY1 45 +#define MCMD_SKYTEXTURE 46 +#define MCMD_TITLEPATCH 47 typedef struct { @@ -125,6 +126,7 @@ typedef struct bool compat_nopassover; bool compat_stairs; bool compat_useblocking; + bool compat_zombie; bool endbunny; bool endcast; bool endgame; @@ -253,6 +255,7 @@ static char *mapcmdnames[] = "COMPAT_STAIRS", "COMPAT_USEBLOCKING", "COMPAT_VILEGHOSTS", + "COMPAT_ZOMBIE", "ENDBUNNY", "ENDCAST", "ENDGAME", @@ -304,6 +307,7 @@ static int mapcmdids[] = MCMD_COMPAT_STAIRS, MCMD_COMPAT_USEBLOCKING, MCMD_COMPAT_VILEGHOSTS, + MCMD_COMPAT_ZOMBIE, MCMD_ENDBUNNY, MCMD_ENDCAST, MCMD_ENDGAME, @@ -347,6 +351,7 @@ bool compat_limitpain; bool compat_nopassover; bool compat_stairs; bool compat_useblocking; +bool compat_zombie; bool nograduallighting; bool canmodify; @@ -3258,6 +3263,7 @@ void P_SetupLevel(int ep, int map) compat_nopassover = mapinfo[map].compat_nopassover; compat_stairs = mapinfo[map].compat_stairs; compat_useblocking = mapinfo[map].compat_useblocking; + compat_zombie = mapinfo[map].compat_zombie; nograduallighting = mapinfo[map].nograduallighting; } @@ -3813,6 +3819,10 @@ static bool P_ParseMapInfo(const char *scriptname) case MCMD_COMPAT_USEBLOCKING: info->compat_useblocking = true; break; + + case MCMD_COMPAT_ZOMBIE: + info->compat_zombie = true; + break; } } diff --git a/src/p_setup.h b/src/p_setup.h index 117f050675..6b8a8f9c64 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -57,6 +57,7 @@ extern bool compat_limitpain; extern bool compat_nopassover; extern bool compat_stairs; extern bool compat_useblocking; +extern bool compat_zombie; extern bool nograduallighting; extern char mapnum[6]; diff --git a/src/p_spec.c b/src/p_spec.c index 3c1e4c47ed..88a35276dd 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1595,7 +1595,10 @@ void P_CrossSpecialLine(line_t *line, int side, mobj_t *thing, bool bossaction) break; case W1_ExitLevel: - G_ExitLevel(); + // killough 10/98: prevent zombies from exiting levels + if (bossaction || !(thing->player && thing->player->health <= 0 && !compat_zombie)) + G_ExitLevel(); + break; case W1_Floor_StartMovingUpAndDown: @@ -1677,7 +1680,10 @@ void P_CrossSpecialLine(line_t *line, int side, mobj_t *thing, bool bossaction) break; case W1_ExitLevel_GoesToSecretLevel: - G_SecretExitLevel(); + // killough 10/98: prevent zombies from exiting levels + if (bossaction || !(thing->player && thing->player->health <= 0 && !compat_zombie)) + G_SecretExitLevel(); + break; case W1_Teleport_MonstersOnly: @@ -2186,11 +2192,19 @@ void P_ShootSpecialLine(const mobj_t *thing, line_t *line) break; case G1_ExitLevel: + // killough 10/98: prevent zombies from exiting levels + if (thing->player && thing->player->health <= 0 && !compat_zombie) + break; + P_ChangeSwitchTexture(line, false); G_ExitLevel(); break; case G1_ExitLevel_GoesToSecretLevel: + // killough 10/98: prevent zombies from exiting levels + if (thing->player && thing->player->health <= 0 && !compat_zombie) + break; + P_ChangeSwitchTexture(line, false); G_SecretExitLevel(); break; diff --git a/src/p_switch.c b/src/p_switch.c index d678690ae1..0e258dca90 100644 --- a/src/p_switch.c +++ b/src/p_switch.c @@ -437,6 +437,13 @@ bool P_UseSpecialLine(mobj_t *thing, line_t *line, int side, bool bossaction) break; case S1_ExitLevel: + // killough 10/98: prevent zombies from exiting levels + if (!bossaction && thing->player && thing->player->health <= 0 && !compat_zombie) + { + S_StartSound(thing, sfx_noway); + return false; + } + P_ChangeSwitchTexture(line, false); G_ExitLevel(); break; @@ -519,6 +526,13 @@ bool P_UseSpecialLine(mobj_t *thing, line_t *line, int side, bool bossaction) break; case S1_ExitLevel_GoesToSecretLevel: + // killough 10/98: prevent zombies from exiting levels + if (!bossaction && thing->player && thing->player->health <= 0 && !compat_zombie) + { + S_StartSound(thing, sfx_noway); + return false; + } + P_ChangeSwitchTexture(line, false); G_SecretExitLevel(); break;