/** Start a display effect and wait for it to finish before returning. */ void deff_start_sync (deffnum_t dn) { U8 n; for (n=0; n < 24; n++) { deff_start (dn); if (deff_get_active () == dn) break; task_sleep (TIME_166MS); } while (deff_get_active () == dn) task_sleep (TIME_66MS); }
CALLSET_ENTRY (trivial, bonus) { deff_start (DEFF_BONUS); task_sleep (TIME_1S); while (deff_get_active () == DEFF_BONUS) task_sleep (TIME_166MS); }
/** * Handle the start button. There should be only one callset entry for * this, because only one of the cases should be handled at any time. * Modules that want to hook the start button should declare a * start_button_handler and modify the logic here. */ CALLSET_ENTRY (start_button, sw_start_button) { /* if (free_timer_test (TMR_IGNORE_START_BUTTON)) { } else */ if (deff_get_active () == DEFF_SYSTEM_RESET) { } else if (switch_stress_enable && in_live_game && valid_playfield) { switch_stress_drain (); } else if (initials_enter_timer) { SECTION_VOIDCALL (__common__, initials_start_button_handler); } #ifdef CONFIG_ENTER_PIN else if (pin_enter_timer) { SECTION_VOIDCALL (__common__, pin_start_button_handler); } #endif #ifdef CONFIG_TEST else if (in_test) { SECTION_VOIDCALL (__test__, test_mode_start_button_handler); } #endif else { VOIDCALL (game_start_button_handler); } }
CALLSET_ENTRY (flipcode, sw_right_button) { if (deff_get_active () != DEFF_AMODE) return; flipcode_lock_char (); flipcode_test (); }
CALLSET_ENTRY (pb_lock, sw_right_button) { if (deff_get_active () == DEFF_LOCK_POWERBALL && !timer_find_gid (GID_PB_LOCK_DEBOUNCE)) { lock_powerball = TRUE; deff_stop (DEFF_LOCK_POWERBALL); } }
bool amode_check_flipper_button (void) { if (deff_get_active () == DEFF_AMODE && !timer_find_gid (GID_AMODE_BUTTON_DEBOUNCE)) return TRUE; else return FALSE; }
CALLSET_ENTRY (pb_lock, sw_left_button) { if (deff_get_active () == DEFF_LOCK_POWERBALL && !timer_find_gid (GID_PB_LOCK_DEBOUNCE)) { sound_send (SND_BUYIN_CANCELLED); lock_powerball = FALSE; deff_stop (DEFF_LOCK_POWERBALL); } }
CALLSET_ENTRY (tz, bonus) { deff_start (DEFF_BONUS); leff_start (LEFF_BONUS); task_sleep_sec (1); while (deff_get_active () == DEFF_BONUS) task_sleep (TIME_66MS); leff_stop (LEFF_BONUS); }
CALLSET_ENTRY (amode, sw_right_button) { if (deff_get_active () == DEFF_AMODE) { amode_flipper_sound (); if (amode_page_changed == 0) amode_page_change (1); } }
CALLSET_ENTRY (stress, minute_elapsed) { #ifdef CONFIG_STRESS_AUTO if (switch_stress_enable && !in_game && deff_get_active () == DEFF_AMODE) { dbprintf ("Stress auto start.\n"); task_create_anon (stress_start_button_task); } #endif }
CALLSET_ENTRY (tnf, tnf_start) { flipper_disable (); tnf_buttons_pressed = 1; score_zero (tnf_score); set_tnf_target (); leff_start (LEFF_BONUS); music_request (MUS_POWERFIELD, PRI_GAME_VMODE); deff_start_sync (DEFF_TNF); task_sleep_sec (1); while (deff_get_active () == DEFF_TNF) task_sleep (TIME_500MS); leff_stop (LEFF_BONUS); callset_invoke (tnf_end); }
CALLSET_ENTRY (tnf, sw_left_button, sw_right_button) { if (deff_get_active () == DEFF_TNF) { bounded_increment (tnf_buttons_pressed, 255); score_add (tnf_score, score_table[SC_100K + tnf_level]); tnf_x = random_scaled(10); tnf_y = random_scaled(3); task_recreate_gid (GID_TNF_SOUND, tnf_sound_task); if (tnf_buttons_pressed > tnf_target) { score_add (tnf_score, score_table[SC_5M]); task_kill_gid (GID_TNF_TIMER); } } }
/** Task that is restarted anytime a flipper button is initially * pressed. It polls the flipper switches continously to * see if it is being held down for the amount of time necessary * to start the status report. */ void status_report_monitor (void) { /* A count of 40 equates to a 4s hold down period. */ U8 count = 40; /* Wait until the player has kept the flipper button(s) down * for an extended period of time. Abort as soon as the * flippers are released. */ while (--count > 0) { if (!switch_poll_logical (SW_LEFT_BUTTON) && !switch_poll_logical (SW_RIGHT_BUTTON)) goto done; task_sleep (TIME_100MS); } /* OK, start the status report deff */ start: deff_start (DEFF_STATUS_REPORT); /* Wait until the flippers are released, or the status report * deff terminates. If the flippers are released, then * exit the task. If the status report finishes, go back to * the beginning -- after another 5sec, it will get started * again. */ for (;;) { if (!switch_poll_logical (SW_LEFT_BUTTON) && !switch_poll_logical (SW_RIGHT_BUTTON)) break; if (deff_get_active () != DEFF_STATUS_REPORT) { task_sleep_sec (5); goto start; } task_sleep (TIME_100MS); } /* Stop the status report */ deff_stop (DEFF_STATUS_REPORT); done: task_exit (); }
CALLSET_ENTRY (rocket, dev_rocket_kick_attempt) { if (in_live_game) { /* Wait until the skill shot has finished */ while (skill_shot_enabled || deff_get_active () == DEFF_SKILL_SHOT_MADE || task_find_gid (GID_SKILL_SWITCH_TRIGGER)) { task_sleep (TIME_500MS); } if (!multi_ball_play ()) leff_start (LEFF_ROCKET); sound_send (SND_ROCKET_KICK_REVVING); deff_start (DEFF_ROCKET); task_sleep (TIME_500MS); task_create_gid (0, rocket_kick_sound); } }
CALLSET_ENTRY (slot, dev_slot_kick_attempt) { /* TODO Hack to hold ball due to the way shot_slot_task works */ while (deff_get_active () == DEFF_DOOR_AWARD) task_sleep (TIME_500MS); while (kickout_locks != 0) task_sleep (TIME_500MS); if (in_live_game) { /* start Slot kick -> STDM timer for combo.c */ event_can_follow (slot_kick, outhole, TIME_1S); sound_send (SND_SLOT_KICKOUT_1); leff_start (LEFF_SLOT_KICKOUT); task_sleep (TIME_500MS); task_create_gid (0, slot_kick_sound); } }
CALLSET_ENTRY (tilt, sw_slam_tilt) { /* Ignore slam tilt switch entirely while coin door is open, and configured for tournament mode. This is to avoid inadvertent slam tilts while dealing with problems. */ if (system_config.tournament_mode && !switch_poll_logical (SW_COIN_DOOR_CLOSED)) return; /* Ignore right after a coin door open/close */ if (nonball_event_did_follow (sw_coin_door_closed, sw_slam_tilt)) return; /* Kill the current game */ stop_game (); /* Disable coins briefly, the whole point of the slam tilt */ event_can_follow (sw_slam_tilt, sw_coin, TIME_5S); /* Start the slam tilt effect */ callset_invoke (slam_tilt); deff_start (DEFF_SLAM_TILT); leff_restart (LEFF_TILT); /* Audit the event */ audit_increment (&system_audits.slam_tilts); /* When slamtilt penalty adjustment is enabled, remove a credit. */ if (price_config.slamtilt_penalty) remove_credit (); while (deff_get_active () == DEFF_SLAM_TILT) task_sleep (TIME_66MS); /* TODO: wait for slam switch to become stable, to avoid * endless restarts */ warm_reboot (); }
CALLSET_ENTRY (challenge, display_update) { if (valid_playfield && deff_get_active () != DEFF_CHALLENGE_RUNNING) deff_start (DEFF_CHALLENGE_RUNNING); }
CALLSET_ENTRY (flipcode, sw_left_button) { if (deff_get_active () != DEFF_AMODE) return; flipcode_advance_char (); }
CALLSET_ENTRY (skill_menu, display_update) { // the volume up/down, status reports, etc will cancel the menu, show it again if we should. if (skill_menu_enabled == 1 && deff_get_active() != DEFF_SKILL_MENU) { deff_start (DEFF_SKILL_MENU); } }
CALLSET_ENTRY (rules, sw_buyin_button) { if (deff_get_active () == DEFF_AMODE) deff_start (DEFF_RULES); }