Advertisement
Guest User

Dracula

a guest
Oct 28th, 2016
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Bram Stoker's Dracula / IPD No. 3072 / April, 1993 / 4 Players
  2. ' VP91x 1.03 by JPSalas 2011
  3. ' Magnet script by Dorsolas/Lander's script, with just a small modification
  4.  
  5. '
  6. '01010111 01101001 01101110 01101110 01100101 01110010 01110011 00100000
  7. '01100100 01101111 01101110 00100111 01110100 00100000 01110011 01100101
  8. '01101100 01101100 00100000 01010110 01010000 01011000 00100000 01110100
  9. '01100001 01100010 01101100 0110F0101 01110011 00101110
  10. '
  11.  
  12. Option Explicit
  13. Randomize
  14.  
  15. Dim dtxx
  16. Dim DesktopMode:DesktopMode = Table1.ShowDT
  17.  
  18. If DesktopMode = True Then
  19. Ramp15.visible = 1
  20. Ramp16.visible = 1
  21. SideWood.visible = 1
  22. For each dtxx in Dflasher:dtxx.Visible = 1:next
  23. l58.Intensity = 0
  24. l58a.Intensity = 0
  25. l21.Intensity = 0
  26. l22.Intensity = 0
  27. else
  28. For each dtxx in Dflasher:dtxx.Visible = 0:next
  29. l58.Intensity = 50
  30. l58a.Intensity = 25
  31. l21.Intensity = 20
  32. l22.Intensity = 20
  33. Ramp15.visible = 0
  34. Ramp16.visible = 0
  35. SideWood.visible = 0
  36. End If
  37.  
  38. Dim VarHidden, UseVPMDMD
  39. Const UseVPMModSol = 1
  40. If Table1.ShowDT = true then
  41.     UseVPMDMD = true
  42.     VarHidden = 1
  43. else
  44.     UseVPMDMD = False
  45.     VarHidden = 0
  46. end if
  47.  
  48. LoadVPM "01560000", "WPC.VBS", 3.26
  49.  
  50. Sub LoadVPM(VPMver, VBSfile, VBSver)
  51.     On Error Resume Next
  52.     If ScriptEngineMajorVersion <5 Then MsgBox "VB Script Engine 5.0 or higher required"
  53.     ExecuteGlobal GetTextFile(VBSfile)
  54.     If Err Then MsgBox "Unable to open " & VBSfile & ". Ensure that it is in the same folder as this table. " & vbNewLine & Err.Description
  55.     Set Controller = CreateObject("VPinMAME.Controller")
  56.     'Set Controller = CreateObject("B2S.Server")
  57.    If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description
  58.     If VPMver> "" Then If Controller.Version <VPMver Or Err Then MsgBox "VPinMAME ver " & VPMver & " required."
  59.     If VPinMAMEDriverVer <VBSver Or Err Then MsgBox VBSFile & " ver " & VBSver & " or higher required."
  60.     On Error Goto 0
  61. End Sub
  62.  
  63. '********************
  64. 'Standard definitions
  65. '********************
  66.  
  67. Const UseSolenoids = 1
  68. Const UseLamps = 1
  69. Const UseSync = 0
  70. Const HandleMech = 0
  71.  
  72. ' Standard Sounds
  73. Const SSolenoidOn = "Solenoid"
  74. Const SSolenoidOff = ""
  75. Const SFlipperOn = "FlipperUp"
  76. Const SFlipperOff = "FlipperDown"
  77. Const SCoin = "Coin"
  78.  
  79. Set GiCallback2 = GetRef("UpdateGI2")
  80.  
  81. Dim bsTrough, bsCryptPopper, bsBLPopper, bsCastlePopper, bsCoffinPopper
  82. Dim mMagnet, dtLDrop, bsCastleLock, x, bumper1, bumper2, bumper3, plungerIM
  83.  
  84.  
  85. On Error Resume Next
  86. Dim i
  87. For i=0 To 127
  88.     Execute "Set Lights(" & i & ")  = L" & i
  89. Next
  90.  
  91. Lights(58)=Array(L58,L58A)
  92.  
  93. '************
  94. ' Table init.
  95. '************
  96.  
  97. Const cGameName = "drac_l1"
  98.  
  99. Sub Table1_Init
  100.     vpmInit Me
  101.     With Controller
  102.         .GameName = cGameName
  103.         If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  104.         .SplashInfoLine = "Bram Stoker's Dracula, Williams, 1993" & vbNewLine & "VP91x table by JPSalas v1.03"
  105.         .Games(cGameName).Settings.Value("rol") = 0 'rotated left
  106.        .HandleKeyboard = 0
  107.         .ShowTitle = 0
  108.         .ShowDMDOnly = 1
  109.         .ShowFrame = 0
  110.         .HandleMechanics = 0
  111.         .Hidden = Desktopmode
  112.         On Error Resume Next
  113.         .Run GetPlayerHWnd
  114.         If Err Then MsgBox Err.Description
  115.         On Error Goto 0
  116.         .Switch(22) = 1 'close coin door
  117.        .Switch(24) = 1 'and keep it close
  118.    End With
  119.  
  120.     ' Nudging
  121.    vpmNudge.TiltSwitch = 14
  122.     vpmNudge.Sensitivity = 1
  123.     vpmNudge.TiltObj = Array(bumper1, bumper2, bumper3, LeftSlingshot, RightSlingshot)
  124.  
  125.     ' Trough
  126.    Set bsTrough = New cvpmBallStack
  127.     With bsTrough
  128.         .InitSw 48, 41, 42, 43, 44, 0, 0, 0
  129.         .InitKick BallRelease, 90, 4
  130.         .InitEntrySnd "Solenoid", "Solenoid"
  131.         .InitExitSnd "ballrel", "Solenoid"
  132.         .Balls = 4
  133.     End With
  134.  
  135.     ' Crypt Popper
  136.    set bsCryptPopper = new cvpmBallStack
  137.     With bsCryptPopper
  138.         .InitSw 0, 56, 0, 0, 0, 0, 0, 0
  139.         .InitKick sw56, 80, 10
  140.         .KickForceVar = 1
  141.         .KickAngleVar = 5
  142.         .KickBalls = 2
  143.         .InitExitSnd "Popper", "Solenoid"
  144.         .Balls = 0
  145.     End With
  146.  
  147.     ' Wire Ramp Popper
  148.    set bsBLPopper = new cvpmBallStack
  149.     With bsBLPopper
  150.         .InitSw 0, 55, 0, 0, 0, 0, 0, 0
  151.         .InitKick sw55, 180, 1
  152.         .InitExitSnd "Popper", "Solenoid"
  153.         .Balls = 0
  154.     End With
  155.  
  156.     ' Castle Popper
  157.    set bsCastlePopper = new cvpmBallStack
  158.     With bsCastlePopper
  159.         .InitSw 0, 71, 0, 0, 0, 0, 0, 0
  160.         .InitKick sw71, 210, 10
  161.         .KickForceVar = 1
  162.         .KickAngleVar = 5
  163.         .KickBalls = 2
  164.         .InitExitSnd "Popper", "Solenoid"
  165.     End With
  166.  
  167.     ' Coffin Popper
  168.    set bsCoffinPopper = new cvpmBallStack
  169.     With bsCoffinPopper
  170.         .InitSw 0, 72, 0, 0, 0, 0, 0, 0
  171.         .InitKick sw72, 180, 1
  172.         .InitExitSnd "Popper", "Solenoid"
  173.     End With
  174.  
  175.     ' Mist Magnet
  176.    Set mMagnet = New cMagnet
  177.     mMagnet.InitMagnet Magnet, 5
  178.     mMagnet.Size = 60
  179.     MagnetPos = 0:SetMagnetPosition
  180.  
  181.     ' Drop target
  182.     Set dtLDrop = New cvpmDropTarget
  183.     With dtLDrop
  184.         .InitDrop sw15, 15
  185.         .InitSnd "droptarget_l", "Solenoid"
  186.         .CreateEvents "dtLDrop"
  187.     End With
  188.  
  189.     ' Castle Lock
  190.    Set bsCastleLock = new cvpmBallStack
  191.     With bsCastleLock
  192.         .initsw 0, 53, 54, 57, 0, 0, 0, 0
  193.         .InitKick CastleLock, 135, 1
  194.     End With
  195.  
  196.  
  197.     ' Main Timer init
  198.    PinMAMETimer.Interval = PinMAMEInterval
  199.     PinMAMETimer.Enabled = 1
  200.  
  201. Plunger.Pullback
  202. Wdivert.Isdropped = 1
  203.  
  204. End Sub
  205.  
  206. Sub table1_Paused:Controller.Pause = 1:End Sub
  207. Sub table1_unPaused:Controller.Pause = 0:End Sub
  208.  
  209. '**********
  210. ' Keys
  211. '**********
  212.  
  213. Sub table1_KeyDown(ByVal Keycode)
  214.     'If keycode = 3 Then SetFlash 131,1
  215.    If keycode = PlungerKey Then Controller.Switch(34) = 1
  216.         If keycode = LeftTiltKey Then
  217.         Nudge 90, 2
  218.     End If
  219.    
  220.     If keycode = RightTiltKey Then
  221.         Nudge 270, 2
  222.     End If
  223.    
  224.     If keycode = CenterTiltKey Then
  225.         Nudge 0, 2
  226.     End If
  227.     If vpmKeyDown(keycode) Then Exit Sub
  228. End Sub
  229.  
  230. Sub table1_KeyUp(ByVal Keycode)
  231.     'If keycode = 3 Then SetFlash 131,0
  232.    If keycode = PlungerKey Then Controller.Switch(34) = 0
  233.     If vpmKeyUp(keycode) Then Exit Sub
  234. End Sub
  235.  
  236.  
  237. '*********
  238. ' Switches
  239. '*********
  240.  
  241. ' Slings & div switches
  242. Dim LStep, RStep
  243.  
  244. Sub LeftSlingShot_Slingshot
  245. PlaySound "slingshot", 0, 0.3, -0.1, 0.25
  246. vpmTimer.PulseSw 64
  247.     LSling.Visible = 0
  248.     LSling1.Visible = 1
  249.     sling2.TransZ = -20
  250.     LStep = 0
  251.     LeftSlingShot.TimerEnabled = 1
  252.     LeftSlingShot.TimerInterval = 10
  253. End Sub
  254.  
  255. Sub LeftSlingShot_Timer
  256.     Select Case LStep
  257.         Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  258.         Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  259.     End Select
  260.     LStep = LStep + 1
  261. End Sub
  262.  
  263. Sub RightSlingShot_Slingshot
  264. PlaySound "slingshot", 0, 0.3, 0.1, 0.25
  265. vpmTimer.PulseSw 65
  266.     RSling.Visible = 0
  267.     RSling1.Visible = 1
  268.     sling1.TransZ = -20
  269.     RStep = 0
  270.     RightSlingShot.TimerEnabled = 1
  271.     RightSlingShot.TimerInterval = 10
  272. End Sub
  273.  
  274. Sub RightSlingShot_Timer
  275.     Select Case RStep
  276.         Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  277.         Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  278.     End Select
  279.     RStep = RStep + 1
  280. End Sub
  281.  
  282.  
  283. ' Bumpers
  284. Sub Bumper1_Hit:vpmTimer.PulseSw 61:PlaySound "bumper", 0, 0.1, 0, 0.25:End Sub
  285. Sub Bumper1_Timer()
  286.     Select Case bump1
  287.         Case 1:Ring1a.IsDropped = 0:bump1 = 2
  288.         Case 2:Ring1b.IsDropped = 0:Ring1a.IsDropped = 1:bump1 = 3
  289.         Case 3:Ring1c.IsDropped = 0:Ring1b.IsDropped = 1:bump1 = 4
  290.         Case 4:Ring1c.IsDropped = 1:Me.TimerEnabled = 0
  291.     End Select
  292. End Sub
  293.  
  294. Sub Bumper2_Hit:vpmTimer.PulseSw 62:PlaySound "bumper", 0, 0.1, -0.1, 0.25:End Sub
  295. Sub Bumper2_Timer()
  296.     Select Case bump2
  297.         Case 1:Ring2a.IsDropped = 0:bump2 = 2
  298.         Case 2:Ring2b.IsDropped = 0:Ring2a.IsDropped = 1:bump2 = 3
  299.         Case 3:Ring2c.IsDropped = 0:Ring2b.IsDropped = 1:bump2 = 4
  300.         Case 4:Ring2c.IsDropped = 1:Me.TimerEnabled = 0
  301.     End Select
  302. End Sub
  303.  
  304. Sub Bumper3_Hit:vpmTimer.PulseSw 63:PlaySound "bumper", 0, 0.1, 0.1, 0.25:End Sub
  305. Sub Bumper3_Timer()
  306.     Select Case bump3
  307.         Case 1:Ring3a.IsDropped = 0:bump3 = 2
  308.         Case 2:Ring3b.IsDropped = 0:Ring3a.IsDropped = 1:bump3 = 3
  309.         Case 3:Ring3c.IsDropped = 0:Ring3b.IsDropped = 1:bump3 = 4
  310.         Case 4:Ring3c.IsDropped = 1:Me.TimerEnabled = 0
  311.     End Select
  312. End Sub
  313.  
  314. ' Drain holes, vuks & saucers
  315. Sub Drain_Hit:Playsound "drain":bsTrough.AddBall Me:End Sub
  316. Sub Drain1_Hit:Playsound "drain":ClearBallID:bsTrough.AddBall Me:End Sub
  317. Sub Drain2_Hit:Playsound "drain":ClearBallID:bsTrough.AddBall Me:End Sub
  318. Sub Drain3_Hit:Playsound "drain":ClearBallID:bsTrough.AddBall Me:End Sub
  319. Sub Drain4_Hit:Playsound "drain":ClearBallID:bsTrough.AddBall Me:End Sub
  320.  
  321. 'Sub sw72a_Hit:PlaySound "hole_enter", 0, 0.3, 0.1, 0.25:bsCoffinPopper.addball Me:End Sub
  322.  
  323. Dim rball
  324.  
  325. Sub sw72a_Hit:PlaySound "hole_enter", 0, 0.3, 0.1, 0.25:me.destroyball:set rball = me.createball:drop.enabled = 1:End Sub
  326.  
  327. Sub drop_timer()
  328. If rball.Z <= -50 Then
  329. me.enabled = 0
  330. drop2.enabled = 1
  331. End If
  332. rball.Z = rball.Z - 1
  333. End Sub
  334.  
  335. Sub drop2_timer()
  336. sw72a.destroyball
  337. bsCoffinPopper.addball rball
  338. me.enabled = 0
  339. End Sub
  340.  
  341. Sub sw71_Hit
  342.     PlaySound "hole_enter", 0, 0.3, 0.1, 0.25
  343.     'ClearBallID
  344.    vpmTimer.PulseSwitch 71, 0, 0
  345.     mMagnet.RemoveBall ActiveBall
  346.     Me.destroyball
  347.     bsCastlePopper.AddBall Me
  348. End Sub
  349.  
  350. Sub sw58_Hit
  351.     PlaySound "hole_enter", 0, 0.3, -0.1, 0.25
  352.     'ClearBallID
  353.    Me.DestroyBall
  354.     PlaySound "subway2"
  355.     vpmTimer.PulseSwitch 58, 1250, "bsBLPopper.AddBall 0 '"
  356. End Sub
  357.  
  358. Sub sw56_Hit
  359.     PlaySound "hole_enter", 0, 0.3, -0.1, 0.25
  360.     'ClearBallID
  361.    vpmTimer.PulseSwitch 56, 100, 0
  362.     mMagnet.RemoveBall ActiveBall
  363.     bsCryptPopper.AddBall Me
  364. End Sub
  365.  
  366. Sub sw56a_Hit
  367.     PlaySound "hole_enter", 0, 0.3, -0.1, 0.25
  368.     'ClearBallID
  369.    mMagnet.RemoveBall ActiveBall
  370.     bsCryptPopper.AddBall Me
  371. End Sub
  372.  
  373. Sub CastleLock_Hit()
  374.     Playsound "metalhit"
  375.     'ClearBallID
  376.    bsCastleLock.AddBall Me
  377. End Sub
  378.  
  379. ' Rollovers & Ramp Switches
  380. Sub sw35_Hit:Controller.Switch(35) = 1:PlaySound "sensor":End Sub
  381. Sub sw35_UnHit:Controller.Switch(35) = 0:PlaySound "outlane":End Sub
  382.  
  383. Sub sw36_Hit:Controller.Switch(36) = 1:PlaySound "sensor":End Sub
  384. Sub sw36_UnHit:Controller.Switch(36) = 0:End Sub
  385.  
  386. Sub sw37_Hit:Controller.Switch(37) = 1:PlaySound "sensor":End Sub
  387. Sub sw37_UnHit:Controller.Switch(37) = 0:End Sub
  388.  
  389. Sub sw38_Hit:Controller.Switch(38) = 1:PlaySound "sensor":End Sub
  390. Sub sw38_UnHit:Controller.Switch(38) = 0:PlaySound "outlane":End Sub
  391.  
  392. Sub sw25_Hit:Controller.Switch(25) = 1:PlaySound "sensor":End Sub
  393. Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
  394.  
  395. Sub sw26_Hit:Controller.Switch(26) = 1:PlaySound "sensor":End Sub
  396. Sub sw26_Unhit:Controller.Switch(26) = 0:End Sub
  397.  
  398. Sub sw27_Hit:Controller.Switch(27) = 1:PlaySound "sensor":End Sub
  399. Sub sw27_Unhit:Controller.Switch(27) = 0:End Sub
  400.  
  401. Sub sw16_Hit:Controller.Switch(16) = 1:PlaySound "sensor":End Sub
  402. Sub sw16_Unhit:Controller.Switch(16) = 0:End Sub
  403.  
  404. Sub sw28_Hit:Controller.Switch(28) = 1:PlaySound "gate":End Sub
  405. Sub sw28_Unhit:Controller.Switch(28) = 0:PlaySound "metalrolling", 0, 0.3, -0.1, 0.25:End Sub
  406.  
  407. Sub sw84_Hit:Controller.Switch(84) = 1:PlaySound "gate":End Sub
  408. Sub sw84_Unhit:Controller.Switch(84) = 0:PlaySound "metalrolling":End Sub
  409.  
  410. Sub sw85_Hit:Controller.Switch(85) = 1:PlaySound "gate":End Sub
  411. Sub sw85_Unhit:Controller.Switch(85) = 0:PlaySound "metalrolling":End Sub
  412.  
  413. Sub sw31_Hit:Controller.Switch(31) = 1:PlaySound "sensor":End Sub
  414. Sub sw31_Unhit:Controller.Switch(31) = 0:End Sub
  415.  
  416. Sub sw51_Hit:Controller.Switch(51) = 1:PlaySound "sensor":End Sub
  417. Sub sw51_Unhit:Controller.Switch(51) = 0:End Sub
  418.  
  419. Sub sw52_Hit:Controller.Switch(52) = 1:PlaySound "sensor":End Sub
  420. Sub sw52_Unhit:Controller.Switch(52) = 0:End Sub
  421.  
  422. Sub sw73_Hit
  423. Controller.Switch(73) = 1
  424. If ActiveBall.VelY < -25 Then
  425. PlaySound "Subway2"
  426. End If
  427. End Sub
  428.  
  429. Sub sw73_Unhit:Controller.Switch(73) = 0:End Sub
  430.  
  431. Sub sw17_Hit:Controller.Switch(17) = 1:End Sub
  432. Sub sw17_Unhit:Controller.Switch(17) = 0:End Sub
  433.  
  434. ' Targets
  435. Sub sw66_Hit:vpmTimer.PulseSw 66:PlaySound "target":End Sub
  436. Sub sw66_Timer:sw66.IsDropped = 0:End Sub
  437.  
  438. Sub sw67_Hit:vpmTimer.PulseSw 67:PlaySound "target":End Sub
  439. Sub sw67_Timer:sw67.IsDropped = 0:End Sub
  440.  
  441. Sub sw68_Hit:vpmTimer.PulseSw 68:PlaySound "target":End Sub
  442. Sub sw68_Timer:sw68.IsDropped = 0:End Sub
  443.  
  444. Sub sw86_Hit:vpmTimer.PulseSw 86:PlaySound "target":End Sub
  445. Sub sw86_Timer:sw86.IsDropped = 0:End Sub
  446.  
  447. Sub sw87_Hit:vpmTimer.PulseSw 87:PlaySound "target":End Sub
  448. Sub sw87_Timer:sw87.IsDropped = 0:End Sub
  449.  
  450. Sub sw88_Hit:vpmTimer.PulseSw 88:PlaySound "target":End Sub
  451. Sub sw88_Timer:sw88.IsDropped = 0:Me.TimerEnabled = 0:End Sub
  452.  
  453. ' Gates
  454. Sub Gate2_Hit():PlaySound "gate":End Sub
  455. Sub Gate4_Hit():PlaySound "gate":End Sub
  456. Sub Gate6_Hit():PlaySound "gate":End Sub
  457.  
  458. ' Ramps helpers
  459. Sub RHelp1_Hit()
  460.     StopSound "metalrolling"
  461.     PlaySound "ballhit"
  462. End Sub
  463.  
  464. Sub RHelp2_Hit()
  465.     StopSound "metalrolling"
  466.     PlaySound "ballhit"
  467. End Sub
  468.  
  469. Sub RHelp3_Hit()
  470.     StopSound "metalrolling"
  471.     PlaySound "ballhit"
  472. End Sub
  473.  
  474. '*********
  475. 'Solenoids
  476. '*********
  477.  
  478. SolCallback(1) = "Auto_Plunger"
  479. SolCallback(2) = "bsCoffinPopper.SolOut"
  480. SolCallback(3) = "bsCastlePopper.SolOut"
  481. SolCallback(4) = "SolRRampDown"
  482. SolCallback(5) = "bsCryptPopper.SolOut"
  483. SolCallback(6) = "bsBLPopper.SolOut"
  484. SolCallback(7) = "vpmSolSound ""Knocker"","
  485. SolCallback(8) = "SolShooterRamp"
  486. SolCallback(14) = "SolRRampUp"
  487. SolCallback(15) = "bsTrough.SolIn"
  488. SolCallback(16) = "bsTrough.SolOut"
  489.  
  490. SolModCallback(17) = "Sol117"
  491. SolModCallback(18) = "Sol118"
  492. SolModCallback(19) = "Sol119"
  493. SolModCallback(20) = "Sol120"
  494. SolModCallback(21) = "Sol121"
  495. SolModCallback(22) = "Sol122"
  496. SolModCallback(23) = "Sol123"
  497. SolModCallback(24) = "Sol124"
  498. SolCallback(25) = "dtLDrop.SolDropUp"
  499. SolCallback(27) = "SolMistMagnet"
  500. SolCallback(33) = "solTopDiverter"
  501. SolCallback(34) = "SolRGate"
  502. SolCallback(35) = "bsCastleLock.SolOut"
  503. SolCallback(36) = "SolLGate"
  504.  
  505. Sub Auto_Plunger(Enabled)
  506.     If Enabled Then
  507.         Plunger.Fire
  508.         PlaySound "solenoid", 0, 0.3, 0.1, 0.25
  509. Else
  510.         Plunger.PullBack
  511.     End If
  512. End Sub
  513.  
  514. '*************
  515. ' Moving Ramp
  516. '*************
  517.  
  518. Dim RRampDir, RRAmpCurrPos, RRamp
  519. RRampCurrPos = 0 ' down
  520. RRampDir = 1     '1 is up -1 is down dir
  521. Controller.Switch(77) = False
  522. 'RightRamp.Collidable = True
  523.  
  524. Sub SolRRampUp(Enabled)
  525.     If Enabled Then
  526.         RRampDir = 1
  527.         Controller.Switch(77) = True
  528.         RightRamp.Collidable = False
  529.         UpdateRamp.Enabled = True
  530.         ''SetLamp 116, 1
  531.        playsound "diverter", 0, 0.3, 0.1, 0.25
  532.     End If
  533. End Sub
  534.  
  535. Sub SolRRampDown(Enabled)
  536.     If Enabled Then
  537.         RRampDir = -1
  538.         Controller.Switch(77) = False
  539.         RightRamp.Collidable = True
  540.         UpdateRamp.Enabled = True
  541.         ''SetLamp 116, 0
  542.        playsound "diverter", 0, 0.3, 0.1, 0.25
  543.     End If
  544. End sub
  545.  
  546. Sub UpdateRamp_Timer
  547.     RRampCurrPos = RRampCurrPos + RRampDir
  548.     If RRampCurrPos> 10 Then
  549.         RRampCurrPos = 10
  550.         UpdateRamp.Enabled = 0
  551.     End If
  552.     If RRampCurrPos <0 Then
  553.         RRampCurrPos = 0
  554.         UpdateRamp.Enabled = 0
  555.     End If
  556.     RightRamp2.HeightBottom = RRampCurrPos *5
  557.     CoffinLiftRampOpaque.RotX = RRampCurrPos -11
  558.     CoffinLiftRamp.RotX = RRampCurrPos -11
  559.     Refresh.State = 1
  560.     Refresh.State = 0
  561. End Sub
  562.  
  563. ' Shooter Ramp
  564.  
  565. Sub SolShooterRamp(Enabled)
  566.     If Enabled Then
  567.         sramp2.Collidable = 0
  568.         dirsrt = 1:shootramp.enabled = 1
  569.         Playsound "solenoid", 0, 0.3, 0.1, 0.25
  570.     Else
  571.         sramp2.Collidable = 1
  572.         dirsrt = 2:shootramp.enabled = 1
  573.         Playsound "solenoid", 0, 0.3, 0.1, 0.25
  574.     End If
  575. End Sub
  576.  
  577. ' Top Ramp Diverter
  578.  
  579. Sub SolTopDiverter(Enabled)
  580.     Playsound "Diverter"
  581.     If Enabled Then
  582.         'diverter1.isdropped = False
  583.        'Controller.Switch(78) = True
  584.        
  585.         wDivert.isdropped = 0
  586.         ddir = 1:Divert.enabled = 1
  587.     Else
  588.         'diverter1.isdropped = True
  589.        'Controller.Switch(78) = False
  590.        WDivert.isdropped = 1
  591.         ddir = 2:Divert.enabled = 1
  592.     End If
  593. End sub
  594.  
  595. Dim FlashState(200), FlashLevel(200)
  596. Dim FlashSpeedUp, FlashSpeedDown
  597. 'Dim x
  598.  
  599. FlashInit()
  600. FlasherTimer.Interval = 10 'flash fading speed
  601. FlasherTimer.Enabled = 1
  602.  
  603. Sub FlashInit
  604.     Dim i
  605.     For i = 0 to 200
  606.         FlashState(i) = 0
  607.         FlashLevel(i) = 0
  608.     Next
  609.  
  610.     FlashSpeedUp = 500   ' fast speed when turning on the flasher
  611.    FlashSpeedDown = 100 ' slow speed when turning off the flasher, gives a smooth fading
  612.    AllFlashOff()
  613. End Sub
  614.  
  615. Sub AllFlashOff
  616.     Dim i
  617.     For i = 0 to 200
  618.         FlashState(i) = 0
  619.     Next
  620. End Sub
  621.  
  622. Sub Flash(nr, object)
  623.     Select Case FlashState(nr)
  624.         Case 0 'off
  625.            FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
  626.             If FlashLevel(nr) < 0 Then
  627.                 FlashLevel(nr) = 0
  628.                 FlashState(nr) = -1 'completely off
  629.            End if
  630.             Object.opacity = FlashLevel(nr)
  631.         Case 1 ' on
  632.            FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
  633.             If FlashLevel(nr) > 1000 Then
  634.                 FlashLevel(nr) = 1000
  635.                 FlashState(nr) = -2 'completely on
  636.            End if
  637.             Object.opacity = FlashLevel(nr)
  638.     End Select
  639. End Sub
  640.  
  641. Sub Flashm(nr, object) 'multiple flashers, it doesn't change the flashstate
  642.    Select Case FlashState(nr)
  643.         Case 0         'off
  644.            Object.opacity = FlashLevel(nr)
  645.         Case 1         ' on
  646.            Object.opacity = FlashLevel(nr)
  647.     End Select
  648. End Sub
  649.  
  650. Sub SetFlash(nr, stat)
  651.     FlashState(nr) = ABS(stat)
  652. End Sub
  653.  
  654. Sub FlasherTimer_Timer()
  655. Flash 161, f61
  656. Flash 162, f62
  657. Flash 163, f63
  658. Flashm 158, f58
  659. Flash 158, f58a
  660. Flashm 121, F121
  661. Flash 121, F121a
  662. Flashm 122, F122
  663. Flash 122, F122a
  664. End Sub
  665.  
  666. Dim ddir
  667.  
  668. Sub Divert_Timer()
  669. Select Case ddir
  670. Case 1:
  671. If Diverter.Z = -315 Then
  672. me.enabled = 0
  673. Controller.Switch(78) = True
  674. Diverter.Z = -315
  675. End If
  676. Diverter.Z = Diverter.Z - 1
  677. Case 2:
  678. If Diverter.Z = -280 Then
  679. me.enabled = 0
  680. Controller.Switch(78) = False
  681. Diverter.Z = -280
  682. End If
  683. Diverter.Z = Diverter.Z + 1
  684. End Select
  685. End Sub
  686.  
  687.  
  688. ' Mist Gates
  689.  
  690. Sub SolLGate(Enabled)
  691.     If Enabled then
  692.         LGate.open = 1
  693.         Wall_LO.isdropped = 1
  694.     else
  695.         LGate.open = 0
  696.         Wall_LO.isdropped = 0
  697.     End If
  698. End Sub
  699.  
  700. Sub SolRGate(Enabled)
  701.     If Enabled then
  702.         RGate.open = 1
  703.         'Light51.state = 1
  704.        'RGate.Move 1, 1, 90
  705.        RGateWall.IsDropped = True
  706.     else
  707.         RGate.open = 0
  708.         'Light51.state = 0
  709.        'RGate.Move 0, 1, 0
  710.        RGateWall.IsDropped = False
  711.     End If
  712. End Sub
  713.  
  714. Sub Sol117(Level)
  715. dim Enabled:Enabled = Level > 0
  716. F17.State=Enabled
  717. F17.Intensity = (Level * 15 / 255)
  718. F17a.State=Enabled
  719. F17a.Intensity = (Level * 15 / 255)
  720. F17b.State=Enabled
  721. F17b.Intensity = (Level * 15 / 255)
  722. End Sub
  723. Sub Sol118(Level)
  724. dim Enabled:Enabled = Level > 0
  725. F18.State=(Enabled)
  726. F18.Intensity = (Level * 15 / 255)
  727. F18a.State=(Enabled)
  728. F18a.Intensity = (Level * 15 / 255)
  729. End Sub
  730.  
  731. Sub Sol119(Level)
  732. dim Enabled:Enabled = Level > 0
  733. F19.State=(Enabled)
  734. F19.Intensity = (Level * 15 / 255)
  735. F19a.State=(Enabled)
  736. F19a.Intensity = (Level * 15 / 255)
  737. End Sub
  738.  
  739. Sub Sol120(Level)
  740. dim Enabled:Enabled = Level > 0
  741. F20.State=(Enabled)
  742. F20.Intensity = (Level * 15 / 255)
  743. F20a.State=(Enabled)
  744. F20a.Intensity = (Level * 15 / 255)
  745. End Sub
  746.  
  747. Sub Sol121(Level)
  748. dim Enabled:Enabled = Level > 0
  749. F21.State=(Enabled)
  750. F21.Intensity = (Level * 15 / 255)
  751. F21a.State=(Enabled)
  752. F21a.Intensity = (Level * 15 / 255)
  753. End Sub
  754.  
  755. Sub Sol122(Level)
  756. dim Enabled:Enabled = Level > 0
  757. F22.State=(Enabled)
  758. F22.Intensity = (Level * 15 / 255)
  759. F22a.State=(Enabled)
  760. F22a.Intensity = (Level * 15 / 255)
  761. End Sub
  762.  
  763. Sub Sol123(Level)
  764. dim Enabled:Enabled = Level > 0
  765. F23.State=(Enabled)
  766. F23.Intensity = (Level * 15 / 255)
  767. F23a.State=(Enabled)
  768. F23a.Intensity = (Level * 15 / 255)
  769. End Sub
  770.  
  771. Sub Sol124(Level)
  772. dim Enabled:Enabled = Level > 0
  773. F24.State=(Enabled)
  774. F24.Intensity = (Level * 15 / 255)
  775. End Sub
  776.  
  777. '**************
  778. ' Flipper Subs
  779. '**************
  780.  
  781. SolCallback(sLRFlipper) = "SolRFlipper"
  782. SolCallback(sLLFlipper) = "SolLFlipper"
  783.  
  784. Sub SolLFlipper(Enabled)
  785.     If Enabled Then
  786.         PlaySound "flipperup":LeftFlipper.RotateToEnd
  787.     Else
  788.         PlaySound "flipperdown":LeftFlipper.RotateToStart
  789.     End If
  790. End Sub
  791.  
  792. Sub SolRFlipper(Enabled)
  793.     If Enabled Then
  794.         PlaySound "flipperup":RightFlipper.RotateToEnd
  795.     Else
  796.         PlaySound "flipperdown":RightFlipper.RotateToStart
  797.     End If
  798. End Sub
  799.  
  800. '***********
  801. ' Update GI
  802. '***********
  803.  
  804. Dim gistep, xxx
  805. gistep = 1 / 8
  806.  
  807. Sub UpdateGI2(no, step)
  808.    
  809.    Select Case no
  810.        
  811.         Case 0
  812.  
  813.    For each xxx in GIBOT:xxx.IntensityScale = gistep * step:next
  814.        
  815.         Case 1
  816.  
  817.    For each xxx in GITOP:xxx.IntensityScale = gistep * step:next  
  818.        
  819.         Case 2
  820.    
  821.    For each xxx in GIMID:xxx.IntensityScale = gistep * step:next
  822.  
  823.         Case 4
  824.  
  825.    Light80.IntensityScale = gistep * step
  826.    
  827.     End Select
  828. End Sub
  829.  
  830. '*******************************
  831. '          Mist Magnet
  832. '    taken from Lander's table
  833. ' with only a small modification
  834. '*******************************
  835.  
  836. '-------------------------------
  837. ' Magnet Simulator Class
  838. ' (07/10/2001 Dorsola)
  839. ' Modified for Dracula (08/16/2001) by Dorsola
  840. '-------------------------------
  841.  
  842. class cMagnet
  843.     Private cX, cY, cStrength, cRange
  844.     private cBalls, cClaimed
  845.     private cTempX, cTempY
  846.  
  847.     Private Sub Class_Initialize()
  848.         set cBalls = CreateObject("Scripting.Dictionary")
  849.         cRange = 1
  850.         cStrength = 0
  851.     End Sub
  852.  
  853.     Public Sub InitMagnet(aTrigger, inStrength)
  854.         cX = aTrigger.X
  855.         cY = aTrigger.Y
  856.         cRange = aTrigger.Radius
  857.         cStrength = inStrength
  858.     End Sub
  859.  
  860.     Public Sub MoveTo(inX, inY)
  861.         cX = inX
  862.         cY = inY
  863.     End Sub
  864.  
  865.     Public Property Get X:X = cX:End Property
  866.     Public Property Get Y:Y = cY:End Property
  867.     Public Property Get Strength:Strength = cStrength:End Property
  868.     Public Property Get Size:Size = cRange:End Property
  869.     Public Property Get Range:Range = cRange:End Property
  870.     Public Property Get Balls:Balls = cBalls.Keys:End Property
  871.  
  872.     Public Property Let X(inX):cX = inX:End Property
  873.     Public Property Let Y(inY):cY = inY:End Property
  874.     Public Property Let Strength(inStrength):cStrength = inStrength:End Property
  875.     Public Property Let Size(inSize):cRange = inSize:End Property
  876.     Public Property Let Range(inSize):cRange = inSize:End Property
  877.  
  878.     Public Sub AddBall(aBall)
  879.         cBalls.Item(aBall) = 0
  880.     End Sub
  881.  
  882.     Public Sub RemoveBall(aBall)
  883.         ' This function tags balls for removal, but does not remove them.
  884.        ' Another sub will be called to remove tagged objects from the dictionary.
  885.        If cBalls.Exists(aBall) then
  886.             if cClaimed then
  887.                 cBalls.Item(aBall) = 1
  888.             else
  889.                 cBalls.Remove(aBall)
  890.             end if
  891.         end if
  892.     End Sub
  893.  
  894.     Public Sub Claim():cClaimed = True:End Sub
  895.  
  896.     Public Sub Release()
  897.         cClaimed = False
  898.         Dim tempobj
  899.         for each tempobj in cBalls.Keys
  900.             if cBalls.Item(tempobj) = 1 then cBalls.Remove(tempobj)
  901.         next
  902.     End Sub
  903.  
  904.     Public Sub ProcessBalls()
  905.         Dim tempObj
  906.         for each tempObj in cBalls.Keys:AttractBall tempObj:next
  907.     End Sub
  908.  
  909.     Public Function GetDist(aBall)
  910.         on error resume next
  911.         if aBall is Nothing then
  912.             GetDist = 100000
  913.         else
  914.             cTempX = aBall.X - cX
  915.             cTempY = aBall.Y - cY
  916.             GetDist = Sqr(cTempX * cTempX + cTempY * cTempY)
  917.             if Err then GetDist = 100000
  918.         end if
  919.     End Function
  920.  
  921.     Public Sub AttractBall(aBall)
  922.         if aBall is Nothing then Exit Sub
  923.         Dim Dist
  924.         Dist = GetDist(aBall)
  925.         if Dist> cRange then Exit Sub
  926.  
  927.         ' Attract ball toward magnet center (cX,cY).
  928.  
  929.         ' Attraction force is determined by distance from center, and strength of magnet.
  930.  
  931.         Dim Force, Ratio
  932.         Ratio = Dist / (1.5 * cRange)
  933.  
  934.         ' TODO: Figure out how to dampen the force when ball is near center and
  935.        ' at low velocity, so that balls don't jitter on the magnets.
  936.        ' Also shore up instability on moving magnet.
  937.  
  938.         Force = cStrength * exp(-0.2 / Ratio) / (Ratio * Ratio * 56)
  939.         aBall.VelX = (aBall.VelX - cTempX * Force / Dist) * 0.985
  940.         aBall.VelY = (aBall.VelY - cTempY * Force / Dist) * 0.985
  941.     End Sub
  942. End Class
  943.  
  944. '-----------------------------------------------
  945. ' Mist Multiball - courtesy of Dorsola
  946. '-----------------------------------------------
  947.  
  948. ' Method: Since any ball that can block the Mist opto is necessarily in the Mist Magnet's trigger area,
  949. ' we automatically have access to all balls in this range.  We can therefore check each ball's position
  950. ' against a line equation and see if it happens to be blocking the opto, and set the switch accordingly.
  951. ' This requires a timer loop.
  952.  
  953. Dim MagnetOn
  954. MagnetOn = false
  955.  
  956. Sub MistTimer_Timer()
  957.     ' Endpoints of the line are (108,1247) and (908,895)
  958.    ' Slope: m = (y2-y1)/(x2-x1) = -0.44
  959.    ' Y-intercept: b = y1 - m*x1 = 1294.52
  960.  
  961.     mMagnet.Claim
  962.  
  963.     Dim obj, CheckState, x, TargetY
  964.     CheckState = 0
  965.     on error resume next
  966.     for each obj in mMagnet.Balls
  967.         ' y = mx+b (m=slope, b=yint)
  968.        TargetY = (-0.44) * obj.X + 1250.52
  969.         if(obj.Y> TargetY - 25) and(obj.Y <TargetY + 25) then CheckState = 1
  970.     next
  971.     on error goto 0
  972.  
  973.     Controller.Switch(82) = CheckState
  974.  
  975.     if MagnetOn then mMagnet.ProcessBalls
  976.  
  977.     mMagnet.Release
  978. End Sub
  979.  
  980. Sub SolMistMagnet(enabled)
  981.     MagnetOn = enabled
  982. End Sub
  983.  
  984. Sub Magnet_Hit()
  985.     mMagnet.AddBall ActiveBall
  986. End Sub
  987.  
  988. Sub Magnet_UnHit()
  989.     mMagnet.RemoveBall ActiveBall
  990. End Sub
  991.  
  992. '------------------------
  993. ' Handle the Mist Motor
  994. '------------------------
  995. ' Method: Treat motor's position as a number from right to left (0-500)
  996. ' and compute its position based on the line equation given above.
  997.  
  998. const motorx1 = 880
  999. const motorx2 = 108
  1000. const motorxrange = 800
  1001. const motory1 = 850
  1002. const motory2 = 1200
  1003. const motoryrange = -312
  1004. const motorslope = -0.44
  1005. const motoryint = 1249.52
  1006.  
  1007. ' Endpoints of the line are (108,1247) and (908,895)
  1008. ' Slope: m = (y2-y1)/(x2-x1) = -0.44
  1009. ' Y-intercept: b = y1 - m*x1 = 1294.52
  1010.  
  1011. Dim MagnetPos, MagnetDir
  1012. MagnetPos = 0:MagnetDir = 0
  1013.  
  1014. ' Coding for MagnetDir: 0 = left, 1 = right, toggle at endpoints.
  1015.  
  1016. Sub MotorTimer_Timer()
  1017.     if Controller.Solenoid(28) then
  1018.         if MagnetDir = 0 then
  1019.             MagnetPos = MagnetPos + 1
  1020.             'mist lights
  1021.            Select Case MagnetPos \ 33
  1022.                 Case 0:ml1.State = 0:ml2.State = 0:ml3.State = 0:ml4.State = 0
  1023.                     ml5.State = 0:ml6.State = 0:ml7.State = 0:ml8.State = 0
  1024.                     ml9.State = 0:ml10.State = 0:ml11.State = 0:ml12.State = 0:ml13.State = 0
  1025.                 Case 1:ml13.State = 1
  1026.                 Case 2:ml12.State = 1:ml13.State = 0
  1027.                 Case 3:ml11.State = 1:ml12.State = 0
  1028.                 Case 4:ml10.State = 1:ml11.State = 0
  1029.                 Case 5:ml9.State = 1:ml10.State = 0
  1030.                 Case 6:ml8.State = 1:ml9.State = 0
  1031.                 Case 7:ml7.State = 1:ml8.State = 0
  1032.                 Case 8:ml6.State = 1:ml7.State = 0
  1033.                 Case 9:ml5.State = 1:ml6.State = 0
  1034.                 Case 10:ml4.State = 1:ml5.State = 0
  1035.                 Case 11:ml3.State = 1:ml4.State = 0
  1036.                 Case 12:ml2.State = 1:ml3.State = 0
  1037.                 Case 13:ml1.State = 1:ml2.State = 0
  1038.                 Case 14:ml1.State = 0
  1039.             End Select
  1040.  
  1041.             if MagnetPos >= 500 then
  1042.                 MagnetPos = 500
  1043.                 MagnetDir = 1
  1044.             end if
  1045.         else
  1046.             MagnetPos = MagnetPos - 1
  1047.             Select Case MagnetPos \ 33
  1048.                 Case 0:ml1.State = 0:ml2.State = 0:ml3.State = 0:ml4.State = 0
  1049.                     ml5.State = 0:ml6.State = 0:ml7.State = 0:ml8.State = 0
  1050.                     ml9.State = 0:ml10.State = 0:ml11.State = 0:ml12.State = 0:ml13.State = 0
  1051.                 Case 1:ml13.State = 0
  1052.                 Case 2:ml12.State = 0:ml13.State = 1
  1053.                 Case 3:ml11.State = 0:ml12.State = 1
  1054.                 Case 4:ml10.State = 0:ml11.State = 1
  1055.                 Case 5:ml9.State = 0:ml10.State = 1
  1056.                 Case 6:ml8.State = 0:ml9.State = 1
  1057.                 Case 7:ml7.State = 0:ml8.State = 1
  1058.                 Case 8:ml6.State = 0:ml7.State = 1
  1059.                 Case 9:ml5.State = 0:ml6.State = 1
  1060.                 Case 10:ml4.State = 0:ml5.State = 1
  1061.                 Case 11:ml3.State = 0:ml4.State = 1
  1062.                 Case 12:ml2.State = 0:ml3.State = 1
  1063.                 Case 13:ml1.State = 0:ml2.State = 1
  1064.                 Case 14:ml1.State = 1
  1065.             End Select
  1066.             if MagnetPos <= 0 then
  1067.                 MagnetPos = 0
  1068.                 MagnetDir = 0
  1069.             end if
  1070.         end if
  1071.  
  1072.         SetMagnetPosition
  1073.         Controller.Switch(81) = (MagnetPos> 490)
  1074.         Controller.Switch(83) = (MagnetPos <10)
  1075.     end if
  1076. End Sub
  1077.  
  1078. Sub SetMagnetPosition()
  1079.     mMagnet.X = motorx1 -(motorxrange * (MagnetPos / 500) )
  1080.     mMagnet.Y = motorslope * mMagnet.X + motoryint
  1081.     If MagnetPos MOD 33 = 0 Then
  1082.         MotorTimer.Interval = 80
  1083.     Else
  1084.         MotorTimer.Interval = 8
  1085.     End If
  1086. End Sub
  1087.  
  1088.  
  1089. '******************************************
  1090. ' Use the motor callback to call div subs
  1091. '******************************************
  1092.  
  1093. Set MotorCallback = GetRef("RealTimeUpdates")
  1094.  
  1095. Sub RealTimeUpdates()
  1096. LFLogo.RotY =  LeftFlipper.CurrentAngle
  1097. RFlogo.RotY =  RightFlipper.CurrentAngle
  1098. WireGateLR.RotX=Spinner2.currentangle
  1099. WireGateLR1.RotX=Spinner1.currentangle
  1100. WireGateLR3.RotY=Spinner3.currentangle
  1101.  
  1102. If L61.State = 1 Then
  1103. setflash 161,1
  1104. else
  1105. setflash 161,0
  1106. End If
  1107.  
  1108. If L62.State = 1 Then
  1109. setflash 162,1
  1110. else
  1111. setflash 162,0
  1112. End If
  1113.  
  1114. If L63.State = 1 Then
  1115. setflash 163,1
  1116. else
  1117. setflash 163,0
  1118. End If
  1119.  
  1120. If l58.state = 1 Then
  1121. setflash 158,1
  1122. else
  1123. setflash 158,0
  1124. End If
  1125.  
  1126. If l21.state = 1 Then
  1127. setflash 121,1
  1128. else
  1129. setflash 121,0
  1130. End If
  1131.  
  1132. If l22.state = 1 Then
  1133. setflash 122,1
  1134. else
  1135. setflash 122,0
  1136. End If
  1137.  
  1138. End Sub
  1139.  
  1140. Sub Trigger55off_Hit:sw55.Enabled=0:End Sub
  1141. Sub Trigger55on_Hit:sw55.Enabled=1:End Sub
  1142.  
  1143. Sub LHD_Hit()
  1144. PlaySound "ball_bounce", 0, 0.3, -0.1, 0.25
  1145. End Sub
  1146.  
  1147. Sub CHD_Hit()
  1148. PlaySound "ball_bounce", 0, 0.3, 0, 0.25
  1149. StopSound "metalrolling"
  1150. End Sub
  1151. Sub CHM_Hit()
  1152. PlaySound "metalrolling", 0, 0.3, 0, 0.25
  1153. End Sub
  1154.  
  1155. Sub RHD_Hit()
  1156. StopSound "subway2"
  1157. PlaySound "ball_bounce", 0, 0.3, 0.1, 0.25
  1158. End Sub
  1159.  
  1160. Dim dirsrt
  1161.  
  1162. Sub shootramp_Timer()
  1163. Select Case dirsrt
  1164. Case 1:
  1165. If ramp_sl.heightbottom = 60 Then
  1166. me.enabled = 0
  1167. ramp_sl.heightbottom = 60
  1168. End If
  1169. ramp_sl.heightbottom = ramp_sl.heightbottom + 1
  1170. Liftramp.ObjRotx = LiftRamp.ObjRotx + 0.25
  1171. LiftRampRod.Z = LiftRampRod.Z + 0.25
  1172. Primitive108.ObjRotx = Primitive108.ObjRotx + 0.25
  1173. Primitive285.ObjRotx = Primitive285.ObjRotx + 0.25
  1174. Case 2:
  1175. If ramp_sl.heightbottom = 0 Then
  1176. me.enabled = 0
  1177. ramp_sl.heightbottom = 0
  1178. End If
  1179. ramp_sl.heightbottom = ramp_sl.heightbottom - 1
  1180. Liftramp.ObjRotx = LiftRamp.ObjRotx - 0.25
  1181. LiftRampRod.Z = LiftRampRod.Z - 0.25
  1182. Primitive108.ObjRotx = Primitive108.ObjRotx - 0.25
  1183. Primitive285.ObjRotx = Primitive285.ObjRotx - 0.25
  1184. End Select
  1185. End Sub
  1186.  
  1187.  
  1188. Sub sw55_UnHit(): StopSound "subway2" : End Sub
  1189.  
  1190. ' *********************************************************************
  1191. '                      Supporting Ball & Sound Functions
  1192. ' *********************************************************************
  1193.  
  1194. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1195.    Vol = Csng(BallVel(ball) ^2 / 2000)
  1196. End Function
  1197.  
  1198. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1199.    Dim tmp
  1200.     tmp = ball.x * 2 / table1.width-1
  1201.     If tmp > 0 Then
  1202.         Pan = Csng(tmp ^10)
  1203.     Else
  1204.         Pan = Csng(-((- tmp) ^10) )
  1205.     End If
  1206. End Function
  1207.  
  1208. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1209.    Pitch = BallVel(ball) * 20
  1210. End Function
  1211.  
  1212. Function BallVel(ball) 'Calculates the ball speed
  1213.    BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1214. End Function
  1215.  
  1216. '*****************************************
  1217. '      JP's VP10 Rolling Sounds
  1218. '*****************************************
  1219.  
  1220. Const tnob = 5 ' total number of balls
  1221. ReDim rolling(tnob)
  1222. InitRolling
  1223.  
  1224. Sub InitRolling
  1225.     Dim i
  1226.     For i = 0 to tnob
  1227.         rolling(i) = False
  1228.     Next
  1229. End Sub
  1230.  
  1231. Sub RollingTimer_Timer()
  1232.     Dim BOT, b
  1233.     BOT = GetBalls
  1234.  
  1235.     ' stop the sound of deleted balls
  1236.    For b = UBound(BOT) + 1 to tnob
  1237.         rolling(b) = False
  1238.         StopSound("fx_ballrolling" & b)
  1239.     Next
  1240.  
  1241.     ' exit the sub if no balls on the table
  1242.    If UBound(BOT) = -1 Then Exit Sub
  1243.  
  1244.     ' play the rolling sound for each ball
  1245.    For b = 0 to UBound(BOT)
  1246.         If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  1247.             rolling(b) = True
  1248.             PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1249.         Else
  1250.             If rolling(b) = True Then
  1251.                 StopSound("fx_ballrolling" & b)
  1252.                 rolling(b) = False
  1253.             End If
  1254.         End If
  1255.     Next
  1256. End Sub
  1257.  
  1258. '**********************
  1259. ' Ball Collision Sound
  1260. '**********************
  1261.  
  1262. Sub OnBallBallCollision(ball1, ball2, velocity)
  1263.     PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  1264. End Sub
  1265.  
  1266. Sub Pins_Hit (idx)
  1267.     PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  1268. End Sub
  1269.  
  1270. Sub Targets_Hit (idx)
  1271.     PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  1272. End Sub
  1273.  
  1274. Sub Metals_Thin_Hit (idx)
  1275.     PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1276. End Sub
  1277.  
  1278. Sub Metals_Medium_Hit (idx)
  1279.     PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1280. End Sub
  1281.  
  1282. Sub Metals2_Hit (idx)
  1283.     PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1284. End Sub
  1285.  
  1286. Sub Gates_Hit (idx)
  1287.     PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1288. End Sub
  1289.  
  1290. Sub Spinner_Spin
  1291.     PlaySound "fx_spinner",0,.25,0,0.25
  1292. End Sub
  1293.  
  1294. Sub Rubbers_Hit(idx)
  1295.     dim finalspeed
  1296.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1297.     If finalspeed > 20 then
  1298.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1299.     End if
  1300.     If finalspeed >= 6 AND finalspeed <= 20 then
  1301.         RandomSoundRubber()
  1302.     End If
  1303. End Sub
  1304.  
  1305. Sub Posts_Hit(idx)
  1306.     dim finalspeed
  1307.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1308.     If finalspeed > 16 then
  1309.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1310.     End if
  1311.     If finalspeed >= 6 AND finalspeed <= 16 then
  1312.         RandomSoundRubber()
  1313.     End If
  1314. End Sub
  1315.  
  1316. Sub RandomSoundRubber()
  1317.     Select Case Int(Rnd*3)+1
  1318.         Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1319.         Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1320.         Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1321.     End Select
  1322. End Sub
  1323.  
  1324. Sub LeftFlipper_Collide(parm)
  1325.     RandomSoundFlipper()
  1326. End Sub
  1327.  
  1328. Sub RightFlipper_Collide(parm)
  1329.     RandomSoundFlipper()
  1330. End Sub
  1331.  
  1332. Sub RandomSoundFlipper()
  1333.     Select Case Int(Rnd*3)+1
  1334.         Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1335.         Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1336.         Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1337.     End Select
  1338. End Sub
  1339.  
  1340. Sub Table1_Exit
  1341. Controller.Stop
  1342. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement