Ejemplo n.º 1
0
/**
 * Request that the background display effect be updated.
 *
 * This finds a display effect to run when nothing has been explicitly
 * started or is in the queue.  It ensures that something is always running.
 */
void deff_update (void)
{
	deffnum_t previous;

	/* If there is a transient effect running, then
	don't try anything.  We'll update the background automatically
	when the foreground exits. */
	if (deff_running && (deff_running != deff_background))
		return;

	/* Recalculate which display effect should run in the
	background */
	previous = deff_running;
	deff_prio = PRI_NULL;
	deff_background = DEFF_NULL;
	if (!in_test)
		callset_invoke (display_update);

	/* Nothing to do if it's already running */
	if (deff_background == previous)
		return;

	/* Switch to the new effect */
	deff_debug ("deff_update: %d -> %d\n", previous, deff_background);
	if (previous != DEFF_NULL)
		deff_stop (previous);
	if (deff_background != DEFF_NULL)
	{
		const deff_t *bgdeff = &deff_table[deff_background];
		deff_running = deff_background;
		deff_start_task (bgdeff);
	}
}
Ejemplo n.º 2
0
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);
	}
}
Ejemplo n.º 3
0
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);
	}
}
Ejemplo n.º 4
0
/*	Restart a multiball mode that is in its grace period */
void mb_mode_restart (struct mb_mode_ops *ops)
{
	if (!mb_mode_in_grace_p (ops))
		return;
	task_create_gid1 (ops->gid_running, ops->active_task);
	task_kill_gid (ops->gid_in_grace);
	deff_stop (ops->deff_ending);
	mb_mode_update (ops, MB_ACTIVE);
}
Ejemplo n.º 5
0
/** If both flippers are pressed and the current running deff
 * is abortable, then stop it. */
CALLSET_ENTRY (deff, flipper_abort)
{
	if (deff_running)
	{
		const deff_t *deff = &deff_table[deff_running];
		if (deff->flags & D_ABORTABLE)
		{
			dbprintf ("Deff %d aborted.\n", deff_running);
			deff_stop (deff_running);
			deff_queue_service ();
		}
	}
}
Ejemplo n.º 6
0
/**
 * See if a factory reset is needed.  The 'init_ok' event is
 * thrown and any catchers can return FALSE if a factory reset
 * should occur.  The accept button must be pressed afterwards
 * to confirm.
 */
void factory_reset_if_required (void)
{
	if (!callset_invoke_boolean (init_ok))
	{
		deff_stop (DEFF_SYSTEM_RESET);
#ifdef CONFIG_DMD_OR_ALPHA
		dmd_alloc_low_clean ();
		font_render_string_center (&font_mono5, 64, 10, "FACTORY SETTINGS");
		font_render_string_center (&font_mono5, 64, 20, "RESTORED");
		dmd_show_low ();
#endif
		factory_reset ();
		task_sleep_sec (4);
		warm_reboot ();
	}
}
Ejemplo n.º 7
0
/** 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 ();
}
Ejemplo n.º 8
0
void sssmb_stop (void)
{
	if (!global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING))
		return;	
	if (mball_jackpot_uncollected == TRUE)
		sound_send (SND_NOOOOOOOO);

	global_flag_off (GLOBAL_FLAG_SSSMB_RUNNING);
	global_flag_off (GLOBAL_FLAG_SSSMB_RED_JACKPOT);
	global_flag_off (GLOBAL_FLAG_SSSMB_ORANGE_JACKPOT);
	global_flag_off (GLOBAL_FLAG_SSSMB_YELLOW_JACKPOT);
	timer_kill_gid (GID_SSSMB_DIVERT_DEBOUNCE);
	task_kill_gid (GID_SSSMB_JACKPOT_READY);
	deff_stop (DEFF_SSSMB_RUNNING);
	lamp_tristate_off (LM_SUPER_SKILL);
	effect_update_request ();
}
Ejemplo n.º 9
0
void sssmb_stop (void)
{
	callset_invoke (sssmb_stop);
	if (!global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING))
		return;	
	if (mball_jackpot_uncollected == TRUE)
	{
		sound_send (SND_NOOOOOOOO);
		callset_invoke (start_hurryup);
	}

	global_flag_off (GLOBAL_FLAG_SSSMB_RUNNING);
	global_flag_off (GLOBAL_FLAG_SSSMB_RED_JACKPOT);
	global_flag_off (GLOBAL_FLAG_SSSMB_ORANGE_JACKPOT);
	global_flag_off (GLOBAL_FLAG_SSSMB_YELLOW_JACKPOT);
	timer_kill_gid (GID_SSSMB_DIVERT_DEBOUNCE);
	task_kill_gid (GID_SSSMB_JACKPOT_READY);
	deff_stop (DEFF_SSSMB_RUNNING);
	lamp_tristate_off (LM_SUPER_SKILL);
	music_refresh ();
}
Ejemplo n.º 10
0
CALLSET_ENTRY (rules, start_game)
{
	task_kill_gid (GID_RULES_LEFF);
	deff_stop (DEFF_RULES);
}