diff --git a/src/game/options_menu.c b/src/game/options_menu.c index 56dba619e3..acb6b74e2e 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -1,7 +1,7 @@ #ifdef EXT_OPTIONS_MENU #include "sm64.h" -#include "include/text_strings.h" +#include "text_strings.h" #include "engine/math_util.h" #include "audio/external.h" #include "game/camera.h" @@ -45,10 +45,14 @@ static const u8 toggleStr[][16] = { { TEXT_OPT_ENABLED }, }; -static const u8 menuStr[][32] = { - { TEXT_OPT_HIGHLIGHT }, +static const u8 optSmallStr[][32] = { { TEXT_OPT_BUTTON1 }, { TEXT_OPT_BUTTON2 }, + { TEXT_OPT_L_HIGHLIGHT }, + { TEXT_OPT_R_HIGHLIGHT }, +}; + +static const u8 menuStr[][32] = { { TEXT_OPT_OPTIONS }, { TEXT_OPT_CAMERA }, { TEXT_OPT_CONTROLS }, @@ -56,7 +60,6 @@ static const u8 menuStr[][32] = { { TEXT_OPT_AUDIO }, { TEXT_EXIT_GAME }, { TEXT_OPT_CHEATS }, - }; static const u8 optsCameraStr[][32] = { @@ -122,7 +125,7 @@ static const u8 bindStr[][32] = { { TEXT_BIND_LEFT }, { TEXT_BIND_RIGHT }, { TEXT_OPT_DEADZONE }, - { TEXT_OPT_RUMBLE } + { TEXT_OPT_RUMBLE }, }; static const u8 *filterChoices[] = { @@ -285,33 +288,34 @@ static struct Option optsCheats[] = { /* submenu definitions */ #ifdef BETTERCAMERA -static struct SubMenu menuCamera = DEF_SUBMENU( menuStr[4], optsCamera ); +static struct SubMenu menuCamera = DEF_SUBMENU( menuStr[1], optsCamera ); #endif -static struct SubMenu menuControls = DEF_SUBMENU( menuStr[5], optsControls ); -static struct SubMenu menuVideo = DEF_SUBMENU( menuStr[6], optsVideo ); -static struct SubMenu menuAudio = DEF_SUBMENU( menuStr[7], optsAudio ); -static struct SubMenu menuCheats = DEF_SUBMENU( menuStr[9], optsCheats ); +static struct SubMenu menuControls = DEF_SUBMENU( menuStr[2], optsControls ); +static struct SubMenu menuVideo = DEF_SUBMENU( menuStr[3], optsVideo ); +static struct SubMenu menuAudio = DEF_SUBMENU( menuStr[4], optsAudio ); +static struct SubMenu menuCheats = DEF_SUBMENU( menuStr[6], optsCheats ); /* main options menu definition */ static struct Option optsMain[] = { #ifdef BETTERCAMERA - DEF_OPT_SUBMENU( menuStr[4], &menuCamera ), + DEF_OPT_SUBMENU( menuStr[1], &menuCamera ), #endif - DEF_OPT_SUBMENU( menuStr[5], &menuControls ), - DEF_OPT_SUBMENU( menuStr[6], &menuVideo ), - DEF_OPT_SUBMENU( menuStr[7], &menuAudio ), - DEF_OPT_BUTTON ( menuStr[8], optmenu_act_exit ), + DEF_OPT_SUBMENU( menuStr[2], &menuControls ), + DEF_OPT_SUBMENU( menuStr[3], &menuVideo ), + DEF_OPT_SUBMENU( menuStr[4], &menuAudio ), + DEF_OPT_BUTTON ( menuStr[5], optmenu_act_exit ), // NOTE: always keep cheats the last option here because of the half-assed way I toggle them - DEF_OPT_SUBMENU( menuStr[9], &menuCheats ) + DEF_OPT_SUBMENU( menuStr[6], &menuCheats ) }; -static struct SubMenu menuMain = DEF_SUBMENU( menuStr[3], optsMain ); +static struct SubMenu menuMain = DEF_SUBMENU( menuStr[0], optsMain ); /* implementation */ static s32 optmenu_option_timer = 0; static u8 optmenu_hold_count = 0; +static s32 optmenu_sin_timer = 0; static struct SubMenu *currentMenu = &menuMain; @@ -450,6 +454,7 @@ static inline s16 get_hudstr_centered_x(const s16 sx, const u8 *str) { void optmenu_draw(void) { s16 scroll; s16 scrollpos; + f32 sinpos; const s16 labelX = get_hudstr_centered_x(160, currentMenu->label); gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin); @@ -465,6 +470,7 @@ void optmenu_draw(void) { gSPDisplayList(gDisplayListHead++, dl_ia_text_begin); gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 80, SCREEN_WIDTH, SCREEN_HEIGHT); + for (u8 i = 0; i < currentMenu->numOpts; i++) { scroll = 140 - 32 * i + currentMenu->scroll * 32; // FIXME: just start from the first visible option bruh @@ -472,19 +478,18 @@ void optmenu_draw(void) { optmenu_draw_opt(¤tMenu->opts[i], 160, scroll, (currentMenu->select == i)); } + sinpos = sins(optmenu_sin_timer*5000)*4; gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - gSPDisplayList(gDisplayListHead++, dl_ia_text_end); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); - gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin); - print_hud_lut_string(HUD_LUT_GLOBAL, 80, 90 + (32 * (currentMenu->select - currentMenu->scroll)), menuStr[0]); - print_hud_lut_string(HUD_LUT_GLOBAL, 224, 90 + (32 * (currentMenu->select - currentMenu->scroll)), menuStr[0]); - gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end); + print_generic_string(80 - sinpos, 132 - (32 * (currentMenu->select - currentMenu->scroll)), optSmallStr[2]); + print_generic_string(224 + sinpos, 132 - (32 * (currentMenu->select - currentMenu->scroll)), optSmallStr[3]); + gSPDisplayList(gDisplayListHead++, dl_ia_text_end); } //This has been separated for interesting reasons. Don't question it. void optmenu_draw_prompt(void) { gSPDisplayList(gDisplayListHead++, dl_ia_text_begin); - optmenu_draw_text(264, 212, menuStr[1 + optmenu_open], 0); + optmenu_draw_text(264, 212, optSmallStr[optmenu_open], 0); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); } @@ -506,7 +511,6 @@ void optmenu_toggle(void) { currentMenu = &menuMain; optmenu_open = 1; - /* Resets l_counter to 0 every time the options menu is open */ l_counter = 0; } else { @@ -539,6 +543,8 @@ void optmenu_check_buttons(void) { if (gPlayer1Controller->buttonPressed & R_TRIG) optmenu_toggle(); + optmenu_sin_timer++; + /* Enables cheats if the user press the L trigger 3 times while in the options menu. Also plays a sound. */ if ((gPlayer1Controller->buttonPressed & L_TRIG) && !Cheats.EnableCheats) { @@ -566,13 +572,13 @@ void optmenu_check_buttons(void) { allowInput = 1; } - if (ABS(gPlayer1Controller->stickY) > 60) { + if ((ABS(gPlayer1Controller->stickY) > 60) || (gPlayer1Controller->buttonPressed & (D_CBUTTONS|U_CBUTTONS))) { if (allowInput) { #ifndef nosound play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs); #endif - if (gPlayer1Controller->stickY >= 60) { + if ((gPlayer1Controller->stickY >= 60) || (gPlayer1Controller->buttonPressed & U_CBUTTONS)) { currentMenu->select--; if (currentMenu->select < 0) currentMenu->select = currentMenu->numOpts-1; @@ -587,12 +593,12 @@ void optmenu_check_buttons(void) { else if (currentMenu->select > currentMenu->scroll + 3) currentMenu->scroll = currentMenu->select - 3; } - } else if (ABS(gPlayer1Controller->stickX) > 60) { + } else if ((ABS(gPlayer1Controller->stickX) > 60) || (gPlayer1Controller->buttonPressed & (L_CBUTTONS|R_CBUTTONS))) { if (allowInput) { #ifndef nosound play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs); #endif - if (gPlayer1Controller->stickX >= 60) + if ((gPlayer1Controller->stickX >= 60) || (gPlayer1Controller->buttonPressed & R_CBUTTONS)) optmenu_opt_change(¤tMenu->opts[currentMenu->select], 1); else optmenu_opt_change(¤tMenu->opts[currentMenu->select], -1);