Added compatibility flag for point-on-line algorithm

It's possible to use original but buggy implementations of P_PointOnLineSide() and P_PointOnDivlineSide() function
See http://forum.zdoom.org/viewtopic.php?f=2&t=49544
This commit is contained in:
alexey.lysiuk 2015-09-15 16:45:20 +03:00
parent b1b8f3a5f9
commit ee7eb3253a
6 changed files with 15 additions and 3 deletions

View file

@ -145,6 +145,7 @@ static FCompatOption Options[] =
{ "badangles", COMPATF2_BADANGLES, SLOT_COMPAT2 },
{ "floormove", COMPATF2_FLOORMOVE, SLOT_COMPAT2 },
{ "soundcutoff", COMPATF2_SOUNDCUTOFF, SLOT_COMPAT2 },
{ "pointonline", COMPATF2_POINTONLINE, SLOT_COMPAT2 },
{ NULL, 0, 0 }
};

View file

@ -561,7 +561,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_NO_PASSMOBJ|COMPATF_LIMITPAIN|
COMPATF_DEHHEALTH|COMPATF_INVISIBILITY|COMPATF_CROSSDROPOFF|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|
COMPATF_WALLRUN|COMPATF_NOTOSSDROPS|COMPATF_LIGHT|COMPATF_MASKEDMIDTEX;
w = COMPATF2_BADANGLES|COMPATF2_FLOORMOVE;
w = COMPATF2_BADANGLES|COMPATF2_FLOORMOVE|COMPATF2_POINTONLINE;
break;
case 3: // Boom compat mode
@ -580,6 +580,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
case 6: // Boom with some added settings to reenable some 'broken' behavior
v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP|COMPATF_NO_PASSMOBJ|
COMPATF_INVISIBILITY|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|COMPATF_WALLRUN|COMPATF_NOTOSSDROPS;
w = COMPATF2_POINTONLINE;
break;
}
@ -622,6 +623,7 @@ CVAR (Flag, compat_maskedmidtex, compatflags, COMPATF_MASKEDMIDTEX);
CVAR (Flag, compat_badangles, compatflags2, COMPATF2_BADANGLES);
CVAR (Flag, compat_floormove, compatflags2, COMPATF2_FLOORMOVE);
CVAR (Flag, compat_soundcutoff, compatflags2, COMPATF2_SOUNDCUTOFF);
CVAR (Flag, compat_pointonline, compatflags2, COMPATF2_POINTONLINE);
//==========================================================================
//

View file

@ -340,6 +340,7 @@ enum
COMPATF2_BADANGLES = 1 << 0, // It is impossible to face directly NSEW.
COMPATF2_FLOORMOVE = 1 << 1, // Use the same floor motion behavior as Doom.
COMPATF2_SOUNDCUTOFF = 1 << 2, // Cut off sounds when an actor vanishes instead of making it owner-less
COMPATF2_POINTONLINE = 1 << 3, // Use original but buggy P_PointOnLineSide() and P_PointOnDivlineSide()
};
// Emulate old bugs for select maps. These are not exposed by a cvar

View file

@ -1333,6 +1333,7 @@ MapFlagHandlers[] =
{ "compat_badangles", MITYPE_COMPATFLAG, 0, COMPATF2_BADANGLES },
{ "compat_floormove", MITYPE_COMPATFLAG, 0, COMPATF2_FLOORMOVE },
{ "compat_soundcutoff", MITYPE_COMPATFLAG, 0, COMPATF2_SOUNDCUTOFF },
{ "compat_pointonline", MITYPE_COMPATFLAG, 0, COMPATF2_POINTONLINE },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },

View file

@ -240,7 +240,10 @@ fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
inline int P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line)
{
return DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
const SDWORD result = DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy);
return (compatflags2 & COMPATF2_POINTONLINE)
? result >= 0
: result > 0;
}
//==========================================================================
@ -254,7 +257,10 @@ inline int P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line)
inline int P_PointOnDivlineSide (fixed_t x, fixed_t y, const divline_t *line)
{
return DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0;
const SDWORD result = DMulScale32 (y-line->y, line->dx, line->x-x, line->dy);
return (compatflags2 & COMPATF2_POINTONLINE)
? result >= 0
: result > 0;
}
//==========================================================================

View file

@ -1303,6 +1303,7 @@ OptionMenu "CompatibilityOptions"
Option "Find shortest textures like Doom", "compat_SHORTTEX", "YesNo"
Option "Use buggier stair building", "compat_stairs", "YesNo"
Option "Use Doom's floor motion behavior", "compat_floormove", "YesNo"
Option "Use Doom's point-on-line algorithm", "compat_pointonline", "YesNo"
StaticText " "
StaticText "Physics Behavior",1