static void handle_input() { bool button_pressed = false; #ifdef CONFIG_USE_TAPS // tap controls { int cx = (Graphics::SCREEN_WIDTH / 2) - (sprites[SPR_MENU].w / 2) - 8; int cy = (Graphics::SCREEN_HEIGHT / 2) - 8; for(int i=0;i<sprites[SPR_MENU].nframes;i++) { RectI r = Sprites::get_sprite_rect(cx, cy, SPR_MENU, i); if (VJoy::ModeAware::wasTap(r)) { if (title.cursel == i) { button_pressed = true; } else { sound(SND_MENU_MOVE); title.cursel = i; } break; } cy += (sprites[SPR_MENU].h + 18); } } #endif // pad control { if (justpushed(DOWNKEY)) { sound(SND_MENU_MOVE); if (++title.cursel >= sprites[SPR_MENU].nframes) title.cursel = 0; } else if (justpushed(UPKEY)) { sound(SND_MENU_MOVE); if (--title.cursel < 0) title.cursel = sprites[SPR_MENU].nframes - 1; } button_pressed = button_pressed || buttonjustpushed(); } if (button_pressed) { sound(SND_MENU_SELECT); int choice = title.cursel; // handle case where user selects Load but there is no savefile, // or the last_save_file is deleted. if (title.cursel == 1) { if (!ProfileExists(settings->last_save_slot)) { bool foundslot = false; for(int i=0;i<MAX_SAVE_SLOTS;i++) { if (ProfileExists(i)) { stat("Last save file %d missing. Defaulting to %d instead.", settings->last_save_slot, i); settings->last_save_slot = i; foundslot = true; } } // there are no save files. Start a new game instead. if (!foundslot) { stat("No save files found. Starting new game instead."); choice = 0; } } } if (choice == 1 && settings->multisave) { title.selchoice = 2; title.seldelay = SELECT_MENU_DELAY; } else { title.selchoice = choice; title.seldelay = SELECT_DELAY; music(0); } } run_konami_code(); }
static void handle_input() { if (justpushed(DOWNKEY)) { sound(SND_MENU_MOVE); if (++title.cursel >= sprites[SPR_MENU].nframes) title.cursel = 0; } else if (justpushed(UPKEY)) { sound(SND_MENU_MOVE); if (--title.cursel < 0) title.cursel = sprites[SPR_MENU].nframes - 1; } if (buttonjustpushed()) { sound(SND_MENU_SELECT); int choice = title.cursel; // handle case where user selects Load but there is no savefile, // or the last_save_file is deleted. if (title.cursel == 1) { if (!ProfileExists(settings->last_save_slot)) { bool foundslot = false; for(int i=0;i<MAX_SAVE_SLOTS;i++) { if (ProfileExists(i)) { stat("Last save file %d missing. Defaulting to %d instead.", settings->last_save_slot, i); settings->last_save_slot = i; foundslot = true; } } // there are no save files. Start a new game instead. if (!foundslot) { stat("No save files found. Starting new game instead."); choice = 0; } } } if (choice == 1 && settings->multisave) { title.selchoice = 2; title.seldelay = SELECT_MENU_DELAY; } else { title.selchoice = choice; title.seldelay = SELECT_DELAY; music(0); } } run_konami_code(); }