From b5501e4b290c4bad68efd9b2aae63fcf707aeeac Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 10 Sep 2021 18:56:12 -0700 Subject: [PATCH] Kludge-fix being able to play music in editor When you're on the music changing screen in the editor, it plays the current track. When you return, it stops playing the track. However, if you press escape, it doesn't stop playing the track. This is because pressing escape just returns to the previous menu without stopping playing the track. To fix this, I just added some kludge in the return menu function. This is kinda super bad but it works for now and is just something to clean up later. Maybe like each menu having exit callbacks or something, I dunno. This is kinda a regression, kinda sorta not. In 2.2 and previous, pressing escape would just close the settings menu entirely, which also bypassed the music fadeout. 2.3 made it so pressing escape doesn't entirely close the settings menu, and just returns to the previous menu, which fails in a different way. But the intended way is definitely to select the return option and having the music fade out. --- desktop_version/src/Game.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 3aa19d08..2abbb5c2 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -5862,6 +5862,12 @@ void Game::returnmenu(void) return; } + /* FIXME: Super bad kludge, don't hardcode this! */ + if (currentmenuname == Menu::ed_music) + { + music.fadeout(); + } + MenuStackFrame& frame = menustack[menustack.size()-1]; //Store this in case createmenu() removes the stack frame