Guest User

Untitled

a guest
Aug 17th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.06 KB | None | 0 0
  1. ' Indiana Jones: The Pinball Adventure / IPD No. 1267 / August, 1993 / 4 Players
  2. ' Thanks to destruk for previous code.
  3. ' Thanks to knorr and clark kent for the help and the resources.
  4. ' Thanks to flupper for bumper caps, flasher domes models.
  5. ' Thanks to RustyCardores for SSF
  6. ' Thanks to VP Dev team for the freaking amazing VPX!
  7.  
  8. Option Explicit
  9. Randomize
  10.  
  11. '************************************************************************
  12. ' Table options
  13. '************************************************************************
  14. Const BlimpToy = 0 'Shows a Custom Nazi Blimp Toy
  15. Const PropellerMod = 0 'Animate Bi-Plane Propeller when making left ramp (0= no, 1= yes)
  16. Const InstrCardType = 0 'Instruction Cards Type (0= original, 1= custom, 2 = random)
  17. Const FlipperType = 2 'Flippers Type (0= red rubber, 1= black rubber, 2 = random)
  18. Const TargetDecals = 0 'Shows Custom Target Decals (0= no, 1= yes)
  19. Const SideCabDecals = 0 'Shows Custom Cabinet Decals (0= no, 1= yes)
  20. '************************************************************************
  21. ' End of table options
  22. '************************************************************************
  23.  
  24. Const BallSize = 52
  25. Const BallMass = 1.6
  26.  
  27. On Error Resume Next
  28. ExecuteGlobal GetTextFile("controller.vbs")
  29. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  30. On Error Goto 0
  31.  
  32. Dim DesktopMode:DesktopMode = Table1.ShowDT
  33. Dim UseVPMDMD:UseVPMDMD = DesktopMode
  34. Const UseVPMModSol = 1
  35.  
  36. LoadVPM "02800000", "WPC.VBS", 3.55
  37.  
  38. '************************************
  39. '******* Standard definitions *******
  40. '************************************
  41. ' Rom Name
  42. Const cGameName = "ij_l7"
  43.  
  44. ' Standard Options
  45. Const UseSolenoids = 2
  46. Const UseLamps = 1
  47. Const UseSync = 1
  48. Const HandleMech = 0
  49.  
  50. ' IJ Specific Option
  51. NoUpperLeftFlipper
  52. NoUpperRightFlipper
  53. Const cSingleLFlip = 0
  54. Const cSingleRFlip = 0
  55.  
  56. keyStagedFlipperL=""
  57. keyStagedFlipperR=""
  58.  
  59. ' Standard Sounds
  60. Const SSolenoidOn = "fx_Solenoid"
  61. Const SSolenoidOff = ""
  62. Const SCoin = "fx_Coin"
  63.  
  64. '************************************************************************
  65. ' Solenoids map
  66. '************************************************************************
  67.  
  68. '(*) handled by cvpmMech
  69.  
  70. SolCallback(1)="bsPopper.SolOut" 'BallPopper
  71. SolCallback(2)="AutoPlunger" 'BallLaunch
  72. SolCallback(3)="dtTotem.SolDropUp" 'TotemDropUp
  73. SolCallback(4)="SolBallRelease" 'BallRelease
  74. SolCallback(5)="dtBank.SolDropUp" 'CenterDropUp
  75. SolCallback(6)="SolIdol" 'IdolRelease
  76. SolCallback(7)="vpmSolSound SoundFX(""fx_Knocker"",DOFKnocker)," 'Knocker
  77. SolCallback(8)="bsLEject.SolOut" 'Left Eject
  78. SolCallback(9)="vpmSolSound SoundFX(""LeftJetNOTUSED"",DOFContactors)," 'Left Bumper
  79. SolCallback(10)="vpmSolSound SoundFX(""RightJetNOTUSED"",DOFContactors)," 'Right Bumper
  80. SolCallback(11)="vpmSolSound SoundFX(""BottomJetNOTUSED"",DOFContactors)," 'Bottom Bumper
  81. SolCallback(12)="vpmSolSound SoundFX(""RightSlingShot"",DOFContactors)," 'Right Sling
  82. SolCallback(13)="vpmSolSound SoundFX(""LeftSlingShot"",DOFContactors)," 'Left Sling
  83. SolCallback(14)="vpmSolGate LeftGate,SoundFX(""DiverterOn"",DOFContactors)," 'Left ControlGate
  84. SolCallback(15)="vpmSolGate RightGate,SoundFX(""DiverterOn"",DOFContactors)," 'Right ControlGate
  85. SolCallback(16)="dtTotem.SolDropDown" 'TotemDropDown
  86. SolCallback(17)="SetLamp 17," 'Insert:Eternal Life
  87. SolModCallback(18)="SetModLamp 18," 'Flasher:Light JackPot
  88. SolCallback(19)="SetLamp 19," 'Insert:Super Jackpot
  89. SolModCallback(20)="SetModLamp 20," 'Flasher:JackPot
  90. SolModCallback(21)="SetModLamp 21," 'Flasher:Path of Adventure
  91. SolCallback(22)="PoAMoveLeft" 'L_PoA (*)
  92. SolCallback(23)="PoAMoveRight" 'R_PoA (*)
  93. SolModCallback(24)="SetModLamp 24," 'Flasher:Plane Gun LEDS
  94. SolCallback(25)="SetLamp 25," 'Insert:Dogfight Hurry up
  95. SolModCallback(26)="SetModLamp 26," 'Flasher:Right Ramp (x3)
  96. SolModCallback(27)="SetModLamp 27," 'Flasher:Left Ramp
  97. SolCallback(28)="bsSubway.SolOut" 'SubwayRelease
  98.  
  99.  
  100. SolCallback(33)="SolDivPower" 'DivPower
  101. SolCallback(34)="SolDivHold" 'DivHold
  102. SolCallback(35)="SolTopPostPower" 'TopPostPower
  103. SolCallback(36)="SolTopPostHold" 'TopPostHold
  104.  
  105. SolModCallback(51)="SetModLamp 51," 'Flasher:Left Side (x2)
  106. SolModCallback(52)="SetModLamp 52," 'Flasher:Right Side (x2)
  107. SolCallback(53)="SetLamp 53," 'Insert:Special (x2)
  108. SolCallback(54)="SetLamp 54," 'Insert:Totem Multi
  109. SolModCallback(55)="SetModLamp 55," 'Flasher:Jackpot Multi
  110. SolCallback(56)="SolMoveIdol" 'Idol Motor
  111.  
  112. SolCallback(sLLFlipper) = "SolLFlipper"
  113. SolCallback(sLRFlipper) = "SolRFlipper"
  114.  
  115. '************************************************************************
  116. ' Table Init
  117. '************************************************************************
  118.  
  119. Dim bsTrough, bsLEject, bsSubway, bsPopper, bsIdol, dtTotem, dtBank, PoAMech
  120.  
  121. Sub Table1_Init
  122. vpmInit Me
  123. With Controller
  124. .GameName = cGameName
  125. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  126. .SplashInfoLine = "Indiana Jones - The Pinball Adventure (Williams 1993)"
  127. .HandleKeyboard = 0
  128. .ShowTitle = 0
  129. .ShowDMDOnly = 1
  130. .ShowFrame = 0
  131. .HandleMechanics = 0
  132. .Hidden = DesktopMode
  133. On Error Resume Next
  134. .Run GetPlayerHWnd
  135. If Err Then MsgBox Err.Description
  136. On Error Goto 0
  137. .DIP(0)=&H00 'set dipswitch to USA
  138. .Switch(22) = 1 'close coin door
  139. .Switch(24) = 0 'always closed
  140. End With
  141.  
  142. ' Main Timer init
  143. PinMAMETimer.Interval = PinMAMEInterval
  144. PinMAMETimer.Enabled = 1
  145.  
  146. ' Nudging
  147. vpmNudge.TiltSwitch = 14
  148. vpmNudge.Sensitivity = 3
  149. vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot)
  150.  
  151. 'Trough
  152. Set bsTrough = New cvpmTrough
  153. With bsTrough
  154. .Size = 6
  155. .InitSwitches Array(86, 85, 84, 83, 82, 81)
  156. .InitExit BallRelease, 70, 15
  157. .InitEntrySounds "fx_drain", SoundFX(SSolenoidOn,DOFContactors), SoundFX(SSolenoidOn,DOFContactors)
  158. .InitExitSounds SoundFX(SSolenoidOn,DOFContactors), SoundFX("BallRelease",DOFContactors)
  159. .Balls = 6
  160. End With
  161.  
  162. 'Left Eject
  163. Set bsLEject = new cvpmSaucer
  164. With bsLEject
  165. .InitKicker Sw31, 31, 170, 12, 0
  166. .InitSounds "fx_saucerHit", SoundFX("LeftEject",DOFContactors), SoundFX("LeftEject",DOFContactors)
  167. ' .CreateEvents "bsLEject", Sw31
  168. End With
  169.  
  170. 'Subway Eject
  171. Set bsSubway = new cvpmSaucer
  172. With bsSubway
  173. .InitKicker sw47, 47, 90, 10, 0
  174. .InitSounds "", SoundFX("SubWayRelease",DOFContactors), SoundFX("SubWayRelease",DOFContactors)
  175. .CreateEvents "bsSubway", Sw47
  176. End With
  177.  
  178. 'Subway Popper Eject
  179. Set bsPopper = new cvpmSaucer
  180. With bsPopper
  181. .InitKicker Sw44, 44, 0, 32, 1.56
  182. .InitSounds "", SoundFX("Ball Popper",DOFContactors), SoundFX("Ball Popper",DOFContactors)
  183. .CreateEvents "bsPopper", Sw44
  184. End With
  185.  
  186. 'Idol Eject
  187. Set bsIdol = New cvpmTrough
  188. With bsIdol
  189. .Size = 3
  190. .InitSwitches Array(0, 0, 0)
  191. .InitExit IdolExit, 180, 0
  192. .Balls = 0
  193. .CreateEvents "bsIdol", IdolEnter
  194. End With
  195.  
  196. 'Totem Drop Target
  197. Set dtTotem = New cvpmDropTarget
  198. With dtTotem
  199. .InitDrop sw11, 11
  200. .Initsnd SoundFX("",DOFDropTargets), SoundFX("TotemDropUp",DOFDropTargets)
  201. End With
  202.  
  203. '3-bank Drop Target
  204. Set dtBank = New cvpmDropTarget
  205. With dtBank
  206. .InitDrop Array(sw115,sw116,sw117), Array(115,116,117)
  207. .Initsnd SoundFX("",DOFDropTargets), SoundFX("CenterDropBankUp",DOFDropTargets)
  208. ' .Initsnd SoundFX("CenterDropBankDown",DOFDropTargets), SoundFX("CenterDropBankUp",DOFDropTargets)
  209. End With
  210.  
  211. 'Path of Adventure
  212. Set POAMech=New cvpmMech
  213. With POAMech
  214. .MType = vpmMechTwoDirSol + vpmMechStopEnd + vpmMechLinear
  215. .Sol1=23
  216. .Sol2=22
  217. .Length=9
  218. .Steps=9
  219. .AddSw 124,0,0
  220. .AddSw 125,8,8
  221. .CallBack=GetRef("UpdatePoA")
  222. .ACC=1
  223. .RET=1
  224. .Start
  225. End With
  226.  
  227. 'Init Captive Ball
  228. CapKicker.CreateSizedBallWithMass Ballsize/2, BallMass:CapKicker.kick 0,0 :CapKicker.enabled=0
  229.  
  230. 'Other Suff
  231. InitPoA:InitIdol:InitLamps:InitRolling:InitOptions
  232. DiverterOn.IsDropped=1
  233. End Sub
  234.  
  235. '************************************************************************
  236. ' Keys
  237. '************************************************************************
  238.  
  239. Sub Table1_KeyDown(ByVal Keycode)
  240. If Keycode= keyFront Then Controller.Switch(12)=1 'buy-in
  241. If keycode = PlungerKey Then Controller.Switch(34) = 1
  242. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge",0)
  243. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge",0)
  244. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge",0)
  245. If vpmKeyDown(keycode) Then Exit Sub
  246. End Sub
  247.  
  248. Sub Table1_KeyUp(ByVal Keycode)
  249. If Keycode = keyFront Then Controller.Switch(12)=0 'buy-in
  250. If keycode = PlungerKey Then Controller.Switch(34) = 0
  251. If vpmKeyUp(keycode) Then Exit Sub
  252. End Sub
  253.  
  254. Sub Table1_Paused:Controller.Pause = True:End Sub
  255. Sub Table1_unPaused:Controller.Pause = False:End Sub
  256. Sub Table1_exit():Controller.Pause = False:Controller.Stop:End Sub
  257.  
  258. '************************************************************************
  259. ' Solenoids
  260. '************************************************************************
  261.  
  262. '*********** Flippers
  263. Sub SolLFlipper(Enabled)
  264. If Enabled AND BSTrough.Balls < 6 Then
  265. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers),LeftFlipper
  266. LeftFlipper.RotateToEnd
  267. Else
  268. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers),LeftFlipper
  269. LeftFlipper.RotateToStart
  270. End If
  271. End Sub
  272.  
  273. Sub SolRFlipper(Enabled)
  274. If Enabled AND BSTrough.Balls < 6 Then
  275. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers),RightFlipper
  276. RightFlipper.RotateToEnd
  277. Else
  278. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers),RightFlipper
  279. RightFlipper.RotateToStart
  280. End If
  281. End Sub
  282.  
  283. '*********** AutoPlunger
  284. Sub AutoPlunger(Enabled)
  285. If Enabled Then
  286. Plunger.Fire
  287. PlaySoundAt SoundFX("Autoplunger",DOFContactors),Plunger
  288. End If
  289. End Sub
  290.  
  291. '*********** BallRelease
  292. Sub SolBallRelease(Enabled)
  293. If Enabled Then
  294. bsTrough.ExitSol_On
  295. If bsTrough.Balls Then vpmTimer.PulseSw 87
  296. End If
  297. End Sub
  298.  
  299. '*********** Diverter
  300. Dim DiverterDir
  301.  
  302. Sub SolDivPower(Enabled)
  303. If Enabled Then
  304. DiverterOff.IsDropped=1
  305. DiverterOn.IsDropped=0
  306. DiverterDir = 1
  307. Diverter.Interval = 5:Diverter.Enabled = 1
  308. PlaySoundAt SoundFX("DiverterOn",DOFContactors),DiverterP
  309. End If
  310. End Sub
  311.  
  312. Sub SolDivHold(Enabled)
  313. If NOT Enabled AND DiverterDir = 1 Then
  314. DiverterOff.IsDropped=0
  315. DiverterOn.IsDropped=1
  316. DiverterDir = -1
  317. Diverter.Interval = 5:Diverter.Enabled = 1
  318. PlaySoundAt SoundFX("DiverterOff",DOFContactors),DiverterP
  319. End If
  320. End Sub
  321.  
  322. Sub Diverter_Timer()
  323. DiverterP.RotZ=DiverterP.RotZ+DiverterDir
  324. If DiverterP.RotZ>2 AND DiverterDir=1 Then Me.Enabled=0:DiverterP.RotZ=2
  325. If DiverterP.RotZ<-30 AND DiverterDir=-1 Then Me.Enabled=0:DiverterP.RotZ=-30
  326. End Sub
  327.  
  328. '*********** Idol Motorized Toy
  329. Dim IdolPos, Ipos, IW
  330.  
  331. Sub InitIdol
  332. Controller.Switch(121)=1:Controller.Switch(122)=0:Controller.Switch(123)=0
  333. End Sub
  334.  
  335. Sub SolMoveIdol(enabled)
  336. If Enabled Then
  337. UpdateIdol.enabled = True
  338. DOF 102, DOFOn
  339. PlaySoundAt SoundFX("IdolMotor",DOFGear),IdolEnter
  340. Else
  341. UpdateIdol.enabled = False
  342. ResetIdol.enabled = True
  343. End If
  344. End Sub
  345.  
  346. Sub UpdateIdol_timer
  347. ResetIdol.Enabled = False
  348. IdolPos=(IdolPos+1)Mod 360
  349. totem.rotz= -IdolPos:totem1.rotz = totem.rotz
  350. Select Case IdolPos '91 '92 '93
  351. Case 0:Controller.Switch(122)=0:IPos=0 'Pos 1 1 0 0
  352. Case 60:Controller.Switch(123)=1:IPos=1 'Pos 2 1 0 1
  353. Case 120:Controller.Switch(121)=0:IPos=2 'Pos 3 0 0 1
  354. Case 180:Controller.Switch(122)=1:IPos=3 'Pos 4 0 1 1
  355. Case 240:Controller.Switch(123)=0:IPos=4 'Pos 5 0 1 0
  356. Case 300:Controller.Switch(121)=1:IPos=5 'Pos 6 1 1 0
  357. End Select
  358. End Sub
  359.  
  360. Sub ResetIdol_timer
  361. If totem.rotz< -60 * Ipos Then totem.rotz = totem.rotz + 1:totem1.rotz = totem.rotz
  362. If totem.rotz = -60 * Ipos Then Me.Enabled=0:IdolPos=-totem.rotz:StopSound "IdolMotor":DOF 102, DOFOff
  363. End Sub
  364.  
  365. '*********** Idol Kickout
  366. Sub SolIdol(Enabled)
  367. If Enabled Then
  368. IdolStop.IsDropped=1:LockDoor1.Z=-55:LockDoor2.Z=-55:LockDoor3.Z=-55:PlaysoundAt SoundFX("IdolReleaseOn",DOFContactors),IdolExit:bsIdol.ExitSol_On
  369. Else
  370. IdolStop.IsDropped=0:LockDoor1.Z=0:LockDoor2.Z=0:LockDoor3.Z=0:PlaysoundAt SoundFX("IdolReleaseOff",DOFContactors),IdolExit
  371. End If
  372. End Sub
  373.  
  374. '*********** Path Of Adventure
  375. Dim movePoA,PoAPos,PoADropTrack,MyBall,Ballspeed
  376.  
  377. Sub InitPoA
  378. PoADropTrack=0:PoaPos=0:Ballspeed=0:TopPost.Z=0
  379. Controller.Switch (124) = 0 : Controller.Switch (125) = 0
  380. End Sub
  381.  
  382. Sub PoaMoveLeft(enabled)
  383. If enabled then
  384. movePoA=0
  385. Else
  386. ResetPoA.Enabled = 1
  387. End If
  388. End Sub
  389.  
  390. Sub PoAMoveRight(enabled)
  391. If Enabled Then
  392. movePoA=0
  393. Else
  394. ResetPoA.Enabled = 1
  395. End If
  396. End Sub
  397.  
  398. Sub ResetPoA_timer
  399. Dim ii
  400. movePoA=movePoA+1
  401. If NOT Controller.Switch (124) AND NOT Controller.Switch (125) AND movePoA > 50 AND NOT PoAPos=0 Then
  402. PoAPos = 0: Me.Enabled=0
  403. minipf.roty=PoAPos:minipf1.roty=PoAPos:minipf2.roty=PoAPos:minipf3.roty=PoAPos:minipf4.roty=PoAPos:minipf5.roty=PoAPos:minipf_screws.roty=-PoAPos
  404. li71.rotY=PoAPos:li72.rotY=PoAPos:li73.rotY=PoAPos:li74.rotY=PoAPos:li75.rotY=PoAPos
  405. li81.rotY=PoAPos:li82.rotY=PoAPos:li83.rotY=PoAPos:li84.rotY=PoAPos:li85.rotY=PoAPos
  406. sw65p.roty=PoAPos:sw66p.rotY=PoAPos:sw67p.rotY=PoAPos:sw68p.rotY=PoAPos
  407. sw75p.roty=PoAPos:sw76p.rotY=PoAPos:sw77p.rotY=PoAPos:sw78p.rotY=PoAPos
  408. For each ii in GIPOA:ii.rotY=PoAPos:Next
  409. End If
  410. End Sub
  411.  
  412. Sub UpdatePOA(oldPos,newPos,aspeed)
  413. Dim ii
  414. PoAPos=2*(POAMech.Position-4)
  415. minipf.roty=PoAPos:minipf1.roty=PoAPos:minipf2.roty=PoAPos:minipf3.roty=PoAPos:minipf4.roty=PoAPos:minipf5.roty=PoAPos:minipf_screws.roty=PoAPos:POASh.transX=PoaPos
  416. li71.rotY=PoAPos:li72.rotY=PoAPos:li73.rotY=PoAPos:li74.rotY=PoAPos:li75.rotY=PoAPos
  417. li81.rotY=PoAPos:li82.rotY=PoAPos:li83.rotY=PoAPos:li84.rotY=PoAPos:li85.rotY=PoAPos
  418. sw65p.roty=PoAPos:sw66p.rotY=PoAPos:sw67p.rotY=PoAPos:sw68p.rotY=PoAPos
  419. sw75p.roty=PoAPos:sw76p.rotY=PoAPos:sw77p.rotY=PoAPos:sw78p.rotY=PoAPos
  420. For each ii in GIPOA:ii.rotY=PoAPos:Next
  421. End Sub
  422.  
  423. Sub EnterPoA_hit:Me.TimerInterval=10:Me.TimerEnabled=1:Playsound "fx_balldrop",0,1,-.2,0,0,1,0,-.8:POABallShadow.visible=1:End Sub
  424. Sub EnterPoA_timer
  425. If NOT IsEmpty (myball) Then
  426. myball.velx = myball.velx + 0.5 * Sgn(PoAPos)
  427. If myball.VelY<0 Then myball.VelY=1
  428. POABallShadow.X = (myball.X - (Ballsize/6) + ((myball.X - (Table1.Width/2))/7)) + 10
  429. POABallShadow.Y = myball.Y + 20
  430. POABallShadow.Z = 156
  431. End If
  432. End Sub
  433.  
  434. Sub ExitPoA_hit:myball=empty:EnterPOA.TimerEnabled=0:Me.TimerInterval=100:Me.TimerEnabled=1:End Sub
  435. Sub ExitPoA_timer:Me.TimerEnabled=0:Playsound "fx_ramp_metal",0,1,-.2,0,0,1,0,-.8:POABallShadow.visible=0:POABallShadow.X=182:POABallShadow.Y=130:End Sub
  436.  
  437. Sub ExitBridge_hit:myball=empty:EnterPOA.TimerEnabled=0:PlaysoundAt "fx_ramp_turn",ExitBridge:End Sub
  438.  
  439. '*********** Top Post
  440. Sub SolTopPostPower(Enabled)
  441. If Enabled Then
  442. If POADropTrack=1 Then Enabled=0
  443. DropPoA.IsDropped=1
  444. sw46.Kick 270,5
  445. TopPost.Z=-30
  446. If POADropTrack=0 Then PlaysoundAt SoundFX("TopPostDown",DOFContactors),TopPost
  447. Else
  448. DropPoA.IsDropped=0
  449. TopPost.Z=-30
  450. If POADropTrack=0 Then DivHelp.TimerInterval=400:DivHelp.TimerEnabled=1
  451. End If
  452. End Sub
  453.  
  454. Sub SolTopPostHold(Enabled)
  455. If Enabled Then
  456. POADropTrack=1
  457. DivHelp.IsDropped=1
  458. DropPoA.IsDropped=0
  459. TopPost.Z=-30:PlaysoundAt SoundFX("TopPostDown",DOFContactors),TopPost
  460. Else
  461. DivHelp.TimerInterval=400
  462. DivHelp.TimerEnabled=1
  463. End If
  464. End Sub
  465.  
  466. Sub DivHelp_timer
  467. Me.TimerEnabled=0
  468. POADropTrack=0
  469. DivHelp.IsDropped=0
  470. TopPost.Z=0:PlaysoundAt SoundFX("TopPostUp",DOFContactors),TopPost
  471. End Sub
  472.  
  473. Sub sw46_Hit()
  474. Set myball=ActiveBall
  475. BallSpeed=myBall.VelX
  476. If POADropTrack = 0 Then StopSound "fx_ramp_enter3"
  477. If POADropTrack = 1 Then sw46.Kick 270,ABS(Ballspeed)
  478. Controller.Switch(46)=1
  479. End Sub
  480.  
  481. Sub sw46_UnHit():Controller.Switch(46) = 0:End Sub
  482.  
  483. Sub sw31_hit()
  484. debug.print "sw31hit"
  485. vpmFlips.Enabled = false
  486. bsLEject.AddBall Me
  487. end sub
  488.  
  489. sub sw31_unhit()
  490. vpmFlips.Enabled = true
  491. debug.print "sw31unhit"
  492. end sub
  493.  
  494. '************************************************************************
  495. ' Switches
  496. '************************************************************************
  497.  
  498. Sub Drain_hit
  499. bsTrough.AddBall Me
  500. Dim BOT:BOT=GetBalls
  501. If Ubound(BOT)=0 Then LeftFlipper.RotateToStart:RightFlipper.RotateToStart
  502. End Sub
  503.  
  504. '*********** Drop Targets
  505. Sub sw11_dropped:dtTotem.Hit 1:End Sub
  506.  
  507. Sub sw115_dropped:dtBank.Hit 1:End Sub
  508. Sub sw116_dropped:dtBank.Hit 2:End Sub
  509. Sub sw117_dropped:dtBank.Hit 3:End Sub
  510.  
  511. Sub sw11_hit:PlaysoundAtVol "DropTargetHit",sw11,.8:PlaySoundAtVol "TotemDropDown",sw11,1:End Sub
  512. Sub sw115_hit:PlaysoundAt "DropTargetHit",ActiveBall:PlaysoundAt "CenterDropBankDown",ActiveBall:End Sub
  513. Sub sw116_hit:PlaysoundAt "DropTargetHit",ActiveBall:PlaysoundAt "CenterDropBankDown",ActiveBall:End Sub
  514. Sub sw117_hit:PlaysoundAt "DropTargetHit",ActiveBall:PlaysoundAt "CenterDropBankDown",ActiveBall:End Sub
  515.  
  516. '*********** Rollovers
  517. Sub Sw15_Hit:Controller.Switch(15)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  518. Sub Sw15_UnHit:Controller.Switch(15)=0: End Sub
  519. Sub Sw16_Hit:Controller.Switch(16)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  520. Sub Sw16_UnHit:Controller.Switch(16)=0: End Sub
  521. Sub Sw17_Hit:Controller.Switch(17)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  522. Sub Sw17_UnHit:Controller.Switch(17)=0: End Sub
  523. Sub Sw18_Hit:Controller.Switch(18)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  524. Sub Sw18_UnHit:Controller.Switch(18)=0: End Sub
  525.  
  526. Sub Sw25_Hit:Controller.Switch(25)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  527. Sub Sw25_UnHit:Controller.Switch(25)=0: End Sub
  528. Sub Sw26_Hit:Controller.Switch(26)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  529. Sub Sw26_UnHit:Controller.Switch(26)=0: End Sub
  530. Sub Sw27_Hit:Controller.Switch(27)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  531. Sub Sw27_UnHit:Controller.Switch(27)=0: End Sub
  532. Sub Sw28_Hit:Controller.Switch(28)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  533. Sub Sw28_UnHit:Controller.Switch(28)=0: End Sub
  534.  
  535. Sub Sw32_Hit:Controller.Switch(32)=1:Activeball.VelY=1: PlaySoundAtBallVol "fx_sensor",1: End Sub
  536. Sub Sw32_UnHit:Controller.Switch(32)=0: End Sub
  537.  
  538. Sub Sw54_Hit:Controller.Switch(54)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  539. Sub Sw54_UnHit:Controller.Switch(54)=0: End Sub
  540. Sub Sw55_Hit:Controller.Switch(55)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  541. Sub Sw55_UnHit:Controller.Switch(55)=0: End Sub
  542. Sub Sw56_Hit:Controller.Switch(56)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  543. Sub Sw56_UnHit:Controller.Switch(56)=0: End Sub
  544. Sub Sw57_Hit:Controller.Switch(57)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  545. Sub Sw57_UnHit:Controller.Switch(57)=0: End Sub
  546. Sub Sw58_Hit:Controller.Switch(58)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  547. Sub Sw58_UnHit:Controller.Switch(58)=0: End Sub
  548.  
  549. Sub Sw88_Hit:Controller.Switch(88)=1: PlaySoundAt "fx_sensor",ActiveBall: End Sub
  550. Sub Sw88_UnHit:Controller.Switch(88)=0: End Sub
  551.  
  552. '*********** Slingshots
  553. Dim LStep, RStep
  554.  
  555. Sub LeftSlingShot_Slingshot()
  556. LSling1.Visible = 1
  557. Lemk.TransZ = -20
  558. LStep = 0
  559. vpmTimer.PulseSw 33
  560. Me.TimerInterval = 20:Me.TimerEnabled = 1
  561. End Sub
  562.  
  563. Sub LeftSlingShot_Timer()
  564. Select Case LStep
  565. Case 1:LSLing1.Visible = 0:LSLing2.Visible = 1:Lemk.TransZ = -10
  566. Case 2:LSLing2.Visible = 0:Lemk.TransZ = 0:Me.TimerEnabled = 0
  567. End Select
  568. LStep = LStep + 1
  569. End Sub
  570.  
  571. Sub RightSlingShot_Slingshot()
  572. RSling1.Visible = 1
  573. Remk.TransZ = -20
  574. RStep = 0
  575. vpmTimer.PulseSw 48
  576. Me.TimerInterval = 20:Me.TimerEnabled = 1
  577. End Sub
  578.  
  579. Sub RightSlingShot_Timer()
  580. Select Case RStep
  581. Case 1:RSLing1.Visible = 0:RSLing2.Visible = 1:Remk.TransZ = -10
  582. Case 2:RSLing2.Visible = 0:Remk.TransZ = 0:Me.TimerEnabled = 0
  583. End Select
  584. RStep = RStep + 1
  585. End Sub
  586.  
  587. '*********** Bumpers
  588. Sub Bumper1_Hit():vpmTimer.PulseSw 35:PlaySoundAtBumperVol "LeftJet",Bumper1,2:End Sub
  589. Sub Bumper2_Hit():vpmTimer.PulseSw 36:PlaySoundAtBumperVol "RightJet",Bumper2,2:End Sub
  590. Sub Bumper3_Hit():vpmTimer.PulseSw 37:PlaySoundAtBumperVol "BottomJet",Bumper3,2:End Sub
  591.  
  592. '*********** Center Standup Target
  593. Sub Sw38_Hit():vpmTimer.PulseSw 38: PlaysoundAt SoundFX("fx_target",DOFTargets),ActiveBall: End Sub
  594.  
  595. '*********** Left Ramp
  596. Sub Sw41_Hit():vpmtimer.pulseSw 41:End Sub
  597. Sub Sw118_Hit()
  598. vpmtimer.pulseSw 118:sw118p.Rotz=-50: Me.TimerEnabled=1:PlaysoundAt "fx_sensor",sw118
  599. If PropellerMod=1 Then RotatePropeller
  600. End Sub
  601. Sub Sw118_timer:Me.TimerEnabled=0:sw118p.Rotz=-20:End Sub
  602.  
  603. '****** Propeller MOD
  604. Dim stepangle
  605.  
  606. Sub RotatePropeller()
  607. PlaysoundAt SoundFXDOF("fx_motor",101,DOFOn,DOFGear),Bumper3
  608. PropellerMove.Enabled = 0
  609. PropellerMove.Interval = 10
  610. PropellerMove.Enabled = 1
  611. stepAngle=10
  612. End Sub
  613.  
  614. Sub PropellerMove_Timer()
  615. Propeller.roty = Propeller.roty + stepAngle
  616. If Propeller.roty >= 6*360 Then stepAngle = stepAngle - 0.2
  617. If stepAngle <= 0 Then Me.Enabled = 0 : Propeller.roty = Propeller.roty -6*360 : StopSound "fx_motor" : DOF 101, DOFOff
  618. End Sub
  619.  
  620. '*********** Right Ramp
  621. Sub Sw42_Hit():vpmtimer.pulseSw 42:End Sub
  622. Sub Sw74_Hit():vpmtimer.pulseSw 74:sw74p.Rotz=-30:Me.TimerEnabled=1:PlaysoundAt "fx_sensor",sw74: End Sub
  623. Sub Sw74_timer:Me.TimerEnabled=0:sw74p.Rotz=0:End Sub
  624.  
  625. '*********** Idol Enter
  626. Sub sw43_hit():vpmtimer.pulseSw 43:End Sub
  627.  
  628. '*********** Subway Enter
  629. Sub Subwayhelp_hit:Me.Kick 30,8:End Sub
  630. Sub sw45_hit():vpmtimer.pulseSw 45:SoundHole45:End Sub
  631. 'Sub sw45_hit():vpmtimer.pulseSw 45:RandomSoundHole:End Sub
  632.  
  633. '*********** Captive Ball Target
  634. Sub Sw64_Hit():vpmTimer.PulseSw 64: PlaysoundAtBall SoundFX("fx_target",DOFTargets): End Sub
  635.  
  636. '*********** Captive Ball Opto
  637. Sub Sw71_Hit:Controller.Switch(71) = 1:End Sub
  638. Sub Sw71_UnHit:Controller.Switch(71) = 0:End Sub
  639.  
  640. '*********** Adventure Targets
  641. Sub Sw51_Hit():vpmTimer.PulseSw 51: PlaySoundAt SoundFX("fx_target",DOFContactors),ActiveBall: End Sub '(U)
  642. Sub Sw52_Hit():vpmTimer.PulseSw 52: PlaySoundAt SoundFX("fx_target",DOFContactors),ActiveBall: End Sub '(R)
  643. Sub Sw53_Hit():vpmTimer.PulseSw 53: PlaySoundAt SoundFX("fx_target",DOFContactors),ActiveBall: End Sub '(E)
  644.  
  645. Sub Sw61_Hit():vpmTimer.PulseSw 61: PlaySoundAt SoundFX("fx_target",DOFContactors),ActiveBall: End Sub '(A)
  646. Sub Sw62_Hit():vpmTimer.PulseSw 62: PlaySoundAt SoundFX("fx_target",DOFContactors),ActiveBall: End Sub '(D)
  647. Sub Sw63_Hit():vpmTimer.PulseSw 63: PlaySoundAt SoundFX("fx_target",DOFContactors),ActiveBall: End Sub '(V)
  648.  
  649. '*********** Path of Adventure
  650. Sub Sw65_Hit:vpmTimer.PulseSw 65:sw65p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  651. Sub Sw65_timer:Me.TimerEnabled=0:sw65p.rotx=0:End Sub
  652. Sub Sw66_Hit:vpmTimer.PulseSw 66:sw66p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  653. Sub Sw66_timer:Me.TimerEnabled=0:sw66p.rotx=0:End Sub
  654. Sub Sw67_Hit:vpmTimer.PulseSw 67:sw67p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  655. Sub Sw67_timer:Me.TimerEnabled=0:sw67p.rotx=0:End Sub
  656. Sub Sw68_Hit:vpmTimer.PulseSw 68:sw68p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  657. Sub Sw68_timer:Me.TimerEnabled=0:sw68p.rotx=0:End Sub
  658.  
  659. Sub sw72_hit():vpmtimer.pulseSw 72:Me.TimerInterval=200:Me.TimerEnabled=1:End Sub
  660. Sub sw72_timer():Me.TimerEnabled=0:SoundHole72:myball=empty:EnterPOA.TimerEnabled=0:End Sub
  661. Sub sw73_hit():vpmtimer.pulseSw 73:Me.TimerInterval=200:Me.TimerEnabled=1:End Sub
  662. Sub sw73_timer():Me.TimerEnabled=0:SoundHole73:myball=empty:EnterPOA.TimerEnabled=0:End Sub
  663.  
  664. Sub Sw75_Hit:vpmTimer.PulseSw 75:sw75p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  665. Sub Sw75_timer:Me.TimerEnabled=0:sw75p.rotx=0:End Sub
  666. Sub Sw76_Hit:vpmTimer.PulseSw 76:sw76p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  667. Sub Sw76_timer:Me.TimerEnabled=0:sw76p.rotx=0:End Sub
  668. Sub Sw77_Hit:vpmTimer.PulseSw 77:sw77p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  669. Sub Sw77_timer:Me.TimerEnabled=0:sw77p.rotx=0:End Sub
  670. Sub Sw78_Hit:vpmTimer.PulseSw 78:sw78p.rotx=-20:Me.TimerEnabled=1:PlaySoundAt "fx_sensor",ActiveBall: End Sub
  671. Sub Sw78_timer:Me.TimerEnabled=0:sw78p.rotx=0:End Sub
  672.  
  673. ' *********************************************************************
  674. ' Lighting
  675. ' *********************************************************************
  676.  
  677. Dim FadingLevel(200), LampState(200)
  678.  
  679. Sub InitLamps
  680. On Error Resume Next
  681. Dim i
  682. For i=11 To 88: Execute "Lights(" & i & ") = Array (Light" & i & ",Light" & i & "a)": Next
  683. For i=0 to 200:LampState(i) = 0:FadingLevel(i) = 0:Next
  684. LampTimer.Interval = 10:LampTimer.Enabled = 1
  685. End Sub
  686.  
  687. Sub LampTimer_Timer()
  688. ' Flashers
  689. FadeLamp 17, FL_ELife
  690. FadeLamp 17, FL_ELifea
  691. FadeModLamp 18, FL_LJackpotA, 2
  692. FadeModLamp 18, FL_LJackpotB, 2
  693. FadeLamp 19, FL_SJackpot
  694. FadeLamp 19, FL_SJackpota
  695. FadeModLamp 20, FL_Jackpot, 2
  696. FadeModLamp 21, FL_POA, 2
  697. FadeModLamp 24, FL_PlaneGunsA, 2
  698. FadeModLamp 24, FL_PlaneGunsB, 2
  699. FadeLamp 25, FL_Dogfight
  700. FadeLamp 25, FL_Dogfighta
  701. FadeModLamp 26, FL_RRamp, 2
  702. FadeModLamp 26, FL_RRamp2, 2
  703. FadeModLamp 26, FL_RRamp3, 2
  704. FadeModLamp 26, FL_RRampa, 2
  705. FadeModLamp 26, FL_RRampb, 2
  706. FadeModLamp 26, FL_RRampbDT, 2
  707. FadeModLamp 26, FL_RRampr, 2
  708. FadeModLamp 26, FL_RRampr1, 2
  709. FadeModLamp 26, FL_RRampr2, 2
  710. FadeModLamp 27, FL_LRamp, 2
  711. FadeModLamp 27, FL_LRampa, 2
  712. FadeModLamp 27, FL_LRampb, 2
  713. FadeModLamp 27, FL_RRampa, 2
  714. FadeModLamp 27, FL_LRampbDT, 2
  715. FadeModLamp 27, FL_LRampr, 2
  716. FadeModLamp 27, FL_LRampr1, 2
  717. FadeModLamp 27, FL_LRampr2, 2
  718. FadeModLamp 27, FL_LRampr3, 2
  719. FadeModLamp 27, FL_LRampr4, 2
  720. FadeModLamp 27, FL_LRampr5, 2
  721. FadeModLamp 51, LeftSideFlashA, 2
  722. FadeModLamp 51, LeftSideFlashB, 2
  723. FadeModLamp 52, RightSideFlash, 2
  724. FadeModLamp 52, RightSideFlash1, 2
  725. FadeModLamp 52, RightSideFlasha, 2
  726. FadeModLamp 52, RightSideFlashb, 2
  727. FadeModLamp 52, RightSideFlashr, 2
  728. FadeModLamp 52, RightSideFlashr1, 2
  729. FadeModLamp 52, RightSideFlashr2, 2
  730. FadeModLamp 52, RightSideFlashr3, 2
  731. FadeLamp 53, FL_SpecialL
  732. FadeLamp 53, FL_SpecialR
  733. FadeLamp 53, FL_SpecialLa
  734. FadeLamp 53, FL_SpecialRa
  735. FadeLamp 54, FL_TotemMulti
  736. FadeLamp 54, FL_TotemMultiA
  737. FadeModLamp 55, FL_JackpotMultiA, 2
  738. FadeModLamp 55, FL_JackpotMultiB, 2
  739. 'i-n-D-Y inserts burst
  740. AddBurst 63, l63r
  741. AddBurst 64, l64r
  742. 'Mission inserts extra burst
  743. AddBurst 18, Light18b
  744. AddBurst 21, Light21b
  745. AddBurst 25, Light25b
  746. AddBurst 27, Light27b
  747. AddBurst 32, Light32b
  748. AddBurst 34, Light34b
  749. AddBurst 41, Light41b
  750. AddBurst 43, Light43b
  751. AddBurst 47, Light47b
  752. AddBurst 51, Light51b
  753. AddBurst 53, Light53b
  754. AddBurst 57, Light57b
  755. 'Path of Adventure inserts
  756. SwapImageAndMat 71,Li71,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  757. SwapImageAndMat 72,Li72,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  758. SwapImageAndMat 73,Li73,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  759. SwapImageAndMat 74,Li74,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  760. SwapImageAndMat 75,Li75,"PoAThePit_On","PoAThePit_Off","PoAInsertsOn","PoAInsertsOff"
  761. SwapImageAndMat 81,Li81,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  762. SwapImageAndMat 82,Li82,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  763. SwapImageAndMat 83,Li83,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  764. SwapImageAndMat 84,Li84,"PoALight_on","PoALight_off","PoAInsertsOn","PoAInsertsOff"
  765. SwapImageAndMat 85,Li85,"PoAEB_on","PoAEB_off","PoAInsertsOn","PoAInsertsOff"
  766. End Sub
  767.  
  768. Sub SetLamp(nr, enabled)
  769. LampState(nr) = enabled
  770. End Sub
  771.  
  772. Sub SetModLamp(nr, value)
  773. If value > 0 Then
  774. LampState(nr) = 1
  775. Else
  776. LampState(nr) = 0
  777. End If
  778. FadingLevel(nr) = value
  779. End Sub
  780.  
  781. Sub FadeLamp(nr, object)
  782. If TypeName(object) = "Light" Then
  783. Object.State = LampState(nr)
  784. End If
  785. If TypeName(object) = "Flasher" Then
  786. Object.visible = LampState(nr)
  787. End If
  788. End Sub
  789.  
  790. Sub FadeModLamp(nr, object, factor)
  791. Object.IntensityScale = FadingLevel(nr) * factor/255
  792. If TypeName(object) = "Light" Then
  793. Object.State = LampState(nr)
  794. End If
  795. If TypeName(object) = "Flasher" Then
  796. Object.visible = LampState(nr)
  797. End If
  798. End Sub
  799.  
  800. Sub AddBurst(nr,Object)
  801. object.visible = Controller.Lamp(nr)
  802. End Sub
  803.  
  804. Sub SwapImageAndMat(nr,object,imageOn,imageOff,matOn,matOff)
  805. Select Case ABS(Cint(Controller.Lamp(nr)))
  806. Case 0 'off
  807. object.image= imageOff:object.material= matOff
  808. Case 1 'on
  809. object.image= imageOn:object.material= matOn
  810. End Select
  811. End Sub
  812.  
  813. '*********** General Illumination
  814. Set GiCallBack2 = GetRef("UpdateGi")
  815.  
  816. Sub UpdateGi(nr,step)
  817. Dim ii
  818. Select Case nr
  819. Case 0 'Top Playfield
  820. If step=0 Then
  821. DOF 103, DOFOff
  822. For each ii in GITop:ii.state=0:Next
  823. For each ii in GITopSides:ii.visible=0:Next
  824. For each ii in GIBumpers:ii.state=0:Next
  825. For each ii in GIPOA:ii.visible=0:Next
  826. Else
  827. DOF 103, DOFOn
  828. For each ii in GITop:ii.state=1:Next
  829. For each ii in GITopSides:ii.visible=1:Next
  830. For each ii in GIBumpers:ii.state=1:Next
  831. For each ii in GIPOA:ii.visible=1:Next
  832. End If
  833. For each ii in GITopSides:ii.IntensityScale = 0.125 * step:Next
  834. For each ii in GITop:ii.IntensityScale = 0.125 * step:Next
  835. For each ii in GIBumpers:ii.IntensityScale = 0.125 * step:Next
  836. For each ii in GIPOA:ii.IntensityScale = 0.125 * step:Next
  837. Case 1 'Bottom Playfield
  838. If step=0 Then
  839. For each ii in GIBot:ii.state=0:Next
  840. For each ii in GIBotSides:ii.visible=0:Next
  841. Else
  842. For each ii in GIBot:ii.state=1:Next
  843. For each ii in GIBotSides:ii.visible=1:Next
  844. End If
  845. For each ii in GIBot:ii.IntensityScale = 0.125 * step:Next
  846. For each ii in GIBotSides:ii.IntensityScale = 0.125 * step:Next
  847. If Step>=7 Then Table1.ColorGradeImage = "ColorGrade_8":Else Table1.ColorGradeImage = "ColorGrade_" & (step+1):End If
  848. Case 2 'Insert Top
  849. Case 3 'Insert Bottom
  850. Case 4 'Return Lane/coin
  851. If step=0 Then
  852. LiteHOF_L.state=0:LiteHOF_R.state=0
  853. Else
  854. LiteHOF_L.state=1:LiteHOF_R.state=1
  855. End If
  856. LiteHOF_L.IntensityScale = 0.125 * step:LiteHOF_R.IntensityScale = 0.125 * step
  857. End Select
  858. End Sub
  859.  
  860. ' *********************************************************************
  861. ' Supporting Ball & Sound Functions
  862. ' *********************************************************************
  863.  
  864. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  865. Vol = Csng(BallVel(ball) ^2 / 1000)
  866. End Function
  867.  
  868. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  869. Dim tmp
  870. tmp = ball.x * 2 / table1.width-1
  871. If tmp > 0 Then
  872. Pan = Csng(tmp ^10)
  873. Else
  874. Pan = Csng(-((- tmp) ^10) )
  875. End If
  876. End Function
  877.  
  878. function AudioFade(ball)
  879. Dim tmp
  880. tmp = ball.y * 2 / Table1.height-1
  881. If tmp > 0 Then
  882. AudioFade = Csng(tmp ^10)
  883. Else
  884. AudioFade = Csng(-((- tmp) ^10) )
  885. End If
  886. End Function
  887.  
  888. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  889. Pitch = BallVel(ball) * 20
  890. End Function
  891.  
  892. Function BallVel(ball) 'Calculates the ball speed
  893. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  894. End Function
  895.  
  896. Function RndNum(min,max)
  897. RndNum = Int(Rnd()*(max-min+1))+min ' Sets a random number between min and max
  898. End Function
  899.  
  900. ' *********************************************************************
  901. ' Other Sound FX
  902. ' *********************************************************************
  903.  
  904. Sub OnBallBallCollision(ball1, ball2, velocity)
  905. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 50, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  906. End Sub
  907.  
  908. Sub LeftFlipper_Collide(parm)
  909. RandomSoundFlipper
  910. End Sub
  911.  
  912. Sub Rightflipper_Collide(parm)
  913. RandomSoundFlipper
  914. End Sub
  915.  
  916. Sub RandomSoundFlipper()
  917. Select Case RndNum(1,3)
  918. Case 1 : PlaySound "fx_flip_hit_1", 0, 20*Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0,AudioFade(ActiveBall)
  919. Case 2 : PlaySound "fx_flip_hit_2", 0, 20*Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0,AudioFade(ActiveBall)
  920. Case 3 : PlaySound "fx_flip_hit_3", 0, 20*Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0,AudioFade(ActiveBall)
  921. End Select
  922. End Sub
  923.  
  924. Sub Gates_Hit (idx)
  925. PlaySoundAtBallVol "fx_gate4",1
  926. End Sub
  927.  
  928. Sub Posts_Hit(idx)
  929. RandomSoundRubber()
  930. End Sub
  931.  
  932. Sub Rubbers_Hit(idx)
  933. RandomSoundRubber()
  934. End Sub
  935.  
  936. Sub RandomSoundRubber()
  937. Select Case Int(Rnd*3)+1
  938. Case 1 : PlaySoundAtBallVol "fx_rubber_hit_1",2
  939. Case 2 : PlaySoundAtBallVol "fx_rubber_hit_2",2
  940. Case 3 : PlaySoundAtBallVol "fx_rubber_hit_3",2
  941. End Select
  942. End Sub
  943.  
  944. Sub SoundHole45()
  945. PlaySoundAtVol "fx_hole3",sw45,.5
  946. End Sub
  947.  
  948. Sub SoundHole72()
  949. PlaySoundAtVol "fx_hole3",sw72,.2
  950. End Sub
  951.  
  952. Sub SoundHole73()
  953. PlaySoundAtVol "fx_hole3",sw73,.2
  954. End Sub
  955.  
  956. ' *********************************************************************
  957. ' Ball Drop & Ramp Sounds
  958. ' *********************************************************************
  959.  
  960. Sub SubwayEnter_Hit:PlaysoundAt "fx_plasticrolling",SubwayEnter:End Sub
  961. Sub SubwayExit_hit:StopSound "fx_plasticrolling":PlaysoundAt "fx_kickerstop",SubwayExit:End Sub
  962.  
  963. Sub ShooterStart_Hit():StopSound "fx_launchball":If ActiveBall.VelY < 0 Then PlaySoundAt "fx_launchball",ShooterStart:End If:End Sub 'ball is going up
  964. Sub ShooterEnd_Hit:If ActiveBall.Z > 30 Then Me.TimerInterval=100:Me.TimerEnabled=1:End If:End Sub 'ball is flying
  965. Sub ShooterEnd_Timer(): Me.TimerEnabled=0 : PlaySound "fx_balldrop",0,2,.2,0,0,0,1,-.6 : End Sub
  966.  
  967. Sub LREnter_Hit():If ActiveBall.VelY < 0 Then PlaySoundAtVol "fx_lrenter",LREnter,.2:End If:End Sub 'ball is going up
  968. Sub LREnter_UnHit():If ActiveBall.VelY > 0 Then StopSound "fx_lrenter":End If:End Sub 'ball is going down
  969. Sub LREnter1_Hit():StopSound "fx_lrenter":PlaySoundAtVol "fx_ramp_turn",LREnter1,.2:End Sub
  970. Sub LREnter2_Hit():StopSound "fx_ramp_turn":End Sub
  971. Sub LRExit_Hit():ActiveBall.VelY=1:PlaySoundAt "fx_balldrop",LRExit:End Sub
  972.  
  973. Sub RREnter_Hit():If ActiveBall.VelY < 0 Then PlaySoundAtVol "fx_ramp_enter1",RREnter,.2:End If:End Sub 'ball is going up
  974. Sub RREnter_UnHit():If ActiveBall.VelY > 0 Then StopSound "fx_ramp_enter1":End If:End Sub 'ball is going down
  975. Sub RREnter1_Hit():PlaySoundAtVol "fx_ramp_enter2",RREnter1,.2:End Sub
  976. Sub RREnter2_Hit():PlaySoundAtVol "fx_ramp_enter2",RREnter2,.2:End Sub
  977. Sub RREnter3_Hit():StopSound "fx_ramp_enter2":End Sub
  978. Sub RRExit_Hit():ActiveBall.VelY=1:PlaysoundAt "fx_balldrop",ActiveBall:End Sub
  979.  
  980. Sub BREnter_Hit():StopSound "fx_ramp_enter2":PlaySoundAtVol "fx_ramp_enter3",BREnter,.2:End Sub
  981. Sub BRExit_Hit():ActiveBall.VelY=1:PlaysoundAt "fx_balldrop",ActiveBall:End Sub
  982.  
  983. ' *********************************************************************
  984. ' Left and Right Orbits Hack
  985. ' *********************************************************************
  986.  
  987. Sub LoopHelpL_Unhit():If ActiveBall.VelY > 20 Then ActiveBall.VelY = RndNum(12,14):End If:End Sub
  988. Sub LoopHelpR_Unhit():If ActiveBall.VelY > 20 Then ActiveBall.VelY = RndNum(12,14):End If:End Sub
  989.  
  990. ' *********************************************************************
  991. ' RealTime Updates
  992. ' *********************************************************************
  993. Set MotorCallback = GetRef("RealTimeUpdates")
  994.  
  995. Sub RealTimeUpdates()
  996. RollingSoundUpdate
  997. BallShadowUpdate
  998. MechsUpdate
  999. End Sub
  1000.  
  1001. '*********** Rolling Sound *********************************
  1002. Const tnob = 7 ' total number of balls : 6 (trough) + 1 (Captive Ball)
  1003. Const fakeballs = 0 ' number of balls created on table start (rolling sound will be skipped)
  1004. ReDim rolling(tnob)
  1005.  
  1006. Sub InitRolling:Dim i:For i=0 to (tnob-1):rolling(i) = False:Next:End Sub
  1007.  
  1008. Sub RollingSoundUpdate()
  1009. Dim BOT, b
  1010. BOT = GetBalls
  1011. ' stop the sound of deleted balls
  1012. If UBound(BOT)<(tnob - 1) Then
  1013. For b = (UBound(BOT) + 1) to (tnob-1)
  1014. rolling(b) = False
  1015. StopSound("fx_ballrolling" & b)
  1016. Next
  1017. End If
  1018. ' exit the Sub if no balls on the table
  1019. If UBound(BOT) = fakeballs-1 Then Exit Sub
  1020. ' play the rolling sound for each ball
  1021. For b = 0 to UBound(BOT)
  1022. If BallVel(BOT(b) ) > 1 Then
  1023. rolling(b) = True
  1024. if BOT(b).z < 30 Then ' Ball on playfield
  1025. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0, AudioFade(BOT(b) )
  1026. Else ' Ball on raised ramp
  1027. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) )*.4, Pan(BOT(b) ), 0, Pitch(BOT(b) )+50000, 1, 0, AudioFade(BOT(b) )
  1028. End If
  1029. Else
  1030. If rolling(b) = True Then
  1031. StopSound("fx_ballrolling" & b)
  1032. rolling(b) = False
  1033. End If
  1034. End If
  1035. Next
  1036. End Sub
  1037.  
  1038. '*********** Ball Shadow *********************************
  1039. Dim BallShadow
  1040. BallShadow = Array (BallShadow1, BallShadow2, BallShadow3,Ballshadow4,Ballshadow5,Ballshadow6,Ballshadow7)
  1041.  
  1042. Sub BallShadowUpdate()
  1043. Dim BOT, b
  1044. BOT = GetBalls
  1045. ' hide shadow of deleted balls
  1046. If UBound(BOT)<(tnob-1) Then
  1047. For b = (UBound(BOT) + 1) to (tnob-1)
  1048. BallShadow(b).visible = 0
  1049. Next
  1050. End If
  1051. ' exit the Sub if no balls on the table
  1052. If UBound(BOT) = -1 Then Exit Sub
  1053. ' render the shadow for each ball
  1054. For b = 0 to UBound(BOT)
  1055. If BOT(b).X < Table1.Width/2 Then
  1056. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 10
  1057. Else
  1058. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 10
  1059. End If
  1060. ballShadow(b).Y = BOT(b).Y + 20
  1061. If BOT(b).Z > 20 Then
  1062. BallShadow(b).visible = 1
  1063. Else
  1064. BallShadow(b).visible = 0
  1065. End If
  1066. Next
  1067. End Sub
  1068.  
  1069. '*********** Gates Primitives Sync *********************************
  1070. Sub MechsUpdate()
  1071. TopGateP.RotX = TopGate.currentangle
  1072. BottomGateP.RotX = BottomGate.currentangle + 10
  1073. LeftGateP.RotY = -LeftGate.currentangle
  1074. RightGateP.RotY = -RightGate.currentangle
  1075. LeftFlipperSh.RotZ = LeftFlipper.currentangle
  1076. RightFlipperSh.RotZ = RightFlipper.currentangle
  1077. End Sub
  1078.  
  1079. ' *********************************************************************
  1080. ' Table Options
  1081. ' *********************************************************************
  1082. Dim InstrChoice, FlipperChoice
  1083.  
  1084. Sub InitOptions
  1085. Blimp.visible=BlimpToy
  1086. leftrail.visible = DesktopMode:rightrail.visible = DesktopMode
  1087. FL_LRampbDT.visible=DesktopMode:FL_LRampb.visible=NOT DesktopMode:FL_RRampbDT.visible=DesktopMode:FL_RRampb.visible=NOT DesktopMode
  1088. If DesktopMode Then FL_LRampr1.opacity=500 Else FL_LRampr1.opacity=100
  1089. If TargetDecals=0 Then
  1090. sw38.image="target-slim":sw51.image="target-round":sw52.image="target-round":sw53.image="target-round":sw61.image="target-round":sw62.image="target-round":sw63.image="target-round"
  1091. Else
  1092. sw38.image="target_slim":sw51.image="target_U":sw52.image="target_R":sw53.image="target_E":sw61.image="target_A":sw62.image="target_D":sw63.image="target_V"
  1093. End If
  1094. If SideCabDecals=0 Then
  1095. LeftCab.image = "sidecabL":RightCab.image = "sidecabR"
  1096. Else
  1097. LeftCab.image = "sidecabL_c":RightCab.image = "sidecabR_c"
  1098. End If
  1099. Select Case InstrCardType
  1100. Case 0
  1101. Card1.image= "IJ-Card1" : Card2.image= "IJ-Card2"
  1102. Case 1
  1103. Card1.image= "IJ-Card1c" : Card2.image= "IJ-Card2c"
  1104. Case 2
  1105. Randomize:InstrChoice = RndNum (0,1)
  1106. Select Case InstrChoice
  1107. Case 0
  1108. Card1.image= "IJ-Card1" : Card2.image= "IJ-Card2"
  1109. Case 1
  1110. Card1.image= "IJ-Card1c" : Card2.image= "IJ-Card2c"
  1111. End Select
  1112. End Select
  1113. Select Case FlipperType
  1114. Case 0
  1115. LeftFlipper.RubberMaterial= "Plastic" : RightFlipper.RubberMaterial= "Plastic"
  1116. Case 1
  1117. LeftFlipper.RubberMaterial= "Rubber Black" : RightFlipper.RubberMaterial= "Rubber Black"
  1118. Case 2
  1119. Randomize:FlipperChoice = RndNum (0,1)
  1120. Select Case FlipperChoice
  1121. Case 0
  1122. LeftFlipper.RubberMaterial= "Plastic" : RightFlipper.RubberMaterial= "Plastic"
  1123. Case 1
  1124. LeftFlipper.RubberMaterial= "Rubber Black" : RightFlipper.RubberMaterial= "Rubber Black"
  1125. End Select
  1126. End Select
  1127. Select Case PropellerMod
  1128. Case 0:Propeller.visible=0:Propeller1.visible=1
  1129. Case 1:Propeller.visible=1:Propeller1.visible=0
  1130. End Select
  1131. End Sub
  1132.  
  1133. '**************************************************************************
  1134. ' Positional Sound Playback Functions by DJRobX
  1135. '**************************************************************************
  1136.  
  1137. 'Set position as table object (Use object or light but NOT wall) and Vol to 1
  1138.  
  1139. Sub PlaySoundAt(sound, tableobj)
  1140. PlaySound sound, 1, 1, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1141. End Sub
  1142.  
  1143.  
  1144. 'Set all as per ball position & speed.
  1145.  
  1146. Sub PlaySoundAtBall(sound)
  1147. PlaySound sound, 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  1148. End Sub
  1149.  
  1150.  
  1151. 'Set position as table object and Vol manually.
  1152.  
  1153. Sub PlaySoundAtVol(sound, tableobj, Vol)
  1154. PlaySound sound, 1, Vol, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1155. End Sub
  1156.  
  1157.  
  1158. 'Set all as per ball position & speed, but Vol Multiplier may be used eg; PlaySoundAtBallVol "sound",3
  1159.  
  1160. Sub PlaySoundAtBallVol(sound, VolMult)
  1161. PlaySound sound, 0, Vol(ActiveBall) * VolMult, Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  1162. End Sub
  1163.  
  1164.  
  1165. 'Set position as bumperX and Vol manually.
  1166.  
  1167. Sub PlaySoundAtBumperVol(sound, tableobj, Vol)
  1168. PlaySound sound, 1, Vol, Pan(tableobj), 0,0,1, 1, AudioFade(tableobj)
  1169. End Sub
  1170.  
  1171.  
  1172. Dim NextOrbitHit:NextOrbitHit = 0
  1173.  
  1174. Sub WireRampBumps_Hit(idx)
  1175. if BallVel(ActiveBall) > .3 and Timer > NextOrbitHit then
  1176. RandomBump3 .3, Pitch(ActiveBall)+5
  1177. ' Schedule the next possible sound time. This prevents it from rapid-firing noises too much.
  1178. ' Lowering these numbers allow more closely-spaced clunks.
  1179. NextOrbitHit = Timer + .2 + (Rnd * .2)
  1180. end if
  1181. End Sub
  1182.  
  1183. Sub PlasticRampBumps_Hit(idx)
  1184. if BallVel(ActiveBall) > .3 and Timer > NextOrbitHit then
  1185. RandomBump 2, -20000
  1186. ' Schedule the next possible sound time. This prevents it from rapid-firing noises too much.
  1187. ' Lowering these numbers allow more closely-spaced clunks.
  1188. NextOrbitHit = Timer + .1 + (Rnd * .2)
  1189. end if
  1190. End Sub
  1191.  
  1192.  
  1193. Sub MetalGuideBumps_Hit(idx)
  1194. if BallVel(ActiveBall) > .3 and Timer > NextOrbitHit then
  1195. RandomBump2 2, Pitch(ActiveBall)
  1196. ' Schedule the next possible sound time. This prevents it from rapid-firing noises too much.
  1197. ' Lowering these numbers allow more closely-spaced clunks.
  1198. NextOrbitHit = Timer + .2 + (Rnd * .2)
  1199. end if
  1200. End Sub
  1201.  
  1202. Sub MetalWallBumps_Hit(idx)
  1203. if BallVel(ActiveBall) > .3 and Timer > NextOrbitHit then
  1204. RandomBump 2, 20000 'Increased pitch to simulate metal wall
  1205. ' Schedule the next possible sound time. This prevents it from rapid-firing noises too much.
  1206. ' Lowering these numbers allow more closely-spaced clunks.
  1207. NextOrbitHit = Timer + .2 + (Rnd * .2)
  1208. end if
  1209. End Sub
  1210.  
  1211.  
  1212. '' Requires rampbump1 to 7 in Sound Manager
  1213. Sub RandomBump(voladj, freq)
  1214. dim BumpSnd:BumpSnd= "rampbump" & CStr(Int(Rnd*7)+1)
  1215. PlaySound BumpSnd, 0, Vol(ActiveBall)*voladj, Pan(ActiveBall), 0, freq, 0, 1, AudioFade(ActiveBall)
  1216. End Sub
  1217.  
  1218. ' Requires metalguidebump1 to 2 in Sound Manager
  1219. Sub RandomBump2(voladj, freq)
  1220. dim BumpSnd:BumpSnd= "metalguidebump" & CStr(Int(Rnd*2)+1)
  1221. PlaySound BumpSnd, 0, Vol(ActiveBall)*voladj, Pan(ActiveBall), 0, freq, 0, 1, AudioFade(ActiveBall)
  1222. End Sub
  1223.  
  1224. ' Requires WireRampBump1 to 5 in Sound Manager
  1225. Sub RandomBump3(voladj, freq)
  1226. dim BumpSnd:BumpSnd= "WireRampBump" & CStr(Int(Rnd*5)+1)
  1227. PlaySound BumpSnd, 0, Vol(ActiveBall)*voladj, Pan(ActiveBall), 0, freq, 0, 1, AudioFade(ActiveBall)
  1228. End Sub
  1229.  
  1230.  
  1231.  
  1232. ' Stop Bump Sounds
  1233. Sub BumpSTOP1_Hit ()
  1234. dim i:for i=1 to 4:StopSound "WireRampBump" & i:next
  1235. NextOrbitHit = Timer + 1
  1236. End Sub
  1237.  
  1238. Sub BumpSTOP2_Hit ()
  1239. dim i:for i=1 to 4:StopSound "WireRampBump" & i:next
  1240. NextOrbitHit = Timer + 1
  1241. End Sub
  1242.  
  1243. Sub BumpSTOP3_Hit ()
  1244. dim i:for i=1 to 4:StopSound "WireRampBump" & i:next
  1245. NextOrbitHit = Timer + 1
  1246. End Sub
Advertisement
Add Comment
Please, Sign In to add comment