Allow user to change music in menu (#212)

* Allow user to change music in menu

* Remove annoying newline

* Fully reset menu

* No need for sSoundBox

* Add music to castle grounds

* Add translations

* oops

* Why did that not save!!

* Update lang/Polish.ini

Co-authored-by: Radek Krzyśków <46760021+Flower35@users.noreply.github.com>

* Update lang/Czech.ini

Co-authored-by: Radek Krzyśków <46760021+Flower35@users.noreply.github.com>

* Update lang/Russian.ini

Co-authored-by: Radek Krzyśków <46760021+Flower35@users.noreply.github.com>

---------

Co-authored-by: Radek Krzyśków <46760021+Flower35@users.noreply.github.com>
This commit is contained in:
EmeraldLockdown 2024-09-01 12:15:04 -05:00 committed by GitHub
parent db3a7e3483
commit af8dc6995d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 87 additions and 28 deletions

View file

@ -260,7 +260,7 @@ QUIT = "Opustit hru"
MENU_TITLE = "MENU" MENU_TITLE = "MENU"
LEVEL = "Level" LEVEL = "Level"
STAFF_ROLL = "Závěrečné titulky" STAFF_ROLL = "Závěrečné titulky"
USE_STAGE_MUSIC = "Použít písničku z levelu" MUSIC = "Písnička"
RANDOM_STAGE = "Náhodný level" RANDOM_STAGE = "Náhodný level"
PLAY_VANILLA_DEMOS = "Přehrát dema" PLAY_VANILLA_DEMOS = "Přehrát dema"

View file

@ -260,7 +260,7 @@ QUIT = "Stop"
MENU_TITLE = "MENU" MENU_TITLE = "MENU"
LEVEL = "Level" LEVEL = "Level"
STAFF_ROLL = "Personeelsoverzicht" STAFF_ROLL = "Personeelsoverzicht"
USE_STAGE_MUSIC = "Gebruik level muziek" MUSIC = "Muziek"
RANDOM_STAGE = "Willekeurig level" RANDOM_STAGE = "Willekeurig level"
PLAY_VANILLA_DEMOS = "Speel normale demos af" PLAY_VANILLA_DEMOS = "Speel normale demos af"

View file

@ -260,7 +260,7 @@ QUIT = "Quit"
MENU_TITLE = "MENU" MENU_TITLE = "MENU"
LEVEL = "Level" LEVEL = "Level"
STAFF_ROLL = "Staff Roll" STAFF_ROLL = "Staff Roll"
USE_STAGE_MUSIC = "Use Stage Music" MUSIC = "Music"
RANDOM_STAGE = "Random Stage" RANDOM_STAGE = "Random Stage"
PLAY_VANILLA_DEMOS = "Play Vanilla Demos" PLAY_VANILLA_DEMOS = "Play Vanilla Demos"

View file

@ -260,7 +260,7 @@ QUIT = "Quitter"
MENU_TITLE = "MENU" MENU_TITLE = "MENU"
LEVEL = "Niveau" LEVEL = "Niveau"
STAFF_ROLL = "Générique de fin" STAFF_ROLL = "Générique de fin"
USE_STAGE_MUSIC = "Utiliser la musique du niveau" MUSIC = "Musique"
RANDOM_STAGE = "Niveau aléatoire" RANDOM_STAGE = "Niveau aléatoire"
PLAY_VANILLA_DEMOS = "Jouer les démos" PLAY_VANILLA_DEMOS = "Jouer les démos"

View file

@ -260,7 +260,7 @@ QUIT = "Beenden"
MENU_TITLE = "MENÜ" MENU_TITLE = "MENÜ"
LEVEL = "Level" LEVEL = "Level"
STAFF_ROLL = "Abspann" STAFF_ROLL = "Abspann"
USE_STAGE_MUSIC = "Stufenmusik verwenden" MUSIC = "Musik"
RANDOM_STAGE = "Zufälliger Level" RANDOM_STAGE = "Zufälliger Level"
PLAY_VANILLA_DEMOS = "Original-Demos spielen" PLAY_VANILLA_DEMOS = "Original-Demos spielen"

View file

@ -258,7 +258,7 @@ QUIT = "Abbandona"
MENU_TITLE = "MENÙ" MENU_TITLE = "MENÙ"
LEVEL = "Livello" LEVEL = "Livello"
STAFF_ROLL = "Staff dei titoli di coda" STAFF_ROLL = "Staff dei titoli di coda"
USE_STAGE_MUSIC = "Usa la musica del livello" MUSIC = "Musica"
RANDOM_STAGE = "Livello casuale" RANDOM_STAGE = "Livello casuale"
PLAY_VANILLA_DEMOS = "Riproduci le demo di gioco" PLAY_VANILLA_DEMOS = "Riproduci le demo di gioco"

View file

@ -260,7 +260,7 @@ QUIT = "Wyjdź"
MENU_TITLE = "MENU" MENU_TITLE = "MENU"
LEVEL = "Poziom" LEVEL = "Poziom"
STAFF_ROLL = "Napisy Końcowe" STAFF_ROLL = "Napisy Końcowe"
USE_STAGE_MUSIC = "Użyj Muzyki z Poziomu" MUSIC = "Muzyka"
RANDOM_STAGE = "Losowy Poziom" RANDOM_STAGE = "Losowy Poziom"
PLAY_VANILLA_DEMOS = "Odtwarzaj Domyślne Dema" PLAY_VANILLA_DEMOS = "Odtwarzaj Domyślne Dema"

View file

@ -260,7 +260,7 @@ QUIT = "Sair"
MENU_TITLE = "MENU" MENU_TITLE = "MENU"
LEVEL = "Nível" LEVEL = "Nível"
STAFF_ROLL = "Créditos finais" STAFF_ROLL = "Créditos finais"
USE_STAGE_MUSIC = "Usar música do nível" MUSIC = "Música"
RANDOM_STAGE = "Nível aleatório" RANDOM_STAGE = "Nível aleatório"
PLAY_VANILLA_DEMOS = "Tocar demos originais" PLAY_VANILLA_DEMOS = "Tocar demos originais"

View file

@ -259,7 +259,7 @@ QUIT = "Выход"
MENU_TITLE = "MENU" MENU_TITLE = "MENU"
LEVEL = "Уровень" LEVEL = "Уровень"
STAFF_ROLL = "Завершение" STAFF_ROLL = "Завершение"
USE_STAGE_MUSIC = "Использовать музыку уровня" MUSIC = "Музыка"
RANDOM_STAGE = "Случайный уровень" RANDOM_STAGE = "Случайный уровень"
PLAY_VANILLA_DEMOS = "Воспроизведение демо уровня" PLAY_VANILLA_DEMOS = "Воспроизведение демо уровня"

View file

@ -260,7 +260,7 @@ QUIT = "Salir"
MENU_TITLE = "MENÚ" MENU_TITLE = "MENÚ"
LEVEL = "Nivel" LEVEL = "Nivel"
STAFF_ROLL = "Créditos Finales" STAFF_ROLL = "Créditos Finales"
USE_STAGE_MUSIC = "Usar música del nivel" MUSIC = "Música"
RANDOM_STAGE = "Nivel aleatorio" RANDOM_STAGE = "Nivel aleatorio"
PLAY_VANILLA_DEMOS = "Demos originales" PLAY_VANILLA_DEMOS = "Demos originales"

View file

@ -41,6 +41,8 @@
#include "pc/configfile.h" #include "pc/configfile.h"
#include "pc/network/network.h" #include "pc/network/network.h"
#include "pc/djui/djui.h" #include "pc/djui/djui.h"
// used for getting gMainMenuSounds
#include "pc/djui/djui_panel_menu_options.h"
#include "pc/lua/smlua_hooks.h" #include "pc/lua/smlua_hooks.h"
#include "pc/mods/mods.h" #include "pc/mods/mods.h"
#include "pc/nametags.h" #include "pc/nametags.h"
@ -1491,16 +1493,20 @@ void update_menu_level(void) {
// figure out music // figure out music
stop_cap_music(); stop_cap_music();
if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { reset_volume();
reset_volume(); disable_background_sound();
disable_background_sound(); if (gMainMenuSounds[configMenuSound].sound == STAGE_MUSIC) {
set_background_music(0, SEQ_MENU_TITLE_SCREEN, 0); // if staff roll is on, set configMenuSound to Title Screen sequence, or 0
} else { if (configMenuStaffRoll) {
reset_volume(); configMenuSound = 0;
disable_background_sound(); }
if (gCurrentArea != NULL) { if (curLevel == LEVEL_CASTLE_GROUNDS) {
set_background_music(0, SEQ_MENU_FILE_SELECT, 0);
} else if (gCurrentArea != NULL) {
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
} }
} else {
set_background_music(0, gMainMenuSounds[configMenuSound].sound, 0);
} }
if (configMenuStaffRoll) { if (configMenuStaffRoll) {

View file

@ -167,7 +167,7 @@ bool configSkipIntro = 0;
bool configPauseAnywhere = false; bool configPauseAnywhere = false;
bool configMenuStaffRoll = false; bool configMenuStaffRoll = false;
unsigned int configMenuLevel = 0; unsigned int configMenuLevel = 0;
bool configMenuSound = false; unsigned int configMenuSound = 0;
bool configMenuRandom = false; bool configMenuRandom = false;
bool configMenuDemos = false; bool configMenuDemos = false;
bool configDisablePopups = false; bool configDisablePopups = false;
@ -297,7 +297,7 @@ static const struct ConfigOption options[] = {
{.name = "pause_anywhere", .type = CONFIG_TYPE_BOOL, .boolValue = &configPauseAnywhere}, {.name = "pause_anywhere", .type = CONFIG_TYPE_BOOL, .boolValue = &configPauseAnywhere},
{.name = "coop_menu_staff_roll", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuStaffRoll}, {.name = "coop_menu_staff_roll", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuStaffRoll},
{.name = "coop_menu_level", .type = CONFIG_TYPE_UINT, .uintValue = &configMenuLevel}, {.name = "coop_menu_level", .type = CONFIG_TYPE_UINT, .uintValue = &configMenuLevel},
{.name = "coop_menu_sound", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuSound}, {.name = "coop_menu_sound", .type = CONFIG_TYPE_UINT, .uintValue = &configMenuSound},
{.name = "coop_menu_random", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuRandom}, {.name = "coop_menu_random", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuRandom},
// {.name = "coop_menu_demos", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuDemos}, // {.name = "coop_menu_demos", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuDemos},
{.name = "disable_popups", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisablePopups}, {.name = "disable_popups", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisablePopups},

View file

@ -117,7 +117,7 @@ extern bool configSkipIntro;
extern bool configPauseAnywhere; extern bool configPauseAnywhere;
extern bool configMenuStaffRoll; extern bool configMenuStaffRoll;
extern unsigned int configMenuLevel; extern unsigned int configMenuLevel;
extern bool configMenuSound; extern unsigned int configMenuSound;
extern bool configMenuRandom; extern bool configMenuRandom;
extern bool configMenuDemos; extern bool configMenuDemos;
extern bool configDisablePopups; extern bool configDisablePopups;

View file

@ -6,21 +6,38 @@
#include "djui_panel_options.h" #include "djui_panel_options.h"
#include "djui_panel_misc.h" #include "djui_panel_misc.h"
#include "djui_panel_pause.h" #include "djui_panel_pause.h"
#include "djui_panel_menu_options.h"
#include "djui_hud_utils.h" #include "djui_hud_utils.h"
#include "pc/utils/misc.h" #include "pc/utils/misc.h"
#include "pc/configfile.h" #include "pc/configfile.h"
#include "game/level_update.h" #include "game/level_update.h"
#include "seq_ids.h"
static struct DjuiSelectionbox* sLevelBox = NULL; static struct DjuiSelectionbox* sLevelBox = NULL;
static struct DjuiCheckbox* sUseStageMusicCheckbox = NULL;
static struct DjuiCheckbox* sRandomStageCheckbox = NULL; static struct DjuiCheckbox* sRandomStageCheckbox = NULL;
// static struct DjuiCheckbox* sVanillaDemosCheckbox = NULL; // static struct DjuiCheckbox* sVanillaDemosCheckbox = NULL;
struct MainMenuSounds gMainMenuSounds[] = {
{ "Title Screen", SEQ_MENU_TITLE_SCREEN },
{ "File Select", SEQ_MENU_FILE_SELECT },
{ "Grass", SEQ_LEVEL_GRASS },
{ "Water", SEQ_LEVEL_WATER },
{ "Snow", SEQ_LEVEL_SNOW },
{ "Slide", SEQ_LEVEL_SLIDE },
{ "Bowser Stage", SEQ_LEVEL_KOOPA_ROAD },
{ "Bowser Fight", SEQ_LEVEL_BOSS_KOOPA },
{ "Spooky", SEQ_LEVEL_SPOOKY },
{ "Hot", SEQ_LEVEL_HOT },
{ "Underground", SEQ_LEVEL_UNDERGROUND },
{ "Bowser Finale", SEQ_LEVEL_BOSS_KOOPA_FINAL },
{ "Staff Roll", SEQ_EVENT_CUTSCENE_CREDITS },
{ "Stage Music", STAGE_MUSIC },
};
void djui_panel_main_menu_create(struct DjuiBase* caller); void djui_panel_main_menu_create(struct DjuiBase* caller);
static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) { static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) {
djui_base_set_enabled(&sLevelBox->base, !(configMenuRandom || configMenuStaffRoll)); djui_base_set_enabled(&sLevelBox->base, !(configMenuRandom || configMenuStaffRoll));
djui_base_set_enabled(&sUseStageMusicCheckbox->base, !configMenuStaffRoll);
djui_base_set_enabled(&sRandomStageCheckbox->base, !configMenuStaffRoll); djui_base_set_enabled(&sRandomStageCheckbox->base, !configMenuStaffRoll);
// djui_base_set_enabled(&sVanillaDemosCheckbox->base, !configMenuStaffRoll); // djui_base_set_enabled(&sVanillaDemosCheckbox->base, !configMenuStaffRoll);
if (configMenuStaffRoll) { if (configMenuStaffRoll) {
@ -29,6 +46,22 @@ static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) {
} }
} }
static void djui_panel_staff_roll(UNUSED struct DjuiBase* caller) {
// update level
djui_panel_level_menu(NULL);
// change menu sound
if (configMenuStaffRoll && gMainMenuSounds[configMenuSound].sound == STAGE_MUSIC) {
configMenuSound = 0;
}
// restart djui back to this menu
djui_panel_shutdown();
gDjuiInMainMenu = true;
djui_panel_main_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
djui_panel_main_menu_create(NULL);
}
static void djui_panel_menu_options_djui_setting_change(UNUSED struct DjuiBase* caller) { static void djui_panel_menu_options_djui_setting_change(UNUSED struct DjuiBase* caller) {
if (gDjuiInMainMenu) { if (gDjuiInMainMenu) {
djui_panel_shutdown(); djui_panel_shutdown();
@ -68,6 +101,7 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_FONT), djuiFontChoices, 2, &configDjuiThemeFont, djui_panel_menu_options_djui_setting_change); djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_FONT), djuiFontChoices, 2, &configDjuiThemeFont, djui_panel_menu_options_djui_setting_change);
if (gDjuiInMainMenu) { if (gDjuiInMainMenu) {
// get level choices
char* levelChoices[18] = { char* levelChoices[18] = {
"CG", "CG",
"BOB", "BOB",
@ -89,14 +123,24 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
"WDW" "WDW"
}; };
// copy sound choices from gMainMenuSounds
int numSounds = sizeof(gMainMenuSounds) / sizeof(gMainMenuSounds[0]);
// if stage roll is on, we shouldn't be allowed to use Stage Music, so remove the entry
if (configMenuStaffRoll) {
numSounds -= 1;
}
char* soundChoices[sizeof(gMainMenuSounds)];
// loop thru all sounds names, and add those to the soundChoices string array
for (int i = 0; i < numSounds; i++) {
soundChoices[i] = gMainMenuSounds[i].name;
}
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL); struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL);
djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll)); djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll));
sLevelBox = selectionbox1; sLevelBox = selectionbox1;
djui_selectionbox_create(body, DLANG(MENU_OPTIONS, MUSIC), soundChoices, numSounds, &configMenuSound, NULL);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_level_menu); djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_staff_roll);
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, USE_STAGE_MUSIC), &configMenuSound, NULL);
djui_base_set_enabled(&checkbox1->base, !configMenuStaffRoll);
sUseStageMusicCheckbox = checkbox1;
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu); struct DjuiCheckbox* checkbox2 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu);
djui_base_set_enabled(&checkbox2->base, !configMenuStaffRoll); djui_base_set_enabled(&checkbox2->base, !configMenuStaffRoll);
sRandomStageCheckbox = checkbox2; sRandomStageCheckbox = checkbox2;

View file

@ -1,4 +1,13 @@
#pragma once #pragma once
#include "djui.h" #include "djui.h"
#define STAGE_MUSIC 0
struct MainMenuSounds {
char* name;
int sound;
};
extern struct MainMenuSounds gMainMenuSounds[];
void djui_panel_main_menu_create(struct DjuiBase* caller); void djui_panel_main_menu_create(struct DjuiBase* caller);