mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Don't reset entire musicclass when mounting and unmounting assets
musicclass::init() re-initializes every attribute of musicclass unnecessarily, when initialization should be put in a constructor instead. This is bad, because music.init() gets called whenever we enter and exit a custom level that has assets. Otherwise, this would result in a bug where music.usingmmmmmm would be reset, causing you to revert to PPPPPP on the title screen whenever you enter a level with MMMMMM selected and exit it. This also causes a confusing desync between game.usingmmmmmm and music.usingmmmmmm since the values of the two variables are now different (these duplicate variables should probably be removed, too, and a lot of other duplicate variables like these exist, too, which are a real headache). Which means despite MMMMMM playing on the title screen, exiting the game and re-launching it will play PPPPPP instead. What's even more is that going to game options and switching to PPPPPP will play PPPPPP, but afterwards launching and re-entering will play MMMMMM. Again, having duplicate variables is very bad, and should probably be fixed, but that's a separate patch.
This commit is contained in:
@@ -10,6 +10,27 @@
|
||||
|
||||
void songend();
|
||||
|
||||
musicclass::musicclass()
|
||||
{
|
||||
safeToProcessMusic= false;
|
||||
m_doFadeInVol = false;
|
||||
musicVolume = MIX_MAX_VOLUME;
|
||||
FadeVolAmountPerFrame = 0;
|
||||
|
||||
currentsong = 0;
|
||||
nicechange = -1;
|
||||
nicefade = false;
|
||||
resumesong = 0;
|
||||
quick_fade = true;
|
||||
|
||||
songStart = 0;
|
||||
songEnd = 0;
|
||||
|
||||
Mix_HookMusicFinished(&songend);
|
||||
|
||||
usingmmmmmm = false;
|
||||
}
|
||||
|
||||
void musicclass::init()
|
||||
{
|
||||
for (size_t i = 0; i < soundTracks.size(); ++i) {
|
||||
@@ -129,24 +150,6 @@ void musicclass::init()
|
||||
|
||||
num_pppppp_tracks++;
|
||||
}
|
||||
|
||||
safeToProcessMusic= false;
|
||||
m_doFadeInVol = false;
|
||||
musicVolume = MIX_MAX_VOLUME;
|
||||
FadeVolAmountPerFrame = 0;
|
||||
|
||||
currentsong = 0;
|
||||
nicechange = -1;
|
||||
nicefade = false;
|
||||
resumesong = 0;
|
||||
quick_fade = true;
|
||||
|
||||
songStart = 0;
|
||||
songEnd = 0;
|
||||
|
||||
Mix_HookMusicFinished(&songend);
|
||||
|
||||
usingmmmmmm = false;
|
||||
}
|
||||
|
||||
void songend()
|
||||
|
||||
Reference in New Issue
Block a user