1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Clean up don't-quick-fade signaling

First, the variable has been inverted, because it's bad practice to have
booleans with negative names. Secondly, instead of magically setting a
signaling variable when calling fadeout(), fadeout() now has a parameter
to set the quick_fade attribute, which is much cleaner than doing the
magical assignment that could potentially look unrelated.
This commit is contained in:
Misa 2020-11-06 00:51:04 -08:00 committed by Ethan Lee
parent 87af9bba04
commit 05b7a38f76
3 changed files with 9 additions and 10 deletions

View file

@ -139,7 +139,7 @@ void musicclass::init()
nicechange = -1;
nicefade = false;
resumesong = 0;
dontquickfade = false;
quick_fade = true;
songStart = 0;
songEnd = 0;
@ -204,13 +204,13 @@ void musicclass::play(int t, const double position_sec /*= 0.0*/, const int fade
nicechange = t;
nicefade = true;
currentsong = -1;
if (!dontquickfade)
if (quick_fade)
{
Mix_FadeOutMusic(500); // fade out quicker
}
else
{
dontquickfade = false;
quick_fade = true;
}
}
else if(Mix_FadeInMusicPos(musicTracks[t].m_music, -1, fadein_ms, position_sec)==-1)
@ -260,10 +260,11 @@ void musicclass::fadeMusicVolumeIn(int ms)
FadeVolAmountPerFrame = MIX_MAX_VOLUME / (ms / 33);
}
void musicclass::fadeout()
void musicclass::fadeout(const bool quick_fade_ /*= true*/)
{
Mix_FadeOutMusic(2000);
resumesong = currentsong;
quick_fade = quick_fade_;
}
void musicclass::processmusicfadein()
@ -303,8 +304,7 @@ void musicclass::niceplay(int t)
{
if(currentsong!=-1)
{
dontquickfade = true;
fadeout();
fadeout(false);
}
nicefade = true;
nicechange = t;

View file

@ -18,7 +18,7 @@ public:
void haltdasmusik();
void silencedasmusik();
void fadeMusicVolumeIn(int ms);
void fadeout();
void fadeout(const bool quick_fade_ = true);
void fadein();
void processmusicfadein();
void processmusic();
@ -43,7 +43,7 @@ public:
int FadeVolAmountPerFrame;
int musicVolume;
bool dontquickfade;
bool quick_fade;
// MMMMMM mod settings
bool mmmmmm;

View file

@ -284,8 +284,7 @@ void scriptclass::run()
}
if (words[0] == "musicfadeout")
{
music.fadeout();
music.dontquickfade = true;
music.fadeout(false);
}
if (words[0] == "musicfadein")
{