From f99d89742a7c0347bb7e2092fa1ede7a02766abc Mon Sep 17 00:00:00 2001
From: lachablock <lachlanwright17@gmail.com>
Date: Thu, 25 Mar 2021 15:09:04 +1100
Subject: [PATCH] Revise conditions under which players use spinheight and
 enter gaps: - players with SF_NOJUMPDAMAGE but *not* SF_NOJUMPSPIN now always
 use spinheight while jumping (i.e. even with PF_NOJUMPDAMAGE), as long as
 their panim is PA_JUMP or PA_ROLL - players with SF_NOJUMPSPIN no longer use
 spinheight while jumping (but,) - PA_ROLL is now an acceptable condition for
 using spinheight (but not for entering gaps, e.g. S3K shields will shrink the
 hitbox but not allow gap entry on their own) - flying players now only use
 spinheight if they do not have SF_NOJUMPSPIN (you're welcome, EggpackRE) -
 players with neither SF_NOJUMPSPIN nor SF_NOJUMPDAMAGE use the same
 conditions as in 2.2.9 prerelease, i.e. use spinheight and can enter gaps
 unless they have PF_NOJUMPDAMAGE

---
 src/p_user.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/p_user.c b/src/p_user.c
index 38f13f8fdf..63942e0bed 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -12949,11 +12949,18 @@ boolean P_PlayerFullbright(player_t *player)
 			&& player->mo->state < &states[S_PLAY_NIGHTS_TRANS6])))); // Note the < instead of <=
 }
 
+#define JUMPCURLED(player) ((player->pflags & PF_JUMPED)\
+	&& (!(player->charflags & SF_NOJUMPSPIN))\
+	&& (!(player->pflags & PF_NOJUMPDAMAGE)\
+		|| ((player->charflags & SF_NOJUMPDAMAGE)\
+		&& (player->panim == PA_JUMP || player->panim == PA_ROLL))))\
+
 // returns true if the player can enter a sector that they could not if standing at their skin's full height
 boolean P_PlayerCanEnterSpinGaps(player_t *player)
 {
-	return ((player->pflags & (PF_SPINNING|PF_GLIDING))
-		|| (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING));
+	return ((player->pflags & (PF_SPINNING|PF_GLIDING)) // players who are spinning or gliding
+		|| (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) // players who are landing from a glide
+		|| JUMPCURLED(player)); // players who are jumpcurled, but only if they would normally jump that way
 }
 
 // returns true if the player should use their skin's spinheight instead of their skin's height
@@ -12961,7 +12968,7 @@ boolean P_PlayerShouldUseSpinHeight(player_t *player)
 {
 	return (P_PlayerCanEnterSpinGaps(player)
 		|| (player->mo->state == &states[player->mo->info->painstate])
-		|| ((player->pflags & PF_JUMPED) && !(player->pflags & PF_NOJUMPDAMAGE))
-		|| player->powers[pw_tailsfly]
-		|| (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED));
+		|| (player->panim == PA_ROLL)
+		|| ((player->powers[pw_tailsfly] || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED))
+			&& !(player->charflags & SF_NOJUMPSPIN)));
 }
-- 
GitLab