From 881507889dfb8950a3bebc1f7725209c1a5b38aa Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 29 Dec 2022 17:54:19 +0000 Subject: [PATCH 1/3] Fix Broly SIGFPE - Don't spawn the KI if the duration <= 0 - If the KI spawned but the duration <= 0 for any other reason remove the object instead of performing the division --- src/k_objects.h | 2 +- src/objects/broly.c | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/k_objects.h b/src/k_objects.h index 284ec1c61..222ead574 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -56,7 +56,7 @@ void Obj_DuelBombInit(mobj_t *bomb); /* Broly Ki */ mobj_t *Obj_SpawnBrolyKi(mobj_t *source, tic_t duration); -void Obj_BrolyKiThink(mobj_t *ki); +boolean Obj_BrolyKiThink(mobj_t *ki); /* Special Stage UFO */ waypoint_t *K_GetSpecialUFOWaypoint(mobj_t *ufo); diff --git a/src/objects/broly.c b/src/objects/broly.c index d041c23b7..4c283a175 100644 --- a/src/objects/broly.c +++ b/src/objects/broly.c @@ -34,14 +34,16 @@ Obj_SpawnBrolyKi ( mobj_t * source, tic_t duration) { - mobj_t *x = P_SpawnMobjFromMobj( - source, 0, 0, 0, MT_BROLY); + mobj_t *x; - if (duration == 0) + if (duration <= 0) { - return x; + return NULL; } + x = P_SpawnMobjFromMobj( + source, 0, 0, 0, MT_BROLY); + // Shrink into center of source object. x->z = (source->z + source->height / 2); @@ -61,12 +63,20 @@ Obj_SpawnBrolyKi return x; } -void +boolean Obj_BrolyKiThink (mobj_t *x) { + if (broly_duration(x) <= 0) + { + P_RemoveMobj(x); + return false; + } + const fixed_t t = get_unit_linear(x), n = Easing_OutSine(t, 0, broly_maxscale(x)); P_InstaScale(x, n); + + return true; } From 1f18aa727a883e5c03e7f60e397cc9c7845f1484 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 29 Dec 2022 17:57:19 +0000 Subject: [PATCH 2/3] Forgot to *stash* this time --- src/p_mobj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 26b38d631..2b8101aeb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6534,7 +6534,10 @@ static void P_MobjSceneryThink(mobj_t *mobj) mobj->renderflags ^= RF_DONTDRAW; break; case MT_BROLY: - Obj_BrolyKiThink(mobj); + if (Obj_BrolyKiThink(mobj) == false) + { + return; + } break; case MT_VWREF: case MT_VWREB: From 4b9797fe2631e2e1f04cb92f14f2d6bee9f705a7 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 2 Jan 2023 13:08:11 +0000 Subject: [PATCH 3/3] Correct for recursive iteration of multiple mines in succession clobbering filescope `minehitlag` --- src/k_collide.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/k_collide.c b/src/k_collide.c index 06d6900e6..e9e832b3d 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -324,6 +324,11 @@ tic_t K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin) if (!spin) { + if (minehitlag == 0) + { + minehitlag = actor->hitlag; + } + Obj_SpawnBrolyKi(actor, minehitlag); return minehitlag;