Advertisement
Guest User

Untitled

a guest
Jul 26th, 2020
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.43 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. Const cGameName="corv_21",UseSolenoids=2,UseLamps=0, SCoin="coin"
  10. Const cSingleLFlip=0
  11. Const cSingleRFlip=0
  12.  
  13. Const UseGI = 1 'Enable Bally Williams GI String Calls
  14.  
  15. LoadVPM "01560000", "WPC.VBS", 3.26
  16.  
  17. Dim DesktopMode: DesktopMode = Table1.ShowDT
  18.  
  19. If DesktopMode = True Then 'Show Desktop components
  20. Ramp16.visible=1
  21. Ramp15.visible=1
  22. Primitive13.visible=1
  23. Else
  24. Ramp16.visible=0
  25. Ramp15.visible=0
  26. Primitive13.visible=0
  27. End if
  28.  
  29. '********************
  30. 'Solenoids Call backs
  31. '********************
  32. SolCallback(1) = "solTrough"
  33. SolCallback(2) = "SolLGate"
  34. SolCallback(3) = "SolKickback"
  35. SolCallback(4) = "bsL.SolOut"
  36. SolCallback(5) = "SolGateU"
  37. '6 Not Used
  38. SolCallback(8) = "bsR.SolOut"
  39. 'SolCallback(9)="vpmSolSound ""Sling"","
  40. 'SolCallback(10)="vpmSolSound ""Sling"","
  41. 'SolCallback(11)="vpmSolSound ""Jet3"","
  42. 'SolCallback(12)="vpmSolSound ""Jet3"","
  43. 'SolCallback(13)="vpmSolSound ""Jet3"","
  44. '14 Not Used
  45. SolCallback(15) ="bsLock.SolOut"
  46. SolCallback(16) ="SolTGate"
  47. SolCallback(17) ="SetLamp 117," 'motor controller and Flasher
  48. SolCallback(18) ="SetLamp 118," 'motor controller
  49. SolCallback(19) ="SetLamp 119," 'motor controller
  50. SolCallback(20) ="SetLamp 120," 'Backglass Only
  51. SolCallback(21) ="SetLamp 121,"
  52. SolCallback(22) ="SetLamp 122,"
  53. SolCallback(23) ="SetLamp 123,"
  54. SolCallback(24) ="SetLamp 124,"
  55. SolCallback(25) ="SetLamp 125,"
  56. SolCallback(26) ="SolEngine" 'motor controller and flasher
  57. SolCallback(27) ="SetLamp 127,"
  58. SolCallback(28) ="SetLamp 128,"
  59.  
  60. 'SolCallback(33) = "" 'Diverter Power
  61. SolCallback(34) = "SolDiv"
  62.  
  63. SolCallback(sLRFlipper) = "SolRFlipper"
  64. SolCallback(sLLFlipper) = "SolLFlipper"
  65.  
  66.  
  67. Sub SolLFlipper(Enabled)
  68. If Enabled Then
  69. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd:LeftFlipper1.RotateToEnd
  70. Else
  71. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart:LeftFlipper1.RotateToStart
  72. End If
  73. End Sub
  74.  
  75. Sub SolRFlipper(Enabled)
  76. If Enabled Then
  77. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd
  78. Else
  79. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart
  80. End If
  81. End Sub
  82.  
  83. '**********************************************************************************************************
  84.  
  85. 'Solenoid Controlled toys
  86. '**********************************************************************************************************
  87.  
  88. Sub solTrough(Enabled)
  89. If Enabled Then
  90. bsTrough.ExitSol_On
  91. vpmTimer.PulseSw 37
  92. End If
  93. End Sub
  94.  
  95. Sub SolLGate(Enabled) 'Lock Gate 1
  96. If Enabled Then
  97. Lgate.open = 1
  98. PlaySound SoundFX("Popper",DOFContactors)
  99. Else
  100. Lgate.Open = 0
  101. End If
  102. End Sub
  103.  
  104. Sub SolKickBack(Enabled)
  105. If Enabled Then
  106. KickBack.Fire
  107. PlaySound SoundFX("Popper",DOFContactors)
  108. Else
  109. KickBack.PullBack
  110. End if
  111. End Sub
  112.  
  113. Sub SolGateU(Enabled) 'Lock Gate 2
  114. If Enabled Then
  115. GateU.Open = 1
  116. PlaySound SoundFX("Popper",DOFContactors)
  117.  
  118. Else
  119. GateU.Open = 0
  120. End If
  121. End Sub
  122.  
  123. Sub SolTGate(Enabled)
  124. If Enabled Then
  125. TGate.Open = 1
  126. PlaySound SoundFX("Popper",DOFContactors)
  127. Else
  128. TGate.Open = 0
  129. End if
  130. End Sub
  131.  
  132. Sub SolEngine(Enabled)
  133. SetLamp 126, Enabled
  134. If Enabled then
  135. EngineP.RotY = EngineP.RotY + 5
  136.  
  137. Else
  138. EngineP.RotY = EngineP.RotY - 5
  139.  
  140. End If
  141. End Sub
  142.  
  143. Sub SolDiv(Enabled)
  144. If Enabled Then
  145. PlaySound SoundFX("Diverter",DOFContactors)
  146. DiverterOFF.IsDropped = 1
  147. DiverterON.IsDropped = 0
  148. DivFlipper.RotateToEnd
  149. Else
  150. PlaySound SoundFX("Diverter",DOFContactors)
  151. DiverterOFF.IsDropped = 0
  152. DiverterON.IsDropped = 1
  153. DivFlipper.RotateToStart
  154. End If
  155. End Sub
  156.  
  157.  
  158. '*****************************************
  159. ' General Illumination for Bally/Williams String GI
  160. '*****************************************
  161.  
  162. Set GiCallBack2 = GetRef("UpdateGi")
  163.  
  164. Sub UpdateGi(nr,step)
  165. Dim xx
  166.  
  167. If step > 0 Then
  168. DOF 101, DOFOn
  169. Else
  170. DOF 101, DOFOff
  171. End If
  172.  
  173. Select Case nr
  174. Case 0
  175. If step=0 Then
  176. 'GI1 OFF
  177. For each xx in GI1:xx.State = 0: Next
  178. PlaySound "fx_relay"
  179. Else
  180. 'GI1 ON
  181. For each xx in GI1:xx.State = 1: Next
  182. PlaySound "fx_relay"
  183. End If
  184. Case 1
  185. If step=0 Then
  186. 'GI2 OFF
  187. For each xx in GI2:xx.State = 0: Next
  188. PlaySound "fx_relay"
  189. Else
  190. 'GI2 ON
  191. For each xx in GI2:xx.State = 1: Next
  192. PlaySound "fx_relay"
  193. End If
  194.  
  195. Case 2
  196. If step=0 Then
  197. 'GI3 OFF
  198. For each xx in GI3:xx.State = 0: Next
  199. PlaySound "fx_relay"
  200. Else
  201. 'GI3 ON
  202. For each xx in GI3:xx.State = 1: Next
  203. PlaySound "fx_relay"
  204. End If
  205.  
  206. Case 3
  207. If step=0 Then
  208. 'GI4 OFF
  209. For each xx in GI4:xx.State = 0: Next
  210. PlaySound "fx_relay"
  211. Else
  212. 'GI4 ON
  213. For each xx in GI4:xx.State = 1: Next
  214. PlaySound "fx_relay"
  215. End If
  216.  
  217. 'Case 4 'GI5 is Backglass Only
  218.  
  219. End Select
  220.  
  221. End Sub
  222.  
  223.  
  224.  
  225.  
  226. '************
  227. ' Table init.
  228. '************
  229. Dim bsTrough, bsR, bsL, bsLock, Mag1, Mag2, Mag3, Mag4
  230.  
  231. Sub Table1_Init
  232. vpmInit Me
  233. On Error Resume Next
  234. With Controller
  235. .GameName = cGameName
  236. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  237. .SplashInfoLine = "Corvette Bally 1994"&chr(13)&"You Suck"
  238. .HandleMechanics=0
  239. .HandleKeyboard=0
  240. .ShowDMDOnly=1
  241. .ShowFrame=0
  242. .ShowTitle=0
  243. .hidden = 0
  244. .HandleMechanics = 7
  245. .Games(cGameName).Settings.Value("sound")=1
  246. '.PuPHide = 1
  247. On Error Resume Next
  248. .Run GetPlayerHWnd
  249. If Err Then MsgBox Err.Description
  250. On Error Goto 0
  251. .Switch(22) = 1
  252. .Switch(24) = 1
  253. End With
  254. On Error Goto 0
  255.  
  256. PinMAMETimer.Interval = PinMAMEInterval
  257. PinMAMETimer.Enabled = 1
  258.  
  259. vpmNudge.TiltSwitch=14
  260. vpmNudge.Sensitivity=1
  261. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
  262.  
  263. '**Trough
  264. Set bsTrough = New cvpmBallStack
  265. bsTrough.InitSw 0,31,32,33,34,0,0,0
  266. bsTrough.InitKick BallRelease, 90, 4
  267. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  268. bsTrough.Balls = 4
  269.  
  270. '**Route 66 Kicker
  271. Set bsR = New cvpmBallStack
  272. bsR.InitSw 0, 57, 0, 0, 0, 0, 0, 0
  273. bsR.InitKick sw57, 270, 24
  274. bsR.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  275. bsR.KickForceVar = 3
  276.  
  277. '**Pit Stop
  278. Set bsL = New cvpmBallStack
  279. bsL.InitSw 0, 36, 0, 0, 0, 0, 0, 0
  280. bsL.InitKick sw36, 235, 5
  281. bsL.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  282. bsL.KickForceVar = 3
  283.  
  284. '**ZR1 Lock
  285. Set bsLock=New cvpmBallStack
  286. bsLock.InitSw 0,76,77,78,0,0,0,0
  287. bsLock.InitKick Kicker3,235,1
  288. bsLock.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  289. bsLock.Balls=0
  290.  
  291. Set mag1= New cvpmMagnet
  292. mag1.InitMagnet Magnet1, 45
  293. mag1.GrabCenter = False
  294. mag1.solenoid=26
  295. mag1.CreateEvents "mag1"
  296.  
  297. Set mag2= New cvpmMagnet
  298. With mag2
  299. .InitMagnet Magnet2, 45
  300. .GrabCenter = False
  301. .solenoid=26
  302. .CreateEvents "mag2"
  303. End With
  304.  
  305. Set mag3= New cvpmMagnet
  306. With mag3
  307. .InitMagnet Magnet3, 45
  308. .GrabCenter = False
  309. .solenoid=26
  310. .CreateEvents "mag3"
  311. End With
  312.  
  313. Set mag4= New cvpmMagnet
  314. With mag4
  315. .InitMagnet Magnet4, 45
  316. .GrabCenter = False
  317. .solenoid=26
  318. .CreateEvents "mag4"
  319. End With
  320.  
  321. DiverterON.IsDropped = 1
  322. KickBack.PullBack
  323.  
  324. End Sub
  325.  
  326. '**********************************************************************************************************
  327. 'Plunger code
  328. '**********************************************************************************************************
  329.  
  330. Sub Table1_KeyDown(ByVal KeyCode)
  331. If Keycode = StartGameKey Then Controller.Switch(13) = 1 ' Start Button
  332. If KeyCode = KeyFront Then Controller.Switch(23) = 1 ' Buy In Button
  333. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  334. If KeyDownHandler(keycode) Then Exit Sub
  335. End Sub
  336.  
  337. Sub Table1_KeyUp(ByVal KeyCode)
  338.  
  339. If Keycode = StartGameKey Then Controller.Switch(13) = 0
  340. If KeyCode = KeyFront Then Controller.Switch(23) = 0
  341. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  342. If KeyUpHandler(keycode) Then Exit Sub
  343. End Sub
  344.  
  345. '**********************************************************************************************************
  346.  
  347. ' Drain hole and kickers
  348. Sub Drain_Hit:bsTrough.addball me : playsound"drain" : End Sub
  349.  
  350. Sub sw57a_Hit::PlaySound "kicker_enter",0,1,0.1,0.25:bsR.AddBall Me:End Sub
  351. Sub sw57_Hit()::PlaySound "kicker_enter",0,1,0.1,0.25:bsL.AddBall Me:End Sub
  352. Sub sw36a_Hit: :PlaySound "kicker_enter",0,1,0.1,0.25:bsL.AddBall Me:End Sub '
  353. Sub Kicker1_Hit::PlaySound "kicker_enter",0,1,0.1,0.25:bsLock.AddBall Me:End Sub
  354. Sub Kicker3_Hit():::PlaySound "kicker_enter",0,1,0.1,0.25:bsR.AddBall Me:End Sub
  355.  
  356.  
  357.  
  358. '**********************************
  359. 'Switches
  360. '**********************************
  361. 'Wire Triggers
  362. Sub sw11_Hit:Controller.Switch(11) = 1:PlaySound "rollover":End Sub
  363. Sub sw11_UnHit:Controller.Switch(11) = 0:End Sub
  364. Sub sw12_Hit:Controller.Switch(12) = 1:PlaySound "rollover":End Sub
  365. Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
  366. Sub sw15_Hit:Controller.Switch(15) = 1:PlaySound "rollover":End Sub
  367. Sub sw15_UnHit:Controller.Switch(15) = 0:End Sub
  368. Sub sw16_Hit:Controller.Switch(16) = 1:PlaySound "rollover":End Sub
  369. Sub sw16_UnHit:Controller.Switch(16) = 0:End Sub
  370. Sub sw17_Hit:Controller.Switch(17) = 1:PlaySound "rollover":End Sub
  371. Sub sw17_UnHit:Controller.Switch(17) = 0:End Sub
  372. Sub sw38_Hit:Controller.Switch(38) = 1:PlaySound "rollover":End Sub
  373. Sub sw38_UnHit:Controller.Switch(38) = 0:End Sub
  374. Sub sw66_Hit:Controller.Switch(66) = 1:PlaySound "rollover":End Sub
  375. Sub sw66_UnHit:Controller.Switch(66) = 0:End Sub
  376. Sub sw67_Hit:Controller.Switch(67) = 1:PlaySound "rollover":End Sub
  377. Sub sw67_UnHit:Controller.Switch(67) = 0:End Sub
  378. Sub sw68_Hit:Controller.Switch(68) = 1:PlaySound "rollover":End Sub
  379. Sub sw68_UnHit:Controller.Switch(68) = 0:End Sub
  380. Sub sw87_Hit:Controller.Switch(87) = 1:PlaySound "rollover":End Sub
  381. Sub sw87_UnHit:Controller.Switch(87) = 0:End Sub
  382. Sub sw88_Hit:Controller.Switch(88) = 1:PlaySound "rollover":End Sub
  383. Sub sw88_UnHit:Controller.Switch(88) = 0:End Sub
  384.  
  385. 'Spinners
  386. Sub sw18_Spin:vpmTimer.PulseSw 18 : playsound"fx_spinner" : End Sub
  387.  
  388. '********* Stand Up Target ***********
  389. Sub sw46_Hit:vpmTimer.PulseSw 46:PlaySound SoundFX("target",DOFTargets):End Sub
  390. Sub sw47_Hit:vpmTimer.PulseSw 47:PlaySound SoundFX("target",DOFTargets):End Sub
  391. Sub sw48_Hit:vpmTimer.PulseSw 48:PlaySound SoundFX("target",DOFTargets):End Sub
  392.  
  393. Sub sw83_Hit:vpmTimer.PulseSw 83:PlaySound SoundFX("target",DOFTargets):End Sub
  394. Sub sw81_Hit:vpmTimer.PulseSw 81:PlaySound SoundFX("target",DOFTargets):End Sub
  395. Sub sw82_Hit:vpmTimer.PulseSw 82:PlaySound SoundFX("target",DOFTargets):End Sub
  396.  
  397. 'RAMP SWITCHES *********************************
  398. Sub sw35_Hit:Controller.Switch(35) = 1:End Sub
  399. Sub sw35_unHit:Controller.Switch(35)=0:End Sub
  400. Sub sw43_Hit:Controller.Switch(43) = 1:End Sub
  401. Sub sw43_unHit:Controller.Switch(43)=0:End Sub
  402. Sub sw44_Hit:vpmTimer.PulseSw 44:PlaySound "fx_metalrolling":End Sub
  403. Sub sw45_Hit:vpmTimer.PulseSw 45:PlaySound "fx_metalrolling":End Sub
  404. 'Sub sw58_Hit:vpmTimer.PulseSw 58:PlaySound "fx_metalrolling":End Sub
  405. Sub sw75_Hit:vpmTimer.PulseSw 75:PlaySound "fx_metalrolling":End Sub
  406.  
  407. 'Optical Triggers
  408. Sub sw41_Hit:Controller.Switch(41) = 1:End Sub
  409. Sub sw41_unHit:Controller.Switch(41)=0:End Sub
  410. Sub sw42_Hit:Controller.Switch(42) = 1:End Sub
  411. Sub sw42_unHit:Controller.Switch(42)=0:End Sub
  412. '51
  413. '52
  414. '55
  415. '56
  416. '71
  417. '72
  418.  
  419. 'Scoring rubber
  420. Sub sw84_Hit:vpmTimer.PulseSw 84:End Sub
  421. Sub sw86_Hit:vpmTimer.PulseSw 86:End Sub
  422.  
  423. '**********************************
  424. 'Bumpers
  425. '**********************************
  426. Sub Bumper1_Hit: vpmTimer.PulseSw 64 : PlayBumperSound : End Sub
  427. Sub Bumper2_Hit: vpmTimer.PulseSw 63 : PlayBumperSound : End Sub
  428. Sub Bumper3_Hit: vpmTimer.PulseSw 65 : PlayBumperSound : End Sub
  429.  
  430. Sub PlayBumperSound()
  431. Select Case Int(Rnd*3)+1
  432. Case 1 : PlaySound SoundFX("fx_bumper1",DOFContactors)
  433. Case 2 : PlaySound SoundFX("fx_bumper2",DOFContactors)
  434. Case 3 : PlaySound SoundFX("fx_bumper3",DOFContactors)
  435. End Select
  436. End Sub
  437.  
  438. '********************
  439. 'Generic Sounds
  440. '********************
  441.  
  442.  
  443. '********************
  444. 'Cars
  445. '********************
  446.  
  447.  
  448. Dim EP,NewEP,RedCarPos,BlueCarPos,NewRedCarPos,NewBlueCarPos,RedPercentDownTrack,BluePercentDownTrack,MechNoMovement
  449. Dim BlueCarXStart, BlueCarYStart, RedCarXStart, RedCarYStart
  450. Const MechCarStart = 0
  451. Const MechCarFinish = 675
  452. Const MechTimerFast = 15
  453. Const MechTimerSlow = 100
  454.  
  455. Const BlueCarXFinish = 878
  456. Const BlueCarYFinish = 117
  457. Const RedCarXFinish = 936
  458. Const RedCarYFinish = 117
  459.  
  460. BlueCarXStart = BlueCar.X
  461. BlueCarYStart = BlueCar.Y
  462. RedCarXStart = RedCar.X
  463. RedCarYStart = RedCar.Y
  464.  
  465.  
  466. Sub Mech_Timer
  467. NewBlueCarPos=Controller.GetMech(0)
  468. NewRedCarPos=Controller.GetMech(1)
  469.  
  470. 'If Cars not moving slow down timer
  471. If (NewBlueCarPos = BlueCarPos) and (NewRedCarPos = RedCarPos) and (Mech.Interval <> MechTimerSlow) Then
  472. If MechNoMovement > 10 Then
  473. Mech.Interval = MechTimerSlow
  474. Else
  475. MechNoMovement = MechNoMovement + 1
  476. End If
  477.  
  478. Else
  479. If NewBlueCarPos <> BlueCarPos Then
  480. BlueCarPos = NewBlueCarPos
  481. BluePercentDownTrack = NewBlueCarPos/(MechCarFinish - MechCarStart)
  482. BlueCar.Y = BlueCarYStart - (BlueCarYStart - BlueCarYFinish) * BluePercentDownTrack
  483. BlueCar.X = BlueCarXStart - (BlueCarXStart - BlueCarXFinish) * BluePercentDownTrack
  484.  
  485. 'Speed Up Timer when car in motion
  486. If Mech.Interval <> MechTimerFast Then Mech.Interval = MechTimerFast
  487. End If
  488.  
  489. If NewRedCarPos <> RedCarPos Then
  490. RedCarPos = NewRedCarPos
  491. RedPercentDownTrack = NewRedCarPos/(MechCarFinish - MechCarStart)
  492. RedCar.Y = RedCarYStart - (RedCarYStart - RedCarYFinish) * RedPercentDownTrack
  493. RedCar.X = RedCarXStart - (RedCarXStart - RedCarXFinish) * RedPercentDownTrack
  494.  
  495. 'Speed Up Timer when car in motion
  496. If Mech.Interval <> MechTimerFast Then Mech.Interval = MechTimerFast
  497. End If
  498. MechNoMovement = 0
  499. End If
  500. End Sub
  501.  
  502.  
  503.  
  504.  
  505. '***************************************************
  506. ' JP's VP10 Fading Lamps & Flashers
  507. ' Based on PD's Fading Light System
  508. ' SetLamp 0 is Off
  509. ' SetLamp 1 is On
  510. ' fading for non opacity objects is 4 steps
  511. '***************************************************
  512.  
  513. Dim LampState(200), FadingLevel(200)
  514. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  515.  
  516. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  517. LampTimer.Interval = 5 'lamp fading speed
  518. LampTimer.Enabled = 1
  519.  
  520. ' Lamp & Flasher Timers
  521.  
  522. Sub LampTimer_Timer()
  523. Dim chgLamp, num, chg, ii
  524. chgLamp = Controller.ChangedLamps
  525. If Not IsEmpty(chgLamp) Then
  526. For ii = 0 To UBound(chgLamp)
  527. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  528. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  529.  
  530. 'Special Handling
  531. ' If chgLamp(ii,0) = 35 Then SolGateU chgLamp(ii,1) 'Uppger Engine Gate Hack
  532. ' 'If chgLamp(ii,0) = 4 Then PFGI chgLamp(ii,1)
  533.  
  534. Next
  535. End If
  536. UpdateLamps
  537. End Sub
  538.  
  539.  
  540. Sub UpdateLamps()
  541. NFadeL 1, L1 'Bumper1
  542. NFadeL 2, L2 'Bumper2
  543. NFadeL 3, L3 'Bumper3
  544.  
  545. NFadeL 11, l11
  546. NFadeL 12, l12
  547. NFadeL 13, l13
  548. NFadeL 14, l14
  549. NFadeL 15, l15
  550. NFadeL 16, l16
  551. NFadeL 17, l17
  552. NFadeL 18, l18
  553.  
  554.  
  555. NFadeL 21, l21
  556. NFadeL 22, l22
  557. NFadeL 23, l23
  558. NFadeL 24, l24
  559. NFadeL 25, l25
  560. NFadeL 26, l26
  561. NFadeL 27, l27
  562. NFadeL 28, l28
  563.  
  564.  
  565. NFadeL 31, l31
  566. NFadeL 32, l32
  567. NFadeL 33, l33
  568. NFadeL 34, l34
  569. NFadeL 35, l35
  570. NFadeL 36, l36
  571. NFadeL 37, l37
  572. NFadeL 38, l38
  573.  
  574.  
  575. NFadeL 41, l41
  576. NFadeL 42, l42
  577. NFadeL 43, l43
  578. NFadeL 44, l44
  579. NFadeL 45, l45
  580. NFadeL 46, l46
  581. NFadeL 47, l47
  582. NFadeL 48, l48
  583.  
  584.  
  585. NFadeL 51, l51
  586. NFadeL 52, l52
  587. Flash 53, f53
  588. NFadeL 54, l54
  589. NFadeL 55, l55
  590. NFadeL 56, l56
  591. NFadeL 57, l57
  592. NFadeL 58, l58
  593.  
  594.  
  595. NFadeL 61, l61
  596. NFadeL 62, l62
  597. NFadeL 63, l63
  598. NFadeL 64, l64
  599. NFadeL 65, l65
  600. NFadeL 66, l66
  601. NFadeL 67, l67
  602. Flash 68, f68
  603.  
  604.  
  605. NFadeL 71, l71
  606. NFadeL 72, l72
  607. NFadeL 73, l73
  608. NFadeL 74, l74
  609. NFadeL 75, l75
  610. Flash 76, f76
  611. Flash 77, f77
  612. Flash 78, f78
  613.  
  614.  
  615. Flash 81, f81
  616. Flash 82, f82
  617. Flashm 83, f83a
  618. Flash 83, f83
  619. Flashm 84, f84a
  620. Flash 84, f84
  621. Flash 85, f85
  622. Flash 86, f86
  623.  
  624. 'Solenid Controlled Lamps
  625. 'NFadeL 117, L117 'Not Shown in the Service Manual No clue where it goes
  626. Flashm 118, Flasher118
  627. Flash 118, Flasher118a
  628. Flashm 119, Flasher119
  629. Flash 119, Flasher119a
  630. 'NFadeL 120, L120 'Backglass Only
  631.  
  632. NFadeL 121, L121
  633. NFadeL 122, L122
  634. NFadeL 123, L123
  635. NFadeL 124, L124
  636. NFadeL 125, L125
  637. Flash 126, Flasher126
  638. NFadeL 127, L127
  639. NFadeLm 128, L128
  640. NFadeL 128, L128b
  641.  
  642. End Sub
  643.  
  644. ' div lamp subs
  645.  
  646. Sub InitLamps()
  647. Dim x
  648. For x = 0 to 200
  649. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  650. FadingLevel(x) = 4 ' used to track the fading state
  651. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  652. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  653. FlashMax(x) = 1 ' the maximum value when on, usually 1
  654. FlashMin(x) = 0 ' the minimum value when off, usually 0
  655. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  656. Next
  657. End Sub
  658.  
  659. Sub AllLampsOff
  660. Dim x
  661. For x = 0 to 200
  662. SetLamp x, 0
  663. Next
  664. End Sub
  665.  
  666. Sub SetLamp(nr, value)
  667. If value <> LampState(nr) Then
  668. LampState(nr) = abs(value)
  669. FadingLevel(nr) = abs(value) + 4
  670. End If
  671. End Sub
  672.  
  673. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  674.  
  675. Sub NFadeL(nr, object)
  676. Select Case FadingLevel(nr)
  677. Case 4:object.state = 0:FadingLevel(nr) = 0
  678. Case 5:object.state = 1:FadingLevel(nr) = 1
  679. End Select
  680. End Sub
  681.  
  682. Sub NFadeLm(nr, object) ' used for multiple lights
  683. Select Case FadingLevel(nr)
  684. Case 4:object.state = 0
  685. Case 5:object.state = 1
  686. End Select
  687. End Sub
  688.  
  689. 'Lights, Ramps & Primitives used as 4 step fading lights
  690. 'a,b,c,d are the images used from on to off
  691.  
  692. Sub FadeObj(nr, object, a, b, c, d)
  693. Select Case FadingLevel(nr)
  694. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  695. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  696. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  697. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  698. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  699. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  700. End Select
  701. End Sub
  702.  
  703. Sub FadeObjm(nr, object, a, b, c, d)
  704. Select Case FadingLevel(nr)
  705. Case 4:object.image = b
  706. Case 5:object.image = a
  707. Case 9:object.image = c
  708. Case 13:object.image = d
  709. End Select
  710. End Sub
  711.  
  712. Sub NFadeObj(nr, object, a, b)
  713. Select Case FadingLevel(nr)
  714. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  715. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  716. End Select
  717. End Sub
  718.  
  719. Sub NFadeObjm(nr, object, a, b)
  720. Select Case FadingLevel(nr)
  721. Case 4:object.image = b
  722. Case 5:object.image = a
  723. End Select
  724. End Sub
  725.  
  726. ' Flasher objects
  727.  
  728. Sub Flash(nr, object)
  729. Select Case FadingLevel(nr)
  730. Case 4 'off
  731. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  732. If FlashLevel(nr) < FlashMin(nr) Then
  733. FlashLevel(nr) = FlashMin(nr)
  734. FadingLevel(nr) = 0 'completely off
  735. End if
  736. Object.IntensityScale = FlashLevel(nr)
  737. Case 5 ' on
  738. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  739. If FlashLevel(nr) > FlashMax(nr) Then
  740. FlashLevel(nr) = FlashMax(nr)
  741. FadingLevel(nr) = 1 'completely on
  742. End if
  743. Object.IntensityScale = FlashLevel(nr)
  744. End Select
  745. End Sub
  746.  
  747. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  748. Object.IntensityScale = FlashLevel(nr)
  749. End Sub
  750.  
  751.  
  752.  
  753. '**********Sling Shot Animations
  754. ' Rstep and Lstep are the variables that increment the animation
  755. '****************
  756. Dim RStep, Lstep
  757.  
  758. Sub RightSlingShot_Slingshot
  759. vpmTimer.PulseSw 62
  760. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  761. RSling.Visible = 0
  762. RSling1.Visible = 1
  763. sling1.rotx = 20
  764. RStep = 0
  765. RightSlingShot.TimerEnabled = 1
  766. ' gi1.State = 0:Gi2.State = 0
  767. End Sub
  768.  
  769. Sub RightSlingShot_Timer
  770. Select Case RStep
  771. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
  772. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
  773. End Select
  774. RStep = RStep + 1
  775. End Sub
  776.  
  777. Sub LeftSlingShot_Slingshot
  778. vpmTimer.PulseSw 61
  779. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
  780. LSling.Visible = 0
  781. LSling1.Visible = 1
  782. sling2.rotx = 20
  783. LStep = 0
  784. LeftSlingShot.TimerEnabled = 1
  785. ' gi3.State = 0:Gi4.State = 0
  786. End Sub
  787.  
  788. Sub LeftSlingShot_Timer
  789. Select Case LStep
  790. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
  791. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0:
  792. End Select
  793. LStep = LStep + 1
  794. End Sub
  795.  
  796.  
  797. '*********************************************************************
  798. ' Positional Sound Playback Functions
  799. '*********************************************************************
  800.  
  801. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  802. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  803. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  804. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  805. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  806. End Sub
  807.  
  808. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  809. Sub PlaySoundAt(soundname, tableobj)
  810. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  811. End Sub
  812.  
  813. Sub PlaySoundAtBall(soundname)
  814. PlaySoundAt soundname, ActiveBall
  815. End Sub
  816.  
  817.  
  818. '*********************************************************************
  819. ' Supporting Ball & Sound Functions
  820. '*********************************************************************
  821.  
  822. 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
  823. Dim tmp
  824. tmp = tableobj.y * 2 / 1000
  825. If tmp > 0 Then
  826. AudioFade = Csng(tmp ^10)
  827. Else
  828. AudioFade = Csng(-((- tmp) ^10) )
  829. End If
  830. End Function
  831.  
  832. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  833. Dim tmp
  834. tmp = tableobj.x * 2 / 1000
  835. If tmp > 0 Then
  836. AudioPan = Csng(tmp ^10)
  837. Else
  838. AudioPan = Csng(-((- tmp) ^10) )
  839. End If
  840. End Function
  841.  
  842. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  843. Vol = Csng(BallVel(ball) ^2 / 1000)
  844. End Function
  845.  
  846. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  847. Pitch = BallVel(ball) * 20
  848. End Function
  849.  
  850. Function BallVel(ball) 'Calculates the ball speed
  851. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  852. End Function
  853.  
  854. '********************************************************************
  855. ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
  856. '********************************************************************
  857.  
  858. Const tnob = 5 ' total number of balls
  859. ReDim rolling(tnob)
  860. InitRolling
  861.  
  862. Sub InitRolling
  863. Dim i
  864. For i = 0 to tnob
  865. rolling(i) = False
  866. Next
  867. End Sub
  868.  
  869. Sub RollingTimer_Timer()
  870. Dim BOT, b
  871. BOT = GetBalls
  872.  
  873. ' stop the sound of deleted balls
  874. For b = UBound(BOT) + 1 to tnob
  875. rolling(b) = False
  876. StopSound "fx_ballrolling" & b
  877. StopSound "fx_plasticrolling" & b
  878. StopSound "fx_metalrolling" & b
  879. Next
  880.  
  881. ' exit the sub if no balls on the table
  882. If UBound(BOT) = -1 Then Exit Sub
  883.  
  884. ' play the rolling sound for each ball
  885. For b = 0 to UBound(BOT)
  886. If BallVel(BOT(b) ) > 1 Then
  887. rolling(b) = True
  888. If BOT(b).Z > 30 Then
  889. ' ball on plastic ramp
  890. StopSound "fx_ballrolling" & b
  891. StopSound "fx_metalrolling" & b
  892. PlaySound "fx_plasticrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  893. Else
  894. ' ball on playfield
  895. StopSound "fx_plasticrolling" & b
  896. StopSound "fx_metalrolling" & b
  897. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  898. End If
  899. Else
  900. If rolling(b) Then
  901. StopSound "fx_ballrolling" & b
  902. StopSound "fx_plasticrolling" & b
  903. StopSound "fx_metalrolling" & b
  904. rolling(b) = False
  905. End If
  906. End If
  907. ' play ball drop sounds
  908. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  909. PlaySound "fx_ball_drop" & b, 0, ABS(BOT(b).velz)/17, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  910. End If
  911. Next
  912. End Sub
  913.  
  914. '**********************
  915. ' Ball Collision Sound
  916. '**********************
  917.  
  918. Sub OnBallBallCollision(ball1, ball2, velocity)
  919. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  920. End Sub
  921.  
  922.  
  923. '*****************************************
  924. ' ninuzzu's FLIPPER SHADOWS
  925. '*****************************************
  926.  
  927. sub FlipperTimer_Timer()
  928. FlipperLSh.RotZ = LeftFlipper.currentangle
  929. FlipperRSh.RotZ = RightFlipper.currentangle
  930. FlipperLSh1.RotZ = LeftFlipper1.currentangle
  931.  
  932. GateUp.RotZ = -(GateU.currentangle)
  933. DivPrim.RotZ = DivFlipper.currentangle
  934.  
  935. End Sub
  936.  
  937. '*****************************************
  938. ' ninuzzu's BALL SHADOW
  939. '*****************************************
  940. Dim BallShadow
  941. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  942.  
  943. 'Sub BallShadowUpdate_timer()
  944. Dim BOT, b
  945. BOT = GetBalls
  946. ' hide shadow of deleted balls
  947. If UBound(BOT)<(tnob-1) Then
  948. For b = (UBound(BOT) + 1) to (tnob-1)
  949. BallShadow(b).visible = 0
  950. Next
  951. End If
  952. ' exit the Sub if no balls on the table
  953. ' If UBound(BOT) = -1 Then Exit Sub
  954. ' render the shadow for each ball
  955. For b = 0 to UBound(BOT)
  956. If BOT(b).X < Table1.Width/2 Then
  957. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  958. Else
  959. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  960. End If
  961. ballShadow(b).Y = BOT(b).Y + 12
  962. If BOT(b).Z > 20 Then
  963. BallShadow(b).visible = 1
  964. Else
  965. BallShadow(b).visible = 0
  966. End If
  967. Next
  968. 'End Sub
  969.  
  970.  
  971.  
  972. '************************************
  973. ' What you need to add to your table
  974. '************************************
  975.  
  976. ' a timer called RollingTimer. With a fast interval, like 10
  977. ' one collision sound, in this script is called fx_collide
  978. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  979. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  980.  
  981.  
  982. '******************************************
  983. ' Explanation of the rolling sound routine
  984. '******************************************
  985.  
  986. ' sounds are played based on the ball speed and position
  987.  
  988. ' the routine checks first for deleted balls and stops the rolling sound.
  989.  
  990. ' The For loop goes through all the balls on the table and checks for the ball speed and
  991. ' if the ball is on the table (height lower than 30) then then it plays the sound
  992. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  993.  
  994. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  995. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  996. ' according to the position of the ball on the table.
  997.  
  998.  
  999. '**************************************
  1000. ' Explanation of the collision routine
  1001. '**************************************
  1002.  
  1003. ' The collision is built in VP.
  1004. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  1005. ' 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
  1006. ' depending of the speed of the collision.
  1007.  
  1008.  
  1009. Sub Pins_Hit (idx)
  1010. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1011. End Sub
  1012.  
  1013. Sub Targets_Hit (idx)
  1014. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1015. End Sub
  1016.  
  1017. Sub Metals_Thin_Hit (idx)
  1018. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1019. End Sub
  1020.  
  1021. Sub Metals_Medium_Hit (idx)
  1022. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1023. End Sub
  1024.  
  1025. Sub Metals2_Hit (idx)
  1026. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1027. End Sub
  1028.  
  1029. Sub Gates_Hit (idx)
  1030. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1031. End Sub
  1032.  
  1033. Sub Spinner_Spin
  1034. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  1035. End Sub
  1036.  
  1037. Sub Rubbers_Hit(idx)
  1038. dim finalspeed
  1039. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1040. If finalspeed > 20 then
  1041. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1042. End if
  1043. If finalspeed >= 6 AND finalspeed <= 20 then
  1044. RandomSoundRubber()
  1045. End If
  1046. End Sub
  1047.  
  1048. Sub Posts_Hit(idx)
  1049. dim finalspeed
  1050. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1051. If finalspeed > 16 then
  1052. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1053. End if
  1054. If finalspeed >= 6 AND finalspeed <= 16 then
  1055. RandomSoundRubber()
  1056. End If
  1057. End Sub
  1058.  
  1059. Sub RandomSoundRubber()
  1060. Select Case Int(Rnd*3)+1
  1061. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1062. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1063. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1064. End Select
  1065. End Sub
  1066.  
  1067. Sub LeftFlipper_Collide(parm)
  1068. RandomSoundFlipper()
  1069. End Sub
  1070.  
  1071. Sub RightFlipper_Collide(parm)
  1072. RandomSoundFlipper()
  1073. End Sub
  1074.  
  1075. Sub RandomSoundFlipper()
  1076. Select Case Int(Rnd*3)+1
  1077. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1078. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1079. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1080. End Select
  1081. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement