mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Merge pull request #384 from alexey-lysiuk/compat_pointonline
Added compatibility flag for point-on-line algorithm
This commit is contained in:
commit
2ce8ee7154
7 changed files with 106 additions and 3 deletions
|
@ -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 }
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -240,7 +240,11 @@ 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;
|
||||
extern int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line);
|
||||
|
||||
return compatflags2 & COMPATF2_POINTONLINE
|
||||
? P_VanillaPointOnLineSide(x, y, line)
|
||||
: DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -254,7 +258,11 @@ 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;
|
||||
extern int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const divline_t* line);
|
||||
|
||||
return (compatflags2 & COMPATF2_POINTONLINE)
|
||||
? P_VanillaPointOnDivlineSide(x, y, line)
|
||||
: (DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -1523,3 +1523,92 @@ static AActor *RoughBlockCheck (AActor *mo, int index, void *param)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// P_VanillaPointOnLineSide
|
||||
// P_PointOnLineSide() from the initial Doom source code release
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line)
|
||||
{
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
if (!line->dx)
|
||||
{
|
||||
if (x <= line->v1->x)
|
||||
return line->dy > 0;
|
||||
|
||||
return line->dy < 0;
|
||||
}
|
||||
if (!line->dy)
|
||||
{
|
||||
if (y <= line->v1->y)
|
||||
return line->dx < 0;
|
||||
|
||||
return line->dx > 0;
|
||||
}
|
||||
|
||||
dx = (x - line->v1->x);
|
||||
dy = (y - line->v1->y);
|
||||
|
||||
left = FixedMul ( line->dy>>FRACBITS , dx );
|
||||
right = FixedMul ( dy , line->dx>>FRACBITS );
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
return 1; // back side
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// P_VanillaPointOnDivlineSide
|
||||
// P_PointOnDivlineSide() from the initial Doom source code release
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const divline_t* line)
|
||||
{
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
if (!line->dx)
|
||||
{
|
||||
if (x <= line->x)
|
||||
return line->dy > 0;
|
||||
|
||||
return line->dy < 0;
|
||||
}
|
||||
if (!line->dy)
|
||||
{
|
||||
if (y <= line->y)
|
||||
return line->dx < 0;
|
||||
|
||||
return line->dx > 0;
|
||||
}
|
||||
|
||||
dx = (x - line->x);
|
||||
dy = (y - line->y);
|
||||
|
||||
// try to quickly decide by looking at sign bits
|
||||
if ( (line->dy ^ line->dx ^ dx ^ dy)&0x80000000 )
|
||||
{
|
||||
if ( (line->dy ^ dx) & 0x80000000 )
|
||||
return 1; // (left is negative)
|
||||
return 0;
|
||||
}
|
||||
|
||||
left = FixedMul ( line->dy>>8, dx>>8 );
|
||||
right = FixedMul ( dy>>8 , line->dx>>8 );
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
return 1; // back side
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue