apply Vanilla demo fixes (#44)

* apply Vanilla demo fixes

This applies all the fixes found on
http://prboom.sourceforge.net/mbf-bugs.html

Of the demos used for regression checking in Chocolate Doom's
quickcheck directory, the AV and D2TWID demos now pass. The others
still desync sooner or later. :(

* add compatibility changes for EV_VerticalDoor() and EV_BuildStairs()

This time directly taken from PrBoom+.

* cosmetics

* revert major changes to EV_VerticalDoor() and EV_BuildStairs()

I'll probably just inject Vanilla code in there. I somehow prefer
this approach over PrBoom+'s if-the-else hell.

* unifying comments
This commit is contained in:
Fabian Greffrath 2020-01-20 11:11:40 +01:00 committed by GitHub
parent 171cfc9241
commit 10195043fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 7 deletions

View File

@ -95,6 +95,17 @@ result_e T_MovePlane
lastpos = sector->floorheight;
sector->floorheight -= speed;
flag = P_CheckSector(sector,crush); //jff 3/19/98 use faster chk
// [FG] Compatibility bug in T_MovePlane
// http://prboom.sourceforge.net/mbf-bugs.html
if ((flag == true) && demo_compatibility)
{
extern boolean P_ChangeSector(sector_t *sector,boolean crunch);
sector->floorheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
}
break;

View File

@ -1201,7 +1201,9 @@ void P_SlideMove(mobj_t *mo)
if (!P_TryMove(mo, mo->x, mo->y + mo->momy, true))
if (!P_TryMove(mo, mo->x + mo->momx, mo->y, true))
if (demo_version < 203 && !compatibility)
// [FG] Compatibility bug in P_SlideMove
// http://prboom.sourceforge.net/mbf-bugs.html
if (demo_version == 201)
mo->momx = mo->momy = 0;
break;
@ -1759,7 +1761,9 @@ static boolean PIT_ChangeSector(mobj_t *thing)
//
// P_ChangeSector
//
static boolean P_ChangeSector(sector_t *sector,boolean crunch)
// [FG] Compatibility bug in T_MovePlane
// http://prboom.sourceforge.net/mbf-bugs.html
boolean P_ChangeSector(sector_t *sector,boolean crunch)
{
int x, y;
@ -2006,6 +2010,12 @@ void P_CreateSecNodeList(mobj_t *thing,fixed_t x,fixed_t y)
int xl, xh, yl, yh, bx, by;
msecnode_t *node;
// [FG] Overlapping uses of global variables in p_map.c
// http://prboom.sourceforge.net/mbf-bugs.html
mobj_t* saved_tmthing = tmthing;
int saved_tmflags = tmflags;
fixed_t saved_tmx = tmx, saved_tmy = tmy;
// First, clear out the existing m_thing fields. As each node is
// added or verified as needed, m_thing will be set properly. When
// finished, delete all nodes where m_thing is still NULL. These
@ -2052,6 +2062,23 @@ void P_CreateSecNodeList(mobj_t *thing,fixed_t x,fixed_t y)
}
else
node = node->m_tnext;
// [FG] Overlapping uses of global variables in p_map.c
// http://prboom.sourceforge.net/mbf-bugs.html
if (demo_compatibility)
{
tmthing = saved_tmthing;
tmflags = saved_tmflags;
tmx = saved_tmx;
tmy = saved_tmy;
if (tmthing)
{
tmbbox[BOXTOP] = tmy + tmthing->radius;
tmbbox[BOXBOTTOM] = tmy - tmthing->radius;
tmbbox[BOXRIGHT] = tmx + tmthing->radius;
tmbbox[BOXLEFT] = tmx - tmthing->radius;
}
}
}
//----------------------------------------------------------------------------

View File

@ -26,6 +26,7 @@
//
//-----------------------------------------------------------------------------
#include "doomstat.h"
#include "r_main.h"
#include "p_maputl.h"
#include "p_setup.h"
@ -111,11 +112,16 @@ static boolean P_CrossSubsector(int num, register los_t *los)
// OPTIMIZE: killough 4/20/98: Added quick bounding-box rejection test
// [FG] Compatibility bug in P_CrossSubsector
// http://prboom.sourceforge.net/mbf-bugs.html
if (!demo_compatibility)
{
if (line->bbox[BOXLEFT ] > los->bbox[BOXRIGHT ] ||
line->bbox[BOXRIGHT ] < los->bbox[BOXLEFT ] ||
line->bbox[BOXBOTTOM] > los->bbox[BOXTOP ] ||
line->bbox[BOXTOP] < los->bbox[BOXBOTTOM])
continue;
}
v1 = line->v1;
v2 = line->v2;
@ -242,7 +248,9 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
return false;
// killough 11/98: shortcut for melee situations
if (t1->subsector == t2->subsector) // same subsector? obviously visible
// [FG] Compatibility bug in P_CheckSight
// http://prboom.sourceforge.net/mbf-bugs.html
if (t1->subsector == t2->subsector && !demo_compatibility) // same subsector? obviously visible
return true;
// An unobstructed LOS is possible.

View File

@ -100,8 +100,13 @@ void P_CalcHeight (player_t* player)
// it causes bobbing jerkiness when the player moves from ice to non-ice,
// and vice-versa.
player->bob = player_bobbing ? (FixedMul(player->momx,player->momx) +
FixedMul(player->momy,player->momy))>>2 : 0;
// [FG] MBF player bobbing rewrite causes demo sync problems
// http://prboom.sourceforge.net/mbf-bugs.html
player->bob = demo_compatibility ?
(FixedMul (player->mo->momx, player->mo->momx)
+ FixedMul (player->mo->momy,player->mo->momy))>>2 :
player_bobbing ? (FixedMul(player->momx,player->momx) +
FixedMul(player->momy,player->momy))>>2 : 0;
if (player->bob > MAXBOB)
player->bob = MAXBOB;

View File

@ -1389,7 +1389,9 @@ static void WI_updateNetgameStats(void)
// killough 2/22/98: Make secrets = 100% if maxsecret = 0:
if (cnt_secret[i] >= (wbs->maxsecret ? (plrs[i].ssecret * 100) / wbs->maxsecret : 100))
// [FG] Intermission screen secrets desync
// http://prboom.sourceforge.net/mbf-bugs.html
if (cnt_secret[i] >= (wbs->maxsecret ? (plrs[i].ssecret * 100) / wbs->maxsecret : demo_compatibility ? 0 : 100))
cnt_secret[i] = wbs->maxsecret ? (plrs[i].ssecret * 100) / wbs->maxsecret : 100;
else
stillticking = true;
@ -1598,7 +1600,10 @@ static void WI_updateStats(void)
S_StartSound(0, sfx_pistol);
// killough 2/22/98: Make secrets = 100% if maxsecret = 0:
if (cnt_secret[0] >= (wbs->maxsecret ?
// [FG] Intermission screen secrets desync
// http://prboom.sourceforge.net/mbf-bugs.html
if ((!wbs->maxsecret && demo_compatibility) ||
cnt_secret[0] >= (wbs->maxsecret ?
(plrs[me].ssecret * 100) / wbs->maxsecret : 100))
{
cnt_secret[0] = (wbs->maxsecret ?