1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

Merge fadeoutqueuesong into nicechange

fadeoutqueuesong basically does the same thing as nicechange - they both
queue a song to be played when the current track is done fading out.
Except, for some reason, I decided to add fadeoutqueuesong instead of
using the existing nicechange/nicefade system.

This has consequences where fadeoutqueuesong would step on the toes of
nicechange. In the case of #390, nicechange would say "let's play
Potential for Anything" when entering the Super Gravitron, but
fadeoutqueuesong had previously said "let's play Pipe Dream" because of
the player having just exited the Super Gravitron. fadeoutqueuesong took
priority because it came first in musicclass::processfade(), and when it
called play(), the Mix_PlayingMusic() in the nicechange check afterwards
would say music would already be playing at that point, so the
nicechange wouldn't take effect.

In the end, the solution is to just merge the new system into the
already-existing system.

Fixes #390.
This commit is contained in:
Misa 2020-11-06 00:36:25 -08:00 committed by Ethan Lee
parent 410d80b731
commit 87af9bba04
2 changed files with 9 additions and 10 deletions

View File

@ -139,7 +139,6 @@ void musicclass::init()
nicechange = -1;
nicefade = false;
resumesong = 0;
fadeoutqueuesong = -1;
dontquickfade = false;
songStart = 0;
@ -199,14 +198,20 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade
}
else
{
if (Mix_FadingMusic() == MIX_FADING_OUT) {
if (Mix_FadingMusic() == MIX_FADING_OUT)
{
// We're already fading out
fadeoutqueuesong = t;
nicechange = t;
nicefade = true;
currentsong = -1;
if (!dontquickfade)
{
Mix_FadeOutMusic(500); // fade out quicker
}
else
{
dontquickfade = false;
}
}
else if(Mix_FadeInMusicPos(musicTracks[t].m_music, -1, fadein_ms, position_sec)==-1)
{
@ -277,11 +282,6 @@ void musicclass::processmusic()
return;
}
if (fadeoutqueuesong != -1 && Mix_PlayingMusic() == 0) {
play(fadeoutqueuesong);
fadeoutqueuesong = -1;
}
if (nicefade && Mix_PlayingMusic() == 0)
{
play(nicechange);

View File

@ -36,14 +36,13 @@ public:
SoundSystem soundSystem;
bool safeToProcessMusic;
int nicechange;
int nicechange; // -1 if no song queued
bool nicefade;
bool m_doFadeInVol;
int FadeVolAmountPerFrame;
int musicVolume;
int fadeoutqueuesong; // -1 if no song queued
bool dontquickfade;
// MMMMMM mod settings