From c1a25aa4c22d73a8782ae33827e8b7277b0d0a8b Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 10 Jun 2023 11:41:32 -0700 Subject: [PATCH] CLI: Allow no music to be played if save pos used If you provided any one of -playx, -playy, -playrx, -playry, -playgc, or -playmusic in command-line arguments for command-line playtesting, then the game would always try to play music, even if you passed a negative -playmusic. This wouldn't do anything in that case, unless you had MMMMMM installed, in which case it would play MMMMMM track 15 (Predestined Fate Final Level) due to the legacy wraparound bug. To fix this, only play music if the track provided is greater than -1. Additionally, to prevent it from playing Path Complete by default if you specify any of the other save position arguments but n ot -playmusic, it's now initialized to -1 instead of 0. --- desktop_version/src/Game.cpp | 5 ++++- desktop_version/src/main.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 05dde775..afccd5c0 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -5387,7 +5387,10 @@ void Game::customloadquick(const std::string& savfile) saverx = playrx; savery = playry; savegc = playgc; - music.play(playmusic); + if (playmusic > -1) + { + music.play(playmusic); + } return; } diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index 316a0b6b..827b18ff 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -61,7 +61,7 @@ static int savey = 0; static int saverx = 0; static int savery = 0; static int savegc = 0; -static int savemusic = 0; +static int savemusic = -1; static std::string playassets; static std::string playtestname;