Arngrim

split second

Jul 16th, 2021
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.76 KB | None | 0 0
  1. ' Split Second / IPD No. 2297 / Stern August, 1981 / 4 Players
  2. ' vpinmame script based on destruk's script
  3. ' Dip switch menu by inkochnito
  4.  
  5. Option Explicit
  6. Randomize
  7.  
  8. ' Physics 3.0.1
  9. Const BallSize = 50
  10. Const BallMass = 1.7
  11.  
  12. On Error Resume Next
  13. ExecuteGlobal GetTextFile("controller.vbs")
  14. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  15. On Error Goto 0
  16.  
  17. Dim bsTrough, dtT, dtR, dtR2, bsLock, x
  18.  
  19. Const cGameName = "splitsec"
  20.  
  21. Dim VarHidden
  22. If Table1.ShowDT = true then
  23. VarHidden = 1
  24. For each x in aReels: x.Visible = 1: Next
  25. Else
  26. VarHidden = 0
  27. For each x in aReels: x.Visible = 0: Next
  28. End If
  29.  
  30. if B2SOn = true then
  31. VarHidden = 1
  32. For each x in aReels: x.Visible = 0: Next
  33. End If
  34.  
  35. LoadVPM "01210000", "STERN.VBS", 3.1
  36.  
  37. '********************
  38. 'Standard definitions
  39. '********************
  40.  
  41. Const UseSolenoids = 2
  42. Const UseLamps = 1
  43. Const UseGI = 0
  44. Const UseSync = 0
  45. Const HandleMech = 0
  46.  
  47. ' Standard Sounds
  48. Const SSolenoidOn = "fx_SolenoidOn"
  49. Const SSolenoidOff = "fx_SolenoidOff"
  50. Const SCoin = "fx_Coin"
  51.  
  52. '************
  53. ' Table init.
  54. '************
  55.  
  56. Sub table1_Init
  57. vpmInit me
  58. With Controller
  59. .GameName = cGameName
  60. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description:Exit Sub
  61. .SplashInfoLine = "Split Second, Stern 1980" & vbNewLine & "VPX table by JPSalas 1.0.0"
  62. .HandleKeyboard = 0
  63. .ShowTitle = 0
  64. .ShowDMDOnly = 1
  65. .ShowFrame = 0
  66. .HandleMechanics = 0
  67. .Hidden = VarHidden
  68. .Games(cGameName).Settings.Value("rol") = 0
  69. '.SetDisplayPosition 0,0,GetPlayerHWnd 'uncomment if you can't see the dmd
  70. On Error Resume Next
  71. Controller.SolMask(0) = 0
  72. vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the Timer to renable all the solenoids after 2 seconds
  73. Controller.Run GetPlayerHWnd
  74. On Error Goto 0
  75. End With
  76.  
  77. ' Nudging
  78. vpmNudge.TiltSwitch = 7
  79. vpmNudge.Sensitivity = 3
  80. vpmNudge.TiltObj = Array(Bumper001, Bumper002, LeftSlingshot, RightSlingshot)
  81.  
  82. ' Trough
  83. Set bsTrough = New cvpmBallStack
  84. With bsTrough
  85. .InitSw 4, 33, 34, 35, 0, 0, 0, 0
  86. .InitKick BallRelease, 90, 4
  87. .InitExitSnd SoundFX("fx_ballrel", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
  88. .Balls = 3
  89. .IsTrough = 1
  90. End With
  91.  
  92. ' Saucer
  93. Set bsLock = New cvpmBallStack
  94. With bsLock
  95. .InitSaucer Kicker1, 36, 270, 5
  96. .InitExitSnd SoundFX("fx_kicker", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
  97. .KickForceVar = 2
  98. .KickAngleVar = 2
  99. End With
  100.  
  101. ' Drop targets
  102. Set dtT = New cvpmDropTarget
  103. With dtT
  104. .InitDrop Array(TargetT1, TargetT2, TargetT3, TargetT4, TargetT5), Array(28, 29, 30, 31, 32)
  105. .InitSnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  106. .CreateEvents "dtT"
  107. End With
  108.  
  109. Set dtR = New cvpmDropTarget
  110. With dtR
  111. .InitDrop Array(TargetM1, TargetM2, TargetM3), Array(25, 26, 27)
  112. .InitSnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  113. .CreateEvents "dtR"
  114. End With
  115.  
  116. Set dtR2 = New cvpmDropTarget
  117. With dtR2
  118. .InitDrop Array(TargetR1, TargetR2, TargetR3), Array(17, 18, 19)
  119. .InitSnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  120. .CreateEvents "dtR2"
  121. End With
  122.  
  123. ' Main Timer init
  124. PinMAMETimer.Interval = PinMAMEInterval
  125. PinMAMETimer.Enabled = 1
  126. RealTime.Enabled = 1
  127. UpdateLeds.Enabled = 1
  128.  
  129. vpmMapLights AllLights
  130.  
  131. ' Turn on Gi
  132. vpmtimer.addtimer 1500, "GiOn '"
  133.  
  134. LoadLUT
  135. End Sub
  136.  
  137. '*****************
  138. ' Gi Effects
  139. '*****************
  140.  
  141. Dim OldGiState
  142. OldGiState = -1 'start witht he Gi off
  143.  
  144. Sub GiON
  145. For each x in aGiLights
  146. x.State = 1
  147. Next
  148. End Sub
  149.  
  150. Sub GiOFF
  151. For each x in aGiLights
  152. x.State = 0
  153. Next
  154. End Sub
  155.  
  156. Sub GiEffect(value) ' value is the duration of the blink
  157. For each x in aGiLights
  158. x.Duration 2, 500 * value, 1
  159. Next
  160. End Sub
  161.  
  162. Sub GIUpdate
  163. Dim tmp, obj
  164. tmp = Getballs
  165. If UBound(tmp) <> OldGiState Then
  166. OldGiState = Ubound(tmp)
  167. If UBound(tmp) = -1 Then
  168. GiOff
  169. Else
  170. GiOn
  171. End If
  172. End If
  173. End Sub
  174.  
  175. '*************************
  176. ' GI - needs new vpinmame
  177. '*************************
  178.  
  179. Set GICallback = GetRef("GIUpdate")
  180.  
  181. Sub GIUpdate(no, Enabled)
  182. For each x in aGiLights
  183. x.State = ABS(Enabled)
  184. Next
  185. End Sub
  186.  
  187. '******************
  188. ' RealTime Updates
  189. '******************
  190.  
  191. Sub RealTime_Timer
  192. RollingUpdate
  193. LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
  194. RightFlipperTop.RotZ = RightFlipper.CurrentAngle
  195. RightFlipperTop2.RotZ = RightFlipper2.CurrentAngle
  196. End Sub
  197.  
  198. '**********
  199. ' Keys
  200. '**********
  201.  
  202. Sub table1_KeyDown(ByVal Keycode)
  203. If keycode = LeftTiltKey Then Nudge 90, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
  204. If keycode = RightTiltKey Then Nudge 270, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
  205. If keycode = CenterTiltKey Then Nudge 0, 8:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
  206. If keycode = LeftMagnaSave Then bLutActive = True
  207. If keycode = RightMagnaSave Then
  208. If bLutActive Then NextLUT:End If
  209. End If
  210. If vpmKeyDown(keycode)Then Exit Sub
  211. If keycode = PlungerKey Then PlaySoundat "fx_PlungerPull", Plunger:Plunger.Pullback
  212. If keycode = KeyRules Then Rules
  213. End Sub
  214.  
  215. Sub table1_KeyUp(ByVal Keycode)
  216. If keycode = LeftMagnaSave Then bLutActive = False
  217. If vpmKeyUp(keycode)Then Exit Sub
  218. If keycode = PlungerKey Then PlaySoundAt "fx_plunger", Plunger:Plunger.Fire
  219. End Sub
  220.  
  221. '*********
  222. ' LUT
  223. '*********
  224.  
  225. Dim bLutActive, LUTImage
  226. Sub LoadLUT
  227. bLutActive = False
  228. x = LoadValue(cGameName, "LUTImage")
  229. If(x <> "")Then LUTImage = x Else LUTImage = 0
  230. UpdateLUT
  231. End Sub
  232.  
  233. Sub SaveLUT
  234. SaveValue cGameName, "LUTImage", LUTImage
  235. End Sub
  236.  
  237. Sub NextLUT:LUTImage = (LUTImage + 1)MOD 10:UpdateLUT:SaveLUT:End Sub
  238.  
  239. Sub UpdateLUT
  240. Select Case LutImage
  241. Case 0:table1.ColorGradeImage = "LUT0"
  242. Case 1:table1.ColorGradeImage = "LUT1"
  243. Case 2:table1.ColorGradeImage = "LUT2"
  244. Case 3:table1.ColorGradeImage = "LUT3"
  245. Case 4:table1.ColorGradeImage = "LUT4"
  246. Case 5:table1.ColorGradeImage = "LUT5"
  247. Case 6:table1.ColorGradeImage = "LUT6"
  248. Case 7:table1.ColorGradeImage = "LUT7"
  249. Case 8:table1.ColorGradeImage = "LUT8"
  250. Case 9:table1.ColorGradeImage = "LUT9"
  251. End Select
  252. End Sub
  253.  
  254. '*********
  255. ' Switches
  256. '*********
  257.  
  258. ' Slings
  259. Dim LStep, RStep
  260.  
  261. Sub LeftSlingShot_Slingshot
  262. PlaySoundAt SoundFX("fx_slingshot", DOFContactors), Lemk
  263. 'DOF 101, DOFPulse
  264. LeftSling004.Visible = 1
  265. Lemk.RotX = 26
  266. LStep = 0
  267. vpmTimer.PulseSw 14
  268. LeftSlingShot.TimerEnabled = 1
  269. End Sub
  270.  
  271. Sub LeftSlingShot_Timer
  272. Select Case LStep
  273. Case 1:LeftSLing004.Visible = 0:LeftSLing003.Visible = 1:Lemk.RotX = 14
  274. Case 2:LeftSLing003.Visible = 0:LeftSLing002.Visible = 1:Lemk.RotX = 2
  275. Case 3:LeftSLing002.Visible = 0:Lemk.RotX = -20:LeftSlingShot.TimerEnabled = 0
  276. End Select
  277. LStep = LStep + 1
  278. End Sub
  279.  
  280. Sub RightSlingShot_Slingshot
  281. PlaySoundAt SoundFX("fx_slingshot", DOFContactors), Remk
  282. 'DOF 102, DOFPulse
  283. RightSling004.Visible = 1
  284. Remk.RotX = 26
  285. RStep = 0
  286. vpmTimer.PulseSw 13
  287. RightSlingShot.TimerEnabled = 1
  288. End Sub
  289.  
  290. Sub RightSlingShot_Timer
  291. Select Case RStep
  292. Case 1:RightSLing004.Visible = 0:RightSLing003.Visible = 1:Remk.RotX = 14
  293. Case 2:RightSLing003.Visible = 0:RightSLing002.Visible = 1:Remk.RotX = 2
  294. Case 3:RightSLing002.Visible = 0:Remk.RotX = -20:RightSlingShot.TimerEnabled = 0
  295. End Select
  296. RStep = RStep + 1
  297. End Sub
  298.  
  299. ' Bumpers
  300. Sub Bumper001_Hit:vpmTimer.PulseSw 16:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper001:End Sub
  301. Sub Bumper002_Hit:vpmTimer.PulseSw 15:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper002:End Sub
  302.  
  303. ' Drain & holes
  304. Sub Drain_Hit:PlaysoundAt "fx_drain", Drain:bsTrough.AddBall Me:End Sub
  305.  
  306. ' Lock system
  307. Dim Kicker2Balls
  308. Dim Kicker3Balls
  309. Kicker2Balls = 0
  310. Kicker3Balls = 0
  311.  
  312. Sub Kicker1_Hit:PlaysoundAt "fx_drain", Kicker1:bsLock.AddBall 0:End Sub
  313.  
  314. Sub Kicker2_Hit
  315. PlaysoundAt "fx_sensor", Kicker2
  316. If bsLock.Balls = 0 Then
  317. vpmTimer.PulseSw(37)
  318. Me.Kick 180, 1
  319. Else
  320. Controller.Switch(37) = 1
  321. Kicker2Balls = 1
  322. End If
  323. End Sub
  324.  
  325. Sub Kicker3_Hit
  326. PlaysoundAt "fx_sensor", Kicker3
  327. If Kicker2Balls = 0 Then
  328. vpmTimer.PulseSw(38)
  329. Me.Kick 180, 1
  330. Else
  331. Controller.Switch(38) = 1
  332. Kicker3Balls = 1
  333. End If
  334. End Sub
  335.  
  336. Sub Lockout(Enabled)
  337. If Enabled Then
  338. bsLock.ExitSol_On
  339. If Kicker2Balls = 1 Then
  340. Kicker2.Kick 180, 1
  341. Controller.Switch(37) = 0
  342. Kicker2Balls = 0
  343. End If
  344. If Kicker3Balls = 1 Then
  345. Kicker3.Kick 180, 1
  346. Controller.Switch(38) = 0
  347. Kicker3Balls = 0
  348. End If
  349. End If
  350. End Sub
  351.  
  352. ' Rollovers
  353. Sub Trigger3_Hit:Controller.Switch(5) = 1:PlaySoundAt "fx_sensor", Trigger3:topramp.Rotx = -6:End Sub
  354. Sub Trigger3_UnHit:Controller.Switch(5) = 0:topramp.Rotx = 0:End Sub
  355.  
  356. Sub TriggerR4_Hit:Controller.Switch(8) = 1:PlaySoundAt "fx_sensor", TriggerR4:End Sub
  357. Sub TriggerR4_UnHit:Controller.Switch(8) = 0:End Sub
  358.  
  359. Sub TriggerT2_Hit:Controller.Switch(9) = 1:PlaySoundAt "fx_sensor", TriggerT2:DOF 106, DOFOn:End Sub
  360. Sub TriggerT2_UnHit:Controller.Switch(9) = 0:DOF 106, DOFOff:End Sub
  361.  
  362. Sub TriggerT1_Hit:Controller.Switch(10) = 1:PlaySoundAt "fx_sensor", TriggerT1:DOF 108, DOFOn:End Sub
  363. Sub TriggerT1_UnHit:Controller.Switch(10) = 0:DOF 108, DOFOff:End Sub
  364.  
  365. Sub TriggerT3_Hit:Controller.Switch(11) = 1:PlaySoundAt "fx_sensor", TriggerT3:DOF 110, DOFOn:End Sub
  366. Sub TriggerT3_UnHit:Controller.Switch(11) = 0:DOF 110, DOFOff:End Sub
  367.  
  368. Sub TriggerR1_Hit:Controller.Switch(12) = 1:PlaySoundAt "fx_sensor", TriggerR1:DOF 101, DOFOn:End Sub
  369. Sub TriggerR1_UnHit:Controller.Switch(12) = 0:DOF 101, DOFOff:End Sub
  370.  
  371. Sub Trigger2_Hit:Controller.Switch(20) = 1:PlaySoundAt "fx_sensor", Trigger2:End Sub
  372. Sub Trigger2_UnHit:Controller.Switch(20) = 0:End Sub
  373.  
  374. Sub Trigger1_Hit:Controller.Switch(21) = 1:PlaySoundAt "fx_sensor", Trigger1:End Sub
  375. Sub Trigger1_UnHit:Controller.Switch(21) = 0:End Sub
  376.  
  377. Sub TriggerR2_Hit:Controller.Switch(22) = 1:PlaySoundAt "fx_sensor", TriggerR2:End Sub
  378. Sub TriggerR2_UnHit:Controller.Switch(22) = 0:End Sub
  379.  
  380. Sub TriggerL2_Hit:Controller.Switch(23) = 1:PlaySoundAt "fx_sensor", TriggerL2:DOF 102, DOFOn:End Sub
  381. Sub TriggerL2_UnHit:Controller.Switch(23) = 0:DOF 102, DOFOff:End Sub
  382.  
  383. Sub TriggerL3_Hit:Controller.Switch(24) = 1:PlaySoundAt "fx_sensor", TriggerL3:DOF 103, DOFOn:End Sub
  384. Sub TriggerL3_UnHit:Controller.Switch(24) = 0:DOF 103, DOFOff:End Sub
  385.  
  386. Sub TriggerL1_Hit:Controller.Switch(39) = 1:PlaySoundAt "fx_sensor", TriggerL1:DOF 104, DOFOn:End Sub
  387. Sub TriggerL1_UnHit:Controller.Switch(39) = 0:DOF 104, DOFOff:End Sub
  388.  
  389. Sub TriggerR3_Hit:Controller.Switch(40) = 1:PlaySoundAt "fx_sensor", TriggerR3:End Sub
  390. Sub TriggerR3_UnHit:Controller.Switch(40) = 0:End Sub
  391.  
  392. 'Spinners
  393. Sub Spinner1_Spin():vpmTimer.PulseSw 5:PlaySoundAt "fx_spinner", spinner1:End Sub
  394.  
  395. 'Targets
  396. Sub TargetT6_Hit:vpmTimer.PulseSw 9:PlaySoundAtBall SoundFXDOF("fx_target",107,DOFPulse,DOFTargets):End Sub
  397. Sub TargetT7_Hit:vpmTimer.PulseSw 10:PlaySoundAtBall SoundFXDOF("fx_target",109,DOFPulse,DOFTargets):End Sub
  398. Sub TargetT8_Hit:vpmTimer.PulseSw 11:PlaySoundAtBall SoundFXDOF("fx_target",111,DOFPulse,DOFTargets):End Sub
  399. Sub TargetL2_Hit:vpmTimer.PulseSw 12:PlaySoundAtBall SoundFX("fx_target", DOFTargets):End Sub
  400. Sub TargetL1_Hit:vpmTimer.PulseSw 24:PlaySoundAtBall SoundFX("fx_target", DOFTargets):End Sub
  401.  
  402. '*********
  403. 'Solenoids
  404. '*********
  405.  
  406. SolCallback(6) = "vpmSolSound SoundFX(""fx_Knocker"",DOFKnocker),"
  407. SolCallback(7) = "bsTrough.SolIn"
  408. SolCallback(8) = "bsTrough.SolOut"
  409. SolCallback(9) = "dtT.SolDropUp"
  410. SolCallback(10) = "dtR.SolDropUp"
  411. SolCallback(11) = "dtR2.SolDropUp"
  412. SolCallback(12) = "Lockout"
  413. SolCallback(19) = "vpmNudge.SolGameOn"
  414.  
  415. '*******************
  416. ' Flipper Subs v3.0
  417. '*******************
  418.  
  419. SolCallback(sLRFlipper) = "SolRFlipper"
  420. SolCallback(sLLFlipper) = "SolLFlipper"
  421.  
  422. Sub SolLFlipper(Enabled)
  423. If Enabled Then
  424. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers), LeftFlipper
  425. LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
  426. LeftFlipper2.EOSTorque = 0.75:LeftFlipper2.RotateToEnd
  427. Else
  428. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers), LeftFlipper
  429. LeftFlipper.EOSTorque = 0.2:LeftFlipper.RotateToStart
  430. LeftFlipper2.EOSTorque = 0.2:LeftFlipper2.RotateToStart
  431. End If
  432. End Sub
  433.  
  434. Sub SolRFlipper(Enabled)
  435. If Enabled Then
  436. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers), RightFlipper
  437. RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
  438. RightFlipper2.EOSTorque = 0.75:RightFlipper2.RotateToEnd
  439. Else
  440. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers), RightFlipper
  441. RightFlipper.EOSTorque = 0.2:RightFlipper.RotateToStart
  442. RightFlipper2.EOSTorque = 0.2:RightFlipper2.RotateToStart
  443. End If
  444. End Sub
  445.  
  446. Sub LeftFlipper_Collide(parm)
  447. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
  448. End Sub
  449.  
  450. Sub RightFlipper_Collide(parm)
  451. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
  452. End Sub
  453.  
  454. Sub LeftFlipper2_Collide(parm)
  455. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
  456. End Sub
  457.  
  458. Sub RightFlipper2_Collide(parm)
  459. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
  460. End Sub
  461.  
  462. '************************************
  463. ' LEDs Display
  464. ' Based on Scapino's LEDs
  465. '************************************
  466.  
  467. Dim Digits(32)
  468. Dim Patterns(11)
  469. Dim Patterns2(11)
  470.  
  471. Patterns(0) = 0 'empty
  472. Patterns(1) = 63 '0
  473. Patterns(2) = 6 '1
  474. Patterns(3) = 91 '2
  475. Patterns(4) = 79 '3
  476. Patterns(5) = 102 '4
  477. Patterns(6) = 109 '5
  478. Patterns(7) = 125 '6
  479. Patterns(8) = 7 '7
  480. Patterns(9) = 127 '8
  481. Patterns(10) = 111 '9
  482.  
  483. Patterns2(0) = 128 'empty
  484. Patterns2(1) = 191 '0
  485. Patterns2(2) = 134 '1
  486. Patterns2(3) = 219 '2
  487. Patterns2(4) = 207 '3
  488. Patterns2(5) = 230 '4
  489. Patterns2(6) = 237 '5
  490. Patterns2(7) = 253 '6
  491. Patterns2(8) = 135 '7
  492. Patterns2(9) = 255 '8
  493. Patterns2(10) = 239 '9
  494.  
  495. 'Assign 6-digit output to reels
  496. Set Digits(0) = a0
  497. Set Digits(1) = a1
  498. Set Digits(2) = a2
  499. Set Digits(3) = a3
  500. Set Digits(4) = a4
  501. Set Digits(5) = a5
  502. Set Digits(6) = a6
  503.  
  504. Set Digits(7) = b0
  505. Set Digits(8) = b1
  506. Set Digits(9) = b2
  507. Set Digits(10) = b3
  508. Set Digits(11) = b4
  509. Set Digits(12) = b5
  510. Set Digits(13) = b6
  511.  
  512. Set Digits(14) = c0
  513. Set Digits(15) = c1
  514. Set Digits(16) = c2
  515. Set Digits(17) = c3
  516. Set Digits(18) = c4
  517. Set Digits(19) = c5
  518. Set Digits(20) = c6
  519.  
  520. Set Digits(21) = d0
  521. Set Digits(22) = d1
  522. Set Digits(23) = d2
  523. Set Digits(24) = d3
  524. Set Digits(25) = d4
  525. Set Digits(26) = d5
  526. Set Digits(27) = d6
  527.  
  528. Set Digits(28) = e0
  529. Set Digits(29) = e1
  530. Set Digits(30) = e2
  531. Set Digits(31) = e3
  532.  
  533. Sub UpdateLeds_Timer
  534. On Error Resume Next
  535. Dim ChgLED, ii, jj, chg, stat
  536. ChgLED = Controller.ChangedLEDs(&HFF, &HFFFF)
  537. If Not IsEmpty(ChgLED)Then
  538. For ii = 0 To UBound(ChgLED)
  539. chg = chgLED(ii, 1):stat = chgLED(ii, 2)
  540. For jj = 0 to 10
  541. If stat = Patterns(jj)OR stat = Patterns2(jj)then Digits(chgLED(ii, 0)).SetValue jj
  542. Next
  543. Next
  544. End IF
  545. End Sub
  546.  
  547. '************************************
  548. ' Diverse Collection Hit Sounds v3.0
  549. '************************************
  550.  
  551. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  552. Sub aMetalWires_Hit(idx):PlaySoundAtBall "fx_MetalWire":End Sub
  553. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  554. Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
  555. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  556. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  557. Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
  558. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  559. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  560. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  561.  
  562. '***************************************************************
  563. ' Supporting Ball & Sound Functions v3.0
  564. ' includes random pitch in PlaySoundAt and PlaySoundAtBall
  565. '***************************************************************
  566.  
  567. Dim TableWidth, TableHeight
  568.  
  569. TableWidth = Table1.width
  570. TableHeight = Table1.height
  571.  
  572. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  573. Vol = Csng(BallVel(ball) ^2 / 2000)
  574. End Function
  575.  
  576. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  577. Dim tmp
  578. tmp = ball.x * 2 / TableWidth-1
  579. If tmp> 0 Then
  580. Pan = Csng(tmp ^10)
  581. Else
  582. Pan = Csng(-((- tmp) ^10))
  583. End If
  584. End Function
  585.  
  586. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  587. Pitch = BallVel(ball) * 20
  588. End Function
  589.  
  590. Function BallVel(ball) 'Calculates the ball speed
  591. BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
  592. End Function
  593.  
  594. Function AudioFade(ball) 'only on VPX 10.4 and newer
  595. Dim tmp
  596. tmp = ball.y * 2 / TableHeight-1
  597. If tmp> 0 Then
  598. AudioFade = Csng(tmp ^10)
  599. Else
  600. AudioFade = Csng(-((- tmp) ^10))
  601. End If
  602. End Function
  603.  
  604. Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
  605. PlaySound soundname, 0, 1, Pan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
  606. End Sub
  607.  
  608. Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
  609. PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.4, 0, 0, 0, AudioFade(ActiveBall)
  610. End Sub
  611.  
  612. '***********************************************
  613. ' JP's VP10 Rolling Sounds + Ballshadow v3.0
  614. ' uses a collection of shadows, aBallShadow
  615. '***********************************************
  616.  
  617. Const tnob = 19 'total number of balls, 20 balls, from 0 to 19
  618. Const lob = 0 'number of locked balls
  619. Const maxvel = 40 'max ball velocity 25-50
  620. ReDim rolling(tnob)
  621. InitRolling
  622.  
  623. Sub InitRolling
  624. Dim i
  625. For i = 0 to tnob
  626. rolling(i) = False
  627. Next
  628. End Sub
  629.  
  630. Sub RollingUpdate()
  631. Dim BOT, b, ballpitch, ballvol, speedfactorx, speedfactory
  632. BOT = GetBalls
  633.  
  634. ' stop the sound of deleted balls and hide the shadow
  635. For b = UBound(BOT) + 1 to tnob
  636. rolling(b) = False
  637. StopSound("fx_ballrolling" & b)
  638. aBallShadow(b).Y = 3000
  639. Next
  640.  
  641. ' exit the sub if no balls on the table
  642. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  643.  
  644. ' play the rolling sound for each ball and draw the shadow
  645. For b = lob to UBound(BOT)
  646. aBallShadow(b).X = BOT(b).X
  647. aBallShadow(b).Y = BOT(b).Y
  648. aBallShadow(b).Height = BOT(b).Z -24
  649.  
  650. If BallVel(BOT(b))> 1 Then
  651. If BOT(b).z <30 Then
  652. ballpitch = Pitch(BOT(b))
  653. ballvol = Vol(BOT(b))
  654. Else
  655. ballpitch = Pitch(BOT(b)) + 25000 'increase the pitch on a ramp
  656. ballvol = Vol(BOT(b)) * 10
  657. End If
  658. rolling(b) = True
  659. PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
  660. Else
  661. If rolling(b) = True Then
  662. StopSound("fx_ballrolling" & b)
  663. rolling(b) = False
  664. End If
  665. End If
  666.  
  667. ' rothbauerw's Dropping Sounds
  668. If BOT(b).VelZ <-1 and BOT(b).z <55 and BOT(b).z> 27 Then 'height adjust for ball drop sounds
  669. PlaySound "fx_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  670. End If
  671.  
  672. ' jps ball speed control
  673. If BOT(b).VelX AND BOT(b).VelY <> 0 Then
  674. speedfactorx = ABS(maxvel / BOT(b).VelX)
  675. speedfactory = ABS(maxvel / BOT(b).VelY)
  676. If speedfactorx <1 Then
  677. BOT(b).VelX = BOT(b).VelX * speedfactorx
  678. BOT(b).VelY = BOT(b).VelY * speedfactorx
  679. End If
  680. If speedfactory <1 Then
  681. BOT(b).VelX = BOT(b).VelX * speedfactory
  682. BOT(b).VelY = BOT(b).VelY * speedfactory
  683. End If
  684. End If
  685. Next
  686. End Sub
  687.  
  688. '***********************
  689. ' Ball Collision Sound
  690. '***********************
  691.  
  692. Sub OnBallBallCollision(ball1, ball2, velocity)
  693. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  694. End Sub
  695.  
  696. 'Switch menu by Inkochnito
  697. Sub editDips
  698. Dim vpmDips:Set vpmDips = New cvpmDips
  699. With vpmDips
  700. .AddForm 700, 400, "Split second - DIP switches"
  701. .AddFrame 2, 5, 110, "Maximum credits", &H00060000, Array("10 credits", 0, "15 credits", &H00020000, "25 credits", &H00040000, "40 credits", &H00060000) 'dip 18&19
  702. .AddFrame 2, 80, 110, "High game to date", 49152, Array("points", 0, "1 free game", &H00004000, "2 free games", 32768, "3 free games", 49152) 'dip 15&16
  703. .AddFrame 2, 155, 110, "Special award", &HC0000000, Array("no award", 0, "100.000 points", &H40000000, "free ball", &H80000000, "free game", &HC0000000) 'dip 31&32
  704. .AddFrame 125, 5, 110, "High score feature", &H00000020, Array("extra ball", 0, "replay", &H00000020) 'dip 6
  705. .AddFrame 125, 57, 110, "Extra ball limit", &H00400000, Array("one per game", 0, "one per ball", &H00400000) 'dip 23
  706. .AddFrame 125, 108, 110, "Add-a-ball memory", &H00001000, Array("three balls", 0, "five balls", &H00001000) 'dip 13
  707. .AddChk 125, 162, 110, Array("Match feature", &H00100000) 'dip 21
  708. .AddChk 125, 180, 110, Array("Credits display", &H00080000) 'dip 20
  709. .AddChk 125, 198, 110, Array("Extra ball", &H00200000) 'dip 22
  710. .AddChk 248, 162, 110, Array("Talking sound", &H00010000) 'dip 17
  711. .AddChk 125, 216, 110, Array("Bonus ball feature", &H00000010) 'dip 5
  712. .AddFrame 248, 5, 110, "Balls per game", &H00000040, Array("3 balls", 0, "5 balls", &H00000040) 'dip 7
  713. .AddFrame 248, 57, 110, "Special limit", &H20000000, Array("one per game", 0, "one per ball", &H20000000) 'dip 30
  714. .AddFrame 248, 108, 110, "Outlane special adjust", &H10000000, Array("alternating", 0, "both lit", &H10000000) 'dip 29
  715. .AddLabel 50, 250, 300, 20, "After hitting OK, press F3 to reset game with new settings."
  716. .ViewDips
  717. End With
  718. End Sub
  719. Set vpmShowDips = GetRef("editDips")
Advertisement
Add Comment
Please, Sign In to add comment