From b5c63e620ab34929ba854d80827cb4908fd52e0f Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Tue, 16 Feb 2021 13:01:39 +0100 Subject: [PATCH] clean up some demo compatibility code --- Source/p_enemy.c | 12 +++++++----- Source/p_floor.c | 8 ++++---- Source/p_setup.c | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/p_enemy.c b/Source/p_enemy.c index 7a82f909..c76c9080 100644 --- a/Source/p_enemy.c +++ b/Source/p_enemy.c @@ -409,17 +409,18 @@ static boolean P_Move(mobj_t *actor, boolean dropoff) // killough 9/12/98 if (P_UseSpecialLine(actor, spechit[numspechit], 0)) good |= spechit[numspechit] == blockline ? 1 : 2; - // [FG] cph - compatibility maze here + // [FG] compatibility maze here // Boom v2.01 and orig. Doom return "good" // Boom v2.02 and LxDoom return good && (P_Random(pr_trywalk)&3) // MBF plays even more games - if (!good || comp[comp_doorstuck]) + if (demo_version < 202) return good; if (demo_version < 203) - return (P_Random(pr_trywalk)&3); /* jff 8/13/98 */ - else /* finally, MBF code */ - return ((P_Random(pr_opendoor) >= 230) ^ (good & 1)); + return good && (compatibility || (P_Random(pr_trywalk)&3)); //jff 8/13/98 + else + return good && (demo_version < 203 || comp[comp_doorstuck] || + (P_Random(pr_opendoor) >= 230) ^ (good & 1)); } else actor->flags &= ~MF_INFLOAT; @@ -2102,6 +2103,7 @@ void A_Detonate(mobj_t *mo) void A_Mushroom(mobj_t *actor) { int i, j, n = actor->info->damage; + // Mushroom parameters are part of code pointer's state fixed_t misc1 = actor->state->misc1 ? actor->state->misc1 : FRACUNIT*4; fixed_t misc2 = actor->state->misc2 ? actor->state->misc2 : FRACUNIT/2; diff --git a/Source/p_floor.c b/Source/p_floor.c index 8edcdde5..89d23def 100644 --- a/Source/p_floor.c +++ b/Source/p_floor.c @@ -118,7 +118,7 @@ result_e T_MovePlane // Moving a floor up // jff 02/04/98 keep floor from moving thru ceilings // jff 2/22/98 weaken check to demo_compatibility - destheight = (demo_compatibility || comp[comp_floors] || + destheight = (demo_compatibility || (demo_version >= 203 && comp[comp_floors]) || destceilingheight)? // killough 10/98 dest : sector->ceilingheight; if (sector->floorheight + speed > destheight) @@ -141,7 +141,7 @@ result_e T_MovePlane flag = P_CheckSector(sector,crush); //jff 3/19/98 use faster chk if (flag == true) { - if (demo_compatibility || comp[comp_floors]) // killough 10/98 + if (demo_compatibility || (demo_version >= 203 && comp[comp_floors])) // killough 10/98 if (crush == true) //jff 1/25/98 fix floor crusher return crushed; sector->floorheight = lastpos; @@ -821,7 +821,7 @@ int EV_BuildStairs if (tsec->floorpic != texture) continue; - if (demo_compatibility || demo_version >= 203) + if (demo_compatibility || demo_version >= 203 || compatibility) { height += stairsize; // killough 10/98: intentionally left this way } @@ -830,7 +830,7 @@ int EV_BuildStairs if (P_SectorActive(floor_special,tsec)) //jff 2/22/98 continue; - if (!demo_compatibility && demo_version < 203) + if (!demo_compatibility && demo_version < 203 && !compatibility) { height += stairsize; } diff --git a/Source/p_setup.c b/Source/p_setup.c index 6b9808a7..5590f428 100644 --- a/Source/p_setup.c +++ b/Source/p_setup.c @@ -943,7 +943,7 @@ void P_RemoveSlimeTrails(void) // killough 10/98 v->r_y = (fixed_t)((dy2 * y0 + dx2 * y1 + dxy * (x0 - x1)) / s); // [FG] override actual vertex coordinates except in compatibility mode - if (!demo_compatibility) + if (demo_version >= 203) { v->x = v->r_x; v->y = v->r_y;