示例#1
0
文件: sssmb.c 项目: SonnyJim/freewpc
static void sssmb_award_jackpot (void)
{
	if (!task_kill_gid (GID_SSSMB_JACKPOT_READY))
		return;

	mball_jackpot_uncollected = FALSE;
	sssmb_initial_ramps_to_divert++;
	if (feature_config.dixon_anti_cradle == YES)
		sssmb_jackpot_value += 5;
	score_1M (sssmb_jackpot_value);
	leff_start (LEFF_PIANO_JACKPOT_COLLECTED);
	deff_start (DEFF_JACKPOT);
	deff_start (DEFF_SSSMB_JACKPOT_COLLECTED);
	sound_send (SND_EXPLOSION_1);

	/* score it */

	if (sssmb_jackpot_value < 100)
		sssmb_jackpot_value += 10;
	sssmb_ramps_to_divert = sssmb_initial_ramps_to_divert;

	if (!global_flag_test (GLOBAL_FLAG_SSSMB_RED_JACKPOT)
		&& !global_flag_test (GLOBAL_FLAG_SSSMB_ORANGE_JACKPOT)
		&& !global_flag_test (GLOBAL_FLAG_SSSMB_YELLOW_JACKPOT))
	{
		sssmb_relight_all_jackpots ();
	}
}
示例#2
0
CALLSET_ENTRY (clock_millions, sw_clock_target)
{
	
	if (timed_mode_running_p (&clock_millions_mode))
	{
		leff_start (LEFF_CLOCK_TARGET);
		/* Award bonus if hit 6 times */
		if (++clock_mode_hits > 5)
		{
			sound_send (SND_EXPLOSION_3);
			score (SC_20M);
			score_add (clock_mode_score, score_table[SC_20M]);
			deff_start (DEFF_CLOCK_MILLIONS_EXPLODE);
			timed_mode_end (&clock_millions_mode);
		}
		else
		{
			sound_send (SND_CLOCK_BELL);
			score (SC_5M);
			score_add (clock_mode_score, score_table[SC_5M]);	
			deff_start (DEFF_CLOCK_MILLIONS_HIT);
		}
		if (!global_flag_test (GLOBAL_FLAG_CHAOSMB_RUNNING))
			tz_clock_reverse_direction ();
		tz_clock_set_speed (clock_mode_hits);
	}
	else if (!global_flag_test (GLOBAL_FLAG_CHAOSMB_RUNNING))
	{
		callset_invoke (sw_jet_noflash);
		score (SC_50K);
		sound_send (SND_NO_CREDITS);
	}
}
示例#3
0
/* check if all 3 are lit */
void redtgt_check (void)
{
	if (global_flag_test (GLOBAL_FLAG_RAFTMODE))
		wpm_next_award ();

	score (SC_20K);

	if (global_flag_test (GLOBAL_FLAG_REDTGT1) && global_flag_test (GLOBAL_FLAG_REDTGT2) && global_flag_test (GLOBAL_FLAG_REDTGT3))
	{
		redtgt_off ();
		if (!flag_test (FLAG_KICKBACKLIT))
		{
			kickback_enable ();
			deff_start (DEFF_REDTGT_KICKBACK);
		}
		else
		{
//			if (global_flag_test (GLOBAL_FLAG_RAFTMODE))
//				wpm_next_award ();
//				raft_award_hazard ();
//			else
				score (SC_250K);
		}
	}
}
示例#4
0
文件: sssmb.c 项目: SonnyJim/freewpc
CALLSET_ENTRY (sssmb, skill_orange)
{
	if (global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING)
		&& global_flag_test (GLOBAL_FLAG_SSSMB_ORANGE_JACKPOT))
	{
		global_flag_off (GLOBAL_FLAG_SSSMB_ORANGE_JACKPOT);
		sssmb_award_jackpot ();
	}
}
示例#5
0
文件: sssmb.c 项目: SonnyJim/freewpc
CALLSET_ENTRY (sssmb, skill_yellow)
{
	if (global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING)
		&& global_flag_test (GLOBAL_FLAG_SSSMB_YELLOW_JACKPOT))
	{
		global_flag_off (GLOBAL_FLAG_SSSMB_YELLOW_JACKPOT);
		sssmb_award_jackpot ();
	}
}
示例#6
0
void sw_right_ramp_enter_task (void)
{
	/* Decide whether to let the ball onto the mini-playfield,
	or dump it.  Do this once for each balls that enters the
	ramp. */
	do {
		/* Let it through to the mpf field if allowed */
		if (mpf_ready_p ())
		{
			/* Reset the unlit count so we can
			 * hint to the player again later */
			unlit_right_ramps = 0;
			bridge_open_start ();
			task_sleep_sec (3);
			/* Don't close if another ball is on it's way */
			if (right_ramps_entered == 1)
				bridge_open_stop ();
		}
		else
		{
			/* Ramp was hit unlit, increment the hint counter */
			bounded_increment (unlit_right_ramps, 3);
			/* tell unlit.c that an unlit shot was made */
			award_unlit_shot (SW_RIGHT_RAMP);

			 /* Show an animation hint if not enabled for mpf */
			if ((unlit_right_ramps == 3  || hurryup_active ())
				&& !global_flag_test (GLOBAL_FLAG_MULTIBALL_RUNNING))
				deff_start (DEFF_SHOOT_HITCH);
			else if (global_flag_test (GLOBAL_FLAG_MULTIBALL_RUNNING)
					&& global_flag_test (GLOBAL_FLAG_MB_JACKPOT_LIT))
			{
				deff_start (DEFF_SHOOT_JACKPOT);
			}
			task_sleep_sec (2);
	
			/* Wait until allowed to kickout */
			/* TODO BUG? */
			while (kickout_locks > 0)
				task_sleep (TIME_100MS);
			
			/* Drop the ball back to the playfield */
			sound_send (SND_RIGHT_RAMP_EXIT);
			bridge_open_start ();
			task_sleep (TIME_300MS);
			/* Sleep a bit longer if multiball, so we knock any following
			 * balls back to the playfield */
			if (multi_ball_play ())
				task_sleep (TIME_200MS);
			bridge_open_stop ();
		}
	} while (--right_ramps_entered > 0);
	/* Failsafe */
	bridge_open_stop ();
	task_exit ();
}
示例#7
0
CALLSET_ENTRY (redtgt, lamp_update)
{
	if (global_flag_test (GLOBAL_FLAG_PF_LAMPS_OFF))
		return;

	if (global_flag_test (GLOBAL_FLAG_REDTGT1))
		lamp_tristate_on (LM_3BANK_TOP);
	if (global_flag_test (GLOBAL_FLAG_REDTGT2))
		lamp_tristate_on (LM_3BANK_CENTER);
	if (global_flag_test (GLOBAL_FLAG_REDTGT3))
		lamp_tristate_on (LM_3BANK_BOTTOM);
}
示例#8
0
CALLSET_ENTRY (gumball, sw_gumball_enter)
{
	/* Ball has entered the gumball machine. */
	dbprintf ("Gumball entered.\n");
	gumball_enable_from_trough = FALSE;
	gumball_count++;
	if (in_live_game)
	{
		if (!multi_ball_play ())
			leff_start (LEFF_GUMBALL_STROBE);
		gumball_running = TRUE;
		gumball_collected_count++;
		award_gumball_score ();
		gumball_release ();

		if (powerball_loaded_into_gumball == TRUE)
		{
			powerball_loaded_into_gumball = FALSE;
			leff_start (LEFF_FLASH_GI2);
			callset_invoke (mball_start);
			callset_invoke (mball_start_3_ball);
			callset_invoke (powerball_in_gumball);	
			/* Do a dodgy multiball combo */
			global_flag_on (GLOBAL_FLAG_SUPER_MB_RUNNING);
			ballsave_add_time (5);
			
			if (!global_flag_test (GLOBAL_FLAG_CHAOSMB_RUNNING)
				&& !global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING))
			{
				/* random_scaled (N) returns from 0 - N-1 */
				switch (random_scaled (2))
				{
					case 0:
						callset_invoke (sssmb_start);
						break;
					case 1:
						callset_invoke (chaosmb_start);
						break;
				}
			}
		}
		else
		{
			bounded_decrement (gumball_enable_count, 0);
		}
		if (!global_flag_test (GLOBAL_FLAG_SUPER_MB_RUNNING))
			deff_start (DEFF_GUMBALL);
	}
}
示例#9
0
/* 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);
		}
	}
}
示例#10
0
文件: sssmb.c 项目: SonnyJim/freewpc
CALLSET_ENTRY (sssmb, lamp_update)
{
	if (global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING) && sssmb_ramps_to_divert > 0)
		lamp_tristate_on (LM_SUPER_SKILL);
	else if (sssmb_can_divert_to_plunger ())
		lamp_tristate_flash (LM_SUPER_SKILL);
}
示例#11
0
void printf_millions (U8 n)
{
	if (global_flag_test (GLOBAL_FLAG_WP5X_RUNNING))
		sprintf ("%d,000,000", n *5);
	else
		sprintf ("%d,000,000", n);
}
示例#12
0
文件: trunk.c 项目: Dmilo/freewpc
CALLSET_ENTRY (trunk_drv, diagnostic_check)
{
	if (feature_config.disable_trunk)
		diag_post_error ("TRUNK DISABLED\nBY ADJUSTMENT\n", MACHINE_PAGE);
	if (global_flag_test (GLOBAL_FLAG_TRUNK_ERROR))
		diag_post_error ("TRUNK IS\nNOT WORKING\n", MACHINE_PAGE);
}
示例#13
0
文件: jets.c 项目: SonnyJim/freewpc
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);
}
示例#14
0
CALLSET_ENTRY (plunger, sw_shooter)
{
    /* TODO - none of this logic works if the shooter switch is broken.
     * Need to invoke this on a timer after any trough kick.
     */
#ifdef INCLUDE_AUTOPLUNGER
    if (valid_playfield
            && !tournament_mode_enabled
            && !global_flag_test (GLOBAL_FLAG_COIN_DOOR_OPENED))
    {
        /* Autolaunch balls right away during a game if they land
        in the autoplunger lane. */
        /* TODO - after locking a ball, adding a new ball to the
        plunger while valid_playfield is TRUE: this will launch
        prematurely.  We need a permanent, system-defined global
        flag that says whether a trough serve should be autoplunged
        or not.  TZ is already doing this privately... */
        VOIDCALL (plunger_sw_launch_button);
    }
    else if (config_timed_plunger == ON)
    {
        /* If timed plunger is enabled, then start a timer
        to autoplunge the ball regardless of button press */
        task_create_gid1 (GID_TIMED_PLUNGER_MONITOR, timed_plunger_monitor);
    }
#endif
    shooter_update ();
}
示例#15
0
文件: timer.c 项目: Dave2084/freewpc
/*
 * 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;
}
示例#16
0
CALLSET_BOOL_ENTRY(dragrace, dev_route_66_popper_kick_request) {
	if (!global_flag_test(GLOBAL_FLAG_DRAGRACE_IN_PROGRESS)) {
		return TRUE;
	}

	// hold the kickout for a bit.
	return FALSE;
}
示例#17
0
文件: jets.c 项目: hydra/freewpc
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);
}
示例#18
0
bool sssmb_can_divert_to_plunger (void)
{
	if (global_flag_test (GLOBAL_FLAG_SSSMB_RUNNING)
		&& sssmb_ramps_to_divert == 0
		&& !switch_poll_logical (SW_SHOOTER))
		return TRUE;
	else
		return FALSE;
}
示例#19
0
CALLSET_ENTRY(dragrace, dev_route_66_popper_enter) {
	if (!global_flag_test(GLOBAL_FLAG_DRAGRACE_ENABLED)) {
		return;
	}
	// kill the shot/arrow lights
	dragrace_disable();

	dragrace_start(GID_DRAGRACE);
}
示例#20
0
CALLSET_ENTRY (multiball, award_scoop_jackpot)
{
	if (multi_ball_play () && global_flag_test (GLOBAL_FLAG_MB_JACKPOT_LIT))
	{
		global_flag_off (GLOBAL_FLAG_MB_JACKPOT_LIT);
		sound_send (SND_JACKPOT);
		score (SC_1M);
		deff_start (DEFF_JACKPOT);
	}
}
示例#21
0
CALLSET_ENTRY (dragrace, sw_right_button) {
	if (!global_flag_test (GLOBAL_FLAG_DRAGRACE_IN_PROGRESS)) {
		return;
	}
	if (button_expectation != EXPECT_RIGHT) {
		return;
	}
	button_expectation = EXPECT_LEFT;
	dragrace_advance_player_car();
}
示例#22
0
文件: serve.c 项目: Dave2084/freewpc
/**
 * If a ball is already on the shooter, or a previous autolaunch
 * request is still in progress, then delay kicking further balls.
 */
CALLSET_BOOL_ENTRY (serve, dev_trough_kick_request)
{
	/* TODO - ball at plunger should block ALL kick requests? */
	if (global_flag_test (GLOBAL_FLAG_BALL_AT_PLUNGER))
		return FALSE;
	else if (task_find_gid (GID_LAUNCH_BALL))
		return FALSE;
	else
		return TRUE;
}
示例#23
0
CALLSET_ENTRY (skillshot_rollover, lamp_update)
{
	if (!global_flag_test (GLOBAL_FLAG_SKILLSHOT_ROLLOVER_ENABLED)) {
		return;
	}

	lamp_flash_if (LM_LEFT_ROLLOVER, current_rollover == SW_LEFT_ROLLOVER);
	lamp_flash_if (LM_MIDDLE_ROLLOVER, current_rollover == SW_MIDDLE_ROLLOVER);
	lamp_flash_if (LM_RIGHT_ROLLOVER, current_rollover == SW_RIGHT_ROLLOVER);
}
示例#24
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
示例#25
0
void dragrace_disable( void ) {
	if (!global_flag_test(GLOBAL_FLAG_DRAGRACE_ENABLED)) {
		return;
	}

	lamp_tristate_off(LM_RACE_TODAY);
	lamp_tristate_off(LM_ROUTE_66_ARROW);

	global_flag_off(GLOBAL_FLAG_DRAGRACE_ENABLED);
	global_flag_off(GLOBAL_FLAG_DIVERTER_ENABLED);
}
示例#26
0
/*  light next unlit target */
void redtgt_addtgt (void)
{
	if (!global_flag_test (GLOBAL_FLAG_REDTGT1))
	{
		global_flag_on (GLOBAL_FLAG_REDTGT1);
//		lamp_tristate_on (LM_3BANK_TOP);
	}
	else if (!global_flag_test (GLOBAL_FLAG_REDTGT2))
	{
		global_flag_on (GLOBAL_FLAG_REDTGT2);
//		lamp_tristate_on (LM_3BANK_CENTER);
	}
	else if (!global_flag_test (GLOBAL_FLAG_REDTGT3))
	{
		global_flag_on (GLOBAL_FLAG_REDTGT3);
//		lamp_tristate_on (LM_3BANK_BOTTOM);
	}

	redtgt_check ();
}
示例#27
0
CALLSET_ENTRY (gumball, sw_gumball_lane)
{
	/* Ball is approaching popper.
	 * Gumball diverter can be closed now. */
	gumball_divertor_close ();
	
	if (global_flag_test (GLOBAL_FLAG_POWERBALL_IN_PLAY))
		powerball_loaded_into_gumball = TRUE;
	else
		powerball_loaded_into_gumball = FALSE;
}
示例#28
0
CALLSET_ENTRY (dragrace, device_update) {
	if (!global_flag_test(GLOBAL_FLAG_DRAGRACE_ENABLED)) {
		return;
	}

	if (multi_ball_play()) {
		global_flag_off(GLOBAL_FLAG_DIVERTER_ENABLED);
	} else {
		global_flag_on(GLOBAL_FLAG_DIVERTER_ENABLED);
	}
}
示例#29
0
文件: sssmb.c 项目: SonnyJim/freewpc
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);
	}
}
示例#30
0
文件: trunk.c 项目: Dmilo/freewpc
void trunk_move (U8 pos)
{
	if (global_flag_test (GLOBAL_FLAG_TRUNK_ERROR))
	{
		trunk_target_pos = 0;
	}
	else
	{
		trunk_target_pos = pos;
		trunk_update ();
	}
}