Permalink
Browse files

- added compatibility flag for buggy CheckSwitchRange behavior

  • Loading branch information...
alexey-lysiuk authored and coelckers committed Feb 11, 2019
1 parent af5a2fe commit d4d010ac322626aa3373b3ea6d6071105ef1180e
@@ -600,7 +600,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)

case 4: // Old ZDoom compat mode
v = COMPATF_SOUNDTARGET | COMPATF_LIGHT;
w = COMPATF2_MULTIEXIT | COMPATF2_TELEPORT | COMPATF2_PUSHWINDOW;
w = COMPATF2_MULTIEXIT | COMPATF2_TELEPORT | COMPATF2_PUSHWINDOW | COMPATF2_CHECKSWITCHRANGE;
break;

case 5: // MBF compat mode
@@ -658,6 +658,7 @@ CVAR (Flag, compat_pointonline, compatflags2, COMPATF2_POINTONLINE);
CVAR (Flag, compat_multiexit, compatflags2, COMPATF2_MULTIEXIT);
CVAR (Flag, compat_teleport, compatflags2, COMPATF2_TELEPORT);
CVAR (Flag, compat_pushwindow, compatflags2, COMPATF2_PUSHWINDOW);
CVAR (Flag, compat_checkswitchrange, compatflags2, COMPATF2_CHECKSWITCHRANGE);

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

@@ -328,6 +328,7 @@ enum : unsigned int
COMPATF2_MULTIEXIT = 1 << 4, // Level exit can be triggered multiple times (required by Daedalus's travel tubes, thanks to a faulty script)
COMPATF2_TELEPORT = 1 << 5, // Don't let indirect teleports trigger sector actions
COMPATF2_PUSHWINDOW = 1 << 6, // Disable the window check in CheckForPushSpecial()
COMPATF2_CHECKSWITCHRANGE = 1 << 7, // Enable buggy CheckSwitchRange behavior
};

// Emulate old bugs for select maps. These are not exposed by a cvar
@@ -194,7 +194,9 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, const DVector3 *
}
}

return (user->Top() > open.top);
return (user->Level->i_compatflags2 & COMPATF2_CHECKSWITCHRANGE)
? (user->Top() >= open.top)
: (user->Top() > open.top);
}
else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL)
{
@@ -216,7 +218,9 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, const DVector3 *
}
}

return (user->Z() < open.bottom);
return (user->Level->i_compatflags2 & COMPATF2_CHECKSWITCHRANGE)
? (user->Z() <= open.bottom)
: (user->Z() < open.bottom);
}
else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL)
{
@@ -229,7 +233,9 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, const DVector3 *
else
{
// no switch found. Check whether the player can touch either top or bottom texture
return (user->Top() > open.top) || (user->isBelow(open.bottom));
return (user->Level->i_compatflags2 & COMPATF2_CHECKSWITCHRANGE)
? ( (user->Top() >= open.top) || (user->Z() <= open.bottom) )
: ( (user->Top() > open.top) || user->isBelow(open.bottom) );
}
}

@@ -1619,6 +1619,7 @@ MapFlagHandlers[] =
{ "compat_multiexit", MITYPE_COMPATFLAG, 0, COMPATF2_MULTIEXIT },
{ "compat_teleport", MITYPE_COMPATFLAG, 0, COMPATF2_TELEPORT },
{ "compat_pushwindow", MITYPE_COMPATFLAG, 0, COMPATF2_PUSHWINDOW },
{ "compat_checkswitchrange", MITYPE_COMPATFLAG, 0, COMPATF2_CHECKSWITCHRANGE },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },
@@ -164,6 +164,7 @@ static FCompatOption Options[] =
{ "multiexit", COMPATF2_MULTIEXIT, SLOT_COMPAT2 },
{ "teleport", COMPATF2_TELEPORT, SLOT_COMPAT2 },
{ "disablepushwindowcheck", COMPATF2_PUSHWINDOW, SLOT_COMPAT2 },
{ "checkswitchrange", COMPATF2_CHECKSWITCHRANGE, SLOT_COMPAT2 },
{ NULL, 0, 0 }
};

@@ -2184,6 +2184,7 @@ CMPTMNU_SOUNDCUTOFF = "Sounds stop when actor vanishes";
CMPTMNU_SOUNDTARGET = "Use original sound target handling";
CMPTMNU_TELEPORT = "Scripted teleports don't trigger sector actions";
CMPTMNU_PUSHWINDOW = "Non-blocking lines can be pushed";
CMPTMNU_CHECKSWITCHRANGE = "Enable buggy CheckSwitchRange behavior";

// Sound Options
SNDMNU_TITLE = "SOUND OPTIONS";
@@ -1434,6 +1434,7 @@ OptionMenu "CompatibilityOptions" protected
Option "$CMPTMNU_MULTIEXIT", "compat_multiexit", "YesNo"
Option "$CMPTMNU_TELEPORT", "compat_teleport", "YesNo"
Option "$CMPTMNU_PUSHWINDOW", "compat_pushwindow", "YesNo"
Option "$CMPTMNU_CHECKSWITCHRANGE", "compat_checkswitchrange", "YesNo"

StaticText " "
StaticText "$CMPTMNU_PHYSICSBEHAVIOR",1
@@ -1338,4 +1338,5 @@ enum ECompatFlags
COMPATF2_MULTIEXIT = 1 << 4, // Level exit can be triggered multiple times (required by Daedalus's travel tubes, thanks to a faulty script)
COMPATF2_TELEPORT = 1 << 5, // Don't let indirect teleports trigger sector actions
COMPATF2_PUSHWINDOW = 1 << 6, // Disable the window check in CheckForPushSpecial()
COMPATF2_CHECKSWITCHRANGE = 1 << 7, // Enable buggy CheckSwitchRange behavior
};

0 comments on commit d4d010a

Please sign in to comment.