From 95fdb52f06a21358a4caf791d982dee10aaae014 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 23 Jun 2026 19:38:14 +0200 Subject: [PATCH] toggable stair "jank" visuals akin to RR, just toned down for smaller kart chars also toggable ofc theres not that many stairs in kart but this looks cute with smol bumps in the road wish this would work on slopes but theyre kinda messed up lol --- src/d_player.h | 2 ++ src/g_game.h | 1 + src/g_input.c | 6 ++++++ src/k_kart.c | 17 +++++++++++++++++ src/p_map.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- src/p_slopes.c | 5 +++++ src/p_user.c | 5 +++++ src/r_main.cpp | 1 + 8 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index bcecb66a5..e4aded95b 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -566,6 +566,8 @@ typedef struct player_s fixed_t fovadd; // adjust FOV for hw rendering SINT8 driftlevel; // just for controller rumble for now + + UINT8 stairjank; } player_t; #endif diff --git a/src/g_game.h b/src/g_game.h index 34496534e..4f46ef89d 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -118,6 +118,7 @@ extern consvar_t cv_driftsparkpulse; extern consvar_t cv_gravstretch; extern consvar_t cv_sloperoll; extern consvar_t cv_sliptideroll; +extern consvar_t cv_stairjank; extern consvar_t cv_slamsound; extern consvar_t cv_sloperolldist; extern consvar_t cv_sparkroll; diff --git a/src/g_input.c b/src/g_input.c index c72ed6308..fa18272b8 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1139,6 +1139,12 @@ void G_DeviceRumbleTick(void) if (leveltime & 1) // this is actually funny lel high = RUMBLE_MODERATE; } + /*else if ((player->stairjank > 8) // this is kinda cool but prob gets annoying after a while + && player->speed != 0 + && P_IsObjectOnGround(player->mo)) + { + low = high = RUMBLE_WEAK; + }*/ if (player->kartstuff[k_brakedrift]) { diff --git a/src/k_kart.c b/src/k_kart.c index 7c1e6a2d7..a447afcd0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -110,6 +110,7 @@ static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sparkroll = {"sparkroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stairjank = {"stairjank", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //hardcode saltyhop mhhm static void saltyhop_onchange(void); @@ -3556,6 +3557,16 @@ boolean K_ShouldSlopeRoll(mobj_t *mobj) return K_CheckSlopeRollDist(mobj); } +static INT32 K_AltFlip(INT32 n, tic_t tics) +{ + return leveltime % (2 * tics) < tics ? n : -(n); +} + +static INT32 K_StairJankFlip(INT32 value) +{ + return K_AltFlip(value, 2); +} + // reset banan and eggbox rollangle when they´re on the ground // if not cv_bananthrowroll option "+Onground" static void K_ResetBananaRollangle(mobj_t* mo) @@ -7320,6 +7331,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground) K_RollMobjBySlopes(player->mo, player->mo->standingslope); + // "Stair jank" visuals akin to RR + if (cv_stairjank.value && player->stairjank > 0) + { + player->mo->temprollangle += K_StairJankFlip(ANGLE_11hh / 2 / (17 / player->stairjank)); // TODO: make strength adjustable? + } + //// // Quick Turning diff --git a/src/p_map.c b/src/p_map.c index 2311e0c44..5a884e968 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2375,8 +2375,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) fixed_t tryx = thing->x; fixed_t tryy = thing->y; fixed_t radius = thing->radius; - fixed_t thingtop ;//= thing->z + thing->height; + fixed_t thingtop;//= thing->z + thing->height; fixed_t startingonground = P_IsObjectOnGround(thing); + fixed_t stairjank = 0; + pslope_t *oldslope = thing->standingslope; INT32 special = -1; floatok = false; @@ -2450,11 +2452,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thingtop = thing->z + thing->height; + const boolean flipped = + (thing->eflags & MFE_VERTICALFLIP) != 0; + // Step up if (thing->z < tmfloorz) { if (tmfloorz - thing->z <= maxstep) { + if (maxstep > 0 && !flipped) + { + stairjank = (tmfloorz - thing->z); + } + thing->z = thing->floorz = tmfloorz; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } @@ -2467,6 +2477,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (thingtop - tmceilingz <= maxstep) { + if (maxstep > 0 && flipped) + { + stairjank = (thingtop - tmceilingz); + } + thing->z = ( thing->ceilingz = tmceilingz ) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } @@ -2483,11 +2498,21 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) { + if (flipped) + { + stairjank = (tmceilingz - thingtop); + } + thing->z = (thing->ceilingz = tmceilingz) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) { + if (!flipped) + { + stairjank = (thing->z - tmfloorz); + } + thing->z = thing->floorz = tmfloorz; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } @@ -2563,6 +2588,25 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) else // don't set standingslope if you're not going to clip against it thing->standingslope = NULL; + /* FIXME: slope step down (even up) has some false + positives, so just ignore them entirely. */ + if (stairjank && !oldslope && !thing->standingslope && thing->player && !thing->player->spectator) + { + // TODO: maybe spawn smol dust effect similar to RR? + /*if (!thing->player->stairjank) + { + mobj_t * spark = P_SpawnMobjFromMobj(thing, 0, 0, 0, MT_JANKSPARK); + spark->fuse = 9; + spark->cusval = K_StairJankFlip(ANGLE_90); + P_SetTarget(&spark->target, thing); + P_SetTarget(&spark->owner, thing); + spark->renderflags |= RF_REDUCEVFX; + }*/ + + thing->player->stairjank = 9; + //thing->player->stairjank = 17; + } + thing->x = x; thing->y = y; diff --git a/src/p_slopes.c b/src/p_slopes.c index 6334b2e45..52a262785 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -901,6 +901,11 @@ void P_SlopeLaunch(mobj_t *mo) //CONS_Printf("Launched off of slope.\n"); mo->standingslope = NULL; + + if (mo->player) + { + mo->player->stairjank = 0; // fuck you + } } // Function to help handle landing on slopes diff --git a/src/p_user.c b/src/p_user.c index 5f13fa018..90bca6cff 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5090,6 +5090,11 @@ void P_PlayerThink(player_t *player) player->squishdance.time = 0; } + if (player->stairjank > 0) + { + player->stairjank--; + } + // Flash player after being hit. if (!(player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should. || player->kartstuff[k_growshrinktimer] > 0 // Grow doesn't flash either. diff --git a/src/r_main.cpp b/src/r_main.cpp index 5a7a1d23f..962ccc0a7 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1598,6 +1598,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_sliptideroll); CV_RegisterVar(&cv_sloperolldist); CV_RegisterVar(&cv_sparkroll); + CV_RegisterVar(&cv_stairjank); CV_RegisterVar(&cv_showhud); CV_RegisterVar(&cv_translucenthud);