From 0b84b3688ac4f6c3dd3c5b2227f80a1d8b492e2e Mon Sep 17 00:00:00 2001
From: Lactozilla <jp6781615@gmail.com>
Date: Sun, 9 Feb 2025 00:25:34 -0300
Subject: [PATCH] Implement color cycling toggle

---
 src/p_user.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/p_user.c b/src/p_user.c
index 2b2334df79..51eefb314e 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -11520,8 +11520,9 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
 // When the player is on a moving animation, the follow object goes to its see state.
 // When dash mode is entered, the follow object switches to its melee state.
 //
-// If MF2_FRET is set, the jet fume flashes during dash mode.
+// If MF2_FRET is set, the jet fume will flash during dash mode.
 // MF2_AMBUSH can be used to enable Metal Sonic's skidding animation.
+// MF2_JUSTATTACKED will enable the color cycling.
 // If the follow item is MT_METALJETFUME, the above two effects are automatically applied.
 //
 // MF2_STRONGBOX is internally used to track if the jet fume is in its deactivated state or not.
@@ -11656,7 +11657,10 @@ void P_DoMetalJetFume(player_t *player, mobj_t *fume)
 
 		fume->flags2 = (fume->flags2 & ~MF2_DONTDRAW) | (mo->flags2 & MF2_DONTDRAW);
 		fume->destscale = (mo->scale + FixedDiv(player->speed, player->normalspeed)) / (underwater ? 6 : 3);
-		fume->color = FUME_SKINCOLORS[(dashmode * sizeof(FUME_SKINCOLORS)) / (DASHMODE_MAX + 1)];
+
+		// Do color cycling if follow item is MT_METALJETFUME, or if MF2_JUSTATTACKED is set
+		if (ismetaljetfume || (fume->flags2 & MF2_JUSTATTACKED))
+			fume->color = FUME_SKINCOLORS[(dashmode * sizeof(FUME_SKINCOLORS)) / (DASHMODE_MAX + 1)];
 
 		if (underwater)
 		{
-- 
GitLab