diff --git a/src/d_player.h b/src/d_player.h index 1813918f0..075a64c69 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -361,9 +361,6 @@ typedef struct squishdance_s { tic_t countdown; // hold "custom 3" for 2 seconds to engange le dance tic_t time; - fixed_t work; - fixed_t ang; - fixed_t bounce; // hehe squishy } squishdance_t; typedef struct salty_s diff --git a/src/p_user.c b/src/p_user.c index 2fc5260e1..dd43d41fe 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4517,27 +4517,33 @@ static void DoABarrelRoll(player_t *player) static void P_DoFunnyDance(player_t *player) { fixed_t bpm; // 140bpm ish + fixed_t work, ang, bounce; // hehe squishy - if (player->spectator || !player->mo || player->kartstuff[k_respawn] || player->salty.jump) // this looks jank as hell during hop + I_Assert(player != NULL); + I_Assert(!P_MobjWasRemoved(player->mo)); + + if (player->spectator) return; - player->squishdance.bounce = 0; + // this looks jank as hell during hop or respawn + if (player->kartstuff[k_respawn] || player->salty.jump) + return; // bpm = FixedDiv((60*TICRATE)<squishdance.work = (player->squishdance.time << FRACBITS) % bpm; + work = (player->squishdance.time << FRACBITS) % bpm; if (player->squishdance.time >= (FRACUNIT >> 1)) // prevent overflow jump - takes about 15 minutes - player->squishdance.time = (player->squishdance.work >> FRACBITS); + player->squishdance.time = (work >> FRACBITS); - player->squishdance.work = FixedDiv(player->squishdance.work*180, bpm); + work = FixedDiv(work*180, bpm); - player->squishdance.ang = ((FixedAngle(player->squishdance.work) >> ANGLETOFINESHIFT) & FINEMASK); - player->squishdance.bounce = ((FINESINE(player->squishdance.ang) - FRACUNIT/2) / 2); + ang = ((FixedAngle(work) >> ANGLETOFINESHIFT) & FINEMASK); + bounce = ((FINESINE(ang) - FRACUNIT/2) / 2); - player->mo->spritexscale -= player->squishdance.bounce; - player->mo->spriteyscale += player->squishdance.bounce; + player->mo->spritexscale -= bounce; + player->mo->spriteyscale += bounce; player->squishdance.time++; }