From d7ce973aaf596b22229cd42f506929b504d37c49 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 21 Sep 2022 12:23:42 -0400 Subject: [PATCH] Only spawn gates when SPB is close to the ground --- src/objects/spb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/objects/spb.c b/src/objects/spb.c index b99f7c371..4ac06b9ee 100644 --- a/src/objects/spb.c +++ b/src/objects/spb.c @@ -78,6 +78,9 @@ static void SPBMantaRings(mobj_t *spb) fixed_t spacing = INT32_MAX; fixed_t finalDist = INT32_MAX; + const fixed_t floatHeight = 24 * spb->scale; + fixed_t floorDist = INT32_MAX; + if (leveltime % SPB_MANTA_VRATE == 0) { spb_manta_vscale(spb) = max(spb_manta_vscale(spb) - 1, SPB_MANTA_VMAX); @@ -89,9 +92,12 @@ static void SPBMantaRings(mobj_t *spb) vScale = FixedDiv(spb_manta_vscale(spb) * FRACUNIT, 100 * FRACUNIT); finalDist = FixedMul(spacing, vScale); + floorDist = abs(P_GetMobjFeet(spb) - P_GetMobjGround(spb)); + spb_manta_totaldist(spb) += P_AproxDistance(spb->momx, spb->momy); - if (spb_manta_totaldist(spb) > finalDist) + if (spb_manta_totaldist(spb) > finalDist + && floorDist <= floatHeight) { spb_manta_totaldist(spb) = 0;