diff --git a/src/d_main.c b/src/d_main.c index 6a525fbd6..1800a0761 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -688,6 +688,55 @@ static boolean D_Display(void) return ranwipe; } +//TODO: this is absolutely fucking horrific +static void DoFunnyDance (void) +{ + thinker_t *th; + static tic_t time = 0; + fixed_t bounce = 0; + fixed_t work, bpm = FLOAT_TO_FIXED(150.f); // FLOAT_TO_FIXED(mapmusic.bpm) + angle_t ang; + + if (S_MapMusPlaying()) + { + bpm = FixedDiv((60*TICRATE)<= (FRACUNIT << (FRACBITS - 2))) // prevent overflow jump - takes about 15 minutes of loop on the same song to reach + time = work; + + work = FixedDiv(work*180, bpm); + + ang = (FixedAngle(work)>>ANGLETOFINESHIFT) & FINEMASK; + bounce = (FINESINE(ang) - FRACUNIT/2); + + if (!paused && !P_AutoPause()) + { + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + mobj_t *mo; + + if (th->function.acp1 != (actionf_p1)P_MobjThinker) // not a mobj + continue; + + mo = (mobj_t *)th; + + if (!mo->player) + continue; + + mo->spritexscale -= bounce/32; + mo->spriteyscale += bounce/32; + } + } + + time += renderdeltatics; + } + else + time = 0; +} + // ========================================================================= // D_SRB2Loop // ========================================================================= diff --git a/src/s_sound.c b/src/s_sound.c index f93682a73..742b0e237 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1960,6 +1960,12 @@ void S_ResetKeepAndSpecialMus(void) keepmapmusic = skipintromus = false; } +boolean S_MapMusPlaying(void) +{ + return S_MusicPlaying() && (strcasecmp(music.name, mapmusic.name) == 0); +} + + // saves the current song position everytime a song stops // so we can resume it in some cases static void S_SetKeepMusResume(void) diff --git a/src/s_sound.h b/src/s_sound.h index 04a818ec9..f159822af 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -52,6 +52,8 @@ extern consvar_t cv_amigatype; #endif #endif +boolean S_MapMusPlaying(void); + //bird music stuff extern consvar_t cv_music_resync_threshold; extern consvar_t cv_music_resync_powerups_only;