From 3b85abdee7e557818486ef06f6714cb374360c11 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 6 Dec 2020 14:11:08 -0300 Subject: [PATCH] Kill saloon doors without a tracer, add height check for non-blocking doors --- src/p_map.c | 6 ++++-- src/p_mobj.c | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 922c0d9ec..24311c35a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -982,7 +982,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->type == MT_SALOONDOOR && tmthing->player) { mobj_t *ref = (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)) ? tmthing->tracer : tmthing; - if ((thing->flags2 & MF2_AMBUSH) || ref != tmthing) + if (((thing->flags2 & MF2_AMBUSH) && (tmthing->z <= thing->z + thing->height) && (tmthing->z + tmthing->height >= thing->z)) + || ref != tmthing) { fixed_t dm = min(FixedHypot(ref->momx, ref->momy), 16*FRACUNIT); angle_t ang = R_PointToAngle2(0, 0, ref->momx, ref->momy) - thing->angle; @@ -995,7 +996,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->type == MT_SALOONDOORCENTER && tmthing->player) { - if ((thing->flags2 & MF2_AMBUSH) || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer))) + if (((thing->flags2 & MF2_AMBUSH) && (tmthing->z <= thing->z + thing->height) && (tmthing->z + tmthing->height >= thing->z)) + || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer))) return true; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ba6d1fad..65113a840 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9651,6 +9651,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj) break; } case MT_SALOONDOOR: + if (!mobj->tracer) // Door center is gone or not spawned? + { + P_RemoveMobj(mobj); // Die + return false; + } + P_SaloonDoorThink(mobj); break; case MT_MINECARTSPAWNER: