From e6366b7865f62e96813a4c1a1ff2eda29df369c7 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Thu, 23 Nov 2023 10:02:21 -0500 Subject: [PATCH] Add Staff Roll menu background option --- lang/Czech.ini | 1 + lang/Dutch.ini | 1 + lang/English.ini | 1 + lang/French.ini | 1 + lang/German.ini | 1 + lang/Italian.ini | 1 + lang/Polish.ini | 1 + lang/Portuguese.ini | 1 + lang/Russian.ini | 1 + lang/SpanishES.ini | 1 + lang/SpanishUS.ini | 1 + src/game/area.c | 4 +- src/game/level_update.c | 72 +++++++++++++++------------ src/game/level_update.h | 1 + src/game/mario_actions_cutscene.c | 3 +- src/pc/configfile.c | 7 ++- src/pc/configfile.h | 2 +- src/pc/djui/djui_panel_menu_options.c | 13 +++-- src/pc/pc_main.c | 5 +- 19 files changed, 74 insertions(+), 44 deletions(-) diff --git a/lang/Czech.ini b/lang/Czech.ini index 7174d6ca..d8a7196b 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -235,6 +235,7 @@ QUIT = "Opustit hru" [MENU_OPTIONS] MAIN_MENU = "HLAVNI MENU" LEVEL = "Level" +STAFF_ROLL = "Závěrečné titulky" USE_STAGE_MUSIC = "Použít písničku z levelu" RANDOM_STAGE = "Náhodný level" PLAY_VANILLA_DEMOS = "Přehrát dema" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 2f70a446..2d9cb54e 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -235,6 +235,7 @@ QUIT = "Stop" [MENU_OPTIONS] MAIN_MENU = "Hoofdmenu" LEVEL = "Level" +STAFF_ROLL = "Personeelsoverzicht" USE_STAGE_MUSIC = "Gebruik level muziek" RANDOM_STAGE = "Willekeurig level" PLAY_VANILLA_DEMOS = "Speel normale demos af" diff --git a/lang/English.ini b/lang/English.ini index f1c9ec3d..5d1461af 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -235,6 +235,7 @@ QUIT = "Quit" [MENU_OPTIONS] MAIN_MENU = "MAIN MENU" LEVEL = "Level" +STAFF_ROLL = "Staff Roll" USE_STAGE_MUSIC = "Use Stage Music" RANDOM_STAGE = "Random Stage" PLAY_VANILLA_DEMOS = "Play Vanilla Demos" diff --git a/lang/French.ini b/lang/French.ini index f75d0f97..ac05d76b 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -236,6 +236,7 @@ QUIT = "Quitter" [MENU_OPTIONS] MAIN_MENU = "MENU" LEVEL = "Niveau" +STAFF_ROLL = "Générique de fin" USE_STAGE_MUSIC = "Utiliser la musique du niveau" RANDOM_STAGE = "Niveau aléatoire" PLAY_VANILLA_DEMOS = "Jouer les démos" diff --git a/lang/German.ini b/lang/German.ini index 0e0ec76c..c3066d83 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -235,6 +235,7 @@ QUIT = "Beenden" [MENU_OPTIONS] MAIN_MENU = "HAUPTMENÜ" LEVEL = "Level" +STAFF_ROLL = "Abspann" USE_STAGE_MUSIC = "Stufenmusik verwenden" RANDOM_STAGE = "Zufälliger Level" PLAY_VANILLA_DEMOS = "Original-Demos spielen" diff --git a/lang/Italian.ini b/lang/Italian.ini index 7b8c3268..c1463371 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -233,6 +233,7 @@ QUIT = "Abbandona" [MENU_OPTIONS] MAIN_MENU = "MENÙ PRINCIPALE" LEVEL = "Livello" +STAFF_ROLL = "Staff dei titoli di coda" USE_STAGE_MUSIC = "Usa la musica del livello" RANDOM_STAGE = "Livello casuale" PLAY_VANILLA_DEMOS = "Riproduci le demo di gioco" diff --git a/lang/Polish.ini b/lang/Polish.ini index e4b40a2a..7a24c891 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -235,6 +235,7 @@ QUIT = "Wyjdz" [MENU_OPTIONS] MAIN_MENU = "MENU GLOWNE" LEVEL = "Poziom" +STAFF_ROLL = "Napisy Końcowe" USE_STAGE_MUSIC = "Uzyj Muzyki Poziomu" RANDOM_STAGE = "Losowy Poziom" PLAY_VANILLA_DEMOS = "Odtworz Domyslne Dema" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index 1a439a12..1c87bbe4 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -235,6 +235,7 @@ QUIT = "Sair" [MENU_OPTIONS] MAIN_MENU = "MENU PRINCIPAL" LEVEL = "Nível" +STAFF_ROLL = "Créditos Finais" USE_STAGE_MUSIC = "Usar Música da Fase" RANDOM_STAGE = "Fase Aleatória" PLAY_VANILLA_DEMOS = "Tocar Demos do Vanilla" diff --git a/lang/Russian.ini b/lang/Russian.ini index 0d203031..85aa4bbd 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -234,6 +234,7 @@ QUIT = "Выход" [MENU_OPTIONS] MAIN_MENU = "MAIN MENU" LEVEL = "Уровень" +STAFF_ROLL = "Завершение" USE_STAGE_MUSIC = "Использовать музыку уровня" RANDOM_STAGE = "Случайный уровень" PLAY_VANILLA_DEMOS = "Воспроизведение демо уровня" diff --git a/lang/SpanishES.ini b/lang/SpanishES.ini index 970d4d28..d132ccb9 100644 --- a/lang/SpanishES.ini +++ b/lang/SpanishES.ini @@ -235,6 +235,7 @@ QUIT = "Salir" [MENU_OPTIONS] MAIN_MENU = "MENÚ PRINCIPAL" LEVEL = "Nivel" +STAFF_ROLL = "Créditos Finales" USE_STAGE_MUSIC = "Usar música del nivel" RANDOM_STAGE = "Nivel aleatorio" PLAY_VANILLA_DEMOS = "Demos originales" diff --git a/lang/SpanishUS.ini b/lang/SpanishUS.ini index afb434d7..7f6d8fa6 100644 --- a/lang/SpanishUS.ini +++ b/lang/SpanishUS.ini @@ -235,6 +235,7 @@ QUIT = "Salir" [MENU_OPTIONS] MAIN_MENU = "MENÚ PRINCIPAL" LEVEL = "Nivel" +STAFF_ROLL = "Créditos Finales" USE_STAGE_MUSIC = "Usar música del nivel" RANDOM_STAGE = "Nivel aleatorio" PLAY_VANILLA_DEMOS = "Demos originales" diff --git a/src/game/area.c b/src/game/area.c index 3f0a380d..6b7829da 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -459,7 +459,9 @@ void render_game(void) { gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); render_text_labels(); do_cutscene_handler(); - print_displaying_credits_entry(); + if (!gDjuiInMainMenu) { + print_displaying_credits_entry(); + } gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT - BORDER_HEIGHT); gPauseScreenMode = render_menus_and_dialogs(); diff --git a/src/game/level_update.c b/src/game/level_update.c index 8b843363..31e01b66 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -959,7 +959,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { case WARP_OP_CREDITS_NEXT: if (gCurrCreditsEntry == &sCreditsSequence[0]) { - sDelayedWarpTimer = 60; + sDelayedWarpTimer = gDjuiInMainMenu ? 1 : 60; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x3C, 0x00, 0x00, 0x00); } else { sDelayedWarpTimer = 20; @@ -1030,7 +1030,7 @@ void initiate_delayed_warp(void) { break; case WARP_OP_CREDITS_NEXT: - sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL); + sound_banks_disable(SEQ_PLAYER_SFX, gDjuiInMainMenu ? SOUND_BANKS_ALL & ~(1 << SOUND_BANK_MENU) : SOUND_BANKS_ALL); gCurrCreditsEntry += 1; @@ -1038,7 +1038,10 @@ void initiate_delayed_warp(void) { lvl_skip_credits(); } else if (gCurrCreditsEntry != NULL) { gCurrActNum = gCurrCreditsEntry->unk02 & 0x07; - if ((gCurrCreditsEntry + 1)->levelNum == LEVEL_NONE) { + if (gCurrCreditsEntry->levelNum == LEVEL_CASTLE_GROUNDS && gDjuiInMainMenu) { + gCurrCreditsEntry = &sCreditsSequence[1]; + destWarpNode = WARP_NODE_CREDITS_NEXT; + } else if ((gCurrCreditsEntry + 1)->levelNum == LEVEL_NONE) { destWarpNode = WARP_NODE_CREDITS_END; } else { destWarpNode = WARP_NODE_CREDITS_NEXT; @@ -1232,6 +1235,7 @@ s32 play_mode_normal(void) { } } else { if (gDjuiInMainMenu && + !configMenuStaffRoll && gCurrDemoInput == NULL && configMenuDemos && !gInPlayerMenu && @@ -1448,7 +1452,7 @@ UNUSED static s32 play_mode_unused(void) { void update_menu_level(void) { // figure out level - int curLevel = 0; + s32 curLevel = 0; switch (configMenuLevel) { case 0: curLevel = LEVEL_CASTLE_GROUNDS; break; case 1: curLevel = LEVEL_BOB; break; @@ -1471,25 +1475,41 @@ void update_menu_level(void) { default: curLevel = LEVEL_CASTLE_GROUNDS; break; } - // warp to level, this feels buggy + // figure out music + stop_cap_music(); + if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { + reset_volume(); + disable_background_sound(); + set_background_music(0, SEQ_MENU_FILE_SELECT, 0); + } else { + reset_volume(); + disable_background_sound(); + set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); + } + + if (configMenuStaffRoll) { + return; + } else { + gCurrCreditsEntry = NULL; + } + + // warp to level if (gCurrLevelNum != curLevel) { if (gIsDemoActive) { stop_demo(NULL); } - gChangeLevel = curLevel; - gChangeActNum = 6; + dynos_warp_to_level(curLevel, 1, 6); gDemoCountdown = 0; } - if (gIsDemoActive) { - return; - } + if (gIsDemoActive) { return; } if (gCurrAreaIndex != 2 && gCurrLevelNum == LEVEL_THI) { sWarpDest.type = WARP_TYPE_CHANGE_AREA; sWarpDest.areaIdx = 2; sWarpDest.nodeId = 0x0A; } + struct Object *o; // set mario/camera pos switch (gCurrLevelNum) { @@ -1613,22 +1633,6 @@ void update_menu_level(void) { gMarioState->controller->stickY = 0; gMarioState->controller->stickMag = 0; gMarioState->intendedMag = 0; - - // figure out music - stop_cap_music(); - if (!configMenuSound || curLevel == LEVEL_CASTLE_GROUNDS) { - reset_volume(); - disable_background_sound(); - set_background_music(0, 0x0021, 0); - } else { - reset_volume(); - disable_background_sound(); - - if (get_current_background_music() == SEQ_MENU_FILE_SELECT) { - gChangeLevel = curLevel; - gChangeActNum = 6; - } - } } s32 update_level(void) { @@ -1747,7 +1751,7 @@ s32 init_level(void) { } else if (!gDebugLevelSelect) { if (gMarioState && gMarioState->action != ACT_UNINITIALIZED) { bool skipIntro = (gNetworkType == NT_NONE || gServerSettings.skipIntro != 0); - if (gDjuiInMainMenu && (gNetworkType == NT_NONE)) { + if (gDjuiInMainMenu && gNetworkType == NT_NONE) { // pick random main menu level if (configMenuRandom) { srand(time(0)); @@ -1755,13 +1759,19 @@ s32 init_level(void) { configMenuLevel = randLevel; } - if (configMenuLevel == 0 && sFirstCastleGroundsMenu) { - set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 7); + if (configMenuStaffRoll) { + gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; + warp_credits(); + level_trigger_warp(gMarioState, WARP_OP_CREDITS_NEXT); sFirstCastleGroundsMenu = false; } else { - set_mario_action(gMarioState, ACT_IDLE, 0); + if (configMenuLevel == 0 && sFirstCastleGroundsMenu) { + set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 7); + sFirstCastleGroundsMenu = false; + } else { + set_mario_action(gMarioState, ACT_IDLE, 0); + } } - } else if (skipIntro || save_file_exists(gCurrSaveFileNum - 1)) { set_mario_action(gMarioState, ACT_IDLE, 0); } else { diff --git a/src/game/level_update.h b/src/game/level_update.h index 514af0e1..90c3c3ff 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -166,6 +166,7 @@ u8 level_control_timer_running(void); u16 level_control_timer(s32 timerOp); void fade_into_special_warp(u32 arg, u32 color); void load_level_init_text(u32 arg); +void warp_credits(void); struct WarpNode *get_painting_warp_node(void); void initiate_painting_warp(s16 paintingIndex); s16 level_trigger_warp(struct MarioState *m, s32 warpOp); diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 38555e3d..09dde122 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -2969,7 +2969,7 @@ static s32 act_credits_cutscene(struct MarioState *m) { m->actionState += 2; } - if (gCurrCreditsEntry != NULL) { + if (gCurrCreditsEntry != NULL && !gDjuiInMainMenu) { if (m->playerIndex == 0) { s32 width = m->actionState * 640 / 100; s32 height = m->actionState * 480 / 100; @@ -2999,6 +2999,7 @@ static s32 act_credits_cutscene(struct MarioState *m) { m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->unk02 & 0xC0) << 8; } + return FALSE; } diff --git a/src/pc/configfile.c b/src/pc/configfile.c index a1fbd4b4..b3249ff8 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -130,6 +130,7 @@ unsigned int configBouncyLevelBounds = 0; unsigned int configNetworkSystem = 0; char configPlayerName[MAX_PLAYER_STRING] = ""; unsigned int configPlayerModel = 0; +bool configMenuStaffRoll = true; unsigned int configMenuLevel = 0; bool configMenuSound = false; bool configMenuRandom = false; @@ -144,7 +145,6 @@ bool configDisablePopups = 0; bool configLuaProfiler = 0; bool configCtxProfiler = 0; #endif -bool configDisableDownloadedModels = 0; unsigned int configInterpolationMode = 1; unsigned int configGamepadNumber = 0; bool configBackgroundGamepad = 1; @@ -234,6 +234,7 @@ static const struct ConfigOption options[] = { {.name = "coopdx_bouncy_bounds", .type = CONFIG_TYPE_UINT , .uintValue = &configBouncyLevelBounds}, {.name = "coop_player_model", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerModel}, {.name = "coop_player_name", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configPlayerName, .maxStringLength = MAX_PLAYER_STRING}, + {.name = "coopdx_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_random", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuRandom}, @@ -260,7 +261,6 @@ static const struct ConfigOption options[] = { {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler}, {.name = "ctx_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configCtxProfiler}, #endif - {.name = "disable_downloaded_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableDownloadedModels}, {.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode}, {.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber}, {.name = "background_gamepad", .type = CONFIG_TYPE_UINT , .boolValue = &configBackgroundGamepad}, @@ -597,6 +597,9 @@ NEXT_OPTION: if (configFrameLimit < 30) { configFrameLimit = 30; } if (configFrameLimit > 3000) { configFrameLimit = 3000; } + if (configPlayerModel >= CT_MAX) { configPlayerModel = 0; } + if (configDjuiTheme >= DJUI_THEME_MAX) { configDjuiTheme = 0; } + #ifndef COOPNET configNetworkSystem = NS_SOCKET; #endif diff --git a/src/pc/configfile.h b/src/pc/configfile.h index e4adfd08..acf7154e 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -89,6 +89,7 @@ extern unsigned int configBouncyLevelBounds; extern unsigned int configNetworkSystem; extern char configPlayerName[]; extern unsigned int configPlayerModel; +extern bool configMenuStaffRoll; extern unsigned int configMenuLevel; extern bool configMenuSound; extern bool configMenuRandom; @@ -103,7 +104,6 @@ extern bool configDisablePopups; extern bool configLuaProfiler; extern bool configCtxProfiler; #endif -extern bool configDisableDownloadedModels; extern unsigned int configInterpolationMode; extern bool configSingleplayerPause; extern bool configDebugPrint; diff --git a/src/pc/djui/djui_panel_menu_options.c b/src/pc/djui/djui_panel_menu_options.c index 5ba39669..eb4c904d 100644 --- a/src/pc/djui/djui_panel_menu_options.c +++ b/src/pc/djui/djui_panel_menu_options.c @@ -7,8 +7,12 @@ static struct DjuiSelectionbox* sLevelBox = NULL; -static void djui_panel_random_menu(UNUSED struct DjuiBase* caller) { - djui_base_set_enabled(&sLevelBox->base, !configMenuRandom); +static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) { + djui_base_set_enabled(&sLevelBox->base, !(configMenuRandom || configMenuStaffRoll)); + if (configMenuStaffRoll) { + warp_credits(); + level_trigger_warp(gMarioState, WARP_OP_CREDITS_NEXT); + } } void djui_panel_main_menu_create(struct DjuiBase* caller) { @@ -37,11 +41,12 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) { "WDW" }; struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL); - djui_base_set_enabled(&selectionbox1->base, !configMenuRandom); + djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll)); sLevelBox = selectionbox1; + djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_level_menu); djui_checkbox_create(body, DLANG(MENU_OPTIONS, USE_STAGE_MUSIC), &configMenuSound, NULL); - djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_random_menu); + djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu); djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo); diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index ce67cfd0..5e7eaf45 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -193,7 +193,7 @@ void produce_interpolation_frames_and_delay(void) { u64 sCurrentFpsUpdateTime = (u64)clock_elapsed_f64(); if (sLastFpsUpdateTime != sCurrentFpsUpdateTime) { - // u32 fps = sFramesSinceFpsUpdate / ((f32)(sCurrentFpsUpdateTime - sLastFpsUpdateTime)); + u32 fps = sFramesSinceFpsUpdate / ((f32)(sCurrentFpsUpdateTime - sLastFpsUpdateTime)); sLastFpsUpdateTime = sCurrentFpsUpdateTime; sFramesSinceFpsUpdate = 0; // printf("fps: %u\n", fps); @@ -296,9 +296,6 @@ void* main_game_init(UNUSED void* arg) { } else if (memcmp(&configPlayerPalette, &gPalettePresets[i], sizeof(struct PlayerPalette)) == 0) { break; } } - if (configPlayerModel >= CT_MAX) { configPlayerModel = 0; } - if (configDjuiTheme >= DJUI_THEME_MAX) { configDjuiTheme = 0; } - gCoopCompatibility = configCoopCompatibility; if (gCLIOpts.FullScreen == 1) { configWindow.fullscreen = true; }