Example #1
0
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);
}
Example #2
0
/**
 * Update the ballsave lamp.
 */
CALLSET_ENTRY (ballsave, lamp_update)
{
#ifdef MACHINE_BALL_SAVE_LAMP
	if (timed_mode_effect_running_p (&ball_save_mode))
	{
		leff_start (LEFF_BALL_SAVE);
	}
	else
	{
		leff_stop (LEFF_BALL_SAVE);
	}
#endif
}
Example #3
0
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);
}
Example #4
0
CALLSET_ENTRY (skill, sw_shooter)
{
	/* Because the shooter switch is declared as an 'edge' switch,
	an event is generated on both transitions.  Check the current
	state of the switch to see which transition occurred. */
	if (!in_live_game)
		return;

	if (!switch_poll_logical (SW_SHOOTER))
	{
		sound_send (SND_SHOOTER_PULL);
		leff_restart (LEFF_STROBE_UP);
		timer_restart_free (GID_SHOOTER_SOUND_DEBOUNCE, TIME_3S);
	}
	else
	{
		leff_stop (LEFF_STROBE_UP);
	}
}
Example #5
0
File: leff.c Project: Dmilo/freewpc
/**
 * Return whether a lamp effect that needs already-allocated resources
 * will be able to run, because it has higher priority than the
 * leffs that are holding its required resources.
 *
 * When this returns FALSE, the new leff can't be started at all.
 * When this returns TRUE, any lower priority effects will have been
 * stopped, and the caller is allowed to continue starting the new
 * effect.
 */
static bool leff_can_preempt (const leff_t *leff)
{
	U8 idx;
	leffnum_t rid;
	const leff_t *rleff;

	/* Scan all running leffs to see which ones are holding our lamps. */
	for (idx = 0; idx < MAX_RUNNING_LEFFS; idx++)
	{
		rid = leff_running_list[idx];
		if (rid != LEFF_NULL)
		{
			rleff = &leff_table[rid];
			if (!lamp_set_disjoint (leff_get_set (rleff), leff_get_set (leff))
				&& rleff->prio >= leff->prio)
			{
				/* This running leff has some of the lamps we need, but
				it is higher priority than us.  So the new effect cannot
				be started. */
				return FALSE;
			}
		}
	}

	/* We scanned the whole table and found no overlapping leffs with
	higher priority.  Therefore, our leff is allowed to run.  We can stop
	everything that is overlapping and the caller may start the new leff. */
	for (idx = 0; idx < MAX_RUNNING_LEFFS; idx++)
	{
		rid = leff_running_list[idx];
		if (rid != LEFF_NULL)
		{
			rleff = &leff_table[rid];
			if (!lamp_set_disjoint (leff_get_set (rleff), leff_get_set (leff))
				&& rleff->prio < leff->prio)
			{
				leff_stop (rid);
			}
		}
	}
	return TRUE;
}
Example #6
0
/** A monitor task that checks whether or not a ball search is
necessary.  This task periodically bumps a counter, which is
normally reset as scoring switches are triggered.  If the
counter reaches a threshold, and ball search is allowed to run,
then it is initiated.
	This task is also responsible for incrementing the ball time
statistic, when ball search is not necessary. */
void ball_search_monitor_task (void)
{
	ball_search_timer_reset ();
	while (in_game)
	{
		task_sleep (TIME_1S);

		/* Step the ball search timer as long as a game
		 * is in progess.  But don't allow a ball search in
		 * some situations:
		 *
		 * - ball is on the shooter switch
		 * - either flipper button is held
		 */
		if (in_live_game && !in_bonus && (live_balls || !valid_playfield)
#ifdef MACHINE_SHOOTER_SWITCH
				&& !switch_poll_logical (MACHINE_SHOOTER_SWITCH)
#endif
				&& !switch_poll_logical (SW_LEFT_BUTTON)
				&& !switch_poll_logical (SW_RIGHT_BUTTON))
		{
			ball_time++;
			ball_search_timer_step ();
			if (ball_search_timed_out ())
			{
				ball_search_count = 0;
				while (ball_search_timer != 0)
				{
					if ((ball_search_count >= 5) && chase_ball_enabled ())
					{
						/* If chase ball is enabled, after the 5th ball search
						we will force endball. */
						audit_increment (&system_audits.chase_balls);
						end_ball ();
						return;
					}
					else
					{
						/* Perform a ball search */
						ball_search_run ();
					}

					/* After the third ball search, cancel the tilt lamp
					effect, to help the player find the missing ball. */
					if (ball_search_count == 3)
						leff_stop (LEFF_TILT);


					if (ball_search_count < 10)
					{
						/* Delay a small amount for the first few ball searches */
						task_sleep_sec (12);
					}
					else
					{
						/* Delay longer after many ball searches */
						task_sleep_sec (20);
					}

					/* After a while, just give up -- but don't do that in tournament
					mode or on free play; this is just to keep a location game from cycling
					continuously. */
					if (ball_search_count >= 25 &&
							!price_config.free_play && !system_config.tournament_mode)
					{
						fatal (ERR_BALL_SEARCH_TIMEOUT);
					}
				}

				/* A ball was seen -- clear the counter and exit */
				ball_search_count = 0;
			}
		}
	}
	task_exit ();
}
Example #7
0
void jets_mode_exit (void)
{
	leff_stop (LEFF_JETS_COMPLETED);
}