From 568012589d2ba2f856cf9772a37871b7828c8090 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 28 Mar 2025 04:52:50 +0100 Subject: [PATCH] :3 --- src/d_player.h | 2 ++ src/p_user.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/d_player.h b/src/d_player.h index 7ecef63de..a1e4a0b20 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -555,6 +555,8 @@ typedef struct player_s fixed_t spinoutrot; // When a player spins out, this value increments modulus 360. + tic_t dancetime; + fixed_t fovadd; // adjust FOV for hw rendering } player_t; diff --git a/src/p_user.c b/src/p_user.c index f4f36eb02..c65b25ccf 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4439,6 +4439,37 @@ DoABarrelRoll (player_t *player) #define SPINOUTROTSPEED (24 * FRACUNIT) #define MAXSPINROT (360 * FRACUNIT) +static void P_DoFunnyDance (player_t *player) +{ + static tic_t time = 0; + fixed_t bounce; + fixed_t work, bpm; + angle_t ang; + + if (player->spectator || !player->mo || player->kartstuff[k_respawn] || player->mo->salty_jump) // this looks jank as hell during hop + return; + + bounce = 0; + + // bpm = FLOAT_TO_FIXED(mapmusic.bpm) << maybe can get the tempo and beat detection lib to work for bpm autodetection + bpm = FixedDiv((60*TICRATE)<= (FRACUNIT>>1)) // prevent overflow jump - takes about 15 minutes + time = (work>>FRACBITS); + + work = FixedDiv(work*180, bpm); + + ang = (FixedAngle(work)>>ANGLETOFINESHIFT) & FINEMASK; + bounce = (FINESINE(ang) - FRACUNIT/2); + + player->mo->spritexscale -= bounce/2; + player->mo->spriteyscale += bounce/2; + + time++; // bruh +} + // // P_PlayerThink // @@ -4976,6 +5007,16 @@ void P_PlayerThink(player_t *player) if (player->losstime && !player->powers[pw_flashing]) player->losstime--; + if (cmd->buttons & BT_CUSTOM3) + { + player->dancetime++; + + if (player->dancetime > TICRATE*2) + P_DoFunnyDance(player); + } + else + player->dancetime = 0; + // 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.