Advertisement
Guest User

Untitled

a guest
Sep 8th, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 77.38 KB | None | 0 0
  1. ' Cirqus Voltaire / IPD No. 4059 / October, 1997 / 4 Players
  2. ' VP913 1.2 by JPSalas 2012
  3. ' Thanks to all the authors (Pinball Ken, Scapino, Pacdude, Fuseball, Wpcmame) who made this table before me.
  4. ' Since I have never played or seen the real table, this table is based on their tables.
  5. ' Thanks to Strangeleo for asking this table and his help with some graphics and testing the table.
  6. ' Parts of the script from the older tables.
  7.  
  8. Option Explicit
  9. Randomize
  10. Const Ballsize = 57
  11.  
  12. '**** New Options Selection through F6 menu ***
  13.  
  14. Dim cController, ROL, Hidden, DefaultOptions, Sound1, Sound2, Sound3
  15. DefaultOptions = 1*optController+2*optB2BEnable+1*optAnIm 'Sets default options to use VPM controller and AutoEnable B2B
  16. 'optReset = 1 'Uncomment to reset to default options in case of error OR keep all changes temporary
  17.  
  18. '-------The Following is now controlled through the F6 Menu-------
  19. 'B2BOn = 2 '0=Off, 1=On, 2=AutoDetect
  20.  
  21. 'Choose Controller: 1-VPM, 2-UVP, 3-B2S
  22. 'Const cController = 1
  23.  
  24.  
  25. '******************************
  26. ' SET alpha GI colors
  27. '******************************
  28. 'Dim GION_alphaGIColor, GIOFF_alphaGIColor
  29. 'GION_alphaGIcolor = 1 ' 0=OFF, 1=WHITE, 2=GREEN, 3 = RED, 4 = blue, 5 = orange
  30. 'GIOFF_alphaGIcolor = 4 ' 0=OFF, 1=WHITE, 2=GREEN, 3 = RED, 4 = blue, 5 = orange
  31. '********************************
  32. 'Const cGameName = "cv_20hc" 'home rom - with credits
  33. Const cGameName = "cv_14" 'arcade rom - with credits
  34. 'Const cGameName = "cv_20h" 'home rom
  35.  
  36. Dim FeedbackSounds:FeedbackSounds = Array("fx_ballrel","fx_bumper1","fx_bumper2","fx_bumper3","fx_diverter","fx_droptarget","fx_flipperdown","fx_flipperup1","fx_flipperup2",_
  37. "fx_kicker","fx_popper","fx_resetdrop","fx_slingshot1","fx_slingshot2","fx_solenoid","fx_solenoidon","fx_solenoidoff","fx_target")
  38.  
  39. '*** End Options ***
  40.  
  41. LoadVPM "01560000", "WPC.VBS", 3.26
  42.  
  43. Sub LoadVPM(VPMver, VBSfile, VBSver) 'Add new call to InitializeOptions to allow selection of controller through F6 menu
  44. On Error Resume Next
  45. If ScriptEngineMajorVersion < 5 Then MsgBox "VB Script Engine 5.0 or higher required"
  46. ExecuteGlobal GetTextFile(VBSfile)
  47. If Err Then MsgBox "Unable to open " & VBSfile & ". Ensure that it is in the same folder as this table. " & vbNewLine & Err.Description
  48.  
  49. InitializeOptions 'Enables New Controller change through F6 menu, so it needs to be placed before Controller selection
  50.  
  51. Select Case cController
  52. Case 1:
  53. Set Controller = CreateObject("VPinMAME.Controller")
  54. If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description
  55. If VPMver>"" Then If Controller.Version < VPMver Or Err Then MsgBox "VPinMAME ver " & VPMver & " required."
  56. If VPinMAMEDriverVer < VBSver Or Err Then MsgBox VBSFile & " ver " & VBSver & " or higher required."
  57. Case 2:
  58. Set Controller = CreateObject("UltraVP.BackglassServ")
  59. Case 3:
  60. Set Controller = CreateObject("B2S.Server")
  61. End Select
  62. If Err then
  63. msgbox "Invalid controller selected, defaulting to VPinMame"
  64. Set controller = CreateObject("VPinMAME.Controller")
  65. End If
  66. On Error Goto 0
  67. End Sub
  68.  
  69. ExecuteGlobal GetTextFile("b2s.vbs")
  70.  
  71. ResetB2SData 0,49,0 'Initialise the b2s data area
  72. Dim Filename 'dynamic b2s launching based on file name
  73. ' If CheckB2S(filename) Then
  74. '********************************************************************************************
  75. ' LaunchBackGlass filename, cbool(TableOptions AND optBackGlass) 'True=Launch bg , False=Don't launch bg.
  76. ' If ShowLogo Then SetB2SData 5,1 'ENABLE BALLY LOGO ON DMD SCREEN FOR 3 SCREEN CABS
  77. '********************************************************************************************
  78. 'End If
  79.  
  80. 'dim expGiState:expGIState = 0
  81.  
  82. 'dim expGILightsL,expGILightsR,expGILightsM
  83.  
  84. 'expGILightsL = Array(EGI1,EGI11,EGI10,EGI17,EGI3,EGI7,EGI8,EGI18,EGI16,EGI20)
  85. 'expGILightsR = Array(EGI2,EGI12,EGI9,EGI4,EGI5,EGI6,EGI5,EGI21,EGI15)
  86. 'expGILightsM = Array(EGI13,EGI14)
  87.  
  88. '********************
  89. 'Standard definitions
  90. '********************
  91.  
  92. Const UseSolenoids = 1
  93. Const UseLamps = 0
  94. Const UseSync = 0
  95. Const HandleMech = 1
  96.  
  97. ' Standard Sounds
  98. Const SSolenoidOn = ""
  99. Const SSolenoidOff = ""
  100. Const SCoin = "fx_coin"
  101.  
  102. 'Set GiCallback2 = GetRef("UpdateGI1")
  103. Set GiCallback2 = GetRef("UpdateGI")
  104.  
  105. Dim bsTrough, bsPopper, bsLeftSaucer, bsRightSaucer, vlLock, mechRM, mRingmasterMagnet, mLockMagnet, mJugglerMagnet, x, bump1, bump2, bump3, plungerIM
  106.  
  107. '************
  108. ' Table init.
  109. '************
  110.  
  111. Sub Table1_Init
  112. vpmInit Me
  113. With Controller
  114. .GameName = cGameName
  115. .SplashInfoLine = "Cirqus Voltaire - based on the table by Bally 1997" & vbNewLine & "VP913 table by JPSalas v1.2"
  116. 'DMD example of position and size for 1400x1050
  117. '.Games(cGameName).Settings.Value("dmd_pos_x")=500
  118. '.Games(cGameName).Settings.Value("dmd_pos_y")=2
  119. '.Games(cGameName).Settings.Value("dmd_width")=400
  120. '.Games(cGameName).Settings.Value("dmd_height")=92
  121. .Games(cGameName).Settings.Value("rol") = 1
  122. .HandleKeyboard = 0
  123. .ShowTitle = 0
  124. .ShowDMDOnly = 1
  125. .ShowFrame = 0
  126. .HandleMechanics = 0
  127. .Hidden = 0
  128. .SolMask(0) = 0
  129. vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the Timer to renable all the solenoids after 2 seconds
  130. On Error Resume Next
  131. .Run GetPlayerHWnd
  132. If Err Then
  133. MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description
  134. msgbox "After table loads, use F6 to choose a different Rom and reload the table."
  135. Exit Sub
  136. End If
  137. On Error Goto 0
  138. End With
  139.  
  140. 'Init Flasher Alpha GI - Set all to 0.
  141.  
  142. flasher_tglass.alpha = 0
  143. sling_gi_left.alpha = 0
  144. sling_gi_right.alpha = 0
  145.  
  146. slt1.alpha = 0
  147. slt2.alpha = 0
  148. slt3.alpha = 0
  149. slt4.alpha = 0
  150. slt5.alpha = 0
  151. slt6.alpha = 0
  152. slt7.alpha = 0
  153. slt8.alpha = 0
  154. slt9.alpha = 0
  155. slt10.alpha = 0
  156. slt11.alpha = 0
  157. slt12.alpha = 0
  158. slt13.alpha = 0
  159. slt_a.alpha = 0
  160. slt_a1.alpha = 0
  161. slt14.alpha = 0
  162. slt15.alpha = 0
  163. slt16.alpha = 0
  164. slt17.alpha = 0
  165. slt18.alpha = 0
  166. slt19.alpha = 0
  167. slt20.alpha = 0
  168.  
  169. mgi1.alpha = 0
  170. mgi2.alpha = 0
  171. mgi3.alpha = 0
  172. mgi4.alpha = 0
  173. mgi5.alpha = 0
  174. mgi6.alpha = 0
  175. mgi7.alpha = 0
  176. mgi8.alpha = 0
  177. mgi9.alpha = 0
  178. mgi10.alpha = 0
  179.  
  180. mgi11.alpha = 0
  181. mgi12.alpha = 0
  182. mgi13.alpha = 0
  183. mgi14.alpha = 0
  184. mgi15.alpha = 0
  185. mgi16.alpha = 0
  186. mgi17.alpha = 0
  187. mgi18.alpha = 0
  188. mgi19.alpha = 0
  189. mgi20.alpha = 0
  190.  
  191. rlt1.alpha = 0
  192. rlt2.alpha = 0
  193. rlt3.alpha = 0
  194. rlt4.alpha = 0
  195. rlt5.alpha = 0
  196. rlt6.alpha = 0
  197. rlt7.alpha = 0
  198. rlt8.alpha = 0
  199. rtl9.alpha = 0
  200. rtl10.alpha = 0
  201. rtl11.alpha = 0
  202. rtl12.alpha = 0
  203. rtl13.alpha = 0
  204.  
  205.  
  206. '**** BMPR Settings ****
  207. ' if useBMPR = 1 then
  208. ' MomentumTimer.enabled = True
  209. ' table1.slopemax = 5.9
  210. ' table1.slopemin = 5.9
  211. ' table1.HardFriction = 0.0032
  212. ' table1.MaxBallSpeed = 50
  213. ' FlipperDampener.enabled = true
  214. ' end if
  215.  
  216. ' Nudging
  217. vpmNudge.TiltSwitch = 14
  218. vpmNudge.Sensitivity = 1
  219. vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot)
  220.  
  221. ' Trough
  222. Set bsTrough = New cvpmBallStack
  223. With bsTrough
  224. .InitSw 0, 32, 33, 34, 35, 0, 0, 0
  225. .InitKick BallRelease, 90, 4
  226. .InitExitSnd Sound1, Sound2
  227. .InitEntrySnd Sound2, Sound2
  228. .Balls = 4
  229. .IsTrough = 1
  230. End With 'Left saucer
  231. Set bsLeftSaucer = New cvpmBallStack
  232. With bsLeftSaucer
  233. .InitSaucer sw71, 71, 45, 10
  234. .InitExitSnd Sound3, Sound3
  235. .CreateEvents "bsLeftSaucer", 0
  236. End With
  237.  
  238. 'Right saucer
  239. Set bsRightSaucer = New cvpmBallStack
  240. With bsRightSaucer
  241. .InitSaucer sw72, 72, 140, 6
  242. .InitExitSnd Sound3, Sound3
  243. .CreateEvents "bsRightSaucer", 0
  244. End With
  245.  
  246. ' Ball popper
  247. Set bsPopper = New cvpmBallStack
  248. With bsPopper
  249. .InitSw 0, 36, 0, 0, 0, 0, 0, 0
  250. .InitKick sw36, 290, 20
  251. .InitExitSnd Sound3, Sound3
  252. .KickForceVar = 3
  253. .KickAngleVar = 10
  254. .KickBalls = 2
  255. End With
  256.  
  257. ' Ring Master Motor
  258. Set mechRM = New cvpmMech
  259. With mechRM
  260. .MType = vpmMechLinear + vpmMechReverse + vpmMechOneDirSol + vpmMechLengthSw
  261. .Sol1 = 22
  262. .Sol2 = 39
  263. .Length = 148
  264. .Steps = 148
  265. .AddSw 44, 0, 2 '0
  266. .AddSw 43, 109, 111 '200
  267. .AddSw 42, 147, 148 '265.5
  268. 'Motor fix later down in the script
  269. End With
  270.  
  271. ' Visible Lock
  272. Set vlLock = New cvpmVLock
  273. With vlLock
  274. .InitVLock Array(sw66, sw67, sw68), Array(sw66k, sw67k, sw68k), Array(66, 67, 68)
  275. .InitSnd Sound2, Sound2
  276. .CreateEvents "vlLock"
  277. End With
  278.  
  279. ' Ring Master Magnet
  280. Set mRingmasterMagnet = New cvpmMagnet
  281. With mRingmasterMagnet
  282. .InitMagnet RingmasterMagnet, 35
  283. '.Solenoid = 35 'own solenoid sub
  284. .GrabCenter = 1
  285. .Size = 100
  286. .CreateEvents "mRingmasterMagnet"
  287. End With
  288.  
  289. ' Lock Magnet
  290. Set mLockMagnet = New cvpmMagnet
  291. With mLockMagnet
  292. .InitMagnet LockMagnet, 50
  293. .Solenoid = 5
  294. .GrabCenter = 0.5
  295. .Size = 300
  296. .CreateEvents "mLockMagnet"
  297. End With
  298.  
  299. ' Juggler Magnet
  300. Set mJugglerMagnet = New cvpmMagnet
  301. With mJugglerMagnet
  302. .InitMagnet JugglerMagnet, 70
  303. .Solenoid = 3
  304. .GrabCenter = 1
  305. .Size = 100
  306. .CreateEvents "mJugglerMagnet"
  307. End With
  308.  
  309. ' Impulse Plunger
  310. 'Const IMPowerSetting = 41 ' Plunger Power
  311. 'Const IMTime = 0.6 ' Time in seconds for Full Plunge
  312. Set plungerIM = New cvpmImpulseP
  313. With plungerIM
  314. .InitImpulseP swplunger, IMPowerSetting, IMTime
  315. .Random IMScatter
  316. .switch 18
  317. .InitEntrySnd "PlungerPull"
  318. .InitExitSnd "fx_plunger2", "fx_plunger"
  319. .CreateEvents "plungerIM"
  320. End With
  321.  
  322. ' Main Timer init
  323. PinMAMETimer.Interval = PinMAMEInterval
  324. PinMAMETimer.Enabled = 1
  325. 'StartShake
  326.  
  327. ' Init Bumper Rings and targets
  328. Ring1a.IsDropped = 1:Ring2a.IsDropped = 1:Ring3a.IsDropped = 1
  329. Ring1b.IsDropped = 1:Ring2b.IsDropped = 1:Ring3b.IsDropped = 1
  330. Ring1c.IsDropped = 1:Ring2c.IsDropped = 1:Ring3c.IsDropped = 1
  331. sw41a.IsDropped = 1:sw58a.IsDropped = 1:sw61a.IsDropped = 1:sw62a.IsDropped = 1:sw56a.IsDropped = 1
  332. sw38a.IsDropped = 1:sw38c.IsDropped = 1
  333.  
  334. ' Init other dropwalls - animations
  335. LeftSLing.IsDropped = 1:LeftSLing2.IsDropped = 1:LeftSLing3.IsDropped = 1
  336. RightSLing.IsDropped = 1:RightSLing2.IsDropped = 1:RightSLing3.IsDropped = 1
  337. Jackpot.IsDropped = 1
  338. 'CannonKicker.CreateBall.Image = "CannonBall"
  339. vpmDoSolCallback 34, 0
  340. BoomDown 1
  341. 'vpmSolWall cRMs, 0, 1
  342. 'vpmSolWall cRMsa, 0, 1
  343. 'vpmSolWall cRM, 0, 1
  344. 'vpmSolWall cRMa, 0, 1
  345. CreateWildBall
  346.  
  347. ''For Each x in expGILightsR
  348. ''x.alpha = 0
  349. ''next
  350. ''For Each x in expGILightsL
  351. ''x.alpha = 0
  352. ''next
  353. ''For Each x in expGILightsM
  354. ''x.alpha = 0
  355. ''next
  356. ''EGI19.alpha = 0
  357.  
  358. ' Fix Motor
  359. Controller.Switch(22) = 0
  360. vpmTimer.AddTimer 100, "StartMotor"
  361.  
  362. vpmTimer.AddTimer 10, "GIUpdate"
  363. ''LBumper2.isdropped = 1
  364. End Sub
  365.  
  366. Sub GIUpdate(dummy):updategi 5,0:End Sub
  367.  
  368. Sub StartMotor(dummy)
  369. Controller.Switch(22) = 1 ' Coin door closed - fixes dead motor bug
  370. With mechRM
  371. .CallBack = GetRef("UpdateRM")
  372. .Start
  373. End With
  374. End Sub
  375.  
  376. '**********
  377. ' Keys
  378. '**********
  379.  
  380. Sub table1_KeyDown(ByVal Keycode)
  381. If keycode = PlungerKey Then
  382. If ImpulsePlunger Then
  383. Pcount = 0:PTime.Enabled = 1:Plunger.TimerEnabled=0:PlungerIM.Pullback
  384. Else
  385. Plunger2.Pullback:vpPlay "PlungerPull"
  386. End If
  387. End If
  388. If keycode = LeftTiltKey Then LeftNudge 90, 1.6, 20:vpPlay "fx_nudge_left"
  389. If keycode = RightTiltKey Then RightNudge 270, 1.6, 20:vpPlay "fx_nudge_right"
  390. If keycode = CenterTiltKey Then CenterNudge 180, 2.8, 30:vpPlay "fx_nudge_forward"
  391. If vpmKeyDown(keycode) Then Exit Sub
  392. If keycode = "3" then
  393. setflash 117,1
  394. setflash 118,1
  395. setflash 119,1
  396. setflash 120,1
  397. setflash 121,1
  398. setflash 124,1
  399. setflash 125,1
  400. setflash 126,1
  401. setflash 128,1
  402. setflash 137,1
  403. end if
  404. End Sub
  405.  
  406. Sub table1_KeyUp(ByVal Keycode)
  407. If keycode = PlungerKey Then
  408. If ImpulsePlunger Then
  409. PlungerIM.Strength = (PCount/25)*Plunger.MechStrength
  410. PlungerIM.AutoFire
  411. PTime.Enabled = 0:Pcount = 0:PTime2.Enabled = 1
  412. Else
  413. PTime2.Enabled = 1:Plunger2.Fire
  414. StopSound "PlungerPull"
  415. If(BallinPlunger = 1) then 'the ball is in the plunger lane
  416. vpPlay "fx_Plunger2"
  417. else
  418. vpPlay "fx_Plunger"
  419. end if
  420. End If
  421. End If
  422. If vpmKeyUp(keycode) Then Exit Sub
  423. If keycode = "3" then
  424. setflash 117,0
  425. setflash 118,0
  426. setflash 119,0
  427. setflash 120,0
  428. setflash 121,0
  429. setflash 124,0
  430. setflash 125,0
  431. setflash 126,0
  432. setflash 128,0
  433. setflash 137,0
  434. end if
  435. End Sub
  436.  
  437.  
  438. ' Koadic's Alpha Ramp
  439. ' Impulse Plunger Scripting v6
  440. ' single ramp animated
  441. ' via image switching
  442. '------------------------------
  443.  
  444. 'Modifications made to include 'Modern Plunger'
  445.  
  446. Dim PDelay, PCount, PImages, PStart, IMTime, IMPowerSetting, PlFrame, IMScatter, ImpulsePlunger, ImpulseP, BallInPlunger
  447.  
  448. IMPowerSetting = Plunger.MechStrength ' Plunger Power - Set via Plunger MechStrength
  449. IMTime = Round(Plunger.PullSpeed/10, 2)' Time in 1/10th seconds for Full Plunge - Set via Plunger Pull Speed...
  450. ' 1 = .1 second, 5 = .5 second, 10 = 1 second, etc.
  451. IMScatter = Plunger.ScatterVelocity ' Plunger Scatter Velocity - Percentage of variation in Plunger Power
  452. ' Setting Scatter Velocity to 10 = 10%, if Power is 50, max plunge will vary from 47.5 to 52.5 (+/- 5%)
  453. PStart = 0 ' Set number of first plunger image, use 1 for legacy "1-12" setup
  454. PImages = 25 ' Set number of animation frames not including the PStart position, use 11 for legacy "1-12" setup
  455. PTime.Interval = INT(IMTime*1000/PImages)
  456. PDelay = CINT(Plunger.FireSpeed/Plunger.TimerInterval)
  457. ReDim PlPos(PDelay)
  458.  
  459. ResetPlungers
  460.  
  461. Sub swPlunger1_Hit:BallinPlunger = 1:End Sub 'in this sub you may add a switch, for example Controller.Switch(14) = 1
  462.  
  463. Sub swPlunger1_UnHit:BallinPlunger = 0:End Sub 'in this sub you may add a switch, for example Controller.Switch(14) = 0
  464.  
  465. Sub ResetPlungers
  466. aPlunger.Image = "p" & PStart
  467. For x = 0 to ubound(PlPos):PlPos(x) = 0:Next
  468. Pcount = 0
  469. PRefresh.state = ABS(PRefresh.state - 1)
  470. End Sub
  471.  
  472. Sub PTime_Timer
  473. If PCount < (PImages) Then
  474. PCount = PCount + 1
  475. aPlunger.Image = "p" & (PCount+PStart)
  476. PRefresh.state = ABS(PRefresh.state - 1)
  477. End If
  478. End Sub
  479.  
  480. Sub PTime2_Timer
  481. Select Case PCount
  482. Case 0:aPlunger.Image = "p" & PStart : PRefresh.state = ABS(PRefresh.state - 1)
  483. Case 1:aPlunger.Image = "p" & INT(PImages/5) : PRefresh.state = ABS(PRefresh.state - 1)
  484. Case 2:ResetPlungers:Plunger.TimerEnabled = 1:Me.Enabled = 0
  485. End Select
  486. Pcount = Pcount + 1
  487. End Sub
  488.  
  489. Sub Plunger_Timer()
  490. PlPos(PDelay) = Plunger.Position
  491. PlFrame = PlPos(PDelay)
  492. If PlPos(PDelay) <> PlPos(PDelay - 1) Then
  493. aPlunger.Image = "p" & PlFrame
  494. PRefresh.state = ABS(PRefresh.state - 1)
  495. If PlPos(PDelay) < 2 and PlPos(0) > 5 and ImpulseP Then
  496. PlungerIM.Strength = (PlPos(0)/25*Plunger.MechStrength)
  497. PlungerIM.AutoFire
  498. PlungerIM.Strength = Plunger.MechStrength
  499. Plunger.TimerEnabled = 0:PTime2.Enabled = 1
  500. End If
  501. End If
  502. For x = 0 to ubound(PlPos)-1:PlPos(x)=PlPos(x+1):Next
  503. End Sub
  504.  
  505. '*************************************
  506. ' Nudge System
  507. ' based on Noah's nudgetest table
  508. '*************************************
  509.  
  510. Dim LeftNudgeEffect, RightNudgeEffect, NudgeEffect
  511.  
  512. Sub LeftNudge(angle, strength, delay)
  513. vpmNudge.DoNudge angle, (strength * (delay-LeftNudgeEffect) / delay) + RightNudgeEffect / delay
  514. LeftNudgeEffect = delay
  515. RightNudgeEffect = 0
  516. RightNudgeTimer.Enabled = 0
  517. LeftNudgeTimer.Interval = delay
  518. LeftNudgeTimer.Enabled = 1
  519. End Sub
  520.  
  521. Sub RightNudge(angle, strength, delay)
  522. vpmNudge.DoNudge angle, (strength * (delay-RightNudgeEffect) / delay) + LeftNudgeEffect / delay
  523. RightNudgeEffect = delay
  524. LeftNudgeEffect = 0
  525. LeftNudgeTimer.Enabled = 0
  526. RightNudgeTimer.Interval = delay
  527. RightNudgeTimer.Enabled = 1
  528. End Sub
  529.  
  530. Sub CenterNudge(angle, strength, delay)
  531. vpmNudge.DoNudge angle, strength * (delay-NudgeEffect) / delay
  532. NudgeEffect = delay
  533. NudgeTimer.Interval = delay
  534. NudgeTimer.Enabled = 1
  535. End Sub
  536.  
  537. Sub LeftNudgeTimer_Timer()
  538. LeftNudgeEffect = LeftNudgeEffect-1
  539. If LeftNudgeEffect = 0 then LeftNudgeTimer.Enabled = 0
  540. End Sub
  541.  
  542. Sub RightNudgeTimer_Timer()
  543. RightNudgeEffect = RightNudgeEffect-1
  544. If RightNudgeEffect = 0 then RightNudgeTimer.Enabled = 0
  545. End Sub
  546.  
  547. Sub NudgeTimer_Timer()
  548. NudgeEffect = NudgeEffect-1
  549. If NudgeEffect = 0 then NudgeTimer.Enabled = 0
  550. End Sub
  551.  
  552. '*********
  553. ' Switches
  554. '*********
  555.  
  556. ' Slings & div switches
  557.  
  558. Dim LStep, RStep
  559.  
  560. Sub LeftSlingShot_Slingshot:LeftSling.IsDropped = 0:vpPlay "fx_slingshot1":vpmTimer.PulseSw 51:LStep = 0:Me.TimerEnabled = 1:End Sub
  561.  
  562. Sub LeftSlingShot_Timer
  563. Select Case LStep
  564. Case 0:LeftSLing.IsDropped = 0
  565. Case 1: 'pause
  566. Case 2:LeftSLing.IsDropped = 1:LeftSLing2.IsDropped = 0
  567. Case 3:LeftSLing2.IsDropped = 1:LeftSLing3.IsDropped = 0
  568. Case 4:LeftSLing3.IsDropped = 1:Me.TimerEnabled = 0
  569. End Select
  570.  
  571. LStep = LStep + 1
  572. End Sub
  573.  
  574. Sub RightSlingShot_Slingshot:RightSling.IsDropped = 0:vpPlay "fx_slingshot2":vpmTimer.PulseSw 52:RStep = 0:Me.TimerEnabled = 1:End Sub
  575. Sub RightSlingShot_Timer
  576. Select Case RStep
  577. Case 0:RightSLing.IsDropped = 0
  578. Case 1: 'pause
  579. Case 2:RightSLing.IsDropped = 1:RightSLing2.IsDropped = 0
  580. Case 3:RightSLing2.IsDropped = 1:RightSLing3.IsDropped = 0
  581. Case 4:RightSLing3.IsDropped = 1:Me.TimerEnabled = 0
  582. End Select
  583.  
  584. RStep = RStep + 1
  585. End Sub
  586.  
  587. ' Bumpers
  588.  
  589. Sub LBumper_Slingshot(x)
  590. LBumper(x).isdropped = 1
  591. LBumper(abs(x-1)).isdropped = 0
  592. vpmTimer.PulseSw 54
  593. vpPlay "fx_bumper1"
  594. bump1 = 1
  595. LBumper1.TimerEnabled = 1
  596. End Sub
  597.  
  598. Sub LBumper1_Timer()
  599. Select Case bump1
  600. Case 1:Ring1a.IsDropped = 0:bump1 = 2
  601. Case 2:Ring1b.IsDropped = 0:Ring1a.IsDropped = 1:bump1 = 3
  602. Case 3:Ring1c.IsDropped = 0:Ring1b.IsDropped = 1:bump1 = 4
  603. Case 4:Ring1c.IsDropped = 1:Me.TimerEnabled = 0
  604. End Select
  605. End Sub
  606.  
  607. Sub RBumper_Hit:vpmTimer.PulseSw 53:vpPlay "fx_bumper2":bump2 = 1:Me.TimerEnabled = 1:End Sub
  608. Sub RBumper_Timer()
  609. Select Case bump2
  610. Case 1:Ring2a.IsDropped = 0:bump2 = 2
  611. Case 2:Ring2b.IsDropped = 0:Ring2a.IsDropped = 1:bump2 = 3
  612. Case 3:Ring2c.IsDropped = 0:Ring2b.IsDropped = 1:bump2 = 4
  613. Case 4:Ring2c.IsDropped = 1:Me.TimerEnabled = 0
  614. End Select
  615. End Sub
  616.  
  617. Sub BBumper_Hit:vpmTimer.PulseSw 55:vpPlay "fx_bumper3":bump3 = 1:Me.TimerEnabled = 1:End Sub
  618. Sub BBumper_Timer()
  619. Select Case bump3
  620. Case 1:Ring3a.IsDropped = 0:bump3 = 2
  621. Case 2:Ring3b.IsDropped = 0:Ring3a.IsDropped = 1:bump3 = 3
  622. Case 3:Ring3c.IsDropped = 0:Ring3b.IsDropped = 1:bump3 = 4
  623. Case 4:Ring3c.IsDropped = 1:Me.TimerEnabled = 0
  624. End Select
  625. End Sub
  626.  
  627. ' Drain holes, vuks & saucers
  628. Sub Drain_Hit
  629. ClearBallID
  630. vpPlay "fx_drain"
  631. bsTrough.AddBall Me
  632. End Sub
  633.  
  634. ' Trap Door Holes with animation
  635. Dim aBall, aZpos
  636.  
  637. Sub TDHole1_Hit
  638. Set aBall = ActiveBall
  639. ClearballID
  640. vpPlay "fx_kicker_enter"
  641. aZpos = 35
  642. Me.TimerInterval = 2
  643. Me.TimerEnabled = 1
  644. End Sub
  645.  
  646. Sub TDHole1_Timer
  647. aBall.Z = aZpos
  648. aZpos = aZpos-4
  649. If aZpos < -30 Then
  650. Me.TimerEnabled = 0
  651. Me.DestroyBall
  652. bsTrapDoor.AddBall Me
  653. End If
  654. End Sub
  655.  
  656. 'Spinner
  657. Sub sw117_Spin():vpmTimer.PulseSw 117:vpPlay "fx_spinner":End Sub
  658. Sub sw115_Spin():vpmTimer.PulseSw 115:vpPlay "fx_spinner":End Sub
  659.  
  660. ' Rollovers & Ramp Switches
  661. Sub sw27_Hit:la1.IsDropped = 1:Controller.Switch(27) = 1:vpPlay "fx_sensor":End Sub
  662. Sub sw27_UnHit:la1.IsDropped = 0:Controller.Switch(27) = 0:End Sub
  663.  
  664. Sub sw57_Hit:la2.IsDropped = 1:Controller.Switch(57) = 1:vpPlay "fx_sensor":End Sub
  665. Sub sw57_UnHit:la2.IsDropped = 0:Controller.Switch(57) = 0:End Sub
  666.  
  667. Sub sw48_Hit:la3.IsDropped = 1:Controller.Switch(48) = 1:vpPlay "fx_sensor":End Sub
  668. Sub sw48_UnHit:la3.IsDropped = 0:Controller.Switch(48) = 0:End Sub
  669.  
  670. Sub sw28_Hit:la4.IsDropped = 1:Controller.Switch(28) = 1:vpPlay "fx_sensor":End Sub
  671. Sub sw28_UnHit:la4.IsDropped = 0:Controller.Switch(28) = 0:End Sub
  672.  
  673. Sub sw25_Hit:la5.IsDropped = 1:Controller.Switch(25) = 1:vpPlay "fx_sensor":End Sub
  674. Sub sw25_UnHit:la5.IsDropped = 0:Controller.Switch(25) = 0:End Sub
  675.  
  676. Sub sw15_Hit:Controller.Switch(15) = 1:vpPlay "fx_sensor":End Sub
  677. Sub sw15_Unhit:Controller.Switch(15) = 0:End Sub
  678.  
  679. Sub sw23_Hit:Controller.Switch(23) = 1:vpPlay "fx_sensor":End Sub
  680. Sub sw23_Unhit:Controller.Switch(23) = 0:End Sub
  681.  
  682. Sub sw26_Hit:Controller.Switch(26) = 1:vpPlay "fx_sensor":End Sub
  683. Sub sw26_Unhit:Controller.Switch(26) = 0:End Sub
  684.  
  685. Sub sw17_Hit:Controller.Switch(17) = 1:vpPlay "fx_sensor":End Sub
  686. Sub sw17_Unhit:Controller.Switch(17) = 0:End Sub
  687.  
  688. Sub sw75_Hit:Controller.Switch(75) = 1:vpPlay "fx_sensor":End Sub
  689. Sub sw75_Unhit:Controller.Switch(75) = 0:End Sub
  690.  
  691. Sub sw76_Hit:Controller.Switch(76) = 1:vpPlay "fx_sensor":End Sub
  692. Sub sw76_Unhit:Controller.Switch(76) = 0:End Sub
  693.  
  694. Sub sw45_Hit:Controller.Switch(45) = 1:vpPlay "fx_sensor":End Sub
  695. Sub sw45_Unhit:Controller.Switch(45) = 0:vpPlay "fx_metalrolling":End Sub
  696.  
  697. Sub sw65_Hit:Controller.Switch(65) = 1:vpPlay "fx_sensor":End Sub
  698. Sub sw65_Unhit:Controller.Switch(65) = 0:vpPlay "fx_metalrolling":End Sub
  699.  
  700. Sub sw64_Hit
  701. Controller.Switch(64) = 1
  702. If ActiveBall.VelX > 15 then ActiveBall.VelX = 15
  703. End Sub
  704. Sub sw64_Unhit:Controller.Switch(64) = 0:End Sub
  705.  
  706. Sub sw12_Hit:Controller.Switch(12) = 1:End Sub
  707. Sub sw12_Unhit:Controller.Switch(12) = 0:End Sub
  708.  
  709. Sub sw16_Hit:Controller.Switch(16) = 1:End Sub
  710. Sub sw16_Unhit:Controller.Switch(16) = 0:End Sub
  711.  
  712. Sub sw63_Hit:Controller.Switch(63) = 1:End Sub
  713. Sub sw63_Unhit:Controller.Switch(63) = 0:End Sub
  714.  
  715. ' Targets
  716. Sub sw41_Hit:vpmTimer.PulseSw 41:sw41.IsDropped = 1:sw41a.IsDropped = 0:Me.TimerEnabled = 1:vpPlay "fx_target":End Sub
  717. Sub sw41_Timer:sw41.IsDropped = 0:sw41a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  718.  
  719. Sub sw58_Hit:vpmTimer.PulseSw 58:sw58.IsDropped = 1:sw58a.IsDropped = 0:Me.TimerEnabled = 1:vpPlay "fx_target":sw58p.rotx=5:End Sub
  720. Sub sw58_Timer:sw58.IsDropped = 0:sw58a.IsDropped = 1:sw58p.rotx=0:Me.TimerEnabled = 0:End Sub
  721.  
  722. Sub sw61_Hit:vpmTimer.PulseSw 61:sw61.IsDropped = 1:sw61a.IsDropped = 0:Me.TimerEnabled = 1:vpPlay "fx_target":End Sub
  723. Sub sw61_Timer:sw61.IsDropped = 0:sw61a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  724.  
  725. Sub sw62_Hit:vpmTimer.PulseSw 62:sw62.IsDropped = 1:sw62a.IsDropped = 0:Me.TimerEnabled = 1:vpPlay "fx_target":End Sub
  726. Sub sw62_Timer:sw62.IsDropped = 0:sw62a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  727.  
  728. Sub sw56_Hit:vpmTimer.PulseSw 56:sw56.IsDropped = 1:sw56a.IsDropped = 0:Me.TimerEnabled = 1:vpPlay "fx_target":End Sub
  729. Sub sw56_Timer:sw56.IsDropped = 0:sw56a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  730.  
  731. Sub sw38_Hit:vpmTimer.PulseSw 38:sw38.IsDropped = 1:sw38a.IsDropped = 0:Me.TimerEnabled = 1:vpPlay "fx_target":End Sub
  732. Sub sw38_Timer:sw38.IsDropped = 0:sw38a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  733.  
  734. Sub sw38b_Hit:vpmTimer.PulseSw 38:sw38b.IsDropped = 1:sw38c.IsDropped = 0:Me.TimerEnabled = 1:vpPlay "fx_target":End Sub
  735. Sub sw38b_Timer:sw38b.IsDropped = 0:sw38c.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  736.  
  737. Sub sw37_Hit:vpmTimer.PulseSw 37:vpPlay "fx_target":End Sub
  738.  
  739. Sub sw37b_Hit:vpmTimer.PulseSw 37:vpPlay "fx_target":End Sub
  740.  
  741. Sub sw37d_Hit:vpmTimer.PulseSw 37:vpPlay "fx_target":End Sub
  742.  
  743. Sub sw74_Hit:vpmTimer.PulseSw 74:vpPlay "fx_rubber":End Sub
  744.  
  745. ' Ramps helpers
  746. Sub RHelp1_Hit()
  747. ActiveBall.VelZ = -2
  748. ActiveBall.VelY = 0
  749. ActiveBall.VelX = 0
  750. StopSound "fx_metalrolling"
  751. vpmTimer.AddTimer 100, "BallSound"
  752. End Sub
  753.  
  754. Sub RHelp2_Hit()
  755. ActiveBall.VelZ = -2
  756. ActiveBall.VelY = 0
  757. ActiveBall.VelX = 0
  758. StopSound "fx_metalrolling"
  759. vpmTimer.AddTimer 100, "BallSound"
  760. End Sub
  761.  
  762. Sub RHelp3_Hit:vpmTimer.AddTimer 150, "BallSound":End Sub
  763.  
  764. Sub RHelp4_Hit:vpmTimer.AddTimer 150, "BallSound":End Sub
  765.  
  766. Sub BallSound(dummy):vpPlay "fx_BallHit":End Sub
  767.  
  768. '*********
  769. 'Solenoids
  770. '*********
  771.  
  772. SolCallback(1) = "Auto_Plunger"
  773. SolCallBack(2) = "SolCannon"
  774. SolCallBack(7) = "BoomUp"
  775. SolCallBack(8) = "BoomDown"
  776. SolCallback(9) = "SolRelease"
  777. SolCallBack(14) = "bsLeftSaucer.SolOut"
  778. SolCallBack(15) = "bsRightSaucer.SolOut"
  779. SolCallback(16) = "vlLock.SolExit"
  780. SolCallBack(33) = "bsPopper.SolOut"
  781. SolCallback(34) = "vpmSolToggleWall LockDiverterOff,LockDiverterOn,""SolenoidOn"","
  782. SolCallBack(35) = "SolRingmasterMagnet"
  783. SolCallBack(36) = "UpperPost.IsDropped = Not "
  784.  
  785. 'Flashers
  786. SolCallBack(17) = "Sol17"
  787. SolCallBack(18) = "Sol18"
  788. SolCallBack(19) = "Sol19"
  789. SolCallBack(20) = "Sol20"
  790. SolCallBack(21) = "Sol21"
  791. SolCallBack(23) = "SetLamp 123,"
  792. SolCallBack(24) = "Sol24"
  793. SolCallBack(25) = "Sol25"
  794. SolCallBack(26) = "Sol26"
  795. SolCallBack(27) = "RMFlasher"
  796. SolCallBack(28) = "Sol28"
  797. SolCallBack(37) = "Sol37"
  798.  
  799. '********************
  800. ' Special JP Flippers
  801. '********************
  802.  
  803. SolCallback(sLRFlipper) = "SolRFlipper"
  804. SolCallback(sLLFlipper) = "SolLFlipper"
  805.  
  806.  
  807. '******************************************
  808. 'Added by JF
  809. '******************************************
  810.  
  811. Dim StartLeftFlipperStrength, StartRightFlipperStrength
  812. Dim StartLeftFlipperSpeed, StartRightFlipperSpeed
  813. Dim StartLeftFlipperReturn, StartRightFlipperReturn
  814.  
  815. if useBMPR = 0 then
  816. StartLeftFlipperStrength=LeftFlipper.Strength
  817. StartRightFlipperStrength=RightFlipper.Strength
  818. StartLeftFlipperSpeed=LeftFlipper.Speed
  819. StartRightFlipperSpeed=RightFlipper.Speed
  820. StartLeftFlipperReturn=LeftFlipper.Return
  821. StartRightFlipperReturn=RightFlipper.Return
  822. else
  823. StartLeftFlipperStrength=LeftFlipper1.Strength
  824. StartRightFlipperStrength=RightFlipper1.Strength
  825. StartLeftFlipperSpeed=LeftFlipper1.Speed
  826. StartRightFlipperSpeed=RightFlipper1.Speed
  827. StartLeftFlipperReturn=LeftFlipper1.Return
  828. StartRightFlipperReturn=RightFlipper1.Return
  829.  
  830. end if
  831.  
  832.  
  833. '******************************************
  834. ' Use FlipperTimers to call div subs
  835. '******************************************
  836.  
  837. Dim LFTCount:LFTCount=1
  838.  
  839. Sub LeftFlipperTimer_Timer()
  840. If LFTCount < 6 Then
  841. LFTCount = LFTCount + 1
  842. LeftFlipper.Strength = StartLeftFlipperStrength*(LFTCount/6)
  843. LeftFlipper1.Strength = StartLeftFlipperStrength*(LFTCount/6)
  844. LeftFlipper2.Strength = StartLeftFlipperStrength*(LFTCount/6)
  845. Else
  846. Me.Enabled=0
  847. End If
  848. End Sub
  849.  
  850. Dim RFTCount:RFTCount=1
  851.  
  852. Sub RightFlipperTimer_Timer()
  853. If RFTCount < 6 Then
  854. RFTCount = RFTCount + 1
  855. RightFlipper.Strength = StartRightFlipperStrength*(RFTCount/6)
  856. RightFlipper1.Strength = StartRightFlipperStrength*(RFTCount/6)
  857. RightFlipper2.Strength = StartRightFlipperStrength*(RFTCount/6)
  858. Else
  859. Me.Enabled=0
  860. End If
  861. End Sub
  862.  
  863.  
  864. Sub SolLFlipper(Enabled)
  865.  
  866. If Enabled Then
  867. LeftFlipperTimer.Enabled=0
  868. vpPlay "fx_flipperup1"
  869. LeftFlipper.RotateToEnd
  870. LeftFlipper1.RotateToEnd
  871. LeftFlipper2.RotateToEnd
  872. Else
  873. LFTCount=1
  874. vpPlay "fx_flipperdown"
  875. LeftFlipper.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  876. LeftFlipper.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  877. LeftFlipper.RotateToStart
  878. LeftFlipper.Strength = StartLeftFlipperStrength*(LFTCount/6)
  879. LeftFlipperTimer.Enabled=1
  880. LeftFlipper.Speed=StartLeftFlipperSpeed
  881. LeftFlipper.Return=StartLeftFlipperReturn
  882.  
  883. LeftFlipper1.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  884. LeftFlipper1.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  885. LeftFlipper1.RotateToStart
  886. LeftFlipper1.Strength = StartLeftFlipperStrength*(LFTCount/6)
  887. LeftFlipper1.Speed=StartLeftFlipperSpeed
  888. LeftFlipper1.Return=StartLeftFlipperReturn
  889.  
  890. LeftFlipper2.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  891. LeftFlipper2.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  892. LeftFlipper2.RotateToStart
  893. LeftFlipper2.Strength = StartLeftFlipperStrength*(LFTCount/6)
  894. LeftFlipper2.Speed=StartLeftFlipperSpeed
  895. LeftFlipper2.Return=StartLeftFlipperReturn
  896. End If
  897. End Sub
  898.  
  899. Sub SolRFlipper(Enabled)
  900.  
  901. If Enabled Then
  902. RightFlipperTimer.Enabled=0
  903. vpPlay "fx_flipperup2"
  904. RightFlipper.RotateToEnd
  905. RightFlipper1.RotateToEnd
  906. RightFlipper2.RotateToEnd
  907. Else
  908. RFTCount=1
  909. vpPlay "fx_flipperdown"
  910. RightFlipper.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  911. RightFlipper.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  912. RightFlipper.RotateToStart
  913. RightFlipper.Strength = StartRightFlipperStrength*(RFTCount/6)
  914. RightFlipperTimer.Enabled=1
  915. RightFlipper.Speed=StartRightFlipperSpeed
  916. RightFlipper.Return=StartRightFlipperReturn
  917.  
  918. RightFlipper1.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  919. RightFlipper1.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  920. RightFlipper1.RotateToStart
  921. RightFlipper1.Strength = StartRightFlipperStrength*(RFTCount/6)
  922. RightFlipper1.Speed=StartRightFlipperSpeed
  923. RightFlipper1.Return=StartRightFlipperReturn
  924.  
  925. RightFlipper2.Speed=.05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  926. RightFlipper2.Return=.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  927. RightFlipper2.RotateToStart
  928. RightFlipper2.Strength = StartRightFlipperStrength*(RFTCount/6)
  929. RightFlipper2.Speed=StartRightFlipperSpeed
  930. RightFlipper2.Return=StartRightFlipperReturn
  931. End If
  932. End Sub
  933.  
  934.  
  935. Sub LeftFlipper_Collide(parm)
  936. vpPlay "fx_rubber_flipper"
  937. End Sub
  938.  
  939. Sub RightFlipper_Collide(parm)
  940. vpPlay "fx_rubber_flipper"
  941. End Sub
  942.  
  943. Sub LeftFlipper1_Collide(parm)
  944. vpPlay "fx_rubber_flipper"
  945. End Sub
  946.  
  947. Sub RightFlipper1_Collide(parm)
  948. vpPlay "fx_rubber_flipper"
  949. End Sub
  950.  
  951. Sub LeftFlipper2_Collide(parm)
  952. vpPlay "fx_rubber_flipper"
  953. End Sub
  954.  
  955. Sub RightFlipper2_Collide(parm)
  956. vpPlay "fx_rubber_flipper"
  957. End Sub
  958. '***********************
  959. ' Flipper Logo
  960. '***********************
  961.  
  962. Sub UpdateFlipperLogos
  963. LogoR.rotz = RightFlipper.CurrentAngle
  964. LogoL.rotz = LeftFlipper.CurrentAngle
  965. End Sub
  966.  
  967.  
  968. '**************
  969. ' Solenoid Subs
  970. '**************
  971.  
  972. Sub SolRelease(Enabled)
  973. If Enabled And bsTrough.Balls > 0 Then
  974. vpmTimer.PulseSw 31
  975. bsTrough.ExitSol_On
  976. End If
  977. End Sub
  978.  
  979. Sub Auto_Plunger(Enabled)
  980. If Enabled Then
  981. PlungerIM.Strength = 45 + (Rnd * 5)
  982. PlungerIM.AutoFire
  983. PlungerIM.Strength = Plunger.MechStrength
  984. vpPlay "fx_Solenoid"
  985. End If
  986. End Sub
  987.  
  988. Dim FireCannon,CannonFlag
  989. CannonFlag=0
  990. Sub SolCannon(Enabled)
  991. If CannonFlag=0 Then
  992. If Enabled Then
  993. vpPlay "fx_Solenoid"
  994. FireCannon=FireCannon+1:If FireCannon>255 Then FireCannon=0
  995. SetB2SData 4,FireCannon
  996. Cannon.Enabled=1
  997. CannonFlag=1
  998. End If
  999. End If
  1000. End Sub
  1001.  
  1002. Sub Cannon_Timer()
  1003. CannonFlag=CannonFlag+1
  1004. Select Case CannonFlag
  1005. Case 2
  1006. vpmTimer.PulseSw 11
  1007. vpPlay "fx_Bell10"
  1008. Case 3
  1009. Cannon.Enabled=0
  1010. CannonFlag=0
  1011. End Select
  1012. End Sub
  1013.  
  1014. Sub BoomUp(Enabled)
  1015. Dim obj
  1016. If Enabled Then
  1017. For each obj in cBoomBumper:obj.IsDropped = 0:Next
  1018. boomramp.alpha = 1
  1019. vpPlay "fx_motor"
  1020. BoomTrigger.enabled = 1
  1021. End If
  1022. End Sub
  1023.  
  1024. Sub BoomDown(Enabled)
  1025. Dim obj
  1026. If Enabled Then
  1027. For each obj in cBoomBumper2:obj.IsDropped = 1:Next
  1028. boomramp.alpha = 0
  1029. vpPlay "fx_motor"
  1030. BoomTrigger.enabled = 0
  1031. End If
  1032. End Sub
  1033.  
  1034. Sub BoomTrigger_Hit
  1035. activeball.z = activeball.z + 80
  1036. End Sub
  1037.  
  1038. ' *********************
  1039. ' Ring Master subs
  1040. ' *********************
  1041.  
  1042. Dim KickAngle
  1043. Sub SolRingmasterMagnet(Enabled)
  1044. mRingmasterMagnet.MagnetOn = Enabled
  1045. RMMagnetkicker.Enabled = Enabled
  1046. If Not Enabled And RMBallInMagnet Then
  1047. mRingmasterMagnet.RemoveBall RMMagBall
  1048. KickAngle = 135 + Rnd * 180
  1049. cball.vely = cball.vely + dcos(KickAngle)*2
  1050. cball.velx = cball.velx - dsin(KickAngle)*2
  1051. vpmTimer.AddTimer 400, "RMKick"
  1052. vpmTimer.AddTimer 200, "BallSound"
  1053. End If
  1054. End Sub
  1055.  
  1056. Sub RMMagnetkicker_Hit
  1057. Set RMMagBall = ActiveBall
  1058. RMBallInMagnet = 1
  1059. End Sub
  1060.  
  1061. Sub RMKick(dummy)
  1062. RMMagnetkicker.kick KickAngle, rnd * 7 + 7
  1063. RMBallInMagnet = 0
  1064. RMMagBall = Empty
  1065. End Sub
  1066.  
  1067. Dim RMBallInMagnet, RMMagBall, RMBall, RMFlashOn, RMCurrPos
  1068. RMBallInMagnet = 0:RMFlashOn = 0:RMCurrPos = 0
  1069.  
  1070. Sub sw38r_Hit
  1071. Set RMBall = ActiveBall
  1072. vpPlay "fx_woodhit"
  1073. vpmTimer.PulseSw 38
  1074. If RMCurrPos > 102 Then
  1075. RMShake
  1076. If cController = 3 Then
  1077. Controller.B2SSetData 101,1:Controller.B2SSetData 101,0
  1078. End If
  1079. End If
  1080. End Sub
  1081.  
  1082. Sub UpdateRM(aCurrPos, aSpeed, aLastPos)
  1083. RMCurrPos = aCurrPos
  1084. Ringmaster_Down.alpha = NOT cbool(RMCurrPos>4)
  1085. Ringmaster_Down2.alpha = NOT cbool(RMCurrPos>4)
  1086. Ringmaster.z = (RMCurrPos-4) * 265.5/144 - 265.5
  1087. RMHitWall.IsDropped = NOT RMCurrPos > 4
  1088. sw38r.enabled = RMCurrPos > 4
  1089. If (RMCurrPos >37 And RMCurrPos < 40) AND RMCurrPos > aLastPos Then cball.vely = cball.vely - 1.5
  1090. If RMBallInMagnet Then RMMagBall.z = Ringmaster.z + 50 + 265.5
  1091. If aCurrPos >= 140 Then
  1092. vpmSolToggleObj cRMHoles, Nothing, 0, 1
  1093. RMHitWall.IsDropped = 1
  1094. sw38r.enabled = 0
  1095. Jackpot.Isdropped = 0
  1096. Else
  1097. vpmSolToggleObj cRMHoles, Nothing, 0, 0
  1098. Jackpot.Isdropped = 1
  1099. End If
  1100. End Sub
  1101.  
  1102. Sub RMFlasher(Enabled)
  1103. RMFlashOn = ABS(Enabled)
  1104. SetLamp 127, RMFlashOn
  1105. If RMFlashOn Then
  1106. Ringmaster.image = RMImages(1)
  1107.  
  1108. Else
  1109. Ringmaster.image = RMImages(0)
  1110. End If
  1111. End Sub
  1112.  
  1113. '************* RM Shake Scripting *************
  1114. Dim mMagnet, cBall, pMod, rmmod
  1115.  
  1116. Set mMagnet = new cvpmMagnet
  1117. With mMagnet
  1118. .InitMagnet WobbleMagnet, 1.5
  1119. .Size = 100
  1120. .CreateEvents mMagnet
  1121. .MagnetOn = True
  1122. End With
  1123. WobbleInit
  1124.  
  1125. Sub RMShake
  1126. cball.velx = cball.velx + rmball.velx*pMod
  1127. cball.vely = cball.vely + rmball.vely*pMod
  1128. End Sub
  1129.  
  1130. 'Includes stripped down version of my reverse slope scripting for a single ball
  1131. Dim ngrav, ngravmod, pslope, nslope, slopemod
  1132. Sub WobbleInit
  1133. pslope = Table1.SlopeMin +((Table1.SlopeMax - Table1.SlopeMin) * Table1.GlobalDifficulty)
  1134. nslope = pslope
  1135. slopemod = pslope + nslope
  1136. ngravmod = 60/aWobbleTimer.interval
  1137. ngrav = slopemod * .0905 * Table1.Gravity / ngravmod
  1138. pMod = .15 'percentage of hit power transfered to captive wobble ball
  1139. Set cBall = ckicker.createball:cball.image = "blank":ckicker.Kick 0,0:mMagnet.addball cball
  1140. aWobbleTimer.enabled = 1
  1141. End Sub
  1142.  
  1143. Sub aWobbleTimer_Timer
  1144. BallShake.Enabled = RMBallInMagnet
  1145. cBall.Vely = cBall.VelY-ngrav 'modifier for slope reversal/cancellation
  1146. rmmod = (ringmaster.z+265.5)/265*.4 '.4 is a 40% modifier for ratio of ball movement to head movement
  1147. ringmaster.rotx = (ckicker.y - cball.y)*rmmod
  1148. ringmaster.roty = (cball.x - ckicker.x)*rmmod
  1149. End Sub
  1150.  
  1151. Sub BallShake_Timer
  1152. If Not IsEmpty(RMMagBall) Then
  1153. RMMagBall.y = RMMagnetkicker.y - dsin(ringmaster.rotx)*265.5
  1154. RMMagBall.x = RMMagnetkicker.x + dsin(ringmaster.roty)*265.5
  1155. End If
  1156. End Sub
  1157.  
  1158. '************* End Shake Scripting ****************
  1159.  
  1160. ' **************
  1161. ' Subway Handler
  1162. ' **************
  1163.  
  1164. ' Side Show holes
  1165. Sub cSSHoles_Hit(idx):SubwayHandler Me(idx), 46:End Sub
  1166.  
  1167. ' Ringmaster holes
  1168. Sub cRMHoles_Hit(idx):SubwayHandler Me(idx), 47:End Sub
  1169.  
  1170. Sub SubwayHandler(aKick, aSwNo)
  1171. ClearballID
  1172. aKick.Destroyball:vpPlay "fx_kicker_enter"
  1173. vpmTimer.PulseSwitch aSwNo, 2000, "bsPopper.AddBall 0'"
  1174. End Sub
  1175.  
  1176. ' ********************************
  1177. ' Menagerie Ball (Wild Ball)
  1178. ' ********************************
  1179.  
  1180. Dim WBall
  1181.  
  1182. Sub CreateWildBall()
  1183. Set WBall = kicker1.Createsizedball(50):WBall.Image = BigBallImage(BColor):kicker1.Kick 0, 0
  1184. ' WBall.CollisionMass = 1
  1185. End Sub
  1186.  
  1187. 'Original GI Sub.
  1188.  
  1189. dim gi9img:gi9img=array("plastics","plastics_on")
  1190.  
  1191. UpdateGI 0, 0:UpdateGI 1, 0:UpdateGI 2, 0:UpdateGI 3, 0
  1192.  
  1193. Sub UpdateGI1(no, Enabled)
  1194. Select Case no
  1195. Case 2 'left
  1196. 'gi1.State = ABS(Enabled)
  1197. 'gi2.State = ABS(Enabled)
  1198. 'gi3.IsDropped = NOT Enabled
  1199. 'gi4.IsDropped = NOT Enabled
  1200. 'gi5.IsDropped = NOT Enabled
  1201. 'gi6.IsDropped = NOT Enabled
  1202. 'gi7.IsDropped = NOT Enabled
  1203. 'gi8.IsDropped = NOT Enabled
  1204. 'gi13.IsDropped = NOT Enabled
  1205. bumper6.State = ABS(Enabled)
  1206. bumper7.State = ABS(Enabled)
  1207. bumper8.State = ABS(Enabled)
  1208. bumper9.State = ABS(Enabled)
  1209. 'bumper11.State = ABS(Enabled)
  1210. 'bumper12.State = ABS(Enabled)
  1211. 'bumper13.State = ABS(Enabled)
  1212. 'bumper14.State = ABS(Enabled)
  1213. 'bumper15.State = ABS(Enabled)
  1214. refresh.state = ABS(refresh.state-1)
  1215. Case 1 'middle
  1216. 'gi10.State = ABS(Enabled)
  1217. 'gi11.State = ABS(Enabled)
  1218. 'gi12.IsDropped = NOT Enabled
  1219. 'gi14.State = ABS(Enabled)
  1220. 'gi15.State = ABS(Enabled)
  1221. 'gi16.State = ABS(Enabled)
  1222. 'gi17.State = ABS(Enabled)
  1223. 'bumper16.State = ABS(Enabled)
  1224. 'bumper17.State = ABS(Enabled)
  1225. 'bumper18.State = ABS(Enabled)
  1226. 'bumper19.State = ABS(Enabled)
  1227. bumper20.State = ABS(Enabled)
  1228. bumper21.State = ABS(Enabled)
  1229. bumper22.State = ABS(Enabled)
  1230. 'bumper23.State = ABS(Enabled)
  1231. 'bumper24.State = ABS(Enabled)
  1232. 'bumper25.State = ABS(Enabled)
  1233. 'bumper26.State = ABS(Enabled)
  1234. 'bumper27.State = ABS(Enabled)
  1235. 'bumper31.State = ABS(Enabled)
  1236. 'bumper32.State = ABS(Enabled)
  1237. 'bumper33.State = ABS(Enabled)
  1238. refresh.state = ABS(refresh.state-1)
  1239. Case 0 'right
  1240. 'gi18.State = ABS(Enabled)
  1241. 'gi19.State = ABS(Enabled)
  1242. 'gi20.IsDropped = NOT Enabled
  1243. 'gi21.IsDropped = NOT Enabled
  1244. 'gi22.IsDropped = NOT Enabled
  1245. 'gi23.IsDropped = NOT Enabled
  1246. 'bumper1.State = ABS(Enabled)
  1247. bumper2.State = ABS(Enabled)
  1248. bumper3.State = ABS(Enabled)
  1249. bumper4.State = ABS(Enabled)
  1250. bumper5.State = ABS(Enabled)
  1251. 'bumper10.State = ABS(Enabled)
  1252. 'bumper29.State = ABS(Enabled)
  1253. 'bumper30.State = ABS(Enabled)
  1254. refresh.state = ABS(refresh.state-1)
  1255. End Select
  1256. End Sub
  1257.  
  1258. '***********
  1259. ' Update GI
  1260. '***********
  1261.  
  1262. Dim gistep
  1263. gistep = 255/8
  1264.  
  1265. Sub UpdateGI(no, step)
  1266. Controller.Switch(22) = 1 'fix motor
  1267. If step = 0 OR step = 7 then exit sub
  1268.  
  1269. Select Case no
  1270.  
  1271. Case 0 'right
  1272.  
  1273. flasher_tglass.alpha = gistep *step
  1274.  
  1275. sling_gi_right.alpha = gistep *step
  1276. rlt1.alpha = gistep *step
  1277. rlt2.alpha = gistep *step
  1278. rlt3.alpha = gistep *step
  1279. rlt4.alpha = gistep *step
  1280. rlt5.alpha = gistep *step
  1281. rlt6.alpha = gistep *step
  1282. rlt7.alpha = gistep *step
  1283. rlt8.alpha = gistep *step
  1284. rtl9.alpha = gistep *step
  1285. rtl10.alpha = gistep *step
  1286. rtl11.alpha = gistep *step
  1287. rtl12.alpha = gistep *step
  1288. rtl13.alpha = gistep *step
  1289.  
  1290. Case 1 'middle
  1291. mgi1.alpha = gistep *step
  1292. mgi2.alpha = gistep *step
  1293. mgi3.alpha = gistep *step
  1294. mgi4.alpha = gistep *step
  1295. mgi5.alpha = gistep *step
  1296. mgi6.alpha = gistep *step
  1297. mgi7.alpha = gistep *step
  1298. mgi8.alpha = gistep *step
  1299. mgi9.alpha = gistep *step
  1300. mgi10.alpha = gistep *step
  1301. mgi11.alpha = gistep *step
  1302. mgi12.alpha = gistep *step
  1303. mgi13.alpha = gistep *step
  1304. mgi14.alpha = gistep *step
  1305. mgi15.alpha = gistep *step
  1306. mgi16.alpha = gistep *step
  1307. mgi17.alpha = gistep *step
  1308. mgi18.alpha = gistep *step
  1309. mgi19.alpha = gistep *step
  1310. mgi20.alpha = gistep *step
  1311.  
  1312. Case 2 'left
  1313. sling_gi_left.alpha = gistep *step
  1314. slt1.alpha = gistep *step
  1315. slt2.alpha = gistep *step
  1316. slt3.alpha = gistep *step
  1317. slt4.alpha = gistep *step
  1318. slt5.alpha = gistep *step
  1319. slt6.alpha = gistep *step
  1320. slt7.alpha = gistep *step
  1321. slt8.alpha = gistep *step
  1322. slt9.alpha = gistep *step
  1323. slt10.alpha = gistep *step
  1324. slt11.alpha = gistep *step
  1325. slt12.alpha = gistep *step
  1326. slt13.alpha = gistep *step
  1327. slt_a.alpha = gistep *step
  1328. slt_a1.alpha = gistep *step
  1329. slt14.alpha = gistep *step
  1330. slt15.alpha = gistep *step
  1331. slt16.alpha = gistep *step
  1332. slt17.alpha = gistep *step
  1333. slt18.alpha = gistep *step
  1334. slt19.alpha = gistep *step
  1335. slt20.alpha = gistep *step
  1336.  
  1337. End Select
  1338. End Sub
  1339.  
  1340. '******************
  1341. ' RealTime Updates
  1342. '******************
  1343. Set MotorCallback = GetRef("GameTimer")
  1344.  
  1345. Sub GameTimer
  1346. RollingSound
  1347. UpdateFlipperLogos
  1348. UpdateVisuals
  1349. End Sub
  1350.  
  1351. '****************************************
  1352. ' Based on rascal's Ball Rolling Script
  1353. '****************************************
  1354. Dim VeloY(3), VeloX(3), rolling(3), b
  1355. b = 0
  1356.  
  1357. Sub RollingSound()
  1358. b = b + 1
  1359. If b > 3 Then b = 1
  1360. If BallStatus(b) = 0 Then
  1361. If rolling(b) = True Then
  1362. StopSound "fx_ballrolling" &b
  1363. rolling(b) = False
  1364. Exit Sub
  1365. Else
  1366. Exit Sub
  1367. End If
  1368. End if
  1369.  
  1370. VeloY(b) = Cint(CurrentBall(b).VelY)
  1371. VeloX(b) = Cint(CurrentBall(b).VelX)
  1372. If(ABS(VeloY(b) ) > 3 or ABS(VeloX(b) ) > 3) and CurrentBall(b).Z < 55 Then 'do not sound if the ball is on a ramp
  1373. If rolling(b) = True then
  1374. Exit Sub
  1375. Else
  1376. rolling(b) = True
  1377. PlaySound "fx_ballrolling" &b
  1378. End If
  1379. Else
  1380. If rolling(b) = True Then
  1381. StopSound "fx_ballrolling" &b
  1382. rolling(b) = False
  1383. End If
  1384. End If
  1385. End Sub
  1386.  
  1387. '****************************************
  1388. ' B2B Collision by Steely & Pinball Ken
  1389. '****************************************
  1390.  
  1391. Dim tnopb, nosf, iball, cnt, errMessage, B2BOn
  1392.  
  1393. CheckB2B
  1394. XYdata.interval = 10 ' <<<<< ADD timer named XYData to table
  1395. tnopb = 5 ' <<<<< SET to the "Total Number Of Possible Balls" in play at any one time
  1396. nosf = 10 ' <<<<< SET to the "Number Of Sound Files" used / B2B collision volume levels
  1397.  
  1398. ReDim CurrentBall(tnopb), BallStatus(tnopb)
  1399.  
  1400. For cnt = 0 to ubound(BallStatus) : BallStatus(cnt) = 0 : Next
  1401.  
  1402. '****************************************
  1403. ' B2B AutoDisable for XP x64 Added by Koadic
  1404. '****************************************
  1405.  
  1406. Sub CheckB2B ' Added by Koadic for XP x64 handling
  1407. Dim osver, cpuver, check
  1408. On Error Resume Next
  1409. For x = 0 to 1 : If B2BOn = x Then Exit Sub : End If : Next 'If B2BOn is set manually, then end routine
  1410. Set check = CreateObject("WScript.Shell")
  1411. osver = check.RegRead ("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
  1412. cpuver = check.RegRead ("HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment\Processor_Architecture")
  1413. If osver < 6 and cpuver = "AMD64" Then B2BOn = 0 Else B2BOn = 1 'If OS is XP and 64bit, then disable B2B
  1414. If Err Then B2BOn = 1 'If there is an error in detecting either OS or x32/x64, then default to On
  1415. On Error Goto 0
  1416. End Sub
  1417.  
  1418. '======================================================
  1419. ' <<<<<<<<<<<<<< Ball Identification >>>>>>>>>>>>>>
  1420. '======================================================
  1421.  
  1422. '******************************
  1423. ' Destruk's alternative vpmCreateBall for use with B2B Enabled tables
  1424. ' Core.vbs calls vpmCreateBall when a ball is created from a ball stack
  1425. '******************************
  1426. If IsEmpty(Eval("vpmCreateBall"))=false Then Set vpmCreateBall = GetRef("B2BvpmCreateBall") ' Override the core.vbs and redefine vpmCreateBall
  1427.  
  1428. Function B2BvpmCreateBall(aKicker)
  1429. Dim bsize2:If IsEmpty(Eval("ballsize"))=true Then bsize2 = 25 Else bsize2 = ballsize/2
  1430. For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
  1431. If ballStatus(cnt) = 0 Then ' If ball ID is available...
  1432. If Not IsEmpty(vpmBallImage) Then ' Set ball object with the first available ID
  1433. Set CurrentBall(cnt) = aKicker.Createsizedball(bsize2).Image
  1434. Else
  1435. Set CurrentBall(cnt) = aKicker.Createsizedball(bsize2)
  1436. End If
  1437. Set B2BvpmCreateBall = aKicker
  1438. CurrentBall(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
  1439. ballStatus(cnt) = 1 ' Mark this ball status active
  1440. ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
  1441. If B2BOn > 0 Then ' If B2BOn is 0, it overrides auto-turn on collision detection
  1442. ' If more than one ball active, start collision detection process
  1443. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  1444. End If
  1445. Exit For ' New ball ID assigned, exit loop
  1446. End If
  1447. Next
  1448. End Function
  1449.  
  1450. 'Call this sub from every kicker that destroys a ball, before the ball is destroyed.
  1451.  
  1452. Sub ClearBallid
  1453. On Error Resume Next ' Error handling for debugging purposes
  1454. iball = ActiveBall.uservalue ' Get the ball ID to be cleared
  1455. If Err Then Msgbox Err.description & vbCrLf & iball
  1456. ballStatus(iBall) = 0 ' Clear the ball status
  1457. ballStatus(0) = ballStatus(0)-1 ' Subtract 1 ball from the # of balls in play
  1458. On Error Goto 0
  1459. End Sub
  1460.  
  1461. '=====================================================
  1462. ' <<<<<<<<<<<<<<<<< XYdata_Timer >>>>>>>>>>>>>>>>>
  1463. '=====================================================
  1464.  
  1465. 'Ball data collection and B2B Collision detection.
  1466.  
  1467. ReDim baX(tnopb,4), baY(tnopb,4), baZ(tnopb,4), bVx(tnopb,4), bVy(tnopb,4), TotalVel(tnopb,4)
  1468. Dim cForce, bDistance, xyTime, cFactor, id, id2, id3, B1, B2
  1469.  
  1470. Sub XYdata_Timer()
  1471. xyTime = Timer+(XYdata.interval*.001) ' xyTime is the system timer plus the current interval time
  1472. If id2 >= 4 Then id2 = 0 ' Loop four times and start over
  1473. id2 = id2+1 ' Increment the ball sampler ID
  1474. For id = 1 to ubound(ballStatus) ' Loop once for each possible ball
  1475. If ballStatus(id) = 1 Then ' If ball is active...
  1476. baX(id,id2) = round(CurrentBall(id).x,2) ' Sample x-coord
  1477. baY(id,id2) = round(CurrentBall(id).y,2) ' Sample y-coord
  1478. baZ(id,id2) = round(CurrentBall(id).z,2) ' Sample z-coord
  1479. bVx(id,id2) = round(CurrentBall(id).velx,2) ' Sample x-velocity
  1480. bVy(id,id2) = round(CurrentBall(id).vely,2) ' Sample y-velocity
  1481. TotalVel(id,id2) = (bVx(id,id2)^2 + bVy(id,id2)^2) ' Calculate total velocity
  1482. If TotalVel(id,id2) > TotalVel(0,0) Then TotalVel(0,0) = int(TotalVel(id,id2))
  1483. End If
  1484. Next
  1485. id3 = id2 : B2 = 2 : B1 = 1 ' Set up the counters for looping
  1486. Do
  1487. If ballStatus(B1) = 1 and ballStatus(B2) = 1 Then ' If both balls are active...
  1488. bDistance = int((TotalVel(B1,id3)+TotalVel(B2,id3))^(1.04 * (CurrentBall(B1).radius + CurrentBall(B2).radius)/50))
  1489. If ((baX(B1,id3) - baX(B2,id3))^2 + (baY(B1,id3) - baY(B2,id3))^2) < (2800 * ((CurrentBall(B1).radius + CurrentBall(B2).radius)/50)^2) + bDistance Then
  1490. If ABS(baZ(B1,id3) - baZ(B2,id3)) < (CurrentBall(B1).radius + CurrentBall(B2).radius) Then collide B1,B2 : Exit Sub 'added z axis collision detection here
  1491. End If
  1492. End If
  1493. B1 = B1+1 ' Increment ball1
  1494. If B1 = ubound(ballstatus) Then Exit Do ' Exit loop if all ball combinations checked
  1495. If B1 >= B2 then B1 = 1:B2 = B2+1 ' If ball1 >= reset ball1 and increment ball2
  1496. Loop
  1497. If ballStatus(0) <= 1 Then XYdata.enabled = False ' Turn off timer if one ball or less
  1498. If XYdata.interval >= 40 Then B2BOn = 0 : XYdata.enabled = False ' Auto-shut off
  1499. If Timer > xyTime * 3 Then B2BOn = 0 : XYdata.enabled = False ' Auto-shut off
  1500. If Timer > xyTime Then XYdata.interval = XYdata.interval+1 ' Increment interval if needed
  1501. End Sub
  1502.  
  1503. '=========================================================
  1504. ' <<<<<<<<<<< Collide(ball id1, ball id2) >>>>>>>>>>>
  1505. '=========================================================
  1506. 'Calculate the collision force and play sound accordingly.
  1507.  
  1508. Dim cTime, cb1,cb2, avgBallx, cAngle, bAngle1, bAngle2
  1509.  
  1510. Sub Collide(cb1,cb2)
  1511. If TotalVel(0,0) / 1.8 > cFactor Then cFactor = int(TotalVel(0,0) / 1.8)
  1512. avgBallx = (bvX(cb2,1) + bvX(cb2,2) + bvX(cb2,3) + bvX(cb2,4)) / 4
  1513. If avgBallx < bvX(cb2,id2) + .1 and avgBallx > bvX(cb2,id2) - .1 Then
  1514. If ABS(TotalVel(cb1,id2) - TotalVel(cb2,id2)) < .000005 Then Exit Sub
  1515. End If
  1516. If Timer < cTime Then Exit Sub
  1517. cTime = Timer+.1 ' Limits collisions to .1 seconds apart
  1518. GetAngle baX(cb1,id3) - baX(cb2,id3), baY(cb1,id3) - baY(cb2,id3), cAngle ' Collision angle via x/y-coordinates
  1519. id3 = id3 - 1 : If id3 = 0 Then id3 = 4 ' Step back one xyData sampling for a good velocity reading
  1520. GetAngle bVx(cb1,id3), bVy(cb1,id3), bAngle1 ' ball 1 travel direction, via velocity
  1521. GetAngle bVx(cb2,id3), bVy(cb2,id3), bAngle2 ' ball 2 travel direction, via velocity
  1522. cForce = Cint((abs(TotalVel(cb1,id3)*Cos(cAngle-bAngle1))+abs(TotalVel(cb2,id3)*Cos(cAngle-bAngle2))))
  1523. If cForce < 4 Then Exit Sub ' Another collision limiter
  1524. cForce = Cint((cForce)/(cFactor/nosf)) ' Divides up cForce for the proper sound selection.
  1525. If cForce > nosf-1 Then cForce = nosf-1 ' First sound file 0(zero) minus one from number of sound files
  1526. PlaySound ("collide" & cForce) ' Combines "collide" with the calculated sound level and play sound
  1527. End Sub
  1528.  
  1529. '=================================================
  1530. ' <<<<<<<< GetAngle(X, Y, Anglename) >>>>>>>>
  1531. '=================================================
  1532. Dim Xin,Yin,rAngle,Radit,wAngle,Pi
  1533. Pi = csng(4*Atn(1)) '3.1415926535897932384626433832795
  1534.  
  1535. Sub GetAngle(Xin, Yin, wAngle)
  1536. If Sgn(Xin) = 0 Then
  1537. If Sgn(Yin) = 1 Then rAngle = 3 * Pi/2 Else rAngle = Pi/2
  1538. If Sgn(Yin) = 0 Then rAngle = 0
  1539. Else
  1540. rAngle = atn(-Yin/Xin)
  1541. End If
  1542. If sgn(Xin) = -1 Then Radit = Pi Else Radit = 0
  1543. If sgn(Xin) = 1 and sgn(Yin) = 1 Then Radit = 2 * Pi
  1544. wAngle = round((Radit + rAngle),4)
  1545. End Sub
  1546.  
  1547. '** Extra math to make my life easier **
  1548. Function dCos(degrees)
  1549. Dim Pi:Pi = CSng(4*Atn(1))
  1550. dcos = cos(degrees * Pi/180)
  1551. if ABS(dCos) < 0.000001 Then dCos = 0
  1552. if ABS(dCos) > 0.999999 Then dCos = 1 * sgn(dCos)
  1553. End Function
  1554.  
  1555. Function dSin(degrees)
  1556. Dim Pi:Pi = CSng(4*Atn(1))
  1557. dsin = sin(degrees * Pi/180)
  1558. if ABS(dSin) < 0.000001 Then dSin = 0
  1559. if ABS(dSin) > 0.999999 Then dSin = 1 * sgn(dSin)
  1560. End Function
  1561.  
  1562. Function dAtn(x)
  1563. Dim Pi:Pi = CSng(4*Atn(1))
  1564. datn = atn(x) * 180 / Pi
  1565. End Function
  1566.  
  1567. Function dAtn2(X, Y)
  1568. If X > 0 Then
  1569. dAtn2 = dAtn(Y / X)
  1570. ElseIf X < 0 Then
  1571. dAtn2 = dAtn(Y / X) + 180 * Sgn(Y)
  1572. If Y = 0 Then dAtn2 = dAtn2 + 180
  1573. If Y < 0 Then dAtn2 = dAtn2 + 360
  1574. Else
  1575. dAtn2 = 90 * Sgn(Y)
  1576. End If
  1577. dAtn2 = dAtn2+90
  1578. End Function
  1579. '** End Extra math **
  1580.  
  1581.  
  1582. '----Solenoid Setlamp/Setflash subs to workaround lamp and flash timers being seperate.----'
  1583.  
  1584. Sub Sol37(Enabled)
  1585.  
  1586. SetLamp 137, Enabled
  1587.  
  1588. SetFlash 137, Enabled
  1589.  
  1590. End Sub
  1591.  
  1592. Sub Sol28(Enabled)
  1593.  
  1594. SetLamp 128, Enabled
  1595.  
  1596. SetFlash 128, Enabled
  1597.  
  1598. End Sub
  1599.  
  1600. Sub Sol20(Enabled)
  1601.  
  1602. SetLamp 120, Enabled
  1603.  
  1604. SetFlash 120, Enabled
  1605.  
  1606. End Sub
  1607.  
  1608. Sub Sol19(Enabled)
  1609.  
  1610. SetLamp 119, Enabled
  1611.  
  1612. SetFlash 119, Enabled
  1613.  
  1614. End Sub
  1615.  
  1616. Sub Sol18(Enabled)
  1617.  
  1618. SetLamp 118, Enabled
  1619.  
  1620. SetFlash 118, Enabled
  1621.  
  1622. End Sub
  1623.  
  1624. Sub Sol17(Enabled)
  1625.  
  1626. SetLamp 117, Enabled
  1627.  
  1628. SetFlash 117, Enabled
  1629.  
  1630. End Sub
  1631.  
  1632. Sub Sol21(Enabled)
  1633.  
  1634. SetLamp 121, Enabled
  1635.  
  1636. SetFlash 121, Enabled
  1637.  
  1638. End Sub
  1639.  
  1640. Sub Sol24(Enabled)
  1641.  
  1642. SetLamp 124, Enabled
  1643.  
  1644. SetFlash 124, Enabled
  1645.  
  1646. End Sub
  1647.  
  1648. Sub Sol25(Enabled)
  1649.  
  1650. SetLamp 125, Enabled
  1651.  
  1652. SetFlash 125, Enabled
  1653.  
  1654. End Sub
  1655.  
  1656. Sub Sol26(Enabled)
  1657.  
  1658. SetLamp 126, Enabled
  1659.  
  1660. SetFlash 126, Enabled
  1661.  
  1662. End Sub
  1663.  
  1664.  
  1665. '*********************
  1666. ' Flasher fading sub
  1667. ' vpm version 1
  1668. '*********************
  1669.  
  1670. Dim FlashState(200), FlashLevel(200)
  1671. Dim FlashSpeedUp, FlashSpeedDown
  1672.  
  1673. FlashInit()
  1674. FlasherTimer.Interval = 10
  1675. FlasherTimer.Enabled = 1
  1676.  
  1677. Sub FlashInit
  1678. Dim i
  1679. For i = 0 to 200
  1680. FlashState(i) = 0
  1681. FlashLevel(i) = 0
  1682. Next
  1683. FlashSpeedUp = 50 ' fast speed when turning on the flasher
  1684. FlashSpeedDown = 10 ' slow speed when turning off the flasher, gives a smooth fading
  1685. ' you could also change the default images for each flasher or leave it as in the editor
  1686. ' for example
  1687. ' Flasher1.Image = "fr"
  1688. AllFlashOff()
  1689. End Sub
  1690.  
  1691. Sub AllFlashOff
  1692. Dim i
  1693. For i = 0 to 200
  1694. FlashState(i) = 0
  1695. Next
  1696. End Sub
  1697.  
  1698. Sub FlasherTimer_Timer()
  1699. Flashm 121, Flasher21
  1700. Flashm 121, Flasher21a
  1701. Flashm 121, Flasher_rr2
  1702. Flashm 121, Flasher_rpanel
  1703. Flash 121, Flasher21_glass
  1704.  
  1705. Flashm 124, Flasher24
  1706. Flashm 124, Flasher24a
  1707. Flashm 124, Flasher24b
  1708. Flashm 124, Flasher24c
  1709. Flashm 124, Flasher_lr2
  1710. Flashm 124, Flasher_lpanel
  1711. Flashm 124, Flasher24d
  1712. Flash 124, Flasher24_glass
  1713.  
  1714. Flashm 125, Flasher25
  1715. Flashm 125, Flasher25a
  1716. Flashm 125, Flasher_lr1
  1717. Flashm 125, Flasher_lpanel2
  1718. Flashm 125, Flasher25b
  1719. Flashm 125, Flasher25c
  1720. Flashm 125, Flasher25d
  1721. Flashm 125, Flasher25e
  1722. Flash 125, Flasher25_glass
  1723. Flashm 126, Flasher26
  1724. Flashm 126, Flasher26a
  1725. Flashm 126, Flasher_rr1
  1726. Flashm 126, Flasher_rpanel2
  1727. Flash 126, Flasher26_glass
  1728.  
  1729. Flashm 82, Flasher_LB
  1730. Flashm 82, Flasher_LBa
  1731. Flashm 82, FlasherLB_Glass
  1732. Flash 82, Flasher_LBR
  1733. Flashm 84, Flasher_UB
  1734. Flashm 84, Flasher_UBa
  1735. Flashm 84, FlasherUB_Glass
  1736. Flash 84, Flasher_UBR
  1737.  
  1738. Flashm 117, Flasher17
  1739. Flash 117, Flasher17_glass
  1740. Flashm 118, Flasher18
  1741. Flash 118, Flasher18_glass
  1742. Flashm 119, Flasher19
  1743. Flash 119, Flasher19_glass
  1744. Flashm 120, Flasher20
  1745. Flash 120, Flasher20_glass
  1746. Flash 128, Flasher28
  1747. Flashm 137, Flasher37
  1748. Flashm 137, Flasher37a
  1749. Flashm 137, Flasher37b
  1750. Flashm 137, Flasher37c
  1751. Flashm 137, Flasher37d
  1752. Flashm 137, Flasher37e
  1753. Flash 137, Flasher37_glass
  1754. End Sub
  1755.  
  1756. Sub SetFlash(nr, stat)
  1757. FlashState(nr) = ABS(stat)
  1758. End Sub
  1759.  
  1760. Sub Flash(nr, object)
  1761. Select Case FlashState(nr)
  1762. Case 0 'off
  1763. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
  1764. If FlashLevel(nr) < 0 Then
  1765. FlashLevel(nr) = 0
  1766. FlashState(nr) = -1 'completely off
  1767. End if
  1768. Object.alpha = FlashLevel(nr)
  1769. Case 1 ' on
  1770. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
  1771. If FlashLevel(nr) > 255 Then
  1772. FlashLevel(nr) = 255
  1773. FlashState(nr) = -2 'completely on
  1774. End if
  1775. Object.alpha = FlashLevel(nr)
  1776. End Select
  1777. End Sub
  1778.  
  1779. Sub Flashm(nr, object) 'multiple flashers, it doesn't change the flashstate
  1780. Select Case FlashState(nr)
  1781. Case 0 'off
  1782. Object.alpha = FlashLevel(nr)
  1783. Case 1 ' on
  1784. Object.alpha = FlashLevel(nr)
  1785. End Select
  1786. End Sub
  1787.  
  1788. '**********************************
  1789. ' JP's Fading Lamps v7.0 VP912
  1790. ' Based on PD's Fading Lights
  1791. ' SetLamp 0 is Off
  1792. ' SetLamp 1 is On
  1793. ' LampState(x) = current state
  1794. '***********************************
  1795.  
  1796. Dim FadingState(200), LampState(200)
  1797.  
  1798. AllLampsOff()
  1799. LampTimer.Interval = 60
  1800. LampTimer.Enabled = 1
  1801.  
  1802. Sub LampTimer_Timer()
  1803. Dim chgLamp, num, chg, ii
  1804. chgLamp = Controller.ChangedLamps
  1805. If Not IsEmpty(chgLamp) Then
  1806. For ii = 0 To UBound(chgLamp)
  1807. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  1808. If chgLamp(ii, 0) = 82 OR chgLamp(ii, 0) = 84 Then
  1809. FlashState(chgLamp(ii, 0)) = chgLamp(ii, 1)
  1810. LampState(chgLamp(ii, 0)) = chgLamp(ii, 1) + 4
  1811. Else
  1812. LampState(chgLamp(ii, 0)) = chgLamp(ii, 1) + 4
  1813. End If
  1814. Next
  1815. End If
  1816.  
  1817. UpdateLamps
  1818. End Sub
  1819.  
  1820. Sub UpdateLamps
  1821. FadeL 11, l11, l11a
  1822. FadeL 12, l12, l12a
  1823. FadeL 13, l13, l13a
  1824. FadeL 14, l14, l14a
  1825. FadeL 15, l15, l15a
  1826. FadeL 16, l16, l16a
  1827. FadeL 17, l17, l17a
  1828. FadeL 18, l18, l18a
  1829. FadeL 21, l21, l21a
  1830. FadeL 22, l22, l22a
  1831. FadeL 23, l23, l23a
  1832. FadeL 24, l24, l24a
  1833. FadeL 25, l25, l25a
  1834. FadeL 26, l26, l26a
  1835. FadeL 27, l27, l27a
  1836. FadeL 28, l28, l28a
  1837. FadeL 31, l31, l31a
  1838. FadeL 32, l32, l32a
  1839. FadeL 33, l33, l33a
  1840. FadeL 34, l34, l34a
  1841. FadeL 35, l35, l35a
  1842. FadeL 36, l36, l36a
  1843. FadeL 37, l37, l37a
  1844. FadeL 38, l38, l38a
  1845. FadeL 41, l41, l41a
  1846. FadeL 42, l42, l42a
  1847. FadeL 43, l43, l43a
  1848. FadeL 44, l44, l44a
  1849. FadeL 45, l45, l45a
  1850. FadeL 46, l46, l46a
  1851. FadeL 47, l47, l47a
  1852. FadeL 48, l48, l48a
  1853. FadeL 51, l51, l51a
  1854. FadeL 52, l52, l52a
  1855. FadeL 53, l53, l53a
  1856. FadeL 54, l54, l54a
  1857. FadeL 55, l55, l55a
  1858. FadeL 56, l56, l56a
  1859. FadeL 57, l57, l57a
  1860. FadeL 58, l58, l58a
  1861. FadeL 61, l61, l61a
  1862. FadeL 62, l62, l62a
  1863. FadeL 63, l63, l63a
  1864. FadeL 64, l64, l64a
  1865. FadeL 65, l65, l65a
  1866. FadeL 66, l66, l66a
  1867. FadeL 67, l67, l67a
  1868. FadeL 68, l68, l68a
  1869. FadeL 71, l71, l71a
  1870. FadeL 72, l72, l72a
  1871. FadeL 73, l73, l73a
  1872. FadeL 74, l74, l74a
  1873. FadeL 75, l75, l75a
  1874. FadeL 76, l76, l76a
  1875. FadeL 77, l77, l77a
  1876. FadeL 78, l78, l78a
  1877. FadeL 81, l81, l81a
  1878. NFadeL 82, RBumper
  1879. NFadeBoom 83
  1880. NFadeL 84, BBumper
  1881. FadeL 85, l85, l85a
  1882. FadeL 86, l86, l86a
  1883. FadeL 87, l87, l87a
  1884. 'NFadeL 88, l88
  1885.  
  1886. 'flashers
  1887.  
  1888. 'FlashARm 117, f17t, "wf_on", "wf_a", "wf_b", refresh
  1889. FadeL 117, f17, f17a
  1890. 'FlashARm 118, f18t, "bf_on", "bf_a", "bf_b", refresh
  1891. FadeL 118, f18, f18a
  1892. 'FlashARm 119, f19t, "bf_on", "bf_a", "bf_b", refresh
  1893. FadeL 119, f19, f19a
  1894. 'FlashARm 120, f20t, "bf_on", "bf_a", "bf_b", refresh
  1895. FadeL 120, f20, f20a
  1896.  
  1897. NFadeBoom 123
  1898.  
  1899. FadeL 127, f27, f27a
  1900. FadeL 128, f28, f28a
  1901.  
  1902. FadeW 121, f21, f21a, f21b
  1903. FadeW 124, f24, f24a, f24b
  1904. FadeW 125, f25, f25a, f25b
  1905. FadeW 126, f26, f26a, f26b
  1906.  
  1907. FadeARm2 137, neonramp2,"neon_green_on","neon_green_a","neon_green_b","neon_green",refresh
  1908.  
  1909. 'FadeARm2 137, neonglow,"alphaneon-60","alphaneon-45","alphaneon-25","",refresh
  1910.  
  1911. FadeLCo 137, cNeon, cNeona 'light
  1912.  
  1913. refresh.state = ABS(refresh.state-1)
  1914. End Sub
  1915.  
  1916. Sub AllLampsOff()
  1917. Dim x
  1918. For x = 0 to 200
  1919. LampState(x) = 4
  1920. Next
  1921.  
  1922. UpdateLamps:UpdateLamps:Updatelamps
  1923. End Sub
  1924.  
  1925. Sub SetLamp(nr, value)
  1926. If value = 0 AND LampState(nr) = 0 Then Exit Sub
  1927. If value = 1 AND LampState(nr) = 1 Then Exit Sub
  1928. LampState(nr) = abs(value) + 4
  1929. End Sub
  1930.  
  1931. 'Walls
  1932.  
  1933. Sub FadeW(nr, a, b, c)
  1934. Select Case LampState(nr)
  1935. Case 2:c.IsDropped = 1:LampState(nr) = 0 'Off
  1936. Case 3:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 2 'fading...
  1937. Case 4:a.IsDropped = 1:b.IsDropped = 0:LampState(nr) = 3 'fading...
  1938. Case 5:a.IsDropped = 0:LampState(nr) = 1 'ON
  1939. End Select
  1940. End Sub
  1941.  
  1942. Sub FadeWm(nr, a, b, c)
  1943. Select Case LampState(nr)
  1944. Case 2:c.IsDropped = 1
  1945. Case 3:b.IsDropped = 1:c.IsDropped = 0
  1946. Case 4:a.IsDropped = 1:b.IsDropped = 0
  1947. Case 5:a.IsDropped = 0
  1948. End Select
  1949. End Sub
  1950.  
  1951. Sub NFadeW(nr, a)
  1952. Select Case LampState(nr)
  1953. Case 4:a.IsDropped = 1:LampState(nr) = 0
  1954. Case 5:a.IsDropped = 0:LampState(nr) = 1
  1955. End Select
  1956. End Sub
  1957.  
  1958. Sub NFadeWm(nr, a)
  1959. Select Case LampState(nr)
  1960. Case 4:a.IsDropped = 1
  1961. Case 5:a.IsDropped = 0
  1962. End Select
  1963. End Sub
  1964.  
  1965. Sub NFadeWi(nr, a)
  1966. Select Case LampState(nr)
  1967. Case 4:a.IsDropped = 0:LampState(nr) = 0
  1968. Case 5:a.IsDropped = 1:LampState(nr) = 1
  1969. End Select
  1970. End Sub
  1971.  
  1972. Sub NFadeWim(nr, a)
  1973. Select Case LampState(nr)
  1974. Case 4:a.IsDropped = 0
  1975. Case 5:a.IsDropped = 1
  1976. End Select
  1977. End Sub
  1978.  
  1979. 'Lights
  1980.  
  1981. Sub FadeL(nr, a, b)
  1982. Select Case LampState(nr)
  1983. Case 2:b.state = 0:LampState(nr) = 0
  1984. Case 3:b.state = 1:LampState(nr) = 2
  1985. Case 4:a.state = 0:LampState(nr) = 3
  1986. Case 5:a.state = 1:LampState(nr) = 1
  1987. End Select
  1988. End Sub
  1989.  
  1990. Sub FadeLm(nr, a, b)
  1991. Select Case LampState(nr)
  1992. Case 2:b.state = 0
  1993. Case 3:b.state = 1
  1994. Case 4:a.state = 0
  1995. Case 5:a.state = 1
  1996. End Select
  1997. End Sub
  1998.  
  1999. Sub NFadeL(nr, a)
  2000. Select Case LampState(nr)
  2001. Case 4:a.state = 0:LampState(nr) = 0
  2002. Case 5:a.State = 1:LampState(nr) = 1
  2003. End Select
  2004. End Sub
  2005.  
  2006. Sub NFadeLm(nr, a)
  2007. Select Case LampState(nr)
  2008. Case 4:a.state = 0
  2009. Case 5:a.State = 1
  2010. End Select
  2011. End Sub
  2012.  
  2013. Sub FadeOldL(nr, a, b, c)
  2014. Select Case LampState(nr)
  2015. Case 2:c.state = 0:LampState(nr) = 0
  2016. Case 3:b.state = 0:c.state = 1:LampState(nr) = 2
  2017. Case 4:a.state = 0:b.state = 1:LampState(nr) = 3
  2018. Case 5:b.state = 0:c.state = 0:a.state = 1:LampState(nr) = 1
  2019. End Select
  2020. End Sub
  2021.  
  2022. Sub FadeOldLm(nr, a, b, c)
  2023. Select Case LampState(nr)
  2024. Case 2:c.state = 0
  2025. Case 3:b.state = 0:c.state = 1
  2026. Case 4:a.state = 0:b.state = 1
  2027. Case 5:b.state = 0:c.state = 0:a.state = 1
  2028. End Select
  2029. End Sub
  2030.  
  2031. 'Reels
  2032.  
  2033. Sub FadeR(nr, a)
  2034. Select Case LampState(nr)
  2035. Case 2:a.SetValue 3:LampState(nr) = 0
  2036. Case 3:a.SetValue 2:LampState(nr) = 2
  2037. Case 4:a.SetValue 1:LampState(nr) = 3
  2038. Case 5:a.SetValue 1:LampState(nr) = 1
  2039. End Select
  2040. End Sub
  2041.  
  2042. Sub FadeRm(nr, a)
  2043. Select Case LampState(nr)
  2044. Case 2:a.SetValue 3
  2045. Case 3:a.SetValue 2
  2046. Case 4:a.SetValue 1
  2047. Case 5:a.SetValue 1
  2048. End Select
  2049. End Sub
  2050.  
  2051. 'Texts
  2052.  
  2053. Sub NFadeT(nr, a, b)
  2054. Select Case LampState(nr)
  2055. Case 4:a.Text = "":LampState(nr) = 0
  2056. Case 5:a.Text = b:LampState(nr) = 1
  2057. End Select
  2058. End Sub
  2059.  
  2060. Sub NFadeTm(nr, a, b)
  2061. Select Case LampState(nr)
  2062. Case 4:a.Text = ""
  2063. Case 5:a.Text = b
  2064. End Select
  2065. End Sub
  2066.  
  2067. ' Flash a light, not controlled by the rom
  2068.  
  2069. Sub FlashL(nr, a, b)
  2070. Select Case LampState(nr)
  2071. Case 1:b.state = 0:LampState(nr) = 0
  2072. Case 2:b.state = 1:LampState(nr) = 1
  2073. Case 3:a.state = 0:LampState(nr) = 2
  2074. Case 4:a.state = 1:LampState(nr) = 3
  2075. Case 5:b.state = 1:LampState(nr) = 4
  2076. End Select
  2077. End Sub
  2078.  
  2079. ' Light acting as a flash. C is the light number to be restored
  2080.  
  2081. Sub MFadeL(nr, a, b, c)
  2082. Select Case LampState(nr)
  2083. Case 2:b.state = 0:LampState(nr) = 0:SetLamp c, LampState(c)
  2084. Case 3:b.state = 1:LampState(nr) = 2
  2085. Case 4:a.state = 0:LampState(nr) = 3
  2086. Case 5:a.state = 1:LampState(nr) = 1
  2087. End Select
  2088. End Sub
  2089.  
  2090. Sub MFadeLm(nr, a, b, c)
  2091. Select Case LampState(nr)
  2092. Case 2:b.state = 0:SetLamp c, LampState(c)
  2093. Case 3:b.state = 1
  2094. Case 4:a.state = 0
  2095. Case 5:a.state = 1
  2096. End Select
  2097. End Sub
  2098.  
  2099. 'Alpha Ramps used as fading lights
  2100. 'ramp is the name of the ramp
  2101. 'a,b,c,d are the images used for on...off
  2102. 'r is the refresh light
  2103.  
  2104. Sub FadeAR(nr, ramp, a, b, c, d, r)
  2105. Select Case LampState(nr)
  2106. Case 2:ramp.image = d:LampState(nr) = 0':r.State = ABS(r.state -1) 'Off
  2107. Case 3:ramp.image = c:LampState(nr) = 2':r.State = ABS(r.state -1) 'fading...
  2108. Case 4:ramp.image = b:LampState(nr) = 3':r.State = ABS(r.state -1) 'fading...
  2109. Case 5:ramp.image = a:LampState(nr) = 1':r.State = ABS(r.state -1) 'ON
  2110. End Select
  2111. End Sub
  2112.  
  2113. Sub FadeARm(nr, ramp, a, b, c, d, r)
  2114. Select Case LampState(nr)
  2115. Case 2:ramp.image = d':r.State = ABS(r.state -1)
  2116. Case 3:ramp.image = c':r.State = ABS(r.state -1)
  2117. Case 4:ramp.image = b':r.State = ABS(r.state -1)
  2118. Case 5:ramp.image = a':r.State = ABS(r.state -1)
  2119. End Select
  2120. End Sub
  2121.  
  2122. Sub FadeARm2(nr, ramp, a, b, c, d, r)
  2123. Select Case LampState(nr)
  2124. Case 2:ramp.alpha = 0':r.State = ABS(r.state -1)
  2125. Case 3:ramp.image = c':r.State = ABS(r.state -1)
  2126. Case 4:ramp.image = b':r.State = ABS(r.state -1)
  2127. Case 5:ramp.alpha = 1:ramp.image = a':r.State = ABS(r.state -1)
  2128. End Select
  2129. End Sub
  2130.  
  2131.  
  2132. Sub FlashAR(nr, ramp, a, b, c, r) 'used for reflections when there is no off ramp
  2133. Select Case LampState(nr)
  2134. Case 2:ramp.alpha = 0:LampState(nr) = 0':r.State = ABS(r.state -1) 'Off
  2135. Case 3:ramp.image = c:LampState(nr) = 2':r.State = ABS(r.state -1) 'fading...
  2136. Case 4:ramp.image = b:LampState(nr) = 3':r.State = ABS(r.state -1) 'fading...
  2137. Case 5:ramp.image = a:ramp.alpha = 1:LampState(nr) = 1':r.State = ABS(r.state -1) 'ON
  2138. End Select
  2139. End Sub
  2140.  
  2141. Sub FlashARm(nr, ramp, a, b, c, r)
  2142. Select Case LampState(nr)
  2143. Case 2:ramp.alpha = 0':r.State = ABS(r.state -1)
  2144. Case 3:ramp.image = c':r.State = ABS(r.state -1)
  2145. Case 4:ramp.image = b':r.State = ABS(r.state -1)
  2146. Case 5:ramp.image = a:ramp.alpha = 1':r.State = ABS(r.state -1)
  2147. End Select
  2148. End Sub
  2149.  
  2150.  
  2151.  
  2152. Sub NFadeAR(nr, ramp, a, b, r)
  2153. Select Case LampState(nr)
  2154. Case 4:ramp.image = b:LampState(nr) = 0':r.State = ABS(r.state -1) 'off
  2155. Case 5:ramp.image = a:LampState(nr) = 1':r.State = ABS(r.state -1) 'on
  2156. End Select
  2157. End Sub
  2158.  
  2159. Sub NFadeARm(nr, ramp, a, b, r)
  2160. Select Case LampState(nr)
  2161. Case 4:ramp.image = b':r.State = ABS(r.state -1)
  2162. Case 5:ramp.image = a':r.State = ABS(r.state -1)
  2163. End Select
  2164. End Sub
  2165.  
  2166. Sub MNFadeAR(nr, ramp, a, b, c, r)
  2167. Select Case LampState(nr)
  2168. Case 4:ramp.image = b:LampState(nr) = 0:SetLamp c, LampState(c)':r.State = ABS(r.state -1) 'off
  2169. Case 5:ramp.image = a:LampState(nr) = 1':r.State = ABS(r.state -1) 'on
  2170. End Select
  2171. End Sub
  2172.  
  2173. Sub MNFadeARm(nr, ramp, a, b, c, r)
  2174. Select Case LampState(nr)
  2175. Case 4:ramp.image = b:SetLamp c, LampState(c)':r.State = ABS(r.state -1) 'off
  2176. Case 5:ramp.image = a':r.State = ABS(r.state -1) 'on
  2177. End Select
  2178. End Sub
  2179.  
  2180. Sub FadeLCo(nr, a, b) 'fading collection of lights
  2181. Dim obj
  2182. Select Case LampState(nr)
  2183. Case 2:vpmSolToggleObj b, Nothing, 0, 0:LampState(nr) = 0
  2184. Case 3:vpmSolToggleObj b, Nothing, 0, 1:LampState(nr) = 2
  2185. Case 4:vpmSolToggleObj a, Nothing, 0, 0:LampState(nr) = 3
  2186. Case 5:vpmSolToggleObj a, Nothing, 0, 1:LampState(nr) = 1
  2187. End Select
  2188. End Sub
  2189.  
  2190. ' Extra Fading Subs, only for this table
  2191.  
  2192. Sub NFadeBoom(nr)
  2193. Select Case LampState(nr)
  2194. Case 4
  2195. l83ba.IsDropped = 1
  2196. l83ua.IsDropped = 1
  2197. boomramp.image = "plastics"
  2198. LampState(nr) = 0
  2199. Case 5
  2200. If l83u.IsDropped = 0 Then
  2201. l83ua.IsDropped = 0
  2202. boomramp.image = "plastics_on"
  2203. Else
  2204. l83ba.IsDropped = 0
  2205. End If
  2206. LampState(nr) = 1
  2207. End Select
  2208. End Sub
  2209.  
  2210.  
  2211. 'REGISTRY LOCATIONS ***************************************************************************************************************************************
  2212.  
  2213. Const optOpenAtStart = &H00000001
  2214. Const optDMDRotation = &H00000002
  2215. Const optDMDHidden = &H00000004
  2216. Const optBMPR = &H00000008
  2217. Const optController = &H00000010
  2218. Const optB2BEnable = &H00000100
  2219. Const optBackglass = &H00001000
  2220. Const optLogo = &H00002000
  2221. Const optModern = &H00004000
  2222. Const optAnIm = 32768
  2223. Const optRom = &H00010000
  2224. Const optFBSounds = &H00100000
  2225.  
  2226. Const optDayMod = &H00000001
  2227. Const optBallColor = &H00000010
  2228. 'Const optGIOn = &H00000100
  2229. 'Const optGIOff = &H00001000
  2230.  
  2231. 'OPTIONS MENU *********************************************************************************************************************************************
  2232.  
  2233. Dim TableOptions, TableOptions2, TableName, optReset
  2234. Private vpmShowDips1, vpmDips1, vpmDips2
  2235.  
  2236. Sub InitializeOptions
  2237. TableName="CirqusVoltaire_FOM" 'Replace with your descriptive table name, it will be used to save settings in VPReg.stg file
  2238. Set vpmShowDips1 = vpmShowDips 'Reassigns vpmShowDips to vpmShowDips1 to allow usage of default dips menu
  2239. Set vpmShowDips = GetRef("TableShowDips") 'Assigns new sub to vmpShowDips
  2240. TableOptions = LoadValue(TableName,"Options") 'Load saved table options
  2241. TableOptions2 = LoadValue(TableName,"Options2") 'Load saved table options
  2242. Set Controller = CreateObject("VPinMAME.Controller") 'Load vpm controller temporarily so options menu can be loaded if needed
  2243. If TableOptions2 = "" Then TableOptions2 = 0
  2244. If TableOptions = "" Or optReset Then 'If no existing options, reset to default through optReset, then open Options menu
  2245. TableOptions = DefaultOptions 'clear any existing settings and set table options to default options
  2246. TableShowOptions
  2247. ElseIf (TableOptions And optOpenAtStart) Then 'If Enable Next Start was selected then
  2248. TableOptions = TableOptions - optOpenAtStart 'clear setting to avoid future executions
  2249. TableShowOptions
  2250. Else
  2251. TableSetOptions
  2252. End If
  2253. TableSetOptions2
  2254. Set Controller = Nothing 'Unload vpm controller so selected controller can be loaded
  2255. End Sub
  2256.  
  2257. Private Sub TableShowDips
  2258. vpmShowDips1 'Show original Dips menu
  2259. TableShowOptions 'Show new options menu
  2260. 'TableShowOptions2 'Add more options menus...
  2261. End Sub
  2262.  
  2263. Private Sub TableShowOptions 'New options menu, additional menus can be added as well, just follow similar format and add call to TableShowDips
  2264. Dim oldOptions : oldOptions = TableOptions
  2265. If Not IsObject(vpmDips1) Then 'If creating an additional menus, need to declare additional vpmDips variables above (ex. vpmDips2 and TableOptions2, etc.)
  2266. Set vpmDips1 = New cvpmDips
  2267. With vpmDips1
  2268. .AddForm 530, 250, "TABLE OPTIONS MENU"
  2269. .AddFrameExtra 0,0,105,"Controller Selection*",3*optController, Array("Visual PinMame", 1*optController, "UVP", 2*optController,_
  2270. "B2S Server", 3*optController)
  2271. .AddFrameExtra 0,60,105,"Rom Selection*",3*optRom, Array("cv_20h", 0*optRom, "cv_20hc", 1*optRom, "cv_14", 2*optRom)
  2272. .AddFrameExtra 0,120,105,"B2B Options",3*optB2BEnable, Array("Auto Detect", 2*optB2BEnable, "Force Disable", 0*optB2BEnable, "Force Enable", 1*optB2BEnable)
  2273. .AddFrameExtra 120,0,130,"Options",0, Array("Launch B2S Backglass", optBackglass, "3rd Screen Logo", optLogo, "Rotate DMD", optDMDRotation,_
  2274. "Hide DMD", optDMDHidden, "Enable BMPR Lite*", optBMPR)
  2275. .AddFrameExtra 120,90,100,"Plunger",0,Array("Modern Plunger", optModern, "Analog Impulse", optAnIm)
  2276. .AddLabel 0,185,100,15,"* Requires restart"
  2277. .AddChkExtra 125,185,135, Array("Enable Menu Next Start", optOpenAtStart)
  2278. ' .AddLabel 120,190,120,15,"(Loads before Controller)"
  2279. .AddChkExtra 125,140,135, Array("Disable Mech Sounds*", optFBSounds)
  2280. .AddLabel 145,155,120,15,"(For use with DOF)"
  2281. End With
  2282. End If
  2283. TableOptions = vpmDips1.ViewDipsExtra(TableOptions)
  2284. SaveValue TableName,"Options",TableOptions
  2285. TableSetOptions
  2286. TableShowOptions2
  2287. End Sub
  2288.  
  2289. Private Sub TableShowOptions2 'New options menu, additional menus can be added as well, just follow similar format and add call to TableShowDips
  2290. Dim oldOptions : oldOptions = TableOptions2
  2291. If Not IsObject(vpmDips2) Then 'If creating an additional menus, need to declare additional vpmDips variables above (ex. vpmDips2 and TableOptions2, etc.)
  2292. Set vpmDips2 = New cvpmDips
  2293. With vpmDips2
  2294. .AddForm 530, 250, "LIGHTING AND COLOR OPTIONS MENU"
  2295. .AddChkExtra 0,0,135, Array("Enable Day Mod", optDayMod)
  2296. .AddFrameExtra 0,20,50,"Ball Color", 7*optBallColor, Array("Green", 0*optBallColor, "Red", 1*optBallColor, "Blue", 2*optBallColor,_
  2297. "Yellow", 3*optBallColor, "Lilac", 4*optBallColor)
  2298. '.AddFrameExtra 65,20,60,"GI On Color", 7*optGIOn, Array("Off", 0*optGIOn, "White", 1*optGIOn, "Green", 2*optGIOn, "Red", 3*optGIOn,_
  2299. ' "Blue", 4*optGIOn, "Orange", 5*optGIOn)
  2300. '.AddFrameExtra 140,20,60,"GI Off Color", 7*optGIOff, Array("Off", 0*optGIOff, "White", 1*optGIOff, "Green", 2*optGIOff, "Red", 3*optGIOff,_
  2301. ' "Blue", 4*optGIOff, "Orange", 5*optGIOff)
  2302. End With
  2303. End If
  2304. TableOptions2 = vpmDips2.ViewDipsExtra(TableOptions2)
  2305. SaveValue TableName,"Options2",TableOptions2
  2306. TableSetOptions2
  2307. End Sub
  2308.  
  2309. Dim BigBallImage, BColor,ShowLogo, useBMPR, DayMod, RMImages
  2310. BigBallImage = Array("big_ball_green", "big_ball_red", "big_ball_blue", "big_ball_yellow", "big_ball_lila")
  2311. 'RMImages = Array("rm_off","rm_on")
  2312.  
  2313. Sub TableSetOptions 'defines required settings before table is run
  2314. ROL = (TableOptions And optDMDRotation)\optDMDRotation
  2315. HIDDEN = (TableOptions And optDMDHidden)\optDMDHidden
  2316. cController = ((TableOptions And (3*optController))\optController)
  2317. B2Bon = ((TableOptions And (3*optB2BEnable))\optB2BEnable)
  2318. ShowLogo = (TableOptions And optLogo)\optLogo
  2319. 'cGameName = Array("cv_20h","cv_20hc","cv_14")((TableOptions AND (3*optRom))\optRom)
  2320. UseBMPR = (TableOptions AND optBMPR)\optBMPR
  2321. If (TableOptions AND optFBSounds) Then
  2322. FFBSounds = FeedbackSounds
  2323. Sound1 = ""
  2324. Sound2 = ""
  2325. Sound3 = ""
  2326. Else
  2327. FFBSounds = Empty
  2328. Sound1 = "fx_ballrel"
  2329. Sound2 = "fx_Solenoid"
  2330. Sound3 = "fx_popper"
  2331. End If
  2332.  
  2333. If (TableOptions AND optModern) Then
  2334. aPlunger.alpha = 0
  2335. PlungerHide.alpha = 0
  2336. ImpulsePlunger=0
  2337. Else
  2338. aPlunger.alpha = 1
  2339. PlungerHide.alpha = 1
  2340. ImpulsePlunger=1
  2341. End If
  2342. If (TableOptions AND optAnIm) Then
  2343. Plunger2.MechPlunger = 0
  2344. ImpulseP = 1
  2345. Else
  2346. Plunger2.MechPlunger = 1
  2347. ImpulseP = 0
  2348. End If
  2349. End Sub
  2350.  
  2351. Sub TableSetOptions2 'defines lighting and color settings before table is run
  2352. Dim obj
  2353. BColor = ((TableOptions2 And 7*optBallColor)\optBallColor)
  2354. 'GION_alphaGIColor = ((TableOptions2 AND 7*optGIOn)\optGIOn)
  2355. 'GIOFF_alphaGIColor = ((TableOptions2 AND 7*optGIOff)\optGIOff)
  2356. DayMod = (TableOptions2 And optDayMod)\optDayMod
  2357. On Error Resume Next
  2358. For each obj in Flippers
  2359. obj.visible = 0
  2360. obj.enabled = 0
  2361. Next
  2362. If UseBMPR then
  2363. LeftFlipper1.visible = 1
  2364. RightFlipper1.visible = 1
  2365. LeftFlipper1.enabled = 1
  2366. RightFlipper1.enabled = 1
  2367. ElseIf DayMod Then
  2368. LeftFlipper2.visible = 1
  2369. RightFlipper2.visible = 1
  2370. LeftFlipper2.enabled = 1
  2371. RightFlipper2.enabled = 1
  2372. Else
  2373. LeftFlipper.visible = 1
  2374. RightFlipper.visible = 1
  2375. LeftFlipper.enabled = 1
  2376. RightFlipper.enabled = 1
  2377. End If
  2378. On Error Goto 0
  2379. If DayMod Then
  2380. apronramp.alpha = 1
  2381. pfDay.alpha = 1
  2382. RingMaster.image = "rm_off-day"
  2383. RMImages = Array("rm_off-day","rm_on-day")
  2384. Else
  2385. apronramp.alpha = 0
  2386. pfDay.alpha = 0
  2387. RingMaster.image = "rm_off"
  2388. RMImages = Array("rm_off","rm_on")
  2389. End If
  2390. End Sub
  2391.  
  2392.  
  2393. 'Dim GIEnabled, GIOn, GIOff : GIEnabled=0
  2394. Sub UpdateVisuals
  2395. If WBall.image <> BigBallImage(BColor) Then WBall.image = BigBallImage(BColor)
  2396. 'If GIOn <> GION_alphaGIColor OR GIOff <> GIOFF_alphaGIColor Then
  2397. 'GIon = GION_alphaGIColor
  2398. 'GIOff = GIOFF_alphaGIColor
  2399. 'UpdateGI 5, GIEnabled
  2400. 'End If
  2401. End Sub
  2402.  
  2403. 'Function CheckB2S(name)
  2404. ' CheckB2S=false
  2405. ' Dim WshShell,filecheck,directory
  2406. ' Set WshShell = CreateObject("WScript.Shell")
  2407. ' name = WshShell.RegRead ("HKCU\Software\Visual Pinball\RecentDir\TableFileName0")
  2408. ' directory = Left(name,InStrRev(name,"\"))
  2409. ' name = Replace(Mid(name,InStrRev(name,"\")+1),".vpt","")
  2410. ' Set filecheck = CreateObject("Scripting.FileSystemObject")
  2411. ' If filecheck.FileExists(directory & name & ".exe") Then CheckB2S = True
  2412. 'End Function
  2413.  
  2414. Dim FFBSounds,DOF
  2415. Sub vpPlay(aSound) 'updated for all 8 possible options
  2416. Dim x,sound
  2417. If IsArray(aSound) Then sound = asound(0) else sound = asound
  2418. If Not IsEmpty(FFBSounds) Then 'If FFBSounds is assigned to the feedbacksounds array... aka FeedBack sounds turned OFF
  2419. For x = 0 to Ubound(FFBSounds) 'Loop through all sounds in the array
  2420. If lcase(FFBSounds(x)) = lcase(sound) Then 'Check to see if sound is present in array, and if so
  2421. Exit Sub 'Exit the sub as no sound should then be played
  2422. End If
  2423. Next 'If sound isn't found, then play sound as normal...
  2424. If IsArray(aSound) Then 'If sound is defined as an array for additional switch use, Then play sound with defined switches
  2425. Select Case UBound(aSound)
  2426. Case 0 : PlaySound aSound(0)
  2427. Case 1 : PlaySound aSound(0),aSound(1)
  2428. Case 2 : PlaySound aSound(0),aSound(1),aSound(2)
  2429. Case 3 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3)
  2430. Case 4 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4)
  2431. Case 5 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4),aSound(5)
  2432. Case 6 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4),aSound(5),aSound(6)
  2433. Case 7 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4),aSound(5),aSound(6),aSound(7)
  2434. End Select
  2435. Else
  2436. PlaySound aSound 'Or just play the sound specified
  2437. End If
  2438. Else 'If Feedback sounds are left ON, play sounds as normal
  2439. If IsArray(aSound) Then
  2440. Select Case UBound(aSound)
  2441. Case 0 : PlaySound aSound(0)
  2442. Case 1 : PlaySound aSound(0),aSound(1)
  2443. Case 2 : PlaySound aSound(0),aSound(1),aSound(2)
  2444. Case 3 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3)
  2445. Case 4 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4)
  2446. Case 5 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4),aSound(5)
  2447. Case 6 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4),aSound(5),aSound(6)
  2448. Case 7 : PlaySound aSound(0),aSound(1),aSound(2),aSound(3),aSound(4),aSound(5),aSound(6),aSound(7)
  2449. End Select
  2450. Else
  2451. PlaySound aSound
  2452. End If
  2453. End If
  2454. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement