Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.07 KB | None | 0 0
  1. '**********************
  2. ' Xenon Bally(1980)
  3. ' VPX table by jpsalas
  4. ' modified by HauntFreaks, Bord
  5. ' version 1.2.3
  6. '**********************
  7.  
  8. Option Explicit
  9. Randomize
  10.  
  11. On Error Resume Next
  12. ExecuteGlobal GetTextFile("controller.vbs")
  13. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  14. On Error Goto 0
  15.  
  16. LoadVPM "01550000", "Bally.vbs", 3.26
  17.  
  18. Dim bsTrough, bsLeftHole, bsTopHole, bsOuthole, dtRBank, FastFlips
  19. Const cGameName = "Xenon"
  20.  
  21. Const UseSolenoids = 1
  22. Const UseLamps = 0
  23. Const UseGI = 0
  24. Const UseSync = 0
  25. Const HandleMech = 0
  26.  
  27. 'Standard Sounds
  28. Const SSolenoidOn = "fx_Solenoid"
  29. Const SSolenoidOff = ""
  30. Const SCoin = "fx_Coin"
  31.  
  32. '************
  33. ' Table init.
  34. '************
  35.  
  36. Sub Table1_Init
  37. vpmInit me
  38.  
  39. With Controller
  40. .GameName = cGameName
  41. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description:Exit Sub
  42. .SplashInfoLine = "Xenon, Bally 1980" & vbNewLine & "VPX table by JPSalas v.1.0.3"
  43. .Games(cGameName).Settings.Value("rol") = 0 '1= rotated display, 0= normal
  44. .HandleMechanics = 0
  45. .HandleKeyboard = 0
  46. .ShowDMDOnly = 1
  47. .ShowFrame = 0
  48. .ShowTitle = 0
  49. .Hidden = 0
  50. If Err Then MsgBox Err.Description
  51. End With
  52. On Error Goto 0
  53. Controller.SolMask(0) = 0
  54. vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  55. Controller.Run
  56.  
  57. Set FastFlips = new cFastFlips
  58. with FastFlips
  59. .CallBackL = "SolLflipper" 'Point these to flipper subs
  60. .CallBackR = "SolRflipper" '...
  61. ' .CallBackUL = "SolULflipper"'...(upper flippers, if needed)
  62. ' .CallBackUR = "SolURflipper"'...
  63. .TiltObjects = True 'Optional, if True calls vpmnudge.solgameon automatically. IF YOU GET A LINE 1 ERROR, DISABLE THIS! (or setup vpmNudge.TiltObj!)
  64. ' .InitDelay "FastFlips", 100 'Optional, if > 0 adds some compensation for solenoid jitter (occasional problem on Bram Stoker's Dracula)
  65. ' .DebugOn = False 'Debug, always-on flippers. Call FastFlips.DebugOn True or False in debugger to enable/disable.
  66. end with
  67.  
  68. 'Nudging
  69. vpmNudge.TiltSwitch = 7
  70. vpmNudge.Sensitivity = 2
  71. vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, Bumper4, LeftSlingshot, RightSlingShot)
  72.  
  73. 'Trough
  74. Set bsTrough = New cvpmBallStack
  75. With bsTrough
  76. .InitSw 8, 2, 28, 0, 0, 0, 0, 0
  77. .InitKick ballrelease, 90, 4
  78. .InitEntrySnd "fx_Solenoid", "fx_Solenoid"
  79. .InitExitSnd SoundFX("fx_ballrel", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
  80. .IsTrough = True
  81. .Balls = 1
  82. End With
  83.  
  84. 'Left hole
  85. Set bsLeftHole = New cvpmBallStack
  86. With bsLeftHole
  87. .InitSaucer sw33, 33, 100, 10
  88. .KickForceVar = 2
  89. .KickAngleVar = 2
  90. .InitExitSnd SoundFX("fx_kicker", DOFContactors), SoundFX("fx_kicker", DOFContactors)
  91. .InitAddSnd SoundFX("fx_kicker_enter", DOFContactors)
  92. End With
  93.  
  94. 'Right hole
  95. Set bsTopHole = New cvpmBallStack
  96. With bsTopHole
  97. .InitSaucer sw34, 34, 165, 10
  98. .KickForceVar = 2
  99. .KickAngleVar = 2
  100. .InitExitSnd SoundFX("fx_kicker", DOFContactors), SoundFX("fx_kicker", DOFContactors)
  101. .InitAddSnd SoundFX("fx_kicker_enter", DOFContactors)
  102. .CreateEvents "bsTopHole", sw34
  103. End With
  104.  
  105. 'Droptargets
  106. set dtRBank = new cvpmdroptarget
  107. With dtRBank
  108. .InitDrop Array(sw21,sw22,sw23,sw24), Array(21, 22, 23, 24)
  109. .Initsnd SoundFX("fx_droptarget", DOFContactors), SoundFX("fx_resetdrop", DOFContactors)
  110. '.CreateEvents "dtRBank" 'this doesn't work with the new droptargets
  111. End With
  112.  
  113. 'Main Timer init
  114. PinMAMETimer.Interval = PinMAMEInterval
  115. PinMAMETimer.Enabled = 1
  116.  
  117. bsTrough.AddBall 1
  118.  
  119. ' Remove the cabinet rails if in FS mode
  120. If Table1.ShowDT = False then
  121. Ramp6.Visible = False
  122. Ramp9.Visible = False
  123. Ramp12.Visible = False
  124. Ramp4.Visible = False
  125. Ramp13.Visible = False
  126. Ramp10.Visible = False
  127. backwallmetalbrackets_prim.Visible = False
  128. backwallmetal_prim.Visible = False
  129. backwallmetalscrews_prim.Visible = False
  130. backwallwood_prim.Visible = False
  131. End If
  132. End Sub
  133.  
  134. Sub table1_Paused:Controller.Pause = 1:End Sub
  135. Sub table1_unPaused:Controller.Pause = 0:End Sub
  136.  
  137. '**********
  138. ' Keys
  139. '**********
  140.  
  141. Sub table1_KeyDown(ByVal Keycode)
  142. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
  143. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
  144. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
  145. If keycode = PlungerKey Then PlaySound "fx_PlungerPull", 0, 1, 0.1, 0.05:Plunger.Pullback
  146. If KeyCode = LeftFlipperKey then FastFlips.FlipL True : FastFlips.FlipUL True
  147. If KeyCode = RightFlipperKey then FastFlips.FlipR True : FastFlips.FlipUR True
  148. If vpmKeyDown(keycode) Then Exit Sub
  149. End Sub
  150.  
  151. Sub table1_KeyUp(ByVal Keycode)
  152. If keycode = PlungerKey Then PlaySound "fx_plunger", 0, 1, 0.1, 0.05:Plunger.Fire
  153. If KeyCode = LeftFlipperKey then FastFlips.FlipL False : FastFlips.FlipUL False
  154. If KeyCode = RightFlipperKey then FastFlips.FlipR False : FastFlips.FlipUR False
  155. If vpmKeyUp(keycode) Then Exit Sub
  156. End Sub
  157.  
  158. '*********
  159. ' Switches
  160. '*********
  161.  
  162. 'Slings & Rubbers
  163. Dim LStep, RStep
  164.  
  165. Sub LeftSlingShot_Slingshot
  166. PlaySound SoundFX("fx_slingshot", DOFContactors), 0, 1, -0.05, 0.05
  167. LeftSling4.Visible = 1
  168. Lemk.RotX = 26
  169. LStep = 0
  170. vpmTimer.PulseSw 36
  171. LeftSlingShot.TimerEnabled = 1
  172. End Sub
  173.  
  174. Sub LeftSlingShot_Timer
  175. Select Case LStep
  176. Case 1:LeftSLing4.Visible = 0:LeftSLing3.Visible = 1:Lemk.RotX = 14
  177. Case 2:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:Lemk.RotX = 2
  178. Case 3:LeftSLing2.Visible = 0:Lemk.RotX = -10:LeftSlingShot.TimerEnabled = 0
  179. End Select
  180. LStep = LStep + 1
  181. End Sub
  182.  
  183. Sub RightSlingShot_Slingshot
  184. PlaySound SoundFX("fx_slingshot", DOFContactors), 0, 1, 0.05, 0.05
  185. RightSling4.Visible = 1
  186. Remk.RotX = 26
  187. RStep = 0
  188. vpmTimer.PulseSw 35
  189. RightSlingShot.TimerEnabled = 1
  190. End Sub
  191.  
  192. Sub RightSlingShot_Timer
  193. Select Case RStep
  194. Case 1:RightSLing4.Visible = 0:RightSLing3.Visible = 1:Remk.RotX = 14
  195. Case 2:RightSLing3.Visible = 0:RightSLing2.Visible = 1:Remk.RotX = 2
  196. Case 3:RightSLing2.Visible = 0:Remk.RotX = -10:RightSlingShot.TimerEnabled = 0
  197. End Select
  198. RStep = RStep + 1
  199. End Sub
  200.  
  201. 'Rubbers
  202.  
  203. Sub sw26_Hit():PlaySound "fx_Rubber", 0, 1, -0.1, 0.15::vpmTimer.PulseSw 26:End Sub
  204. Sub sw26a_Hit():PlaySound "fx_Rubber", 0, 1, 0.1, 0.15::vpmTimer.PulseSw 26:End Sub
  205.  
  206. 'Spinner
  207. Sub sw5_Spin():vpmTimer.pulsesw 5:PlaySound "fx_spinner":End Sub
  208.  
  209. ' Bumpers
  210. Sub Bumper1_Hit:vpmTimer.PulseSw 40:PlaySound SoundFX("fx_bumper", DOFContactors), 0, 1, -0.1, 0.15:End Sub
  211. Sub Bumper2_Hit:vpmTimer.PulseSw 39:PlaySound SoundFX("fx_bumper", DOFContactors), 0, 1, 0.1, 0.15:End Sub
  212. Sub Bumper3_Hit:vpmTimer.PulseSw 38:PlaySound SoundFX("fx_bumper", DOFContactors), 0, 1, 0, 0.15:End Sub
  213. Sub Bumper4_Hit:vpmTimer.PulseSw 37:PlaySound SoundFX("fx_bumper", DOFContactors), 0, 1, 0, 0.15:End Sub
  214.  
  215. 'Rollover & Ramp Switches
  216. Sub sw1_Hit:Controller.Switch(1) = 1:PlaySound "fx_sensor", 0, 1, -0.1, 0.15:StopSound "wireramp":End Sub
  217. Sub sw1_UnHit:Controller.Switch(1) = 0:End Sub
  218.  
  219. Sub sw17_Hit:w17.IsDropped=1:Controller.Switch(17) = 1:PlaySound "fx_sensor", 0, 1, 0, 0.15:End Sub
  220. Sub sw17_UnHit:w17.IsDropped=0:Controller.Switch(17) = 0:End Sub
  221.  
  222. Sub sw18_Hit:w18.IsDropped=1:Controller.Switch(18) = 1:PlaySound "fx_sensor", 0, 1, 0, 0.15:End Sub
  223. Sub sw18_UnHit:w18.IsDropped=0:Controller.Switch(18) = 0:End Sub
  224.  
  225. Sub sw19_Hit:w19.IsDropped=1:Controller.Switch(19) = 1:PlaySound "fx_sensor", 0, 1, 0, 0.15:End Sub
  226. Sub sw19_UnHit:w19.IsDropped=0:Controller.Switch(19) = 0:End Sub
  227.  
  228. Sub sw20_Hit:w20.IsDropped=1:Controller.Switch(20) = 1:PlaySound "fx_sensor", 0, 1, 0, 0.15:End Sub
  229. Sub sw20_UnHit:w20.IsDropped=0:Controller.Switch(20) = 0:End Sub
  230.  
  231. Sub sw25_Hit:Controller.Switch(25) = 1:PlaySound "fx_sensor", 0, 1, 0.1, 0.15:End Sub
  232. Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
  233.  
  234. Sub sw27_Hit:Controller.Switch(27) = 1:PlaySound "fx_sensor", 0, 1, 0.1, 0.15:End Sub
  235. Sub sw27_UnHit:Controller.Switch(27) = 0:End Sub
  236.  
  237. Sub sw29_Hit:Controller.Switch(29) = 1:PlaySound "fx_sensor", 0, 1, -0.1, 0.15:End Sub
  238. Sub sw29_UnHit:Controller.Switch(20) = 0:End Sub
  239.  
  240. Sub sw30_Hit:Controller.Switch(30) = 1:PlaySound "fx_sensor", 0, 1, -0.1, 0.15:End Sub
  241. Sub sw30_UnHit:Controller.Switch(30) = 0:End Sub
  242.  
  243. Sub sw31_Hit:Controller.Switch(31) = 1:PlaySound "fx_sensor", 0, 1, 0.1, 0.15:End Sub
  244. Sub sw31_UnHit:Controller.Switch(31) = 0:End Sub
  245.  
  246. Sub sw32_Hit:Controller.Switch(32) = 1:PlaySound "fx_sensor", 0, 1, 0.1, 0.15:End Sub
  247. Sub sw32_UnHit:Controller.Switch(32) = 0:End Sub
  248.  
  249. 'Standup Targets
  250. Sub sw3_Hit:vpmTimer.PulseSw 3:PlaySound SoundFX("fx_target", DOFContactors), 0, 1, -0.1, 0.15:End Sub
  251. Sub sw4_Hit:vpmTimer.PulseSw 4:PlaySound SoundFX("fx_target", DOFContactors), 0, 1, -0.1, 0.15:End Sub
  252.  
  253. 'Droptargets VPX
  254. Sub sw21_Hit:PlaySound SoundFX("fx_droptarget", DOFContactors), 0, 1, 0.1, 0.15:End Sub 'hit event only for the sound
  255. Sub sw21_Dropped:dtRBank.hit 1 : D1L1.state=1 : End Sub
  256.  
  257. Sub sw22_Hit:PlaySound SoundFX("fx_droptarget", DOFContactors), 0, 1, 0.1, 0.15:End Sub 'hit event only for the sound
  258. Sub sw22_Dropped:dtRBank.hit 2 : D2L1.state=1 : D2L2.state=1 : End Sub
  259.  
  260. Sub sw23_Hit:PlaySound SoundFX("fx_droptarget", DOFContactors), 0, 1, 0.1, 0.15:End Sub 'hit event only for the sound
  261. Sub sw23_Dropped:dtRBank.hit 3 : D3L1.state=1 : D3L2.state=1 : End Sub
  262.  
  263. Sub sw24_Hit:PlaySound SoundFX("fx_droptarget", DOFContactors), 0, 1, 0.1, 0.15:End Sub 'hit event only for the sound
  264. Sub sw24_Dropped:dtRBank.hit 4 : D4L1.state=1 : D4L2.state=1 : End Sub
  265.  
  266. ' Drain & holes
  267. Sub sw33_Hit():bsLeftHole.AddBall 0:End Sub
  268. Sub Drain_Hit:Playsound "fx_drain":bsTrough.AddBall Me:End Sub
  269.  
  270. '***********
  271. ' Solenoids
  272. '***********
  273. ' from pacdudes script
  274.  
  275. SolCallback(1) = "SolDropUp"
  276. SolCallback(2) = "dtRBank.SolHit 4,"
  277. SolCallback(3) = "dtRBank.SolHit 3,"
  278. SolCallback(4) = "dtRBank.SolHit 2,"
  279. SolCallback(5) = "dtRBank.SolHit 1,"
  280. SolCallback(6) = "vpmsolsound SoundFX(""fx_knocker"",DOFKnocker),"
  281. SolCallback(7) = "bsTrough.SolIn"
  282. SolCallback(8) = "bsTrough.SolOut"
  283. SolCallback(9) = "SolLeftOut"
  284. SolCallback(17) = "SolTopOut"
  285. SolCallback(19) = "FastFlips.TiltSol"
  286. 'SolCallback(19) = "ACRelay"
  287. 'SolCallback(20) = "PowerOn"
  288.  
  289. 'Took a look at Xenon. While Sol18 kind of works, correct one should be Sol19.
  290. '
  291. 'The tilt solenoid is assigned to vpmNudge.SolGameOn, but FastFlips.TiltObjects = True it will call that automatically. So you can safely replace the existing script.
  292.  
  293. ''Solenoid Subs
  294. 'Sub ACRelay(enabled)
  295. ' vpmNudge.SolGameOn enabled
  296. 'End Sub
  297.  
  298. '**************
  299. ' Flipper Subs
  300. '**************
  301.  
  302. SolCallback(sLRFlipper) = "SolRFlipper"
  303. SolCallback(sLLFlipper) = "SolLFlipper"
  304.  
  305. Sub SolLFlipper(Enabled)
  306. If Enabled Then
  307. PlaySound SoundFX("fx_flipperup", DOFContactors), 0, 1, -0.1, 0.25
  308. LeftFlipper.RotateToEnd
  309. Else
  310. PlaySound SoundFX("fx_flipperdown", DOFContactors), 0, 1, -0.1, 0.25
  311. LeftFlipper.RotateToStart
  312. End If
  313. End Sub
  314.  
  315. Sub SolRFlipper(Enabled)
  316. If Enabled Then
  317. PlaySound SoundFX("fx_flipperup", DOFContactors), 0, 1, 0.1, 0.25
  318. RightFlipper.RotateToEnd
  319. Else
  320. PlaySound SoundFX("fx_flipperdown", DOFContactors), 0, 1, 0.1, 0.25
  321. RightFlipper.RotateToStart
  322. End If
  323. End Sub
  324.  
  325. Sub LeftFlipper_Collide(parm)
  326. PlaySound "fx_rubber_flipper", 0, parm / 10, -0.1, 0.15
  327. End Sub
  328.  
  329. Sub RightFlipper_Collide(parm)
  330. PlaySound "fx_rubber_flipper", 0, parm / 10, 0.1, 0.15
  331. End Sub
  332.  
  333. '***** kicker animation
  334.  
  335. Dim LeftKick, TopKick
  336.  
  337. Sub SolLeftOut(enabled)
  338. If enabled Then
  339. bslefthole.ExitSol_On
  340. LeftKick = 0
  341. kickarmleft_prim.ObjRotY = 12
  342. LeftKickTimer.Enabled = 1
  343. End If
  344. End Sub
  345.  
  346. Sub LeftKickTimer_Timer
  347. Select Case LeftKick
  348. Case 1:kickarmleft_prim.ObjRotY = 50
  349. Case 2:kickarmleft_prim.ObjRotY = 50
  350. Case 3:kickarmleft_prim.ObjRotY = 50
  351. Case 4:kickarmleft_prim.ObjRotY = 50
  352. Case 5:kickarmleft_prim.ObjRotY = 50
  353. Case 6:kickarmleft_prim.ObjRotY = 50
  354. Case 7:kickarmleft_prim.ObjRotY = 50
  355. Case 8:kickarmleft_prim.ObjRotY = 50
  356. Case 9:kickarmleft_prim.ObjRotY = 50
  357. Case 10:kickarmleft_prim.ObjRotY = 50
  358. Case 11:kickarmleft_prim.ObjRotY = 24
  359. Case 12:kickarmleft_prim.ObjRotY = 12
  360. Case 13:kickarmleft_prim.ObjRotY = 0:LeftKickTimer.Enabled = 0
  361. End Select
  362. LeftKick = LeftKick + 1
  363. End Sub
  364.  
  365. Sub SoltopOut(enabled)
  366. If enabled Then
  367. bstophole.ExitSol_On
  368. topKick = 0
  369. kickarmtop_prim.ObjRotX = -12
  370. topKickTimer.Enabled = 1
  371. End If
  372. End Sub
  373.  
  374. Sub topKickTimer_Timer
  375. Select Case topKick
  376. Case 1:kickarmtop_prim.ObjRotX = -50
  377. Case 2:kickarmtop_prim.ObjRotX = -50
  378. Case 3:kickarmtop_prim.ObjRotX = -50
  379. Case 4:kickarmtop_prim.ObjRotX = -50
  380. Case 5:kickarmtop_prim.ObjRotX = -50
  381. Case 6:kickarmtop_prim.ObjRotX = -50
  382. Case 7:kickarmtop_prim.ObjRotX = -50
  383. Case 8:kickarmtop_prim.ObjRotX = -50
  384. Case 9:kickarmtop_prim.ObjRotX = -50
  385. Case 10:kickarmtop_prim.ObjRotX = -50
  386. Case 11:kickarmtop_prim.ObjRotX = -24
  387. Case 12:kickarmtop_prim.ObjRotX = -12
  388. Case 13:kickarmtop_prim.ObjRotX = 0:topKickTimer.Enabled = 0
  389. End Select
  390. topKick = topKick + 1
  391. End Sub
  392.  
  393. '*****Drop lights off
  394. dim xx
  395. For each xx in DTLights: xx.state=0:Next
  396.  
  397. Sub SolDropUp(enabled)
  398. dim xx
  399. if enabled Then
  400. dtRBank.SolDropUp enabled
  401. For each xx in DTLights: xx.state=0:Next
  402. end if
  403. End Sub
  404.  
  405. '******************************************************
  406. ' JP's VP10 Fading Lamps & Flashers
  407. ' very reduced, mostly for rom activated flashers
  408. ' if you need to turn a light on or off then use:
  409. ' LightState(lightnumber) = 0 or 1
  410. ' Based on PD's Fading Light System
  411. '******************************************************
  412.  
  413. Dim LightState(200), FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  414.  
  415. InitFlashers() ' turn off the lights and flashers and reset them to the default parameters
  416.  
  417. LampTimer.Interval = 50 'lamp fading speed
  418. LampTimer.Enabled = 1
  419.  
  420. Sub LampTimer_timer()
  421. Dim chgLamp, x
  422. chgLamp = Controller.ChangedLamps
  423. If Not IsEmpty(chgLamp) Then
  424. For x = 0 To UBound(chgLamp)
  425. LightState(chgLamp(x, 0) ) = chgLamp(x, 1) 'light state as set by the rom
  426. Next
  427. End If
  428. ' Lights & Flashers
  429. LightX 2, l2
  430. LightX 3, l3
  431. LightX 4, l4
  432. LightXm 5, l5b
  433. LightXm 5, l5c
  434. LightX 5, l5
  435. LightX 6, l6
  436. LightX 7, l7
  437. LightX 8, l8
  438. LightX 9, l9
  439. Flashm 10, Diode1
  440. Flash 10, Diode2
  441. LightX 11, l11
  442. LightX 12, l12
  443. Flashm 14, Diode9
  444. Flash 14, Diode10
  445. LightX 15, l15
  446. LightX 17, l17
  447. LightX 18, l18
  448. LightX 19, l19
  449. LightX 20, l20
  450. LightXm 21, l21b
  451. LightXm 21, l21c
  452. LightX 21, l21
  453. LightX 22, l22
  454. LightX 23, l23
  455. LightX 24, l24
  456. LightX 25, l25
  457. LightXm 26, l26a
  458. LightX 26, l26
  459. LightX 28, l28
  460. Flashm 30, Diode7
  461. Flash 30, Diode8
  462. LightX 31, l31
  463. LightX 33, l33
  464. LightX 34, l34
  465. LightX 35, l35
  466. LightX 36, l36
  467. LightXm 37, l37b
  468. LightXm 37, l37c
  469. LightX 37, l37
  470. LightX 38, l38
  471. LightX 39, l39
  472. LightX 40, l40
  473. LightX 41, l41
  474. LightX 42, l42
  475. LightX 44, l44
  476. Flashm 46, Diode5
  477. Flash 46, Diode6
  478. LightX 47, l47
  479. LightX 49, l49
  480. LightX 50, l50
  481. LightX 51, l51
  482. LightXm 52, l52b
  483. LightX 52, l52
  484. LightXm 53, l53b
  485. LightXm 53, l53c
  486. LightX 53, l53
  487. LightX 54, l54
  488. LightX 55, l55
  489. LightX 56, l56
  490. LightX 57, l57
  491. LightX 58, l58
  492. LightX 59, l59
  493. LightX 60, l60
  494. Flashm 62, Diode3
  495. Flash 62, Diode4
  496. LightX 63, l63
  497. LightXm 69, l69a
  498. LightX 69, l69
  499. LightX 101, l101
  500. Flashm 199, f199
  501. Flash 199, f199a
  502. End Sub
  503.  
  504. ' div lamp subs
  505.  
  506. Sub InitFlashers()
  507. Dim x
  508. For x = 0 to 200
  509. LightState(x) = 0 ' light state: 0=off, 1=on, -1=no change (on or off)
  510. FlashSpeedUp(x) = 0.5 ' Fade Speed Up
  511. FlashSpeedDown(x) = 0.25 ' Fade Speed Down
  512. FlashMax(x) = 1 ' the maximum intensity when on, usually 1
  513. FlashMin(x) = 0 ' the minimum intensity when off, usually 0
  514. FlashLevel(x) = 0 ' the intensity/fading of the flashers
  515. Next
  516. End Sub
  517.  
  518. ' VPX Lights, just turn them on or off
  519.  
  520. Sub LightX(nr, object)
  521. Select Case LightState(nr)
  522. Case 0, 1:object.state = LightState(nr):LightState(nr) = -1
  523. End Select
  524. End Sub
  525.  
  526. Sub LightXm(nr, object) 'multiple lights
  527. Select Case LightState(nr)
  528. Case 0, 1:object.state = LightState(nr)
  529. End Select
  530. End Sub
  531.  
  532. ' VPX Flashers, changes the intensity
  533.  
  534. Sub Flash(nr, object)
  535. Select Case LightState(nr)
  536. Case 0 'off
  537. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  538. If FlashLevel(nr) < FlashMin(nr) Then
  539. FlashLevel(nr) = FlashMin(nr)
  540. LightState(nr) = -1 'completely off, so stop the fading loop
  541. End if
  542. Object.IntensityScale = FlashLevel(nr)
  543. Case 1 ' on
  544. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  545. If FlashLevel(nr) > FlashMax(nr) Then
  546. FlashLevel(nr) = FlashMax(nr)
  547. LightState(nr) = -1 'completely on, so stop the fading loop
  548. End if
  549. Object.IntensityScale = FlashLevel(nr)
  550. End Select
  551. End Sub
  552.  
  553. Sub Flashm(nr, object) 'multiple flashers, it just sets the intensity
  554. Object.IntensityScale = FlashLevel(nr)
  555. End Sub
  556.  
  557. ' *********************************************************************
  558. ' Supporting Ball & Sound Functions
  559. ' *********************************************************************
  560.  
  561. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  562. Vol = Csng(BallVel(ball) ^2 / 2000)
  563. End Function
  564.  
  565. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  566. Dim tmp
  567. tmp = ball.x * 2 / table1.width-1
  568. If tmp > 0 Then
  569. Pan = Csng(tmp ^10)
  570. Else
  571. Pan = Csng(-((- tmp) ^10) )
  572. End If
  573. End Function
  574.  
  575. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  576. Pitch = BallVel(ball) * 20
  577. End Function
  578.  
  579. Function BallVel(ball) 'Calculates the ball speed
  580. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  581. End Function
  582.  
  583. '*****************************************
  584. ' JP's VP10 Rolling Sounds
  585. '*****************************************
  586.  
  587. Const tnob = 5 ' total number of balls in this table is 4, but always use a higher number here because of the timing
  588. ReDim rolling(tnob)
  589. InitRolling
  590.  
  591. Sub InitRolling
  592. Dim i
  593. For i = 0 to tnob
  594. rolling(i) = False
  595. Next
  596. End Sub
  597.  
  598. Sub RollingUpdate()
  599. Dim BOT, b, ballpitcht
  600. BOT = GetBalls
  601.  
  602. ' stop the sound of deleted balls
  603. For b = UBound(BOT) + 1 to tnob
  604. rolling(b) = False
  605. StopSound("fx_ballrolling" & b)
  606. Next
  607.  
  608. ' exit the sub if no balls on the table
  609. If UBound(BOT) = -1 Then Exit Sub
  610.  
  611. ' play the rolling sound for each ball
  612. For b = 0 to UBound(BOT)
  613. If BallVel(BOT(b) ) > 1 Then
  614. rolling(b) = True
  615. if BOT(b).z < 30 Then ' Ball on playfield
  616. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  617. Else
  618. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) )*100, 1, 0
  619. End If
  620. Else
  621. If rolling(b) = True Then
  622. StopSound("fx_ballrolling" & b)
  623. rolling(b) = False
  624. End If
  625. End If
  626. Next
  627. End Sub
  628.  
  629. '**********************
  630. ' Ball Collision Sound
  631. '**********************
  632.  
  633. Sub OnBallBallCollision(ball1, ball2, velocity)
  634. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  635. End Sub
  636.  
  637. '*****************************************
  638. ' FLIPPER SHADOWS
  639. '*****************************************
  640.  
  641. sub FlipperTimer_Timer()
  642. FlipperLSh.RotZ = LeftFlipper.currentangle
  643. FlipperRSh.RotZ = RightFlipper.currentangle
  644.  
  645. End Sub
  646.  
  647. '*****************************************
  648. ' BALL SHADOW
  649. '*****************************************
  650. Dim BallShadow
  651. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  652.  
  653. Sub BallShadowUpdate_timer()
  654. Dim BOT, b
  655. BOT = GetBalls
  656. ' hide shadow of deleted balls
  657. If UBound(BOT)<(tnob-1) Then
  658. For b = (UBound(BOT) + 1) to (tnob-1)
  659. BallShadow(b).visible = 0
  660. Next
  661. End If
  662. ' exit the Sub if no balls on the table
  663. If UBound(BOT) = -1 Then Exit Sub
  664. ' render the shadow for each ball
  665. For b = 0 to UBound(BOT)
  666. If BOT(b).X < Table1.Width/2 Then
  667. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 13
  668. Else
  669. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 13
  670. End If
  671. ballShadow(b).Y = BOT(b).Y + 10
  672. If BOT(b).Z > 20 Then
  673. BallShadow(b).visible = 1
  674. Else
  675. BallShadow(b).visible = 0
  676. End If
  677. Next
  678. End Sub
  679.  
  680. '******************
  681. ' RealTime Updates
  682. '******************
  683.  
  684. Set MotorCallback = GetRef("RealTimeUpdates")
  685.  
  686. Sub RealTimeUpdates
  687. RollingUpdate
  688. GIUpdate
  689. End Sub
  690.  
  691. ' Gi turns off when no balls are in play - just for fun JP :)
  692. Dim OldGiState
  693. OldGiState = -1 'start witht he Gi off
  694.  
  695. Sub GIUpdate
  696. Dim tmp, obj
  697. tmp = Getballs
  698. If UBound(tmp) <> OldGiState Then
  699. OldGiState = Ubound(tmp)
  700. If UBound(tmp) = -1 Then
  701. For each obj in aGiLights:obj.State = 0:Next
  702. LightState(199) = 0
  703. Else
  704. For each obj in aGiLights:obj.State = 1:Next
  705. LightState(199) = 1
  706. End If
  707. End If
  708. End Sub
  709. '******************************
  710. ' Diverse Collection Hit Sounds
  711. '******************************
  712.  
  713. Sub aMetal_Wires_Hit(idx):PlaySound "fx_metalhit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  714. Sub aRubber_Bands_Hit(idx):PlaySound "fx_rubber_band", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  715. Sub aRubber_Posts_Hit(idx):PlaySound "fx_rubber", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  716. Sub aRubber_Pins_Hit(idx):PlaySound "fx_postrubber", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  717. Sub aPlastics_Hit(idx):PlaySound "fx_PlasticHit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  718. Sub aGates_Hit(idx):PlaySound "fx_Gate", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  719. Sub aWoods_Hit(idx):PlaySound "fx_Woodhit", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  720.  
  721. Sub Trigger2_Hit
  722. If ActiveBall.VelY < 0 then
  723. PlaySound"fx_metalrolling"
  724. End If
  725. End Sub
  726. Sub Trigger2_UnHit
  727. If ActiveBall.VelY > 0 Then
  728. StopSound"fx_metalrolling"
  729. End If
  730. End Sub
  731.  
  732. Sub Trigger3_Hit: PlaySound"fx_rampbump1":End Sub
  733. Sub Trigger4_Hit: PlaySound"fx_rampbump2":Stopsound"fx_metalrolling":End Sub
  734. Sub Trigger5_Hit: PlaySound"wireramp":End Sub
  735.  
  736. 'Bally Xenon
  737. 'added by Inkochnito
  738. Sub editDips
  739. Dim vpmDips:Set vpmDips = New cvpmDips
  740. With vpmDips
  741. .AddForm 700, 400, "Xenon - DIP switches"
  742. .AddChk 7, 10, 180, Array("Match feature", &H08000000) 'dip 28
  743. .AddChk 205, 10, 115, Array("Credits display", &H04000000) 'dip 27
  744. .AddFrame 2, 30, 190, "Maximum credits", &H03000000, Array("10 credits", 0, "15 credits", &H01000000, "25 credits", &H02000000, "40 credits", &H03000000) 'dip 25&26
  745. .AddFrame 2, 106, 190, "Drop target 2X lite adjustment", &H00000020, Array("2X is off at start game", 0, "2X is on at start game", &H00000020) 'dip 6
  746. .AddFrame 2, 152, 190, "Drop target tube exit value", &H00000040, Array("exit value does not step", 0, "exit value steps up 1", &H00000040) 'dip 7
  747. .AddFrame 2, 198, 190, "Drop target special lite", &H00000080, Array("lite steps to 25000", 0, "lite stays lit", &H00000080) 'dip 8
  748. .AddFrame 2, 248, 190, "Outlanes and flipper feed lanes", &H00002000, Array("1 lite comes on then alternates", 0, "both lites come on", &H00002000) 'dip 14
  749. .AddFrame 2, 298, 190, "Top saucer scoring and Xenon lite", 49152, Array("scores 5,000 and no lite advances", 0, "scores 10,000 and 1 lite advance", &H00004000, "scores 10,000 and 2 lite advances", 49152) 'dip 15&16
  750. .AddFrame 205, 30, 190, "Balls per game", &HC0000000, Array("2 balls", &HC0000000, "3 balls", 0, "4 balls", &H80000000, "5 balls", &H40000000) 'dip 31&32
  751. .AddFrame 205, 106, 190, "Side saucer mota special lite", &H00100000, Array("special resets with the score", 0, "special will alternate", &H00100000) 'dip 21
  752. .AddFrame 205, 152, 190, "Side saucer mota score lites", &H00200000, Array("any lite will reset to 5,000", 0, "any lite will come on for next ball", &H00200000) 'dip 22
  753. .AddFrame 205, 198, 190, "Side saucer mota lite advance", &H00400000, Array("mota lites advance 1 at a time", 0, "mota lites advance 2 times", &H00400000) 'dip 23
  754. .AddFrame 205, 248, 190, "Side saucer mota 50K, 90K lite", &H00800000, Array("lites step to 50K only", 0, "lites step to 90K", &H00800000) 'dip 24
  755. .AddFrame 205, 298, 190, "Game over attract", &H10000000, Array("no voice", 0, "voice says: try me again", &H10000000) 'dip 29
  756. .AddFrame 205, 348, 190, "Top saucer first 2X lites adjust", &H20000000, Array("not in memory", 0, "in memory", &H20000000) 'dip 30
  757. .AddLabel 50, 400, 300, 20, "Set selftest position 17,18 and 19 to 03 for the best gameplay."
  758. .AddLabel 50, 420, 300, 20, "After hitting OK, press F3 to reset game with new settings."
  759. .ViewDips
  760. End With
  761. End Sub
  762. Set vpmShowDips = GetRef("editDips")
  763.  
  764. Sub table1_Exit:Controller.Stop:End Sub
  765.  
  766. 'cFastFlips by nFozzy
  767. 'Bypasses pinmame callback for faster and more responsive flippers
  768. 'Version 1.1 beta2 (More proper behaviour, extra safety against script errors)
  769.  
  770. 'Flipper / game-on Solenoid # reference
  771. 'Atari: Sol16
  772. 'Astro: ?
  773. 'Bally Early 80's: Sol19
  774. 'Bally late 80's (Blackwater 100, etc): Sol19
  775. 'Game Plan: Sol16
  776. 'Gottlieb System 1: Sol17
  777. 'Gottlieb System 80: No dedicated flipper solenoid? GI circuit Sol10?
  778. 'Gottlieb System 3: Sol32
  779. 'Playmatic: Sol8
  780. 'Spinball: Sol25
  781. 'Stern (80's): Sol19
  782. 'Taito: ?
  783. 'Williams System 3, 4, 6: Sol23
  784. 'Williams System 7: Sol25
  785. 'Williams System 9: Sol23
  786. 'Williams System 11: Sol23
  787. 'Bally / Williams WPC 90', 92', WPC Security: Sol31
  788. 'Data East (and Sega pre-whitestar): Sol23
  789. 'Zaccaria: ???
  790.  
  791. '********************Setup*******************:
  792.  
  793. '....somewhere outside of any subs....
  794. 'dim FastFlips
  795.  
  796. '....table init....
  797. 'Set FastFlips = new cFastFlips
  798. 'with FastFlips
  799. ' .CallBackL = "SolLflipper" 'Point these to flipper subs
  800. ' .CallBackR = "SolRflipper" '...
  801. '' .CallBackUL = "SolULflipper"'...(upper flippers, if needed)
  802. '' .CallBackUR = "SolURflipper"'...
  803. ' .TiltObjects = True 'Optional, if True calls vpmnudge.solgameon automatically. IF YOU GET A LINE 1 ERROR, DISABLE THIS! (or setup vpmNudge.TiltObj!)
  804. '' .InitDelay "FastFlips", 100 'Optional, if > 0 adds some compensation for solenoid jitter (occasional problem on Bram Stoker's Dracula)
  805. '' .DebugOn = False 'Debug, always-on flippers. Call FastFlips.DebugOn True or False in debugger to enable/disable.
  806. 'end with
  807.  
  808. '...keydown section... commenting out upper flippers is not necessary as of 1.1
  809. 'If KeyCode = LeftFlipperKey then FastFlips.FlipL True : FastFlips.FlipUL True
  810. 'If KeyCode = RightFlipperKey then FastFlips.FlipR True : FastFlips.FlipUR True
  811. '(Do not use Exit Sub, this script does not handle switch handling at all!)
  812.  
  813. '...keyUp section...
  814. 'If KeyCode = LeftFlipperKey then FastFlips.FlipL False : FastFlips.FlipUL False
  815. 'If KeyCode = RightFlipperKey then FastFlips.FlipR False : FastFlips.FlipUR False
  816.  
  817. '...Solenoid...
  818. 'SolCallBack(31) = "FastFlips.TiltSol"
  819. '//////for a reference of solenoid numbers, see top /////
  820.  
  821.  
  822. 'One last note - Because this script is super simple it will call flipper return a lot.
  823. 'It might be a good idea to add extra conditional logic to your flipper return sounds so they don't play every time the game on solenoid turns off
  824. 'Example:
  825. 'Instead of
  826. 'LeftFlipper.RotateToStart
  827. 'playsound SoundFX("FlipperDown",DOFFlippers), 0, 1, 0.01 'return
  828. 'Add Extra conditional logic:
  829. 'LeftFlipper.RotateToStart
  830. 'if LeftFlipper.CurrentAngle = LeftFlipper.StartAngle then
  831. ' playsound SoundFX("FlipperDown",DOFFlippers), 0, 1, 0.01 'return
  832. 'end if
  833. 'That's it]
  834. '*************************************************
  835. Function NullFunction(aEnabled):End Function '1 argument null function placeholder
  836. Class cFastFlips
  837. Public TiltObjects, DebugOn, hi
  838. Private SubL, SubUL, SubR, SubUR, FlippersEnabled, Delay, LagCompensation, Name, FlipState(3)
  839.  
  840. Private Sub Class_Initialize()
  841. Delay = 0 : FlippersEnabled = False : DebugOn = False : LagCompensation = False
  842. Set SubL = GetRef("NullFunction"): Set SubR = GetRef("NullFunction") : Set SubUL = GetRef("NullFunction"): Set SubUR = GetRef("NullFunction")
  843. End Sub
  844.  
  845. 'set callbacks
  846. Public Property Let CallBackL(aInput) : Set SubL = GetRef(aInput) : Decouple sLLFlipper, aInput: End Property
  847. Public Property Let CallBackUL(aInput) : Set SubUL = GetRef(aInput) : End Property
  848. Public Property Let CallBackR(aInput) : Set SubR = GetRef(aInput) : Decouple sLRFlipper, aInput: End Property
  849. Public Property Let CallBackUR(aInput) : Set SubUR = GetRef(aInput) : End Property
  850. Public Sub InitDelay(aName, aDelay) : Name = aName : delay = aDelay : End Sub 'Create Delay
  851. 'Automatically decouple flipper solcallback script lines (only if both are pointing to the same sub) thanks gtxjoe
  852. Private Sub Decouple(aSolType, aInput) : If StrComp(SolCallback(aSolType),aInput,1) = 0 then SolCallback(aSolType) = Empty End If : End Sub
  853.  
  854. 'call callbacks
  855. Public Sub FlipL(aEnabled)
  856. FlipState(0) = aEnabled 'track flipper button states: the game-on sol flips immediately if the button is held down (1.1)
  857. If not FlippersEnabled and not DebugOn then Exit Sub
  858. subL aEnabled
  859. End Sub
  860.  
  861. Public Sub FlipR(aEnabled)
  862. FlipState(1) = aEnabled
  863. If not FlippersEnabled and not DebugOn then Exit Sub
  864. subR aEnabled
  865. End Sub
  866.  
  867. Public Sub FlipUL(aEnabled)
  868. FlipState(2) = aEnabled
  869. If not FlippersEnabled and not DebugOn then Exit Sub
  870. subUL aEnabled
  871. End Sub
  872.  
  873. Public Sub FlipUR(aEnabled)
  874. FlipState(3) = aEnabled
  875. If not FlippersEnabled and not DebugOn then Exit Sub
  876. subUR aEnabled
  877. End Sub
  878.  
  879. Public Sub TiltSol(aEnabled) 'Handle solenoid / Delay (if delayinit)
  880. If delay > 0 and not aEnabled then 'handle delay
  881. vpmtimer.addtimer Delay, Name & ".FireDelay" & "'"
  882. LagCompensation = True
  883. else
  884. If Delay > 0 then LagCompensation = False
  885. EnableFlippers(aEnabled)
  886. end If
  887. End Sub
  888.  
  889. Sub FireDelay() : If LagCompensation then EnableFlippers False End If : End Sub
  890.  
  891. Private Sub EnableFlippers(aEnabled)
  892. If aEnabled then SubL FlipState(0) : SubR FlipState(1) : subUL FlipState(2) : subUR FlipState(3)
  893. FlippersEnabled = aEnabled
  894. If TiltObjects then vpmnudge.solgameon aEnabled
  895. If Not aEnabled then
  896. subL False
  897. subR False
  898. If not IsEmpty(subUL) then subUL False
  899. If not IsEmpty(subUR) then subUR False
  900. End If
  901. End Sub
  902.  
  903. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement