示例#1
0
//if a ball drains during the mode and with time still on the ballsave timer - send it back in play
CALLSET_BOOL_ENTRY (cryoprison, ball_drain) { //thrown by device.c
	if	(flag_test(FLAG_IS_CRYOPRISON_MB_RUNNING)
		&& cryoprison_ballsave)	{
		sound_start (ST_SPEECH, SPCH_JOHN_SCREAM, SL_2S, PRI_GAME_QUICK5);
		serve_ball_auto ();
		return FALSE; //this is not a valid drain, don't count it
	}
	else return TRUE; //this is a valid drain
}//end of callset
示例#2
0
static void set_ball_count_task (void) {
	device_t *dev = device_entry (DEVNO_TROUGH);
	U8 max_live_balls;
	U8 retries;
	U8 	temp_live_balls_wanted;

	max_live_balls = live_balls;
	temp_live_balls_wanted = live_balls_wanted - live_balls;
	retries = 2;

	//first pass - quick fire balls
	MB_SERVING = TRUE;
	while (temp_live_balls_wanted) {
		temp_live_balls_wanted--;
		sol_request_async (SOL_BALLSERVE);
		task_sleep (TIME_500MS); //worked good at 700 - just giving a little margin here
		task_sleep (TIME_400MS);
		sol_request_async (MACHINE_LAUNCH_SOLENOID);
		task_sleep (TIME_500MS);//worked good at 300 - just giving a little margin here
	}//end of rapid fire serving
	MB_SERVING = FALSE;

	//check trough to see if live balls is accurate
			task_sleep (TIME_1S);
			live_balls = (5 - device_recount(device_entry (DEVNO_TROUGH)) );
			max_live_balls = live_balls;

	//if still not all balls out there, retry slower - 2 times
	// we will usually arrive at this place on a ball-saving type multiball
	//where balls are constantly draining and refiring
	//this is okay, since the refiring will slow down which is sort of a punishment to
	//the player for allowing the balls to drain so fast
	while (max_live_balls < live_balls_wanted && retries) {
		retries--;

		/* Are there enough balls in the trough to satisfy another kick request?
		 * If not, then we need to add the balls from somewhere else.*/
		if (dev->actual_count < dev->kicks_needed)	callset_invoke (trough_rescue);
		else										serve_ball_auto ();

		task_sleep (SET_BALL_COUNT_TASK_DELAY);

		/* As long as there is a ball on the shooter, wait before trying
		to continue.  This flag will clear once the shooter switch
		has cleared for a few seconds. */
		while (global_flag_test (GLOBAL_FLAG_BALL_AT_PLUNGER))
			task_sleep (TIME_133MS);

		/* See if the ball count went up, indicating success */
		if (live_balls > max_live_balls)
			max_live_balls = live_balls;
	}//end of retry section

	task_exit ();
} //end of function
示例#3
0
文件: serve.c 项目: Elwoodbe/freewpc
static void set_ball_count_task (void)
{
    device_t *dev = device_entry (DEVNO_TROUGH);
    U8 max_live_balls;
    U8 retries;

    /* While we are launching balls, we monitor 'live_balls' to
    check that it is going up. */
    max_live_balls = live_balls;

    /* Set the number of times we will attempt to kick a ball.
    This is the number of balls that need to be added to play,
    plus 2 to handle errors.  After this, we give up. */
    retries = live_balls_wanted - max_live_balls + 2;

    while (retries && max_live_balls < live_balls_wanted)
    {
        retries--;

        /* Are there enough balls in the trough to satisfy another
        kick request?  If not, then we need to add the balls from
        somewhere else.  This is machine-specific. */
        if (dev->actual_count < dev->kicks_needed)
        {
            callset_invoke (trough_rescue);
        }
        else
        {
            serve_ball_auto ();
        }

        /* Wait a bit for the ball to make it to the shooter lane. */
        task_sleep (TIME_2S + TIME_500MS);

        /* As long as there is a ball on the shooter, wait before trying
        to continue.  This flag will clear once the shooter switch
        has cleared for a few seconds. */
        while (global_flag_test (GLOBAL_FLAG_BALL_AT_PLUNGER))
            task_sleep (TIME_133MS);

        /* See if the ball count went up, indicating success */
        if (live_balls > max_live_balls)
            max_live_balls = live_balls;
    }
    task_exit ();
}
示例#4
0
void car_chase_mode_init (void) {
	car_chase_mode_shots_made = 0;
	flag_on (FLAG_IS_CARCHASE_MODE_RUNNING);
	ballsave_add_time (10);
	++car_chase_modes_achieved;
	diverter_stop();//defined in divhold2.ct
	task_kill_gid (GID_CR_LIGHTS);
	carchase_mode_on(); //at ramps.c
	serve_ball_auto(); //add one ball to the playfield - NOT a multiball since doesn't change global ball count
	sound_start (ST_SPEECH, SPCH_WUSS_SPARTAN, SL_4S, PRI_GAME_QUICK5);
	task_sleep_sec (2);
	sound_start (ST_SPEECH, SPCH_EXCUSE_ME, SL_4S, PRI_GAME_QUICK5);
	task_sleep_sec (1);
	sound_start (ST_SPEECH, SPCH_BETWEEN_YOU_N_ME, SL_4S, PRI_GAME_QUICK5);
	//flash lamp for a time
	score_zero(car_chase_mode_score);

	lamp_tristate_off (LM_CLAW_READY);
}//end of function
示例#5
0
文件: serve.c 项目: Dave2084/freewpc
static void set_ball_count_task (void)
{
	device_t *dev = device_entry (DEVNO_TROUGH);
	U8 max_live_balls;
	U8 retries;

	/* While we are launching balls, we monitor 'live_balls' to
	check that it is going up. */
	max_live_balls = live_balls;

	/* Set the number of times we will attempt to kick a ball.
	This is the number of balls that need to be added to play,
	plus 2 to handle errors.  After this, we give up. */
	retries = live_balls_wanted - max_live_balls + 2;

	while (retries && max_live_balls < live_balls_wanted)
	{
		retries--;

		/* Are there enough balls in the trough to satisfy another
		kick request?  If not, then we need to add the balls from
		somewhere else.  This is machine-specific. */
		if (dev->actual_count < dev->kicks_needed)
		{
			callset_invoke (trough_rescue);
		}
		else
		{
			serve_ball_auto ();
		}

		/* Delay slightly, and see if the live count changed.
		We only track its maximum */
		task_sleep (TIME_1500MS);

		/* See if the ball count went up, indicating success */
		if (live_balls > max_live_balls)
			max_live_balls = live_balls;
	}
	task_exit ();
}
示例#6
0
/**
 * Return a ball back into play due to ballsave.
 */
static void ballsave_launch (void)
{
	serve_ball_auto ();
	deff_start (DEFF_BALL_SAVE);
}
示例#7
0
//if eject coil just fired then this was probably an inadvertent drain so give the ball back
CALLSET_ENTRY (eject, sw_left_outlane) {
	//if eject accidently cause a left drain then give the ball back
	//immediately - unless ball save is active in which case the ball will come back
	//anyway
	if (in_game && !in_tilt && task_kill_gid(GID_EJECT_1) && !ballsave_test_active() ) 	serve_ball_auto ();
}//end of function