SHARE
TWEET

24 fixed

Arngrim May 23rd, 2017 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. Randomize
  3.  
  4. Const cGameName="twenty4_150",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
  5.  
  6.  
  7. On Error Resume Next
  8. ExecuteGlobal GetTextFile("controller.vbs")
  9. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  10. On Error Goto 0
  11.  
  12. LoadVPM "01560000", "sam.VBS", 3.10
  13. Dim DesktopMode: DesktopMode = Table1.ShowDT
  14.  
  15. If DesktopMode = True Then 'Show Desktop components
  16. Ramp16.visible=1
  17. Ramp15.visible=1
  18. Primitive13.visible=1
  19. Else
  20. Ramp16.visible=0
  21. Ramp15.visible=0
  22. Primitive13.visible=0
  23. End if
  24.  
  25. '*************************************************************
  26. 'Solenoid Call backs
  27. '**********************************************************************************************************
  28. SolCallback(1) = "solTrough"
  29. SolCallback(2) = "solAutofire"
  30. SolCallback(3) = "bsTEject.SolOut" 'safehouse eject
  31. SolCallback(4) =    "dtLDrop.SolDropUp" 'Drop Targets
  32. SolCallback(5) =    "dtRDrop.SolDropUp" 'Drop Targets
  33. SolCallback(6) =    "vpmSolgate GateL,""gate"","   
  34. SolCallback(7)  =   "vpmSolgate GateR,""gate"","
  35. 'SolCallback(8) = 'shaker not used
  36. SolCallback(12) = "SolSafeHouse"
  37. SolCallback(13) =   "dtUDrop.SolDropUp" 'Drop Targets
  38. SolCallback(14) = "SolSniper"
  39. SolCallback(22) = "SolPostUp" 'left ramp post
  40. SolCallback(28) = "SolSuitCase" 'suitcase lockup
  41. SolCallback(29) = "sniperpost" 'sniper up post
  42.  
  43. 'Solenoid Controlled Sounds
  44. 'SolCallback(9) = "SolLeftPop" 'left pop bumper
  45. 'SolCallback(10) = "SolRightPop" 'right pop bumper
  46. 'SolCallback(11) = "SolBottomPop" 'bottom pop bumper
  47. 'SolCallback(17) = 'left slingshot
  48. 'SolCallback(18) = 'right slingshot
  49.  
  50. 'Solenoid Controlled Flashers
  51. SolCallback(19) =   "SetLamp 119," 'flash safehouse x3
  52. SolCallback(20) =   "SetLamp 120," 'flash sniper x2
  53. SolCallback(26) =   "SetLamp 126," 'flash pop x3
  54. SolCallback(27) =   "SetLamp 127," 'flash right side under jet?
  55. SolCallback(31) =   "SetLamp 131," 'Orange Dome Slingshots x2
  56. SolCallback(32) =   "SetLamp 132," 'flash left spinner x3
  57.  
  58. SolCallback(15) =   "SolLFlipper"
  59. SolCallback(16) =   "SolRFlipper"
  60.  
  61. Sub SolLFlipper(Enabled)
  62.      If Enabled Then
  63.          PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd
  64.      Else
  65.          PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart
  66.      End If
  67.   End Sub
  68.  
  69. Sub SolRFlipper(Enabled)
  70.      If Enabled Then
  71.          PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd
  72.      Else
  73.          PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart
  74.      End If
  75. End Sub
  76. '**********************************************************************************************************
  77.  
  78. 'Solenoid Controlled toys
  79. '**********************************************************************************************************
  80.  
  81.  
  82. Sub solTrough(Enabled)
  83.     If Enabled Then
  84.         bsTrough.ExitSol_On
  85.         vpmTimer.PulseSw 22
  86.     End If
  87.  End Sub
  88.  
  89. Sub solSniper(Enabled)
  90.     If Enabled Then
  91.         SniperT.Enabled = 1
  92.     End If
  93.  End Sub
  94.  
  95. Sub solSafehouse(Enabled)
  96.     If Enabled Then
  97.         SafeRot = True
  98.     Else
  99.     End If
  100.  End Sub
  101.  
  102. Sub solAutofire(Enabled)
  103.     If Enabled Then
  104.        PlungerIM.AutoFire
  105.        PlaySound SoundFX("Popper",DOFContactors)
  106.     End If
  107.  End Sub
  108.  
  109.  
  110.  
  111. Sub SolPostUp(Enabled)
  112.   If Enabled Then
  113.      PostUp.Isdropped= 0
  114.      playsound SoundFX("fx_bumper2",DOFContactors)
  115.     ' UpdateGI 1, 0
  116.     Else
  117.      PostUp.Isdropped= 1
  118.      playsound SoundFX("fx_bumper2",DOFContactors)
  119.     ' UpdateGI 1, 8
  120.   End If
  121. End Sub
  122.  
  123. 'Suitcase post
  124. Sub SolSuitCase(Enabled)
  125.     If Enabled Then
  126.         Post45.IsDropped=True
  127.         SuitRot = True
  128.         scdiv.TransX=40
  129.         playsound SoundFX("fx_bumper2",DOFContactors)
  130.     Else
  131.         Post45.IsDropped=False
  132.         scdiv.TransX=0
  133.         playsound SoundFX("fx_bumper2",DOFContactors)
  134.     End If
  135. End Sub
  136.  
  137. ' Left Ramp post
  138. Sub leftramppost(Enabled)
  139.     If Enabled Then
  140.         RampPost.Isdropped=false
  141.      playsound SoundFX("fx_bumper2",DOFContactors)
  142.     Else
  143.         RampPost.Isdropped=true
  144.      playsound SoundFX("fx_bumper2",DOFContactors)
  145.     End If
  146.  End Sub
  147.  
  148. 'Primitive Gate
  149. Sub FlipperTimer_Timer
  150.     sw14Prim.Rotz = sw14.Currentangle
  151.     sw54Prim.Rotz = sw54.Currentangle
  152.     sw58Prim.Rotz = sw58.Currentangle
  153.  End Sub
  154.  
  155. 'Stern-Sega GI
  156. set GICallback = GetRef("UpdateGI")
  157.  
  158. Sub UpdateGI(no, Enabled)
  159.     If Enabled Then
  160.         DOF 101, DOFOn
  161.         dim xx
  162.         For each xx in GI:xx.State = 1: Next
  163.         PlaySound "fx_relay"
  164.     Else
  165.         DOF 101, DOFOff
  166.         For each xx in GI:xx.State = 0: Next
  167.         PlaySound "fx_relay"
  168.     End If
  169. End Sub
  170.  
  171. '**********************************************************************************************************
  172.  
  173. 'Initiate Table
  174. '**********************************************************************************************************
  175.  
  176.     Dim bsTrough, bsVUK, visibleLock, bsTEject, dtUDrop, dtLDrop, dtRDrop
  177.  
  178.   Sub Table1_Init
  179.     With Controller
  180.         .GameName = cGameName
  181.         If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  182.         .SplashInfoLine = "24"
  183.         .HandleKeyboard = 0
  184.         .ShowTitle = 0
  185.         .ShowDMDOnly = 1
  186.         .ShowFrame = 0
  187.         .HandleMechanics = 1
  188.         .Hidden = 0
  189.         On Error Resume Next
  190.         .Run GetPlayerHWnd
  191.         If Err Then MsgBox Err.Description
  192.     End With
  193.  
  194.     PinMAMETimer.Interval = PinMAMEInterval
  195.     PinMAMETimer.Enabled = 1
  196.     vpmNudge.TiltSwitch=-7
  197.     vpmNudge.Sensitivity=1
  198.     vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
  199.  
  200.     Set bsTrough = New cvpmBallStack
  201.         bsTrough.InitSw 0, 21, 20, 19, 18, 0, 0, 0
  202.         bsTrough.InitKick BallRelease, 90, 8
  203.         bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  204.         bsTrough.Balls = 4
  205.  
  206.     Set bsTEject = new cvpmBallStack
  207.         bsTEject.InitSaucer sw3, 3, 162, 15
  208.         bsTEject.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  209.  
  210.     Set visibleLock = New cvpmVLock
  211.     With visibleLock
  212.         .InitVLock Array(sw43,sw44,sw45),Array(k43, k44, k45), Array(43,44,45)
  213.         .InitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  214.         .ExitDir = 180
  215.         .ExitForce = 0
  216.         .createevents "visibleLock"
  217.     End With
  218.  
  219.      Set dtUDrop = new cvpmDropTarget
  220.          dtUDrop.Initdrop Array(Sw11,Sw13), Array(11,13)
  221.          dtUDrop.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  222.  
  223.      Set dtLDrop = new cvpmDropTarget
  224.          dtLDrop.Initdrop Array(sw60), Array(60)
  225.          dtLDrop.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  226.  
  227.      Set dtRDrop = new cvpmDropTarget
  228.          dtRDrop.Initdrop Array(sw61), Array(61)
  229.          dtRDrop.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  230.  
  231.     RampPost.Isdropped=true
  232.     RightPost.Isdropped=true
  233.     Post43.IsDropped=true
  234.     Post44.IsDropped=true
  235.     Post45.IsDropped=true
  236.     PostUp.Isdropped = 1
  237.  
  238.   End Sub
  239.  
  240. '**********************************************************************************************************
  241. 'Plunger code
  242. '**********************************************************************************************************
  243.  
  244. Sub Table1_KeyDown(ByVal Keycode)
  245.     If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull":Controller.Switch(11) = 0
  246.     If vpmKeyDown(keycode) Then Exit Sub
  247. End Sub
  248.  
  249. Sub Table1_KeyUp(ByVal keycode)
  250.     If vpmKeyUp(keycode) Then Exit Sub
  251.     If Keycode = StartGameKey Then Controller.Switch(16) = 0
  252.     If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  253. End Sub
  254.  
  255. 'Auto Plunger
  256. '**********************************************************************************************************
  257.  
  258.     Dim PlungerIM
  259.     Const IMPowerSetting = 40
  260.     Const IMTime = 0.6
  261.     Set plungerIM = New cvpmImpulseP
  262.     With plungerIM
  263.         .InitImpulseP swplunger, IMPowerSetting, IMTime
  264.         .Switch 23
  265.         .Random 1.5
  266.         .InitExitSnd "plunger2", "plunger"
  267.         .CreateEvents "plungerIM"
  268.     End With
  269.  
  270. '**********************************************************************************************************
  271.  
  272.  ' Drain hole and kickers
  273. Sub Drain_Hit:bsTrough.addball me : playsound"drain" : End Sub
  274. Sub sw3_Hit:bsTEject.addball 0 : playsound "popper_ball": End Sub
  275.  
  276. 'Drop Targets
  277.  Sub Sw11_Dropped:dtUDrop.Hit 1 :End Sub  
  278.  Sub Sw13_Dropped:dtUDrop.Hit 2 :End Sub
  279.  
  280.  Sub Sw60_Dropped:dtLDrop.Hit 1 :End Sub
  281.  
  282.  Sub Sw61_Dropped:dtRDrop.Hit 1 :End Sub
  283.  
  284. 'Wire Triggers
  285. Sub sw23_Hit:Controller.Switch(23)=1 : playsound"rollover" : End Sub
  286. Sub sw23_unHit:Controller.Switch(23)=0:End Sub
  287. Sub sw24_Hit:Controller.Switch(24)=1 : playsound"rollover" : End Sub
  288. Sub sw24_unHit:Controller.Switch(24)=0:End Sub
  289. Sub sw25_Hit:Controller.Switch(25)=1 : playsound"rollover" : End Sub
  290. Sub sw25_unHit:Controller.Switch(25)=0:End Sub
  291. Sub sw28_Hit:Controller.Switch(28)=1 : playsound"rollover" : End Sub
  292. Sub sw28_unHit:Controller.Switch(28)=0:End Sub
  293. Sub sw29_Hit:Controller.Switch(29)=1 : playsound"rollover" : End Sub
  294. Sub sw29_unHit:Controller.Switch(29)=0:End Sub
  295.  
  296. Sub sw46_Hit:Controller.Switch(46)=1 : playsound"rollover" : End Sub
  297. Sub sw46_unHit:Controller.Switch(46)=0:End Sub
  298. Sub sw55_Hit:Controller.Switch(55)=1 : playsound"rollover" : End Sub
  299. Sub sw55_unHit:Controller.Switch(55)=0:End Sub
  300. Sub sw56_Hit:Controller.Switch(56)=1 : playsound"rollover" : End Sub
  301. Sub sw56_unHit:Controller.Switch(56)=0:End Sub
  302. Sub sw57_Hit:Controller.Switch(57)=1 : playsound"rollover" : End Sub
  303. Sub sw57_unHit:Controller.Switch(57)=0:End Sub
  304.  
  305.  'Gate Triggers
  306. Sub sw14_hit:vpmTimer.pulseSw 14 : End Sub
  307. Sub sw54_hit:vpmTimer.pulseSw 54 : End Sub
  308. Sub sw58_hit:vpmTimer.pulseSw 58 : End Sub
  309.  
  310. 'Spinners
  311. Sub sw10_Spin:vpmTimer.PulseSw 10 : playsound"fx_spinner" : End Sub
  312.  
  313.  'Stand Up Targets
  314. Sub sw1_hit:vpmTimer.pulseSw 1 : End Sub
  315. Sub sw2_hit:vpmTimer.pulseSw 2 : End Sub
  316. Sub sw4_hit:vpmTimer.pulseSw 4 : End Sub
  317. Sub sw5_hit:vpmTimer.pulseSw 5 : End Sub
  318. Sub sw6_hit:vpmTimer.pulseSw 6 : End Sub
  319. Sub sw7_hit:vpmTimer.pulseSw 7 : End Sub
  320. Sub sw8_hit:vpmTimer.pulseSw 8 : End Sub
  321. Sub sw9_hit:vpmTimer.pulseSw 9 : End Sub
  322. Sub sw33_hit:vpmTimer.pulseSw 33 : End Sub
  323. Sub sw34_hit:vpmTimer.pulseSw 34 : End Sub
  324. Sub sw39_hit:vpmTimer.pulseSw 39 : End Sub
  325. Sub sw40_hit:vpmTimer.pulseSw 40 : End Sub
  326. Sub sw41_hit:vpmTimer.pulseSw 41 : End Sub
  327.  
  328. Sub sw62_Hit
  329.     If sniperstate = true Then
  330.         vpmTimer.PulseSw 62
  331.         SniperT.Enabled = 1
  332.     Else
  333.         vpmTimer.PulseSw 62
  334.     End If
  335. End Sub
  336.  
  337.  
  338. 'Bumpers
  339. Sub Bumper1_Hit : vpmTimer.PulseSw(30) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  340. Sub Bumper2_Hit : vpmTimer.PulseSw(31) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  341. Sub Bumper3_Hit : vpmTimer.PulseSw(32) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  342.  
  343. 'SuiteCase Lock buttons
  344. Sub sw43_Hit:Controller.Switch(43)=1:End Sub
  345. Sub sw43_unHit:Controller.Switch(43)=0:End Sub
  346. Sub sw44_Hit:Controller.Switch(44)=1:Post43.IsDropped=False:End Sub     'suitcase lock mid
  347. Sub sw44_unHit:Controller.Switch(44)=0:Post43.IsDropped=True:End Sub
  348. Sub sw45_Hit:Controller.Switch(45)=1:Post44.IsDropped=False:End Sub     'suitcase lock top
  349. Sub sw45_unHit:Controller.Switch(45)=0:Post44.IsDropped=True:End Sub
  350.  
  351. 'Generic Sounds
  352. Sub Trigger1_Hit: playsound"fx_ballrampdrop" : End Sub
  353. Sub Trigger2_Hit: playsound"fx_ballrampdrop" : End Sub
  354. Sub Trigger3_Hit: playsound"fx_ballrampdrop" : End Sub
  355.  
  356. Sub Trigger4_Hit: playsound"Wire Ramp" : End Sub
  357.  
  358. '*************************************************************
  359. 'Right Post
  360. '**********************************************************************************************************
  361.  
  362. sniperpostprim.RotAndTra5=-48
  363. Sub sniperpost(enabled)
  364.     if Enabled then
  365.        
  366.     RightPost.IsDropped=0
  367.     sniperup.Enabled=1
  368.     'UpdateGI 1, 0
  369.      else
  370.         sniperdown.Enabled=1
  371.         RightPost.IsDropped=1
  372.     'UpdateGI 1, 8
  373.      end if
  374.     End Sub
  375.  
  376. Dim STPos
  377. StPos=0
  378.  
  379.   Sub sniperup_Timer()
  380.      Select Case STPos 
  381.             Case 1:sniperpostprim.RotAndTra5=-48
  382.             Case 2:sniperpostprim.RotAndTra5=-38
  383.             Case 3:sniperpostprim.RotAndTra5=-28
  384.             Case 4:sniperpostprim.RotAndTra5=-18
  385.             Case 5:sniperpostprim.RotAndTra5=8
  386.             Case 6:sniperpostprim.RotAndTra5=0:sniperup.Enabled=0
  387. End Select
  388.  
  389.     If STpos<6 then STPos=STpos+1
  390.   End Sub
  391.  
  392.   Sub sniperdown_Timer()
  393.      Select Case STPos 
  394.  
  395.             Case 1:sniperpostprim.RotAndTra5=-48:sniperdown.Enabled=0
  396.             Case 2:sniperpostprim.RotAndTra5=-38
  397.             Case 3:sniperpostprim.RotAndTra5=-28
  398.             Case 4:sniperpostprim.RotAndTra5=-18
  399.             Case 5:sniperpostprim.RotAndTra5=8
  400.             Case 6:sniperpostprim.RotAndTra5=0
  401.     End Select
  402.     If STpos>0 Then STPos=STpos-1
  403.   End Sub
  404.  
  405. '*************************************************************
  406. 'Sniper
  407. '**********************************************************************************************************
  408.  
  409. Dim sniperstate
  410. sniperstate = False
  411. Sub SniperT_Timer()
  412.     If sniperstate = False then
  413.         If Sniper.rotandtra8 <= 95 then
  414.            Sniper.rotandtra8 = Sniper.rotandtra8 + 1
  415.         Else
  416.             SniperT.Enabled = False
  417.             sniperstate = True
  418.         End If
  419.     Else
  420.         If Sniper.rotandtra8 => 25 then
  421.            Sniper.rotandtra8 = Sniper.rotandtra8 - 1
  422.         Else
  423.             SniperT.Enabled = False
  424.             sniperstate = False
  425.         End If
  426.     End If
  427. End Sub
  428.  
  429. '*************************************************************
  430. 'SafeHouse
  431. '**********************************************************************************************************
  432.  
  433. Dim SafeRot:SafeRot = False
  434. Sub SafehouseT_Timer() 
  435.     If SafeRot = True and Safehouse.RotY >= 180 then
  436.         DOF 201, DOFOn
  437.         Safehouse.RotY = Safehouse.RotY - 3
  438.         DOF 201, DOFOff
  439.     End If
  440.     If SafeRot = False and Safehouse.RotY <= 270 then
  441.         DOF 201, DOFOn
  442.         Safehouse.RotY = Safehouse.RotY + 3
  443.         DOF 201, DOFOff
  444.     End If
  445.     If Safehouse.RotY = 180 then SafeRot = False   
  446. End Sub
  447.  
  448. '*************************************************************
  449. 'SuitCase
  450. '**********************************************************************************************************
  451.  
  452. Dim SuitRot:SuitRot = False
  453. Sub SuitcaseT_Timer()
  454.     If SuitRot = True and Suitcase.RotAndTra7 >= 320 then
  455.         DOF 201, DOFOn
  456.         Suitcase.RotAndTra7 = Suitcase.RotAndTra7 - 1
  457.         DOF 201, DOFOff
  458.     End If
  459.     If SuitRot = False and Suitcase.RotAndTra7 <= 358 then
  460.         DOF 201, DOFOn
  461.         Suitcase.RotAndTra7 = Suitcase.RotAndTra7 + 1
  462.         DOF 201, DOFOff
  463.     End If
  464.     If Suitcase.RotAndTra7 = 320 then SuitRot = False
  465. End Sub
  466.  
  467. '***************************************************
  468. '       JP's VP10 Fading Lamps & Flashers
  469. '       Based on PD's Fading Light System
  470. ' SetLamp 0 is Off
  471. ' SetLamp 1 is On
  472. ' fading for non opacity objects is 4 steps
  473. '***************************************************
  474.  
  475. Dim LampState(200), FadingLevel(200)
  476. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  477.  
  478. InitLamps()             ' turn off the lights and flashers and reset them to the default parameters
  479. LampTimer.Interval = 5 'lamp fading speed
  480. LampTimer.Enabled = 1
  481.  
  482. ' Lamp & Flasher Timers
  483.  
  484. Sub LampTimer_Timer()
  485.     Dim chgLamp, num, chg, ii
  486.     chgLamp = Controller.ChangedLamps
  487.     If Not IsEmpty(chgLamp) Then
  488.         For ii = 0 To UBound(chgLamp)
  489.             LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)       'keep the real state in an array
  490.             FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  491.         Next
  492.     End If
  493.     UpdateLamps
  494. End Sub
  495.  
  496.  Sub UpdateLamps()
  497.     NFadeL 3, l3
  498.     NFadeL 4, l4
  499.     NFadeL 5, l5
  500.     NFadeL 6, l6
  501.     NFadeL 7, l7
  502.     NFadeL 8, l8
  503.     NFadeL 10, l10
  504.     NFadeL 11, l11
  505.     NFadeL 12, l12
  506.     NFadeL 13, l13
  507.     NFadeL 17, l17
  508.     NFadeL 18, l18
  509.     NFadeL 19, l19
  510.     NFadeL 20, l20
  511.     NFadeL 21, l21
  512.     NFadeL 22, l22
  513.     NFadeL 23, l23
  514.     NFadeL 24, l24
  515.     NFadeL 25, l25
  516.     NFadeL 26, l26
  517.     NFadeL 27, l27
  518.     NFadeL 28, l28
  519.     NFadeL 29, l29
  520.     NFadeL 30, l30
  521.     NFadeL 31, l31
  522.     NFadeL 32, l32
  523.     NFadeL 33, l33
  524.     NFadeL 34, l34
  525.     NFadeL 35, l35
  526.     NFadeL 36, l36
  527.     NFadeL 37, l37
  528.     NFadeL 38, l38
  529.     NFadeL 39, l39
  530.     NFadeL 40, l40
  531.     NFadeL 41, l41
  532.     NFadeL 42, l42
  533.     NFadeL 43, l43
  534.     NFadeL 44, l44
  535.     NFadeL 45, l45
  536.     NFadeL 46, l46
  537.     NFadeL 47, l47
  538.     NFadeL 48, l48
  539.     NFadeL 49, l49
  540.     NFadeL 50, l50
  541.     NFadeL 51, l51
  542.     NFadeL 52, l52
  543.     NFadeL 53, l53
  544.     NFadeL 54, l54
  545.     NFadeL 55, l55
  546.     NFadeL 56, l56
  547.     NFadeL 57, l57
  548.     NFadeL 59, l59
  549.     NFadeLm 60, l60a 'left Bumper
  550.     NFadeL 60, l60 'left Bumper
  551.     NFadeL 61, l61 'right Bumper
  552.     NFadeLm 62, l62a 'bottom Bumper
  553.     NFadeL 62, l62 'bottom Bumper
  554.     NFadeL 63, l63
  555.     NFadeL 64, l64
  556.     NFadeL 65, l65
  557.     NFadeL 66, l66
  558.     NFadeL 67, l67
  559.     NFadeL 68, l68
  560.     NFadeL 69, l69
  561.     NFadeL 70, l70
  562.     NFadeL 71, l71
  563.     NFadeL 72, l72
  564.     NFadeL 73, l73
  565.     NFadeL 74, l74
  566.     NFadeL 75, l75
  567.     NFadeL 76, l76
  568.     NFadeL 77, l77
  569.     NFadeL 78, l78
  570.     NFadeL 79, l79
  571.     NFadeL 80, l80
  572.  
  573. 'Solenoid Controlled Flashers
  574.     NFadeObjm 119, Safehouse, "safehousetexture_ON", "safehousetexture"
  575.     NFadeLm 119, f119a 'safehouse
  576.     NFadeL 119, f119 'safehouse
  577.     NFadeObj 120, Sniper, "SniperTexture_ON", "SniperTexture"
  578.     NFadeL 126, f126 'PF light
  579.     NFadeObjm 127, l127, "flasher_red_on", "flasher_red"
  580.     NFadeL 127, f127 'right side red dome
  581.     NFadeObjm 127, l131, "flasher_orange_on", "flasher_orange"
  582.     NFadeObjm 127, l131a, "flasher_orange_on", "flasher_orange"
  583.     NFadeLm 131, f131 'orange flasher left sling
  584.     NFadeL 131, f131a 'orange flasher left sling
  585.     NFadeObjm 132, l132, "flasher_red_on", "flasher_red"
  586.     NFadeL 132, f132 'left red dome
  587. End Sub
  588.  
  589. ' div lamp subs
  590.  
  591. Sub InitLamps()
  592.     Dim x
  593.     For x = 0 to 200
  594.         LampState(x) = 0        ' current light state, independent of the fading level. 0 is off and 1 is on
  595.         FadingLevel(x) = 4      ' used to track the fading state
  596.         FlashSpeedUp(x) = 0.4   ' faster speed when turning on the flasher
  597.         FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  598.         FlashMax(x) = 1         ' the maximum value when on, usually 1
  599.         FlashMin(x) = 0         ' the minimum value when off, usually 0
  600.         FlashLevel(x) = 0       ' the intensity of the flashers, usually from 0 to 1
  601.     Next
  602. End Sub
  603.  
  604. Sub AllLampsOff
  605.     Dim x
  606.     For x = 0 to 200
  607.         SetLamp x, 0
  608.     Next
  609. End Sub
  610.  
  611. Sub SetLamp(nr, value)
  612.     If value <> LampState(nr) Then
  613.         LampState(nr) = abs(value)
  614.         FadingLevel(nr) = abs(value) + 4
  615.     End If
  616. End Sub
  617.  
  618. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  619.  
  620. Sub NFadeL(nr, object)
  621.     Select Case FadingLevel(nr)
  622.         Case 4:object.state = 0:FadingLevel(nr) = 0
  623.         Case 5:object.state = 1:FadingLevel(nr) = 1
  624.     End Select
  625. End Sub
  626.  
  627. Sub NFadeLm(nr, object) ' used for multiple lights
  628.     Select Case FadingLevel(nr)
  629.         Case 4:object.state = 0
  630.         Case 5:object.state = 1
  631.     End Select
  632. End Sub
  633.  
  634. 'Lights, Ramps & Primitives used as 4 step fading lights
  635. 'a,b,c,d are the images used from on to off
  636.  
  637. Sub FadeObj(nr, object, a, b, c, d)
  638.     Select Case FadingLevel(nr)
  639.         Case 4:object.image = b:FadingLevel(nr) = 6                   'fading to off...
  640.         Case 5:object.image = a:FadingLevel(nr) = 1                   'ON
  641.         Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1             'wait
  642.         Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  643.         Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1         'wait
  644.         Case 13:object.image = d:FadingLevel(nr) = 0                  'Off
  645.     End Select
  646. End Sub
  647.  
  648. Sub FadeObjm(nr, object, a, b, c, d)
  649.     Select Case FadingLevel(nr)
  650.         Case 4:object.image = b
  651.         Case 5:object.image = a
  652.         Case 9:object.image = c
  653.         Case 13:object.image = d
  654.     End Select
  655. End Sub
  656.  
  657. Sub NFadeObj(nr, object, a, b)
  658.     Select Case FadingLevel(nr)
  659.         Case 4:object.image = b:FadingLevel(nr) = 0 'off
  660.         Case 5:object.image = a:FadingLevel(nr) = 1 'on
  661.     End Select
  662. End Sub
  663.  
  664. Sub NFadeObjm(nr, object, a, b)
  665.     Select Case FadingLevel(nr)
  666.         Case 4:object.image = b
  667.         Case 5:object.image = a
  668.     End Select
  669. End Sub
  670.  
  671. ' Flasher objects
  672.  
  673. Sub Flash(nr, object)
  674.     Select Case FadingLevel(nr)
  675.         Case 4 'off
  676.             FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  677.             If FlashLevel(nr) < FlashMin(nr) Then
  678.                 FlashLevel(nr) = FlashMin(nr)
  679.                 FadingLevel(nr) = 0 'completely off
  680.             End if
  681.             Object.IntensityScale = FlashLevel(nr)
  682.         Case 5 ' on
  683.             FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  684.             If FlashLevel(nr) > FlashMax(nr) Then
  685.                 FlashLevel(nr) = FlashMax(nr)
  686.                 FadingLevel(nr) = 1 'completely on
  687.             End if
  688.             Object.IntensityScale = FlashLevel(nr)
  689.     End Select
  690. End Sub
  691.  
  692. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  693.     Object.IntensityScale = FlashLevel(nr)
  694. End Sub
  695.  
  696. '**********************************************************************************************************
  697. '**********************************************************************************************************
  698. '   Start of VPX functions
  699. '**********************************************************************************************************
  700. '**********************************************************************************************************
  701.  
  702. '**********Sling Shot Animations
  703. ' Rstep and Lstep  are the variables that increment the animation
  704. '****************
  705. Dim RStep, Lstep
  706.  
  707. Sub RightSlingShot_Slingshot
  708.     vpmTimer.PulseSw 27
  709.     PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  710.     RSling.Visible = 0
  711.     RSling1.Visible = 1
  712.     sling1.TransZ = -20
  713.     RStep = 0
  714.     RightSlingShot.TimerEnabled = 1
  715. End Sub
  716.  
  717. Sub RightSlingShot_Timer
  718.     Select Case RStep
  719.         Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  720.         Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  721.     End Select
  722.     RStep = RStep + 1
  723. End Sub
  724.  
  725. Sub LeftSlingShot_Slingshot
  726.     vpmTimer.PulseSw 26
  727.     PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  728.     LSling.Visible = 0
  729.     LSling1.Visible = 1
  730.     sling2.TransZ = -20
  731.     LStep = 0
  732.     LeftSlingShot.TimerEnabled = 1
  733. End Sub
  734.  
  735. Sub LeftSlingShot_Timer
  736.     Select Case LStep
  737.         Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  738.         Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  739.     End Select
  740.     LStep = LStep + 1
  741. End Sub
  742.  
  743.  
  744. ' *********************************************************************
  745. '                      Supporting Ball & Sound Functions
  746. ' *********************************************************************
  747.  
  748. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  749.     Vol = Csng(BallVel(ball) ^2 / 2000)
  750. End Function
  751.  
  752. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  753.     Dim tmp
  754.     tmp = ball.x * 2 / table1.width-1
  755.     If tmp > 0 Then
  756.         Pan = Csng(tmp ^10)
  757.     Else
  758.         Pan = Csng(-((- tmp) ^10) )
  759.     End If
  760. End Function
  761.  
  762. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  763.     Pitch = BallVel(ball) * 20
  764. End Function
  765.  
  766. Function BallVel(ball) 'Calculates the ball speed
  767.     BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  768. End Function
  769.  
  770. '*****************************************
  771. '      JP's VP10 Rolling Sounds
  772. '*****************************************
  773.  
  774. Const tnob = 5 ' total number of balls
  775. ReDim rolling(tnob)
  776. InitRolling
  777.  
  778. Sub InitRolling
  779.     Dim i
  780.     For i = 0 to tnob
  781.         rolling(i) = False
  782.     Next
  783. End Sub
  784.  
  785. Sub RollingTimer_Timer()
  786.     Dim BOT, b
  787.     BOT = GetBalls
  788.  
  789.     ' stop the sound of deleted balls
  790.     For b = UBound(BOT) + 1 to tnob
  791.         rolling(b) = False
  792.         StopSound("fx_ballrolling" & b)
  793.     Next
  794.  
  795.     ' exit the sub if no balls on the table
  796.     If UBound(BOT) = -1 Then Exit Sub
  797.  
  798.     ' play the rolling sound for each ball
  799.     For b = 0 to UBound(BOT)
  800.         If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  801.             rolling(b) = True
  802.             PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  803.         Else
  804.             If rolling(b) = True Then
  805.                 StopSound("fx_ballrolling" & b)
  806.                 rolling(b) = False
  807.             End If
  808.         End If
  809.     Next
  810. End Sub
  811.  
  812. '**********************
  813. ' Ball Collision Sound
  814. '**********************
  815.  
  816. Sub OnBallBallCollision(ball1, ball2, velocity)
  817.     PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  818. End Sub
  819.  
  820.  
  821.  
  822. '************************************
  823. ' What you need to add to your table
  824. '************************************
  825.  
  826. ' a timer called RollingTimer. With a fast interval, like 10
  827. ' one collision sound, in this script is called fx_collide
  828. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  829. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  830.  
  831.  
  832. '******************************************
  833. ' Explanation of the rolling sound routine
  834. '******************************************
  835.  
  836. ' sounds are played based on the ball speed and position
  837.  
  838. ' the routine checks first for deleted balls and stops the rolling sound.
  839.  
  840. ' The For loop goes through all the balls on the table and checks for the ball speed and
  841. ' if the ball is on the table (height lower than 30) then then it plays the sound
  842. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  843.  
  844. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  845. ' will change according to the ball speed, and the PAN function will change the stereo position according
  846. ' to the position of the ball on the table.
  847.  
  848.  
  849. '**************************************
  850. ' Explanation of the collision routine
  851. '**************************************
  852.  
  853. ' The collision is built in VP.
  854. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  855. ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
  856. ' depending of the speed of the collision.
  857.  
  858.  
  859. Sub Pins_Hit (idx)
  860.     PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  861. End Sub
  862.  
  863. Sub Targets_Hit (idx)
  864.     PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  865. End Sub
  866.  
  867. Sub Metals_Thin_Hit (idx)
  868.     PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  869. End Sub
  870.  
  871. Sub Metals_Medium_Hit (idx)
  872.     PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  873. End Sub
  874.  
  875. Sub Metals2_Hit (idx)
  876.     PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  877. End Sub
  878.  
  879. Sub Gates_Hit (idx)
  880.     PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  881. End Sub
  882.  
  883. Sub Spinner_Spin
  884.     PlaySound "fx_spinner",0,.25,0,0.25
  885. End Sub
  886.  
  887. Sub Rubbers_Hit(idx)
  888.     dim finalspeed
  889.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  890.     If finalspeed > 20 then
  891.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  892.     End if
  893.     If finalspeed >= 6 AND finalspeed <= 20 then
  894.         RandomSoundRubber()
  895.     End If
  896. End Sub
  897.  
  898. Sub Posts_Hit(idx)
  899.     dim finalspeed
  900.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  901.     If finalspeed > 16 then
  902.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  903.     End if
  904.     If finalspeed >= 6 AND finalspeed <= 16 then
  905.         RandomSoundRubber()
  906.     End If
  907. End Sub
  908.  
  909. Sub RandomSoundRubber()
  910.     Select Case Int(Rnd*3)+1
  911.         Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  912.         Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  913.         Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  914.     End Select
  915. End Sub
  916.  
  917. Sub LeftFlipper_Collide(parm)
  918.     RandomSoundFlipper()
  919. End Sub
  920.  
  921. Sub RightFlipper_Collide(parm)
  922.     RandomSoundFlipper()
  923. End Sub
  924.  
  925. Sub RandomSoundFlipper()
  926.     Select Case Int(Rnd*3)+1
  927.         Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  928.         Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  929.         Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  930.     End Select
  931. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top