CALLSET_ENTRY (jet, sw_jet) { /* Hack for when mpf_exit switch breaks */ if (!multi_ball_play () && mpf_timer > 0) callset_invoke (sw_mpf_exit); if (global_flag_test(GLOBAL_FLAG_POWERBALL_IN_PLAY)) jets_scored += 2; else jets_scored++; if (jets_scored >= jets_for_bonus) { bounded_increment (jets_bonus_level, 50); jets_for_bonus += 5; award_unlit_shot (SW_BOTTOM_JET); sound_send (SND_GLASS_BREAKS); task_sleep (TIME_500MS); /* jetscore is used rather than score_deff_get * because it's likely another score would of * happened */ if (jets_bonus_level < 3) { score (SC_1M); jetscore = 1; } else if (jets_bonus_level < 5) { score (SC_5M); jetscore = 5; } else if (jets_bonus_level < 7) { score (SC_10M); jetscore = 10; } if (!timer_find_gid (GID_HITCHHIKER)) deff_start (DEFF_JETS_LEVEL_UP); } if (timed_mode_running_p (&tsm_mode)) { score (SC_500K); score_add (tsm_mode_total, score_table[SC_500K]); } else { score (SC_150K); /* Stop deff from restarting whilst we * are showing the level up deff * or when the hitch anim is running */ if ((jets_scored <= jets_for_bonus) && (!timer_find_gid (GID_HITCHHIKER))) deff_restart (DEFF_JETS_HIT); } task_create_gid1 (GID_JET_SOUND, sw_jet_sound); }
CALLSET_ENTRY (left_ramp, lamp_update) { if (timer_find_gid (GID_TNF_READY)) lamp_tristate_flash (LM_BONUS_X); else lamp_tristate_off (LM_BONUS_X); }
/* Called by the right loop magnet to see if we should divert the ball */ void sw_gumball_right_loop_entered (void) { /* Open the divertor if trying to load the gumball*/ if (gumball_enable_from_trough && event_did_follow (autolaunch, right_loop)) { magnet_disable_catch (MAG_RIGHT); gumball_divertor_open (); } /* Don't open if autofired into play or dropped from the lock*/ else if (event_did_follow (autolaunch, right_loop) || timer_find_gid (GID_LOCK_KICKED)) { } /* Don't open if the magnet is about to grab the ball * but remembering that it will always let the powerball through */ else if ((magnet_enabled (MAG_RIGHT) || magnet_busy (MAG_RIGHT)) && !global_flag_test (GLOBAL_FLAG_POWERBALL_IN_PLAY)) { } else if (gumball_load_is_enabled ()) { gumball_divertor_open (); if (in_live_game && !multi_ball_play ()) { sound_send (SND_GUMBALL_ENTER); } } }
CALLSET_ENTRY (jet, sw_jet) { task_create_gid1 (GID_JET_SOUND, sw_jet_sound); if (global_flag_test(GLOBAL_FLAG_POWERBALL_IN_PLAY)) jets_scored += 2; else jets_scored++; if (jets_scored >= jets_for_bonus) { jets_level_up (); } if (timed_mode_running_p (&tsm_mode)) { score (SC_500K); score_add (tsm_mode_total, score_table[SC_500K]); callset_invoke (respawn_dollar); } else { score (SC_150K); /* Stop deff from restarting whilst we * are showing the level up deff * or when the hitch anim is running */ if (!timer_find_gid (GID_HITCHHIKER) && !task_find_gid (GID_JETS_LEVEL_UP)) deff_restart (DEFF_JETS_HIT); } /* Hack for when mpf_exit switch breaks */ if (!multi_ball_play () && mpf_timer > 0) callset_invoke (sw_mpf_exit); }
static void jets_level_up (void) { timer_restart_free (GID_JETS_LEVEL_UP, TIME_2S); jets_scored = 1; bounded_increment (jets_bonus_level, 50); if (jets_for_bonus <= 195) jets_for_bonus += 5; award_unlit_shot (SW_BOTTOM_JET); /* jetscore is used rather than score_deff_get * because it's likely another score woud of * happened */ if (jets_bonus_level < 3) { score (SC_1M); jetscore = 1; } else if (jets_bonus_level < 5) { score (SC_5M); jetscore = 5; } else if (jets_bonus_level < 7) { score (SC_10M); jetscore = 10; } if (!timer_find_gid (GID_HITCHHIKER)) deff_start (DEFF_JETS_LEVEL_UP); }
/* * Check if timers should be paused. * * Returns TRUE if timers should not run for some reason. * Returns FALSE if timers should continue to run. */ bool system_timer_pause (void) { if (!in_game || in_bonus || !valid_playfield) return TRUE; if (timer_lock_count) return TRUE; if (global_flag_test (GLOBAL_FLAG_BALL_AT_PLUNGER) && single_ball_play ()) return TRUE; if (global_flag_test (GLOBAL_FLAG_COIN_DOOR_OPENED)) return TRUE; if (config_timed_game) { extern U8 timed_game_suspend_count; if (timer_find_gid (GID_TIMED_GAME_PAUSED)) return TRUE; if (timed_game_suspend_count) return TRUE; } if (device_holdup_count ()) return TRUE; if (ball_search_timed_out ()) return TRUE; if (timer_find_gid (GID_BALLSAVE_EXTENDED)) return TRUE; /* Machines can extend the meaning of timer pause by defining an 'allow timers' event. It should return FALSE if timers should be paused for some reason. */ if (!callset_invoke_boolean (allow_timers)) return TRUE; #ifdef MACHINE_TZ if (mpf_active) return TRUE; #endif return FALSE; }
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); } }
void magnet_enable_catch (U8 magnet) { if (timer_find_gid (GID_LEFT_TO_RIGHT_THROW) && magnet == MAG_LEFT) return; enum magnet_state *magstates = (enum magnet_state *)&left_magnet_state; set_mag_hold_time (magnet, DEFAULT_MAG_HOLD_TIME); magstates[magnet] = MAG_ENABLED; }
CALLSET_ENTRY (tz, start_without_credits) { if (!timer_find_gid (GID_START_NO_CREDITS_DEBOUNCE)) { timer_restart_free (GID_START_NO_CREDITS_DEBOUNCE, TIME_5S); sound_send (SND_GREEEED); } }
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 (outhole, sw_outhole) { if (in_live_game) { if (ballsave_test_active ()) { /* Start a timer so we grab the ball after its * fired to help the player */ timer_restart_free (GID_BALL_LAUNCH_DEATH, TIME_6S); } /* Start a timer to check if 3 balls drain quickly */ if (!timer_find_gid (GID_MULTIDRAIN) && !ballsave_test_active ()) { multidrain_count = 0; if (multi_ball_play ()) timer_restart_free (GID_MULTIDRAIN, TIME_7S); } if (timer_find_gid (GID_MULTIDRAIN)) { /* There are 6 balls installed normally */ bounded_increment (multidrain_count, 6); if (multidrain_count >= 3) multidrain_awarded = TRUE; } /* Whoops, lost the powerball before getting it in the gumball */ if (!multi_ball_play () && global_flag_test (GLOBAL_FLAG_POWERBALL_IN_PLAY) && !ballsave_test_active ()) { sound_send (SND_NOOOOOOOO); powerball_death = TRUE; task_sleep (TIME_500MS); } deff_start (DEFF_BALL_EXPLODE); leff_start (LEFF_STROBE_UP); } }
CALLSET_ENTRY (sssmb, sw_shooter) { if (global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING) && timer_find_gid (GID_SSSMB_DIVERT_DEBOUNCE)) { extern U8 skill_switch_reached; /* It will always reach at least the first switch */ skill_switch_reached = 1; task_create_gid1 (GID_SSSMB_JACKPOT_READY, sssmb_jackpot_ready_task); } }
void magnet_enable_catch_and_hold (U8 magnet, U8 secs) { if (timer_find_gid (GID_LEFT_TO_RIGHT_THROW) && magnet == MAG_LEFT) return; enum magnet_state *magstates = (enum magnet_state *)&left_magnet_state; /* Limit to 4 secs as we run at 16ms ticks in a U8 timer */ if (secs > 2) secs = 2; set_mag_hold_time (magnet, (secs * (1000UL / MAG_DRIVE_RTT_FREQ))); magstates[magnet] = MAG_ENABLED; }
void magnet_enable_catch_and_throw (U8 magnet) { if (timer_find_gid (GID_LEFT_TO_RIGHT_THROW) && magnet == MAG_LEFT) return; if (feature_config.mag_throw == NO) return; enum magnet_state *magstates = (enum magnet_state *)&left_magnet_state; /* Hold the ball for 2 sec@100% before we throw to stabilise it*/ // set_mag_hold_time (magnet, (64 / MAG_DRIVE_RTT_FREQ)); enable_magnet_throw (magnet); magstates[magnet] = MAG_ENABLED; }
CALLSET_ENTRY (sssmb, sw_shooter) { if (global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING) && timer_find_gid (GID_SSSMB_DIVERT_DEBOUNCE)) { extern U8 skill_switch_reached; /* It will always reach at least the fist switch */ skill_switch_reached = 1; /* TODO: handle case where red jackpot switch is tripped but ball falls back to plunger lane */ task_create_gid1 (GID_SSSMB_JACKPOT_READY, sssmb_jackpot_ready_task); } }
/* Called from leftramp.c */ void sssmb_left_ramp_exit (void) { if (global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING)) { if (sssmb_ramps_to_divert == 0) { if (!timer_find_gid (GID_SSSMB_DIVERT_DEBOUNCE)) { timer_start_free (GID_SSSMB_DIVERT_DEBOUNCE, TIME_6S); } } else { bounded_decrement (sssmb_ramps_to_divert, 0); } score_update_required (); } }
static inline void gangway_shot (task_gid_t gid, task_gid_t other_gid) { score (SC_50K); if (gangway_available_p ()) { if (timer_find_gid (gid)) { timer_kill_gid (gid); gangway_loop_collected (); } else { timer_kill_gid (other_gid); timer_start_free (gid, TIME_5S); gangway_loop_lit (); } } }
void sssmb_running_deff (void) { U16 fno; for (;;) { for (fno = IMG_BOLT_TESLA_START; fno <= IMG_BOLT_TESLA_END; fno += 2) { dmd_alloc_pair_clean (); dmd_map_overlay (); dmd_clean_page_low (); font_render_string_left (&font_bitoutline, 1, 1, "SKILL"); font_render_string_left (&font_quadrit, 54, 2, "MULTIBALL"); sprintf_current_score (); font_render_string_center (&font_cowboy, 64, 16, sprintf_buffer); if (timer_find_gid (GID_SSSMB_DIVERT_DEBOUNCE)) { sprintf ("SKILL SHOT SCORES JACKPOT"); } else if (sssmb_ramps_to_divert == 0) { sprintf ("SHOOT LEFT RAMP NOW"); } else if (sssmb_ramps_to_divert == 1) { sprintf ("1 RAMP FOR SKILL SHOT"); } else { sprintf ("%d RAMPS FOR SKILL SHOT", sssmb_ramps_to_divert); } font_render_string_center (&font_var5, 64, 26, sprintf_buffer); dmd_text_outline (); dmd_alloc_pair (); frame_draw (fno); dmd_overlay_outline (); dmd_show2 (); task_sleep (TIME_66MS); } } }
void sssmb_running_deff (void) { for (;;) { score_update_start (); dmd_alloc_pair (); dmd_clean_page_low (); font_render_string_center (&font_term6, 64, 4, "SKILL MULTIBALL"); sprintf_current_score (); font_render_string_center (&font_fixed6, 64, 16, sprintf_buffer); dmd_copy_low_to_high (); if (timer_find_gid (GID_SSSMB_DIVERT_DEBOUNCE)) { sprintf ("SKILL SHOT SCORES JACKPOT"); } else if (sssmb_ramps_to_divert == 0) { sprintf ("SHOOT LEFT RAMP NOW"); } else if (sssmb_ramps_to_divert == 1) { sprintf ("1 RAMP FOR SKILL SHOT"); } else { sprintf ("%d RAMPS FOR SKILL SHOT", sssmb_ramps_to_divert); } font_render_string_center (&font_var5, 64, 26, sprintf_buffer); dmd_show_low (); while (!score_update_required ()) { task_sleep (TIME_66MS); dmd_show_other (); } } }
/** Returns the number of balls held up temporarily. * * This is the number of balls that are seen, or about to be * seen in ball devices, but which will not be kept here. * This count is queried by timers to determine when they * should be paused. */ U8 device_holdup_count (void) { return held_balls + (timer_find_gid (GID_DEVICE_SWITCH_WILL_FOLLOW) ? 1 : 0); }
CALLSET_ENTRY (gangway, lamp_update) { lamp_on_if (LM_FLIPPER_LANES, gangway_available_p ()); lamp_flash_if (LM_LEFT_GANGWAY, timer_find_gid (GID_LEFT_GANGWAY_LIT)); lamp_flash_if (LM_RIGHT_GANGWAY, timer_find_gid (GID_RIGHT_GANGWAY_LIT)); }
CALLSET_ENTRY (outhole, single_ball_play) { if (!timer_find_gid (GID_MULTIDRAIN)) multidrain_awarded = FALSE; }