Outhere

The Witcher Siggi_1.0

Sep 2nd, 2020 (edited)
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '
  2. ' UpDated DOF Outhere 9-2-2020 -- Added soundFXF to silence solenoid sounds when selected in 10.6
  3. '
  4. Option Explicit
  5. Randomize
  6.  
  7.  
  8. On Error Resume Next
  9. ExecuteGlobal GetTextFile("controller.vbs")
  10. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  11. On Error Goto 0
  12.  
  13. Const cGameName="csmic_l1",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="fx_coin"'".weeh"
  14. Const Ballsize = 50
  15. Const BallMass = 1.6
  16.  
  17.  
  18.  
  19. LoadVPM "00990300", "S7.VBS", 2.21
  20. Dim DesktopMode: DesktopMode = Table1.ShowDT
  21.  
  22. If DesktopMode = True Then 'Show Desktop components
  23. Ramp16.visible=1
  24. Ramp15.visible=1
  25. Else
  26. Ramp16.visible=0
  27. Ramp15.visible=0
  28. End if
  29.  
  30. '*************************************************************
  31. 'Solenoid Call backs
  32. '**********************************************************************************************************
  33. SolCallback(1) = "bsTrough.SolIn"
  34. SolCallback(2) = "bsTrough.SolOut"
  35. SolCallback(3) = "bsSaucerT.SolOut"
  36. SolCallback(4) = "bsSaucerB.SolOut"
  37. SolCallback(5) = "dtL.SolDropUp"
  38. SolCallback(6) = "dtC.SolDropUp"
  39. SolCallback(7) = "dtR.SolDropUp"
  40. SolCallback(11) = "GILights"
  41. SolCallback(15) = "vpmSolSound Knocker,"
  42. SolCallback(5) = "dtL.SolDropUp"
  43. SolCallback(6) = "dtC.SolDropUp"
  44. SolCallback(7) = "dtR.SolDropUp"
  45. SolCallback(11) = "GILights"
  46. SolCallback(15) = "vpmSolSound Knocker,"
  47. 'SolCallback(25) = "sGameOn"
  48.  
  49. SolCallback(sLRFlipper) = "SolRFlipper"
  50. SolCallback(sLLFlipper) = "SolLFlipper"
  51.  
  52. Sub SolLFlipper(Enabled)
  53. If Enabled Then
  54. PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd
  55. Else
  56. PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart
  57. End If
  58. End Sub
  59.  
  60. Sub SolRFlipper(Enabled)
  61. If Enabled Then
  62. PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd
  63. Else
  64. PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart
  65. End If
  66. End Sub
  67.  
  68. '**********************************************************************************************************
  69.  
  70. 'Solenoid Controlled toys
  71. '**********************************************************************************************************
  72.  
  73. Sub GILights(Enabled)
  74. If Enabled Then
  75. dim xx
  76. For each xx in GI:xx.State = 0: Next
  77. Else
  78. For each xx in GI:xx.State = 1: Next
  79. End If
  80. End Sub
  81.  
  82. Sub sGameOn(Enabled)
  83. If Enabled Then
  84.  
  85. Else
  86.  
  87. End If
  88. End Sub
  89.  
  90.  
  91. '**********************************************************************************************************
  92.  
  93. 'MUSIC
  94. '**********************************************************************************************************
  95. Dim musicNum : Dim musicEnd
  96.  
  97. Sub music_hit()
  98.  
  99. If musicNum = 0 then PlayMusic "TW_01.mp3" End If
  100. If musicNum = 1 then PlayMusic "TW_02.mp3" End If
  101. If musicNum = 2 then PlayMusic "TW_03.mp3" End If
  102. If musicNum = 3 then PlayMusic "TW_04.mp3" End If
  103. If musicNum = 4 then PlayMusic "TW_05.mp3" End If
  104. If musicNum = 5 then PlayMusic "TW_06.mp3" End If
  105. If musicNum = 6 then PlayMusic "TW_07.mp3" End If
  106. If musicNum = 7 then PlayMusic "TW_08.mp3" End If
  107. If musicNum = 8 then PlayMusic "TW_09.mp3" End If
  108. If musicNum = 9 then PlayMusic "TW_10.mp3" End If
  109.  
  110.  
  111. musicNum = (musicNum + 1) mod 10
  112. End Sub
  113.  
  114. Sub table1_MusicDone
  115. music_hit
  116. End Sub
  117.  
  118.  
  119. '**********************************************************************************************************
  120.  
  121. 'Initiate Table
  122. '**********************************************************************************************************
  123. Dim bsTrough, dtL, dtC, dtR, bsSaucerT, bsSaucerB
  124.  
  125. PlaySound ".weeh"
  126.  
  127. Sub Table1_Init
  128. vpmInit Me
  129. On Error Resume Next
  130. With Controller
  131. .GameName = cGameName
  132. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  133. .SplashInfoLine = "Cosmic GunFight (Williams)"&chr(13)&"You Suck"
  134. .HandleMechanics=0
  135. .HandleKeyboard=0
  136. .ShowDMDOnly=1
  137. .ShowFrame=0
  138. .ShowTitle=0
  139. .hidden = 0
  140. .Games(cGameName).Settings.Value("sound") = 0
  141. If Err Then MsgBox Err.Description
  142. End With
  143. On Error Goto 0
  144. Controller.SolMask(0)=0
  145. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  146. Controller.Run
  147. If Err Then MsgBox Err.Description
  148. On Error Goto 0
  149.  
  150.  
  151. PinMAMETimer.Interval=PinMAMEInterval
  152. PinMAMETimer.Enabled=1
  153.  
  154. vpmNudge.TiltSwitch=swTilt
  155. vpmNudge.Sensitivity=5
  156. vpmNudge.TiltObj = Array(Bumper1,Bumper2,Bumper3,Bumper4,LeftSlingshot,RightSlingshot)
  157.  
  158. Set bsTrough=New cvpmBallstack
  159. bsTrough.InitSw 29,27,28,0,0,0,0,0
  160. bsTrough.InitKick BallRelease,90,4
  161. bsTrough.InitExitSnd "ballrelease","solon"
  162. bsTrough.Balls=2
  163.  
  164. Set bsSaucerT = New cvpmBallStack
  165. bsSaucerT.InitSaucer sw25,25,89,10
  166. bsSaucerT.KickForceVar = 6
  167. bsSaucerT.InitExitSnd "popper_ball",""
  168.  
  169.  
  170. Set bsSaucerB = New cvpmBallStack
  171. bsSaucerB.InitSaucer sw26,26,90,12
  172. bsSaucerB.KickForceVar = 4
  173. bsSaucerB.InitExitSnd "popper_ball",""
  174.  
  175.  
  176. Set dtL=New cvpmDropTarget
  177. dtL.InitDrop Array(sw40,sw41,sw42),Array(40,41,42)
  178. dtL.InitSnd "DTDrop","DTReset"
  179.  
  180. Set dtC=New cvpmDropTarget
  181. dtC.InitDrop Array(sw43,sw44,sw45),Array(43,44,45)
  182. dtC.InitSnd "DTDrop","DTReset"
  183.  
  184. Set dtR=New cvpmDropTarget
  185. dtR.InitDrop Array(sw46,sw47,sw48),Array(46,47,48)
  186. dtR.InitSnd "DTDrop","DTReset"
  187.  
  188. End Sub
  189.  
  190. '**********************************************************************************************************
  191. 'Plunger code
  192. '**********************************************************************************************************
  193.  
  194. Sub Table1_KeyDown(ByVal KeyCode)
  195. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  196. If keycode = LeftFlipperKey then controller.switch(52)=1
  197. If keycode = RightFlipperKey then controller.switch(49)=1
  198. If keycode = 5 Then PlaySound ".hey":PlaySound "fx_coin"
  199. If keycode = 4 Then PlaySound ".hey":PlaySound "fx_coin"
  200. If keycode = 6 Then PlaySound ".hey":PlaySound "fx_coin"
  201. If keycode = 2 Then PlaySound ".heykurz"
  202. If keycode = RightMagnaSave Then music_hit
  203. If keycode = LeftMagnaSave Then PlaySound ".tw2" :EndMusic
  204. If vpmKeyDown(keycode)Then Exit Sub
  205. End Sub
  206.  
  207. Sub Table1_KeyUp(ByVal KeyCode)
  208. If vpmKeyUp(keycode)Then Exit Sub
  209. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  210. If keycode = LeftFlipperKey then controller.switch(52)=0
  211. If keycode = RightFlipperKey then controller.switch(49)=0
  212.  
  213. End Sub
  214.  
  215.  
  216. '**********************************************************************************************************
  217. ' Drain hole and kickers
  218.  
  219.  
  220. Sub Drain_Hit
  221. playsound"drain"
  222. If l15.State Then PlaySound ".acting"
  223. If l16.State Then PlaySound ".tr-magiclight"
  224. If l17.State Then PlaySound ".dogslive"
  225. If l18.State Then PlaySound ".stop"
  226. If l19.State Then PlaySound ".pissoff"
  227. bsTrough.addball me
  228. End Sub
  229.  
  230. Sub sw25_Hit
  231. bsSaucerT.AddBall Me
  232. PlaySound "kicker_enter_left"
  233. If l25.State Then PlaySound ".locked"
  234. End Sub
  235.  
  236. Sub sw26_Hit
  237. bsSaucerB.AddBall Me
  238. PlaySound "kicker_enter_left"
  239. If l26.State Then PlaySound ".locked"
  240. End Sub
  241.  
  242. Sub sw26a_Hit
  243. bsSaucerB.AddBall Me
  244. PlaySound "kicker_enter_left"
  245. If l26.State Then PlaySound ".locked"
  246. End Sub
  247.  
  248.  
  249. Sub KickerA_Hit:
  250. playsound".wusch"
  251. me.DestroyBall
  252. Me.TimerEnabled = 1
  253. End Sub
  254.  
  255. Sub KickerA_Timer
  256. KickerB.CreateBall :
  257. KickerB.Kick -90,15
  258. Me.Timerenabled = 0
  259. End Sub
  260.  
  261.  
  262. 'Wire Triggers
  263.  
  264.  
  265. Sub sw9_Hit:Controller.Switch(9) = 1
  266. PlaySound "rollover"
  267. If l9.State = 0 Then PlaySound ".tr-time"
  268. If l9.State Then PlaySound ".tr-terible"
  269. End Sub
  270. Sub sw9_unHit:Controller.Switch(9)=0:End Sub
  271.  
  272.  
  273. Sub sw9a_Hit:Controller.Switch(9)=1
  274. If l9a.State = 0 Then PlaySound ".shit"
  275. If l9a.State Then PlaySound ".leave"
  276. End Sub
  277. Sub sw9a_unHit:Controller.Switch(9)=0:End Sub
  278.  
  279.  
  280. Sub sw10_Hit:Controller.Switch(10) = 1
  281. PlaySound "rollover"
  282. If l10.State = 0 Then PlaySound ".tr-though"
  283. If l10.State Then PlaySound ".tr-terible"
  284. End Sub
  285. Sub sw10_unHit:Controller.Switch(10)=0 : End Sub
  286.  
  287.  
  288. Sub sw10a_Hit:Controller.Switch(10) = 1
  289. PlaySound "rollover"
  290. If l10.State = 0 Then PlaySound ".tr-bedroom"
  291. If l10.State Then PlaySound ".damnit"
  292. End Sub
  293. Sub sw10a_unHit:Controller.Switch(10)=0:End Sub
  294.  
  295.  
  296. Sub sw11_Hit:Controller.Switch(11) = 1
  297. PlaySound "rollover"
  298. If l11.State = 0 Then PlaySound ".jov-magic"
  299. If l11.State Then PlaySound ".inlane"
  300. End Sub
  301. Sub sw11_unHit:Controller.Switch(11)=0:End Sub
  302.  
  303.  
  304. Sub sw12_Hit:Controller.Switch(12) = 1
  305. PlaySound "rollover"
  306. If l12.State = 0 Then PlaySound ".trinking"
  307. If l12.State Then PlaySound ".inlane"
  308. End Sub
  309. Sub sw12_unHit:Controller.Switch(12)=0:End Sub
  310.  
  311.  
  312. Sub sw13_Hit:Controller.Switch(13) = 1
  313. PlaySound "rollover"
  314. If l13.State = 0 Then PlaySound ".jov-well"
  315. If l13.State Then PlaySound ".inlane"
  316. End Sub
  317. Sub sw13_unHit:Controller.Switch(13)=0:End Sub
  318.  
  319.  
  320. Sub sw14_Hit:Controller.Switch(14) = 1
  321. PlaySound "rollover"
  322. If l15.State Then PlaySound ".hereagain"
  323. If l16.State Then PlaySound ".geraldw"
  324. If l17.State Then PlaySound ".free"
  325. If l18.State Then PlaySound ".trouble"
  326. If l19.State Then PlaySound ".broom"
  327. End Sub
  328. Sub sw14_unHit:Controller.Switch(14)=0:End Sub
  329.  
  330.  
  331. Sub sw15_Hit:Controller.Switch(34) = 1
  332. If l14.State Then PlaySound ".achm"
  333. If l14.State = 0 Then PlaySound ".cut"
  334. End Sub
  335. Sub sw15_unHit:Controller.Switch(34) = 0 :End Sub
  336.  
  337.  
  338.  
  339. Sub sw31_Hit:Controller.Switch(31)=1 : playsound"rollover" : End Sub
  340. Sub sw31_unHit:Controller.Switch(31)= 0:End Sub
  341.  
  342.  
  343. Sub sw32_Hit:Controller.Switch(13) = 1
  344. PlaySound "rollover"
  345. If l13a.State = 0 Then PlaySound ".accident"
  346. If l13a.State Then PlaySound ".woman"
  347. End Sub
  348. Sub sw32_unHit:Controller.Switch(13)= 0:End Sub
  349.  
  350.  
  351. Sub sw38_Hit:Controller.Switch(38) = 1
  352. If l14.State = 0 Then PlaySound ".witcher"
  353. If l14.State Then PlaySound ".triss"
  354. If l27.State Then PlaySound ".extraballc"
  355. End Sub
  356. Sub sw38_unHit:Controller.Switch(38)= 0:End Sub
  357.  
  358.  
  359. Sub sw39_Hit:Controller.Switch(11) = 1
  360. PlaySound "rollover"
  361. If l11.State = 0 Then PlaySound ".jov-book"
  362. If l11.State Then PlaySound ".inlane"
  363. End Sub
  364. Sub sw39_unHit:Controller.Switch(11)= 0:End Sub
  365.  
  366.  
  367. Sub sw51_Hit:Controller.Switch(51)=1
  368. If l1.State Then PlaySound ".shootagain"
  369. If l8.State Then PlaySound ".last"
  370. End Sub
  371. Sub sw51_unHit:Controller.Switch(51)= 0: End Sub
  372.  
  373.  
  374. Sub triss_Hit:
  375. If l28.State Then PlaySound ".tr-pleasure"
  376. If l29.State Then PlaySound ".tr-stay"
  377. If l30.State Then PlaySound ".tr-perhaps"
  378. If l31.State Then PlaySound ".tr-missed"
  379. If l32.State Then PlaySound ".tr-bestbed"
  380. End Sub
  381.  
  382.  
  383. Sub EB_Hit:
  384. If l27.State Then PlaySound ".extraballlit"
  385. End Sub
  386.  
  387.  
  388. Sub SkillShot_Hit:
  389. Controller.Switch(33) = 1
  390. Controller.Switch(34) = 1
  391. Controller.Switch(35) = 1
  392. If l27.State = 0 Then PlaySound ".tr-job"
  393. If l27.State Then PlaySound ".extraballc"
  394. End Sub
  395.  
  396.  
  397. Sub SkillShot_unHit:
  398. Controller.Switch(33) = 0
  399. Controller.Switch(34) = 0
  400. Controller.Switch(35) = 0
  401. End Sub
  402.  
  403. 'Scoring Rubbers
  404. 'Sub sw15_Hit : vpmTimer.PulseSw(15) : playsound".switch":End Sub
  405. Sub sw18_Hit : vpmTimer.PulseSw(18) : playsound".switch2":End Sub
  406. Sub sw19_Hit : vpmTimer.PulseSw(19) : playsound".switch3":End Sub
  407. Sub sw20_Hit : vpmTimer.PulseSw(20) : playsound".switch3":End Sub
  408.  
  409. Sub sw50_Hit : Controller.Switch(50)= 1 : playsound".switch2":End Sub
  410. Sub sw50_unHit: Controller.Switch(50)= 0 : End Sub
  411.  
  412.  
  413. 'Stand Up Targets
  414. Sub sw33_Hit
  415. vpmTimer.PulseSw(33)
  416. playsound".targethit"
  417. If l33.State Then If l36.State = 0 Then PlaySound ".hell"
  418. If l34.State Then If l39.State = 0 Then PlaySound ".gold"
  419. If l35.State Then If l42.State = 0 Then PlaySound ".here"
  420. End Sub
  421.  
  422.  
  423. Sub sw34_Hit
  424. vpmTimer.PulseSw(34)
  425. playsound".targethit"
  426. If l33.State Then If l37.State = 0 Then PlaySound ".hell"
  427. If l34.State Then If l40.State = 0 Then PlaySound ".gold"
  428. If l35.State Then If l43.State = 0 Then PlaySound ".here"
  429. End Sub
  430.  
  431. Sub sw35_Hit
  432. vpmTimer.PulseSw(35)
  433. playsound".targethit"
  434. If l33.State Then If l38.State = 0 Then PlaySound ".hell"
  435. If l34.State Then If l41.State = 0 Then PlaySound ".gold"
  436. If l35.State Then If l44.State = 0 Then PlaySound ".here"
  437. End Sub
  438.  
  439.  
  440. 'Drop Targets
  441. Sub Sw40_Dropped:dtL.Hit 1 : PlaySound ".ww1":End Sub
  442. Sub Sw41_Dropped:dtL.Hit 2 : PlaySound ".ww2":End Sub
  443. Sub Sw42_Dropped:dtL.Hit 3 : PlaySound ".ww3":End Sub
  444.  
  445. Sub Sw43_Dropped:dtC.Hit 1 : PlaySound ".lesh1":End Sub
  446. Sub Sw44_Dropped:dtC.Hit 2 : PlaySound ".lesh2":End Sub
  447. Sub Sw45_Dropped:dtC.Hit 3 : PlaySound ".lesh3":End Sub
  448.  
  449. Sub Sw46_Dropped:dtR.Hit 1 : PlaySound ".striga":End Sub
  450. Sub Sw47_Dropped:dtR.Hit 2 : PlaySound ".striga2":End Sub
  451. Sub Sw48_Dropped:dtR.Hit 3 : PlaySound ".striga3":End Sub
  452.  
  453. 'Bumpers
  454. Sub Bumper1_Hit : vpmTimer.PulseSw 21 : Playsound SoundFX("fx_bumper1",DOFContactors): playsound".sword2":End Sub
  455. Sub Bumper2_Hit : vpmTimer.PulseSw 22 : playsound SoundFX("fx_bumper1",DOFContactors): playsound".sword":End Sub
  456. Sub Bumper3_Hit : vpmTimer.PulseSw 24 : playsound SoundFX("fx_bumper1",DOFContactors): playsound".bumper3":End Sub
  457. Sub Bumper4_Hit : vpmTimer.PulseSw 23 : playsound SoundFX("fx_bumper1",DOFContactors): playsound".bumper3":End Sub
  458.  
  459.  
  460. Sub MusicStop_Timer()
  461.  
  462. If l5.state = 1 Then EndMusic
  463. If l3.state = 1 Then EndMusic
  464.  
  465. End Sub
  466.  
  467.  
  468. Sub Switch_Timer()
  469.  
  470. If l14.state = 1 Then l14b.state = 0
  471. If l14.state = 0 Then l14b.state = 1
  472. If l64.state = 1 Then l14b.state = 0
  473.  
  474. End Sub
  475.  
  476.  
  477. '***************************************************
  478. ' JP's VP10 Fading Lamps & Flashers
  479. ' Based on PD's Fading Light System
  480. ' SetLamp 0 is Off
  481. ' SetLamp 1 is On
  482. ' fading for non opacity objects is 4 steps
  483. '***************************************************
  484.  
  485. Dim LampState(200), FadingLevel(200)
  486. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  487.  
  488. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  489. LampTimer.Interval = 5 'lamp fading speed
  490. LampTimer.Enabled = 1
  491.  
  492. ' Lamp & Flasher Timers
  493.  
  494. Sub LampTimer_Timer()
  495. Dim chgLamp, num, chg, ii
  496. chgLamp = Controller.ChangedLamps
  497. If Not IsEmpty(chgLamp) Then
  498. For ii = 0 To UBound(chgLamp)
  499. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  500. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  501. Next
  502. End If
  503. UpdateLamps
  504. End Sub
  505.  
  506. Sub UpdateLamps
  507.  
  508. NFadeL 1, l1
  509. NFadeL 3, l3
  510. NFadeL 5, l5
  511. NFadeL 7, l7
  512. NFadeL 8, l8
  513. NFadeLm 9, l9
  514. NFadeL 9, l9a
  515. NFadeLm 10, l10
  516. NFadeL 10, l10a
  517. NFadeLm 11, l11
  518. NFadeL 11, l11a
  519. NFadeL 12, l12
  520. NFadeLm 13, l13
  521. NFadeL 13, l13a
  522. NFadeLm 14, l14
  523. NFadeL 14, l14a
  524. NFadeL 15, l15
  525. NFadeL 16, l16
  526. NFadeL 17, l17
  527. NFadeL 18, l18
  528. NFadeL 19, l19
  529. NFadeL 20, l20
  530. NFadeL 21, l21
  531. NFadeL 22, l22
  532. NFadeL 23, l23
  533. NFadeL 24, l24
  534. NFadeL 25, l25
  535. NFadeLm 26, l26a
  536. NFadeL 26, l26
  537. NFadeLm 27, l27
  538. NFadeL 27, l27a
  539. NFadeL 28, l28
  540. NFadeL 29, l29
  541. NFadeL 30, l30
  542. NFadeL 31, l31
  543. NFadeL 32, l32
  544. NFadeL 33, l33
  545. NFadeL 34, l34
  546. NFadeL 35, l35
  547. NFadeL 36, l36
  548. NFadeL 37, l37
  549. NFadeL 38, l38
  550. NFadeL 39, l39
  551. NFadeL 40, l40
  552. NFadeL 41, l41
  553. NFadeL 42, l42
  554. NFadeL 43, l43
  555. NFadeL 44, l44
  556. NFadeL 49, l49
  557. NFadeL 50, l50
  558. NFadeL 51, l51
  559. NFadeL 52, l52
  560. NFadeL 53, l53
  561. NFadeL 54, l54
  562. NFadeL 55, l55
  563. NFadeL 56, l56
  564. NFadeL 57, l57
  565. NFadeL 58, l58
  566. NFadeL 59, l59
  567. NFadeL 60, l60
  568. NFadeL 61, l61
  569. NFadeL 62, l62
  570. NFadeL 63, l63
  571. NFadeL 64, l64
  572.  
  573. End Sub
  574.  
  575.  
  576. ' div lamp subs
  577.  
  578. Sub InitLamps()
  579. Dim x
  580. For x = 0 to 200
  581. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  582. FadingLevel(x) = 4 ' used to track the fading state
  583. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  584. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  585. FlashMax(x) = 1 ' the maximum value when on, usually 1
  586. FlashMin(x) = 0 ' the minimum value when off, usually 0
  587. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  588. Next
  589. End Sub
  590.  
  591. Sub AllLampsOff
  592. Dim x
  593. For x = 0 to 200
  594. SetLamp x, 0
  595. Next
  596. End Sub
  597.  
  598. Sub SetLamp(nr, value)
  599. If value <> LampState(nr) Then
  600. LampState(nr) = abs(value)
  601. FadingLevel(nr) = abs(value) + 4
  602. End If
  603. End Sub
  604.  
  605. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  606.  
  607. Sub NFadeL(nr, object)
  608. Select Case FadingLevel(nr)
  609. Case 4:object.state = 0:FadingLevel(nr) = 0
  610. Case 5:object.state = 1:FadingLevel(nr) = 1
  611. End Select
  612. End Sub
  613.  
  614. Sub NFadeLm(nr, object) ' used for multiple lights
  615. Select Case FadingLevel(nr)
  616. Case 4:object.state = 0
  617. Case 5:object.state = 1
  618. End Select
  619. End Sub
  620.  
  621. 'Lights, Ramps & Primitives used as 4 step fading lights
  622. 'a,b,c,d are the images used from on to off
  623.  
  624. Sub FadeObj(nr, object, a, b, c, d)
  625. Select Case FadingLevel(nr)
  626. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  627. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  628. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  629. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  630. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  631. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  632. End Select
  633. End Sub
  634.  
  635. Sub FadeObjm(nr, object, a, b, c, d)
  636. Select Case FadingLevel(nr)
  637. Case 4:object.image = b
  638. Case 5:object.image = a
  639. Case 9:object.image = c
  640. Case 13:object.image = d
  641. End Select
  642. End Sub
  643.  
  644. Sub NFadeObj(nr, object, a, b)
  645. Select Case FadingLevel(nr)
  646. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  647. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  648. End Select
  649. End Sub
  650.  
  651. Sub NFadeObjm(nr, object, a, b)
  652. Select Case FadingLevel(nr)
  653. Case 4:object.image = b
  654. Case 5:object.image = a
  655. End Select
  656. End Sub
  657.  
  658. ' Flasher objects
  659.  
  660. Sub Flash(nr, object)
  661. Select Case FadingLevel(nr)
  662. Case 4 'off
  663. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  664. If FlashLevel(nr) < FlashMin(nr) Then
  665. FlashLevel(nr) = FlashMin(nr)
  666. FadingLevel(nr) = 0 'completely off
  667. End if
  668. Object.IntensityScale = FlashLevel(nr)
  669. Case 5 ' on
  670. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  671. If FlashLevel(nr) > FlashMax(nr) Then
  672. FlashLevel(nr) = FlashMax(nr)
  673. FadingLevel(nr) = 1 'completely on
  674. End if
  675. Object.IntensityScale = FlashLevel(nr)
  676. End Select
  677. End Sub
  678.  
  679. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  680. Object.IntensityScale = FlashLevel(nr)
  681. End Sub
  682.  
  683.  
  684. '**********************************************************************************************************
  685. 'Digital Display
  686. '**********************************************************************************************************
  687. Dim Digits(32)
  688.  
  689. ' 1st Player
  690. Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
  691. Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
  692. Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
  693. Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
  694. Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
  695. Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
  696. Digits(6) = Array(LED70,LED71,LED72,LED73,LED74,LED75,LED76)
  697.  
  698. ' 2nd Player
  699. Digits(7) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
  700. Digits(8) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
  701. Digits(9) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
  702. Digits(10) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
  703. Digits(11) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
  704. Digits(12) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
  705. Digits(13) = Array(LED140,LED141,LED142,LED143,LED144,LED145,LED146)
  706.  
  707. ' 3rd Player
  708. Digits(14) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
  709. Digits(15) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
  710. Digits(16) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
  711. Digits(17) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
  712. Digits(18) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
  713. Digits(19) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
  714. Digits(20) = Array(LED210,LED211,LED212,LED213,LED214,LED215,LED216)
  715.  
  716. ' 4th Player
  717. Digits(21) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
  718. Digits(22) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
  719. Digits(23) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
  720. Digits(24) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
  721. Digits(25) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
  722. Digits(26) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
  723. Digits(27) = Array(LED280,LED281,LED282,LED283,LED284,LED285,LED286)
  724.  
  725. ' Credits
  726. Digits(28) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)
  727. Digits(29) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17)
  728. ' Balls
  729. Digits(30) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38)
  730. Digits(31) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59)
  731.  
  732. Sub DisplayTimer_Timer
  733. Dim ChgLED,ii,num,chg,stat,obj
  734. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  735. If Not IsEmpty(ChgLED) Then
  736. If DesktopMode = True Then
  737. For ii = 0 To UBound(chgLED)
  738. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  739. if (num < 32) then
  740. For Each obj In Digits(num)
  741. If chg And 1 Then obj.State = stat And 1
  742. chg = chg\2 : stat = stat\2
  743. Next
  744. else
  745. end if
  746. next
  747. end if
  748. end if
  749. End Sub
  750.  
  751. ' ********************************************************************************************************************************
  752. ' ********************************************************************************************************************************
  753. 'Start of VPX Call Back Functions
  754. ' ********************************************************************************************************************************
  755. ' ********************************************************************************************************************************
  756.  
  757.  
  758.  
  759. '**********Sling Shot Animations
  760. ' Rstep and Lstep are the variables that increment the animation
  761. '****************
  762. Dim RStep, Lstep
  763.  
  764. Sub RightSlingShot_Slingshot
  765. vpmTimer.PulseSw 37
  766. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  767. PlaySound ".sword"
  768. RSling.Visible = 0
  769. RSling1.Visible = 1
  770. sling1.TransZ = -20
  771. RStep = 0
  772. RightSlingShot.TimerEnabled = 1
  773. End Sub
  774.  
  775. Sub RightSlingShot_Timer
  776. Select Case RStep
  777. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  778. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  779. End Select
  780. RStep = RStep + 1
  781. End Sub
  782.  
  783. Sub LeftSlingShot_Slingshot
  784. vpmTimer.PulseSw 36
  785. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  786. PlaySound ".sword"
  787. LSling.Visible = 0
  788. LSling1.Visible = 1
  789. sling2.TransZ = -20
  790. LStep = 0
  791. LeftSlingShot.TimerEnabled = 1
  792. End Sub
  793.  
  794. Sub LeftSlingShot_Timer
  795. Select Case LStep
  796. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  797. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  798. End Select
  799. LStep = LStep + 1
  800. End Sub
  801.  
  802.  
  803.  
  804. ' *********************************************************************
  805. ' Supporting Ball & Sound Functions
  806. ' *********************************************************************
  807.  
  808. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  809. Vol = Csng(BallVel(ball) ^2 / 2000)
  810. End Function
  811.  
  812. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  813. Dim tmp
  814. tmp = ball.x * 2 / table1.width-1
  815. If tmp > 0 Then
  816. Pan = Csng(tmp ^10)
  817. Else
  818. Pan = Csng(-((- tmp) ^10) )
  819. End If
  820. End Function
  821.  
  822. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  823. Pitch = BallVel(ball) * 20
  824. End Function
  825.  
  826. Function BallVel(ball) 'Calculates the ball speed
  827. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  828. End Function
  829.  
  830. '*****************************************
  831. ' JP's VP10 Rolling Sounds
  832. '*****************************************
  833.  
  834. Const tnob = 5 ' total number of balls
  835. ReDim rolling(tnob)
  836. InitRolling
  837.  
  838. Sub InitRolling
  839. Dim i
  840. For i = 0 to tnob
  841. rolling(i) = False
  842. Next
  843. End Sub
  844.  
  845. Sub RollingTimer_Timer()
  846. Dim BOT, b
  847. BOT = GetBalls
  848.  
  849. ' stop the sound of deleted balls
  850. For b = UBound(BOT) + 1 to tnob
  851. rolling(b) = False
  852. StopSound("fx_ballrolling" & b)
  853. Next
  854.  
  855. ' exit the sub if no balls on the table
  856. If UBound(BOT) = -1 Then Exit Sub
  857.  
  858. ' play the rolling sound for each ball
  859. For b = 0 to UBound(BOT)
  860. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  861. rolling(b) = True
  862. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  863. Else
  864. If rolling(b) = True Then
  865. StopSound("fx_ballrolling" & b)
  866. rolling(b) = False
  867. End If
  868. End If
  869. Next
  870. End Sub
  871.  
  872. '**********************
  873. ' Ball Collision Sound
  874. '**********************
  875.  
  876. Sub OnBallBallCollision(ball1, ball2, velocity)
  877. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  878. End Sub
  879.  
  880.  
  881.  
  882. '************************************
  883. ' What you need to add to your table
  884. '************************************
  885.  
  886. ' a timer called RollingTimer. With a fast interval, like 10
  887. ' one collision sound, in this script is called fx_collide
  888. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  889. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  890.  
  891.  
  892. '******************************************
  893. ' Explanation of the rolling sound routine
  894. '******************************************
  895.  
  896. ' sounds are played based on the ball speed and position
  897.  
  898. ' the routine checks first for deleted balls and stops the rolling sound.
  899.  
  900. ' The For loop goes through all the balls on the table and checks for the ball speed and
  901. ' if the ball is on the table (height lower than 30) then then it plays the sound
  902. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  903.  
  904. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  905. ' will change according to the ball speed, and the PAN function will change the stereo position according
  906. ' to the position of the ball on the table.
  907.  
  908.  
  909. '**************************************
  910. ' Explanation of the collision routine
  911. '**************************************
  912.  
  913. ' The collision is built in VP.
  914. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  915. ' 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
  916. ' depending of the speed of the collision.
  917.  
  918.  
  919. Sub Pins_Hit (idx)
  920. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  921. End Sub
  922.  
  923. Sub Targets_Hit (idx)
  924. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  925. End Sub
  926.  
  927. Sub Metals_Thin_Hit (idx)
  928. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  929. End Sub
  930.  
  931. Sub Metals_Medium_Hit (idx)
  932. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  933. End Sub
  934.  
  935. Sub Metals2_Hit (idx)
  936. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  937. End Sub
  938.  
  939. Sub Gates_Hit (idx)
  940. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  941. End Sub
  942.  
  943. Sub Spinner_Spin
  944. PlaySound "fx_spinner",0,.25,0,0.25
  945. End Sub
  946.  
  947. Sub Rubbers_Hit(idx)
  948. dim finalspeed
  949. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  950. If finalspeed > 20 then
  951. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  952. End if
  953. If finalspeed >= 6 AND finalspeed <= 20 then
  954. RandomSoundRubber()
  955. End If
  956. End Sub
  957.  
  958. Sub Posts_Hit(idx)
  959. dim finalspeed
  960. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  961. If finalspeed > 16 then
  962. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  963. End if
  964. If finalspeed >= 6 AND finalspeed <= 16 then
  965. RandomSoundRubber()
  966. End If
  967. End Sub
  968.  
  969. Sub RandomSoundRubber()
  970. Select Case Int(Rnd*3)+1
  971. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  972. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  973. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  974. End Select
  975. End Sub
  976.  
  977. Sub LeftFlipper_Collide(parm)
  978. RandomSoundFlipper()
  979. End Sub
  980.  
  981. Sub RightFlipper_Collide(parm)
  982. RandomSoundFlipper()
  983. End Sub
  984.  
  985. Sub RandomSoundFlipper()
  986. Select Case Int(Rnd*3)+1
  987. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  988. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  989. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  990. End Select
  991. End Sub
  992.  
  993. Sub Table1_Exit():Controller.Games(cGameName).Settings.Value("sound")=1:Controller.Stop:End Sub
RAW Paste Data