Skip to content

Commit

Permalink
Support compat_zombie in MAPINFO lumps
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Jul 3, 2023
1 parent 4227a08 commit 7e95a45
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 36 deletions.
1 change: 1 addition & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
78 changes: 44 additions & 34 deletions src/p_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -125,6 +126,7 @@ typedef struct
bool compat_nopassover;
bool compat_stairs;
bool compat_useblocking;
bool compat_zombie;
bool endbunny;
bool endcast;
bool endgame;
Expand Down Expand Up @@ -253,6 +255,7 @@ static char *mapcmdnames[] =
"COMPAT_STAIRS",
"COMPAT_USEBLOCKING",
"COMPAT_VILEGHOSTS",
"COMPAT_ZOMBIE",
"ENDBUNNY",
"ENDCAST",
"ENDGAME",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -347,6 +351,7 @@ bool compat_limitpain;
bool compat_nopassover;
bool compat_stairs;
bool compat_useblocking;
bool compat_zombie;
bool nograduallighting;

bool canmodify;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/p_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
18 changes: 16 additions & 2 deletions src/p_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions src/p_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7e95a45

Please sign in to comment.