From 2b173f1ec0fef939e22f5c9d84aee958c35c3e23 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 10 Apr 2021 03:17:02 -0700 Subject: [PATCH 1/8] Rumble the jart when stepping on staircases - Sprite tilts back and forth 5.625 degrees, two tics each side, for 17 tics (half a second). - Turning is ignored--as if in the air--every other tic during those 17 tics. --- src/d_player.h | 2 ++ src/k_kart.c | 7 +------ src/p_map.c | 21 +++++++++++++++++++++ src/p_tick.c | 5 +++++ src/p_tick.h | 4 ++++ src/p_user.c | 8 ++++++++ src/r_patchrotation.c | 32 +++++++++++++++++++++++++------- 7 files changed, 66 insertions(+), 13 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 08a0f1cde..8e1545d48 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -708,6 +708,8 @@ typedef struct player_s UINT8 kickstartaccel; + UINT8 stairjank; + #ifdef HWRENDER fixed_t fovadd; // adjust FOV for hw rendering #endif diff --git a/src/k_kart.c b/src/k_kart.c index 280916f57..99cab4ea7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1761,11 +1761,6 @@ static void K_SpawnBrakeDriftSparks(player_t *player) // Be sure to update the m sparks->renderflags |= RF_DONTDRAW; } -static fixed_t K_RandomFlip(fixed_t f) -{ - return ( ( leveltime & 1 ) ? f : -f ); -} - void K_SpawnDriftBoostClip(player_t *player) { mobj_t *clip; @@ -1790,7 +1785,7 @@ void K_SpawnDriftBoostClip(player_t *player) clip->momz += player->mo->momz; P_InstaThrust(clip, player->mo->angle + - K_RandomFlip(P_RandomRange(FRACUNIT/2, FRACUNIT)), + P_RandomFlip(P_RandomRange(FRACUNIT/2, FRACUNIT)), FixedMul(scale, player->speed)); } diff --git a/src/p_map.c b/src/p_map.c index ab4f13b82..40781721a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2419,6 +2419,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) fixed_t radius = thing->radius; fixed_t thingtop; fixed_t startingonground = P_IsObjectOnGround(thing); + fixed_t stairjank = 0; + fixed_t stairstep = 0; floatok = false; // reset this to 0 at the start of each trymove call as it's only used here @@ -2490,6 +2492,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (maxstep > 0) { + const fixed_t minstep = maxstep / 8; + thingtop = thing->z + thing->height; // Step up @@ -2497,6 +2501,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (tmfloorstep <= maxstep) { + stairjank = thing->floordrop; + stairstep = minstep; + thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2510,6 +2517,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (tmceilingstep <= maxstep) { + stairjank = thing->ceilingdrop; + stairstep = minstep; + thing->z = ( thing->ceilingz = tmceilingz ) - thing->height; thing->ceilingrover = tmceilingrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2526,6 +2536,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) { + stairjank = thing->ceilingdrop; + stairstep = minstep; + thing->z = (thing->ceilingz = tmceilingz) - thing->height; thing->ceilingrover = tmceilingrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2533,6 +2546,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) { + stairjank = thing->floordrop; + stairstep = minstep; + thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2619,6 +2635,11 @@ 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; + if (stairjank > stairstep && thing->player) + { + thing->player->stairjank = 17; + } + thing->x = x; thing->y = y; diff --git a/src/p_tick.c b/src/p_tick.c index b79a1fa29..100f29894 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -36,6 +36,11 @@ tic_t leveltime; +INT32 P_AltFlip(INT32 n, tic_t tics) +{ + return leveltime % (2 * tics) < tics ? n : -(n); +} + // // THINKERS // All thinkers should be allocated by Z_Calloc diff --git a/src/p_tick.h b/src/p_tick.h index 1fb88f3f2..e90f1be31 100644 --- a/src/p_tick.h +++ b/src/p_tick.h @@ -30,4 +30,8 @@ void P_DoTeamscrambling(void); void P_RemoveThinkerDelayed(thinker_t *thinker); //killed mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98 +// Negate the value for tics +INT32 P_AltFlip(INT32 value, tic_t tics); +#define P_RandomFlip(value) P_AltFlip(value, 1) + #endif diff --git a/src/p_user.c b/src/p_user.c index 0ea75e3bf..18243428b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1869,6 +1869,9 @@ static void P_3dMovement(player_t *player) movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift]; else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle movepushangle = (angle_t)player->kartstuff[k_boostangle]; + else if (player->stairjank && leveltime & 1) + movepushangle = R_PointToAngle2(0, 0, + player->mo->momx, player->mo->momy); else movepushangle = player->mo->angle; @@ -4749,6 +4752,11 @@ void P_PlayerThink(player_t *player) player->typing_duration = 0; } + if (player->stairjank > 0) + { + player->stairjank--; + } + player->pflags &= ~PF_SLIDING; K_KartPlayerThink(player, cmd); // SRB2kart diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c index 6149bab24..f6ae0655f 100644 --- a/src/r_patchrotation.c +++ b/src/r_patchrotation.c @@ -15,6 +15,7 @@ #include "w_wad.h" #include "r_main.h" // R_PointToAngle #include "k_kart.h" // K_Sliptiding +#include "p_tick.h" #ifdef ROTSPRITE fixed_t rollcosang[ROTANGLES]; @@ -32,16 +33,14 @@ angle_t R_GetPitchRollAngle(mobj_t *mobj) return rollOrPitch; } -angle_t R_SpriteRotationAngle(mobj_t *mobj) +static angle_t R_PlayerSpriteRotation(player_t *player) { - angle_t viewingAngle = R_PointToAngle(mobj->x, mobj->y); - angle_t angleDelta = (viewingAngle - mobj->angle); + angle_t viewingAngle = R_PointToAngle(player->mo->x, player->mo->y); + angle_t angleDelta = (viewingAngle - player->mo->angle); - angle_t sliptideLift = mobj->player - ? mobj->player->aizDriftTilt : 0; + angle_t sliptideLift = player->aizDriftTilt; - angle_t rollOrPitch = R_GetPitchRollAngle(mobj); - angle_t rollAngle = (rollOrPitch + mobj->rollangle); + angle_t rollAngle = 0; if (sliptideLift) { @@ -52,6 +51,25 @@ angle_t R_SpriteRotationAngle(mobj_t *mobj) FixedMul(sliptideLift, FINECOSINE(angleDelta >> ANGLETOFINESHIFT)); } + if (player->stairjank) + { + rollAngle += P_AltFlip(ANGLE_11hh / 2 / + (17 / player->stairjank), 2); + } + + return rollAngle; +} + +angle_t R_SpriteRotationAngle(mobj_t *mobj) +{ + angle_t rollOrPitch = R_GetPitchRollAngle(mobj); + angle_t rollAngle = (rollOrPitch + mobj->rollangle); + + if (mobj->player) + { + rollAngle += R_PlayerSpriteRotation(mobj->player); + } + return rollAngle; } From 50c198cc0f02ef996ded9ff62482105f74c0f151 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 10 Apr 2021 04:22:44 -0700 Subject: [PATCH 2/8] Fuck up turning even more - Lose control of turning for 2 tics instead of 1. - Drift angle is also increased (less inward). --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 18243428b..f949e179f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1866,10 +1866,10 @@ static void P_3dMovement(player_t *player) oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0); if (player->kartstuff[k_drift] != 0) - movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift]; + movepushangle = player->mo->angle-(ANGLE_45/(player->stairjank ? 4 : 5))*player->kartstuff[k_drift]; else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle movepushangle = (angle_t)player->kartstuff[k_boostangle]; - else if (player->stairjank && leveltime & 1) + else if (player->stairjank && leveltime & 3) movepushangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); else From b3293aa1227bbce2934a20cb7153ba5ab96e7267 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Apr 2021 02:07:23 -0700 Subject: [PATCH 3/8] Don't stair jank on really small steps Also don't do it off slope launches. --- src/p_map.c | 10 +++++----- src/p_slopes.c | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 40781721a..ba10a713a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2492,7 +2492,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (maxstep > 0) { - const fixed_t minstep = maxstep / 8; + const fixed_t minstep = maxstep / 4; thingtop = thing->z + thing->height; @@ -2501,7 +2501,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (tmfloorstep <= maxstep) { - stairjank = thing->floordrop; + stairjank = tmfloorstep; stairstep = minstep; thing->z = thing->floorz = tmfloorz; @@ -2517,7 +2517,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (tmceilingstep <= maxstep) { - stairjank = thing->ceilingdrop; + stairjank = tmceilingstep; stairstep = minstep; thing->z = ( thing->ceilingz = tmceilingz ) - thing->height; @@ -2536,7 +2536,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) { - stairjank = thing->ceilingdrop; + stairjank = (tmceilingz - thingtop); stairstep = minstep; thing->z = (thing->ceilingz = tmceilingz) - thing->height; @@ -2546,7 +2546,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) { - stairjank = thing->floordrop; + stairjank = (thing->z - tmfloorz); stairstep = minstep; thing->z = thing->floorz = tmfloorz; diff --git a/src/p_slopes.c b/src/p_slopes.c index 80b1a79e1..776a46b80 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -850,7 +850,10 @@ void P_SlopeLaunch(mobj_t *mo) mo->standingslope = NULL; if (mo->player) + { mo->player->powers[pw_justlaunched] = 1; + mo->player->stairjank = 0; // fuck you + } } // From 786dec30ad97acb6c63c39185fada31ec14a9de0 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Apr 2021 02:09:26 -0700 Subject: [PATCH 4/8] Tweak stair janking physics a bit - Fuck up turning for half the duration of the animation. - Treat drift the same as turning (just ignore it). --- src/p_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index f949e179f..b2aa4cd54 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1865,13 +1865,13 @@ static void P_3dMovement(player_t *player) // Get the old momentum; this will be needed at the end of the function! -SH oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0); - if (player->kartstuff[k_drift] != 0) - movepushangle = player->mo->angle-(ANGLE_45/(player->stairjank ? 4 : 5))*player->kartstuff[k_drift]; - else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle - movepushangle = (angle_t)player->kartstuff[k_boostangle]; - else if (player->stairjank && leveltime & 3) + if (player->stairjank > 8 && leveltime & 3) movepushangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); + else if (player->kartstuff[k_drift] != 0) + movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift]; + else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle + movepushangle = (angle_t)player->kartstuff[k_boostangle]; else movepushangle = player->mo->angle; From 7badb5d925be29c6fec7cafce7b2b615f33df8e3 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Apr 2021 02:32:26 -0700 Subject: [PATCH 5/8] Stair jank sound effects Big meaty sfx, or a shorter one when quickly stepping. --- src/p_map.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index ba10a713a..f9eac42b8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2637,6 +2637,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (stairjank > stairstep && thing->player) { + /* use a shorter sound if not two tics have passed + * since the last step */ + S_StartSound(thing, thing->player->stairjank + >= 16 ? sfx_s23b : sfx_s268); thing->player->stairjank = 17; } From 3f09cd4f2bec31044eabfceb8c0613139bdb141a Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Apr 2021 18:54:29 -0700 Subject: [PATCH 6/8] Stair janking VFX Little sparks spawn on one side of your jart while stepping, plays for 4 frames on each side. Loops if 10 tics of the janking animation remain. --- src/deh_tables.c | 7 +++++++ src/info.c | 34 ++++++++++++++++++++++++++++++++++ src/info.h | 7 +++++++ src/k_kart.c | 5 +++++ src/k_kart.h | 1 + src/p_enemy.c | 2 +- src/p_map.c | 12 +++++++++++- src/p_mobj.c | 15 +++++++++++++++ src/r_patchrotation.c | 4 ++-- 9 files changed, 83 insertions(+), 4 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index a6a7c35cb..7023fb9a2 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4650,6 +4650,12 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_DEBTSPIKEC", "S_DEBTSPIKED", "S_DEBTSPIKEE", + + // Sparks when driving on stairs + "S_JANKSPARK1", + "S_JANKSPARK2", + "S_JANKSPARK3", + "S_JANKSPARK4", }; // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", @@ -5451,6 +5457,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_DRIFTSPARK", "MT_BRAKEDRIFT", "MT_DRIFTDUST", + "MT_JANKSPARK", "MT_ROCKETSNEAKER", // Rocket sneakers diff --git a/src/info.c b/src/info.c index 51cce3e7d..7273f58d1 100644 --- a/src/info.c +++ b/src/info.c @@ -541,6 +541,7 @@ char sprnames[NUMSPRITES + 1][5] = "DRIF", // Drift Sparks "BDRF", // Brake drift sparks "DRWS", // Drift dust sparks + "JANK", // Stair janking sparks // Kart Items "RSHE", // Rocket sneaker @@ -5227,6 +5228,12 @@ state_t states[NUMSTATES] = {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKED}, // S_DEBTSPIKEC {SPR_DEBT, 6|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKEE}, // S_DEBTSPIKED {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE1}, // S_DEBTSPIKEE + + // Sparks when driving on stairs + {SPR_JANK, 0, 1, {NULL}, 0, 0, S_JANKSPARK2}, // S_JANKSPARK1 + {SPR_JANK, FF_PAPERSPRITE|FF_FULLBRIGHT|FF_ANIMATE, 4, {NULL}, 3, 1, S_JANKSPARK3}, // S_JANKSPARK2 + {SPR_JANK, 0, 0, {A_SetCustomValue}, -1, 5, S_JANKSPARK4}, // S_JANKSPARK3 + {SPR_JANK, 0, 0, {A_ChangeAngleRelative}, 180, 180, S_JANKSPARK2}, // S_JANKSPARK4 }; mobjinfo_t mobjinfo[NUMMOBJTYPES] = @@ -23473,6 +23480,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_JANKSPARK + -1, // doomednum + S_JANKSPARK1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_FLOAT|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_ROCKETSNEAKER -1, // doomednum S_ROCKETSNEAKER_L, // spawnstate diff --git a/src/info.h b/src/info.h index 527dc5a05..58d1dfd76 100644 --- a/src/info.h +++ b/src/info.h @@ -1093,6 +1093,7 @@ typedef enum sprite SPR_DRIF, // Drift Sparks SPR_BDRF, // Brake drift sparks SPR_DRWS, // Drift dust sparks + SPR_JANK, // Stair janking sparks // Kart Items SPR_RSHE, // Rocket sneaker @@ -5642,6 +5643,11 @@ typedef enum state S_DEBTSPIKED, S_DEBTSPIKEE, + S_JANKSPARK1, + S_JANKSPARK2, + S_JANKSPARK3, + S_JANKSPARK4, + S_FIRSTFREESLOT, S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1, NUMSTATES @@ -6462,6 +6468,7 @@ typedef enum mobj_type MT_DRIFTSPARK, MT_BRAKEDRIFT, MT_DRIFTDUST, + MT_JANKSPARK, MT_ROCKETSNEAKER, diff --git a/src/k_kart.c b/src/k_kart.c index 99cab4ea7..d8503e1a9 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7679,6 +7679,11 @@ SINT8 K_Sliptiding(player_t *player) return p[k_drift] ? 0 : p[k_aizdriftstrat]; } +INT32 K_StairJankFlip(INT32 value) +{ + return P_AltFlip(value, 2); +} + static void K_KartSpindashDust(mobj_t *parent) { fixed_t rad = FixedDiv(FixedHypot(parent->radius, parent->radius), parent->scale); diff --git a/src/k_kart.h b/src/k_kart.h index 09665d8ab..a5ebb9534 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -85,6 +85,7 @@ boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y); void K_UpdateSteeringValue(player_t *player, INT16 destSteering); INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue); INT32 K_GetKartDriftSparkValue(player_t *player); +INT32 K_StairJankFlip(INT32 value); void K_SpawnDriftBoostExplosion(player_t *player, int stage); void K_KartUpdatePosition(player_t *player); mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount); diff --git a/src/p_enemy.c b/src/p_enemy.c index 8ef33a38e..5e6952469 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14819,4 +14819,4 @@ void A_InvincSparkleRotate(mobj_t *actor) actor->momz = actor->target->momz; // Give momentum for eventual interp builds idk. actor->angle += ANG1*10*(actor->extravalue2); // Arbitrary value, change this if you want, I suppose. -} \ No newline at end of file +} diff --git a/src/p_map.c b/src/p_map.c index f9eac42b8..ef4f6f1cf 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2638,9 +2638,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (stairjank > stairstep && thing->player) { /* use a shorter sound if not two tics have passed - * since the last step */ + * since the last step */ S_StartSound(thing, thing->player->stairjank >= 16 ? sfx_s23b : sfx_s268); + + 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); + } + thing->player->stairjank = 17; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 49165162d..c90b84fec 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6887,6 +6887,21 @@ static boolean P_MobjRegularThink(mobj_t *mobj) mobj->renderflags |= RF_DONTDRAW; } break; + case MT_JANKSPARK: + if (!mobj->target) + { + P_RemoveMobj(mobj); + return false; + } + if (mobj->fuse == 1 && mobj->target->player && + mobj->target->player->stairjank >= 8) + { + mobj->fuse = 9; + } + P_TeleportMove(mobj, mobj->target->x, + mobj->target->y, mobj->target->z); + mobj->angle = mobj->target->angle + mobj->cusval; + break; case MT_PLAYERRETICULE: if (!mobj->target || !mobj->target->health) { diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c index f6ae0655f..447eb6925 100644 --- a/src/r_patchrotation.c +++ b/src/r_patchrotation.c @@ -53,8 +53,8 @@ static angle_t R_PlayerSpriteRotation(player_t *player) if (player->stairjank) { - rollAngle += P_AltFlip(ANGLE_11hh / 2 / - (17 / player->stairjank), 2); + rollAngle += K_StairJankFlip(ANGLE_11hh / 2 / + (17 / player->stairjank)); } return rollAngle; From 81e43245a892e68eef17a3350d6b5b19dd7428fe Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Apr 2021 19:28:38 -0700 Subject: [PATCH 7/8] Don't stair jank if crossing from/onto a slope Also don't do it on ceilings unless standing on it. --- src/p_map.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index ef4f6f1cf..9a96f7004 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2420,7 +2420,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) fixed_t thingtop; fixed_t startingonground = P_IsObjectOnGround(thing); fixed_t stairjank = 0; - fixed_t stairstep = 0; + pslope_t *oldslope = thing->standingslope; floatok = false; // reset this to 0 at the start of each trymove call as it's only used here @@ -2492,7 +2492,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (maxstep > 0) { - const fixed_t minstep = maxstep / 4; + const boolean flipped = + (thing->eflags & MFE_VERTICALFLIP) != 0; thingtop = thing->z + thing->height; @@ -2501,8 +2502,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (tmfloorstep <= maxstep) { - stairjank = tmfloorstep; - stairstep = minstep; + if (!flipped) + stairjank = tmfloorstep; thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; @@ -2517,8 +2518,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (tmceilingstep <= maxstep) { - stairjank = tmceilingstep; - stairstep = minstep; + if (flipped) + stairjank = tmceilingstep; thing->z = ( thing->ceilingz = tmceilingz ) - thing->height; thing->ceilingrover = tmceilingrover; @@ -2536,8 +2537,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) { - stairjank = (tmceilingz - thingtop); - stairstep = minstep; + if (flipped) + stairjank = (tmceilingz - thingtop); thing->z = (thing->ceilingz = tmceilingz) - thing->height; thing->ceilingrover = tmceilingrover; @@ -2546,8 +2547,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) { - stairjank = (thing->z - tmfloorz); - stairstep = minstep; + if (!flipped) + stairjank = (thing->z - tmfloorz); thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; @@ -2635,7 +2636,10 @@ 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; - if (stairjank > stairstep && thing->player) + /* FIXME: slope step down (even up) has some false + positives, so just ignore them entirely. */ + if (stairjank && !oldslope && + !thing->standingslope && thing->player) { /* use a shorter sound if not two tics have passed * since the last step */ From 92e61d82d98afc7b3aac019cb18561e2cf9a1bb9 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Apr 2021 20:19:38 -0700 Subject: [PATCH 8/8] Don't stair jank in spectator mode --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 9a96f7004..e4ea5ac8b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2638,8 +2638,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) /* FIXME: slope step down (even up) has some false positives, so just ignore them entirely. */ - if (stairjank && !oldslope && - !thing->standingslope && thing->player) + if (stairjank && !oldslope && !thing->standingslope && + thing->player && !thing->player->spectator) { /* use a shorter sound if not two tics have passed * since the last step */