Archived
1
0
Disbranĉigi 0

Add selectionSound to eMenus

This commit is contained in:
Jaidyn Ann 2020-05-31 02:31:32 -05:00
parent b6ff39914f
commit 889194c9ca
4 changed files with 18 additions and 3 deletions

BIN
data/sound/eeuh.ogg Normal file

Binary file not shown.

View File

@ -143,7 +143,7 @@ calc_menu ( struct eMenu* menu, int sp_select_button )
{ {
spSleep(50000); spSleep(50000);
if ( spGetInput()->button[sp_select_button] ) if ( spGetInput()->button[sp_select_button] )
return menu->selection + 1; return menu_select( menu );
else if ( spGetInput()->button[SP_BUTTON_DOWN] ) else if ( spGetInput()->button[SP_BUTTON_DOWN] )
menu_select_down( menu ); menu_select_down( menu );
else if ( spGetInput()->button[SP_BUTTON_UP] ) else if ( spGetInput()->button[SP_BUTTON_UP] )
@ -154,6 +154,15 @@ calc_menu ( struct eMenu* menu, int sp_select_button )
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// returns selected menu item, and plays proper sound
int
menu_select ( struct eMenu* menu )
{
if ( menu->moveSound != NULL )
spSoundPlay( menu->selectSound, menu->soundChannel,0,0,-1 );
return menu->selection + 1;
}
// move an eMenu's selected element up by one (if possible) // move an eMenu's selected element up by one (if possible)
void void
menu_select_up ( struct eMenu* menu ) menu_select_up ( struct eMenu* menu )

View File

@ -51,6 +51,7 @@ int calc_menu ( struct eMenu*, int );
void resize_menu ( struct eMenu* ); void resize_menu ( struct eMenu* );
int menu_select ( struct eMenu* );
void menu_select_up ( struct eMenu* ); void menu_select_up ( struct eMenu* );
void menu_select_down ( struct eMenu* ); void menu_select_down ( struct eMenu* );

View File

@ -65,6 +65,9 @@ calc_test ( Uint32 steps )
else else
return 0; return 0;
if ( menucode > 0 )
spSleep(700000);
// sleep long enough after selection to play selection sound lol
return menucode; return menucode;
} }
@ -98,6 +101,7 @@ init_test_menu ( struct eMenu* menu )
menu->titleCentered = 0; menu->titleCentered = 0;
menu->textCentered = 0; menu->textCentered = 0;
menu->moveSound = sounds[0]; menu->moveSound = sounds[0];
menu->selectSound = sounds[1];
add_menu_element(menu, "give up"); add_menu_element(menu, "give up");
add_menu_element(menu, "run away"); add_menu_element(menu, "run away");
add_menu_element(menu, "eat a baby"); add_menu_element(menu, "eat a baby");
@ -128,6 +132,7 @@ init_sounds ( void )
{ {
spSoundInit(); spSoundInit();
add_sound("data/sound/tamborine.ogg"); add_sound("data/sound/tamborine.ogg");
add_sound("data/sound/eeuh.ogg");
} }