From 99c4d798a18d12f4355798d19a126549b970b900 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 15 Aug 2023 00:38:57 -0700 Subject: [PATCH] K_SpawnKartMissile: facilitate water running - Set floorz and ceilingz so object fulfills grounded condition for water running - Set position after object is fully configured - Jawz needs target set in order to water run --- src/k_kart.c | 81 ++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 79e135234..cd6b366dd 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4775,6 +4775,50 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I th->momy = FixedMul(finalspeed, FINESINE(an>>ANGLETOFINESHIFT)); th->momz = source->momz; + if (source->player != NULL) + { + th->cusval = source->player->itemscale; + } + + switch (type) + { + case MT_ORBINAUT: + Obj_OrbinautThrown(th, finalspeed, dir); + break; + case MT_JAWZ: + Obj_JawzThrown(th, finalspeed, dir); + break; + case MT_SPB: + th->movefactor = finalspeed; + break; + case MT_BUBBLESHIELDTRAP: + P_SetScale(th, ((5*th->destscale)>>2)*4); + th->destscale = (5*th->destscale)>>2; + S_StartSound(th, sfx_s3kbfl); + S_StartSound(th, sfx_cdfm35); + break; + case MT_BALLHOG: + // Contra spread shot scale up + th->destscale = th->destscale << 1; + th->scalespeed = abs(th->destscale - th->scale) / (2*TICRATE); + break; + case MT_GARDENTOP: + th->movefactor = finalspeed; + break; + case MT_GACHABOM: + Obj_GachaBomThrown(th, finalspeed, dir); + break; + default: + break; + } + + // I'm calling P_SetOrigin to update the floorz if this + // object can run on water. However, P_CanRunOnWater + // requires that the object is already on the ground, so + // floorz needs to be set beforehand too. + th->floorz = source->floorz; + th->ceilingz = source->ceilingz; + // Get floorz and ceilingz P_SetOrigin(th, x, y, z); @@ -4823,43 +4867,6 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I } } - if (source->player != NULL) - { - th->cusval = source->player->itemscale; - } - - switch (type) - { - case MT_ORBINAUT: - Obj_OrbinautThrown(th, finalspeed, dir); - break; - case MT_JAWZ: - Obj_JawzThrown(th, finalspeed, dir); - break; - case MT_SPB: - th->movefactor = finalspeed; - break; - case MT_BUBBLESHIELDTRAP: - P_SetScale(th, ((5*th->destscale)>>2)*4); - th->destscale = (5*th->destscale)>>2; - S_StartSound(th, sfx_s3kbfl); - S_StartSound(th, sfx_cdfm35); - break; - case MT_BALLHOG: - // Contra spread shot scale up - th->destscale = th->destscale << 1; - th->scalespeed = abs(th->destscale - th->scale) / (2*TICRATE); - break; - case MT_GARDENTOP: - th->movefactor = finalspeed; - break; - case MT_GACHABOM: - Obj_GachaBomThrown(th, finalspeed, dir); - break; - default: - break; - } - if (type != MT_BUBBLESHIELDTRAP) { x = x + P_ReturnThrustX(source, an, source->radius + th->radius);