mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									db3a7e3483
								
							
						
					
					
						commit
						af8dc6995d
					
				
					 15 changed files with 87 additions and 28 deletions
				
			
		|  | @ -260,7 +260,7 @@ QUIT = "Opustit hru" | |||
| MENU_TITLE = "MENU" | ||||
| LEVEL = "Level" | ||||
| 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" | ||||
| PLAY_VANILLA_DEMOS = "Přehrát dema" | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ QUIT = "Stop" | |||
| MENU_TITLE = "MENU" | ||||
| LEVEL = "Level" | ||||
| STAFF_ROLL = "Personeelsoverzicht" | ||||
| USE_STAGE_MUSIC = "Gebruik level muziek" | ||||
| MUSIC = "Muziek" | ||||
| RANDOM_STAGE = "Willekeurig level" | ||||
| PLAY_VANILLA_DEMOS = "Speel normale demos af" | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ QUIT = "Quit" | |||
| MENU_TITLE = "MENU" | ||||
| LEVEL = "Level" | ||||
| STAFF_ROLL = "Staff Roll" | ||||
| USE_STAGE_MUSIC = "Use Stage Music" | ||||
| MUSIC = "Music" | ||||
| RANDOM_STAGE = "Random Stage" | ||||
| PLAY_VANILLA_DEMOS = "Play Vanilla Demos" | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ QUIT = "Quitter" | |||
| MENU_TITLE = "MENU" | ||||
| LEVEL = "Niveau" | ||||
| STAFF_ROLL = "Générique de fin" | ||||
| USE_STAGE_MUSIC = "Utiliser la musique du niveau" | ||||
| MUSIC = "Musique" | ||||
| RANDOM_STAGE = "Niveau aléatoire" | ||||
| PLAY_VANILLA_DEMOS = "Jouer les démos" | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ QUIT = "Beenden" | |||
| MENU_TITLE = "MENÜ" | ||||
| LEVEL = "Level" | ||||
| STAFF_ROLL = "Abspann" | ||||
| USE_STAGE_MUSIC = "Stufenmusik verwenden" | ||||
| MUSIC = "Musik" | ||||
| RANDOM_STAGE = "Zufälliger Level" | ||||
| PLAY_VANILLA_DEMOS = "Original-Demos spielen" | ||||
| 
 | ||||
|  |  | |||
|  | @ -258,7 +258,7 @@ QUIT = "Abbandona" | |||
| MENU_TITLE = "MENÙ" | ||||
| LEVEL = "Livello" | ||||
| STAFF_ROLL = "Staff dei titoli di coda" | ||||
| USE_STAGE_MUSIC = "Usa la musica del livello" | ||||
| MUSIC = "Musica" | ||||
| RANDOM_STAGE = "Livello casuale" | ||||
| PLAY_VANILLA_DEMOS = "Riproduci le demo di gioco" | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ QUIT = "Wyjdź" | |||
| MENU_TITLE = "MENU" | ||||
| LEVEL = "Poziom" | ||||
| STAFF_ROLL = "Napisy Końcowe" | ||||
| USE_STAGE_MUSIC = "Użyj Muzyki z Poziomu" | ||||
| MUSIC = "Muzyka" | ||||
| RANDOM_STAGE = "Losowy Poziom" | ||||
| PLAY_VANILLA_DEMOS = "Odtwarzaj Domyślne Dema" | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ QUIT = "Sair" | |||
| MENU_TITLE = "MENU" | ||||
| LEVEL = "Nível" | ||||
| STAFF_ROLL = "Créditos finais" | ||||
| USE_STAGE_MUSIC = "Usar música do nível" | ||||
| MUSIC = "Música" | ||||
| RANDOM_STAGE = "Nível aleatório" | ||||
| PLAY_VANILLA_DEMOS = "Tocar demos originais" | ||||
| 
 | ||||
|  |  | |||
|  | @ -259,7 +259,7 @@ QUIT = "Выход" | |||
| MENU_TITLE = "MENU" | ||||
| LEVEL = "Уровень" | ||||
| STAFF_ROLL = "Завершение" | ||||
| USE_STAGE_MUSIC = "Использовать музыку уровня" | ||||
| MUSIC = "Музыка" | ||||
| RANDOM_STAGE = "Случайный уровень" | ||||
| PLAY_VANILLA_DEMOS = "Воспроизведение демо уровня" | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ QUIT = "Salir" | |||
| MENU_TITLE = "MENÚ" | ||||
| LEVEL = "Nivel" | ||||
| STAFF_ROLL = "Créditos Finales" | ||||
| USE_STAGE_MUSIC = "Usar música del nivel" | ||||
| MUSIC = "Música" | ||||
| RANDOM_STAGE = "Nivel aleatorio" | ||||
| PLAY_VANILLA_DEMOS = "Demos originales" | ||||
| 
 | ||||
|  |  | |||
|  | @ -41,6 +41,8 @@ | |||
| #include "pc/configfile.h" | ||||
| #include "pc/network/network.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/mods/mods.h" | ||||
| #include "pc/nametags.h" | ||||
|  | @ -1491,16 +1493,20 @@ void update_menu_level(void) { | |||
| 
 | ||||
|     // figure out music
 | ||||
|     stop_cap_music(); | ||||
|     if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { | ||||
|         reset_volume(); | ||||
|         disable_background_sound(); | ||||
|         set_background_music(0, SEQ_MENU_TITLE_SCREEN, 0); | ||||
|     } else { | ||||
|         reset_volume(); | ||||
|         disable_background_sound(); | ||||
|         if (gCurrentArea != NULL) { | ||||
|     reset_volume(); | ||||
|     disable_background_sound(); | ||||
|     if (gMainMenuSounds[configMenuSound].sound == STAGE_MUSIC) { | ||||
|         // if staff roll is on, set configMenuSound to Title Screen sequence, or 0
 | ||||
|         if (configMenuStaffRoll) { | ||||
|             configMenuSound = 0; | ||||
|         } | ||||
|         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); | ||||
|         } | ||||
|     } else { | ||||
|         set_background_music(0, gMainMenuSounds[configMenuSound].sound, 0); | ||||
|     } | ||||
| 
 | ||||
|     if (configMenuStaffRoll) { | ||||
|  |  | |||
|  | @ -167,7 +167,7 @@ bool         configSkipIntro                      = 0; | |||
| bool         configPauseAnywhere                  = false; | ||||
| bool         configMenuStaffRoll                  = false; | ||||
| unsigned int configMenuLevel                      = 0; | ||||
| bool         configMenuSound                      = false; | ||||
| unsigned int configMenuSound                      = 0; | ||||
| bool         configMenuRandom                     = false; | ||||
| bool         configMenuDemos                      = false; | ||||
| bool         configDisablePopups                  = false; | ||||
|  | @ -297,7 +297,7 @@ static const struct ConfigOption options[] = { | |||
|     {.name = "pause_anywhere",                 .type = CONFIG_TYPE_BOOL,   .boolValue   = &configPauseAnywhere}, | ||||
|     {.name = "coop_menu_staff_roll",           .type = CONFIG_TYPE_BOOL,   .boolValue   = &configMenuStaffRoll}, | ||||
|     {.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_demos",                .type = CONFIG_TYPE_BOOL,   .boolValue   = &configMenuDemos},
 | ||||
|     {.name = "disable_popups",                 .type = CONFIG_TYPE_BOOL,   .boolValue   = &configDisablePopups}, | ||||
|  |  | |||
|  | @ -117,7 +117,7 @@ extern bool         configSkipIntro; | |||
| extern bool         configPauseAnywhere; | ||||
| extern bool         configMenuStaffRoll; | ||||
| extern unsigned int configMenuLevel; | ||||
| extern bool         configMenuSound; | ||||
| extern unsigned int configMenuSound; | ||||
| extern bool         configMenuRandom; | ||||
| extern bool         configMenuDemos; | ||||
| extern bool         configDisablePopups; | ||||
|  |  | |||
|  | @ -6,21 +6,38 @@ | |||
| #include "djui_panel_options.h" | ||||
| #include "djui_panel_misc.h" | ||||
| #include "djui_panel_pause.h" | ||||
| #include "djui_panel_menu_options.h" | ||||
| #include "djui_hud_utils.h" | ||||
| #include "pc/utils/misc.h" | ||||
| #include "pc/configfile.h" | ||||
| #include "game/level_update.h" | ||||
| #include "seq_ids.h" | ||||
| 
 | ||||
| static struct DjuiSelectionbox* sLevelBox = NULL; | ||||
| static struct DjuiCheckbox* sUseStageMusicCheckbox = NULL; | ||||
| static struct DjuiCheckbox* sRandomStageCheckbox = 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); | ||||
| 
 | ||||
| static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) { | ||||
|     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(&sVanillaDemosCheckbox->base, !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) { | ||||
|     if (gDjuiInMainMenu) { | ||||
|         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); | ||||
| 
 | ||||
|         if (gDjuiInMainMenu) { | ||||
|             // get level choices
 | ||||
|             char* levelChoices[18] = { | ||||
|                 "CG", | ||||
|                 "BOB", | ||||
|  | @ -89,14 +123,24 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) { | |||
|                 "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); | ||||
|             djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll)); | ||||
|             sLevelBox = selectionbox1; | ||||
| 
 | ||||
|             djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_level_menu); | ||||
|             struct DjuiCheckbox* checkbox1 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, USE_STAGE_MUSIC), &configMenuSound, NULL); | ||||
|             djui_base_set_enabled(&checkbox1->base, !configMenuStaffRoll); | ||||
|             sUseStageMusicCheckbox = checkbox1; | ||||
|             djui_selectionbox_create(body, DLANG(MENU_OPTIONS, MUSIC), soundChoices, numSounds, &configMenuSound, NULL); | ||||
|             djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_staff_roll); | ||||
|             struct DjuiCheckbox* checkbox2 = djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu); | ||||
|             djui_base_set_enabled(&checkbox2->base, !configMenuStaffRoll); | ||||
|             sRandomStageCheckbox = checkbox2; | ||||
|  |  | |||
|  | @ -1,4 +1,13 @@ | |||
| #pragma once | ||||
| #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); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 EmeraldLockdown
						EmeraldLockdown