From 2a3f17f1f7d94b1c6cfbe544e93efc25307e4e0c Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 11 Apr 2021 15:18:35 -0700 Subject: [PATCH] Add audio category to options menu The audio category contains the MMMMMM soundtrack option, as well as stubs for the soon-to-be-implemented volume slider options. --- desktop_version/src/Game.cpp | 17 +++++++--- desktop_version/src/Game.h | 1 + desktop_version/src/Input.cpp | 60 ++++++++++++++++++++++++---------- desktop_version/src/Render.cpp | 60 ++++++++++++++++++++++++++-------- 4 files changed, 102 insertions(+), 36 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 3316d919..bc675e88 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6031,13 +6031,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) case Menu::options: option("gameplay"); option("graphics"); + option("audio"); option("game pad"); option("accessibility"); - //Add extra menu for mmmmmm mod - if(music.mmmmmm){ - option("soundtrack"); - } - option("return"); menuyoff = 0; maxspacing = 15; @@ -6058,6 +6054,17 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) menuyoff = 0; maxspacing = 15; break; + case Menu::audiooptions: + option("music volume"); + option("sound volume"); + if (music.mmmmmm) + { + option("soundtrack"); + } + option("return"); + menuyoff = 0; + maxspacing = 15; + break; case Menu::accessibility: #if !defined(MAKEANDPLAY) option("unlock play modes"); diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index ce6d3af2..e91a1a38 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -44,6 +44,7 @@ namespace Menu gameplayoptions, speedrunneroptions, advancedoptions, + audiooptions, accessibility, controller, cleardatamenu, diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index f9568e50..5313f9bb 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -750,34 +750,25 @@ static void menuactionpress(void) map.nexttowercolour(); break; case 2: + /* Audio options */ + music.playef(11); + game.createmenu(Menu::audiooptions); + map.nexttowercolour(); + break; + case 3: //gamepad options music.playef(11); game.createmenu(Menu::controller); map.nexttowercolour(); break; - case 3: + case 4: //accessibility options music.playef(11); game.createmenu(Menu::accessibility); map.nexttowercolour(); break; - } - - if (game.currentmenuoption == 4 && music.mmmmmm) - { - //**** TOGGLE MMMMMM - music.usingmmmmmm = !music.usingmmmmmm; - music.playef(11); - if (music.currentsong > -1) - { - music.play(music.currentsong); - } - game.savestatsandsettings_menu(); - } - - if (game.currentmenuoption == 4 + (music.mmmmmm?1:0)) - { - //Last option here is "return" + default: + /* Return */ music.playef(11); if (game.ingame_titlemode) { @@ -788,8 +779,41 @@ static void menuactionpress(void) game.returnmenu(); map.nexttowercolour(); } + break; + } + break; + case Menu::audiooptions: + switch (game.currentmenuoption) + { + case 0: + /* Not implemented */ + break; + case 1: + /* Not implemented */ + break; + case 2: + if (!music.mmmmmm) + { + break; + } + + /* Toggle MMMMMM */ + music.usingmmmmmm = !music.usingmmmmmm; + music.playef(11); + if (music.currentsong > -1) + { + music.play(music.currentsong); + } + game.savestatsandsettings_menu(); + break; } + if (game.currentmenuoption == 2 + (int) music.mmmmmm) + { + /* Return */ + game.returnmenu(); + map.nexttowercolour(); + } break; case Menu::unlockmenutrials: switch (game.currentmenuoption) diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 092a88a0..25970783 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -175,28 +175,24 @@ static void menurender(void) graphics.Print(-1, 65, "Adjust screen settings", tr, tg, tb, true); break; case 2: + graphics.bigprint(-1, 30, "Audio Options", tr, tg, tb, true); + graphics.Print(-1, 65, "Adjust volume settings", tr, tg, tb, true); + if (music.mmmmmm) + { + graphics.Print(-1, 75, "and soundtrack", tr, tg, tb, true); + } + break; + case 3: graphics.bigprint(-1, 30, "Game Pad Options", tr, tg, tb, true); graphics.Print(-1, 65, "Rebind your controller's buttons", tr, tg, tb, true); graphics.Print(-1, 75, "and adjust sensitivity", tr, tg, tb, true); break; - case 3: + case 4: graphics.bigprint(-1, 30, "Accessibility", tr, tg, tb, true); graphics.Print(-1, 65, "Disable screen effects, enable", tr, tg, tb, true); graphics.Print(-1, 75, "slowdown modes or invincibility", tr, tg, tb, true); break; } - - if (game.currentmenuoption == 4 && music.mmmmmm) - { - graphics.bigprint(-1, 30, "Soundtrack", tr, tg, tb, true); - graphics.Print(-1, 65, "Toggle between MMMMMM and PPPPPP", tr, tg, tb, true); - if (music.usingmmmmmm) { - graphics.Print(-1, 85, "Current soundtrack: MMMMMM", tr, tg, tb, true); - } - else { - graphics.Print(-1, 85, "Current soundtrack: PPPPPP", tr, tg, tb, true); - } - } break; case Menu::graphicoptions: switch (game.currentmenuoption) @@ -281,6 +277,44 @@ static void menurender(void) break; } break; + case Menu::audiooptions: + switch (game.currentmenuoption) + { + case 0: + /* Not implemented */ + break; + case 1: + /* Not implemented */ + break; + case 2: + if (!music.mmmmmm) + { + break; + } + { + /* Screen width 40 chars, 4 per char */ + char buffer[160 + 1]; + char soundtrack[6 + 1]; + char letter; + if (music.usingmmmmmm) + { + letter = 'M'; + } + else + { + letter = 'P'; + } + VVV_fillstring(soundtrack, sizeof(soundtrack), letter); + SDL_snprintf(buffer, sizeof(buffer), "Current soundtrack: %s", soundtrack); + + graphics.bigprint(-1, 30, "Soundtrack", tr, tg, tb, true); + graphics.Print(-1, 65, "Toggle between MMMMMM and PPPPPP", tr, tg, tb, true); + graphics.Print(-1, 85, buffer, tr, tg, tb, true); + break; + } + + } + break; case Menu::credits: graphics.Print( -1, 50, "VVVVVV is a game by", tr, tg, tb, true); graphics.bigprint( 40, 65, "Terry Cavanagh", tr, tg, tb, true, 2);