- added compatibility flag for buggy CheckSwitchRange behavior

https://forum.zdoom.org/viewtopic.php?t=63008
https://forum.zdoom.org/viewtopic.php?t=63650
This commit is contained in:
alexey.lysiuk 2019-02-11 16:26:11 +02:00 committed by Christoph Oelckers
parent af5a2fe522
commit d4d010ac32
8 changed files with 17 additions and 4 deletions

View file

@ -600,7 +600,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
case 4: // Old ZDoom compat mode case 4: // Old ZDoom compat mode
v = COMPATF_SOUNDTARGET | COMPATF_LIGHT; v = COMPATF_SOUNDTARGET | COMPATF_LIGHT;
w = COMPATF2_MULTIEXIT | COMPATF2_TELEPORT | COMPATF2_PUSHWINDOW; w = COMPATF2_MULTIEXIT | COMPATF2_TELEPORT | COMPATF2_PUSHWINDOW | COMPATF2_CHECKSWITCHRANGE;
break; break;
case 5: // MBF compat mode 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_multiexit, compatflags2, COMPATF2_MULTIEXIT);
CVAR (Flag, compat_teleport, compatflags2, COMPATF2_TELEPORT); CVAR (Flag, compat_teleport, compatflags2, COMPATF2_TELEPORT);
CVAR (Flag, compat_pushwindow, compatflags2, COMPATF2_PUSHWINDOW); CVAR (Flag, compat_pushwindow, compatflags2, COMPATF2_PUSHWINDOW);
CVAR (Flag, compat_checkswitchrange, compatflags2, COMPATF2_CHECKSWITCHRANGE);
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

View file

@ -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_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_TELEPORT = 1 << 5, // Don't let indirect teleports trigger sector actions
COMPATF2_PUSHWINDOW = 1 << 6, // Disable the window check in CheckForPushSpecial() 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 // Emulate old bugs for select maps. These are not exposed by a cvar

View file

@ -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) 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) 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 else
{ {
// no switch found. Check whether the player can touch either top or bottom texture // 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) );
} }
} }

View file

@ -1619,6 +1619,7 @@ MapFlagHandlers[] =
{ "compat_multiexit", MITYPE_COMPATFLAG, 0, COMPATF2_MULTIEXIT }, { "compat_multiexit", MITYPE_COMPATFLAG, 0, COMPATF2_MULTIEXIT },
{ "compat_teleport", MITYPE_COMPATFLAG, 0, COMPATF2_TELEPORT }, { "compat_teleport", MITYPE_COMPATFLAG, 0, COMPATF2_TELEPORT },
{ "compat_pushwindow", MITYPE_COMPATFLAG, 0, COMPATF2_PUSHWINDOW }, { "compat_pushwindow", MITYPE_COMPATFLAG, 0, COMPATF2_PUSHWINDOW },
{ "compat_checkswitchrange", MITYPE_COMPATFLAG, 0, COMPATF2_CHECKSWITCHRANGE },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 }, { "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end2_track", MITYPE_EATNEXT, 0, 0 },

View file

@ -164,6 +164,7 @@ static FCompatOption Options[] =
{ "multiexit", COMPATF2_MULTIEXIT, SLOT_COMPAT2 }, { "multiexit", COMPATF2_MULTIEXIT, SLOT_COMPAT2 },
{ "teleport", COMPATF2_TELEPORT, SLOT_COMPAT2 }, { "teleport", COMPATF2_TELEPORT, SLOT_COMPAT2 },
{ "disablepushwindowcheck", COMPATF2_PUSHWINDOW, SLOT_COMPAT2 }, { "disablepushwindowcheck", COMPATF2_PUSHWINDOW, SLOT_COMPAT2 },
{ "checkswitchrange", COMPATF2_CHECKSWITCHRANGE, SLOT_COMPAT2 },
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };

View file

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

View file

@ -1434,6 +1434,7 @@ OptionMenu "CompatibilityOptions" protected
Option "$CMPTMNU_MULTIEXIT", "compat_multiexit", "YesNo" Option "$CMPTMNU_MULTIEXIT", "compat_multiexit", "YesNo"
Option "$CMPTMNU_TELEPORT", "compat_teleport", "YesNo" Option "$CMPTMNU_TELEPORT", "compat_teleport", "YesNo"
Option "$CMPTMNU_PUSHWINDOW", "compat_pushwindow", "YesNo" Option "$CMPTMNU_PUSHWINDOW", "compat_pushwindow", "YesNo"
Option "$CMPTMNU_CHECKSWITCHRANGE", "compat_checkswitchrange", "YesNo"
StaticText " " StaticText " "
StaticText "$CMPTMNU_PHYSICSBEHAVIOR",1 StaticText "$CMPTMNU_PHYSICSBEHAVIOR",1

View file

@ -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_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_TELEPORT = 1 << 5, // Don't let indirect teleports trigger sector actions
COMPATF2_PUSHWINDOW = 1 << 6, // Disable the window check in CheckForPushSpecial() COMPATF2_PUSHWINDOW = 1 << 6, // Disable the window check in CheckForPushSpecial()
COMPATF2_CHECKSWITCHRANGE = 1 << 7, // Enable buggy CheckSwitchRange behavior
}; };