Arngrim

Austin powers

May 25th, 2017
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.33 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. Dim Ballsize,BallMass
  10. Ballsize = 50
  11. BallMass = 1.65
  12.  
  13. Const cGameName="austin",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
  14.  
  15. LoadVPM "01200000", "SEGA.VBS", 3.10
  16. Dim DesktopMode: DesktopMode = Table1.ShowDT
  17.  
  18. If DesktopMode = True Then 'Show Desktop components
  19. 'Ramp16.visible=1
  20. 'Ramp15.visible=1
  21. Primitive13.visible=1
  22. Else
  23. 'Ramp16.visible=0
  24. 'Ramp15.visible=0
  25. Primitive13.visible=0
  26. End if
  27.  
  28. '*************************************************************
  29. 'Solenoid Call backs
  30. '**********************************************************************************************************
  31. SolCallBack(1) = "SolTrough"
  32. SolCallBack(2) = "SolAutoPlungerIM"
  33. SolCallback(3) = "bsScoop.SolOut"
  34. SolCallback(4) = "SolLaserBeam"'Laser Beam Eject
  35. SolCallback(7) = "SolAustinDance"'Dancing Austin
  36. SolCallback(8) = "bsInodoro.SolOut" 'Toilet Post
  37. 'SolCallback(14) = "SolIman"
  38. 'SolCallback(19) = "SolDrEvil"
  39. SolCallback(20) = "SolTimeMachine"'Time Machine Motor Relay Board
  40. SolCallback(22) = "SolDiv"'Laser Beam Diverter
  41. SolCallback(23) = "vpmSolgate Gate,""Diverter"","
  42.  
  43. SolCallback(sLRFlipper) = "SolRFlipper"
  44. SolCallback(sLLFlipper) = "SolLFlipper"
  45.  
  46.  
  47. SolCallBack(5) = "SetLamp 105," 'Time Travel Ramp
  48. SolCallBack(6) = "SolFlasher6" 'Right Green Dome
  49. SolCallBack(12) = "SolFlasher12" 'Left Blue Dome
  50. SolCallBack(13) = "SolFlasher13" 'Right Red Dome
  51. SolCallBack(25) = "SetLamp 125," 'PF light insert
  52. SolCallBack(26) = "SetLamp 126," 'PF light insert
  53. SolCallBack(27) = "SolFlasher27" 'Spot Light
  54. SolCallBack(28) = "SetLamp 128," 'PF light insert
  55. SolCallBack(29) = "SetLamp 129," 'PF light insert
  56. SolCallBack(30) = "SetLamp 130," 'PF light insert
  57. SolCallBack(31) = "SetLamp 131," 'PF light insert
  58. SolCallBack(32) = "SolFlasher32" 'Left yellow Dome
  59.  
  60.  
  61.  
  62.  
  63. Dim bsTrough, mMagnet, bsInodoro, bsScoop, mDancing, mLaserGun, plungerIM
  64. Dim x, BallInGun, GPos, aBall, aZpos, XX
  65.  
  66. Sub Table1_Init
  67. vpmInit Me
  68. On Error Resume Next
  69. With Controller
  70. .GameName = cGameName
  71. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  72. .SplashInfoLine = "Austin Powers -- Stern, 2001"&chr(13)&"You Suck"
  73. .HandleMechanics=0
  74. .HandleKeyboard=0
  75. .ShowDMDOnly=1
  76. .ShowFrame=0
  77. .ShowTitle=0
  78. .hidden = 0
  79. On Error Resume Next
  80. .Run GetPlayerHWnd
  81. If Err Then MsgBox Err.Description
  82. On Error Goto 0
  83. End With
  84. On Error Goto 0
  85.  
  86. PinMAMETimer.Interval=PinMAMEInterval:
  87. PinMAMETimer.Enabled=1
  88.  
  89. vpmNudge.TiltSwitch=56
  90. vpmNudge.Sensitivity=5
  91. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
  92.  
  93. ' Trough & Ball Release
  94. Set bsTrough = New cvpmBallStack
  95. bsTrough.InitSw 0, 14, 13, 12, 11, 0, 0, 0
  96. bsTrough.InitKick BallRelease, 90, 10
  97. bsTrough.InitExitSnd SoundFX("fx_ballrel",DOFContactors), SoundFX("Solenoid",DOFContactors)
  98. bsTrough.IsTrough = True
  99. bsTrough.Balls = 4
  100.  
  101. ' Impulse Plunger
  102. Const IMPowerSetting = 55
  103. Const IMTime = 0.6
  104. Set plungerIM = New cvpmImpulseP
  105. With plungerIM
  106. .InitImpulseP swplunger, IMPowerSetting, IMTime
  107. .Random 0.3
  108. .switch 16
  109. .InitExitSnd SoundFX("fx_AutoPlunger",DOFContactors), SoundFX("fx_target",DOFContactors)
  110. .CreateEvents "plungerIM"
  111. End With
  112.  
  113.  
  114. Set mMagnet= New cvpmMagnet
  115. With mMagnet
  116. .InitMagnet Magnet, 100
  117. .GrabCenter = 1
  118. .solenoid= 14
  119. .CreateEvents "mMagnet"
  120. End With
  121.  
  122.  
  123. Set bsInodoro = new cvpmBallStack
  124. bsInodoro.InitSaucer Sw21, 21, 240, 8
  125. bsInodoro.KickForceVar = 3
  126. bsInodoro.KickAngleVar = 5
  127. bsInodoro.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  128. bsInodoro.CreateEvents "bsInodoro", 0
  129.  
  130.  
  131. Set bsScoop = New cvpmSaucer
  132. With bsScoop
  133. .InitKicker Sw46b, 46, 190, 100, 1.5
  134. .InitSounds "Popper", SoundFX(SSolenoidOn,DOFContactors), SoundFX("popper_ball",DOFContactors)
  135. .CreateEvents "bsScoop", sw46b
  136. End With
  137.  
  138.  
  139.  
  140. ' LaserGun
  141. set mLaserGun = new cvpmMech
  142. mLaserGun.MType = vpmMechOneSol + vpmMechReverse + vpmMechLinear + vpmMechFast
  143. mLaserGun.Sol1 = 21
  144. mLaserGun.Length = 750
  145. mLaserGun.Steps = 75
  146. mLaserGun.AddSw 43, 0, 0
  147. mLaserGun.AddSw 44, 40, 74
  148. mLaserGun.Callback = GetRef("UpdateLserGun")
  149. mLaserGun.Start
  150.  
  151. 'DREvil "By JPSalas"
  152. Dim mEvil
  153. Set mEvil=New cvpmMech
  154. mEvil.MType=vpmMechOneSol+vpmMechReverse+vpmMechLinear
  155. mEvil.Sol1=19
  156. mEvil.Length=130
  157. mEvil.Steps=50
  158. mEvil.AddSw 23,0,1
  159. mEvil.AddSw 22,48,49
  160. mEvil.Callback=GetRef("UpdateEvil")
  161. mEvil.Start
  162.  
  163. ' Misc. Initialisation
  164. RampDiverter.IsDropped=0:RampDiverter2.IsDropped=1
  165.  
  166. sw24.Isdropped = True
  167. x = controller.getmech(3)
  168. UpdateLserGun x, 0, x
  169.  
  170.  
  171. End Sub
  172.  
  173.  
  174. 'Solenoid Subs
  175. Sub SolTrough(Enabled)
  176. If Enabled Then
  177. bsTrough.ExitSol_On
  178. vpmTimer.PulseSw 15
  179. End If
  180. End Sub
  181.  
  182. 'SkillShoot
  183. Sub SolAutoPlungerIM(Enabled)
  184. If Enabled Then
  185. PlungerIM.AutoFire
  186. End If
  187. End Sub
  188.  
  189. 'Diverter
  190. Sub SolDiv(Enabled)
  191. If enabled Then
  192. RampDiverter.Isdropped = 1
  193. PlaySound SoundFX("DiverterOn",DOFContactors)
  194. RampDiverter2.Isdropped = 0
  195. Primitive_RampDiverter.RotY = 25
  196. Else
  197. RampDiverter.Isdropped = 0
  198. PlaySound SoundFX("DiverterOff",DOFContactors)
  199. RampDiverter2.Isdropped = 1
  200. Primitive_RampDiverter.RotY = 0
  201. End If
  202. End Sub
  203.  
  204.  
  205. 'Maquina del Tiempo
  206. Sub SolTimeMachine(Enabled)
  207. If Enabled Then
  208. TimeMachineTimer.Enabled=1
  209. Else
  210. TimeMachineTimer.Enabled=0
  211. End If
  212. End Sub
  213.  
  214. Sub TimeMachineTimer_Timer()
  215. StopSound"Motor": PlaySound SoundFX("Motor",DOFGear)
  216. TimeMachineP.RotX = TimeMachineP.RotX + 15
  217. Me.Enabled = 1
  218. End Sub
  219.  
  220.  
  221. set GICallback = GetRef("UpdateGI")
  222.  
  223. Sub UpdateGI(no, Enabled)
  224. If Enabled Then
  225. DOF 101, DOFOn
  226. dim xxxx, xxx
  227. For each xxxx in GILights:xxxx.State = 1: Next
  228. For each xxx in GILightsBackwalls:xxx.visible=1: Next 'BackWall Flashers
  229. PlaySound "fx_relay_on"
  230. Table1.ColorGradeImage = "ColorGradeLUT256x16_ConSat"
  231. Else
  232. DOF 101, DOFOff
  233. For each xx in GILights:xx.State = 0: Next
  234. For each xxx in GILightsBackwalls:xxx.visible=0: Next
  235. PlaySound "fx_relay_off"
  236. Table1.ColorGradeImage = "ColorGradeLUT256x16_ConSatDark"
  237. End If
  238. End Sub
  239.  
  240. Sub FlipperTimer_Timer
  241. LFLogo.roty = LeftFlipper.currentangle + 0
  242. RFLogo.roty = RightFlipper.currentangle + 0
  243. End Sub
  244.  
  245.  
  246.  
  247.  
  248. Sub SolFlasher6(enabled)
  249. If enabled Then
  250. Flasher6.opacity = 200
  251. Flasher6m.opacity = 100
  252. FlasherL6.state = 1
  253. Flasher6b.opacity = 100
  254. Else
  255. Flasher6.opacity = 0
  256. Flasher6m.opacity = 0
  257. FlasherL6.state = 0
  258. Flasher6b.opacity = 0
  259. End If
  260. End Sub
  261.  
  262.  
  263. Sub SolFlasher12(enabled)
  264. If enabled Then
  265. Flasher12.opacity = 200
  266. Flasher12m.opacity = 100
  267. FlasherL12.state = 1
  268. Flasher12b.opacity = 100
  269. Else
  270. Flasher12.opacity = 0
  271. Flasher12m.opacity = 0
  272. FlasherL12.state = 0
  273. Flasher12b.opacity = 0
  274. End If
  275. End Sub
  276.  
  277.  
  278. Sub SolFlasher13(enabled)
  279. If enabled Then
  280. Flasher13.opacity = 200
  281. Flasher13m.opacity = 100
  282. FlasherL13.state = 1
  283. Flasher13b.opacity = 100
  284. Else
  285. Flasher13.opacity = 0
  286. Flasher13m.opacity = 0
  287. FlasherL13.state = 0
  288. Flasher13b.opacity = 0
  289. End If
  290. End Sub
  291.  
  292. Sub SolFlasher27(enabled)
  293. If enabled Then
  294. Flasher27.opacity = 200
  295. Flasher27m.opacity = 100
  296. FlasherLight27.state = 1
  297. F127a.image = "bulbOn"
  298. Else
  299. Flasher27.opacity = 0
  300. Flasher27m.opacity = 0
  301. FlasherLight27.state = 0
  302. F127a.image = "bulb"
  303. End If
  304. End Sub
  305.  
  306. Sub SolFlasher32(enabled)
  307. If enabled Then
  308. Flasher32.opacity = 200
  309. Flasher32m.opacity = 100
  310. FlasherL32.state = 1
  311. Flasher32b.opacity = 100
  312. Else
  313. Flasher32.opacity = 0
  314. Flasher32m.opacity = 0
  315. FlasherL32.state = 0
  316. Flasher32b.opacity = 0
  317. End If
  318. End Sub
  319.  
  320.  
  321.  
  322.  
  323. '******************
  324. 'Keys Up and Down
  325. '*****************
  326. Sub Table1_KeyUp(ByVal Keycode)
  327. If Keycode=LeftMagnaSave Or KeyCode=RightMagnaSave Then Controller.Switch(53)=0
  328. If keycode = plungerkey then Plunger.Fire: Playsound "fx_plunger"
  329. If vpmKeyUp(keycode) Then Exit Sub
  330. End Sub
  331.  
  332.  
  333. Sub Table1_KeyDown(ByVal Keycode)
  334. If Keycode=LeftMagnaSave Or KeyCode=RightMagnaSave Then Controller.Switch(53)=1
  335. If keycode = PlungerKey Then Plunger.Pullback: Playsound "fx_plungerpull"
  336. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
  337. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
  338. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
  339. If vpmKeyDown(keycode) Then Exit Sub
  340. End Sub
  341.  
  342.  
  343. ' Flippers
  344. Sub SolLFlipper(Enabled)
  345. If Enabled Then
  346. PlaySound SoundFX("fx_flipperUp", DOFFlippers), 0, 1, -0.1, 0.15
  347. LeftFlipper.RotateToEnd
  348. Else
  349. PlaySound SoundFX("fx_flipperDown", DOFFlippers), 0, 1, -0.1, 0.15
  350. LeftFlipper.RotateToStart
  351. End If
  352. End Sub
  353.  
  354. Sub SolRFlipper(Enabled)
  355. If Enabled Then
  356. PlaySound SoundFX("fx_flipperUp", DOFFlippers), 0, 1, 0.1, 0.15
  357. RightFlipper.RotateToEnd
  358. Else
  359. PlaySound SoundFX("fx_flipperDown", DOFFlippers), 0, 1, 0.1, 0.15
  360. RightFlipper.RotateToStart
  361. End If
  362. End Sub
  363.  
  364.  
  365.  
  366. ' Drain hole and kickers
  367. Sub Drain_Hit:bsTrough.addball me : playsound"fx_drain" : End Sub
  368. Sub Sw21_Hit:bsInodoro.AddBall me : playsound "popper_ball": End Sub
  369.  
  370.  
  371. Sub Sw46_hit: Sw46.enabled = 0 : End Sub
  372. Sub Sw46b_UnHit: vpmtimer.addtimer 1000, "Sw46.enabled = 1 '" :End Sub
  373.  
  374.  
  375. '*****************
  376. ' Switches
  377. '*****************
  378.  
  379. ' Slingshots
  380. Dim LStep, RStep
  381.  
  382. Sub LeftSlingShot_Slingshot
  383. PlaySound SoundFX("LeftSlingShot", DOFContactors), 0, 1, -0.05, 0.05
  384. LeftSling4.Visible = 1
  385. Lemk.RotX = 26
  386. LStep = 0
  387. vpmTimer.PulseSw 59
  388. LeftSlingShot.TimerEnabled = 1
  389. End Sub
  390.  
  391. Sub LeftSlingShot_Timer
  392. Select Case LStep
  393. Case 1:LeftSLing4.Visible = 0:LeftSLing3.Visible = 1:Lemk.RotX = 14
  394. Case 2:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:Lemk.RotX = 2
  395. Case 3:LeftSLing2.Visible = 0:Lemk.RotX = -10:LeftSlingShot.TimerEnabled = 0
  396. End Select
  397. LStep = LStep + 1
  398. End Sub
  399.  
  400. Sub RightSlingShot_Slingshot
  401. PlaySound SoundFX("RightSlingShot", DOFContactors), 0, 1, 0.05, 0.05
  402. RightSling4.Visible = 1
  403. Remk.RotX = 26
  404. RStep = 0
  405. vpmTimer.PulseSw 62
  406. RightSlingShot.TimerEnabled = 1
  407. End Sub
  408.  
  409. Sub RightSlingShot_Timer
  410. Select Case RStep
  411. Case 1:RightSLing4.Visible = 0:RightSLing3.Visible = 1:Remk.RotX = 14
  412. Case 2:RightSLing3.Visible = 0:RightSLing2.Visible = 1:Remk.RotX = 2
  413. Case 3:RightSLing2.Visible = 0:Remk.RotX = -10:RightSlingShot.TimerEnabled = 0
  414. End Select
  415. RStep = RStep + 1
  416. End Sub
  417.  
  418.  
  419. 'Bumpers
  420. Sub Bumper1_Hit:vpmTimer.PulseSw 49 : playsound SoundFX("LeftBumper_Hit",DOFContactors) : End Sub
  421. Sub Bumper2_Hit:vpmTimer.PulseSw 50 : playsound SoundFX("RightBumper_Hit",DOFContactors) : End Sub
  422. Sub Bumper3_Hit:vpmTimer.PulseSw 51 : playsound SoundFX("TopBumper_Hit",DOFContactors) : End Sub
  423.  
  424. 'Stand Up Targets
  425. ' Left Banks Targets
  426. Sub Sw25_Hit:vpmTimer.PulseSw 25 :MoveTarget25 :PlaySound SoundFX("fx_bumper",DOFTargets), 0, 1, 0.15, 0.15:End Sub
  427. Sub Sw26Hit:vpmTimer.PulseSw 26 :MoveTarget26 :PlaySound SoundFX("fx_bumper",DOFTargets), 0, 1, 0.15, 0.15:End Sub
  428. Sub Sw27_Hit:vpmTimer.PulseSw 27 :MoveTarget27 :PlaySound SoundFX("fx_bumper",DOFTargets), 0, 1, 0.15, 0.15:End Sub
  429. Sub Sw28_Hit:vpmTimer.PulseSw 28 :MoveTarget27 :PlaySound SoundFX("fx_bumper",DOFTargets), 0, 1, 0.15, 0.15:End Sub
  430. Sub Sw29_Hit:vpmTimer.PulseSw 29 :MoveTarget29 :PlaySound SoundFX("fx_bumper",DOFTargets), 0, 1, 0.15, 0.15:End Sub
  431. Sub Sw30_Hit:vpmTimer.PulseSw 30 :MoveTarget30 :PlaySound SoundFX("fx_bumper",DOFTargets), 0, 1, 0.15, 0.15:End Sub
  432.  
  433. Sub MoveTarget25
  434. Sw25a.TransZ = 5
  435. Sw25b.TransZ = 5
  436. Sw25.Timerenabled = False
  437. Sw25.Timerenabled = True
  438. End Sub
  439. Sub Sw25_Timer
  440. Sw25.Timerenabled = False
  441. Sw25a.TransZ = 0
  442. Sw25b.TransZ = 0
  443. End Sub
  444.  
  445. Sub MoveTarget26
  446. Sw26a.TransZ = 5
  447. Sw26b.TransZ = 5
  448. Sw26.Timerenabled = False
  449. Sw26.Timerenabled = True
  450. End Sub
  451. Sub Sw26_Timer
  452. Sw26.Timerenabled = False
  453. Sw26a.TransZ = 0
  454. Sw26b.TransZ = 0
  455. End Sub
  456.  
  457. Sub MoveTarget27
  458. Sw27a.TransZ = 5
  459. Sw27b.TransZ = 5
  460. Sw27.Timerenabled = False
  461. Sw27.Timerenabled = True
  462. End Sub
  463. Sub Sw27_Timer
  464. Sw27.Timerenabled = False
  465. Sw27a.TransZ = 0
  466. Sw27b.TransZ = 0
  467. End Sub
  468.  
  469. Sub MoveTarget28
  470. Sw28a.TransZ = 5
  471. Sw28b.TransZ = 5
  472. Sw28.Timerenabled = False
  473. Sw28.Timerenabled = True
  474. End Sub
  475. Sub Sw28_Timer
  476. Sw28.Timerenabled = False
  477. Sw28a.TransZ = 0
  478. Sw28b.TransZ = 0
  479. End Sub
  480.  
  481.  
  482. Sub MoveTarget29
  483. Sw29a.TransZ = 5
  484. Sw29b.TransZ = 5
  485. Sw29.Timerenabled = False
  486. Sw29.Timerenabled = True
  487. End Sub
  488. Sub Sw29_Timer
  489. Sw29.Timerenabled = False
  490. Sw29a.TransZ = 0
  491. Sw29b.TransZ = 0
  492. End Sub
  493.  
  494. Sub MoveTarget30
  495. Sw30a.TransZ = 5
  496. Sw30b.TransZ = 5
  497. Sw30.Timerenabled = False
  498. Sw30.Timerenabled = True
  499. End Sub
  500. Sub Sw30_Timer
  501. Sw30.Timerenabled = False
  502. Sw30a.TransZ = 0
  503. Sw30b.TransZ = 0
  504. End Sub
  505.  
  506.  
  507. Sub sw31_Hit:vpmTimer.PulseSw 31:End Sub
  508. Sub sw32_Hit:vpmTimer.PulseSw 32:End Sub
  509.  
  510. 'Wire Triggers
  511. Sub sw16_Hit:Controller.Switch(16)=1 : playsound"rollover" : End Sub
  512. Sub sw16_unHit:Controller.Switch(16)=0:End Sub
  513. Sub sw33_Hit:Controller.Switch(33)=1 : playsound"rollover" : End Sub
  514. Sub sw33_unHit:Controller.Switch(33)=0:End Sub
  515. Sub sw39_Hit:Controller.Switch(39)=1 : playsound"rollover" : End Sub
  516. Sub sw39_unHit:Controller.Switch(39)=0:End Sub
  517. Sub sw47_Hit:Controller.Switch(47)=1 : playsound"rollover" : End Sub
  518. Sub sw47_unHit:Controller.Switch(47)=0:End Sub
  519. Sub sw48_Hit:Controller.Switch(48)=1 : playsound"rollover" : End Sub
  520. Sub sw48_unHit:Controller.Switch(48)=0:End Sub
  521. Sub sw57_Hit:Controller.Switch(57)=1 : playsound"rollover" : End Sub
  522. Sub sw57_unHit:Controller.Switch(57)=0:End Sub
  523. Sub sw58_Hit:Controller.Switch(58)=1 : playsound"rollover" : End Sub
  524. Sub sw58_unHit:Controller.Switch(58)=0:End Sub
  525. Sub sw60_Hit:Controller.Switch(60)=1 : playsound"rollover" : End Sub
  526. Sub sw60_unHit:Controller.Switch(60)=0:End Sub
  527. Sub sw61_Hit:Controller.Switch(61)=1 : playsound"rollover" : End Sub
  528. Sub sw61_unHit:Controller.Switch(61)=0:End Sub
  529.  
  530.  
  531.  
  532. 'Ramp Gate Triggers
  533. Sub sw18_hit:vpmTimer.pulseSw 18 : playsound"rollover" : End Sub
  534. Sub sw35_hit:vpmTimer.pulseSw 35 : playsound"fx_chapa" : End Sub
  535.  
  536. Sub sw37_Hit:Controller.Switch(37)=1 : playsound"fx_gate4" : End Sub
  537. Sub sw37_unHit:Controller.Switch(37)=0:End Sub
  538.  
  539.  
  540. Sub sw38_hit:vpmTimer.pulseSw 38 : playsound"fx_gate4" : End Sub
  541.  
  542. Sub sw41_Hit:Controller.Switch(41)=1 End Sub
  543. Sub sw41_unHit:Controller.Switch(41)=0:End Sub
  544.  
  545. Sub sw42_hit:vpmTimer.pulseSw 42 :playsound "fx_gate4": End Sub
  546. Sub sw42_Unhit:vpmTimer.pulseSw 42 : End Sub
  547.  
  548. '**********************************************************************************************************
  549. 'LaserBeam
  550. '**********************************************************************************************************
  551. Sub SolLaserBeam(Enabled)
  552. If Enabled AND BallInGun then
  553. vpmCreateBall Sw45
  554. PlaySound SoundFX("CannoShot",DOFContactors)
  555. Sw45.kick 300 + GPos, 60
  556. controller.switch(45) = 0
  557. BallInGun = 0
  558. End If
  559. End Sub
  560.  
  561. Sub UpdateLserGun(acurrpos, aspeed, alastpos)
  562. GPos = acurrpos
  563. StopSound"Motor": PlaySound SoundFX("Motor",DOFGear)
  564. PCannon.RotY = GPos
  565. End Sub
  566.  
  567. Sub Sw45b_hit(): StopSound "fx_ramp_enter3": PlaySound "popper_ball": controller.switch(45) = 1:me.DestroyBall:BallInGun = 1:End Sub
  568.  
  569.  
  570. '**********************************************************************************************************
  571. 'Dancing Austin
  572. '**********************************************************************************************************
  573.  
  574. Dim cBall
  575. DanceInit
  576.  
  577. Sub DanceInit
  578. Set cBall = ckicker.createball
  579. ckicker.Kick 0, 0
  580. End Sub
  581.  
  582.  
  583. Sub SolAustinDance(Enabled)
  584. If Enabled Then
  585. AustinDance
  586. End If
  587. End Sub
  588.  
  589. Sub AustinDance
  590. cball.velx = 47
  591. End Sub
  592.  
  593. Sub AustinUpdate_Timer
  594. AustinDancerP.RotY = -(Spinner1.currentangle) :
  595. End Sub
  596.  
  597. Sub Spinner1_Spin(): PlaySound "fx_sensor" End Sub
  598.  
  599. '**********************************************************************************************************
  600. 'Minimi Spiner "By JPSalas"
  601. '**********************************************************************************************************
  602. Dim SpinPos, SpinDir
  603. SpinPos = 0
  604. SpinDir = 0
  605.  
  606. Sub Sw34_Spin()
  607. 'vpmTimer.PulseSw 34 'not needed anymore, animation will trigger the spinner, probably can remove this object from table
  608. playsound"fx_spinner"
  609. End Sub
  610.  
  611. Sub Sw34Anim_Hit()
  612. SpinDir = -10 * (ActiveBall.VelY / 2)
  613. SpinTimer.Enabled = 1
  614. End Sub
  615.  
  616. Sub Spintimer_Timer()
  617. SpinPos = SpinPos + int(SpinDir)
  618. if SpinPos>360 Then
  619. SpinPos = SpinPos - 360
  620. vpmTimer.PulseSw 34
  621. elseif SpinPos < 0 Then
  622. SpinPos = SpinPos + 360
  623. vpmTimer.PulseSw 34
  624. end if
  625. SpinDir = SpinDir * .95
  626. if abs(SpinDir) <= 10 then ' Lost momentum, start return to upgright position
  627. If SpinPos <= 180 Then
  628. SpinDir = -((SpinPos * 19) / 180)-1
  629. else
  630. SpinDir = ((360-SpinPos) * 19 / 180)+1
  631. end if
  632. if SpinPos <=1 or SpinPos >= 359 then SpinPos = 0:Me.Enabled =0
  633. end if
  634. MiniMiP.RotX = SpinPos
  635. End Sub
  636.  
  637.  
  638. '**********************************************************************************************************
  639. 'Dr Evil "By JPSalas"
  640. '**********************************************************************************************************
  641. Dim Sw24Pos
  642. Sub Sw24_Hit():Sw24pos=0:Sw24T.Enabled=1:vpmTimer.PulseSw 24: End Sub
  643.  
  644. Sub Sw24T_Timer()
  645. Select Case Sw24pos
  646. Case 0: Sw24P.y=657:PlaySound"fx_chapa"
  647. Case 1: Sw24P.y=647
  648. Case 2: Sw24P.y=637
  649. Case 3: Sw24P.y=627
  650. Case 4: Sw24P.y=637
  651. Case 5: Sw24P.y=647
  652. Case 6: Sw24P.y=657
  653. Case 7: Sw24P.y=647
  654. Case 8: Sw24P.y=637
  655. Case 9: Sw24P.y=627
  656. Case 10: Sw24P.y=637
  657. Case 11: Sw24P.y=647
  658. Case 12: Sw24P.y=657 :Sw24T.Enabled = 0
  659. End Select
  660. Sw24pos = Sw24pos + 1
  661. End Sub
  662.  
  663. Sub UpdateEvil(aNewPos,aSpeed,aLastPos)
  664. Sw24P.TransY = aNewPos * 3
  665. StopSound"Motor": PlaySound"Motor"
  666. If aNewPos > 3 then
  667. sw24.IsDropped = 0
  668. 'DR_Evil.IsDropped = 0
  669. Else
  670. sw24.Isdropped = 1
  671. 'DR_Evil.IsDropped = 1
  672. End If
  673. End Sub
  674.  
  675.  
  676. '***************************************************
  677. ' JP's VP10 Fading Lamps & Flashers
  678. ' Based on PD's Fading Light System
  679. ' SetLamp 0 is Off
  680. ' SetLamp 1 is On
  681. ' fading for non opacity objects is 4 steps
  682. '***************************************************
  683.  
  684. Dim bulb
  685. Dim LampState(200), FadingLevel(200)
  686. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  687.  
  688. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  689. LampTimer.Interval = 10 'lamp fading speed
  690. LampTimer.Enabled = 1
  691.  
  692. ' Lamp & Flasher Timers
  693.  
  694. Sub LampTimer_Timer()
  695. Dim chgLamp, num, chg, ii
  696. chgLamp = Controller.ChangedLamps
  697. If Not IsEmpty(chgLamp) Then
  698. For ii = 0 To UBound(chgLamp)
  699. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  700. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  701. Next
  702. End If
  703. UpdateLamps
  704. End Sub
  705.  
  706. Sub InitLamps()
  707. Dim x
  708. For x = 0 to 200
  709. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  710. FadingLevel(x) = 4 ' used to track the fading state
  711. FlashSpeedUp(x) = 0.5 ' faster speed when turning on the flasher
  712. FlashSpeedDown(x) = 0.35 ' slower speed when turning off the flasher
  713. FlashMax(x) = 1 ' the maximum value when on, usually 1
  714. FlashMin(x) = 0 ' the minimum value when off, usually 0
  715. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  716. Next
  717. End Sub
  718.  
  719. Sub UpdateLamps
  720. NFadeL 1, Light1
  721. NFadeL 2, Light2
  722. NFadeL 3, Light3
  723. NFadeL 4, Light4
  724. NFadeL 5, Light5
  725. NFadeL 6, Light6
  726. NFadeL 7, Light7
  727. NFadeL 8, Light8
  728. NFadeL 9, Light9
  729. NFadeL 10, Light10
  730. NFadeL 11, Light11
  731. NFadeL 12, Light12
  732.  
  733. nFadeLm 13, BumperL_Flasher
  734. nFadeLm 13, BumperL_Flasher_a
  735. Flash 13, BumperL_Flasher1
  736.  
  737. nFadeLm 14, BumperR_Flasher
  738. nFadeLm 14, BumperR_Flasher_a
  739. Flash 14, BumperR_Flasher1
  740.  
  741. nFadeLm 15, BumperT_Flasher
  742. nFadeLm 15, BumperT_Flasher_a
  743. Flash 15, BumperT_Flasher1
  744.  
  745. NFadeL 16, Light16
  746. NFadeL 17, Light17
  747. NFadeL 18, Light18
  748. NFadeL 19, Light19
  749. NFadeL 20, Light20
  750. NFadeL 21, Light21
  751. NFadeL 22, Light22
  752. NFadeL 23, Light23
  753. NFadeL 24, Light24
  754. NFadeL 25, Light25
  755. NFadeL 26, Light26
  756. NFadeL 27, Light27
  757. NFadeL 28, Light28
  758. NFadeL 29, Light29
  759. NFadeL 30, Light30
  760. NFadeL 31, Light31
  761. NFadeL 32, Light32
  762. NFadeL 33, Light33
  763. NFadeL 34, Light34
  764. NFadeL 35, Light35
  765. NFadeL 36, Light36
  766. NFadeL 37, Light37
  767. NFadeL 38, Light38
  768. NFadeL 39, Light39
  769. NFadeL 40, Light40
  770. NFadeL 41, Light41
  771. NFadeL 42, Light42
  772. NFadeL 43, Light43
  773. NFadeL 44, Light44
  774. NFadeL 45, Light45
  775. NFadeL 46, Light46
  776. NFadeL 47, Light47
  777. NFadeL 48, Light48
  778. NFadeL 49, Light49
  779. NFadeL 50, Light50
  780. NFadeL 51, Light51
  781. NFadeL 52, Light52
  782. NFadeObjm 53, l53, "FireButtonOn", "FireButton"
  783. NFadeL 53, F53 'Fire Button
  784. NFadeL 54, Light54 'DR Evil
  785. NFadeL 57, Light57
  786. NFadeL 58, Light58
  787. NFadeL 59, Light59
  788. NFadeL 60, Light60
  789. NFadeL 61, Light61
  790. NFadeL 62, Light62
  791. NFadeL 63, Light63
  792. NFadeL 64, Light64
  793. NFadeL 65, Light65
  794. NFadeL 66, Light66
  795. NFadeL 67, Light67
  796. NFadeL 68, Light68
  797. NFadeL 73, Light73
  798. NFadeL 74, Light74
  799. NFadeL 75, Light75
  800. NFadeL 76, Light76
  801.  
  802. 'Solenoid Controlled Lamps
  803. NFadeLm 105, F105
  804. NFadeL 105, F105a
  805. NFadeL 125, FlasherLight25
  806. NFadeL 126, FlasherLight26
  807. NFadeL 128, FlasherLight28
  808. NFadeL 129, FlasherLight29
  809. NFadeL 130, FlasherLight30
  810. NFadeL 131, FlasherLight31
  811.  
  812. End Sub
  813.  
  814. Sub SetLamp(nr, value)
  815. If value <> LampState(nr) Then
  816. LampState(nr) = abs(value)
  817. FadingLevel(nr) = abs(value) + 4
  818. End If
  819. End Sub
  820.  
  821. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  822.  
  823. Sub NFadeL(nr, object)
  824. Select Case FadingLevel(nr)
  825. Case 4:object.state = 0:FadingLevel(nr) = 0
  826. Case 5:object.state = 1:FadingLevel(nr) = 1
  827. End Select
  828. End Sub
  829.  
  830. Sub NFadeLm(nr, object) ' used for multiple lights
  831. Select Case FadingLevel(nr)
  832. Case 4:object.state = 0
  833. Case 5:object.state = 1
  834. End Select
  835. End Sub
  836.  
  837. 'Lights, Ramps & Primitives used as 4 step fading lights
  838. 'a,b,c,d are the images used from on to off
  839.  
  840. Sub FadeObj(nr, object, a, b, c, d)
  841. Select Case FadingLevel(nr)
  842. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  843. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  844. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  845. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  846. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  847. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  848. End Select
  849. End Sub
  850.  
  851. Sub FadeObjm(nr, object, a, b, c, d)
  852. Select Case FadingLevel(nr)
  853. Case 4:object.image = b
  854. Case 5:object.image = a
  855. Case 9:object.image = c
  856. Case 13:object.image = d
  857. End Select
  858. End Sub
  859.  
  860. Sub NFadeObj(nr, object, a, b)
  861. Select Case FadingLevel(nr)
  862. Case 4:object.image = b:FadingLevel(nr) = 0
  863. Case 5:object.image = a:FadingLevel(nr) = 1
  864. End Select
  865. End Sub
  866.  
  867. Sub NFadeObjm(nr, object, a, b)
  868. Select Case FadingLevel(nr)
  869. Case 4:object.image = b
  870. Case 5:object.image = a
  871. End Select
  872. End Sub
  873.  
  874. ' Flasher objects
  875.  
  876. Sub Flash(nr, object)
  877. Select Case FadingLevel(nr)
  878. Case 4 'off
  879. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  880. If FlashLevel(nr) < FlashMin(nr) Then
  881. FlashLevel(nr) = FlashMin(nr)
  882. FadingLevel(nr) = 0 'completely off
  883. End if
  884. Object.IntensityScale = FlashLevel(nr)
  885. Case 5 ' on
  886. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  887. If FlashLevel(nr) > FlashMax(nr) Then
  888. FlashLevel(nr) = FlashMax(nr)
  889. FadingLevel(nr) = 1 'completely on
  890. End if
  891. Object.IntensityScale = FlashLevel(nr)
  892. End Select
  893. End Sub
  894.  
  895. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  896. Object.IntensityScale = FlashLevel(nr)
  897. End Sub
  898.  
  899. ' RGB Leds
  900.  
  901. Sub RGBLED (object,red,green,blue)
  902. If TypeName(object) = "Light" Then
  903. object.color = RGB(0,0,0)
  904. object.colorfull = RGB(2.5*red,2.5*green,2.5*blue)
  905. object.state=1
  906. ElseIf TypeName(object) = "Flasher" Then
  907. object.color = RGB(2.5*red,2.5*green,2.5*blue)
  908. object.IntensityScale = 1
  909. End If
  910. End Sub
  911.  
  912. ' Modulated Flasher and Lights objects
  913.  
  914. Sub SetLampMod(nr, value)
  915. If value > 0 Then
  916. LampState(nr) = 1
  917. Else
  918. LampState(nr) = 0
  919. End If
  920. FadingLevel(nr) = value
  921. End Sub
  922.  
  923. Sub LampMod(nr, object)
  924. Object.IntensityScale = FadingLevel(nr)/128
  925. If TypeName(object) = "Light" Then
  926. Object.State = LampState(nr)
  927. End If
  928. If TypeName(object) = "Flasher" Then
  929. Object.visible = LampState(nr)
  930. End If
  931. End Sub
  932.  
  933.  
  934.  
  935.  
  936. ' *********************************************************************
  937. ' Supporting Ball & Sound Functions
  938. ' *********************************************************************
  939.  
  940. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  941. Vol = Csng(BallVel(ball) ^2 / 500)
  942. End Function
  943.  
  944. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  945. Dim tmp
  946. tmp = ball.x * 2 / Table1.width-1
  947. If tmp > 0 Then
  948. Pan = Csng(tmp ^10)
  949. Else
  950. Pan = Csng(-((- tmp) ^10))
  951. End If
  952. End Function
  953.  
  954. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  955. Pitch = BallVel(ball) * 20
  956. End Function
  957.  
  958. Function BallVel(ball) 'Calculates the ball speed
  959. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2)))
  960. End Function
  961.  
  962. '****************************************
  963. ' Real Time updates
  964. '****************************************
  965.  
  966. Set MotorCallBack = GetRef("GameTimer")
  967.  
  968. Sub GameTimer
  969. RollingUpdate
  970. BallShadowUpdate
  971. LFLogo.RotY = LeftFlipper.CurrentAngle
  972. RFlogo.RotY = RightFlipper.CurrentAngle
  973. End Sub
  974.  
  975. '*********** ROLLING SOUND *********************************
  976. Const tnob = 3 ' total number of balls
  977. ReDim rolling(tnob)
  978. InitRolling
  979.  
  980. Sub InitRolling:Dim i:For i=0 to (tnob-1):rolling(i) = False:Next:End Sub
  981.  
  982. Sub RollingUpdate()
  983. Dim BOT, b, ballpitch
  984. BOT = GetBalls
  985. ' stop the sound of deleted balls
  986. If UBound(BOT)<(tnob -1) Then
  987. For b = (UBound(BOT) + 1) to (tnob-1)
  988. rolling(b) = False
  989. StopSound("fx_ballrolling" & b)
  990. Next
  991. End If
  992. ' exit the Sub if no balls on the table
  993. If UBound(BOT) = -1 Then Exit Sub
  994. ' play the rolling sound for each ball
  995. For b = 0 to UBound(BOT)
  996. If BallVel(BOT(b) ) > 1 Then
  997. If BOT(b).z < 30 Then
  998. ballpitch = Pitch(BOT(b))
  999. Else
  1000. ballpitch = Pitch(BOT(b)) * 100
  1001. End If
  1002. rolling(b) = True
  1003. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), Pan(BOT(b)), 0, ballpitch, 1, 0
  1004. Else
  1005. If rolling(b) = True Then
  1006. StopSound("fx_ballrolling" & b)
  1007. rolling(b) = False
  1008. End If
  1009. End If
  1010. Next
  1011. End Sub
  1012.  
  1013. '*********** BALL SHADOW *********************************
  1014. Dim BallShadow
  1015. BallShadow = Array (BallShadow1, BallShadow2, BallShadow3)
  1016.  
  1017. Sub BallShadowUpdate()
  1018. Dim BOT, b
  1019. BOT = GetBalls
  1020. ' hide shadow of deleted balls
  1021. If UBound(BOT)<(tnob-1) Then
  1022. For b = (UBound(BOT) + 1) to (tnob-1)
  1023. BallShadow(b).visible = 0
  1024. Next
  1025. End If
  1026. ' exit the Sub if no balls on the table
  1027. If UBound(BOT) = -1 Then Exit Sub
  1028. ' render the shadow for each ball
  1029. For b = 0 to UBound(BOT)
  1030. If BOT(b).X < Table1.Width/2 Then
  1031. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 10
  1032. Else
  1033. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 10
  1034. End If
  1035. ballShadow(b).Y = BOT(b).Y + 20
  1036.  
  1037. If BOT(b).Z > 20 Then
  1038. BallShadow(b).visible = 1
  1039. Else
  1040. BallShadow(b).visible = 0
  1041. End If
  1042. Next
  1043. End Sub
  1044.  
  1045. '******************************
  1046. ' Sound FX
  1047. '******************************
  1048.  
  1049. Sub aMetals_Hit(idx):PlaySound "fx_MetalHit":End Sub
  1050. Sub aRubber_Bands_Hit(idx):PlaySound "fx_rubber_band", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  1051. Sub aRubber_Posts_Hit(idx):PlaySound "fx_rubber", 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  1052. Sub aPlastics_Hit(idx):PlaySound "fx_PlasticHit":End Sub
  1053. Sub aGates_Hit(idx):PlaySound "fx_Gate":End Sub
  1054. Sub aWoods_Hit(idx):PlaySound "fx_woodhit":End Sub
  1055.  
  1056.  
  1057. Sub Trigger2_Hit:PlaySound "fx_chapa" End Sub
  1058.  
  1059. 'Flipper rubber sounds
  1060.  
  1061. Sub LeftFlipper_Collide(parm)
  1062. PlaySound "fx_rubber_flipper", 0, parm / 10, -0.1, 0.15
  1063. End Sub
  1064.  
  1065. Sub RightFlipper_Collide(parm)
  1066. PlaySound "fx_rubber_flipper", 0, parm / 10, 0.1, 0.15
  1067. End Sub
  1068.  
  1069. ' Ball Collision Sound
  1070. Sub OnBallBallCollision(ball1, ball2, velocity)
  1071. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  1072. End Sub
  1073.  
  1074. Sub LREnter_Hit():If ActiveBall.VelY < 0 Then PlaySound "fx_ramp_enter1":End If:End Sub 'ball is going up
  1075. Sub LREnter_UnHit():If ActiveBall.VelY > 0 Then StopSound "fx_ramp_enter1":End If:End Sub 'ball is going down
  1076. Sub LREnter1_Hit():PlaySound "fx_ramp_enter2":End Sub
  1077. Sub LREnter2_Hit():PlaySound "fx_ramp_enter3":End Sub
  1078.  
  1079. Sub LRExit_Hit():ActiveBall.VelY=1:StopSound "fx_ramp_enter3":Me.TimerInterval=200:Me.TimerEnabled=1:End Sub
  1080. Sub LRExit_timer():Me.TimerEnabled=0:RandomDropSound:End Sub
  1081.  
  1082. Sub RREnter_Hit():If ActiveBall.VelY < 0 Then PlaySound "fx_ramp_enter1":End If:End Sub 'ball is going up
  1083. Sub RREnter_UnHit():If ActiveBall.VelY > 0 Then StopSound "fx_ramp_enter1":End If:End Sub 'ball is going down
  1084. Sub RREnter1_Hit():PlaySound "fx_ramp_enter2":End Sub
  1085. Sub RREnter2_Hit():PlaySound "fx_ramp_enter3":End Sub
  1086.  
  1087. Sub RRExit_Hit():StopSound "fx_ramp_enter3":Me.TimerInterval=200:Me.TimerEnabled=1:End Sub
  1088. Sub RRExit_timer():Me.TimerEnabled=0:RandomDropSound:End Sub
  1089.  
  1090. Sub TriggerLaunchBall_Hit(): vpmtimer.addtimer 350, "RandomDropSound '" End Sub
  1091.  
  1092. Sub RandomDropSound()
  1093. Select Case Int(Rnd*3)+1
  1094. Case 1 : PlaySound "fx_BallDrop1"
  1095. Case 2 : PlaySound "fx_BallDrop2"
  1096. Case 3 : PlaySound "fx_BallDrop3"
  1097. End Select
  1098. End Sub
Advertisement
Add Comment
Please, Sign In to add comment