/**************************************************************************** * * inlanes lighting effects * ****************************************************************************/ void inlane_quick_freeze_leff (void) { U8 i; for (i = 0; i < 10; i++) { lamplist_apply (LAMPLIST_LEFT_RAMP_AWARDS, leff_toggle); task_sleep (TIME_133MS); }//end of loop leff_exit (); }//end of function
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); }
void console_task(struct SHEET *sheet) { struct TIMER *timer; struct TASK *task = task_now(); int i, fifobuf[128], cursor_x = 16, cursor_c = COL8_000000; char s[2]; fifo32_init(&task->fifo, 128, fifobuf, task); timer = timer_alloc(); timer_init(timer, &task->fifo, 1); timer_settime(timer, 50); /* プロンプト表示 */ putfonts8_asc_sht(sheet, 8, 28, COL8_FFFFFF, COL8_000000, ">", 1); for (;;) { io_cli(); if (fifo32_status(&task->fifo) == 0) { task_sleep(task); io_sti(); } else { i = fifo32_get(&task->fifo); io_sti(); if (i <= 1) { /* カーソル用タイマ */ if (i != 0) { timer_init(timer, &task->fifo, 0); /* 次は0を */ cursor_c = COL8_FFFFFF; } else { timer_init(timer, &task->fifo, 1); /* 次は1を */ cursor_c = COL8_000000; } timer_settime(timer, 50); } if (256 <= i && i <= 511) { /* キーボードデータ(タスクA経由) */ if (i == 8 + 256) { /* バックスペース */ if (cursor_x > 16) { /* カーソルをスペースで消してから、カーソルを1つ戻す */ putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, " ", 1); cursor_x -= 8; } } else { /* 一般文字 */ if (cursor_x < 240) { /* 一文字表示してから、カーソルを1つ進める */ s[0] = i - 256; s[1] = 0; putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, s, 1); cursor_x += 8; } } } /* カーソル再表示 */ boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43); sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44); } } }
/**************************************************************************** * * lighting effects * ****************************************************************************/ void top_popper_leff (void) { U8 i; for (i = 0; i < 6; i++) { flasher_pulse (FLASH_DIVERTER_FLASHER); task_sleep (TIME_33MS); flasher_pulse(FLASH_CLAW_FLASHER); task_sleep (TIME_33MS); flasher_pulse(FLASH_ELEVATOR_1_FLASHER); task_sleep (TIME_33MS); flasher_pulse(FLASH_ELEVATOR_2_FLASHER); task_sleep (TIME_100MS); } for (i = 0; i < 6; i++) { flasher_pulse (FLASH_LEFT_RAMP_UP_FLASHER); task_sleep (TIME_33MS); flasher_pulse (FLASH_DIVERTER_FLASHER); task_sleep (TIME_33MS); flasher_pulse (FLASH_RIGHT_RAMP_UP_FLASHER); sound_start (ST_EFFECT, ZAPP_3_MED, SL_2S, PRI_GAME_QUICK2); task_sleep (TIME_100MS); } leff_exit(); }//end of function
void rules_oddchange1_leff (void) { for (;;) { lamp_tristate_flash (LM_LL_5M); task_sleep (TIME_200MS); lamp_tristate_off (LM_LL_5M); lamp_tristate_flash (LM_ML_5M); task_sleep (TIME_200MS); lamp_tristate_off (LM_ML_5M); lamp_tristate_flash (LM_UL_5M); task_sleep (TIME_200MS); lamp_tristate_off (LM_UL_5M); lamp_tristate_flash (LM_UR_5M); task_sleep (TIME_200MS); lamp_tristate_off (LM_UR_5M); lamp_tristate_flash (LM_MR1_5M); task_sleep (TIME_200MS); lamp_tristate_off (LM_MR1_5M); lamp_tristate_flash (LM_MR2_5M); task_sleep (TIME_200MS); lamp_tristate_off (LM_MR2_5M); lamp_tristate_flash (LM_LR_5M); task_sleep (TIME_200MS); lamp_tristate_off (LM_LR_5M); } }
void rules_chaosmb_leff (void) { lamp_tristate_flash (LM_CLOCK_MILLIONS); task_sleep_sec (3); for (;;) { lamp_tristate_flash (LM_SUPER_SKILL); task_sleep (TIME_500MS); lamp_tristate_off (LM_SUPER_SKILL); lamp_tristate_flash (LM_MULTIBALL); task_sleep (TIME_500MS); lamp_tristate_off (LM_MULTIBALL); lamp_tristate_flash (LM_BONUS_X); task_sleep (TIME_500MS); lamp_tristate_off (LM_BONUS_X); lamp_tristate_flash (LM_RAMP_BATTLE); task_sleep (TIME_500MS); lamp_tristate_off (LM_RAMP_BATTLE); lamp_tristate_flash (LM_PIANO_JACKPOT); task_sleep (TIME_500MS); lamp_tristate_off (LM_PIANO_JACKPOT); lamp_tristate_flash (LM_CAMERA); task_sleep (TIME_500MS); lamp_tristate_off (LM_CAMERA); lamp_tristate_flash (LM_POWER_PAYOFF); task_sleep (TIME_500MS); lamp_tristate_off (LM_POWER_PAYOFF); } }
/** The display effect for a non-fatal error */ void nonfatal_error_deff (void) { #ifdef DEBUGGER dmd_alloc_low_clean (); sprintf ("NONFATAL %ld", system_audits.non_fatal_errors); font_render_string_center (&font_mono5, 64, 10, sprintf_buffer); sprintf ("ERRNO %i GID %i", last_nonfatal_error_code, last_nonfatal_error_gid); font_render_string_center (&font_mono5, 64, 20, sprintf_buffer); dmd_show_low (); sound_send (SND_TEST_ALERT); task_sleep (TIME_200MS); sound_send (SND_TEST_ALERT); task_sleep (TIME_200MS); sound_send (SND_TEST_ALERT); task_sleep_sec (4); #endif deff_exit (); }
static void hellof(void *priv) { unsigned ts = (unsigned)priv; unsigned i = 0; while (1) { printf("Hello %6d\r\n", i++); task_sleep(ts); } }
void rollovers_animation_display_effect_reverse (U16 start_frame, U16 end_frame){ U16 fno; for (fno = start_frame; fno >= end_frame; fno -= 2) { dmd_alloc_pair (); frame_draw(fno); dmd_show2 (); task_sleep (TIME_100MS); }//end of inner loop }//end of function
void right_ramp_leff (void) { U8 i; for (i = 0; i < 5; i++) { flasher_pulse (FLASH_RIGHT_RAMP_UP); flasher_pulse (FLASH_RIGHT_RAMP); task_sleep (TIME_100MS); } leff_exit(); }//end of function
/** Called from a deff when it wants to toggle between two images * on the low and high mapped pages, both in mono mode. * COUNT is the number of times to toggle. * DELAY is how long to wait between each change. */ void deff_swap_low_high (S8 count, task_ticks_t delay) { dmd_show_low (); while (--count >= 0) { dmd_show_other (); task_sleep (delay); } }
/** * Execute a single flasher action. */ void flasher_act (U8 id, struct flasher_action *action) { while (action->pulse_time != 0) { sol_start_real (id, action->duty, action->pulse_time); task_sleep (action->delay_time); action++; } }
void gangway_strobe_leff1 (void) { for (;;) { lamplist_step_increment (LAMPLIST_GANGWAYS, matrix_lookup (LMX_EFFECT1_LAMPS)); task_sleep (TIME_66MS); } }
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); }
void huxley_leff (void){ U8 i; leff_create_peer (huxley_leff1); for (i = 0; i < 15; i++) { flasher_pulse (FLASH_EJECT_FLASHER); task_sleep (TIME_100MS); } leff_exit(); }//end of function
void slow_music_log (U8 count, U8 delay) { U8 i; for (i = 0; i < count; i++) { sound_send (SND_MUSIC_SLOWER); task_sleep (delay + i); } }
/** * Free the lock on a particular solenoid. This waits for the * pulse to finish, then releases the driver for others. */ void sol_free (U8 sol) { /* Wait for the pulse to finish */ while (req_lock != 0x80) task_sleep (TIME_66MS); /* Release the lock for another task */ req_lock = 0; }
void side_ramp_leff (void) { U8 i; for (i = 0; i < 9; i++) { flasher_pulse (FLASH_SIDE_RAMP); flasher_pulse (FLASH_DIVERTER_FLASHER); task_sleep (TIME_100MS); }// end of loop leff_exit(); }//end of function
/**************************************************************************** * * eyeball lighting effects * ****************************************************************************/ void eyeball_leff (void){ U8 i; for (i = 0; i < 10; i++) { leff_toggle(LM_RETINA_SCAN); flasher_pulse (FLASH_EYEBALL); task_sleep (TIME_100MS); }// end of loop leff_exit(); }//end of function
void car_chase_hit_effect_deff(void) { U8 car_chase_SoundCounter; car_chase_SoundCounter = random_scaled(car_chase_TotalNumOfSounds);//from kernal/random.c dmd_clean_page_high ();// dmd_clean_page_low ();// //NOTE: skid sound is played on ramp enter at ramps.c //these sounds are on ramp exit sound_start (ST_SPEECH, car_chase_SoundsArray[car_chase_SoundCounter], SL_4S, PRI_GAME_QUICK2); sound_start (ST_EFFECT, CAR_GEAR_CHANGE, SL_2S, PRI_GAME_QUICK2); if (IN_TEST) { if (++carchase_MessageCounter > 8) carchase_MessageCounter = 0; } else carchase_MessageCounter = random_scaled(9); switch (carchase_MessageCounter) { default: case 0: car_chase_animation_display_effect (IMG_CARCHASE_B_START, IMG_CARCHASE_B_END); car_chase_animation_display_effect (IMG_CARCHASE_A_START, IMG_CARCHASE_A_END); break; case 1: car_chase_animation_display_effect (IMG_CARCHASE_C_START, IMG_CARCHASE_C_END); car_chase_animation_display_effect (IMG_CARCHASE_B_START, IMG_CARCHASE_B_END); break; case 2: car_chase_animation_display_effect (IMG_CARCHASE_D_START, IMG_CARCHASE_D_END); car_chase_animation_display_effect (IMG_CARCHASE_C_START, IMG_CARCHASE_C_END); break; case 3: car_chase_animation_display_effect (IMG_CARCHASE_H_START, IMG_CARCHASE_H_END); car_chase_animation_display_effect (IMG_CARCHASE_D_START, IMG_CARCHASE_D_END); break; case 4: car_chase_animation_display_effect (IMG_CARCHASE_F1_START, IMG_CARCHASE_F1_END); car_chase_animation_display_effect (IMG_CARCHASE_E_START, IMG_CARCHASE_E_END); break; case 5: car_chase_animation_display_effect (IMG_CARCHASE_F2_START, IMG_CARCHASE_F2_END); car_chase_animation_display_effect (IMG_CARCHASE_H_START, IMG_CARCHASE_H_END); break; case 6: car_chase_animation_display_effect (IMG_CARCHASE_F2_START, IMG_CARCHASE_F2_END); car_chase_animation_display_effect (IMG_CARCHASE_F1_START, IMG_CARCHASE_F1_END); break; case 7: car_chase_animation_display_effect (IMG_CARCHASE_A_START, IMG_CARCHASE_A_END); car_chase_animation_display_effect (IMG_CARCHASE_J_START, IMG_CARCHASE_J_END); break; case 8: car_chase_animation_display_effect (IMG_CARCHASE_J_START, IMG_CARCHASE_J_END); car_chase_animation_display_effect (IMG_CARCHASE_E_START, IMG_CARCHASE_E_END); break; }//end of switch task_sleep (TIME_100MS); deff_exit (); }//end of function
void turn_off_gi_leff (void) { gi_leff_allocate (PINIO_GI_STRINGS); while (gi_off) { gi_leff_disable (PINIO_GI_STRINGS); task_sleep (TIME_1S); } gi_leff_free (PINIO_GI_STRINGS); leff_exit (); }// end of function
void close_constask(struct TASK *task) { struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; task_sleep(task); memman_free_4k(memman, task->cons_stack, 64 * 1024); memman_free_4k(memman, (int) task->fifo.buf, 128 * 4); task->flags = 0; /* task_free(task); の代わり */ return; }
/** * Pulse the flippers periodically during stress test. */ static void switch_stress_flipper_task (void) { for (;;) { task_sleep (TIME_1500MS); #if (MACHINE_FLIPTRONIC == 1) flipper_override_pulse (WPC_LL_FLIP_SW); #endif task_sleep (TIME_1500MS); #if (MACHINE_FLIPTRONIC == 1) flipper_override_pulse (WPC_LR_FLIP_SW); #endif task_sleep (TIME_500MS); #ifdef DEBUGGER db_dump_all (); #endif } }
/**************************************************************************** * * display effects * ****************************************************************************/ void prison_break_animation_display_effect (U16 start_frame, U16 end_frame){ U16 fno; for (fno = start_frame; fno <= end_frame; fno += 2) { dmd_alloc_pair (); frame_draw(fno); dmd_show2 (); task_sleep (TIME_100MS); }//end of inner loop }
/* Function to wait 6 seconds or until the autofire is detected as loaded */ static inline void autofire_ball_catch_wait (void) { U8 timeout = 60; /* 6 seconds */ while (!switch_poll_logical (SW_AUTOFIRE2) && --timeout != 0) { task_sleep (TIME_100MS); } }
void color_cycle_leff (void) { U8 i; const U8 count = 9; lamplist_set_apply_delay (0); i = count; lamplist_apply (LAMPLIST_RED_LAMPS, leff_on); do { lamplist_apply (LAMPLIST_RED_LAMPS, leff_toggle); task_sleep (TIME_100MS); } while (--i != 0); i = count; lamplist_apply (LAMPLIST_WHITE_LAMPS, leff_on); do { lamplist_apply (LAMPLIST_WHITE_LAMPS, leff_toggle); task_sleep (TIME_100MS); } while (--i != 0); i = count; lamplist_apply (LAMPLIST_YELLOW_LAMPS, leff_on); do { lamplist_apply (LAMPLIST_YELLOW_LAMPS, leff_toggle); task_sleep (TIME_100MS); } while (--i != 0); i = count; lamplist_apply (LAMPLIST_ORANGE_LAMPS, leff_on); do { lamplist_apply (LAMPLIST_ORANGE_LAMPS, leff_toggle); task_sleep (TIME_100MS); } while (--i != 0); i = count; lamplist_apply (LAMPLIST_AMBER_LAMPS, leff_on); do { lamplist_apply (LAMPLIST_AMBER_LAMPS, leff_toggle); task_sleep (TIME_100MS); } while (--i != 0); leff_exit (); }
/** Display effect for system reset */ void system_reset_deff (void) { /* On DMD machines display the full copyright screen. Alphanumerics aren't large enough to do this. */ #if (MACHINE_DMD == 1) dmd_alloc_low_clean (); font_render_string_center (&font_var5, 64, 3, "FREEWPC (C) COPYRIGHT " C_STRING(BUILD_YEAR)); font_render_string_center (&font_var5, 64, 11, "THIS SOFTWARE IS NOT"); font_render_string_center (&font_var5, 64, 17, "SUPPORTED BY BALLY/WILLIAMS"); font_render_string_center (&font_var5, 64, 25, "WWW.ODDCHANGE.COM/FREEWPC"); dmd_show_low (); #endif #if (MACHINE_ALPHANUMERIC == 1) seg_alloc_clean (); seg_write_row_center (0, "FREEWPC <C>" C_STRING(BUILD_YEAR)); seg_write_row_center (1, "WWW.ODDCHANGE.COM"); seg_show (); #endif task_sleep_sec (3); #ifdef CONFIG_DMD_OR_ALPHA dmd_alloc_low_clean (); font_render_string_left (&font_mono5, 1, 1, MACHINE_NAME); #ifdef DEBUGGER sprintf ("D%s.%s", C_STRING(MACHINE_MAJOR_VERSION), C_STRING(MACHINE_MINOR_VERSION)); #else sprintf ("R%s.%s", C_STRING(MACHINE_MAJOR_VERSION), C_STRING(MACHINE_MINOR_VERSION)); #endif font_render_string_right (&font_mono5, 127, 1, sprintf_buffer); SECTION_VOIDCALL (__common__, render_build_date); font_render_string_left (&font_mono5, 1, 9, sprintf_buffer); #if (MACHINE_PIC == 1) pic_render_serial_number (); font_render_string_left (&font_mono5, 1, 18, sprintf_buffer); #endif font_render_string_left (&font_mono5, 1, 26, "TESTING..."); dmd_show_low (); #endif /* Keep the reset display for at least 3 seconds (so * it is readable), keep it longer if any of the * asynchronous initializations are still running. */ task_sleep_sec (3); while (sys_init_pending_tasks != 0) task_sleep (TIME_66MS); /* If there were any diagnostic errors discovered, announce this fact. */ diag_announce_if_errors (); dbprintf ("System initialized.\n"); deff_exit (); }
void jets_active_task (void) { while (timed_mode_running_p (&tsm_mode)) { lamp_tristate_off (LM_RIGHT_JET); lamp_tristate_on (LM_LEFT_JET); task_sleep (TIME_100MS); lamp_tristate_off (LM_LEFT_JET); lamp_tristate_on (LM_LOWER_JET); task_sleep (TIME_100MS); lamp_tristate_off (LM_LOWER_JET); lamp_tristate_on (LM_RIGHT_JET); task_sleep (TIME_100MS); } lamp_tristate_on (LM_LEFT_JET); lamp_tristate_on (LM_LOWER_JET); lamp_tristate_on (LM_RIGHT_JET); task_exit (); }
void jets_level_up_deff (void) { dmd_alloc_pair_clean (); U16 fno; sound_send (SND_GLASS_BREAKS); for (fno = IMG_EXPLODE_START; fno < IMG_EXPLODE_END; fno += 2) { dmd_map_overlay (); dmd_clean_page_low (); if (fno > 4) { sprintf ("TOWN SQUARE LEVEL %d", jets_bonus_level); font_render_string_center (&font_mono5, 64, 7, sprintf_buffer); /* We don't use scoreget as it's likely another score * has been awarded */ sprintf("%d MILLION", jetscore); font_render_string_center (&font_fireball, 64, 20, sprintf_buffer); } dmd_text_outline (); dmd_alloc_pair (); frame_draw (fno); callset_invoke (score_overlay); dmd_overlay_outline (); dmd_show2 (); task_sleep (TIME_33MS); } for (fno = 0; fno < 10; fno++) { dmd_alloc_pair_clean (); sprintf ("TOWN SQUARE LEVEL %d", jets_bonus_level); font_render_string_center (&font_mono5, 64, 7, sprintf_buffer); /* We don't use scoreget as it's likely another score * has been awarded */ sprintf("%d MILLION", jetscore); font_render_string_center (&font_fireball, 64, 20, sprintf_buffer); dmd_copy_low_to_high (); callset_invoke (score_overlay); dmd_show2 (); task_sleep (TIME_100MS); } deff_exit (); }
/** * Called when the system hardware is fully initialized. * This function performs final initialization. */ void system_reset (void) { system_accept_freewpc (); /* Start the reset display effect, which shows * the machine name, version, etc. */ deff_start (DEFF_SYSTEM_RESET); /* Perform final checks on the switch matrix to make sure * it is working properly. */ /* TODO - poll certain switches that must be operational * before allowing the system to complete init. */ opto_check (); /* Check various persistent variables for sane values. * If there are any incompatibilities, perform a factory * reset to be safe. */ factory_reset_if_required (); /* Mark hardware initialization complete. This will * allow switch scanning to start, so sleep briefly * to allow that to happen once. */ sys_init_complete++; task_sleep (TIME_66MS); /* Invoke other final initializations. */ callset_invoke (init_complete); /* Bump the power-up audit */ audit_increment (&system_audits.power_ups); log_event (SEV_INFO, MOD_SYSTEM, EV_SYSTEM_INIT, 0); /* Start the attract mode effects */ amode_start (); /* In test-only mode, pretend ENTER was pressed * and go straight to test mode. */ #ifdef MACHINE_TEST_ONLY while (sys_init_pending_tasks != 0) task_sleep (TIME_66MS); callset_invoke (sw_enter); #endif }