Beispiel #1
0
void rudy_eye_update (void)
{
	switch (EYE_DIRECTION (rudy_eyes))
	{
		case EYES_STRAIGHT:
			eye_direction_stop ();
			break;
		case EYES_LEFT:
			eye_direction_start_reverse ();
			task_recreate_gid_while (GID_RUDY_EYE_TIMEOUT, rudy_eyedir_timeout,
				TASK_DURATION_INF);
			break;
		case EYES_RIGHT:
			eye_direction_start_forward ();
			task_recreate_gid_while (GID_RUDY_EYE_TIMEOUT, rudy_eyedir_timeout,
				TASK_DURATION_INF);
			break;
	}

	switch (EYE_LID(rudy_eyes))
	{
		case EYELID_NORMAL:
		case EYELID_OPEN:
			sol_request (SOL_EYELIDS_OPEN);
			break;

		case EYELID_CLOSED:
			sol_request (SOL_EYELIDS_CLOSED);
			break;
	}
	task_sleep_sec (2);
	task_exit ();
}
Beispiel #2
0
/** Request that a device eject 1 ball */
void device_request_kick (device_t *dev)
{
	task_gid_t gid = DEVICE_GID (device_devno (dev));
	task_kill_gid (gid);
	if (device_kickable_count (dev) > 0)
	{
		dev->kicks_needed++;
		dev->kick_errors = 0;
		/* TODO - this logic probably belongs somewhere else.
		We're increment live balls very early here, before the
		balls are actually added to play. */
		if (!trough_dev_p (dev))
			live_balls++;
	}
	else if (switch_stress_enable && trough_dev_p (dev))
	{
		missing_balls++;
		device_add_live ();
	}
	else
	{
		dbprintf ("Kick request invalid\n");
	}
	if (gid != task_getgid ())
		task_recreate_gid_while (gid, device_update, TASK_DURATION_INF);
}
Beispiel #3
0
/** Called from a switch handler to do the common processing.
 * The input is the device number.  The actual switch that
 * transitioned is unknown, as we don't really care. */
void device_sw_handler (U8 devno)
{
	/* Ignore device switches until initialization is complete */
	if (!sys_init_complete)
	{
		dbprintf ("Device switch ignored during init.\n");
		return;
	}

	/* Ignore device switches if the device update task is already running.
	 * It is polling the device count and will deal with this event. */
	if (task_find_gid (DEVICE_GID (devno)))
		return;

	timer_kill_gid (GID_DEVICE_SWITCH_WILL_FOLLOW);
	task_recreate_gid_while (DEVICE_GID (devno), device_update, TASK_DURATION_INF);
}
Beispiel #4
0
CALLSET_ENTRY (right_ramp, sw_right_ramp)
{
	/* Handle all balls entering the ramp unconditionally, so that
	they are disposed of properly. */
	right_ramps_entered++;
	task_recreate_gid_while (GID_RIGHT_RAMP_ENTERED,
		sw_right_ramp_enter_task, TASK_DURATION_INF);

	/* Scoring functions only happen during a game */
	if (!in_live_game)
		return;
	
	score (SC_10K);
	if (mpf_ready_p ())
		sound_send (SND_RAMP_ENTERS_POWERFIELD);
	else
	{	
		/* Ramp was hit unlit */
		sound_send (SND_RIGHT_RAMP_DEFAULT_ENTER);
	}
}
Beispiel #5
0
/** Request that a device ejects all balls */
void device_request_empty (device_t *dev)
{
	U8 can_kick;

	task_gid_t gid = DEVICE_GID (device_devno (dev));
	task_kill_gid (gid);

	/* See how many balls are in the device, and schedule that many kicks. */
	can_kick = device_kickable_count (dev);
	dev->kicks_needed += can_kick;
	dev->kick_errors = 0;

	/* TODO - this logic probably belongs somewhere else */
	if (!trough_dev_p (dev))
		live_balls += can_kick;

	/* Reset count of locked balls */
	dev->max_count = dev->props->init_max_count;
	if (gid != task_getgid ())
		task_recreate_gid_while (gid, device_update, TASK_DURATION_INF);
}
/**
 * Periodically check to see if effects need updating.
 */
CALLSET_ENTRY (effect_update, idle_every_100ms, start_ball, end_ball)
{
	if (sys_init_complete && !in_test)
	{
		/* Update devices frequently */
		if (in_game && !ball_search_timed_out ())
			callset_invoke (device_update);

		/* Less frequently, update background display, music, and lamps.
		Normally this is done every 500ms.  If effect_update_request() is
		called, then it will occur on the next 100ms interval. */
		if (effect_update_counter == 0)
		{
			task_recreate_gid_while (GID_EFFECT_UPDATE, effect_update_task, TASK_DURATION_INF);
			update_complete ();
		}
		else
		{
			--effect_update_counter;
		}
	}
}
Beispiel #7
0
void rudy_blink (void)
{
	task_recreate_gid_while (GID_RUDY_BLINK, rudy_blink_task,
		TASK_DURATION_INF);
}