コード例 #1
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);
}
コード例 #2
0
ファイル: gumball.c プロジェクト: SonnyJim/freewpc
/* 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);
		}
	}
}
コード例 #3
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);
}
コード例 #4
0
ファイル: pitstop_award.c プロジェクト: hydra/freewpc
CALLSET_ENTRY(pitstop_award, dev_pitstop_popper_enter) {
    if (multi_ball_play()) {
        return;
    }

    task_kill_gid(GID_PITSTOP_AWARD_TASK);
    task_create_gid1(GID_PITSTOP_AWARD_TASK, pitstop_award_task);

}
コード例 #5
0
ファイル: rightramp.c プロジェクト: SonnyJim/freewpc
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 ();
}
コード例 #6
0
ファイル: lanes.c プロジェクト: SonnyJim/freewpc
static void handle_outlane (void)
{
    /* Start a timer to tell the difference between an outlane
     * drain and a center drain when the ball reaches the trough. */
    event_can_follow (any_outlane, center_drain, TIME_7S);
    deff_start (DEFF_BALL_DRAIN_OUTLANE);

    if (!multi_ball_play ())
        leff_start (LEFF_STROBE_DOWN);
}
コード例 #7
0
ファイル: multiball.c プロジェクト: SonnyJim/freewpc
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);
	}
}
コード例 #8
0
ファイル: outhole.c プロジェクト: CardonaPinball/freewpc
CALLSET_ENTRY (outhole, sw_outhole)
{
	if (in_live_game)
	{
		if (ballsave_test_active ())
		{
			/* Start a timer so we grab the ball after its
			 * fired to help the player */
			timer_restart_free (GID_BALL_LAUNCH_DEATH, TIME_6S);
		}

		
		/* Start a timer to check if 3 balls drain quickly */
		if (!timer_find_gid (GID_MULTIDRAIN) && !ballsave_test_active ())
		{
			multidrain_count = 0;
			if (multi_ball_play ())
				timer_restart_free (GID_MULTIDRAIN, TIME_7S);
		}
	
		if (timer_find_gid (GID_MULTIDRAIN))
		{
			/* There are 6 balls installed normally */
			bounded_increment (multidrain_count, 6);
			if (multidrain_count >= 3)
				multidrain_awarded = TRUE;
		}
		
		/* Whoops, lost the powerball before getting it in the gumball */
		if (!multi_ball_play () &&
			 global_flag_test (GLOBAL_FLAG_POWERBALL_IN_PLAY) &&
			 !ballsave_test_active ())
		{
			sound_send (SND_NOOOOOOOO);
			powerball_death = TRUE;
			task_sleep (TIME_500MS);
		}
		deff_start (DEFF_BALL_EXPLODE);
		leff_start (LEFF_STROBE_UP);
	}
	
}
コード例 #9
0
ファイル: vmode_dragrace.c プロジェクト: hydra/freewpc
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);
	}
}
コード例 #10
0
ファイル: rocket.c プロジェクト: SonnyJim/freewpc
CALLSET_ENTRY (rocket, dev_rocket_kick_attempt)
{
	if (in_live_game)
	{
		if (!multi_ball_play ())
			leff_start (LEFF_ROCKET);
		sound_send (SND_ROCKET_KICK_REVVING);
		task_sleep (TIME_500MS);
		task_create_gid (0, rocket_kick_sound);
	}
}
コード例 #11
0
ファイル: leffs.c プロジェクト: SonnyJim/freewpc
void slot_kickout_leff (void)
{
	if (multi_ball_play ())
	{
		triac_leff_enable (TRIAC_GI_MASK);
	}
	leff_create_peer (slot_kickout_subtask);
	task_sleep (TIME_500MS);
	triac_leff_enable (TRIAC_GI_MASK);
	leff_exit ();
}
コード例 #12
0
ファイル: unlit.c プロジェクト: SonnyJim/freewpc
inline static bool can_award_unlit_shot (U8 unlit_called_from)
{
    /* Don't allow during multiball or if previously collected */
    if (multi_ball_play ())
        return FALSE;
    else if (backdoor_award_collected)
        return FALSE;
    /* Don't allow spamming the same unlit shot */
    else if (unlit_called_from == unlit_called_from_stored)
        return FALSE;
    else
        return TRUE;
}
コード例 #13
0
ファイル: vmode_dragrace.c プロジェクト: hydra/freewpc
CALLSET_ENTRY (dragrace, lamp_update) {
	if (!global_flag_test(GLOBAL_FLAG_DRAGRACE_ENABLED)) {
		return;
	}

	if (multi_ball_play()) {
		lamp_tristate_off(LM_RACE_TODAY);
		lamp_tristate_off(LM_ROUTE_66_ARROW);
	} else {
		lamp_tristate_flash(LM_RACE_TODAY);
		lamp_tristate_flash(LM_ROUTE_66_ARROW);
	}
}
コード例 #14
0
ファイル: gumball.c プロジェクト: SonnyJim/freewpc
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);
	}
}
コード例 #15
0
ファイル: gumball.c プロジェクト: SonnyJim/freewpc
/* Used for in game testing of whether the player can collect
 * the gumball */
bool gumball_load_is_enabled (void)
{
	if (!in_live_game)
		return FALSE;
	/* Don't enable if the powerball is likely to be out undetected 
	 * We should wait for a detection event first */
	else if (pb_maybe_in_play () )
		return FALSE;
	/* If powerball is out during single ball play, enable */
	else if ((global_flag_test (GLOBAL_FLAG_POWERBALL_IN_PLAY) || gumball_enable_count)
		&& !multi_ball_play ())
		return TRUE;
	else
		return FALSE;
}
コード例 #16
0
ファイル: rocket.c プロジェクト: CardonaPinball/freewpc
CALLSET_ENTRY (rocket, dev_rocket_kick_attempt)
{
	if (in_live_game)
	{
		/* Wait until the skill shot has finished */
		while (skill_shot_enabled ||
			deff_get_active () == DEFF_SKILL_SHOT_MADE ||
			task_find_gid (GID_SKILL_SWITCH_TRIGGER))
		{
			task_sleep (TIME_500MS);
		}
		if (!multi_ball_play ())
			leff_start (LEFF_ROCKET);
		sound_send (SND_ROCKET_KICK_REVVING);
		deff_start (DEFF_ROCKET);
		task_sleep (TIME_500MS);
		task_create_gid (0, rocket_kick_sound);
	}
}