From 9e650fa6c022483e727dc3ce0e1915c67a8fc60e Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 13 Jan 2024 17:30:16 -0800 Subject: [PATCH] Guard: reflect items like Bubble - Clash + player knockback --- src/k_collide.cpp | 5 +++++ src/p_map.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/k_collide.cpp b/src/k_collide.cpp index d10dd845f..c9dd7085b 100644 --- a/src/k_collide.cpp +++ b/src/k_collide.cpp @@ -771,6 +771,11 @@ boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2) { if (!t2->threshold || t2->type == MT_DROPTARGET) { + if (t1->player && K_PlayerGuard(t1->player)) + { + K_KartSolidBounce(t1, t2); + K_DoPowerClash(t1, t2); + } if (!t2->momx && !t2->momy) { t2->momz += (24*t2->scale) * P_MobjFlip(t2); diff --git a/src/p_map.c b/src/p_map.c index 782028790..95e509cca 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1004,6 +1004,27 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) if (tm.thing->type == MT_RANDOMITEM) return BMIT_CONTINUE; + if (tm.thing->type != MT_PLAYER && thing->player && K_PlayerGuard(thing->player) && P_BubbleCanReflect(thing, tm.thing)) + { + // see if it went over / under + if (tm.thing->z > thing->z + thing->height) + return BMIT_CONTINUE; // overhead + if (tm.thing->z + tm.thing->height < thing->z) + return BMIT_CONTINUE; // underneath + + return K_BubbleShieldCollide(thing, tm.thing) ? BMIT_CONTINUE : BMIT_ABORT; + } + else if (thing->type != MT_PLAYER && tm.thing->player && K_PlayerGuard(tm.thing->player) && P_BubbleCanReflect(tm.thing, thing)) + { + // see if it went over / under + if (tm.thing->z > thing->z + thing->height) + return BMIT_CONTINUE; // overhead + if (tm.thing->z + tm.thing->height < thing->z) + return BMIT_CONTINUE; // underneath + + return K_BubbleShieldCollide(tm.thing, thing) ? BMIT_CONTINUE : BMIT_ABORT; + } + // Bubble Shield reflect if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->bubbleblowup) || (thing->player && thing->player->bubbleblowup))