Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.79 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. LoadVPM "01500000","DE.VBS",3.10
  10.  
  11. '*************************************
  12. '** Game Specific Code Starts Here **
  13. '********************************************
  14.  
  15. Const cGameName="ckpt_a17",UseSolenoids=2,UseLamps=1,UseSync=1,UseGI=0,SCoin="coin4"
  16. 'Const SSolenoidOn="solon",SSolenoidOff="soloff",SFlipperOn="FlipperUp",SFlipperOff="FlipperDown",SCoin="coin4"
  17.  
  18. Dim DesktopMode: DesktopMode = Table1.ShowDT
  19.  
  20. If DesktopMode = True Then 'Show Desktop components
  21. Ramp16.visible=1
  22. Ramp15.visible=1
  23. Primitive13.visible=1
  24. Else
  25. Ramp16.visible=0
  26. Ramp15.visible=0
  27. Primitive13.visible=0
  28. End if
  29.  
  30.  
  31. '*************************************************************
  32. 'Solenoid Call backs
  33. '**********************************************************************************************************
  34.  
  35.  
  36.  
  37. SolCallback(1)="bsTrough.SolIn"
  38. SolCallback(2)="bsTrough.SolOut"
  39. SolCallback(3)="bsPit.SolOut"
  40. SolCallback(4)="dtC.SolDropUp"
  41. SolCallback(5)="dtL.SolDropUp"
  42. SolCallback(6)="dtR.SolDropUp"
  43. SolCallback(7)="bsVuk.SolOut"
  44. SolCallback(8)="AutoPlunger"
  45. SolCallback(9)="dtR.SolDropDown"
  46. 'SolCallback(10)=
  47. SolCallback(11)="PFGI"
  48. SolCallback(12)= "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  49. SolCallback(13)="SetLamp 113,"
  50. SolCallback(14)="SetLamp 114,"
  51. SolCallback(15)="SetLamp 115,"
  52. SolCallback(16)="SetLamp 116,"
  53. SolCallback(17)="vpmSolSound SoundFX(""fx_bumper1"",DOFContactors),"
  54. SolCallback(18)="vpmSolSound SoundFX(""fx_bumper2"",DOFContactors),"
  55. SolCallback(19)="vpmSolSound SoundFX(""fx_bumper3"",DOFContactors),"
  56. 'SolCallback(20)="vpmSolSound ""right_slingshot"","
  57. 'SolCallback(21)="vpmSolSound ""left_slingshot"","
  58. 'SolCallback(22)= 'Not Used
  59. 'SolCallback(23)= 'Not Used
  60. SolCallback(24)="SetLamp 65,"
  61. SolCallback(25)="SetLamp 135,"
  62. SolCallback(26)="SetLamp 136,"
  63. SolCallback(27)="SetLamp 127,"
  64. SolCallback(28)="SetLamp 128,"
  65. SolCallback(29)="SetLamp 129,"
  66. SolCallback(30)="SetLamp 130,"
  67. SolCallback(31)="SetLamp 131,"
  68. SolCallback(32)="SetLamp 132,"
  69. 'SolCallback(38)=
  70.  
  71.  
  72. SolCallback(sLRFlipper) = "SolRFlipper"
  73. SolCallback(sLLFlipper) = "SolLFlipper"
  74.  
  75.  
  76. Sub SolLFlipper(Enabled)
  77. If Enabled Then
  78. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd
  79. Else
  80. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart
  81. End If
  82. End Sub
  83.  
  84. Sub SolRFlipper(Enabled)
  85. If Enabled Then
  86. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd
  87. Else
  88. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart
  89. End If
  90. End Sub
  91.  
  92.  
  93. '**********************************************************************************************************
  94.  
  95. 'Solenoid Controlled toys
  96. '**********************************************************************************************************
  97.  
  98. Sub AutoPlunger(Enabled)
  99. If Enabled Then
  100. Plunger2.Fire
  101. playsound SoundFX("Popper",DOFContactors)
  102. Else
  103. Plunger2.PullBack
  104. End If
  105. End Sub
  106.  
  107. 'Playfield GI
  108. Sub PFGI(Enabled)
  109. If Enabled Then
  110. dim xx
  111. For each xx in GI:xx.State = 0: Next
  112. PlaySound "fx_relay"
  113. Else
  114. For each xx in GI:xx.State = 1: Next
  115. PlaySound "fx_relay"
  116. End If
  117. End Sub
  118.  
  119.  
  120.  
  121. '**********Sling Shot Animations
  122. ' Rstep and Lstep are the variables that increment the animation
  123. '****************
  124. Dim RStep, Lstep
  125.  
  126. Sub RightSlingShot_Slingshot
  127. vpmTimer.PulseSw 22
  128. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  129. RSling.Visible = 0
  130. RSling1.Visible = 1
  131. sling1.rotx = 20
  132. RStep = 0
  133. RightSlingShot.TimerEnabled = 1
  134. ' gi1.State = 0:Gi2.State = 0
  135. End Sub
  136.  
  137. Sub RightSlingShot_Timer
  138. Select Case RStep
  139. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
  140. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
  141. End Select
  142. RStep = RStep + 1
  143. End Sub
  144.  
  145. Sub LeftSlingShot_Slingshot
  146. vpmTimer.PulseSw 21
  147. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
  148. LSling.Visible = 0
  149. LSling1.Visible = 1
  150. sling2.rotx = 20
  151. LStep = 0
  152. LeftSlingShot.TimerEnabled = 1
  153. ' gi3.State = 0:Gi4.State = 0
  154. End Sub
  155.  
  156. Sub LeftSlingShot_Timer
  157. Select Case LStep
  158. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
  159. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0:
  160. End Select
  161. LStep = LStep + 1
  162. End Sub
  163.  
  164.  
  165.  
  166. '**********************************************************************************************************
  167.  
  168. 'Initiate Table
  169. '**********************************************************************************************************
  170.  
  171.  
  172.  
  173. Dim bsTrough,dtC,dtL,dtR,bsVuk,bsPit
  174.  
  175. Sub Table1_Init
  176.  
  177. On Error Resume Next
  178. With Controller
  179. .GameName=cGameName
  180. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  181. .SplashInfoLine = "Checkpoint, Data East 1991"
  182. .Games(cGameName).Settings.Value("rol") = 0 'rotate DMD to the left
  183. .HandleMechanics=0
  184. .HandleKeyboard=0
  185. .ShowDMDOnly=1
  186. .ShowFrame=0
  187. .ShowTitle=0
  188. .DIP(0)=&H00
  189. .Run
  190. End With
  191. If Err Then MsgBox Err.Description
  192. On Error Goto 0
  193.  
  194.  
  195. PinMAMETimer.Interval=PinMAMEInterval
  196. PinMAMETimer.Enabled=1
  197.  
  198.  
  199. vpmNudge.TiltSwitch=1
  200. vpmNudge.Sensitivity=2
  201. vpmNudge.TiltObj=Array(Bumper1a,Bumper2a,Bumper3a,LeftSlingshot,RightSlingshot)
  202.  
  203. Set bsTrough=New cvpmBallStack
  204. bsTrough.InitSw 10,13,12,11,0,0,0,0
  205. bsTrough.InitKick BallRelease,115,3
  206. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  207. bsTrough.Balls=3
  208.  
  209. Set bsVUK=New cvpmBallStack
  210. bsVUK.InitSw 0,30,0,0,0,0,0,0
  211. bsVUK.InitKick Kicker2,188,5
  212. bsVUK.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  213.  
  214. Set bsPit=New cvpmBallStack
  215. bsPit.InitSaucer Kicker1,37,180,1
  216. bsPit.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  217.  
  218. Set dtC=New cvpmDropTarget
  219. dtC.InitDrop Array(Wall1,Wall2,Wall3),Array(41,42,43)
  220. dtC.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  221.  
  222. Set dtL=New cvpmDropTarget
  223. dtL.InitDrop Array(Wall4,Wall5,Wall6,Wall7),Array(33,34,35,36)
  224. dtL.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  225.  
  226. Set dtR=New cvpmDropTarget
  227. dtR.InitDrop Wall8,44
  228. dtR.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  229.  
  230. vpmMapLights AllLights
  231.  
  232. Plunger2.PullBack
  233. End Sub
  234.  
  235. '**********************************************************************************************************
  236. 'Plunger code
  237. '**********************************************************************************************************
  238.  
  239. Sub Table1_KeyDown(ByVal KeyCode)
  240.  
  241. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  242. If KeyDownHandler(keycode) Then Exit Sub
  243. End Sub
  244.  
  245. Sub Table1_KeyUp(ByVal KeyCode)
  246.  
  247. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  248. If KeyUpHandler(keycode) Then Exit Sub
  249. End Sub
  250.  
  251. '**********************************************************************************************************
  252.  
  253.  
  254. Sub Drain_Hit:bsTrough.AddBall Me : playsound"drain5" : End Sub
  255. Sub Kicker1_Hit:bsPit.AddBall Me : playsound "popper_ball": End Sub
  256.  
  257. '********** Subway *********
  258.  
  259. Sub Kicker3_Hit:vpmTimer.PulseSw(24) : playsound "MiniExit3" : bsVUK.AddBall Me : End Sub
  260. Sub Kicker4_Hit:vpmTimer.PulseSw(24) : playsound "MiniExit3" : bsVUK.AddBall Me : End Sub
  261.  
  262. 'Drop Targets
  263. Sub Wall4_Hit:dtL.Hit 1:End Sub '33
  264. Sub Wall5_Hit:dtL.Hit 2:End Sub '34
  265. Sub Wall6_Hit:dtL.Hit 3:End Sub '35
  266. Sub Wall7_Hit:dtL.Hit 4:End Sub '36
  267.  
  268. Sub Wall1_Hit:dtC.Hit 1:End Sub '41
  269. Sub Wall2_Hit:dtC.Hit 2:End Sub '42
  270. Sub Wall3_Hit:dtC.Hit 3:End Sub '43
  271.  
  272. Sub Wall8_Hit:dtR.Hit 1:End Sub '44
  273.  
  274.  
  275. 'Wire Triggers
  276. Sub Trigger1_Hit:Controller.Switch(14)=1:End Sub '14
  277. Sub Trigger1_unHit:Controller.Switch(14)=0:End Sub
  278. Sub Trigger2_Hit:Controller.Switch(25)=1:End Sub '25
  279. Sub Trigger2_unHit:Controller.Switch(25)=0:End Sub
  280. Sub Trigger3_Hit:Controller.Switch(26)=1:End Sub '26
  281. Sub Trigger3_unHit:Controller.Switch(26)=0:End Sub
  282. Sub Trigger4_Hit:Controller.Switch(27)=1:End Sub '27
  283. Sub Trigger4_unHit:Controller.Switch(27)=0:End Sub
  284. Sub LeftOutlane_Hit:Controller.Switch(17)=1:End Sub '17
  285. Sub LeftOutlane_unHit:Controller.Switch(17)=0:End Sub
  286. Sub LeftInlane_Hit:Controller.Switch(18)=1:End Sub '18
  287. Sub LeftInlane_unHit:Controller.Switch(18)=0:End Sub
  288. Sub RightOutlane_Hit:Controller.Switch(19)=1:End Sub '19
  289. Sub RightOutlane_unHit:Controller.Switch(19)=0:End Sub
  290. Sub RightInlane_Hit:Controller.Switch(20)=1:End Sub '20
  291. Sub RightInlane_unHit:Controller.Switch(20)=0:End Sub
  292. 'Sub LeftSlingshot_Slingshot:vpmTimer.PulseSw(21):End Sub '21
  293. 'Sub RightSlingshot_Slingshot:vpmTimer.PulseSw(22):End Sub '22
  294.  
  295. 'Ramp Triggers
  296. Sub Trigger5_Hit:Controller.Switch(28)=1:End Sub '28
  297. Sub Trigger5_unHit:Controller.Switch(28)=0:End Sub
  298. Sub Trigger6_Hit:Controller.Switch(29)=1:End Sub '29
  299. Sub Trigger6_unHit:Controller.Switch(29)=0:End Sub
  300.  
  301. 'Spinner
  302. Sub sw38_Spin: vpmTimer.PulseSw 38 : playsound"fx_spinner" : End Sub
  303.  
  304. 'Stand Up Target
  305. Sub Wall9_Hit:vpmTimer.PulseSw(45):End Sub '45
  306. Sub FlatTireTarget_Hit:vpmTimer.PulseSw(23):End Sub '23
  307.  
  308.  
  309. Sub DropRamp_Hit()
  310. playsound "ballhit"
  311. End Sub
  312.  
  313.  
  314.  
  315.  
  316. '********** Bumpers ***********
  317. 'Dim Bump2,Bump1,Bump3
  318.  
  319.  
  320. Sub Bumper1a_Hit:vpmTimer.PulseSw 46
  321. B1L3.State = 1:B1L4. State = 1
  322. Me.TimerEnabled = 1
  323. End Sub
  324.  
  325. Sub Bumper1a_Timer
  326. B1L3.State = 0:B1L4. State = 0
  327. Me.Timerenabled = 0
  328. End Sub
  329.  
  330.  
  331. Sub Bumper2a_Hit:vpmTimer.PulseSw 48
  332. B1L5.State = 1:B1L6. State = 1
  333. Me.TimerEnabled = 1
  334. End Sub
  335.  
  336. Sub Bumper2a_Timer
  337. B1L5.State = 0:B1L6. State = 0
  338. Me.Timerenabled = 0
  339. End Sub
  340.  
  341.  
  342. Sub Bumper3a_Hit:vpmTimer.PulseSw 47
  343. B1L1.State = 1:B1L2. State = 1
  344. Me.TimerEnabled = 1
  345. End Sub
  346.  
  347. Sub Bumper3a_Timer
  348. B1L1.State = 0:B1L2. State = 0
  349. Me.Timerenabled = 0
  350. End Sub
  351.  
  352.  
  353.  
  354.  
  355. '***************************************************
  356. ' JP's VP10 Fading Lamps & Flashers
  357. ' Based on PD's Fading Light System
  358. ' SetLamp 0 is Off
  359. ' SetLamp 1 is On
  360. ' fading for non opacity objects is 4 steps
  361. '***************************************************
  362.  
  363. Dim LampState(200), FadingLevel(200)
  364. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  365.  
  366. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  367. LampTimer.Interval = 5 'lamp fading speed
  368. LampTimer.Enabled = 1
  369.  
  370. ' Lamp & Flasher Timers
  371.  
  372. Sub LampTimer_Timer()
  373. Dim chgLamp, num, chg, ii
  374. chgLamp = Controller.ChangedLamps
  375. If Not IsEmpty(chgLamp) Then
  376. For ii = 0 To UBound(chgLamp)
  377. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  378. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  379.  
  380. 'Special Handling
  381. 'If chgLamp(ii,0) = 2 Then solTrough chgLamp(ii,1)
  382. 'If chgLamp(ii,0) = 4 Then PFGI chgLamp(ii,1)
  383.  
  384. Next
  385. End If
  386. UpdateLamps
  387. End Sub
  388.  
  389.  
  390. Sub UpdateLamps()
  391.  
  392. NFadeL 1, L1
  393. NFadeL 2, L2
  394. NFadeL 3, L3
  395. NFadeL 4, L4
  396. NFadeL 5, L5
  397. NFadeL 6, L6
  398.  
  399. NFadeL 9, L9
  400. NFadeL 10, L10
  401. NFadeL 11, L11
  402. NFadeL 12, L12
  403. NFadeL 13, L13
  404. NFadeL 14, L14
  405. NFadeL 18, L18
  406. NFadeL 19, L19
  407. NFadeL 20, L20
  408. NFadeL 21, L21
  409. NFadeL 22, L22
  410. NFadeL 17, L17
  411.  
  412. 'Flash 1, Flasher1 'Pitstop Sign Red LED
  413. 'Flash 2, Flasher2 'Pitstop Sign Green LED
  414. 'Flash 3, Flasher3 'Ramp Sign LED
  415. 'Flash 8, Flasher8 'Ramp Sign LED
  416. 'Flash 23, Flasher23 'Hot Nitro Sign LED
  417. 'Flash 44, Flasher44 'Spinner Sign LED
  418. 'Flash 45, Flasher45 'Spinner Sign LED
  419. 'Flash 46, Flasher46 'Spinner Sign LED
  420. 'Flash 47, Flasher47 'Spinner Sign LED
  421. 'Flash 48, Flasher48 'Spinner Sign LED
  422. 'Flash 49, Flasher49 'BakWall
  423. 'Flash 50, Flasher50 'BakWall
  424. 'Flash 51, Flasher51 'BakWall
  425. 'Flash 52, Flasher52 'BakWall
  426. 'Flash 53, Flasher53 'Ramp Sign LED
  427. 'Flash 54, Flasher54 'Ramp Sign LED
  428.  
  429.  
  430.  
  431. NFadeL 23, L23
  432. NFadeL 24, L24
  433. NFadeL 25, L25
  434. NFadeL 26, L26
  435. NFadeL 27, L27
  436. NFadeL 28, L28
  437. NFadeL 29, L29
  438. NFadeL 30, L30
  439. NFadeL 31, L31
  440.  
  441. NFadeL 32, L32
  442. NFadeL 33, L33
  443. NFadeL 34, L34
  444. NFadeL 35, L35
  445. NFadeL 36, L36
  446. NFadeL 37, L37
  447. NFadeL 38, L38
  448. NFadeL 39, L39
  449. NFadeL 40, L40
  450. NFadeL 41, L41
  451. NFadeL 42, L42
  452. NFadeL 43, L43
  453. NFadeL 44, L44 'Spinner Sign LED
  454. NFadeL 45, L45 'Spinner Sign LED
  455. NFadeL 46, L46 'Spinner Sign LED
  456. NFadeL 47, L47 'Spinner Sign LED
  457. NFadeL 48, L48 'Spinner Sign LED
  458. NFadeL 49, L49 'BakWall
  459. NFadeL 50, L50 'BakWall
  460. NFadeL 51, L51 'BakWall
  461. NFadeL 52, L52 'BakWall
  462. NFadeL 53, L53
  463. NFadeL 54, L54
  464. NFadeLm 55, L55
  465. NFadeL 55, L55b
  466. NFadeL 56, L56
  467. NFadeL 57, L57
  468. NFadeL 58, L58
  469. NFadeL 59, L59
  470. NFadeL 60, L60
  471. NFadeL 64, L64
  472.  
  473.  
  474. 'NFadeL 7, L7 'BakGlass
  475. 'NFadeL 8, L8 'BakGlass
  476.  
  477. 'NFadeL 15, L15 'BakGlass
  478. 'NFadeL 16, L16 'BakGlass
  479.  
  480.  
  481.  
  482.  
  483. 'NFadeL 24, L24
  484. 'Flash 23, Flasher23 'Hot Nitro Sign LED
  485. 'Flash 8, Flasher8 'Ramp Sign LED
  486.  
  487.  
  488.  
  489.  
  490.  
  491. 'Flash 53, Flasher53 'Ramp Sign LED
  492. 'Flash 54, Flasher54 'Ramp Sign LED
  493.  
  494. 'NFadeL 55, L55b
  495.  
  496.  
  497.  
  498. 'NFadeL 61, L61 'Bumper 1
  499. 'NFadeL 62, L62 'Bumper 2
  500. 'NFadeL 63, L63 'Bumper 3
  501.  
  502.  
  503. 'Solenid Controlled Lamps
  504.  
  505. NFadeL 65, L65
  506. 'NFadeL 16, L16
  507. 'NFadeLm 15, L15a
  508. 'NFadeL 15, L15b
  509.  
  510.  
  511. NFadeLm 113, S113a
  512. NFadeL 113, S113b
  513.  
  514. NFadeL 114, S114
  515.  
  516. NFadeLm 115, S115a
  517. NFadeL 115, S115b
  518.  
  519. NFadeL 116, S116
  520.  
  521.  
  522.  
  523.  
  524. NFadeLm 127, S127
  525. NFadeLm 127, S127b
  526.  
  527. NFadeLm 128, S128
  528. NFadeLm 128, S128a
  529.  
  530. NFadeLm 129, S129
  531.  
  532.  
  533. NFadeLm 130, S130
  534. NFadeLm 130, S130b
  535.  
  536. NFadeL 131, S131
  537. NFadeL 132, S132
  538.  
  539. NFadeLm 135, S135a
  540. NFadeLm 135, S135b
  541. NFadeLm 135, S135c
  542.  
  543. NFadeLm 136, S136a
  544. NFadeLm 136, S136b
  545. NFadeLm 136, S136c
  546.  
  547.  
  548.  
  549. End Sub
  550.  
  551.  
  552.  
  553.  
  554. ' div lamp subs
  555.  
  556. Sub InitLamps()
  557. Dim x
  558. For x = 0 to 200
  559. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  560. FadingLevel(x) = 4 ' used to track the fading state
  561. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  562. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  563. FlashMax(x) = 1 ' the maximum value when on, usually 1
  564. FlashMin(x) = 0 ' the minimum value when off, usually 0
  565. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  566. Next
  567. End Sub
  568.  
  569. Sub AllLampsOff
  570. Dim x
  571. For x = 0 to 200
  572. SetLamp x, 0
  573. Next
  574. End Sub
  575.  
  576. Sub SetLamp(nr, value)
  577. If value <> LampState(nr) Then
  578. LampState(nr) = abs(value)
  579. FadingLevel(nr) = abs(value) + 4
  580. End If
  581. End Sub
  582.  
  583. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  584.  
  585. Sub NFadeL(nr, object)
  586. Select Case FadingLevel(nr)
  587. Case 4:object.state = 0:FadingLevel(nr) = 0
  588. Case 5:object.state = 1:FadingLevel(nr) = 1
  589. End Select
  590. End Sub
  591.  
  592. Sub NFadeLm(nr, object) ' used for multiple lights
  593. Select Case FadingLevel(nr)
  594. Case 4:object.state = 0
  595. Case 5:object.state = 1
  596. End Select
  597. End Sub
  598.  
  599. 'Lights, Ramps & Primitives used as 4 step fading lights
  600. 'a,b,c,d are the images used from on to off
  601.  
  602. Sub FadeObj(nr, object, a, b, c, d)
  603. Select Case FadingLevel(nr)
  604. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  605. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  606. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  607. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  608. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  609. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  610. End Select
  611. End Sub
  612.  
  613. Sub FadeObjm(nr, object, a, b, c, d)
  614. Select Case FadingLevel(nr)
  615. Case 4:object.image = b
  616. Case 5:object.image = a
  617. Case 9:object.image = c
  618. Case 13:object.image = d
  619. End Select
  620. End Sub
  621.  
  622. Sub NFadeObj(nr, object, a, b)
  623. Select Case FadingLevel(nr)
  624. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  625. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  626. End Select
  627. End Sub
  628.  
  629. Sub NFadeObjm(nr, object, a, b)
  630. Select Case FadingLevel(nr)
  631. Case 4:object.image = b
  632. Case 5:object.image = a
  633. End Select
  634. End Sub
  635.  
  636. ' Flasher objects
  637.  
  638. Sub Flash(nr, object)
  639. Select Case FadingLevel(nr)
  640. Case 4 'off
  641. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  642. If FlashLevel(nr) < FlashMin(nr) Then
  643. FlashLevel(nr) = FlashMin(nr)
  644. FadingLevel(nr) = 0 'completely off
  645. End if
  646. Object.IntensityScale = FlashLevel(nr)
  647. Case 5 ' on
  648. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  649. If FlashLevel(nr) > FlashMax(nr) Then
  650. FlashLevel(nr) = FlashMax(nr)
  651. FadingLevel(nr) = 1 'completely on
  652. End if
  653. Object.IntensityScale = FlashLevel(nr)
  654. End Select
  655. End Sub
  656.  
  657. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  658. Object.IntensityScale = FlashLevel(nr)
  659. End Sub
  660.  
  661.  
  662.  
  663.  
  664.  
  665. '*********************************************************************
  666. ' Positional Sound Playback Functions
  667. '*********************************************************************
  668.  
  669. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  670. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  671. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  672. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  673. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  674. End Sub
  675.  
  676. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  677. Sub PlaySoundAt(soundname, tableobj)
  678. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  679. End Sub
  680.  
  681. Sub PlaySoundAtBall(soundname)
  682. PlaySoundAt soundname, ActiveBall
  683. End Sub
  684.  
  685.  
  686. '*********************************************************************
  687. ' Supporting Ball & Sound Functions
  688. '*********************************************************************
  689.  
  690. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  691. Dim tmp
  692. tmp = tableobj.y * 2 / table1.height-1
  693. If tmp > 0 Then
  694. AudioFade = Csng(tmp ^10)
  695. Else
  696. AudioFade = Csng(-((- tmp) ^10) )
  697. End If
  698. End Function
  699.  
  700. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  701. Dim tmp
  702. tmp = tableobj.x * 2 / table1.width-1
  703. If tmp > 0 Then
  704. AudioPan = Csng(tmp ^10)
  705. Else
  706. AudioPan = Csng(-((- tmp) ^10) )
  707. End If
  708. End Function
  709.  
  710. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  711. Vol = Csng(BallVel(ball) ^2 / 2000)
  712. End Function
  713.  
  714. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  715. Pitch = BallVel(ball) * 20
  716. End Function
  717.  
  718. Function BallVel(ball) 'Calculates the ball speed
  719. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  720. End Function
  721.  
  722.  
  723.  
  724. '********************************************************************
  725. ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
  726. '********************************************************************
  727.  
  728. Const tnob = 5 ' total number of balls
  729. ReDim rolling(tnob)
  730. InitRolling
  731.  
  732. Sub InitRolling
  733. Dim i
  734. For i = 0 to tnob
  735. rolling(i) = False
  736. Next
  737. End Sub
  738.  
  739. Sub RollingTimer_Timer()
  740. Dim BOT, b
  741. BOT = GetBalls
  742.  
  743. ' stop the sound of deleted balls
  744. For b = UBound(BOT) + 1 to tnob
  745. rolling(b) = False
  746. StopSound "fx_ballrolling" & b
  747. StopSound "fx_plasticrolling" & b
  748. StopSound "fx_metalrolling" & b
  749. Next
  750.  
  751. ' exit the sub if no balls on the table
  752. If UBound(BOT) = -1 Then Exit Sub
  753.  
  754. ' play the rolling sound for each ball
  755. For b = 0 to UBound(BOT)
  756. If BallVel(BOT(b) ) > 1 Then
  757. rolling(b) = True
  758. If BOT(b).Z > 30 Then
  759. ' ball on plastic ramp
  760. StopSound "fx_ballrolling" & b
  761. StopSound "fx_metalrolling" & b
  762. PlaySound "fx_plasticrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  763. Else
  764. ' ball on playfield
  765. StopSound "fx_plasticrolling" & b
  766. StopSound "fx_metalrolling" & b
  767. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  768. End If
  769. Else
  770. If rolling(b) Then
  771. StopSound "fx_ballrolling" & b
  772. StopSound "fx_plasticrolling" & b
  773. StopSound "fx_metalrolling" & b
  774. rolling(b) = False
  775. End If
  776. End If
  777. ' play ball drop sounds
  778. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  779. PlaySound "fx_ball_drop" & b, 0, ABS(BOT(b).velz)/17, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  780. End If
  781. Next
  782. End Sub
  783.  
  784. '**********************
  785. ' Ball Collision Sound
  786. '**********************
  787.  
  788. Sub OnBallBallCollision(ball1, ball2, velocity)
  789. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  790. End Sub
  791.  
  792.  
  793. '*****************************************
  794. ' ninuzzu's FLIPPER SHADOWS
  795. '*****************************************
  796.  
  797. sub FlipperTimer_Timer()
  798. FlipperLSh.RotZ = LeftFlipper.currentangle
  799. FlipperRSh.RotZ = RightFlipper.currentangle
  800.  
  801. LFLogo.RotY = LeftFlipper.CurrentAngle
  802. RFlogo.RotY = RightFlipper.CurrentAngle
  803.  
  804. End Sub
  805.  
  806. '*****************************************
  807. ' ninuzzu's BALL SHADOW
  808. '*****************************************
  809. Dim BallShadow
  810. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  811.  
  812. Sub BallShadowUpdate_timer()
  813. Dim BOT, b
  814. BOT = GetBalls
  815. ' hide shadow of deleted balls
  816. If UBound(BOT)<(tnob-1) Then
  817. For b = (UBound(BOT) + 1) to (tnob-1)
  818. BallShadow(b).visible = 0
  819. Next
  820. End If
  821. ' exit the Sub if no balls on the table
  822. If UBound(BOT) = -1 Then Exit Sub
  823. ' render the shadow for each ball
  824. For b = 0 to UBound(BOT)
  825. If BOT(b).X < Table1.Width/2 Then
  826. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  827. Else
  828. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  829. End If
  830. ballShadow(b).Y = BOT(b).Y + 12
  831. If BOT(b).Z > 20 Then
  832. BallShadow(b).visible = 1
  833. Else
  834. BallShadow(b).visible = 0
  835. End If
  836. Next
  837. End Sub
  838.  
  839.  
  840.  
  841. '************************************
  842. ' What you need to add to your table
  843. '************************************
  844.  
  845. ' a timer called RollingTimer. With a fast interval, like 10
  846. ' one collision sound, in this script is called fx_collide
  847. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  848. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  849.  
  850.  
  851. '******************************************
  852. ' Explanation of the rolling sound routine
  853. '******************************************
  854.  
  855. ' sounds are played based on the ball speed and position
  856.  
  857. ' the routine checks first for deleted balls and stops the rolling sound.
  858.  
  859. ' The For loop goes through all the balls on the table and checks for the ball speed and
  860. ' if the ball is on the table (height lower than 30) then then it plays the sound
  861. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  862.  
  863. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  864. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  865. ' according to the position of the ball on the table.
  866.  
  867.  
  868. '**************************************
  869. ' Explanation of the collision routine
  870. '**************************************
  871.  
  872. ' The collision is built in VP.
  873. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  874. ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
  875. ' depending of the speed of the collision.
  876.  
  877.  
  878. Sub Pins_Hit (idx)
  879. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  880. End Sub
  881.  
  882. Sub Targets_Hit (idx)
  883. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  884. End Sub
  885.  
  886. Sub Metals_Thin_Hit (idx)
  887. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  888. End Sub
  889.  
  890. Sub Metals_Medium_Hit (idx)
  891. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  892. End Sub
  893.  
  894. Sub Metals2_Hit (idx)
  895. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  896. End Sub
  897.  
  898. Sub Gates_Hit (idx)
  899. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  900. End Sub
  901.  
  902. Sub Spinner_Spin
  903. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  904. End Sub
  905.  
  906. Sub Rubbers_Hit(idx)
  907. dim finalspeed
  908. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  909. If finalspeed > 20 then
  910. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  911. End if
  912. If finalspeed >= 6 AND finalspeed <= 20 then
  913. RandomSoundRubber()
  914. End If
  915. End Sub
  916.  
  917. Sub Posts_Hit(idx)
  918. dim finalspeed
  919. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  920. If finalspeed > 16 then
  921. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  922. End if
  923. If finalspeed >= 6 AND finalspeed <= 16 then
  924. RandomSoundRubber()
  925. End If
  926. End Sub
  927.  
  928. Sub RandomSoundRubber()
  929. Select Case Int(Rnd*3)+1
  930. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  931. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  932. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  933. End Select
  934. End Sub
  935.  
  936. Sub LeftFlipper_Collide(parm)
  937. RandomSoundFlipper()
  938. End Sub
  939.  
  940. Sub RightFlipper_Collide(parm)
  941. RandomSoundFlipper()
  942. End Sub
  943.  
  944. Sub RandomSoundFlipper()
  945. Select Case Int(Rnd*3)+1
  946. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  947. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  948. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  949. End Select
  950. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement