Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.49 KB | None | 0 0
  1. ' Black Pyramid - Bally 1984
  2. ' IPD No. 312 / July, 1984 / 4 Players
  3. ' VPX - version by JPSalas 2017, version 1.0.0
  4.  
  5. Option Explicit
  6. Randomize
  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. LoadVPM "01550000", "Bally.vbs", 3.26
  14.  
  15. 'Variables
  16. Dim bsTrough, bsSaucer, dtBank, x
  17.  
  18. Const cGameName = "blakpyra"
  19.  
  20. Const UseSolenoids = 1
  21. Const UseLamps = 0
  22. Const UseGI = 0
  23. Const UseSync = 0 'set it to 1 if the table runs too fast
  24. Const HandleMech = 0
  25.  
  26. Dim VarHidden
  27. If Table1.ShowDT = true then
  28. VarHidden = 1
  29. For each x in aReels
  30. x.Visible = 1
  31. Next
  32. else
  33. VarHidden = 0
  34. For each x in aReels
  35. x.Visible = 0
  36. Next
  37. lrail.Visible = 0
  38. rrail.Visible = 0
  39. end if
  40.  
  41. if B2SOn = true then VarHidden = 1
  42.  
  43. ' Standard Sounds
  44. Const SSolenoidOn = "fx_Solenoid"
  45. Const SSolenoidOff = ""
  46. Const SCoin = "fx_Coin"
  47.  
  48. 'Table Init
  49. Sub table1_Init
  50. vpmInit me
  51. With Controller
  52. .GameName = cGameName
  53. .SplashInfoLine = "Black Pyramid, Bally 1984" & vbNewLine & "VPX table by jpsalas"
  54. .HandleKeyboard = 0
  55. .ShowTitle = 0
  56. .ShowDMDOnly = 1
  57. .ShowFrame = 0
  58. .HandleMechanics = 0
  59. .Hidden = VarHidden
  60. .Games(cGameName).Settings.Value("rol") = 0 '1= rotated display, 0= normal
  61. '.SetDisplayPosition 0,0, GetPlayerHWnd 'restore dmd window position
  62. On Error Resume Next
  63. Controller.SolMask(0) = 0
  64. vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the Timer to renable all the solenoids after 2 seconds
  65. Controller.Run GetPlayerHWnd
  66. On Error Goto 0
  67. End With
  68.  
  69. 'Nudging
  70. vpmNudge.TiltSwitch = 15
  71. vpmNudge.Sensitivity = 4
  72. vpmNudge.TiltObj = Array(Bumper1, Bumper2, LeftSlingshot, RightSlingShot)
  73.  
  74. 'Trough
  75. Set bsTrough = New cvpmBallStack
  76. With bsTrough
  77. .InitSw 0, 8, 0, 0, 0, 0, 0, 0
  78. .InitKick ballrelease, 90, 4
  79. .InitExitSnd SoundFX("fx_ballrel", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
  80. .Balls = 1
  81. End With
  82.  
  83. 'Saucer
  84. Set bsSaucer = New cvpmBallStack
  85. With bsSaucer
  86. .InitSaucer sw7, 7, 200, 10
  87. .InitExitSnd SoundFX("fx_kicker", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
  88. End With
  89.  
  90. 'Drop targets
  91. set dtBank = new cvpmdroptarget
  92. With dtBank
  93. .InitDrop Array(sw30, sw31, sw32), Array(30, 31, 32)
  94. .initsnd SoundFX("", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  95. End With
  96.  
  97. 'Main Timer init
  98. PinMAMETimer.Interval = PinMAMEInterval
  99. PinMAMETimer.Enabled = 1
  100. End Sub
  101.  
  102. Sub table1_Paused:Controller.Pause = 1:End Sub
  103. Sub table1_unPaused:Controller.Pause = 0:End Sub
  104.  
  105. '**********
  106. ' Keys
  107. '**********
  108.  
  109. Sub table1_KeyDown(ByVal Keycode)
  110. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
  111. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
  112. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
  113. If keycode = PlungerKey Then PlaySoundAt "fx_PlungerPull",Plunger:Plunger.Pullback
  114. If vpmKeyDown(keycode)Then Exit Sub
  115. End Sub
  116.  
  117. Sub table1_KeyUp(ByVal Keycode)
  118. If vpmKeyUp(keycode)Then Exit Sub
  119. If keycode = PlungerKey Then PlaySoundAt "fx_plunger",Plunger:Plunger.Fire
  120. End Sub
  121.  
  122. ' Slings
  123. Dim LStep, RStep
  124.  
  125. Sub LeftSlingShot_Slingshot
  126. PlaySoundAt SoundFX("fx_slingshot", DOFContactors),Lemk
  127. LeftSling4.Visible = 1
  128. Lemk.RotX = 26
  129. LStep = 0
  130. vpmTimer.PulseSw 1
  131. LeftSlingShot.TimerEnabled = 1
  132. End Sub
  133.  
  134. Sub LeftSlingShot_Timer
  135. Select Case LStep
  136. Case 1:LeftSLing4.Visible = 0:LeftSLing3.Visible = 1:Lemk.RotX = 14
  137. Case 2:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:Lemk.RotX = 2
  138. Case 3:LeftSLing2.Visible = 0:Lemk.RotX = -10:LeftSlingShot.TimerEnabled = 0
  139. End Select
  140. LStep = LStep + 1
  141. End Sub
  142.  
  143. Sub RightSlingShot_Slingshot
  144. PlaySoundAt SoundFX("fx_slingshot", DOFContactors),Remk
  145. RightSling4.Visible = 1
  146. Remk.RotX = 26
  147. RStep = 0
  148. vpmTimer.PulseSw 2
  149. RightSlingShot.TimerEnabled = 1
  150. End Sub
  151.  
  152. Sub RightSlingShot_Timer
  153. Select Case RStep
  154. Case 1:RightSLing4.Visible = 0:RightSLing3.Visible = 1:Remk.RotX = 14
  155. Case 2:RightSLing3.Visible = 0:RightSLing2.Visible = 1:Remk.RotX = 2
  156. Case 3:RightSLing2.Visible = 0:Remk.RotX = -10:RightSlingShot.TimerEnabled = 0
  157. End Select
  158. RStep = RStep + 1
  159. End Sub
  160.  
  161. ' Scoring rubbers
  162.  
  163. Sub sw12_Hit:PlaySoundAt "fx_Rubber",ActiveBall:vpmTimer.PulseSw 12:End Sub
  164. Sub sw12a_Hit:PlaySoundAt "fx_Rubber",ActiveBall:vpmTimer.PulseSw 12:End Sub
  165.  
  166. 'Moving Target
  167. Sub sw5a_Hit:vpmTimer.PulseSw 5:PlaySoundAt SoundFX("fx_target", DOFDropTargets), ActiveBall:End Sub
  168. Sub sw5b_Hit:vpmTimer.PulseSw 5:PlaySoundAt SoundFX("fx_target", DOFDropTargets), ActiveBall:End Sub
  169. Sub sw5c_Hit:vpmTimer.PulseSw 5:PlaySoundAt SoundFX("fx_target", DOFDropTargets), ActiveBall:End Sub
  170.  
  171. 'Bumpers
  172. Sub Bumper1_Hit:vpmTimer.PulseSw 3:PlaySoundAtBumperVol SoundFX("fx_bumper", DOFContactors), Bumper1,1:End Sub
  173. Sub Bumper2_Hit:vpmTimer.PulseSw 4:PlaySoundAtBumperVol SoundFX("fx_bumper", DOFContactors), Bumper2,1:End Sub
  174.  
  175. 'Drain
  176. Sub Drain_Hit():bsTrough.AddBall Me:PlaySoundAt "fx_drain",Drain:End Sub
  177. Sub sw7_Hit():bsSaucer.AddBall 0:Playsound "fx_kicker_enter", 0, 1, 0, 0.1:End Sub
  178.  
  179. 'Rollovers
  180. Sub sw17_Hit:Controller.Switch(17) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  181. Sub sw17_UnHit:Controller.Switch(17) = 0:End Sub
  182.  
  183. Sub sw24_Hit:Controller.Switch(24) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  184. Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
  185.  
  186. Sub sw22_Hit:Controller.Switch(22) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  187. Sub sw22_UnHit:Controller.Switch(22) = 0:End Sub
  188.  
  189. Sub sw23_Hit:Controller.Switch(23) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  190. Sub sw23_UnHit:Controller.Switch(23) = 0:End Sub
  191.  
  192. Sub sw29_Hit:Controller.Switch(29) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  193. Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
  194.  
  195. Sub sw28_Hit:Controller.Switch(28) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  196. Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
  197.  
  198. Sub sw13_Hit:Controller.Switch(13) = 1:PlaySoundAt "fx_sensor", ActiveBall:Light1.Duration 2, 600, 1:End Sub
  199. Sub sw13_UnHit:Controller.Switch(13) = 0:End Sub
  200.  
  201. Sub sw14_Hit:Controller.Switch(14) = 1:PlaySoundAt "fx_sensor", ActiveBall:Light2.Duration 2, 600, 1:End Sub
  202. Sub sw14_UnHit:Controller.Switch(14) = 0:End Sub
  203.  
  204. 'Standup Targets
  205. Sub sw20_Hit:vpmTimer.PulseSw 20:PlaySoundAt SoundFX("fx_target", DOFDropTargets), ActiveBall:End Sub
  206.  
  207. Sub sw21_Hit:vpmTimer.PulseSw 21:PlaySoundAt SoundFX("fx_target", DOFDropTargets), ActiveBall:End Sub
  208.  
  209. Sub sw18_Hit:vpmTimer.PulseSw 18:PlaySoundAt SoundFX("fx_target", DOFDropTargets), ActiveBall:End Sub
  210.  
  211. Sub sw19_Hit:vpmTimer.PulseSw 19:PlaySoundAt SoundFX("fx_target", DOFDropTargets), ActiveBall:End Sub
  212.  
  213. ' Droptargets
  214. Sub sw30_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets),sw30:End Sub
  215. Sub sw31_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets),sw31:End Sub
  216. Sub sw32_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets),sw32:End Sub
  217.  
  218. Sub sw30_Dropped:dtbank.Hit 1:End Sub
  219. Sub sw31_Dropped:dtbank.Hit 2:End Sub
  220. Sub sw32_Dropped:dtbank.Hit 3:End Sub
  221.  
  222. '****Solenoids
  223.  
  224. SolCallback(15) = "vpmSolSound SoundFX(""fx_knocker"",DOFKnocker),"
  225. SolCallback(13) = "dtBank.SolDropUp"
  226. SolCallback(14) = "bsTrough.SolOut"
  227. SolCallback(12) = "bsSaucer.SolOut"
  228. SolCallback(17) = "SolGate"
  229. SolCallback(19) = "vpmNudge.SolGameOn"
  230.  
  231. Sub SolGate(Enabled)
  232. vpmSolDiverter DiverterFlipper, False, Not Enabled
  233. vpmSolDiverter DiverterFlipper, False, Not Enabled
  234. End Sub
  235.  
  236. Set MotorCallback = GetRef("UpdateDiverter")
  237.  
  238. Sub UpdateDiverter
  239. Diverter.RotZ = DiverterFlipper.CurrentAngle
  240. End Sub
  241.  
  242. '*****************
  243. ' Gi Effects
  244. '*****************
  245.  
  246. Dim OldGiState
  247. OldGiState = -1 'start witht he Gi off
  248.  
  249. Sub GiON
  250. For each x in aGiLights
  251. GiEffect
  252. Next
  253. End Sub
  254.  
  255. Sub GiOFF
  256. For each x in aGiLights
  257. x.State = 0
  258. Next
  259. End Sub
  260.  
  261. Sub GiEffect
  262. For each x in aGiLights
  263. x.Duration 2, 1000, 1
  264. Next
  265. End Sub
  266.  
  267. Sub GIUpdate
  268. Dim tmp, obj
  269. tmp = Getballs
  270. If UBound(tmp) <> OldGiState Then
  271. OldGiState = Ubound(tmp)
  272. If UBound(tmp) = -1 Then
  273. GiOff
  274. Else
  275. GiOn
  276. End If
  277. End If
  278. End Sub
  279.  
  280. '**************
  281. ' Flipper Subs
  282. '**************
  283.  
  284. SolCallback(sLRFlipper) = "SolRFlipper"
  285. SolCallback(sLLFlipper) = "SolLFlipper"
  286.  
  287. Sub SolLFlipper(Enabled)
  288. If Enabled Then
  289. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers),LeftFlipper
  290. LeftFlipper.RotateToEnd
  291. Else
  292. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers),LeftFlipper
  293. LeftFlipper.RotateToStart
  294. End If
  295. End Sub
  296.  
  297. Sub SolRFlipper(Enabled)
  298. If Enabled Then
  299. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers),RightFlipper
  300. RightFlipper.RotateToEnd
  301. Else
  302. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers),RightFlipper
  303. RightFlipper.RotateToStart
  304. End If
  305. End Sub
  306.  
  307. Sub LeftFlipper_Collide(parm)
  308. PlaySound "fx_rubber_flipper", 0, parm / 10, -0.1, 0.25,0,0,1,.8
  309. End Sub
  310.  
  311. Sub RightFlipper_Collide(parm)
  312. PlaySound "fx_rubber_flipper", 0, parm / 10, 0.1, 0.25,0,0,1,.8
  313. End Sub
  314.  
  315. '***********************
  316. ' Swing Target animation
  317. '***********************
  318.  
  319. Dim MyPi, SwingStep, SwingPos
  320. MyPi = Round(4 * Atn(1), 6) / 90
  321. SwingStep = 0
  322.  
  323. Sub SwingTimer_Timer()
  324. If Controller.Lamp(13)Then
  325. SwingPos = SIN(SwingStep * MyPi) * 50
  326. SwingStep = (SwingStep + 1)MOD 360
  327. sw5p.Roty = SwingPos
  328. If SwingPos < -33 Then
  329. sw5a.Isdropped = 0:sw5b.IsDropped = 1
  330. ElseIF SwingPos < 33 Then
  331. sw5b.Isdropped = 0:sw5a.IsDropped = 1:sw5c.IsDropped = 1
  332. Else
  333. sw5c.Isdropped = 0:sw5b.IsDropped = 1
  334. End If
  335. End If
  336. End Sub
  337. '***************************************************
  338. ' JP's VP10 Fading Lamps & Flashers
  339. ' Based on PD's Fading Light System
  340. ' SetLamp 0 is Off
  341. ' SetLamp 1 is On
  342. ' fading for non opacity objects is 4 steps
  343. '***************************************************
  344.  
  345. Dim LampState(200), FadingLevel(200)
  346. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200), FlashRepeat(200)
  347.  
  348. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  349. LampTimer.Interval = 10 'lamp fading speed
  350. LampTimer.Enabled = 1
  351.  
  352. ' Lamp & Flasher Timers
  353.  
  354. Sub LampTimer_Timer()
  355. Dim chgLamp, num, chg, ii
  356. chgLamp = Controller.ChangedLamps
  357. If Not IsEmpty(chgLamp)Then
  358. For ii = 0 To UBound(chgLamp)
  359. LampState(chgLamp(ii, 0)) = chgLamp(ii, 1) 'keep the real state in an array
  360. FadingLevel(chgLamp(ii, 0)) = chgLamp(ii, 1) + 4 'actual fading step
  361. Next
  362. End If
  363. If VarHidden Then
  364. UpdateLeds
  365. End If
  366. UpdateLamps
  367. GIUpdate
  368. RollingUpdate
  369. End Sub
  370.  
  371. Sub UpdateLamps
  372. NFadeT 1, l1, "Ball In Play"
  373. NFadeLm 2, l2a
  374. NFadeL 2, l2
  375. NFadeL 3, l3
  376. NFadeL 4, l4
  377. NFadeL 5, l5
  378. NFadeL 6, l6
  379. NFadeL 7, l7
  380. NFadeL 8, l8
  381. NFadeL 9, l9
  382. NFadeL 10, l10
  383. NFadeTm 11, l11a, "Same Player Shoots Again"
  384. NFadeL 11, l11
  385. NFadeL 12, l12
  386. NFadeL 14, l14
  387. NFadeL 15, l15
  388. NFadeL 17, l17
  389. NFadeLm 18, l18
  390. NFadeL 18, l18a
  391. NFadeL 19, l19
  392. NFadeL 20, l20
  393. NFadeL 21, l21
  394. NFadeL 22, l22
  395. NFadeL 23, l23
  396. NFadeL 24, l24
  397. NFadeL 25, l25
  398. NFadeL 26, l26
  399. NFadeT 27, l27, "Match"
  400. NFadeL 28, l28
  401. NFadeT 29, l29, "High Score to Date"
  402. NFadeL 30, l30
  403. NFadeL 31, l31
  404. NFadeL 33, l33
  405. NFadeL 34, l34
  406. NFadeL 35, l35
  407. NFadeL 36, l36
  408. NFadeL 37, l37
  409. NFadeL 38, l38
  410. NFadeL 39, l39
  411. NFadeL 40, l40
  412. NFadeL 41, l41
  413. NFadeL 42, l42
  414. NFadeL 43, l43
  415. NFadeL 44, l44
  416. NFadeT 45, l45, "Game Over"
  417. NFadeL 46, l46
  418. NFadeL 47, l47
  419. NFadeL 49, l49
  420. NFadeL 50, l50
  421. NFadeL 51, l51
  422. NFadeL 52, l52
  423. NFadeL 53, l53
  424. NFadeL 54, l54
  425. NFadeL 55, l55
  426. NFadeL 56, l56
  427. NFadeL 57, l57
  428. NFadeL 58, l58
  429. NFadeL 59, l59
  430. NFadeL 60, l60
  431. NFadeT 61, l61, "TILT"
  432. NFadeL 62, l62
  433. NFadeL 63, l63
  434. NFadeL 65, l65
  435. NFadeL 66, l66
  436. NFadeL 81, l81
  437. NFadeL 82, l82
  438. NFadeL 83, l83
  439. NFadeL 97, l97
  440. NFadeL 98, l98
  441. NFadeL 99, l99
  442. NFadeL 113, l113
  443. NFadeLm 114, l114a
  444. NFadeL 114, l114
  445. NFadeL 115, l115
  446. End Sub
  447.  
  448. ' div lamp subs
  449.  
  450. Sub InitLamps()
  451. Dim x
  452. For x = 0 to 200
  453. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  454. FadingLevel(x) = 4 ' used to track the fading state
  455. FlashSpeedUp(x) = 0.2 ' faster speed when turning on the flasher
  456. FlashSpeedDown(x) = 0.1 ' slower speed when turning off the flasher
  457. FlashMax(x) = 1 ' the maximum value when on, usually 1
  458. FlashMin(x) = 0 ' the minimum value when off, usually 0
  459. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  460. FlashRepeat(x) = 20 ' how many times the flash repeats
  461. Next
  462. End Sub
  463.  
  464. Sub AllLampsOff
  465. Dim x
  466. For x = 0 to 200
  467. SetLamp x, 0
  468. Next
  469. End Sub
  470.  
  471. Sub SetLamp(nr, value)
  472. If value <> LampState(nr)Then
  473. LampState(nr) = abs(value)
  474. FadingLevel(nr) = abs(value) + 4
  475. End If
  476. End Sub
  477.  
  478. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  479.  
  480. Sub NFadeL(nr, object)
  481. Select Case FadingLevel(nr)
  482. Case 4:object.state = 0:FadingLevel(nr) = 0
  483. Case 5:object.state = 1:FadingLevel(nr) = 1
  484. End Select
  485. End Sub
  486.  
  487. Sub NFadeLm(nr, object) ' used for multiple lights
  488. Select Case FadingLevel(nr)
  489. Case 4:object.state = 0
  490. Case 5:object.state = 1
  491. End Select
  492. End Sub
  493.  
  494. 'Lights, Ramps & Primitives used as 4 step fading lights
  495. 'a,b,c,d are the images used from on to off
  496.  
  497. Sub FadeObj(nr, object, a, b, c, d)
  498. Select Case FadingLevel(nr)
  499. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  500. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  501. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  502. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  503. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  504. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  505. End Select
  506. End Sub
  507.  
  508. Sub FadeObjm(nr, object, a, b, c, d)
  509. Select Case FadingLevel(nr)
  510. Case 4:object.image = b
  511. Case 5:object.image = a
  512. Case 9:object.image = c
  513. Case 13:object.image = d
  514. End Select
  515. End Sub
  516.  
  517. Sub NFadeObj(nr, object, a, b)
  518. Select Case FadingLevel(nr)
  519. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  520. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  521. End Select
  522. End Sub
  523.  
  524. Sub NFadeObjm(nr, object, a, b)
  525. Select Case FadingLevel(nr)
  526. Case 4:object.image = b
  527. Case 5:object.image = a
  528. End Select
  529. End Sub
  530.  
  531. ' Flasher objects
  532.  
  533. Sub Flash(nr, object)
  534. Select Case FadingLevel(nr)
  535. Case 4 'off
  536. FlashLevel(nr) = FlashLevel(nr)- FlashSpeedDown(nr)
  537. If FlashLevel(nr) < FlashMin(nr)Then
  538. FlashLevel(nr) = FlashMin(nr)
  539. FadingLevel(nr) = 0 'completely off
  540. End if
  541. Object.IntensityScale = FlashLevel(nr)
  542. Case 5 ' on
  543. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  544. If FlashLevel(nr) > FlashMax(nr)Then
  545. FlashLevel(nr) = FlashMax(nr)
  546. FadingLevel(nr) = 1 'completely on
  547. End if
  548. Object.IntensityScale = FlashLevel(nr)
  549. End Select
  550. End Sub
  551.  
  552. Sub Flashm(nr, object) 'multiple flashers, it doesn't change anything, it just follows the main flasher
  553. Select Case FadingLevel(nr)
  554. Case 4, 5
  555. Object.IntensityScale = FlashLevel(nr)
  556. End Select
  557. End Sub
  558.  
  559. Sub FlashBlink(nr, object)
  560. Select Case FadingLevel(nr)
  561. Case 4 'off
  562. FlashLevel(nr) = FlashLevel(nr)- FlashSpeedDown(nr)
  563. If FlashLevel(nr) < FlashMin(nr)Then
  564. FlashLevel(nr) = FlashMin(nr)
  565. FadingLevel(nr) = 0 'completely off
  566. End if
  567. Object.IntensityScale = FlashLevel(nr)
  568. If FadingLevel(nr) = 0 AND FlashRepeat(nr)Then 'repeat the flash
  569. FlashRepeat(nr) = FlashRepeat(nr)-1
  570. If FlashRepeat(nr)Then FadingLevel(nr) = 5
  571. End If
  572. Case 5 ' on
  573. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  574. If FlashLevel(nr) > FlashMax(nr)Then
  575. FlashLevel(nr) = FlashMax(nr)
  576. FadingLevel(nr) = 1 'completely on
  577. End if
  578. Object.IntensityScale = FlashLevel(nr)
  579. If FadingLevel(nr) = 1 AND FlashRepeat(nr)Then FadingLevel(nr) = 4
  580. End Select
  581. End Sub
  582.  
  583. ' Desktop Objects: Reels & texts (you may also use lights on the desktop)
  584.  
  585. ' Reels
  586.  
  587. Sub FadeR(nr, object)
  588. Select Case FadingLevel(nr)
  589. Case 4:object.SetValue 1:FadingLevel(nr) = 6 'fading to off...
  590. Case 5:object.SetValue 0:FadingLevel(nr) = 1 'ON
  591. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  592. Case 9:object.SetValue 2:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  593. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  594. Case 13:object.SetValue 3:FadingLevel(nr) = 0 'Off
  595. End Select
  596. End Sub
  597.  
  598. Sub FadeRm(nr, object)
  599. Select Case FadingLevel(nr)
  600. Case 4:object.SetValue 1
  601. Case 5:object.SetValue 0
  602. Case 9:object.SetValue 2
  603. Case 3:object.SetValue 3
  604. End Select
  605. End Sub
  606.  
  607. 'Texts
  608.  
  609. Sub NFadeT(nr, object, message)
  610. Select Case FadingLevel(nr)
  611. Case 4:object.Text = "":FadingLevel(nr) = 0
  612. Case 5:object.Text = message:FadingLevel(nr) = 1
  613. End Select
  614. End Sub
  615.  
  616. Sub NFadeTm(nr, object, message)
  617. Select Case FadingLevel(nr)
  618. Case 4:object.Text = ""
  619. Case 5:object.Text = message
  620. End Select
  621. End Sub
  622.  
  623. '************************************
  624. ' LEDs Display
  625. ' Based on Scapino's LEDs
  626. '************************************
  627.  
  628. Dim Digits(32)
  629. Dim Patterns(11)
  630. Dim Patterns2(11)
  631.  
  632. Patterns(0) = 0 'empty
  633. Patterns(1) = 63 '0
  634. Patterns(2) = 6 '1
  635. Patterns(3) = 91 '2
  636. Patterns(4) = 79 '3
  637. Patterns(5) = 102 '4
  638. Patterns(6) = 109 '5
  639. Patterns(7) = 125 '6
  640. Patterns(8) = 7 '7
  641. Patterns(9) = 127 '8
  642. Patterns(10) = 111 '9
  643.  
  644. Patterns2(0) = 128 'empty
  645. Patterns2(1) = 191 '0
  646. Patterns2(2) = 134 '1
  647. Patterns2(3) = 219 '2
  648. Patterns2(4) = 207 '3
  649. Patterns2(5) = 230 '4
  650. Patterns2(6) = 237 '5
  651. Patterns2(7) = 253 '6
  652. Patterns2(8) = 135 '7
  653. Patterns2(9) = 255 '8
  654. Patterns2(10) = 239 '9
  655.  
  656. 'Assign 7-digit output to reels
  657. Set Digits(0) = a0
  658. Set Digits(1) = a1
  659. Set Digits(2) = a2
  660. Set Digits(3) = a3
  661. Set Digits(4) = a4
  662. Set Digits(5) = a5
  663. Set Digits(6) = a6
  664.  
  665. Set Digits(7) = b0
  666. Set Digits(8) = b1
  667. Set Digits(9) = b2
  668. Set Digits(10) = b3
  669. Set Digits(11) = b4
  670. Set Digits(12) = b5
  671. Set Digits(13) = b6
  672.  
  673. Set Digits(14) = c0
  674. Set Digits(15) = c1
  675. Set Digits(16) = c2
  676. Set Digits(17) = c3
  677. Set Digits(18) = c4
  678. Set Digits(19) = c5
  679. Set Digits(20) = c6
  680.  
  681. Set Digits(21) = d0
  682. Set Digits(22) = d1
  683. Set Digits(23) = d2
  684. Set Digits(24) = d3
  685. Set Digits(25) = d4
  686. Set Digits(26) = d5
  687. Set Digits(27) = d6
  688.  
  689. Set Digits(28) = e0
  690. Set Digits(29) = e1
  691. Set Digits(30) = e2
  692. Set Digits(31) = e3
  693.  
  694. Sub UpdateLeds
  695. On Error Resume Next
  696. Dim ChgLED, ii, jj, chg, stat
  697. ChgLED = Controller.ChangedLEDs(&HFF, &HFFFF)
  698. If Not IsEmpty(ChgLED)Then
  699. For ii = 0 To UBound(ChgLED)
  700. chg = chgLED(ii, 1):stat = chgLED(ii, 2)
  701. For jj = 0 to 10
  702. If stat = Patterns(jj)OR stat = Patterns2(jj)then Digits(chgLED(ii, 0)).SetValue jj
  703. Next
  704. Next
  705. End IF
  706. End Sub
  707.  
  708. '******************************
  709. ' Diverse Collection Hit Sounds
  710. '******************************
  711.  
  712. Sub aMetals_Hit(idx):PlaySound "fx_MetalHit2", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  713. Sub aRubber_Bands_Hit(idx):PlaySound "fx_rubber_band", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  714. Sub aRubber_Posts_Hit(idx):PlaySound "fx_rubber_post", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  715. Sub aRubber_Pins_Hit(idx):PlaySound "fx_rubber_pin", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  716. Sub aPlastics_Hit(idx):PlaySound "fx_PlasticHit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  717. Sub aGates_Hit(idx):PlaySound "fx_Gate", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  718. Sub aWoods_Hit(idx):PlaySound "fx_Woodhit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  719.  
  720. ' *********************************************************************
  721. ' Supporting Ball & Sound Functions
  722. ' *********************************************************************
  723.  
  724. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  725. Vol = Csng(BallVel(ball) ^2 / 2000)
  726. End Function
  727.  
  728. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  729. Dim tmp
  730. tmp = ball.x * 2 / table1.width-1
  731. If tmp > 0 Then
  732. Pan = Csng(tmp ^10)
  733. Else
  734. Pan = Csng(-((- tmp) ^10))
  735. End If
  736. End Function
  737.  
  738. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  739. Pitch = BallVel(ball) * 20
  740. End Function
  741.  
  742. Function BallVel(ball) 'Calculates the ball speed
  743. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2)))
  744. End Function
  745.  
  746. Function AudioFade(ball) 'only on VPX 10.4 and newer
  747. Dim tmp
  748. tmp = ball.y * 2 / Table1.height-1
  749. If tmp > 0 Then
  750. AudioFade = Csng(tmp ^10)
  751. Else
  752. AudioFade = Csng(-((- tmp) ^10))
  753. End If
  754. End Function
  755.  
  756. '*****************************************
  757. ' JP's VP10 Rolling Sounds
  758. '*****************************************
  759.  
  760. Const tnob = 20 ' total number of balls
  761. Const lob = 0 'number of locked balls
  762. ReDim rolling(tnob)
  763. InitRolling
  764.  
  765. Sub InitRolling
  766. Dim i
  767. For i = 0 to tnob
  768. rolling(i) = False
  769. Next
  770. End Sub
  771.  
  772. Sub RollingUpdate()
  773. Dim BOT, b, ballpitch
  774. BOT = GetBalls
  775.  
  776. ' stop the sound of deleted balls
  777. For b = UBound(BOT) + 1 to tnob
  778. rolling(b) = False
  779. StopSound("fx_ballrolling" & b)
  780. Next
  781.  
  782. ' exit the sub if no balls on the table
  783. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  784.  
  785. ' play the rolling sound for each ball
  786. For b = lob to UBound(BOT)
  787. If BallVel(BOT(b)) > 1 Then
  788. If BOT(b).z < 30 Then
  789. ballpitch = Pitch(BOT(b))
  790. Else
  791. ballpitch = Pitch(BOT(b)) + 15000 'increase the pitch on a ramp or elevated surface
  792. End If
  793. rolling(b) = True
  794. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
  795. Else
  796. If rolling(b) = True Then
  797. StopSound("fx_ballrolling" & b)
  798. rolling(b) = False
  799. End If
  800. End If
  801. Next
  802. End Sub
  803.  
  804. '**********************
  805. ' Ball Collision Sound
  806. '**********************
  807.  
  808. Sub OnBallBallCollision(ball1, ball2, velocity)
  809. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 200, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  810. End Sub
  811.  
  812.  
  813. 'Bally Black Pyramid
  814. 'Added by Inkochnito
  815. Sub editDips
  816. Dim vpmDips:Set vpmDips = New cvpmDips
  817. With vpmDips
  818. .AddForm 700, 400, "Black Pyramid - DIP switches"
  819. .AddFrame 2, 0, 190, "Maximum credits", &H03000000, Array("10 credits", 0, "15 credits", &H01000000, "25 credits", &H02000000, "40 credits", &H03000000) 'dip 25&26
  820. .AddFrame 2, 76, 190, "Balls per game", &HC0000000, Array("2 balls", &HC0000000, "3 balls", 0, "4 balls", &H80000000, "5 balls", &H40000000) 'dip 31&32
  821. .AddFrame 2, 154, 190, "Bonus special", &H00600000, Array("on after 120K", 0, "on with 120K", &H00400000, "on with 60K", &H00600000) 'dip 22&23
  822. .AddChk 2, 217, 100, Array("Match feature", &H08000000) 'dip 28
  823. .AddChk 2, 232, 100, Array("Credits display", &H04000000) 'dip 27
  824. .AddChk 2, 247, 100, Array("Attract sound", &H20000000) 'dip 30
  825. .AddFrame 205, 0, 190, "Left lane X-ball build up", &H000000C0, Array("90000", 0, "80000", &H00000040, "70000", &H00000080, "50000", &H000000C0) 'dip 7&8
  826. .AddFrame 205, 76, 190, "Bonus special per game", &H00000020, Array("only 1", 0, "unlimited", &H00000020) 'dip 6
  827. .AddFrame 205, 122, 190, "M and I return lanes", &H00002000, Array("lanes separated", 0, "lanes tied together", &H00002000) 'dip 14
  828. .AddFrame 205, 168, 190, "Left roll up lane", &H00100000, Array("20000 initially unlit", 0, "20000 initially lit", &H00100000) 'dip 21
  829. .AddFrame 205, 214, 190, "Right lane 50000", &H00800000, Array("alternates", 0, "stays on", &H00800000) 'dip 24
  830. .AddLabel 25, 270, 350, 20, "Set selftest position 16,17,18 and 19 to 03 for the best gameplay."
  831. .AddLabel 25, 290, 350, 20, "After hitting OK, press F3 to reset game with new settings."
  832. .ViewDips
  833. End With
  834. End Sub
  835. Set vpmShowDips = GetRef("editDips")
  836.  
  837. '**************************************************************************
  838. ' Positional Sound Playback Functions by DJRobX
  839. '**************************************************************************
  840.  
  841. 'Set position as table object (Use object or light but NOT wall) and Vol to 1
  842.  
  843. Sub PlaySoundAt(sound, tableobj)
  844. PlaySound sound, 1, 1, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  845. End Sub
  846.  
  847.  
  848. 'Set all as per ball position & speed.
  849.  
  850. Sub PlaySoundAtBall(sound)
  851. PlaySound sound, 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  852. End Sub
  853.  
  854.  
  855. 'Set position as table object and Vol manually.
  856.  
  857. Sub PlaySoundAtVol(sound, tableobj, Vol)
  858. PlaySound sound, 1, Vol, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  859. End Sub
  860.  
  861.  
  862. 'Set all as per ball position & speed, but Vol Multiplier may be used eg; PlaySoundAtBallVol "sound",3
  863.  
  864. Sub PlaySoundAtBallVol(sound, VolMult)
  865. PlaySound sound, 0, Vol(ActiveBall) * VolMult, Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  866. End Sub
  867.  
  868.  
  869. 'Set position as bumperX and Vol manually.
  870.  
  871. Sub PlaySoundAtBumperVol(sound, tableobj, Vol)
  872. PlaySound sound, 1, Vol, Pan(tableobj), 0,0,1, 1, AudioFade(tableobj)
  873. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement