From 8e5714439ac572d6c8265c4e6701c1f67361aa01 Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 3 Jan 2021 23:26:05 -0800 Subject: [PATCH] Unindent musicclass::play() from previous two commits As always, the actual unindenting happens in a separate commit in order to minimize diff noise. --- desktop_version/src/Music.cpp | 72 +++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index cf6b4e57..fa657b56 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -195,51 +195,51 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade currentsong = t; - if (t == -1) + if (t == -1) + { + return; + } + + if (!INBOUNDS_VEC(t, musicTracks)) + { + puts("play() out-of-bounds!"); + currentsong = -1; + return; + } + + if (currentsong == 0 || currentsong == 7 || (!map.custommode && (currentsong == 0+num_mmmmmm_tracks || currentsong == 7+num_mmmmmm_tracks))) + { + // Level Complete theme, no fade in or repeat + if (Mix_FadeInMusicPos(musicTracks[t].m_music, 0, 0, position_sec) == -1) { - return; + printf("Mix_FadeInMusicPos: %s\n", Mix_GetError()); } + } + else + { + if (Mix_FadingMusic() == MIX_FADING_OUT) + { + // We're already fading out + nicechange = t; + nicefade = true; + currentsong = -1; - if (!INBOUNDS_VEC(t, musicTracks)) + if (quick_fade) { - puts("play() out-of-bounds!"); - currentsong = -1; - return; - } - - if (currentsong == 0 || currentsong == 7 || (!map.custommode && (currentsong == 0+num_mmmmmm_tracks || currentsong == 7+num_mmmmmm_tracks))) - { - // Level Complete theme, no fade in or repeat - if (Mix_FadeInMusicPos(musicTracks[t].m_music, 0, 0, position_sec) == -1) - { - printf("Mix_FadeInMusicPos: %s\n", Mix_GetError()); - } + Mix_FadeOutMusic(500); // fade out quicker } else { - if (Mix_FadingMusic() == MIX_FADING_OUT) - { - // We're already fading out - nicechange = t; - nicefade = true; - currentsong = -1; - - if (quick_fade) - { - Mix_FadeOutMusic(500); // fade out quicker - } - else - { - quick_fade = true; - } - } - else if (Mix_FadeInMusicPos(musicTracks[t].m_music, -1, fadein_ms, position_sec) == -1) - { - printf("Mix_FadeInMusicPos: %s\n", Mix_GetError()); - } + quick_fade = true; } + } + else if (Mix_FadeInMusicPos(musicTracks[t].m_music, -1, fadein_ms, position_sec) == -1) + { + printf("Mix_FadeInMusicPos: %s\n", Mix_GetError()); + } + } - songStart = SDL_GetPerformanceCounter(); + songStart = SDL_GetPerformanceCounter(); } void musicclass::resume(const int fadein_ms /*= 0*/)