...goto...Peter, how could you...argh\!

This commit is contained in:
Christian Kroll 2009-07-18 15:32:36 +00:00
parent 42da4894c8
commit b832adc6ce
1 changed files with 64 additions and 63 deletions

View File

@ -36,20 +36,20 @@ extern game_descriptor_t _game_descriptors_end__[];
#define MENU_PREVITEM(item) ((item + MENU_ITEM_MAX - 1) % MENU_ITEM_MAX) #define MENU_PREVITEM(item) ((item + MENU_ITEM_MAX - 1) % MENU_ITEM_MAX)
void menu() void menu()
{
if (MENU_ITEM_MAX != 0)
{ {
// don't let WAIT() query fire button to prevent endless circular jumps // don't let WAIT() query fire button to prevent endless circular jumps
waitForFire = 0; waitForFire = 0;
clear_screen(0); clear_screen(0);
// wait as long the fire button is pressed to prevent unwanted selections // wait as long as "fire" is pressed to prevent unwanted selections
while (JOYISFIRE) while (JOYISFIRE)
{ {
wait(MENU_POLL_INTERVAL); wait(MENU_POLL_INTERVAL);
} }
if(MENU_ITEM_MAX == 0) goto end;
// set initial menu item // set initial menu item
static uint8_t miSelection = 0; static uint8_t miSelection = 0;
// scroll in currently selected menu item // scroll in currently selected menu item
@ -104,8 +104,8 @@ void menu()
} }
} }
end:
waitForFire = 1; waitForFire = 1;
}
return; return;
} }
@ -116,7 +116,8 @@ uint8_t menu_getIconPixel(uint8_t item, int8_t x, int8_t y)
if (x < MENU_WIDTH_ICON) if (x < MENU_WIDTH_ICON)
{ {
// return pixel // return pixel
return (0x80 >> x) & pgm_read_word(&_game_descriptors_start__[item].icon[y]); return (0x80 >> x) &
pgm_read_word(&_game_descriptors_start__[item].icon[y]);
} }
else else
{ {