Arngrim

Untitled

Jan 13th, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 61.81 KB | None | 0 0
  1. '************ Freddy, A Nightmare On Elm Street
  2. '************ Premier 1994
  3. '************ unclewilly, grizz, hassenchop for VPM5 version
  4. '************ and base for the VPX one by Team PP : JPJ - Chucky - Aetios - NeoFR45 - Arngrim
  5.  
  6. Option Explicit
  7. Randomize
  8.  
  9. On Error Resume Next
  10. ExecuteGlobal GetTextFile("controller.vbs")
  11. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  12. On Error Goto 0
  13.  
  14. Const BallSize = 52
  15. Const BallMass = 1.8
  16.  
  17. LoadVPM "01560000", "gts3.VBS", 3.10
  18.  
  19. 'Variables
  20. Dim xx
  21. Dim Bump1, Bump2, Bump3
  22. Dim cGameName
  23. Dim bsTrough, DTBank, MechBoiler, bsVUKT, bsVUKB, bsFreddyHead, cb, PlungerIM, bsBallrelease, FastFlips
  24. Dim clawOn
  25. Dim BallinPlunger
  26. Dim GlobalSoundLevel, R, G, B, TI
  27. Dim obj, rGreen, rRed, rBlue, RGBFactor, RGBStep
  28. GlobalSoundLevel = 2
  29.  
  30. Const UseSolenoids = 2
  31. Const UseLamps = 0
  32. Const UseSync = 1
  33. Const HandleMech = 0
  34.  
  35.  
  36. '******** Flupper Dome ini **********
  37. Dim FlashLevel1, FlashLevel2
  38. F17L.IntensityScale = 0
  39. F19L.IntensityScale = 0
  40. '************************************
  41.  
  42. cGameName = "freddy"
  43.  
  44. Sub Table1_Exit ' in some tables this needs to be Table1_Exit
  45. Controller.Stop
  46. End Sub
  47.  
  48.  
  49.  
  50. '************
  51. ' Table init.
  52. '************
  53.  
  54. Sub Table1_Init
  55.  
  56. vpmInit Me
  57.  
  58. With Controller
  59. .GameName = cGameName
  60. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  61. .SplashInfoLine = "Freddy, Premier 1994"
  62. .HandleMechanics = 0
  63. .HandleKeyboard = 0
  64. .ShowDMDOnly = 1
  65. .ShowFrame = 0
  66. .ShowTitle = 0
  67. End With
  68. Controller.Hidden = 0
  69. On Error Resume Next
  70.  
  71. Controller.Run
  72. ' If Err Then MsgBox Err.Description
  73. ' On Error Goto 0
  74.  
  75.  
  76. ' Main Timer init
  77. PinMAMETimer.Interval = PinMAMEInterval
  78. PinMAMETimer.Enabled = 1
  79.  
  80. ' Nudging
  81. vpmNudge.TiltSwitch = 14
  82. vpmNudge.Sensitivity = 3
  83. vpmNudge.TiltObj = Array(Bumper1,Bumper2,LeftSlingshot,RightSlingshot, sw16, sw15)
  84.  
  85.  
  86. clawOn = 0
  87. FclawR.enabled = 0
  88. FclawL.enabled = 0
  89.  
  90. JawP.z=90'35 'old 20
  91. Primitive6.z=20
  92. Primitive4.objrotx = -3
  93. Primitive4.objroty = 3
  94.  
  95. ' SaveValue cRegistryName, "Options", 0 : Exit Sub ' This will clear your Registry settings if uncommented
  96. ' FreddyOptions = CInt("0" & LoadValue(cRegistryName, "Options")) : FreddySetOptions
  97. ' If (FreddyOptions And cOptNoStartM) = 0 Then FreddyShowDips:end if
  98.  
  99.  
  100.  
  101. ' Autofire Plunger
  102. Const IMPowerSetting = 45
  103. Const IMTime = 0.4
  104. Set plungerIM = New cvpmImpulseP
  105. With plungerIM
  106. .InitImpulseP swplunger, IMPowerSetting, IMTime
  107. .Random 0.3
  108. .InitExitSnd "plunger", "solenoid"
  109. .CreateEvents "plungerIM"
  110. End With
  111.  
  112.  
  113.  
  114.  
  115. '**Trough
  116. Set bsTrough = New cvpmBallStack
  117. With bsTrough
  118. .InitSw 23,0,0,22,0,0,0,0
  119. .InitKick BallRelease, 90, 8
  120. .InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  121. '.BallImage = "ballDark"
  122. .Balls = 3
  123. End With
  124. bsTrough.AddBall 0
  125.  
  126. Set bsBallRelease = New cvpmBallStack
  127. With bsBallRelease
  128. .InitSaucer BallRelease, 150, 110, 20
  129. .InitEntrySnd "solenoid", "solenoid"
  130. .InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("solenoid",DOFContactors)
  131. End With
  132.  
  133. Set bsFreddyHead = New cvpmBallStack
  134. With bsFreddyHead
  135. .InitSw 0,80,0,0,0,0,0,0
  136. .InitKick sw80a, 130, 21
  137. .KickForceVar = 5
  138. .KickAngleVar = 5
  139. .InitExitSnd SoundFX("Solenoid",DOFContactors), SoundFX("Solenoid",DOFContactors)
  140. End With
  141.  
  142. '**VUK Top
  143. Set bsVUKT = New cvpmBallStack
  144. With bsVUKT
  145. .InitSaucer sw21,21,190,10
  146. .KickZ= 3
  147. .InitExitSnd SoundFX("Solenoid",DOFContactors), SoundFX("Solenoid",DOFContactors)
  148. End With
  149.  
  150. '**VUK bottom
  151. Set bsVUKB = New cvpmBallStack
  152. With bsVUKB
  153. .InitSaucer sw20,20,150,15
  154. .KickZ= 99
  155. .InitExitSnd SoundFX("Solenoid",DOFContactors), SoundFX("Solenoid",DOFContactors)
  156. End With
  157.  
  158.  
  159. 'DropTargets
  160. Set DTBank = New cvpmDropTarget
  161. With DTBank
  162. .InitDrop Array(Array(sw17,sw17a),Array(sw27,sw27a),Array(sw37,sw37a)), Array(17,27,37)
  163. .InitSnd SoundFX("DTC",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  164. End With
  165.  
  166. 'Boiler Door Animation
  167. Set MechBoiler = new cvpmMech
  168. With MechBoiler
  169. .Sol1 = 24
  170. .Mtype = vpmMechReverse + vpmMechOneSol 'vpmMechLinear +
  171. .Length = 110
  172. .Steps = 10
  173. .Acc = 20
  174. .Ret = 0
  175. .AddSw 24, 1, 1
  176. .AddSw 34, 9, 9
  177. .Callback = GetRef("UpdateBoiler")
  178. .Start
  179. End With
  180.  
  181. 'Captive ball
  182. Set cb = New cvpmCaptiveBall
  183. With cb
  184. .InitCaptive captTrig, captwall, capt, 360
  185. .ForceTrans = .9
  186. .MinForce = 3.5
  187. .Start
  188. End With
  189.  
  190. '**** Fastflips
  191. Set FastFlips = new cFastFlips
  192. with FastFlips
  193. .CallBackL = "SolLflipper" 'Point these to flipper subs
  194. .CallBackR = "SolRflipper" '...
  195. ' .CallBackUL = "SolULflipper"'...(upper flippers, if needed)
  196. ' .CallBackUR = "SolURflipper"'...
  197. .TiltObjects = True 'Optional, if True calls vpmnudge.solgameon automatically. IF YOU GET A LINE 1 ERROR, DISABLE THIS! (or setup vpmNudge.TiltObj!)
  198. ' .DebugOn = True 'Debug, always-on flippers. Call FastFlips.DebugOn True or False in debugger to enable/disable.
  199. end with
  200.  
  201.  
  202. 'BoilerDoorInit
  203. InitBoilerDoor
  204.  
  205.  
  206. '********** diverters init ************
  207. Door01.ObjRotz = 0
  208. Door02.ObjRotz = 245
  209. RD1.IsDropped=1:RD2.IsDropped=1:RDOpen.IsDropped=1
  210. TDA1.IsDropped=1:TDA2.IsDropped=1:TDOpen.IsDropped=1
  211. '**************************************
  212.  
  213. '**** Kickback and autoplunger ****
  214. kickbackwall.IsDropped=1
  215. kickback.PullBack
  216. ' Plunger.PullBack
  217. '**********************************
  218.  
  219. '********** Init Gi - New VPX *************
  220. For each xx in GI:xx.state=0:next
  221. FLaneL1.state = 0
  222. FLaneL.state = 0
  223. FLaneL12.state = 0
  224. FLaneL2.state = 0
  225.  
  226. RainbowTimer.enabled = 1
  227. '******************************************
  228.  
  229. '********** Go for GI Light On ************
  230. GIT.Enabled=1
  231. '******************************************
  232.  
  233. '********** InitFlashers **************
  234. l10.state = 0
  235. l10In.state = 0
  236. l11.state = 0
  237. l11In.state = 0
  238. 'f17l.state = 0 'FlasherDome, Flupper's method never state off
  239. f17lint.state = 0
  240. 'f19l.state = 0 'FlasherDome, Flupper's method never state off
  241. f19lint.state = 0
  242. PRefresh.state = 0
  243. Lightclaw.state = 0
  244. F19flashsecA.amount = 0
  245. F19FlashsecA.intensityScale = 0
  246. F19flashsecB.amount = 0
  247. F19FlashsecB.intensityScale = 0
  248. F19flashsecC.amount = 0
  249. F19FlashsecC.intensityScale = 0
  250. F17flashsecA.amount = 0
  251. F17FlashsecA.intensityScale = 0
  252. F17flashsecB.amount = 0
  253. F17FlashsecB.intensityScale = 0
  254. F17flashsecC.amount = 0
  255. F17FlashsecC.intensityScale = 0
  256. F17flashsecD.amount = 0
  257. F17FlashsecD.intensityScale = 0
  258. '***************************************
  259.  
  260. '********** variables ******************
  261. rt=0
  262. rb=0
  263. plb=0
  264. plt=0
  265. RGBStep = 0
  266. rgreen = 0
  267. rblue = 0
  268. rRed = 0
  269. '***************************************
  270.  
  271. End Sub
  272. '*********************** end table ini ********************************
  273.  
  274. '********** GI Light On ***********
  275. Sub GIT_Timer()
  276. For each xx in GI:xx.state=1:next
  277. GIT.Enabled=0
  278.  
  279. End Sub
  280. '**********************************
  281.  
  282.  
  283. Sub InitBoilerDoor()
  284. For xx = 1 To 7
  285. boilerdoor(xx).IsDropped = 1
  286. Next
  287. End Sub
  288.  
  289. Sub UpdateBoiler(currpos, currspeed, lastpos)
  290. If currpos <> lastpos Then
  291. boilerdoor(lastpos).IsDropped = 1
  292. boilerdoor(currpos).IsDropped = 0
  293. End If
  294. End Sub
  295.  
  296.  
  297.  
  298. Sub Table1_Paused:Controller.Pause = 1:End Sub
  299. Sub Table1_unPaused:Controller.Pause = 0:End Sub
  300.  
  301.  
  302. '*************** Keys *****************
  303. Sub Table1_KeyDown(ByVal Keycode)
  304.  
  305. '********* nudge *******
  306. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge",0)
  307. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge",0)
  308. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge",0)
  309.  
  310. If Keycode = StartGameKey then Controller.Switch(4) = 1:end If
  311.  
  312. If Keycode = KeyReset then
  313. For each xx in GI:xx.state=0:next
  314. GIT.Enabled=1
  315. End if
  316.  
  317. If keycode = PlungerKey Then
  318. Plunger.Pullback
  319. end if
  320.  
  321.  
  322. If KeyCode = LeftFlipperKey then FastFlips.FlipL True ': FastFlips.FlipUL True
  323. If KeyCode = RightFlipperKey then FastFlips.FlipR True:FastFlips.FlipUR True
  324.  
  325. ' If Keycode = LeftFlipperKey then
  326. ' If FGA = 1 then
  327. ' glove.RotateToEnd
  328. ' Controller.Switch(45) = 1
  329. ' else
  330. ' Controller.Switch(45) = 1
  331. ' end if
  332. ' End If
  333. '
  334. ' If Keycode = RightFlipperKey then Controller.Switch(47) = 1:end if
  335.  
  336. If KeyCode = RightMagnaSave then
  337. Controller.Switch(7) = 1
  338. clawOn = 1
  339. FClawL.rotatetoend
  340. FClawR.rotatetoend
  341. end if
  342.  
  343. If vpmKeyDown(keycode) Then Exit Sub
  344. End Sub
  345.  
  346.  
  347. Sub Table1_KeyUp(ByVal keycode)
  348. If Keycode = StartGameKey then Controller.Switch(4) = 0
  349.  
  350. If KeyCode = LeftFlipperKey then FastFlips.FlipL False ': FastFlips.FlipUL True
  351. If KeyCode = RightFlipperKey then FastFlips.FlipR False:FastFlips.FlipUR True
  352.  
  353. ' If Keycode = LeftFlipperKey then
  354. ' glove.RotateToStart
  355. ' Controller.Switch(45) = 0
  356. ' end if
  357. '
  358. ' If Keycode = RightFlipperKey then Controller.Switch(47) = 0
  359.  
  360. If KeyCode = RightMagnaSave then
  361. Controller.Switch(7) = 0
  362. clawOn = 0
  363. Lightclaw.state = 0
  364. FClawL.rotatetostart
  365. FClawR.rotatetostart
  366. FClaw.rotatetostart
  367. end If
  368.  
  369. If keycode = PlungerKey Then
  370. If(BallinPlunger = 1) then 'the ball is in the plunger lane
  371. PlaySound "Plunger2"
  372. Plunger.Fire
  373. else
  374. PlaySound "Plunger"
  375. Plunger.Fire
  376. end if
  377. End If
  378.  
  379. If vpmKeyUp(keycode) Then Exit Sub
  380. End Sub
  381.  
  382. '***************** end keys ********************
  383.  
  384.  
  385. '**************** Solenoids ********************
  386.  
  387. SolCallback(1) = "" 'Top Bumper
  388. SolCallback(2) = "" 'Bottom Bumper
  389. SolCallback(3) = "" 'LeftSling
  390. SolCallback(4) = "" 'RightSling
  391. SolCallback(5) = "" 'LeftKicking Target
  392. SolCallback(6) = "" 'RightKicking Target
  393. SolCallback(7) = "SolKickBack"
  394. SolCallback(8) = "SolClawSave"
  395. SolCallback(9) = "solAutofire" '"SolAutoplung"
  396. SolCallback(10) = "SolDivTop"
  397. SolCallback(11) = "SolDivBot"
  398. SolCallback(12) = "solTUK"
  399. SolCallback(13) = "bsFreddyHead.SolOut"
  400. SolCallback(14) = "bsVUKB.SolOut"
  401. SolCallback(15) = "SolMouth"
  402. SolCallback(16) = "ResetDrops" 'OK
  403. SolCallback(17) = "SolLanes" 'SolLanes
  404. SolCallback(18) = "Solflash18" 'ok flasher inlay près des flippers
  405. SolCallback(19) = "Solflash19" 'ok flash 17 flasher près du gant
  406. SolCallback(20) = "SolF24" ' 'ok flash 19 flasher haut gauche
  407. SolCallback(21) = "SolFreddy" 'ok Freddy's Head
  408. SolCallback(22) = "SolF22" 'ok Boiler - Four
  409. SolCallback(23) = "SolHouse"
  410. 'SolCallback(24) = "SolBoilerMotor"
  411. SolCallback(25) = "SolGloveFlipper"
  412. SolCallback(27) = "Solrelease" ' old commented '"SolTicketDis"
  413. SolCallback(28) = "bsTrough.SolOut"
  414. SolCallback(29) = "bsTrough.SolIn"
  415. SolCallback(30) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  416. SolCallback(31) = "vpmNudge.SolGameOn"
  417. SolCallback(32) ="FastFlips.TiltSol"
  418. ' SolCallback(32) ="solGOR"
  419.  
  420. SolCallback(sLRFlipper) = "SolRFlipper"
  421. SolCallback(sLLFlipper) = "SolLFlipper"
  422. 'SolCallback(sLURFlipper) = "SolURflipper"
  423.  
  424. Sub SolLFlipper(Enabled)
  425. If enabled Then
  426. If FGA = 1 then
  427. PlaySound SoundFX("LFlip",DOFFlippers):LeftFlipper.RotateToEnd
  428. glove.RotateToEnd
  429. ' Controller.Switch(81) = 1 '45
  430. else
  431. PlaySound SoundFX("LFlip",DOFFlippers):LeftFlipper.RotateToEnd
  432. ' Controller.Switch(81) = 1
  433. end if
  434. else
  435. LeftFlipper.RotateToStart
  436. ' Controller.Switch(81) = 0
  437. glove.RotateToStart
  438. PlaySound SoundFX("LFlipd",DOFFlippers)
  439. End If
  440. End Sub
  441.  
  442. Sub SolRFlipper(Enabled)
  443. If Enabled Then
  444. PlaySound SoundFX("RFlip",DOFFlippers)
  445. RightFlipper.RotateToEnd
  446. RightFlipper1.RotateToEnd
  447. ' controller.Switch(82)=1 '47
  448. Else
  449. RightFlipper.RotateToStart
  450. RightFlipper1.RotateToStart
  451. ' controller.Switch(82)=0
  452. PlaySound SoundFX("RFlipd",DOFFlippers)
  453. End If
  454.  
  455. End Sub
  456.  
  457. 'Sub SolURflipper(Enabled)
  458. ' If Enabled Then
  459. ' RightFlipper1.RotateToEnd
  460. ' controller.Switch(82)=1 '47
  461. ' Else
  462. ' RightFlipper1.RotateToStart
  463. ' controller.Switch(82)=0
  464. ' End If
  465. '
  466. 'end Sub
  467.  
  468. Sub SolRelease(Enabled)
  469. If Enabled Then
  470. bsTrough.ExitSol_On
  471. vpmCreateBall BallRelease
  472. bsBallRelease.AddBall 0
  473. End If
  474. End Sub
  475.  
  476. Sub SolLanes(enabled)
  477. if enabled then
  478. FLaneL1.state = 1
  479. FLaneL.state = 1
  480. FLaneL12.state = 1
  481. FLaneL2.state = 1
  482. Else
  483. FLaneL1.state = 0
  484. FLaneL.state = 0
  485. FLaneL12.state = 0
  486. FLaneL2.state = 0
  487. end if
  488. End Sub
  489.  
  490. Sub Solflash18(Enabled)
  491. if enabled then
  492. f18.state = 1
  493. f18a.state = 1
  494. f18l.state = 1
  495. Else
  496. f18.state = 0
  497. f18a.state = 0
  498. f18l.state = 0
  499. end if
  500. End Sub
  501.  
  502. Sub Solflash19(Enabled)
  503. if enabled then
  504.  
  505. FlashLevel2 = 1 : FlasherFlash2_Timer 'Flupper's command to flash
  506. ' f17l.state = 1
  507. f17lint.state = 1
  508. F17flashsecA.amount = 70
  509. F17FlashsecA.intensityScale = 1
  510. F17flashsecB.amount = 70
  511. F17FlashsecB.intensityScale = 1
  512. F17flashsecC.amount = 70
  513. F17FlashsecC.intensityScale = 1
  514. F17flashsecD.amount = 70
  515. F17FlashsecD.intensityScale = 1
  516. Else
  517. FlashLevel2 = 0
  518. ' f17l.state = 0
  519. f17lint.state = 0
  520. F17flashsecA.amount = 0
  521. F17FlashsecA.intensityScale = 0
  522. F17flashsecB.amount = 0
  523. F17FlashsecB.intensityScale = 0
  524. F17flashsecC.amount = 0
  525. F17FlashsecC.intensityScale = 0
  526. F17flashsecD.amount = 0
  527. F17FlashsecD.intensityScale = 0
  528. end if
  529. End Sub
  530.  
  531. Sub SolF24(Enabled)
  532. if enabled then
  533. FlashLevel1 = 1 : FlasherFlash1_Timer 'Flupper's command to flash
  534. ' f19l.state = 1
  535. f19lint.state = 1
  536. F19flashsecA.amount = 70
  537. F19FlashsecA.intensityScale = 1
  538. F19flashsecB.amount = 70
  539. F19FlashsecB.intensityScale = 1
  540. F19flashsecC.amount = 70
  541. F19FlashsecC.intensityScale = 1
  542. Else
  543. FlashLevel1 = 0
  544. ' f19l.state = 0
  545. f19lint.state = 0
  546. F19flashsecA.amount = 0
  547. F19FlashsecA.intensityScale = 0
  548. F19flashsecB.amount = 0
  549. F19FlashsecB.intensityScale = 0
  550. F19flashsecC.amount = 0
  551. F19FlashsecC.intensityScale = 0
  552. end if
  553. End Sub
  554.  
  555. Sub SolF22(Enabled)
  556. if enabled then
  557. Flash22.state = 1
  558. Else
  559. Flash22.state = 0
  560. end if
  561. End Sub
  562.  
  563. Sub SolHouse(enabled)
  564. if enabled then
  565. F25L.state = 1
  566. F25L1.state = 1
  567. Else
  568. F25L.state = 0
  569. F25L1.state = 0
  570. end if
  571. End Sub
  572.  
  573. Sub SolFreddy(enabled)
  574. if enabled then
  575. Flash21.state = 1
  576. Flash21a.state = 1
  577. Flash21b.state = 1
  578. Else
  579. Flash21.state = 0
  580. Flash21a.state = 0
  581. Flash21b.state = 0
  582. end if
  583. End Sub
  584.  
  585.  
  586. Sub solGOR(enabled)
  587. If enabled then
  588. For each xx in GI:xx.state=1:next
  589. l10.state = 1
  590. l10In.state = 1
  591. l11.state = 1
  592. l11In.state = 1
  593. else
  594. For each xx in GI:xx.state=0:next
  595. l10.state = 0
  596. l10In.state = 0
  597. l11.state = 0
  598. l11In.state = 0
  599. end if
  600. End Sub
  601.  
  602.  
  603. 'Solenoid top up kicker
  604. Dim aBall,aZpos, KickSpeed
  605.  
  606. '****** VUK ********
  607. KickSpeed = 10
  608.  
  609. Sub solTUK(Enabled)
  610. If Enabled then
  611. PlaySound SoundFX("scoopexit",DOFContactors)
  612. UpKTimer.Interval = 2 'Set timer to 1ms
  613. UpKTimer.Enabled = True
  614. end if
  615. End Sub
  616.  
  617. Sub UpKTimer_Timer()
  618. aBall.Z=aZpos 'Move the ball Z position to the value of variable aZpos
  619. aZpos=aZpos+KickSpeed 'Add <Kickspeed> from ball to Z position and repeat the line above
  620. If aZpos>110 Then 'If the ball Z position is at 220 then,
  621. UpKTimer.Enabled=0 'disable the timer and use the normal kicker code
  622. bsVUKT.ExitSol_On
  623. End If
  624. End Sub
  625. '******* END VUK *********
  626.  
  627.  
  628. '************************* Solenoid Glove *********************
  629. Dim FGA:FGA=0
  630. Sub SolGloveFlipper(enabled)
  631. If enabled then
  632. FGA=1
  633. Else
  634. FGA=0
  635. End If
  636. End Sub
  637. '**************************************************************
  638.  
  639.  
  640. '************************* Solenoid Jaw ***********************
  641. 'Solenoid jaw
  642. Dim JawDir, Jpos, JActive:JawDir=1: Jpos=0: JActive=0
  643. Sub SolMouth(enabled)
  644. If enabled then
  645. jawMid.Enabled=1:JawDir=1:JActive=1
  646. else
  647. if JActive = 0 then
  648. jawMid.Enabled=0:Jpos=0
  649. JawP.z=90:JActive=0:Primitive6.z=20
  650. Else
  651. jawMid.Enabled=1
  652. end if
  653. end if
  654. End Sub
  655.  
  656. Sub jawMid_Timer()
  657. Select Case Jpos
  658. Case 0: JawP.z=80:Primitive6.z=24
  659. Case 1: JawP.z=71:Primitive6.z=20
  660. Case 2: JawP.z=66:Primitive6.z=16
  661. Case 3: JawP.z=57:Primitive6.z=14
  662. Case 4: JawP.z=52:Primitive6.z=18
  663. Case 5: JawP.z=47:Primitive6.z=24
  664. Case 6: JawP.z=42:Primitive6.z=20
  665. Case 7: JawP.z=39:Primitive6.z=16
  666. Case 8: JawP.z=37:Primitive6.z=14
  667. Case 9: JawP.z=36:Primitive6.z=18
  668.  
  669. End Select
  670. Jpos=Jpos+JawDir
  671. If Jpos=10 Then
  672. Jpos=9:JawDir=-1
  673. End If
  674. If Jpos=-1 Then
  675. Jpos=0:JawDir=1:Jactive = 0
  676. jawMid.Enabled=0
  677. End If
  678. End Sub
  679. '**************************************************************
  680.  
  681.  
  682. '******************** Claw Save *************************
  683.  
  684. Sub SolClawSave(enabled)
  685. if clawOn = 1 then
  686. FclawR.enabled = 1
  687. FclawL.enabled = 1
  688. FClaw.rotatetoend
  689. Lightclaw.state = 1
  690. PlaySound SoundFX("claw",DOFContactors)
  691. end if
  692. if clawOn = 0 then
  693. FclawR.enabled = 0
  694. FclawL.enabled = 0
  695. FClaw.rotatetostart
  696. Lightclaw.state = 0
  697. end if
  698. End Sub
  699.  
  700. '******************* End claw save **********************
  701.  
  702.  
  703. Sub solAutofire(Enabled)
  704. If Enabled Then
  705. PlungerIM.AutoFire
  706. End If
  707. End Sub
  708.  
  709.  
  710.  
  711. Sub SolKickBack(enabled)
  712. If enabled then
  713. kickback.Fire:PlaySound SoundFX("Solenoid",DOFcontactors)
  714. kickbackwall.TimerEnabled=1
  715. End If
  716. End Sub
  717.  
  718. Sub kickbackwall_Timer()
  719. 'kickbackwall.IsDropped=1 'I let it to prevent a no working kickback. Old vp
  720. kickback.PullBack
  721. kickbackwall.TimerEnabled=0
  722. End Sub
  723.  
  724. 'Diverters\
  725. Dim TDP, BDP,TDIR,BDIR:TDP=0:BDP=0:TDIR=1:BDIR=1
  726. 'Top Diverter
  727.  
  728.  
  729. '******************** Doors Diverters ***********************
  730.  
  731. Sub SolDivTop(enabled)
  732. If Enabled then
  733. TDClosed.IsDropped=1:TDOpen.IsDropped=0:TDIR=1
  734. TDClosed.TimerEnabled=1
  735. Else
  736. TDClosed.IsDropped=0:TDOpen.IsDropped=1:TDIR=-1
  737. TDClosed.TimerEnabled=1
  738. End If
  739. End Sub
  740.  
  741. Sub TDClosed_Timer()
  742. Select Case TDP
  743. Case 0: Door02.ObjRotz = 245:TDA0.IsDropped=0:TDA1.IsDropped=1:TDA2.IsDropped=1
  744. Case 1: Door02.ObjRotz = 262:TDA0.IsDropped=1:TDA1.IsDropped=0:TDA2.IsDropped=1
  745. Case 2: Door02.ObjRotz = 285:TDA0.IsDropped=1:TDA1.IsDropped=1:TDA2.IsDropped=0
  746. End Select
  747. TDP=TDP+TDIR
  748. If TDP=3 Then
  749. TDClosed.TimerEnabled=0:TDP=2
  750. End If
  751. If TDP=-1 Then
  752. TDClosed.TimerEnabled=0:TDP=0
  753. End If
  754. End Sub
  755.  
  756. 'Bottom Divertert
  757. Sub SolDivBot(enabled)
  758. If Enabled then
  759. RDOpen.IsDropped=0:RDClosed.IsDropped=1
  760. RDClosed.TimerEnabled=1:BDIR=1
  761. Else
  762. RDOpen.IsDropped=1:RDClosed.IsDropped=0
  763. RDClosed.TimerEnabled=1:BDIR=-1
  764. End If
  765. End Sub
  766.  
  767. Sub RDClosed_Timer()
  768. Select Case BDP
  769. Case 0: Door01.ObjRotz = 0:RD0.IsDropped=0:RD1.IsDropped=1:RD2.IsDropped=1
  770. Case 1: Door01.ObjRotz = -12:RD0.IsDropped=1:RD1.IsDropped=0:RD2.IsDropped=1
  771. Case 2: Door01.ObjRotz = -24:RD0.IsDropped=1:RD1.IsDropped=1:RD2.IsDropped=0
  772. End Select
  773. BDP=BDP+BDIR
  774. If BDP=3 Then
  775. RDClosed.TimerEnabled=0:BDP=2
  776. End If
  777. If BDP=-1 Then
  778. RDClosed.TimerEnabled=0:BDP=0
  779. End If
  780. End Sub
  781.  
  782. '******************** End Doors Diverters ***********************
  783.  
  784.  
  785.  
  786. '***********************************************************************
  787. '************************** Flipper Subs *************************
  788.  
  789. ' SolCallback(sLRFlipper) = "SolRFlipper"
  790. ' SolCallback(sLLFlipper) = "SolLFlipper"
  791.  
  792. ' Sub SolLFlipper(Enabled)
  793. ' If Enabled Then
  794. ' PlaySound "LFlip":LeftFlipper.RotateToEnd
  795. '
  796. ' Else
  797. ' PlaySound "LFlipD":LeftFlipper.RotateToStart
  798. '
  799. ' End If
  800. ' End Sub
  801. '
  802. ' Sub SolRFlipper(Enabled)
  803. ' If Enabled Then
  804. ' PlaySound "RFlip":RightFlipper.RotateToEnd:RightFlipper1.RotateToEnd
  805. '
  806. ' Else
  807. ' PlaySound "RFlipD":RightFlipper.RotateToStart:RightFlipper1.RotateToStart
  808. '
  809. ' End If
  810. ' End Sub
  811.  
  812. 'Drains and Kickers
  813. Dim BIT:BIT=0
  814. Sub Drain_Hit():PlaySound "Drain":ClearBallID:bsTrough.AddBall Me:End Sub
  815. Sub sw21_Hit():PlaySound "kicker_enter":Set aBall=ActiveBall:aZpos=90:bsVUKT.AddBall 0:End Sub
  816. Sub sw20_Hit():PlaySound "kicker_enter":bsVUKB.AddBall 0:End Sub
  817. Sub SubwayEnter_Hit():PlaySound "Drain":ClearBallID:SubwayEnter.Destroyball:BIT=BIT+1:Me.TimerEnabled=1:End Sub
  818. Sub SubwayEnter_Timer()
  819. vpmTimer.PulseSw 100
  820. subwayExit.CreateBall:subwayExit.Kick 135, 2
  821. BIT=BIT-1
  822. If BIT=0 then SubwayEnter.TimerEnabled=0
  823. End Sub
  824. Sub sw80_Hit():ClearBallID:sw80.destroyball:bsFreddyHead.AddBall me:sw80a.Kick 130, 10:End Sub
  825. Sub sw80a_Unhit():PlaySound "DROP_RIGHT":End Sub
  826.  
  827.  
  828.  
  829. '*********************************************************************
  830. '************************* Slingshots **************************
  831.  
  832. Dim RStep, Lstep
  833.  
  834. Sub RightSlingShot_Slingshot
  835. PlaySound SoundFX("Rsling",DOFContactors), 0, 1, 0.05, 0.05
  836. RSling.Visible = 0
  837. RSling1.Visible = 1
  838. sling1.TransZ = -20
  839. vpmTimer.PulseSw 13:RStep = 0:RightSlingShot.TimerEnabled = 1
  840. End Sub
  841.  
  842. Sub RightSlingShot_Timer
  843. Select Case RStep
  844. Case 2:RSLing1.Visible = 0:RSLing2.Visible = 0:RSLing3.Visible = 1:sling1.TransZ = -10
  845. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:RSLing3.Visible = 0:sling1.TransZ = -10
  846. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  847. End Select
  848. RStep = RStep + 1
  849.  
  850. if RSLing1.Visible = 0 then
  851. RSLing1.Visible = 0
  852. end if
  853. End Sub
  854.  
  855. Sub LeftSlingShot_Slingshot
  856. PlaySound SoundFX("Lsling",DOFContactors),0,1,-0.05,0.05
  857. LSling.Visible = 0
  858. LSling1.Visible = 1
  859. sling2.TransZ = -20
  860. vpmTimer.PulseSw 12:LStep = 0:LeftSlingShot.TimerEnabled = 1
  861. End Sub
  862.  
  863. Sub LeftSlingShot_Timer
  864. Select Case LStep
  865. Case 2:LSLing1.Visible = 0:LSLing2.Visible = 0:LSLing3.Visible = 1:sling2.TransZ = -10
  866. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:LSLing3.Visible = 0:sling2.TransZ = -10
  867. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  868. End Select
  869. LStep = LStep + 1
  870.  
  871. if LSLing1.Visible = 0 then
  872. RSLing1.Visible = 0
  873. End If
  874. End Sub
  875. '*********************************************************************
  876.  
  877.  
  878.  
  879. ' Captive Ball
  880. Sub captTrig_Hit:cb.TrigHit ActiveBall:End Sub
  881. Sub captTrig_UnHit:cb.TrigHit 0:End Sub
  882. Sub captwall_Hit:PlaySound "collide4":cb.BallHit ActiveBall:End Sub
  883. Sub Capt_Hit:cb.BallReturn Me:End Sub
  884.  
  885.  
  886.  
  887.  
  888. '**********************************************************
  889. '************************ Bumpers *************************
  890. '**********************************************************
  891. Dim hatdir, ht
  892. ht = 0
  893.  
  894. Sub Bumper1_Hit
  895. vpmTimer.PulseSw 10
  896. bumpersounds()
  897. Me.TimerEnabled = 1
  898. hatdir = 1
  899. ht=0:hat.enabled = 1
  900. End Sub
  901.  
  902. Sub Bumper1_Timer
  903. Me.Timerenabled = 0
  904. End Sub
  905.  
  906. Sub Bumper2_Hit
  907. vpmTimer.PulseSw 11
  908. bumpersounds()
  909. Me.TimerEnabled = 1
  910. hatdir=-1
  911. ht=6:hat.enabled = 1
  912. End Sub
  913.  
  914. Sub Bumper2_Timer
  915. Me.Timerenabled = 0
  916. End Sub
  917.  
  918. sub hat_timer()
  919. select case ht
  920. Case 0 : Primitive4.objrotx = -2:Primitive4.objroty = 2:Primitive6.z=23
  921. Case 1 : Primitive4.objrotx = 0:Primitive4.objroty = 0:Primitive6.z=25
  922. Case 2 : Primitive4.objrotx = 1:Primitive4.objroty = -1:Primitive6.z=26
  923. Case 3 : Primitive4.objrotx = 2:Primitive4.objroty = -2:Primitive6.z=27
  924. Case 4 : Primitive4.objrotx = 0:Primitive4.objroty = 0:Primitive6.z=24
  925. Case 5 : Primitive4.objrotx = -2:Primitive4.objroty = 2:Primitive6.z=22
  926. Case 6 : Primitive4.objrotx = -1:Primitive4.objroty = 1:Primitive6.z=20
  927. end Select
  928. ht=ht + hatdir
  929. if ht = -1 then hat.enabled = 0:ht=6:hatdir=-1:Primitive4.objrotx = -3:Primitive4.objroty = 3:Primitive6.z=20
  930. if ht = 7 then hat.enabled = 0:ht=0:hatdir=1:Primitive4.objrotx = -3:Primitive4.objroty = 3:Primitive6.z=20
  931. End Sub
  932.  
  933. sub BumperSounds()
  934. Select Case Int(Rnd*3)
  935. Case 0 : PlaySound SoundFX("bumper1",DOFContactors)
  936. Case 1 : PlaySound SoundFX("bumper2",DOFContactors)
  937. Case 2 : PlaySound SoundFX("bumper2",DOFContactors)
  938. End Select
  939. End Sub
  940.  
  941.  
  942. 'Rollover & Ramp Switches
  943. Sub sw92_Hit:Controller.Switch(92) = 1:PlaySound "rollover":End Sub
  944. Sub sw92_UnHit:Controller.Switch(92) = 0:End Sub
  945.  
  946. Sub sw93_Hit:Controller.Switch(93) = 1:PlaySound "rollover":End Sub
  947. Sub sw93_UnHit:Controller.Switch(93) = 0:End Sub
  948.  
  949. Sub sw102_Hit:Controller.Switch(102) = 1:PlaySound "rollover":End Sub
  950. Sub sw102_UnHit:Controller.Switch(102) = 0:End Sub
  951.  
  952. Sub sw103_Hit:Controller.Switch(103) = 1:PlaySound "rollover":End Sub
  953. Sub sw103_UnHit:Controller.Switch(103) = 0:End Sub
  954.  
  955. Sub sw90_Hit:Controller.Switch(90) = 1:End Sub
  956. Sub sw90_UnHit:Controller.Switch(90) = 0:End Sub
  957.  
  958. Sub sw25_Hit:Controller.Switch(25) = 1:BallinPlunger = 1:PRefresh.state =1:End Sub
  959. Sub sw25_UnHit:Controller.Switch(25) = 0:BallinPlunger = 0:PRefresh.state =0:End Sub
  960.  
  961.  
  962. ' **************************************************************************
  963. ' ****************** Kicking Targets ***************************************
  964.  
  965. Dim KT1Step, KT2step, KT3step
  966.  
  967. Sub SW16_Slingshot
  968. PlaySound SoundFX("Rsling",DOFContactors),0,1,-0.2,0
  969. sw16p.ObjRotY=4
  970. sw16p.TransX = -4
  971. vpmTimer.PulseSw 16
  972. KT1Step = 0
  973. SW16.TimerEnabled = 1
  974. End Sub
  975.  
  976. Sub SW16_Timer
  977. Select Case KT1Step
  978. Case 0:sw16p.TransX = 8:sw16p.ObjRotY=-4
  979. Case 1:sw16p.TransX = 4:sw16p.ObjRotY=-2
  980. Case 2:sw16p.TransX = 0:sw16p.ObjRotY=0:SW16.TimerEnabled = 0
  981. End Select
  982. KT1Step = KT1Step + 1
  983. End Sub
  984.  
  985. Sub SW15_Slingshot
  986. PlaySound SoundFX("Rsling",DOFContactors),0,1,-0.2,0
  987. sw15p.ObjRotY=4
  988. sw15p.TransX = -4
  989. vpmTimer.PulseSw 15
  990. KT2Step = 0
  991. SW15.TimerEnabled = 1
  992. End Sub
  993.  
  994. Sub SW15_Timer
  995. Select Case KT2Step
  996. Case 0:sw15p.TransX = 8:sw15p.ObjRotY=-4
  997. Case 1:sw15p.TransX = 4:sw15p.ObjRotY=-2
  998. Case 2:sw15p.TransX = 0:sw15p.ObjRotY=0:SW15.TimerEnabled = 0
  999. End Select
  1000. KT2Step = KT2Step + 1
  1001. End Sub
  1002.  
  1003. Sub SW14_Slingshot
  1004. PlaySound SoundFX("Lsling",DOFContactors),0,1,-0.2,0
  1005. sw14p.ObjRotY=4
  1006. sw14p.TransX = -4
  1007. vpmTimer.PulseSw 14
  1008. KT3Step = 0
  1009. SW14.TimerEnabled = 1
  1010. End Sub
  1011.  
  1012. Sub SW14_Timer
  1013. Select Case KT3Step
  1014. Case 0:sw14p.TransX = 8:sw14p.ObjRotY=-4
  1015. Case 1:sw14p.TransX = 4:sw14p.ObjRotY=-2
  1016. Case 2:sw14p.TransX = 0:sw14p.ObjRotY=0:SW14.TimerEnabled = 0
  1017. End Select
  1018. KT3Step = KT3Step + 1
  1019. End Sub
  1020.  
  1021. ' **************************************************************************
  1022. ' ****************** Freddy's Head *****************************************
  1023. Sub sw26_Hit:vpmTimer.PulseSw 26:PlaySound SoundFX("target",DOFTargets):End Sub
  1024.  
  1025.  
  1026. ' **************************************************************************
  1027. ' ****************** Freddy's Targets **************************************
  1028. Sub sw96_Hit:vpmTimer.PulseSw 96:PlaySound SoundFX("target",DOFTargets):eyetarget.enabled = 1:End Sub
  1029. Sub sw106_Hit:vpmTimer.PulseSw 106:PlaySound SoundFX("target",DOFTargets):eyetarget.enabled = 1:End Sub
  1030. Sub sw97_Hit:vpmTimer.PulseSw 97:PlaySound SoundFX("target",DOFTargets):eyetarget.enabled = 1:End Sub
  1031. Sub sw107_Hit:vpmTimer.PulseSw 107:PlaySound SoundFX("target",DOFTargets):eyetarget.enabled = 1:End Sub
  1032.  
  1033. Dim eyet
  1034. eyet=0
  1035. sub eyetarget_timer()
  1036. select case eyet
  1037. case 0 :Primitive6.z=17
  1038. case 1 :Primitive6.z=15
  1039. case 2 :Primitive6.z=18
  1040. case 3 :Primitive6.z=20
  1041. end Select
  1042. eyet=eyet + 1
  1043. if eyet = 4 then eyet=0:eyetarget.enabled = 0
  1044. end Sub
  1045.  
  1046.  
  1047. Sub boilerdoor_Hit(idx):vpmTimer.PulseSw 110:PlaySound SoundFX("target",DOFShaker):End Sub
  1048.  
  1049.  
  1050. ' **************************************************************************
  1051. ' ****************** Standup Targets ***************************************
  1052. Sub SW94_hit():sw94p.transx = -10:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):vpmTimer.PulseSw 94:End Sub
  1053. Sub SW94_Timer():sw94p.transx = 0:Me.TimerEnabled = 0:End Sub
  1054.  
  1055. Sub SW95_hit():sw95p.transx = -10:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):vpmTimer.PulseSw 95:End Sub
  1056. Sub SW95_Timer():sw95p.transx = 0:Me.TimerEnabled = 0:End Sub
  1057.  
  1058. Sub SW104_hit():sw104p.transx = -10:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):vpmTimer.PulseSw 104:End Sub
  1059. Sub SW104_Timer():sw104p.transx = 0:Me.TimerEnabled = 0:End Sub
  1060.  
  1061. Sub SW105_hit():sw105p.transx = -10:Me.TimerEnabled = 1:PlaySound SoundFX("target",DOFTargets):vpmTimer.PulseSw 105:End Sub
  1062. Sub SW105_Timer():sw105p.transx = 0:Me.TimerEnabled = 0:End Sub
  1063.  
  1064.  
  1065. ' **************************************************************************
  1066. ' ****************** Drop Targets ******************************************
  1067.  
  1068. dim sw17dir, sw27Dir, sw37Dir
  1069. dim sw17Pos, sw27Pos, sw37Pos
  1070.  
  1071. sw17Dir = 1:sw27Dir = 1:sw37Dir = 1
  1072. sw17Pos = 0:sw27Pos = 0:sw37Pos = 0
  1073.  
  1074. 'Targets Init
  1075. sw17a.TimerEnabled = 1:sw27a.TimerEnabled = 1:sw37a.TimerEnabled = 1
  1076.  
  1077.  
  1078. Sub sw17_Hit:DTBank.Hit 1:sw17Dir = 0:sw17a.TimerEnabled = 1:sw1727.isdropped = 1:End Sub
  1079. Sub sw27_Hit:DTBank.Hit 2:sw27Dir = 0:sw27a.TimerEnabled = 1:sw1727.isdropped = 1:sw2737.isdropped = 1:End Sub
  1080. Sub sw37_Hit:DTBank.Hit 3:sw37Dir = 0:sw37a.TimerEnabled = 1:sw2737.isdropped = 1:End Sub
  1081. Sub sw1727_Hit
  1082. sw1727.isdropped = 1:sw2737.isdropped = 1
  1083. DTBank.Hit 1:sw17Dir = 0:sw17a.TimerEnabled = 1
  1084. DTBank.Hit 2:sw27Dir = 0:sw27a.TimerEnabled = 1
  1085. End Sub
  1086.  
  1087. Sub sw2737_Hit
  1088. :sw1727.isdropped = 1:sw2737.isdropped = 1
  1089. DTBank.Hit 2:sw27Dir = 0:sw27a.TimerEnabled = 1
  1090. DTBank.Hit 3:sw37Dir = 0:sw37a.TimerEnabled = 1
  1091. End Sub
  1092.  
  1093.  
  1094. Sub sw17a_Timer()
  1095.  
  1096. Select Case sw17Pos
  1097. Case 0: sw17P.z=24
  1098. If sw17Dir = 1 then
  1099. sw17a.TimerEnabled = 0
  1100. else
  1101. sw17Dir = 0
  1102. sw17a.TimerEnabled = 1
  1103. end if
  1104. Case 1: sw17P.z=26
  1105. Case 2: sw17P.z=29
  1106. Case 3: sw17P.z=26
  1107. Case 4: sw17P.z=22
  1108. Case 5: sw17P.z=18
  1109. Case 6: sw17P.z=14
  1110. Case 7: sw17P.z=10
  1111. Case 8: sw17P.z=6
  1112. Case 9: sw17P.z=2
  1113. Case 10: sw17P.z=-4
  1114. Case 11: sw17P.z=-10
  1115. Case 12: sw17P.z=-16
  1116. Case 13: sw17P.z=-19:sw17P.ReflectionEnabled = true
  1117. Case 14: sw17P.z=-22:sw17P.ReflectionEnabled = false
  1118. If sw17Dir = 1 then
  1119. else
  1120. sw17a.TimerEnabled = 0
  1121. end if
  1122. End Select
  1123. If sw17Dir = 1 then
  1124. If sw17pos>0 then sw17pos=sw17pos-1
  1125. else
  1126. If sw17pos<14 then sw17pos=sw17pos+1
  1127. end if
  1128. End Sub
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134. Sub sw27a_Timer()
  1135. Select Case sw27Pos
  1136. Case 0: sw27P.z=24
  1137. If sw27Dir = 1 then
  1138. sw27a.TimerEnabled = 0
  1139. else
  1140. sw27Dir = 0
  1141. sw27a.TimerEnabled = 1
  1142. end if
  1143. Case 1: sw27P.z=26
  1144. Case 2: sw27P.z=29
  1145. Case 3: sw27P.z=26
  1146. Case 4: sw27P.z=22
  1147. Case 5: sw27P.z=18
  1148. Case 6: sw27P.z=14
  1149. Case 7: sw27P.z=10
  1150. Case 8: sw27P.z=6
  1151. Case 9: sw27P.z=2
  1152. Case 10: sw27P.z=-4
  1153. Case 11: sw27P.z=-10
  1154. Case 12: sw27P.z=-16
  1155. Case 13: sw27P.z=-19:sw27P.ReflectionEnabled = true
  1156. Case 14: sw27P.z=-22:sw27P.ReflectionEnabled = false
  1157. If sw27Dir = 1 then
  1158. else
  1159. sw27a.TimerEnabled = 0
  1160. end if
  1161. End Select
  1162. If sw27Dir = 1 then
  1163. If sw27pos>0 then sw27pos=sw27pos-1
  1164. else
  1165. If sw27pos<14 then sw27pos=sw27pos+1
  1166. end if
  1167. End Sub
  1168.  
  1169.  
  1170. Sub sw37a_Timer()
  1171. Select Case sw37Pos
  1172. Case 0: sw37P.z=24
  1173. If sw37Dir = 1 then
  1174. sw37a.TimerEnabled = 0
  1175. else
  1176. sw37Dir = 0
  1177. sw37a.TimerEnabled = 1
  1178. end if
  1179. Case 1: sw37P.z=26
  1180. Case 2: sw37P.z=29
  1181. Case 3: sw37P.z=26
  1182. Case 4: sw37P.z=22
  1183. Case 5: sw37P.z=18
  1184. Case 6: sw37P.z=14
  1185. Case 7: sw37P.z=10
  1186. Case 8: sw37P.z=6
  1187. Case 9: sw37P.z=2
  1188. Case 10: sw37P.z=-4
  1189. Case 11: sw37P.z=-10
  1190. Case 12: sw37P.z=-16
  1191. Case 13: sw37P.z=-19:sw37P.ReflectionEnabled = true
  1192. Case 14: sw37P.z=-22:sw37P.ReflectionEnabled = false
  1193. If sw37Dir = 1 then
  1194. else
  1195. sw37a.TimerEnabled = 0
  1196. end if
  1197. End Select
  1198. If sw37Dir = 1 then
  1199. If sw37pos>0 then sw37pos=sw37pos-1
  1200. else
  1201. If sw37pos<14 then sw37pos=sw37pos+1
  1202. end if
  1203. End Sub
  1204.  
  1205.  
  1206.  
  1207. '******* DT Subs jpj - Add timer before the drop targets will respawn *******
  1208.  
  1209. Sub ResetDrops(Enabled)
  1210. If Enabled Then
  1211. resetD.interval = 250
  1212. resetD.enabled = 1
  1213. End if
  1214. End Sub
  1215.  
  1216. sub resetD_timer
  1217. sw17Dir = 1:sw27Dir = 1:sw37Dir = 1
  1218. sw17a.TimerEnabled = 1:sw27a.TimerEnabled = 1:sw37a.TimerEnabled = 1
  1219. sw1727.isdropped = 0:sw2737.isdropped = 0
  1220. DTBank.DropSol_On
  1221. resetD.enabled=0
  1222. end Sub
  1223.  
  1224. ' **************************************************************************
  1225.  
  1226.  
  1227.  
  1228. '*************************
  1229. ' Plunger
  1230. '*************************
  1231. dim plb, plt 'plunger bottom plunger top
  1232.  
  1233.  
  1234. Sub swPlunger_Hit:BallinPlunger = 1:End Sub 'in this sub you may add a switch, for example Controller.Switch(14) = 1
  1235.  
  1236. Sub swPlunger_UnHit:BallinPlunger = 0:playsound "launchball01":plb=1:End Sub
  1237. 'in this sub you may add a switch, for example Controller.Switch(14) = 0
  1238.  
  1239.  
  1240.  
  1241.  
  1242. '======================
  1243. 'Options Menu Variables
  1244. '======================
  1245.  
  1246. ' Const cRegistryName = "FreddyUW"
  1247. ' Const cOptNoFade = &H08
  1248. ' Const cOptNoStartM = &H10
  1249. '
  1250. '
  1251. ' Dim FreddyOptions
  1252. '
  1253. ' Private Sub FreddyShowDips
  1254. ' If Not IsObject(vpmDips) Then ' First time
  1255. ' Set vpmDips = New cvpmDips
  1256. ' With vpmDips
  1257. ' .AddForm 100, 100, "Freddy Game Settings"
  1258. ' .AddFrameExtra 0,55,145,"Disable",0,_
  1259. ' Array("Menu At Start", cOptNoStartM,"Alpha Flashers", cOptNoFade)
  1260. ' End With
  1261. ' End If
  1262. ' FreddyOptions = vpmDips.ViewDipsExtra(FreddyOptions)
  1263. ' FreddySetOptions : SaveValue cRegistryName, "Options", FreddyOptions
  1264. ' End Sub
  1265. ' Set vpmShowDips = GetRef("FreddyShowDips")
  1266.  
  1267. '=========================
  1268. ' Handle Freddy Options
  1269. '=========================
  1270. ' Dim AlphaF : AlphaF = True
  1271. '
  1272. '
  1273. ' Sub FreddySetOptions
  1274. ' If freddyOptions And cOptNoFade Then
  1275. ' AlphaF = False
  1276. ' Else
  1277. ' AlphaF = True
  1278. ' End If
  1279. ' End Sub
  1280.  
  1281.  
  1282.  
  1283. '****************************************
  1284. ' JP's Fading Lamps 3.5 VP9 Fading only
  1285. ' Based on PD's Fading Lights
  1286. ' SetLamp 0 is Off
  1287. ' SetLamp 1 is On
  1288. ' LampState(x) current state
  1289. '****************************************
  1290. Dim x
  1291.  
  1292. Dim FadingState(130), LampState(130)
  1293.  
  1294.  
  1295. AllLampsOff()
  1296. LampTimer.Interval = 30
  1297. LampTimer.Enabled = 1
  1298.  
  1299. Sub LampTimer_Timer()
  1300. Dim chgLamp, num, chg, ii
  1301. chgLamp = Controller.ChangedLamps
  1302. If Not IsEmpty(chgLamp) Then
  1303. For ii = 0 To UBound(chgLamp)
  1304. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  1305. FadingState(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
  1306. Next
  1307. End If
  1308.  
  1309. UpdateLamps
  1310. End Sub
  1311.  
  1312. Sub UpdateLamps
  1313. FadeL 0, l0, l0a
  1314. 'FadeL 1, l, la 'credit button
  1315. 'FadeL 2, 2, 2a 'not used
  1316. FadeLm 3, Amp1
  1317. FadeAR 3, Ampoule01, "AmpRougeOff", "AmpRougeOnb", "AmpRougeOna", "AmpRougeOn"
  1318. FadeLm 4, Amp2
  1319. FadeAR 4, Ampoule02, "AmpVertOff", "AmpVertOnb", "AmpVertOna", "AmpVertOn"
  1320. FadeLm 5, Amp3
  1321. FadeAR 5, Ampoule03, "AmpVertOff", "AmpVertOnb", "AmpVertOna", "AmpVertOn"
  1322. FadeLm 6, Amp4
  1323. FadeAR 6, Ampoule04, "AmpVertOff", "AmpVertOnb", "AmpVertOna", "AmpVertOn"
  1324. FadeLm 7, Amp5
  1325. FadeAR 7, Ampoule05, "AmpVertOff", "AmpVertOnb", "AmpVertOna", "AmpVertOn"
  1326. FadeL 10, l10, l10In
  1327. FadeL 11, l11, l11In
  1328. if sw17dir = 0 and l11.state = 1 then
  1329. l11dt1.State =1
  1330. Else
  1331. l11dt1.State =0
  1332. end if
  1333. if sw27dir = 0 and l11.state = 1 then
  1334. l11dt2.State =1
  1335. Else
  1336. l11dt2.State =0
  1337. end if
  1338. if sw37dir = 0 and l11.state = 1 then
  1339. l11dt3.State =1
  1340. Else
  1341. l11dt3.State =0
  1342. end if
  1343.  
  1344. 'FadeL 12, l12a
  1345. FadeL 13, l13, l13a
  1346. FadeL 14, l14, l14a
  1347. FadeL 15, l15, l15a
  1348. FadeL 16, l16, l16a
  1349. FadeL 17, l17, l17a
  1350.  
  1351. 'FadeL 21, l21, l21a
  1352. 'FadeL 22, l22, l22a
  1353. FadeL 23, l23, l23a
  1354. FadeL 24, l24, l24a
  1355. FadeL 25, l25, l25a
  1356. FadeL 26, l26, l26a
  1357. FadeL 27, l27, l27a
  1358.  
  1359. FadeL 30, l30, l30a
  1360. FadeL 31, l31, l31a
  1361. FadeL 32, l32, l32a
  1362. FadeL 33, l33, l33a
  1363. FadeL 34, l34, l34a
  1364. FadeL 35, l35, l35a
  1365. FadeL 36, l36, l36a
  1366. FadeL 37, l37, l37a
  1367.  
  1368. FadeL 40, l40, l40a
  1369. FadeL 41, l41, l41a
  1370. FadeL 42, l42, l42a
  1371. FadeL 43, l43, l43a
  1372. 'FadeL 44, l44, l44a 'not used
  1373. FadeL 45, l45, l45a
  1374. FadeL 46, l46, l46a
  1375. FadeL 47, l47, l47a
  1376.  
  1377. FadeL 50, l50, l50a
  1378. FadeL 51, l51, l51a
  1379. FadeL 52, l52, l52a
  1380. FadeL 53, l53, l53a
  1381. FadeL 54, l54, l54a
  1382. FadeL 55, l55, l55a
  1383. FadeL 56, l56, l56a
  1384. FadeL 57, l57, l57a
  1385.  
  1386. FadeL 60, l60, l60a
  1387. FadeL 61, l61, l61a
  1388. FadeL 62, l62, l62a
  1389. FadeL 63, l63, l63a
  1390. 'FadeL 64, l64, l64a 'not used
  1391. FadeL 65, l65, l65a'
  1392. FadeL 66, l66, l66a
  1393. FadeL 67, l67, l67a
  1394.  
  1395. FadeL 70, l70, l70a
  1396. FadeL 71, l71, l71a
  1397. FadeL 72, l72, l72a
  1398. FadeL 73, l73, l73a
  1399. FadeL 74, l74, l74a
  1400. FadeL 75, l75, l75a'
  1401. FadeL 76, l76, l76a
  1402. FadeL 77, l77, l77a
  1403.  
  1404. FadeL 85, l85, l85a'
  1405. FadeL 86, l86, l86a
  1406. FadeL 87, l87, l87a
  1407.  
  1408. FadeLL 91, l91, l91a, l91p
  1409. FadeLL 92, l92, l92a, l92p
  1410. FadeLL 93, l93, l93a, l93p
  1411. FadeLL 94, l94, l94a, l94p
  1412. FadeLL 95, l95, l95a, l95p
  1413. FadeLL 96, l96, l96a, l96p
  1414. FadeLm 97, l97p2
  1415. FadeLm 97, l97p3
  1416. FadeLm 97, l97p4
  1417. FadeLm 97, l97p5
  1418. FadeLm 97, l97p6
  1419. FadeLL 97, l97, l97a, l97p1
  1420.  
  1421.  
  1422. NfadeL 103, l103
  1423. NfadeL 104, l104
  1424. NfadeL 105, l105
  1425. NfadeL 106, l106
  1426. NfadeL 107, l107
  1427.  
  1428. NfadeL 113, l113
  1429. NfadeL 114, l114
  1430. NfadeL 115, l115
  1431. NfadeL 116, l116
  1432. NfadeL 117, l117
  1433.  
  1434. FadeL 119, f18,f18a
  1435.  
  1436. NfadeL 122, flash22
  1437. FadeL 123, flash21, flash21a
  1438.  
  1439. 'NfadeL 126, l126 'test
  1440. ' FadeWCol 126, Cabin, Cabina, Cabinb
  1441.  
  1442. End Sub
  1443.  
  1444. Sub RainbowTimer_Timer 'rainbow led light color changing
  1445.  
  1446. RGBFactor =20
  1447. Select Case RGBStep
  1448. Case 0 'Green
  1449. rGreen = rGreen + RGBFactor
  1450. If rGreen > 255 then
  1451. rGreen = 255
  1452. RGBStep = 1
  1453. End If
  1454. Case 1 'Red
  1455. rRed = rRed - RGBFactor
  1456. If rRed < 0 then
  1457. rRed = 0
  1458. RGBStep = 2
  1459. End If
  1460. Case 2 'Blue
  1461. rBlue = rBlue + RGBFactor
  1462. If rBlue > 255 then
  1463. rBlue = 255
  1464. RGBStep = 3
  1465. End If
  1466. Case 3 'Green
  1467. rGreen = rGreen - RGBFactor
  1468. If rGreen < 0 then
  1469. rGreen = 0
  1470. RGBStep = 4
  1471. End If
  1472. Case 4 'Red
  1473. rRed = rRed + RGBFactor
  1474. If rRed > 255 then
  1475. rRed = 255
  1476. RGBStep = 5
  1477. End If
  1478. Case 5 'Blue
  1479. rBlue = rBlue - RGBFactor
  1480. If rBlue < 0 then
  1481. rBlue = 0
  1482. RGBStep = 0
  1483. End If
  1484. End Select
  1485. ' For each obj in RainbowLights
  1486. ' obj.color = RGB(rRed \ 10, rGreen \ 10, rBlue \ 10)
  1487. ' obj.colorfull = RGB(rRed, rGreen, rBlue)
  1488. ' Next
  1489. test.color = RGB(rRed \ 10, rGreen \ 10, rBlue \ 10)
  1490. test.colorfull = RGB(rRed, rGreen, rBlue)
  1491. test1.color = RGB(rRed \ 10, rGreen \ 10, rBlue \ 10)
  1492. test1.colorfull = RGB(rRed, rGreen, rBlue)
  1493. test2.color = RGB(rRed \ 10, rGreen \ 10, rBlue \ 10)
  1494. test2.colorfull = RGB(rRed, rGreen, rBlue)
  1495.  
  1496. End Sub
  1497.  
  1498. Sub AllLampsOff()
  1499. Dim x
  1500. For x = 0 to 130
  1501. LampState(x) = 0
  1502. FadingState(x) = 4
  1503. Next
  1504. UpdateLamps:'UpdateLamps:Updatelamps
  1505. End Sub
  1506.  
  1507.  
  1508.  
  1509. Sub FadeAR(nr, ramp, a, b, c, d)
  1510. Select Case FadingState(nr)
  1511. Case 2:ramp.image = a:FadingState(nr) = 0 'Off
  1512. Case 3:ramp.image = c:FadingState(nr) = 2 'fading...
  1513. Case 4:ramp.image = b:FadingState(nr) = 3 'fading...
  1514. Case 5:ramp.image = d:FadingState(nr) = 1 'ON
  1515. End Select
  1516. End Sub
  1517.  
  1518. Sub FadeL(nr, a,b)
  1519. Select Case FadingState(nr)
  1520. Case 4:a.state = 0:b.state = 0:FadingState(nr) = 0
  1521. Case 5:a.state = 1:b.state = 1:FadingState(nr) = 1
  1522. End Select
  1523. End Sub
  1524.  
  1525. Sub FadeLL(nr, a,b,c)
  1526. Select Case FadingState(nr)
  1527. Case 4:a.state = 0:b.state = 0:c.state = 0:FadingState(nr) = 0
  1528. Case 5:a.state = 1:b.state = 1:c.state = 1:FadingState(nr) = 1
  1529. End Select
  1530. End Sub
  1531.  
  1532. Sub FadeLm(nr, a)
  1533. Select Case FadingState(nr)
  1534. Case 4:a.state = 0
  1535. Case 5:a.state = 1
  1536. End Select
  1537. End Sub
  1538.  
  1539. Sub NFadeL(nr, a)
  1540. Select Case FadingState(nr)
  1541. Case 4:a.state = 0:FadingState(nr) = 0
  1542. Case 5:a.State = 1:FadingState(nr) = 1
  1543. End Select
  1544. End Sub
  1545.  
  1546.  
  1547. '*** Red flasher - Flupper's Method ***
  1548. Sub FlasherFlash2_Timer()
  1549. dim flashx3, matdim
  1550. If not Flasherflash2.TimerEnabled Then
  1551. Flasherflash2.TimerEnabled = True
  1552. Flasherflash2.visible = 1
  1553. Flasherlit2.visible = 1
  1554. End If
  1555. flashx3 = FlashLevel2 * FlashLevel2 * FlashLevel2
  1556. Flasherflash2.opacity = 1500 * flashx3
  1557. Flasherlit2.BlendDisableLighting = 10 * flashx3
  1558. Flasherbase2.BlendDisableLighting = flashx3
  1559. F17L.IntensityScale = flashx3
  1560. matdim = Round(10 * FlashLevel2)
  1561. Flasherlit2.material = "domelit" & matdim
  1562. FlashLevel2 = FlashLevel2 * 0.9 - 0.01
  1563. If FlashLevel2 < 0.15 Then
  1564. Flasherlit2.visible = 0
  1565. Else
  1566. Flasherlit2.visible = 1
  1567. end If
  1568. If FlashLevel2 < 0 Then
  1569. Flasherflash2.TimerEnabled = False
  1570. Flasherflash2.visible = 0
  1571. End If
  1572. End Sub
  1573.  
  1574. Sub FlasherFlash1_Timer()
  1575. dim flashx3, matdim
  1576. If not Flasherflash1.TimerEnabled Then
  1577. Flasherflash1.TimerEnabled = True
  1578. Flasherflash1.visible = 1
  1579. Flasherlit1.visible = 1
  1580. End If
  1581. flashx3 = FlashLevel1 * FlashLevel1 * FlashLevel1
  1582. Flasherflash1.opacity = 1500 * flashx3
  1583. Flasherlit1.BlendDisableLighting = 10 * flashx3
  1584. Flasherbase1.BlendDisableLighting = flashx3
  1585. F19L.IntensityScale = flashx3
  1586. matdim = Round(10 * FlashLevel2)
  1587. Flasherlit1.material = "domelit" & matdim
  1588. FlashLevel1 = FlashLevel1 * 0.9 - 0.01
  1589. If FlashLevel1 < 0.15 Then
  1590. Flasherlit1.visible = 0
  1591. Else
  1592. Flasherlit1.visible = 1
  1593. end If
  1594. If FlashLevel1 < 0 Then
  1595. Flasherflash1.TimerEnabled = False
  1596. Flasherflash1.visible = 0
  1597. End If
  1598. End Sub
  1599. '***************************************
  1600.  
  1601.  
  1602. ' *********************************************************************
  1603. ' Supporting Ball & Sound Functions
  1604. ' *********************************************************************
  1605.  
  1606. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1607. Vol = Csng(BallVel(ball) ^2 / 2)
  1608. End Function
  1609.  
  1610. Function Vol2(ball1, ball2) ' Calculates the Volume of the sound based on the speed of two balls
  1611. Vol2 = (Vol(ball1) + Vol(ball2) ) / 2
  1612. End Function
  1613.  
  1614. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1615. Dim tmp
  1616. tmp = ball.x * 2 / table1.width-1
  1617. If tmp> 0 Then
  1618. Pan = Csng(tmp ^10)
  1619. Else
  1620. Pan = Csng(-((- tmp) ^10) )
  1621. End If
  1622. End Function
  1623.  
  1624. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1625. Pitch = BallVel(ball) * 20
  1626. End Function
  1627.  
  1628. Function BallVel(ball) 'Calculates the ball speed
  1629. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ))
  1630. End Function
  1631.  
  1632. '*****************************************
  1633. ' JP's VP10 Collision & Rolling Sounds
  1634. '*****************************************
  1635.  
  1636. Const tnob = 5 ' total number of balls
  1637. ReDim rolling(tnob)
  1638. ReDim collision(tnob)
  1639. Initcollision
  1640.  
  1641. Sub Initcollision
  1642. Dim i
  1643. For i = 0 to tnob
  1644. collision(i) = -1
  1645. rolling(i) = False
  1646. Next
  1647. End Sub
  1648.  
  1649. Sub CollisionTimer_Timer()
  1650. Dim BOT, B, B1, B2, dx, dy, dz, distance, radii
  1651. BOT = GetBalls
  1652.  
  1653. ' rolling
  1654.  
  1655. For B = UBound(BOT) +1 to tnob
  1656. rolling(b) = False
  1657. StopSound("fx_ballrolling" & b)'
  1658. Next
  1659.  
  1660. If UBound(BOT) = -1 Then Exit Sub
  1661.  
  1662. For B = 0 to UBound(BOT)
  1663. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  1664. rolling(b) = True
  1665. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) )*200, Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1666. ' PlaySound("fx_ballrolling"), -1, Vol(BOT(b) )*15, Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1667.  
  1668. Else
  1669. If rolling(b) = True Then
  1670. StopSound("fx_ballrolling" & b)
  1671. rolling(b) = False
  1672. End If
  1673. End If
  1674. Next
  1675.  
  1676. 'collision
  1677.  
  1678. If UBound(BOT) < 1 Then Exit Sub
  1679.  
  1680. For B1 = 0 to UBound(BOT)
  1681. For B2 = B1 + 1 to UBound(BOT)
  1682. dz = INT(ABS((BOT(b1).z - BOT(b2).z) ) )
  1683. radii = BOT(b1).radius + BOT(b2).radius
  1684. If dz <= radii Then
  1685.  
  1686. dx = INT(ABS((BOT(b1).x - BOT(b2).x) ) )
  1687. dy = INT(ABS((BOT(b1).y - BOT(b2).y) ) )
  1688. distance = INT(SQR(dx ^2 + dy ^2) )
  1689.  
  1690. If distance <= radii AND (collision(b1) = -1 OR collision(b2) = -1) Then
  1691. collision(b1) = b2
  1692. collision(b2) = b1
  1693. PlaySound("collide"& b), 0, Vol2(BOT(b1), BOT(b2))*40, Pan(BOT(b1)), 0, Pitch(BOT(b1)), 0, 0
  1694. Else
  1695. If distance > (radii + 10) Then
  1696. If collision(b1) = b2 Then collision(b1) = -1
  1697. If collision(b2) = b1 Then collision(b2) = -1
  1698. End If
  1699. End If
  1700. End If
  1701. Next
  1702. Next
  1703. End Sub
  1704.  
  1705.  
  1706.  
  1707. '******************************
  1708. ' destruk's new vpmCreateBall
  1709. ' use it: vpmCreateBall kicker
  1710. ' Use it in vpm tables instead
  1711. ' of CreateBallID kickername
  1712. '******************************
  1713.  
  1714. Set vpmCreateBall = GetRef("mypersonalcreateballroutine")
  1715. Function mypersonalcreateballroutine(aKicker)
  1716. For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
  1717. If ballStatus(cnt) = 0 Then ' If ball ID is available...
  1718. If Not IsEmpty(vpmBallImage) Then
  1719. Set currentball(cnt) = aKicker.CreateBall.Image ' Set ball object with the first available ID
  1720. Else
  1721. Set currentball(cnt) = aKicker.CreateBall
  1722. End If
  1723. Set mypersonalcreateballroutine = aKicker
  1724. currentball(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
  1725. ballStatus(cnt) = 1 ' Mark this ball status active
  1726. ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
  1727. If coff = False Then ' If collision off, overrides auto-turn on collision detection
  1728. ' If more than one ball active, start collision detection process
  1729. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  1730. End If
  1731. Exit For ' New ball ID assigned, exit loop
  1732. End If
  1733. Next
  1734. End Function
  1735.  
  1736. '****************************************
  1737. ' B2B Collision by Steely & Pinball Ken
  1738. ' jpsalas: added destruk's changes
  1739. ' & ball height check
  1740. '****************************************
  1741.  
  1742. Dim tnopb, nosf
  1743. '
  1744. tnopb = 5
  1745. nosf = 7
  1746.  
  1747. Dim currentball(10), ballStatus(10)
  1748. Dim iball, cnt, coff, errMessage
  1749.  
  1750. XYdata.interval = 1
  1751. coff = False
  1752.  
  1753. For cnt = 0 to ubound(ballStatus)
  1754. ballStatus(cnt) = 0
  1755. Next
  1756.  
  1757. ' Create ball in kicker and assign a Ball ID used mostly in non-vpm tables
  1758. Sub CreateBallID(Kickername)
  1759. For cnt = 1 to ubound(ballStatus)
  1760. If ballStatus(cnt) = 0 Then
  1761. If Not IsEmpty(vpmBallImage) Then ' Set ball object with the first available ID
  1762. Set currentball(cnt) = Kickername.Createsizedball(15*brc)
  1763. Else
  1764. Set currentball(cnt) = Kickername.Createsizedball(15*brc)
  1765. end If
  1766. 'Set currentball(cnt) = Kickername.createball
  1767. currentball(cnt).uservalue = cnt
  1768. ballStatus(cnt) = 1
  1769. ballStatus(0) = ballStatus(0) + 1
  1770. If coff = False Then
  1771. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  1772. End If
  1773. End If
  1774. Exit For
  1775.  
  1776. Next
  1777. End Sub
  1778.  
  1779. Sub ClearBallID
  1780. On Error Resume Next
  1781. iball = ActiveBall.uservalue
  1782. currentball(iball).UserValue = 0
  1783. 'If Err Then Msgbox Err.description & vbCrLf & iball
  1784. ballStatus(iBall) = 0
  1785. ballStatus(0) = ballStatus(0) -1
  1786. On Error Goto 0
  1787. End Sub
  1788.  
  1789. ' Ball data collection and B2B Collision detection. jpsalas: added height check
  1790. ReDim baX(tnopb, 4), baY(tnopb, 4), baZ(tnopb, 4), bVx(tnopb, 4), bVy(tnopb, 4), TotalVel(tnopb, 4)
  1791. Dim cForce, bDistance, xyTime, cFactor, id, id2, id3, B1, B2
  1792.  
  1793. Sub XYdata_Timer()
  1794. xyTime = Timer + (XYdata.interval * .001)
  1795. If id2 >= 4 Then id2 = 0
  1796. id2 = id2 + 1
  1797. For id = 1 to ubound(ballStatus)
  1798. If ballStatus(id) = 1 Then
  1799. baX(id, id2) = round(currentball(id).x, 2)
  1800. baY(id, id2) = round(currentball(id).y, 2)
  1801. baZ(id, id2) = round(currentball(id).z, 2)
  1802. bVx(id, id2) = round(currentball(id).velx, 2)
  1803. bVy(id, id2) = round(currentball(id).vely, 2)
  1804. TotalVel(id, id2) = (bVx(id, id2) ^2 + bVy(id, id2) ^2)
  1805. If TotalVel(id, id2) > TotalVel(0, 0) Then TotalVel(0, 0) = int(TotalVel(id, id2) )
  1806. End If
  1807. Next
  1808.  
  1809. id3 = id2:B2 = 2:B1 = 1
  1810. Do
  1811. If ballStatus(B1) = 1 and ballStatus(B2) = 1 Then
  1812. bDistance = int((TotalVel(B1, id3) + TotalVel(B2, id3) ) ^1.04)
  1813. If ABS(baZ(B1, id3) - baZ(B2, id3)) < 50 Then
  1814. If((baX(B1, id3) - baX(B2, id3) ) ^2 + (baY(B1, id3) - baY(B2, id3) ) ^2) < 2800 + bDistance Then collide B1, B2:Exit Sub
  1815. End If
  1816. End If
  1817. B1 = B1 + 1
  1818. If B1 >= ballStatus(0) Then Exit Do
  1819. If B1 >= B2 then B1 = 1:B2 = B2 + 1
  1820. Loop
  1821.  
  1822. If ballStatus(0) <= 1 Then XYdata.enabled = False
  1823.  
  1824. If XYdata.interval >= 40 Then coff = True:XYdata.enabled = False
  1825. If Timer > xyTime * 3 Then coff = True:XYdata.enabled = False
  1826. If Timer > xyTime Then XYdata.interval = XYdata.interval + 1
  1827. End Sub
  1828.  
  1829. 'Calculate the collision force and play sound
  1830. Dim cTime, cb1, cb2, avgBallx, cAngle, bAngle1, bAngle2
  1831.  
  1832. Sub Collide(cb1, cb2)
  1833. If TotalVel(0, 0) / 1.8 > cFactor Then cFactor = int(TotalVel(0, 0) / 1.8)
  1834. avgBallx = (bvX(cb2, 1) + bvX(cb2, 2) + bvX(cb2, 3) + bvX(cb2, 4) ) / 4
  1835. If avgBallx < bvX(cb2, id2) + .1 and avgBallx > bvX(cb2, id2) -.1 Then
  1836. If ABS(TotalVel(cb1, id2) - TotalVel(cb2, id2) ) < .000005 Then Exit Sub
  1837. End If
  1838. If Timer < cTime Then Exit Sub
  1839. cTime = Timer + .1
  1840. GetAngle baX(cb1, id3) - baX(cb2, id3), baY(cb1, id3) - baY(cb2, id3), cAngle
  1841. id3 = id3 - 1:If id3 = 0 Then id3 = 4
  1842. GetAngle bVx(cb1, id3), bVy(cb1, id3), bAngle1
  1843. GetAngle bVx(cb2, id3), bVy(cb2, id3), bAngle2
  1844. cForce = Cint((abs(TotalVel(cb1, id3) * Cos(cAngle-bAngle1) ) + abs(TotalVel(cb2, id3) * Cos(cAngle-bAngle2) ) ) )
  1845. If cForce < 4 Then Exit Sub
  1846. cForce = Cint((cForce) / (cFactor / nosf) )
  1847. If cForce > nosf-1 Then cForce = nosf-1
  1848. PlaySound("collide" & cForce)
  1849. End Sub
  1850.  
  1851. ' Get angle
  1852. Dim Xin, Yin, rAngle, Radit, wAngle, Pi
  1853. Pi = Round(4 * Atn(1), 6) '3.1415926535897932384626433832795
  1854.  
  1855. Sub GetAngle(Xin, Yin, wAngle)
  1856. If Sgn(Xin) = 0 Then
  1857. If Sgn(Yin) = 1 Then rAngle = 3 * Pi / 2 Else rAngle = Pi / 2
  1858. If Sgn(Yin) = 0 Then rAngle = 0
  1859. Else
  1860. rAngle = atn(- Yin / Xin)
  1861. End If
  1862. If sgn(Xin) = -1 Then Radit = Pi Else Radit = 0
  1863. If sgn(Xin) = 1 and sgn(Yin) = 1 Then Radit = 2 * Pi
  1864. wAngle = round((Radit + rAngle), 4)
  1865. End Sub
  1866. '***************************************************************
  1867.  
  1868.  
  1869. '**************************************************************
  1870. '************************ Sounds ************************
  1871. '**************************************************************
  1872.  
  1873. 'Sounds
  1874. dim rt, rb 'ramp top and ramp bottom
  1875.  
  1876. dim speedx
  1877. dim speedy
  1878. dim finalspeed
  1879. Sub RHSND_Hit(IDX)
  1880. finalspeed=SQR(ActiveBall.velx * ActiveBall.velx + ActiveBall.vely * ActiveBall.vely)
  1881. if finalspeed > 11 then PlaySound "rubber" else PlaySound "rubberFlipper":end if
  1882. End Sub
  1883. Sub Gates_Hit(IDX):RandomSoundGates():End Sub
  1884. Sub LeftFlipper_Collide(parm)
  1885. RandomSoundRubber()
  1886. End Sub
  1887. Sub RightFlipper_Collide(parm)
  1888. RandomSoundRubber()
  1889. End Sub
  1890.  
  1891. sub trigentreerampebefore_unHit()
  1892.  
  1893. if rb=1 then
  1894. rb=0
  1895. stopsound "sramp2"
  1896. playsound "launchballreturn01"
  1897. end if
  1898. end Sub
  1899.  
  1900. sub trigentreerampe_unHit()
  1901. if plb=1 and rb = 0 Then
  1902. plb=0
  1903. stopsound "launchball01"
  1904. end If
  1905.  
  1906. if rb=0 then
  1907. PlaySound "sramp2"
  1908. rb=1
  1909. end if
  1910. end Sub
  1911.  
  1912. sub sortierampe1_unHit()
  1913. PlaySound "DROP_RIGHT"
  1914. stopsound "sramp2"
  1915.  
  1916. rb=0
  1917. end Sub
  1918.  
  1919. sub Ramp1_unhit()
  1920. StopSound "sramp2"
  1921. PlaySound"DROP_RIGHT"
  1922. end Sub
  1923.  
  1924. Sub RampHelp_Hit():PlaySound"rail":End Sub
  1925. Sub RampHelp1_Hit():PlaySound"DROP_RIGHT":End Sub
  1926. Sub RampHelp2_Hit():stopsound "ramp":PlaySound"DROP_LEFT":End Sub
  1927. Sub RampHelp3_Hit():stopsound "ramp":PlaySound"DROP_RIGHT":End Sub
  1928.  
  1929. Sub RampHelp3_UnHit(): PlaySound"DROP_LEFT":End Sub
  1930.  
  1931. sub trigger1_hit()
  1932. playsound "sramp2", 0, Vol(ActiveBall)*4*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall)*25, 0, 0
  1933. end sub
  1934.  
  1935. sub Trigger1_unhit()
  1936. stopsound "sramp2"
  1937. end sub
  1938.  
  1939. sub trigger2_hit()
  1940. playsound "sramp2", 0, Vol(ActiveBall)*4*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall)*22, 0, 0
  1941. end sub
  1942.  
  1943. sub Trigger2_unhit()
  1944. stopsound "sramp2"
  1945. end sub
  1946.  
  1947. 'sub Wall36_hit()
  1948. ' msgbox activeball.z
  1949. 'end sub
  1950.  
  1951. ' Extra Sounds
  1952. 'Sub Sound1_Hit:PlaySound "metalrolling":End Sub
  1953. 'Sub Sound2_Hit:PlaySound "metalrolling":End Sub
  1954. 'Sub Sound3_Hit:PlaySound "metalrolling":End Sub
  1955. 'Sub BallRol1_Hit:PlaySound "ballrolling":End Sub
  1956. '
  1957. '
  1958. 'Sub BalldropSound: PlaySound "fx_ball_drop" : End Sub
  1959. 'Sub OnBallBallCollision(ball1, ball2, velocity) : PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0 : End Sub
  1960. '
  1961. 'Sub Trigger1_Hit() : Stopsound "plasticrolling" : PlaySound "metalrolling", -1,GlobalSoundLevel * 0.3, 0, 0, 1, 0, 0 : End Sub
  1962. '
  1963. 'Sub LeftFlipper_Collide(parm) : RandomSoundFlipper() : End Sub
  1964. 'Sub RightFlipper_Collide(parm) : RandomSoundFlipper() : End Sub
  1965. '
  1966. '
  1967. 'Sub Pins_Hit (idx)
  1968. ' PlaySound "plastic", 0, Vol(ActiveBall)*GlobalSoundLevel, Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  1969. 'End Sub
  1970. '
  1971. 'Sub Targets_Hit (idx)
  1972. ' PlaySound "target", 0, Vol(ActiveBall)*GlobalSoundLevel, Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  1973. 'End Sub
  1974.  
  1975. Sub Metal_Hit (idx)
  1976. RandomSoundMetal()
  1977. End Sub
  1978.  
  1979. 'Sub MetalsThin_Hit (idx)
  1980. ' PlaySound "metalhit_thin", 0, Vol(ActiveBall)*GlobalSoundLevel, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1981. 'End Sub
  1982. '
  1983. 'Sub MetalsMedium_Hit (idx)
  1984. ' PlaySound "metalhit_medium", 0, Vol(ActiveBall)*GlobalSoundLevel, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1985. 'End Sub
  1986. '
  1987. 'Sub Metals2_Hit (idx)
  1988. ' PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1989. 'End Sub
  1990. '
  1991. 'Sub Gates_Hit (idx)
  1992. ' PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1993. 'End Sub
  1994. '
  1995. 'Sub Spinner1_Hit ()
  1996. ' PlaySound "fx_spinner", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1997. 'End Sub
  1998. '
  1999. 'Sub Spinner2_Hit ()
  2000. ' PlaySound "fx_spinner", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2001. 'End Sub
  2002.  
  2003. Sub Rubbers_Hit(idx)
  2004. dim finalspeed
  2005. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2006. If finalspeed > 20 then
  2007. PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2008. End if
  2009. If finalspeed >= 1 AND finalspeed <= 20 then
  2010. RandomSoundRubber()
  2011. End If
  2012. End Sub
  2013.  
  2014. 'Sub Posts_Hit(idx)
  2015. ' dim finalspeed
  2016. ' finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2017. ' If finalspeed > 16 then
  2018. ' PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2019. ' End if
  2020. ' If finalspeed >= 6 AND finalspeed <= 16 then
  2021. ' RandomSoundRubber()
  2022. ' End If
  2023. 'End Sub
  2024.  
  2025. Sub RandomSoundMetal()
  2026. Select Case Int(Rnd*3)+1
  2027. Case 1 : PlaySound "metal_1", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2028. Case 2 : PlaySound "metal_2", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2029. Case 3 : PlaySound "metal_3", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2030. End Select
  2031. End Sub
  2032. Sub RandomSoundRubber()
  2033. Select Case Int(Rnd*3)+1
  2034. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2035. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2036. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2037. End Select
  2038. End Sub
  2039. Sub RandomSoundGates()
  2040. Select Case Int(Rnd*2)+1
  2041. Case 1 : PlaySound "Gate", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2042. Case 2 : PlaySound "Gate4", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2043. End Select
  2044. End Sub
  2045. Sub RandomSoundFlipper()
  2046. Select Case Int(Rnd*3)+1
  2047. Case 1 :PlaySound "flip_hit_1", 0, GlobalSoundLevel * ballvel(ActiveBall) / 50, -0.1, 0.25
  2048. Case 2 :PlaySound "flip_hit_2", 0, GlobalSoundLevel * ballvel(ActiveBall) / 50, -0.1, 0.25
  2049. Case 3 :PlaySound "flip_hit_3", 0, GlobalSoundLevel * ballvel(ActiveBall) / 50, -0.1, 0.25
  2050. End Select
  2051. End Sub
  2052.  
  2053. '*******************************************************************************************
  2054.  
  2055. Sub sw21h_Hit()
  2056. ClearBallID
  2057. me.destroyball
  2058. sw21h1.createball
  2059. sw21h1.kick 80,10
  2060. End Sub
  2061.  
  2062. Sub sw21h1_Unhit()
  2063. playsound "ramp"
  2064. End Sub
  2065.  
  2066. '***************************************
  2067. '** Flippers Primitive **
  2068. '***************************************
  2069.  
  2070. Sub flippers_Timer()
  2071. GloveP.objRotZ = glove.currentAngle-180
  2072. LeftFlipperP.objRotZ = LeftFlipper.CurrentAngle-90
  2073. RightFlipperP1.objRotZ = RightFlipper1.CurrentAngle-90
  2074. RightFlipperP.objRotZ = RightFlipper.CurrentAngle-90
  2075. claw.objRotX = Fclaw.currentangle
  2076. if clawOn = 0 then
  2077. FclawR.enabled = 0
  2078. FclawL.enabled = 0
  2079. FClaw.rotatetostart
  2080. end if
  2081.  
  2082. End Sub
  2083.  
  2084.  
  2085. 'cFastFlips by nFozzy
  2086. 'Bypasses pinmame callback for faster and more responsive flippers
  2087. 'Version 1.1 beta2 (More proper behaviour, extra safety against script errors)
  2088. '*************************************************
  2089. Function NullFunction(aEnabled):End Function '1 argument null function placeholder
  2090. Class cFastFlips
  2091. Public TiltObjects, DebugOn, hi
  2092. Private SubL, SubUL, SubR, SubUR, FlippersEnabled, Delay, LagCompensation, Name, FlipState(3)
  2093.  
  2094. Private Sub Class_Initialize()
  2095. Delay = 0 : FlippersEnabled = False : DebugOn = False : LagCompensation = False
  2096. Set SubL = GetRef("NullFunction"): Set SubR = GetRef("NullFunction") : Set SubUL = GetRef("NullFunction"): Set SubUR = GetRef("NullFunction")
  2097. End Sub
  2098.  
  2099. 'set callbacks
  2100. Public Property Let CallBackL(aInput) : Set SubL = GetRef(aInput) : Decouple sLLFlipper, aInput: End Property
  2101. Public Property Let CallBackUL(aInput) : Set SubUL = GetRef(aInput) : End Property
  2102. Public Property Let CallBackR(aInput) : Set SubR = GetRef(aInput) : Decouple sLRFlipper, aInput: End Property
  2103. Public Property Let CallBackUR(aInput) : Set SubUR = GetRef(aInput) : End Property
  2104. Public Sub InitDelay(aName, aDelay) : Name = aName : delay = aDelay : End Sub 'Create Delay
  2105. 'Automatically decouple flipper solcallback script lines (only if both are pointing to the same sub) thanks gtxjoe
  2106. Private Sub Decouple(aSolType, aInput) : If StrComp(SolCallback(aSolType),aInput,1) = 0 then SolCallback(aSolType) = Empty End If : End Sub
  2107.  
  2108. 'call callbacks
  2109. Public Sub FlipL(aEnabled)
  2110. FlipState(0) = aEnabled 'track flipper button states: the game-on sol flips immediately if the button is held down (1.1)
  2111. If not FlippersEnabled and not DebugOn then Exit Sub
  2112. subL aEnabled
  2113. End Sub
  2114.  
  2115. Public Sub FlipR(aEnabled)
  2116. FlipState(1) = aEnabled
  2117. If not FlippersEnabled and not DebugOn then Exit Sub
  2118. subR aEnabled
  2119. End Sub
  2120.  
  2121. Public Sub FlipUL(aEnabled)
  2122. FlipState(2) = aEnabled
  2123. If not FlippersEnabled and not DebugOn then Exit Sub
  2124. subUL aEnabled
  2125. End Sub
  2126.  
  2127. Public Sub FlipUR(aEnabled)
  2128. FlipState(3) = aEnabled
  2129. If not FlippersEnabled and not DebugOn then Exit Sub
  2130. subUR aEnabled
  2131. End Sub
  2132.  
  2133. Public Sub TiltSol(aEnabled) 'Handle solenoid / Delay (if delayinit)
  2134. If delay > 0 and not aEnabled then 'handle delay
  2135. vpmtimer.addtimer Delay, Name & ".FireDelay" & "'"
  2136. LagCompensation = True
  2137. else
  2138. If Delay > 0 then LagCompensation = False
  2139. EnableFlippers(aEnabled)
  2140. end If
  2141. End Sub
  2142.  
  2143. Sub FireDelay() : If LagCompensation then EnableFlippers False End If : End Sub
  2144.  
  2145. Private Sub EnableFlippers(aEnabled)
  2146. If aEnabled then SubL FlipState(0) : SubR FlipState(1) : subUL FlipState(2) : subUR FlipState(3)
  2147. FlippersEnabled = aEnabled
  2148. If TiltObjects then vpmnudge.solgameon aEnabled
  2149. If Not aEnabled then
  2150. subL False
  2151. subR False
  2152. If not IsEmpty(subUL) then subUL False
  2153. If not IsEmpty(subUR) then subUR False
  2154. End If
  2155. End Sub
  2156.  
  2157.  
  2158. End Class
Advertisement
Add Comment
Please, Sign In to add comment