From b03056e4c8045ab76c1b9275dc11a92519ae6226 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 26 Aug 2023 16:05:34 -0700 Subject: [PATCH 1/5] Smoothlanding leniency --- src/k_kart.c | 15 ++++++++++++--- src/k_kart.h | 6 ++++-- src/objects/dash-rings.c | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 529ca6c7f..1f3785134 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3936,6 +3936,14 @@ boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, bool return false; } + if (fromAir && player->airtime < STUMBLE_AIRTIME + && player->airtime > 1) // ACHTUNG HACK, sorry. Ground-to-ground transitions sometimes have 1-tic airtime because collision blows + { + // Short airtime with no reaction window, probably a track traversal setpiece. + // Don't punish for these. + return false; + } + if ((player->mo->pitch == oldPitch) && (player->mo->roll == oldRoll)) { @@ -4099,6 +4107,9 @@ void K_UpdateStumbleIndicator(player_t *player) mobj->renderflags &= ~RF_HORIZONTALFLIP; } + if (air && player->airtime < STUMBLE_AIRTIME) + delta = 0; + steepRange = ANGLE_90 - steepVal; delta = max(0, abs(delta) - ((signed)steepVal)); trans = ((FixedDiv(AngleFixed(delta), AngleFixed(steepRange)) * (NUMTRANSMAPS - 2)) + (FRACUNIT/2)) / FRACUNIT; @@ -8253,9 +8264,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->incontrol++; } - player->incontrol = min(player->incontrol, 5*TICRATE); - player->incontrol = max(player->incontrol, -5*TICRATE); - if (player->tumbleBounces > 0) { K_HandleTumbleSound(player); @@ -10436,6 +10444,7 @@ static void K_KartSpindash(player_t *player) // Update fastfall. player->fastfall = player->mo->momz; player->spindash = 0; + player->mo->roll = 0; if (player->fastfallBase == 0) { diff --git a/src/k_kart.h b/src/k_kart.h index e0bcabf06..a85459ddc 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -40,8 +40,10 @@ Make sure this matches the actual number of states #define RR_PROJECTILE_FUSE (8*TICRATE) -#define STUMBLE_STEEP_VAL ANG60 -#define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10) +// 2023-08-26 +ang20 to Sal's OG values to make them friendlier - Tyron +#define STUMBLE_STEEP_VAL (ANG60 + ANG20) +#define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10 + ANG20) +#define STUMBLE_AIRTIME TICRATE*3 #define MAXRINGVOLUME 255 #define MINRINGVOLUME 100 diff --git a/src/objects/dash-rings.c b/src/objects/dash-rings.c index 527157cb1..a680820ed 100644 --- a/src/objects/dash-rings.c +++ b/src/objects/dash-rings.c @@ -161,6 +161,7 @@ static void DashRingLaunch(player_t *player, mobj_t *ring) player->dashRingPushTics = DASHRING_PUSH_TICS; player->mo->rollangle = 0; + player->mo->roll = 0; player->flashing = 0; player->fastfall = 0; K_TumbleInterrupt(player); From b43df44156613c7a13905a5ff975ddaecd7190b5 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 26 Aug 2023 22:23:10 -0700 Subject: [PATCH 2/5] Tyron you suck at using your editor --- src/k_kart.c | 3 +++ src/k_kart.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 1f3785134..a2f188fef 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8263,6 +8263,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->incontrol = 0; player->incontrol++; } + + player->incontrol = min(player->incontrol, 5*TICRATE); + player->incontrol = max(player->incontrol, -5*TICRATE); if (player->tumbleBounces > 0) { diff --git a/src/k_kart.h b/src/k_kart.h index a85459ddc..2f5936064 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -43,7 +43,7 @@ Make sure this matches the actual number of states // 2023-08-26 +ang20 to Sal's OG values to make them friendlier - Tyron #define STUMBLE_STEEP_VAL (ANG60 + ANG20) #define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10 + ANG20) -#define STUMBLE_AIRTIME TICRATE*3 +#define STUMBLE_AIRTIME 35 #define MAXRINGVOLUME 255 #define MINRINGVOLUME 100 From 2f331a4d10051914579586e9e5d2363a4ff5c5eb Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 26 Aug 2023 22:24:18 -0700 Subject: [PATCH 3/5] Let's be slightly more semantically correct about this --- src/k_kart.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.h b/src/k_kart.h index 2f5936064..e33580f81 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -43,7 +43,7 @@ Make sure this matches the actual number of states // 2023-08-26 +ang20 to Sal's OG values to make them friendlier - Tyron #define STUMBLE_STEEP_VAL (ANG60 + ANG20) #define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10 + ANG20) -#define STUMBLE_AIRTIME 35 +#define STUMBLE_AIRTIME TICRATE #define MAXRINGVOLUME 255 #define MINRINGVOLUME 100 From eabef184f176878ec95dc15d0eb4481852447add Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 27 Aug 2023 04:14:00 -0700 Subject: [PATCH 4/5] Add P_ResetPitchRoll --- src/k_kart.c | 7 +++---- src/p_local.h | 1 + src/p_mobj.c | 13 +++++++++++-- src/p_user.c | 3 +-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index a2f188fef..556bde894 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3918,7 +3918,7 @@ void K_StumblePlayer(player_t *player) P_SetPlayerMobjState(player->mo, S_KART_SPINOUT); // Reset slope. - player->mo->pitch = player->mo->roll = 0; + P_ResetPitchRoll(player->mo); } boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, boolean fromAir) @@ -4260,7 +4260,7 @@ static void K_HandleTumbleBounce(player_t *player) player->tumbleHeight = 10; player->pflags |= PF_TUMBLELASTBOUNCE; player->mo->rollangle = 0; // p_user.c will stop rotating the player automatically - player->mo->pitch = player->mo->roll = 0; // Prevent Kodachrome Void infinite + P_ResetPitchRoll(player->mo); // Prevent Kodachrome Void infinite } } @@ -6162,8 +6162,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT)); } - mo->pitch = 0; - mo->roll = 0; + P_ResetPitchRoll(mo); if (sound) { diff --git a/src/p_local.h b/src/p_local.h index eaf1d6349..ba3f65438 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -569,6 +569,7 @@ void P_ExplodeMissile(mobj_t *mo); void P_CheckGravity(mobj_t *mo, boolean affect); void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope); void P_SetPitchRoll(mobj_t *mo, angle_t pitch, angle_t yaw); +void P_ResetPitchRoll(mobj_t *mo); fixed_t P_ScaleFromMap(fixed_t n, fixed_t scale); fixed_t P_GetMobjHead(const mobj_t *); fixed_t P_GetMobjFeet(const mobj_t *); diff --git a/src/p_mobj.c b/src/p_mobj.c index 1e6a797d1..8aa533169 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1333,7 +1333,7 @@ void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope) } else { - mo->pitch = mo->roll = 0; + P_ResetPitchRoll(mo); } } @@ -1348,6 +1348,15 @@ void P_SetPitchRoll(mobj_t *mo, angle_t pitch, angle_t yaw) mo->pitch = FixedMul(pitch, FINECOSINE (yaw)); } +// +// P_ResetPitchRoll +// +void P_ResetPitchRoll(mobj_t *mo) +{ + mo->pitch = 0; + mo->roll = 0; +} + #define STOPSPEED (FRACUNIT) // @@ -7191,7 +7200,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } case MT_FLOATINGITEM: { - mobj->pitch = mobj->roll = 0; + P_ResetPitchRoll(mobj); if (mobj->flags & MF_NOCLIPTHING) { if (P_CheckDeathPitCollide(mobj)) diff --git a/src/p_user.c b/src/p_user.c index a5176e580..49c92f86f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -488,8 +488,7 @@ void P_ResetPlayer(player_t *player) if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false) { - player->mo->pitch = 0; - player->mo->roll = 0; + P_ResetPitchRoll(player->mo); } } From c080828dde5ad920022145a21b274443eafa7a6e Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 27 Aug 2023 04:16:20 -0700 Subject: [PATCH 5/5] Dash Rings, Fast Fall: reset pitch too --- src/k_kart.c | 2 +- src/objects/dash-rings.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 556bde894..32f312a22 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10446,7 +10446,7 @@ static void K_KartSpindash(player_t *player) // Update fastfall. player->fastfall = player->mo->momz; player->spindash = 0; - player->mo->roll = 0; + P_ResetPitchRoll(player->mo); if (player->fastfallBase == 0) { diff --git a/src/objects/dash-rings.c b/src/objects/dash-rings.c index a680820ed..d40e341bb 100644 --- a/src/objects/dash-rings.c +++ b/src/objects/dash-rings.c @@ -161,7 +161,7 @@ static void DashRingLaunch(player_t *player, mobj_t *ring) player->dashRingPushTics = DASHRING_PUSH_TICS; player->mo->rollangle = 0; - player->mo->roll = 0; + P_ResetPitchRoll(player->mo); player->flashing = 0; player->fastfall = 0; K_TumbleInterrupt(player);