From 44bd4ec0b731164e7b1125bc8993066aa91469b0 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 17 Jun 2020 00:48:10 -0700 Subject: [PATCH] Fix custom assets not being unmounted when exiting from editor/credits If you exited from the editor, custom assets would not be unmounted. But I made sure to put the FILESYSTEM_unmountassets() before the music.play(6) because otherwise the menu music wouldn't play. You could also exit to the menu from a custom level using the rollcredits() command, so I made sure to put a FILESYSTEM_unmountassets() when returning to the menu from the credits as well. I also made sure to put it before the music.playef(18) so there's no risk of the sound effect not playing properly, or not playing the non-level-specific one. I added a comment to both FILESYSTEM_unmountasset()s to make sure anyone reading the code is aware of the frame order dependency. --- desktop_version/src/Logic.cpp | 2 ++ desktop_version/src/editor.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 88fb978c..161bfe47 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -1,6 +1,7 @@ #include "Logic.h" #include "Script.h" #include "Network.h" +#include "FileSystemUtils.h" void titlelogic() { @@ -107,6 +108,7 @@ void gamecompletelogic2() map.colstate = 10; game.gamestate = TITLEMODE; graphics.fademode = 4; + FILESYSTEM_unmountassets(); // should be before music.playef(18) music.playef(18); game.returntomenu(Menu::play); game.createmenu(Menu::gamecompletecontinue); diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index acc3cc3f..248fea3c 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -3589,6 +3589,7 @@ void editorlogic() script.hardreset(); graphics.fademode = 4; music.haltdasmusik(); + FILESYSTEM_unmountassets(); // should be before music.play(6) music.play(6); map.nexttowercolour(); ed.settingsmod=false;