From 061e3c282c1a43800eb95393233f93aa86f7f9e6 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 8 Mar 2024 06:07:15 -0800 Subject: [PATCH 1/2] Broly: fix underflow on remaining timer - Fix Fuel Canister setting player's hitlag to -1, causing SPB to stop thinking --- src/objects/broly.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects/broly.hpp b/src/objects/broly.hpp index d75a7fc4b..64f7f58da 100644 --- a/src/objects/broly.hpp +++ b/src/objects/broly.hpp @@ -44,7 +44,7 @@ struct Broly : Mobj bool valid() const { return duration(); } - tic_t remaining() const { return tics - kBufferTics; } + tic_t remaining() const { return tics > kBufferTics ? tics - kBufferTics : 0u; } Fixed linear() const { return (remaining() * FRACUNIT) / duration(); } From 9c436763c2b3ce39dc7afa416fd1370914bbd47b Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 8 Mar 2024 06:10:43 -0800 Subject: [PATCH 2/2] SPB: only stop thinking if chase targt hitlag is >0 - Mobjs only actually freeze if hitlag >0 - This will probably stop something like 061e3c282 happening to SPB again --- src/objects/spb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects/spb.c b/src/objects/spb.c index 89ac8f174..2c0d51fa9 100644 --- a/src/objects/spb.c +++ b/src/objects/spb.c @@ -679,7 +679,7 @@ static void SPBChase(mobj_t *spb, mobj_t *bestMobj) return; } - if (chase->hitlag) + if (chase->hitlag > 0) { // If the player is frozen, the SPB should be too. spb->hitlag = max(spb->hitlag, chase->hitlag);