apply two more demofixes to EV_VerticalDoor() and EV_BuildStairs() (#46)

After this commit, it seems I am as close to Vanilla Doom compatibility
as I can get without implementing overflow emulation for REJECT, SPECHITS,
INTERCEPTS, etc. Not sure if I want to go this way at all.

Fixes #39.
This commit is contained in:
Fabian Greffrath 2020-01-20 21:41:46 +01:00 committed by GitHub
parent 58f4445380
commit c71b6d4755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 4 deletions

View File

@ -449,9 +449,18 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
sec = sides[line->sidenum[1]].sector;
// if door already has a thinker, use it
if (sec->ceilingdata) //jff 2/22/98
door = sec->ceilingdata; //jff 2/22/98
// [FG] DR doors corrupt other actions
// http://prboom.sourceforge.net/mbf-bugs.html
if (demo_compatibility)
{
if (!door) door = sec->floordata;
if (!door) door = sec->lightingdata;
}
if (door) //jff 2/22/98
{
door = sec->ceilingdata; //jff 2/22/98
switch(line->special)
{
case 1: // only for "raise" doors, not "open"s
@ -466,7 +475,21 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
if (!thing->player)
return 0; // JDC: bad guys never close doors
// [FG] DR doors corrupt other actions
// http://prboom.sourceforge.net/mbf-bugs.html
if (door->thinker.function == T_VerticalDoor || !demo_compatibility)
{
door->direction = -1; // start going down immediately
}
else if (door->thinker.function == T_PlatRaise)
{
plat_t *plat = (plat_t *) door;
plat->wait = -1;
}
else
{
door->direction = -1;
}
}
return 1;
}

View File

@ -692,6 +692,24 @@ int EV_DoChange
// Returns true if any thinkers are created
//
// [FG] Compatibility bug in EV_BuildStairs
// http://prboom.sourceforge.net/mbf-bugs.html
static int P_FindSectorFromLineTag_Vanilla (const line_t* line, int start)
{
int i;
for (i=start+1;i<numsectors;i++)
if (sectors[i].tag == line->tag)
return i;
return -1;
}
int (*P_FindSectorFromLineTag_BuildStairs)(const line_t* line, int start);
#define STAIRS_UNINITIALIZED_CRUSH_FIELD_VALUE 10
int EV_BuildStairs
( line_t* line,
stair_e type )
@ -716,8 +734,14 @@ int EV_BuildStairs
secnum = -1;
rtn = 0;
// [FG] Compatibility bug in EV_BuildStairs
// http://prboom.sourceforge.net/mbf-bugs.html
P_FindSectorFromLineTag_BuildStairs = demo_compatibility ?
P_FindSectorFromLineTag_Vanilla :
P_FindSectorFromLineTag;
// start a stair at each sector tagged the same as the linedef
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
while ((secnum = P_FindSectorFromLineTag_BuildStairs(line,secnum)) >= 0)
{
sec = &sectors[secnum];
@ -744,12 +768,18 @@ int EV_BuildStairs
stairsize = 8*FRACUNIT;
if (!demo_compatibility)
floor->crush = false; //jff 2/27/98 fix uninitialized crush field
// [FG] initialize crush field
else
floor->crush = STAIRS_UNINITIALIZED_CRUSH_FIELD_VALUE;
break;
case turbo16:
speed = FLOORSPEED*4;
stairsize = 16*FRACUNIT;
if (!demo_compatibility)
floor->crush = true; //jff 2/27/98 fix uninitialized crush field
// [FG] initialize crush field
else
floor->crush = STAIRS_UNINITIALIZED_CRUSH_FIELD_VALUE;
break;
}
floor->speed = speed;
@ -809,12 +839,17 @@ int EV_BuildStairs
//jff 2/27/98 fix uninitialized crush field
if (!demo_compatibility)
floor->crush = type==build8? false : true;
// [FG] initialize crush field
else
floor->crush = STAIRS_UNINITIALIZED_CRUSH_FIELD_VALUE;
ok = 1;
break;
}
} while(ok); // continue until no next step is found
if (!comp[comp_stairs]) // killough 10/98: compatibility option
// [FG] Compatibility bug in EV_BuildStairs
// http://prboom.sourceforge.net/mbf-bugs.html
if (!comp[comp_stairs] && !demo_compatibility) // killough 10/98: compatibility option
secnum = osecnum; //jff 3/4/98 restore loop index
}
return rtn;