Skip to content

Commit

Permalink
added emulation of Final Doom's teleporter z glitch and activate it f…
Browse files Browse the repository at this point in the history
…or Saturnia MAP10
  • Loading branch information
coelckers committed Apr 27, 2024
1 parent 0e83254 commit 0049a00
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/d_main.cpp
Expand Up @@ -712,6 +712,8 @@ CVAR (Flag, compat_railing, compatflags2, COMPATF2_RAILING);
CVAR (Flag, compat_avoidhazard, compatflags2, COMPATF2_AVOID_HAZARDS);
CVAR (Flag, compat_stayonlift, compatflags2, COMPATF2_STAYONLIFT);
CVAR (Flag, compat_nombf21, compatflags2, COMPATF2_NOMBF21);
CVAR (Flag, compat_voodoozombies, compatflags2, COMPATF2_VOODOO_ZOMBIES);
CVAR (Flag, compat_fdteleport, compatflags2, COMPATF2_FDTELEPORT);

CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

Expand Down
1 change: 1 addition & 0 deletions src/doomdef.h
Expand Up @@ -241,6 +241,7 @@ enum : unsigned int
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
COMPATF2_FDTELEPORT = 1 << 16, // Emulate Final Doom's teleporter z glitch.

};

Expand Down
1 change: 1 addition & 0 deletions src/maploader/compatibility.cpp
Expand Up @@ -173,6 +173,7 @@ static FCompatOption Options[] =
{ "scriptwait", COMPATF2_SCRIPTWAIT, SLOT_COMPAT2 },
{ "nombf21", COMPATF2_NOMBF21, SLOT_COMPAT2 },
{ "voodoozombies", COMPATF2_VOODOO_ZOMBIES, SLOT_COMPAT2 },
{ "fdteleport", COMPATF2_FDTELEPORT, SLOT_COMPAT2 },
{ NULL, 0, 0 }
};

Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_lnspec.cpp
Expand Up @@ -1120,7 +1120,7 @@ FUNC(LS_Teleport_NewMap)
FUNC(LS_Teleport)
// Teleport (tid, sectortag, bNoSourceFog)
{
int flags = TELF_DESTFOG;
int flags = TELF_DESTFOG | TELF_FDCOMPAT;
if (!arg2)
{
flags |= TELF_SOURCEFOG;
Expand Down
1 change: 1 addition & 0 deletions src/playsim/p_spec.h
Expand Up @@ -141,6 +141,7 @@ enum
TELF_KEEPHEIGHT = 16,
TELF_ROTATEBOOM = 32,
TELF_ROTATEBOOMINVERSE = 64,
TELF_FDCOMPAT = 128,
};

//Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false).
Expand Down
23 changes: 20 additions & 3 deletions src/playsim/p_teleport.cpp
Expand Up @@ -128,7 +128,15 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
}
else
{
pos.Z = floorheight;
if (!(thing->Level->i_compatflags2 & COMPATF2_FDTELEPORT) || !(flags & TELF_FDCOMPAT) || floorheight > thing->Z())
{
pos.Z = floorheight;
}
else
{
pos.Z = thing->Z();
}

if (!(flags & TELF_KEEPORIENTATION))
{
resetpitch = false;
Expand All @@ -145,7 +153,16 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
}
else
{
pos.Z = floorheight;
// emulation of Final Doom's teleport glitch.
// For walking monsters we still have to force them to the ground because the handling of off-ground monsters is different from vanilla.
if (!(thing->Level->i_compatflags2 & COMPATF2_FDTELEPORT) || !(flags & TELF_FDCOMPAT) || !(thing->flags & MF_NOGRAVITY) || floorheight > pos.Z)
{
pos.Z = floorheight;
}
else
{
pos.Z = thing->Z();
}
}
}
// [MK] notify thing of incoming teleport, check for an early cancel
Expand Down Expand Up @@ -245,7 +262,7 @@ DEFINE_ACTION_FUNCTION(AActor, Teleport)
PARAM_FLOAT(z);
PARAM_ANGLE(an);
PARAM_INT(flags);
ACTION_RETURN_BOOL(P_Teleport(self, DVector3(x, y, z), an, flags));
ACTION_RETURN_BOOL(P_Teleport(self, DVector3(x, y, z), an, flags & ~TELF_FDCOMPAT));
}

//-----------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions wadsrc/static/compatibility.txt
Expand Up @@ -332,3 +332,8 @@ F1EB6927F53047F219A54997DAD9DC81 // mm2.wad map20
rebuildnodes
trace
}

BA2247ED1465C8107192AC4215B2A5F3 // saturnia.wad map10
{
fdteleport
}
2 changes: 2 additions & 0 deletions wadsrc/static/menudef.txt
Expand Up @@ -1758,6 +1758,7 @@ OptionMenu "CompatActorMenu" protected
Option "$CMPTMNU_INVISIBILITY", "compat_INVISIBILITY", "YesNo"
Option "$CMPTMNU_MINOTAUR", "compat_MINOTAUR", "YesNo"
Option "$CMPTMNU_NOTOSSDROPS", "compat_NOTOSSDROPS", "YesNo"
Option "$CMPTMNU_VOODOOZOMBIES", "compat_voodoozombies", "YesNo"
Class "CompatibilityMenu"
}

Expand All @@ -1784,6 +1785,7 @@ OptionMenu "CompatMapMenu" protected
Option "$CMPTMNU_POINTONLINE", "compat_pointonline", "YesNo"
Option "$CMPTMNU_MULTIEXIT", "compat_multiexit", "YesNo"
Option "$CMPTMNU_TELEPORT", "compat_teleport", "YesNo"
Option "$CMPTMNU_FDTELEPORT", "compat_fdteleport", "YesNo"
Option "$CMPTMNU_PUSHWINDOW", "compat_pushwindow", "YesNo"
Option "$CMPTMNU_CHECKSWITCHRANGE", "compat_checkswitchrange", "YesNo"
Option "$CMPTMNU_RAILINGHACK", "compat_railing", "YesNo"
Expand Down

0 comments on commit 0049a00

Please sign in to comment.