Arngrim

NBAFB controller vbs

Jul 2nd, 2017
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.05 KB | None | 0 0
  1. ' NBA Fastbreak / IPD No. 4023 / March, 1997 / 4 Players
  2. ' http://www.ipdb.org/machine.cgi?id=4023
  3. ' VP915 v1.0 by JPSalas 2013
  4. ' based on the tables by Aurich and bmiki75
  5.  
  6. Option Explicit
  7. Randomize
  8.  
  9. On Error Resume Next
  10. ExecuteGlobal GetTextFile("controller.vbs")
  11. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  12. On Error Goto 0
  13.  
  14. Const BallSize = 50 'add this here to redefine the ball size, placed before LoadVPM.'
  15.  
  16. LoadVPM "01120100", "WPC.VBS", 3.37 'minimum core.vbs version
  17.  
  18. Dim bsTrough, bsEject, bsSaucer1, bsSaucer2, bsSaucer3, bsSaucer4, mBallCatch, mDefender
  19. Dim PlungerIM, x, bump1, bump2, bump3
  20.  
  21. Const UseSolenoids = 1
  22. Const UseLamps = 0
  23. Const UseGI = 1
  24. Const UseSync = 0 'set it to 1 if the table runs too fast
  25. Const HandleMech = 1
  26.  
  27. ' Standard Sounds
  28. Const SSolenoidOn = "fx_Solenoidon"
  29. Const SSolenoidOff = "fx_SolenoidOff"
  30. Const SFlipperOn = "fx_flipperup1"
  31. Const SFlipperoff = "fx_flipperdown"
  32. Const SCoin = "fx_coin"
  33.  
  34. Set GiCallback2 = GetRef("UpdateGI")
  35.  
  36. sub updategi (no, Enabled)
  37. if Enabled Then
  38. DOF 101, DOFOn
  39. debug.print "ON"
  40. Else
  41. DOF 101, DOFOff
  42. debug.print "OFF"
  43. End if
  44. ' Eval("textbox"&no).text=enabled
  45. end sub
  46.  
  47. Set MotorCallback = GetRef("GameTimer") 'realtime updates - flipper logos, rolling sound
  48.  
  49. Sub table1_Init
  50. Dim cGameName, ii
  51. With Controller
  52. cGameName = "nbaf_31"
  53. .GameName = cGameName
  54. .SplashInfoLine = "NBA Fastbreak, Bally 1997" & vbNewLine & "VP915 table by JPSalas v.1.0"
  55. .Games(cGameName).Settings.Value("rol") = 0 'rotated vpm display
  56. .HandleMechanics = 0
  57. .HandleKeyboard = 0
  58. .ShowDMDOnly = 1
  59. .ShowFrame = 0
  60. .ShowTitle = 0
  61. .Hidden = 0
  62. ' .Games(cGameName).Settings.Value("dmd_pos_x")=0
  63. ' .Games(cGameName).Settings.Value("dmd_pos_y")=0
  64. If Err Then MsgBox Err.Description
  65. End With
  66. On Error Goto 0
  67. Controller.SolMask(0) = 0
  68. vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the Timer to renable all the solenoids after 2 seconds
  69. Controller.DIP(0) = &H00
  70. Controller.Run GetPlayerHWnd
  71. Controller.Switch(22) = 1 'close coin door
  72. Controller.Switch(24) = 1 'and keep it close
  73.  
  74. ' Nudging
  75. vpmNudge.TiltSwitch = 14
  76. vpmNudge.Sensitivity = 1
  77. vpmNudge.TiltObj = Array(LeftSlingshot, RightSlingshot, bumper1, bumper2, bumper3)
  78.  
  79. ' Trough & Ball Release
  80. Set bsTrough = New cvpmBallStack
  81. With bsTrough
  82. .InitSw 0, 32, 33, 34, 35, 31, 0, 0
  83. .InitKick BallRelease, 180, 10
  84. .InitExitSnd SoundFX("fx_Ballrel",DOFContactors), SoundFX("fx_solenoid",DOFContactors)
  85. .InitEntrySnd "fx_solenoid", "fx_solenoid"
  86. .IsTrough = True
  87. .Balls = 4
  88. End With
  89.  
  90. ' Ball Catch Magnet
  91. Set mBallCatch = New cvpmMagnet
  92. With mBallCatch
  93. .InitMagnet BCMagnet, 60
  94. .Solenoid = 8
  95. .GrabCenter = 1
  96. End With
  97.  
  98. ' Eject
  99. Set bsEject = New cvpmBallStack
  100. With bsEject
  101. .InitSaucer sw25, 25, 165, 7
  102. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  103. End With
  104.  
  105. ' Saucers (In the Paint)
  106. Set bsSaucer1 = New cvpmBallStack
  107. With bsSaucer1
  108. .InitSaucer sw68, 68, 65, 32
  109. .Kickz = 1.2
  110. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  111. End With
  112.  
  113. Set bsSaucer2 = New cvpmBallStack
  114. With bsSaucer2
  115. .InitSaucer sw67, 67, 26, 28
  116. .Kickz = 1.15
  117. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  118. End With
  119.  
  120. Set bsSaucer3 = New cvpmBallStack
  121. With bsSaucer3
  122. .InitSaucer sw66, 66, 310, 32
  123. .Kickz = 1.15
  124. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  125. End With
  126.  
  127. Set bsSaucer4 = New cvpmBallStack
  128. With bsSaucer4
  129. .InitSaucer sw65, 65, 293, 31.5
  130. .Kickz = 1.2
  131. .InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
  132. End With
  133.  
  134. ' Defender
  135. Set mDefender = New cvpmMech
  136. With mDefender
  137. .MType = vpmMechOneDirSol + vpmMechStopEnd + vpmMechLinear
  138. .Sol1 = 37 'Enable
  139. .Sol2 = 38 'Direction
  140. .Length = 65
  141. .Steps = 65
  142. .AddSw 51, 0, 1
  143. .AddSw 52, 17, 18
  144. .AddSw 53, 31, 32
  145. .AddSw 54, 44, 45
  146. .AddSw 55, 64, 65
  147. .CallBack = GetRef("UpdateDefender")
  148. .Start
  149. End With
  150. UpdateDefender 32, 32, 32
  151.  
  152. 'Impulse Plunger
  153. Const IMPowerSetting = 38 ' Plunger Power
  154. Const IMTime = 1.1 ' Time in seconds for Full Plunge
  155. Set plungerIM = New cvpmImpulseP
  156. With plungerIM
  157. .InitImpulseP swPlunger, IMPowerSetting, IMTime
  158. .Switch 15
  159. .Random 5
  160. .InitExitSnd "fx_plunger2", "fx_plunger"
  161. .CreateEvents "plungerIM"
  162. End With
  163.  
  164. ' Misc. Initialisation
  165. LeftSLing.IsDropped = 1:LeftSLing2.IsDropped = 1:LeftSLing3.IsDropped = 1
  166. RightSLing.IsDropped = 1:RightSLing2.IsDropped = 1:RightSLing3.IsDropped = 1
  167. LeftSLingH.IsDropped = 1:LeftSLingH2.IsDropped = 1:LeftSLingH3.IsDropped = 1
  168. RightSLingH.IsDropped = 1:RightSLingH2.IsDropped = 1:RightSLingH3.IsDropped = 1
  169. sw41a.IsDropped = 1:sw42a.IsDropped = 1:sw43a.IsDropped = 1
  170. sw28a.IsDropped = 1:sw18a.IsDropped = 1
  171.  
  172. For each ii in ADef1:ii.Isdropped = 1:Next
  173. For each ii in ADef2:ii.visible = 0:ii.Collidable = 0:Next
  174.  
  175. 'BackBall.CreateSizedBall(20).Image = "BasketBall"
  176.  
  177. ' Main Timer init
  178. PinMAMETimer.Interval = PinMAMEInterval
  179. PinMAMETimer.Enabled = 1
  180. 'StartShake
  181. End Sub
  182.  
  183. '**********
  184. ' Keys
  185. '**********
  186.  
  187. Sub table1_KeyDown(ByVal Keycode)
  188. If keycode = PlungerKey Then PlaySound "fx_PlungerPull":Controller.Switch(11) = 1
  189. If keycode = LeftTiltKey Then LeftNudge 90, 1.6, 20:PlaySound SoundFX("fx_nudge_left",0)
  190. If keycode = RightTiltKey Then RightNudge 270, 1.6, 20:PlaySound SoundFX("fx_nudge_right",0)
  191. If keycode = CenterTiltKey Then CenterNudge 0, 2.8, 30:PlaySound SoundFX("fx_nudge_forward",0)
  192. If vpmKeyDown(keycode) Then Exit Sub
  193. End Sub
  194.  
  195. Sub table1_KeyUp(ByVal Keycode)
  196. If vpmKeyUp(keycode) Then Exit Sub
  197. If keycode = PlungerKey Then Controller.Switch(11) = 0
  198. End Sub
  199.  
  200. '*************************************
  201. ' Nudge System
  202. ' based on Noah's nudgetest table
  203. '*************************************
  204.  
  205. Dim LeftNudgeEffect, RightNudgeEffect, NudgeEffect
  206.  
  207. Sub LeftNudge(angle, strength, delay)
  208. vpmNudge.DoNudge angle, (strength * (delay-LeftNudgeEffect) / delay) + RightNudgeEffect / delay
  209. LeftNudgeEffect = delay
  210. RightNudgeEffect = 0
  211. RightNudgeTimer.Enabled = 0
  212. LeftNudgeTimer.Interval = delay
  213. LeftNudgeTimer.Enabled = 1
  214. End Sub
  215.  
  216. Sub RightNudge(angle, strength, delay)
  217. vpmNudge.DoNudge angle, (strength * (delay-RightNudgeEffect) / delay) + LeftNudgeEffect / delay
  218. RightNudgeEffect = delay
  219. LeftNudgeEffect = 0
  220. LeftNudgeTimer.Enabled = 0
  221. RightNudgeTimer.Interval = delay
  222. RightNudgeTimer.Enabled = 1
  223. End Sub
  224.  
  225. Sub CenterNudge(angle, strength, delay)
  226. vpmNudge.DoNudge angle, strength * (delay-NudgeEffect) / delay
  227. NudgeEffect = delay
  228. NudgeTimer.Interval = delay
  229. NudgeTimer.Enabled = 1
  230. End Sub
  231.  
  232. Sub LeftNudgeTimer_Timer()
  233. LeftNudgeEffect = LeftNudgeEffect-1
  234. If LeftNudgeEffect = 0 then LeftNudgeTimer.Enabled = 0
  235. End Sub
  236.  
  237. Sub RightNudgeTimer_Timer()
  238. RightNudgeEffect = RightNudgeEffect-1
  239. If RightNudgeEffect = 0 then RightNudgeTimer.Enabled = 0
  240. End Sub
  241.  
  242. Sub NudgeTimer_Timer()
  243. NudgeEffect = NudgeEffect-1
  244. If NudgeEffect = 0 then NudgeTimer.Enabled = False
  245. End Sub
  246.  
  247. '*********
  248. ' Switches
  249. '*********
  250.  
  251. Dim LStep, RStep
  252.  
  253. Sub LeftSlingShot_Slingshot:LeftSling.IsDropped = 0:PlaySound SoundFX("fx_slingshot1",DOFContactors):vpmTimer.PulseSw 57:LStep = 0:Me.TimerEnabled = 1:End Sub
  254.  
  255. Sub LeftSlingShot_Timer
  256. Select Case LStep
  257. Case 0:LeftSLing.IsDropped = 0:LeftSLingH.IsDropped = 0
  258. Case 1: 'pause
  259. Case 2:LeftSLing.IsDropped = 1:LeftSLing2.IsDropped = 0:LeftSLingH.IsDropped = 1:LeftSLingH2.IsDropped = 0
  260. Case 3:LeftSLing2.IsDropped = 1:LeftSLing3.IsDropped = 0:LeftSLingH2.IsDropped = 1:LeftSLingH3.IsDropped = 0
  261. Case 4:LeftSLing3.IsDropped = 1:LeftSLingH3.IsDropped = 1:Me.TimerEnabled = 0
  262. End Select
  263.  
  264. LStep = LStep + 1
  265. End Sub
  266.  
  267. Sub RightSlingShot_Slingshot:RightSling.IsDropped = 0:PlaySound SoundFX("fx_slingshot2",DOFContactors):vpmTimer.PulseSw 58:RStep = 0:Me.TimerEnabled = 1:End Sub
  268. Sub RightSlingShot_Timer
  269. Select Case RStep
  270. Case 0:RightSLing.IsDropped = 0:RightSLingH.IsDropped = 0
  271. Case 1: 'pause
  272. Case 2:RightSLing.IsDropped = 1:RightSLing2.IsDropped = 0:RightSLingH.IsDropped = 1:RightSLingH2.IsDropped = 0
  273. Case 3:RightSLing2.IsDropped = 1:RightSLing3.IsDropped = 0:RightSLingH2.IsDropped = 1:RightSLingH3.IsDropped = 0
  274. Case 4:RightSLing3.IsDropped = 1:RightSLingH3.IsDropped = 1:Me.TimerEnabled = 0
  275. End Select
  276.  
  277. RStep = RStep + 1
  278. End Sub
  279.  
  280. ' Bumpers
  281. Sub Bumper1_Hit:vpmTimer.PulseSw 61:PlaySound SoundFX("fx_bumper1",DOFContactors):bump1 = 1:Me.TimerEnabled = 1:End Sub
  282. Sub Bumper1_Timer()
  283. Select Case bump1
  284. Case 1:Ring1.HeightTop = 15:Ring1.HeightBottom = 15:bump1 = 2
  285. Case 2:Ring1.HeightTop = 25:Ring1.HeightBottom = 25:bump1 = 3
  286. Case 3:Ring1.HeightTop = 35:Ring1.HeightBottom = 35:bump1 = 4
  287. Case 4:Ring1.HeightTop = 45:Ring1.HeightBottom = 45:Me.TimerEnabled = 0
  288. End Select
  289.  
  290. 'Bumper1R.State = ABS(Bumper1R.State - 1) 'refresh light
  291. End Sub
  292.  
  293. Sub Bumper2_Hit:vpmTimer.PulseSw 23:PlaySound SoundFX("fx_bumper2",DOFContactors):bump2 = 1:Me.TimerEnabled = 1:End Sub
  294. Sub Bumper2_Timer()
  295. Select Case bump2
  296. Case 1:Ring2.HeightTop = 15:Ring2.HeightBottom = 15:bump2 = 2
  297. Case 2:Ring2.HeightTop = 25:Ring2.HeightBottom = 25:bump2 = 3
  298. Case 3:Ring2.HeightTop = 35:Ring2.HeightBottom = 35:bump2 = 4
  299. Case 4:Ring2.HeightTop = 45:Ring2.HeightBottom = 45:Me.TimerEnabled = 0
  300. End Select
  301.  
  302. ' Bumper2R.State = ABS(Bumper2R.State - 1) 'refresh light
  303. End Sub
  304.  
  305. Sub Bumper3_Hit:vpmTimer.PulseSw 62:PlaySound SoundFX("fx_bumper3",DOFContactors):bump3 = 1:Me.TimerEnabled = 1:End Sub
  306. Sub Bumper3_Timer()
  307. Select Case bump3
  308. Case 1:Ring3.HeightTop = 15:Ring3.HeightBottom = 15:bump3 = 2
  309. Case 2:Ring3.HeightTop = 25:Ring3.HeightBottom = 25:bump3 = 3
  310. Case 3:Ring3.HeightTop = 35:Ring3.HeightBottom = 35:bump3 = 4
  311. Case 4:Ring3.HeightTop = 45:Ring3.HeightBottom = 45:Me.TimerEnabled = 0
  312. End Select
  313.  
  314. ' Bumper3R.State = ABS(Bumper3R.State - 1) 'refresh light
  315. End Sub
  316.  
  317. ' Eject holes
  318. Sub Drain_Hit:ClearBallID:Playsound "fx_drain":bsTrough.AddBall Me:End Sub
  319. Sub sw25_Hit:Playsound "fx_kicker_enter":bsEject.AddBall 0:End Sub
  320.  
  321. Sub sw65_Hit
  322. PlaySound "fx_kicker_enter"
  323. bsSaucer4.AddBall 0
  324. End Sub
  325.  
  326. Sub sw66_Hit
  327. PlaySound "fx_kicker_enter"
  328. bsSaucer3.AddBall 0
  329. End Sub
  330.  
  331. Sub sw67_Hit
  332. PlaySound "fx_kicker_enter"
  333. bsSaucer2.AddBall 0
  334. End Sub
  335.  
  336. Sub sw68_Hit
  337. PlaySound "fx_kicker_enter"
  338. bsSaucer1.AddBall 0
  339. End Sub
  340.  
  341. ' Rollovers
  342. Sub sw26_Hit:la1.IsDropped = 1:Controller.Switch(26) = 1:PlaySound "fx_sensor":End Sub
  343. Sub sw26_UnHit:la1.IsDropped = 0:Controller.Switch(26) = 0:End Sub
  344.  
  345. Sub sw16_Hit:la2.IsDropped = 1:Controller.Switch(16) = 1:PlaySound "fx_sensor":End Sub
  346. Sub sw16_UnHit:la2.IsDropped = 0:Controller.Switch(16) = 0:End Sub
  347.  
  348. Sub sw17_Hit:la3.IsDropped = 1:Controller.Switch(17) = 1:PlaySound "fx_sensor":End Sub
  349. Sub sw17_UnHit:la3.IsDropped = 0:Controller.Switch(17) = 0:End Sub
  350.  
  351. Sub sw27_Hit:la4.IsDropped = 1:Controller.Switch(27) = 1:PlaySound "fx_sensor":End Sub
  352. Sub sw27_UnHit:la4.IsDropped = 0:Controller.Switch(27) = 0:End Sub
  353.  
  354. Sub sw56_Hit:la5.IsDropped = 1:Controller.Switch(56) = 1:PlaySound "fx_sensor":End Sub
  355. Sub sw56_UnHit:la5.IsDropped = 0:Controller.Switch(56) = 0:End Sub
  356.  
  357. Sub sw38_Hit:la6.IsDropped = 1:Controller.Switch(38) = 1:PlaySound "fx_sensor":End Sub
  358. Sub sw38_UnHit:la6.IsDropped = 0:Controller.Switch(38) = 0:End Sub
  359.  
  360. Sub sw48_Hit:la7.IsDropped = 1:Controller.Switch(48) = 1:PlaySound "fx_sensor":End Sub
  361. Sub sw48_UnHit:la7.IsDropped = 0:Controller.Switch(48) = 0:End Sub
  362.  
  363. 'Optos
  364. Sub sw36_Hit:Controller.Switch(36) = 1:End Sub
  365. Sub sw36_UnHit:Controller.Switch(36) = 0:End Sub
  366.  
  367. Sub sw47_Hit:Controller.Switch(47) = 1:End Sub
  368. Sub sw47_UnHit:Controller.Switch(47) = 0:End Sub
  369.  
  370. Sub sw45_Hit:Controller.Switch(45) = 1:End Sub
  371. Sub sw45_UnHit:Controller.Switch(45) = 0:End Sub
  372.  
  373. Sub sw46_Hit:Controller.Switch(46) = 1:PlaySound "fx_metalrolling":ActiveBall.VelY = 10:End Sub
  374. Sub sw46_UnHit:Controller.Switch(46) = 0:End Sub
  375.  
  376. Sub sw44_Hit:Controller.Switch(44) = 1:End Sub
  377. Sub sw44_UnHit:Controller.Switch(44) = 0:End Sub
  378.  
  379. Sub sw37_Hit:Controller.Switch(37) = 1:End Sub
  380. Sub sw37_UnHit:Controller.Switch(37) = 0:End Sub
  381.  
  382. Sub sw64_Hit:Controller.Switch(64) = 1:End Sub
  383. Sub sw64_UnHit:Controller.Switch(64) = 0:End Sub
  384.  
  385. Sub sw63_Hit:Controller.Switch(63) = 1:End Sub
  386. Sub sw63_UnHit:Controller.Switch(63) = 0:End Sub
  387.  
  388. Sub sw115_Hit:Controller.Switch(115) = 1:End Sub
  389. Sub sw115_UnHit:Controller.Switch(115) = 0:End Sub
  390.  
  391. Sub sw117_Hit:Controller.Switch(117) = 1:End Sub
  392. Sub sw117_UnHit:Controller.Switch(117) = 0:End Sub
  393.  
  394. Sub sw12_Hit:Controller.Switch(12) = 1:End Sub
  395. Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
  396.  
  397. 'Targets
  398. Sub sw41_Hit:sw41.IsDropped = 1:sw41a.IsDropped = 0:Me.TimerEnabled = 1:vpmTimer.PulseSw 41:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  399. Sub sw41_Timer:sw41.IsDropped = 0:sw41a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  400.  
  401. Sub sw42_Hit:sw42.IsDropped = 1:sw42a.IsDropped = 0:Me.TimerEnabled = 1:vpmTimer.PulseSw 42:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  402. Sub sw42_Timer:sw42.IsDropped = 0:sw42a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  403.  
  404. Sub sw43_Hit:sw43.IsDropped = 1:sw43a.IsDropped = 0:Me.TimerEnabled = 1:vpmTimer.PulseSw 43:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  405. Sub sw43_Timer:sw43.IsDropped = 0:sw43a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  406.  
  407. Sub sw18_Hit:sw18.IsDropped = 1:sw18a.IsDropped = 0:Me.TimerEnabled = 1:vpmTimer.PulseSw 18:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  408. Sub sw18_Timer:sw18.IsDropped = 0:sw18a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  409.  
  410. Sub sw28_Hit:sw28.IsDropped = 1:sw28a.IsDropped = 0:Me.TimerEnabled = 1:vpmTimer.PulseSw 28:PlaySound SoundFX("fx_target",DOFTargets):End Sub
  411. Sub sw28_Timer:sw28.IsDropped = 0:sw28a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
  412.  
  413. '***********
  414. ' Solenoids
  415. '***********
  416.  
  417. SolCallBack(1) = "Auto_Plunger"
  418. 'SolCallBack(2) = Not Used
  419. SolCallBack(3) = "vpmSolWall Diverter2,True,"
  420. SolCallBack(4) = "vpmSolWall Diverter1,True,"
  421. SolCallBack(5) = "bsEject.SolOut"
  422. SolCallBack(6) = "RightGate.Open ="
  423. 'SolCallBack(7) = "SolBasket"
  424. 'SolCallBack(8) ' magnet - handled in the magnet definition
  425. SolCallBack(9) = "bsTrough.SolOut"
  426. 'SolCallBack(10) = "vpmSolSound ""lSling"","
  427. 'SolCallBack(11) = "vpmSolSound ""lSling"","
  428. 'SolCallBack(12) = "vpmSolSound ""Jet1"","
  429. 'SolCallBack(13) = "vpmSolSound ""Jet1"","
  430. 'SolCallBack(14) = "vpmSolSound ""Jet1"","
  431.  
  432. SolCallBack(15) = "PassRight2"
  433. SolCallBack(16) = "PassLeft2"
  434.  
  435. SolCallBack(17) = "SetLamp 117,"
  436. SolCallBack(18) = "SetLamp 118,"
  437. SolCallBack(19) = "SetLamp 119,"
  438. SolCallBack(20) = "SetLamp 120,"
  439. SolCallBack(22) = "SetLamp 122,"
  440. SolCallBack(24) = "SetLamp 124,"
  441.  
  442. SolCallBack(25) = "PassRight1"
  443. SolCallBack(26) = "PassLeft3"
  444. SolCallBack(27) = "PassRight3"
  445. SolCallBack(28) = "PassLeft4"
  446.  
  447. SolCallBack(33) = "bsSaucer1.SolOut"
  448. SolCallBack(34) = "bsSaucer2.SolOut"
  449. SolCallBack(35) = "bsSaucer3.SolOut"
  450. SolCallBack(36) = "bsSaucer4.SolOut"
  451. 'SolCallBack(37) = Motor Enable (defender) - handled in the mech
  452. 'SolCallBack(38) = Motor Direction (defender) - handled in the mech
  453. SolCallBack(39) = "ClockEnable"
  454. SolCallBack(40) = "ClockCount"
  455.  
  456. Sub Auto_Plunger(Enabled)
  457. If Enabled Then
  458. PlungerIM.AutoFire
  459. End If
  460. End Sub
  461.  
  462. Sub SolBasket(Enabled)
  463. If Enabled Then
  464. BackBall.Kick 330, 26
  465. End If
  466. End Sub
  467.  
  468. Sub BackBall1_Hit
  469. BackBall1.Destroyball
  470. BackBall.CreateSizedBall(20).Image = "BasketBall"
  471. End Sub
  472.  
  473. Sub UpdateDefender(aNewPos, aSpeed, aLastPos)
  474. ADef1(aLastPos).IsDropped = True
  475. ADef1(aNewPos).IsDropped = False
  476. ADef2(aLastPos).visible = 0:ADef2(aLastPos).collidable = 0
  477. ADef2(aNewPos).visible = 1:ADef2(aNewPos).collidable = 1
  478. 'DefR.State = ABS(DefR.State -1)
  479. End Sub
  480.  
  481. ' In The Paint
  482.  
  483. Sub PassRight1(Enabled)
  484. If Enabled then
  485. bsSaucer1.Kickz = 0
  486. bsSaucer1.InitAltKick 110, 6
  487. bsSaucer1.ExitAltSol_On
  488. bsSaucer1.Kickz = 1.2
  489. End If
  490. End Sub
  491.  
  492. Sub PassRight2(Enabled)
  493. If Enabled then
  494. bsSaucer2.Kickz = 0
  495. bsSaucer2.InitAltKick 70, 8
  496. bsSaucer2.ExitAltSol_On
  497. bsSaucer2.Kickz = 1.15
  498. End If
  499. End Sub
  500.  
  501. Sub PassRight3(Enabled)
  502. If Enabled then
  503. bsSaucer3.Kickz = 0
  504. bsSaucer3.InitAltKick 45, 8
  505. bsSaucer3.ExitAltSol_On
  506. bsSaucer3.Kickz = 1.15
  507. End If
  508. End Sub
  509.  
  510. Sub PassLeft2(Enabled)
  511. If Enabled then
  512. bsSaucer2.Kickz = 0
  513. bsSaucer2.InitAltKick 310, 7
  514. bsSaucer2.ExitAltSol_On
  515. bsSaucer2.Kickz = 1.15
  516. End If
  517. End Sub
  518.  
  519. Sub PassLeft3(Enabled)
  520. If Enabled then
  521. bsSaucer3.Kickz = 0
  522. bsSaucer3.InitAltKick 290, 8
  523. bsSaucer3.ExitAltSol_On
  524. bsSaucer3.Kickz = 1.15
  525. End If
  526. End Sub
  527.  
  528. Sub PassLeft4(Enabled)
  529. If Enabled then
  530. bsSaucer4.Kickz = 0
  531. bsSaucer4.InitAltKick 250, 4
  532. bsSaucer4.ExitAltSol_On
  533. bsSaucer4.Kickz = 1.2
  534. End If
  535. End Sub
  536.  
  537. 'Clock display
  538. Dim Clock
  539. Clock = 24
  540.  
  541. Sub ClockEnable(Enabled)
  542. If Enabled Then
  543. Clock = 24
  544. UpdateClock
  545. Else
  546. Clock = 24
  547. UpdateClock
  548. ClockTimer.Enabled = False
  549. End If
  550. End Sub
  551.  
  552. Sub ClockCount(Enabled)
  553. If Enabled Then
  554. ClockTimer.Enabled = True
  555. Else
  556. ClockTimer.Enabled = False
  557. End If
  558. End Sub
  559.  
  560. Sub ClockTimer_Timer()
  561. If Clock > 0 Then
  562. Clock = Clock -1
  563. UpdateClock
  564. Else
  565. Me.Enabled = False
  566. End If
  567. End Sub
  568.  
  569. Sub UpdateClock
  570. clockdisp.Image = "clock" & clock
  571. End Sub
  572.  
  573. '***************************************
  574. ' Special JP Flippers, including:
  575. ' - tap code by Jimmifingers
  576. ' - recoil fix to enable dropcatches
  577. ' - ball hit sound
  578. '**************************************
  579.  
  580. SolCallback(sLRFlipper) = "SolRFlipper"
  581. SolCallback(sLLFlipper) = "SolLFlipper"
  582. 'Dim StartLeftFlipperStrength, StartRightFlipperStrength
  583. 'Dim StartLeftFlipperSpeed, StartRightFlipperSpeed
  584. 'Dim StartLeftFlipperReturn, StartRightFlipperReturn
  585. 'Dim StartLeftFlipperRecoil, StartRightFlipperRecoil
  586. '
  587. 'StartLeftFlipperStrength = LeftFlipper.Strength
  588. 'StartRightFlipperStrength = RightFlipper.Strength
  589. 'StartLeftFlipperSpeed = LeftFlipper.Speed
  590. 'StartRightFlipperSpeed = RightFlipper.Speed
  591. 'StartLeftFlipperReturn = LeftFlipper.Return
  592. 'StartRightFlipperReturn = RightFlipper.Return
  593. 'StartLeftFlipperRecoil = LeftFlipper.Recoil
  594. 'StartRightFlipperRecoil = LeftFlipper.Recoil
  595.  
  596. Sub SolLFlipper(Enabled)
  597. If Enabled Then
  598. LeftFlipper.TimerEnabled = 0
  599. PlaySound SoundFX("fx_flipperup1",DOFFlippers)
  600. LeftFlipper.RotateToEnd
  601. Else
  602. ' LFTCount = 1
  603. PlaySound SoundFX("fx_flipperdown",DOFFlippers)
  604. ' LeftFlipper.Recoil = 0.5 'decrease the recoil to allow drop catches
  605. ' LeftFlipper.Speed = .05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  606. ' LeftFlipper.Return = 0.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  607. '
  608. LeftFlipper.RotateToStart
  609. ' LeftFlipper.Strength = StartLeftFlipperStrength * (LFTCount / 6)
  610. ' LeftFlipper.TimerEnabled = 1
  611. ' LeftFlipper.Speed = StartLeftFlipperSpeed
  612. ' LeftFlipper.Return = StartLeftFlipperReturn
  613. ' LeftFlipper.Recoil = StartLeftFlipperRecoil
  614. End If
  615. End Sub
  616.  
  617. Sub SolRFlipper(Enabled)
  618. If Enabled Then
  619. RightFlipper.TimerEnabled = 0
  620. PlaySound SoundFX("fx_flipperup1",DOFFlippers)
  621. RightFlipper.RotateToEnd
  622. Else
  623. ' RFTCount = 1
  624. PlaySound SoundFX("fx_flipperdown",DOFFlippers)
  625. ' RightFlipper.Recoil = 0.5 'decrease the recoil to allow drop catches
  626. ' RightFlipper.Speed = .05 'Temporarily drop speed for slower back draw to help visuals on quick tap
  627. ' RightFlipper.Return = 0.3 'Increase Return strength to compensate for speed drop on return to help against weak ball hit strength from underneath flipper (draining position)
  628. '
  629. RightFlipper.RotateToStart
  630. ' RightFlipper.Strength = StartRightFlipperStrength * (LFTCount / 6)
  631. ' RightFlipper.TimerEnabled = 1
  632. ' RightFlipper.Speed = StartRightFlipperSpeed
  633. ' RightFlipper.Return = StartRightFlipperReturn
  634. ' RightFlipper.Recoil = StartRightFlipperRecoil
  635. End If
  636. End Sub
  637.  
  638. 'Dim LFTCount:LFTCount = 1
  639.  
  640. 'Sub LeftFlipper_Timer()
  641. ' If LFTCount < 6 Then
  642. ' LFTCount = LFTCount + 1
  643. ' LeftFlipper.Strength = StartLeftFlipperStrength * (LFTCount / 6)
  644. ' Else
  645. ' Me.TimerEnabled = 0
  646. ' End If
  647. 'End Sub
  648. '
  649. 'Dim RFTCount:RFTCount = 1
  650. '
  651. 'Sub RightFlipper_Timer()
  652. ' If RFTCount < 6 Then
  653. ' RFTCount = RFTCount + 1
  654. ' RightFlipper.Strength = StartRightFlipperStrength * (RFTCount / 6)
  655. ' Else
  656. ' Me.TimerEnabled = 0
  657. ' End If
  658. 'End Sub
  659.  
  660. Sub LeftFlipper_Collide(parm)
  661. PlaySound "fx_rubber_flipper"
  662. End Sub
  663.  
  664. Sub RightFlipper_Collide(parm)
  665. PlaySound "fx_rubber_flipper"
  666. End Sub
  667.  
  668. '***********************
  669. ' Flipper Logos
  670. '***********************
  671.  
  672. Sub UpdateFlipperLogos
  673. LFLogo.RotAndTra2 = LeftFlipper.CurrentAngle
  674. RFlogo.RotAndTra2 = RightFlipper.CurrentAngle
  675. End Sub
  676.  
  677. '******************
  678. ' RealTime Updates
  679. '******************
  680. Set MotorCallback = GetRef("GameTimer")
  681.  
  682. Sub GameTimer
  683. RollingSound
  684. UpdateFlipperLogos
  685. End Sub
  686.  
  687. '*************************
  688. ' Ball Rolling Sound
  689. ' Based on rascal's code
  690. '*************************
  691. Dim VeloY(3), VeloX(3), rolling(3), b
  692. b = 0
  693.  
  694. Sub RollingSound()
  695. b = b + 1
  696. If b > 3 Then b = 1
  697. If BallStatus(b) = 0 Then
  698. If rolling(b) = True Then
  699. StopSound "fx_ballrolling" &b
  700. rolling(b) = False
  701. Exit Sub
  702. Else
  703. Exit Sub
  704. End If
  705. End if
  706.  
  707. VeloY(b) = Cint(CurrentBall(b).VelY)
  708. VeloX(b) = Cint(CurrentBall(b).VelX)
  709. If(ABS(VeloY(b) ) > 3 or ABS(VeloX(b) ) > 3) and CurrentBall(b).Z < 55 Then 'do not sound if the ball is on a ramp
  710. If rolling(b) = True then
  711. Exit Sub
  712. Else
  713. rolling(b) = True
  714. PlaySound "fx_ballrolling" &b
  715. End If
  716. Else
  717. If rolling(b) = True Then
  718. StopSound "fx_ballrolling" &b
  719. rolling(b) = False
  720. End If
  721. End If
  722. End Sub
  723.  
  724. '*************************************************
  725. ' destruk's new vpmCreateBall for ball collision
  726. ' use it: vpmCreateBall kicker
  727. '*************************************************
  728.  
  729. Set vpmCreateBall = GetRef("mycreateball")
  730. Function mycreateball(aKicker)
  731. For cnt = 1 to ubound(ballStatus)
  732. If ballStatus(cnt) = 0 Then
  733. If Not IsEmpty(vpmBallImage) Then
  734. Set CurrentBall(cnt) = aKicker.CreateSizedBall(BSize).Image
  735. Else
  736. Set CurrentBall(cnt) = aKicker.CreateSizedBall(BSize)
  737. End If
  738. Set mycreateball = aKicker
  739. currentball(cnt).uservalue = cnt
  740. ballStatus(cnt) = 1
  741. ballStatus(0) = ballStatus(0) + 1
  742. If coff = False Then
  743. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  744. End If
  745. Exit For
  746. End If
  747. Next
  748. End Function
  749.  
  750. '**************************************************************
  751. ' vpm Ball Collision based on the code by Steely & Pinball Ken
  752. ' added destruk's changes, ball size and height check by koadic
  753. '**************************************************************
  754.  
  755. Const tnopb = 10 'max nr. of balls
  756. Const nosf = 10 'nr. of sound files
  757.  
  758. ReDim CurrentBall(tnopb), BallStatus(tnopb)
  759. Dim iball, cnt, coff, errMessage
  760.  
  761. XYdata.interval = 1
  762. coff = False
  763.  
  764. For cnt = 0 to ubound(BallStatus):BallStatus(cnt) = 0:Next
  765.  
  766. ' Create ball in kicker and assign a Ball ID used mostly in non-vpm tables
  767. Sub CreateBallID(aKicker)
  768. For cnt = 1 to ubound(ballStatus)
  769. If ballStatus(cnt) = 0 Then
  770. Set CurrentBall(cnt) = aKicker.CreateSizedBall(Bsize)
  771. currentball(cnt).uservalue = cnt
  772. ballStatus(cnt) = 1
  773. ballStatus(0) = ballStatus(0) + 1
  774. If coff = False Then
  775. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  776. End If
  777. Exit For
  778. End If
  779. Next
  780. End Sub
  781.  
  782. Sub ClearBallID
  783. On Error Resume Next
  784. iball = ActiveBall.uservalue
  785. currentball(iball).UserValue = 0
  786. If Err Then Msgbox Err.description & vbCrLf & iball
  787. ballStatus(iBall) = 0
  788. ballStatus(0) = ballStatus(0) -1
  789. On Error Goto 0
  790. End Sub
  791.  
  792. ' Ball data collection and B2B Collision detection. jpsalas: added height check
  793. ReDim baX(tnopb, 4), baY(tnopb, 4), baZ(tnopb, 4), bVx(tnopb, 4), bVy(tnopb, 4), TotalVel(tnopb, 4)
  794. Dim cForce, bDistance, xyTime, cFactor, id, id2, id3, B1, B2
  795.  
  796. Sub XYdata_Timer()
  797. xyTime = Timer + (XYdata.interval * .001)
  798. If id2 >= 4 Then id2 = 0
  799. id2 = id2 + 1
  800. For id = 1 to ubound(ballStatus)
  801. If ballStatus(id) = 1 Then
  802. baX(id, id2) = round(currentball(id).x, 2)
  803. baY(id, id2) = round(currentball(id).y, 2)
  804. baZ(id, id2) = round(currentball(id).z, 2)
  805. bVx(id, id2) = round(currentball(id).velx, 2)
  806. bVy(id, id2) = round(currentball(id).vely, 2)
  807. TotalVel(id, id2) = (bVx(id, id2) ^2 + bVy(id, id2) ^2)
  808. If TotalVel(id, id2) > TotalVel(0, 0) Then TotalVel(0, 0) = int(TotalVel(id, id2) )
  809. End If
  810. Next
  811.  
  812. id3 = id2:B2 = 2:B1 = 1
  813. Do
  814. If ballStatus(B1) = 1 and ballStatus(B2) = 1 Then
  815. bDistance = int((TotalVel(B1, id3) + TotalVel(B2, id3) ) ^(1.04 * (CurrentBall(B1).radius + CurrentBall(B2).radius) / 50) )
  816. If((baX(B1, id3) - baX(B2, id3) ) ^2 + (baY(B1, id3) - baY(B2, id3) ) ^2) < (2800 * ((CurrentBall(B1).radius + CurrentBall(B2).radius) / 50) ^2) + bDistance Then
  817. If ABS(baZ(B1, id3) - baZ(B2, id3) ) < (CurrentBall(B1).radius + CurrentBall(B2).radius) Then collide B1, B2:Exit Sub
  818. End If
  819. End If
  820. B1 = B1 + 1
  821. If B1 = ubound(ballstatus) Then Exit Do
  822. If B1 >= B2 then B1 = 1:B2 = B2 + 1
  823. Loop
  824.  
  825. If ballStatus(0) <= 1 Then XYdata.enabled = False
  826.  
  827. If XYdata.interval >= 40 Then coff = True:XYdata.enabled = False
  828. If Timer > xyTime * 3 Then coff = True:XYdata.enabled = False
  829. If Timer > xyTime Then XYdata.interval = XYdata.interval + 1
  830. End Sub
  831.  
  832. 'Calculate the collision force and play sound
  833. Dim cTime, cb1, cb2, avgBallx, cAngle, bAngle1, bAngle2
  834.  
  835. Sub Collide(cb1, cb2)
  836. If TotalVel(0, 0) / 1.8 > cFactor Then cFactor = int(TotalVel(0, 0) / 1.8)
  837. avgBallx = (bvX(cb2, 1) + bvX(cb2, 2) + bvX(cb2, 3) + bvX(cb2, 4) ) / 4
  838. If avgBallx < bvX(cb2, id2) + .1 and avgBallx > bvX(cb2, id2) -.1 Then
  839. If ABS(TotalVel(cb1, id2) - TotalVel(cb2, id2) ) < .000005 Then Exit Sub
  840. End If
  841. If Timer < cTime Then Exit Sub
  842. cTime = Timer + .1
  843. GetAngle baX(cb1, id3) - baX(cb2, id3), baY(cb1, id3) - baY(cb2, id3), cAngle
  844. id3 = id3 - 1:If id3 = 0 Then id3 = 4
  845. GetAngle bVx(cb1, id3), bVy(cb1, id3), bAngle1
  846. GetAngle bVx(cb2, id3), bVy(cb2, id3), bAngle2
  847. cForce = Cint((abs(TotalVel(cb1, id3) * Cos(cAngle-bAngle1) ) + abs(TotalVel(cb2, id3) * Cos(cAngle-bAngle2) ) ) )
  848. If cForce < 4 Then Exit Sub
  849. cForce = Cint((cForce) / (cFactor / nosf) )
  850. If cForce > nosf-1 Then cForce = nosf-1
  851. PlaySound("fx_collide" & cForce)
  852. End Sub
  853.  
  854. ' Get angle
  855. Dim Xin, Yin, rAngle, Radit, wAngle, Pi
  856. Pi = Round(4 * Atn(1), 6) '3.1415926535897932384626433832795
  857.  
  858. Sub GetAngle(Xin, Yin, wAngle)
  859. If Sgn(Xin) = 0 Then
  860. If Sgn(Yin) = 1 Then rAngle = 3 * Pi / 2 Else rAngle = Pi / 2
  861. If Sgn(Yin) = 0 Then rAngle = 0
  862. Else
  863. rAngle = atn(- Yin / Xin)
  864. End If
  865. If sgn(Xin) = -1 Then Radit = Pi Else Radit = 0
  866. If sgn(Xin) = 1 and sgn(Yin) = 1 Then Radit = 2 * Pi
  867. wAngle = round((Radit + rAngle), 4)
  868. End Sub
  869.  
  870. '***************************************************
  871. ' JP's VP10 Fading Lamps & Flashers
  872. ' Based on PD's Fading Light System
  873. ' SetLamp 0 is Off
  874. ' SetLamp 1 is On
  875. ' fading for non opacity objects is 4 steps
  876. '***************************************************
  877.  
  878. Dim LampState(200), FadingLevel(200)
  879. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  880.  
  881. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  882. LampTimer.Interval = 10 'lamp fading speed
  883. LampTimer.Enabled = 1
  884.  
  885. ' Lamp & Flasher Timers
  886.  
  887. Sub LampTimer_Timer()
  888. Dim chgLamp, num, chg, ii
  889. chgLamp = Controller.ChangedLamps
  890. If Not IsEmpty(chgLamp) Then
  891. For ii = 0 To UBound(chgLamp)
  892. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  893. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  894. Next
  895. End If
  896. UpdateLamps
  897. End Sub
  898.  
  899. Sub UpdateLamps
  900. NfadeL 11, l11
  901. NfadeL 12, l12
  902. NfadeL 13, l13
  903. NfadeL 14, l14
  904. NfadeL 15, l15
  905. NfadeL 16, l16
  906. NfadeL 17, l17
  907. NfadeL 18, l18
  908. NfadeL 21, l21
  909. NfadeL 22, l22
  910. NfadeL 23, l23
  911. NfadeL 24, l24
  912. NfadeL 25, l25
  913. NfadeL 26, l26
  914. NfadeL 27, l27
  915. NfadeL 28, l28
  916. NfadeL 31, l31
  917. NfadeL 32, l32
  918. NfadeL 33, l33
  919. NfadeL 34, l34
  920. NfadeL 35, l35
  921. NfadeL 36, l36
  922. NfadeL 37, l37
  923. NfadeL 38, l38
  924. NfadeL 41, l41
  925. NfadeL 42, l42
  926. NfadeL 43, l43
  927. NfadeL 44, l44
  928. NfadeL 45, l45
  929. NfadeL 46, l46
  930. NfadeL 47, l47
  931. NfadeL 48, l48
  932. NfadeL 51, l51
  933. NfadeL 52, l52
  934. NfadeL 53, l53
  935. NfadeL 54, l54
  936. NfadeL 55, l55
  937. NfadeL 56, l56
  938. NfadeL 57, l57
  939. NfadeL 58, l58
  940. NFadeLm 61, l61b
  941. NfadeL 61, l61
  942. NfadeL 62, l62
  943. NfadeL 63, l63
  944. NfadeL 64, l64
  945. NfadeL 65, l65
  946. NfadeL 66, l66
  947. NfadeL 71, l71
  948. NfadeL 72, l72
  949. NfadeL 73, l73
  950. NfadeL 74, l74
  951. NfadeL 75, l75
  952. NfadeL 76, l76
  953. NfadeL 81, l81
  954. NfadeL 82, l82
  955. NfadeL 83, l83
  956. NfadeL 84, l84
  957. NfadeL 85, l85
  958. NfadeL 86, l86
  959. NfadeL 87, l87
  960. NfadeL 88, l88
  961.  
  962. ' fadeobj 67, l67, "of_on", "of_a", "of_b", "empty"
  963. ' fadeobj 68, l68, "of_on", "of_a", "of_b", "empty"
  964. ' fadeobj 77, l77, "of_on", "of_a", "of_b", "empty"
  965. ' fadeobj 78, l78, "of_on", "of_a", "of_b", "empty"
  966. flash 67,f67
  967. flash 68,f68
  968. flash 77,f77
  969. flash 78,f78
  970.  
  971.  
  972.  
  973. ' flashers old
  974. ' fadeobj 117, f17, "rf_on", "rf_a", "rf_b", "empty"
  975. ' NFadeLm 118, bumper1
  976. ' fadeobj 118, f18, "rf_on", "rf_a", "rf_b", "empty"
  977. ' fadeobj 119, f19, "wf_on", "wf_a", "wf_b", "empty"
  978. ' fadeobj 120, f20, "bf_on", "bf_a", "bf_b", "empty"
  979. ' fadeobjm 124, f24, "wf_on", "wf_a", "wf_b", "empty"
  980. ' fadeobj 124, f24b, "bf_on", "bf_a", "bf_b", "empty"
  981.  
  982. ' flashers new
  983. flash 117,f17
  984. flash 118,f18
  985. flash 119,f19
  986. flash 120,f20
  987. flashm 124,f24b
  988. flash 124,f24
  989. End Sub
  990.  
  991. ' div lamp subs
  992.  
  993. Sub InitLamps()
  994. Dim x
  995. For x = 0 to 200
  996. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  997. FadingLevel(x) = 4 ' used to track the fading state
  998. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  999. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  1000. FlashMax(x) = 1 ' the maximum value when on, usually 1
  1001. FlashMin(x) = 0 ' the minimum value when off, usually 0
  1002. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  1003. Next
  1004. End Sub
  1005.  
  1006. Sub AllLampsOff
  1007. Dim x
  1008. For x = 0 to 200
  1009. SetLamp x, 0
  1010. Next
  1011. End Sub
  1012.  
  1013. Sub SetLamp(nr, value)
  1014. If value <> LampState(nr) Then
  1015. LampState(nr) = abs(value)
  1016. FadingLevel(nr) = abs(value) + 4
  1017. End If
  1018. End Sub
  1019.  
  1020. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  1021.  
  1022. Sub NFadeL(nr, object)
  1023. Select Case FadingLevel(nr)
  1024. Case 4:object.state = 0:FadingLevel(nr) = 0
  1025. Case 5:object.state = 1:FadingLevel(nr) = 1
  1026. End Select
  1027. End Sub
  1028.  
  1029. Sub NFadeLm(nr, object)
  1030. Select Case FadingLevel(nr)
  1031. Case 4:object.state = 0
  1032. Case 5:object.state = 1
  1033. End Select
  1034. End Sub
  1035.  
  1036. 'Lights, Ramps & Primitives used as 4 step fading lights
  1037. 'a,b,c,d are the images used from on to off
  1038.  
  1039. Sub FadeObj(nr, object, a, b, c, d)
  1040. Select Case FadingLevel(nr)
  1041. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  1042. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  1043. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  1044. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  1045. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  1046. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  1047. End Select
  1048. End Sub
  1049.  
  1050. Sub FadeObjm(nr, object, a, b, c, d)
  1051. Select Case FadingLevel(nr)
  1052. Case 4:object.image = b
  1053. Case 5:object.image = a
  1054. Case 9:object.image = c
  1055. Case 13:object.image = d
  1056. End Select
  1057. End Sub
  1058.  
  1059. Sub NFadeObj(nr, object, a, b)
  1060. Select Case FadingLevel(nr)
  1061. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  1062. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  1063. End Select
  1064. End Sub
  1065.  
  1066. Sub NFadeObjm(nr, object, a, b)
  1067. Select Case FadingLevel(nr)
  1068. Case 4:object.image = b
  1069. Case 5:object.image = a
  1070. End Select
  1071. End Sub
  1072.  
  1073. ' Flasher objects
  1074.  
  1075. Sub Flash(nr, object)
  1076. Select Case FadingLevel(nr)
  1077. Case 4 'off
  1078. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  1079. If FlashLevel(nr) < FlashMin(nr) Then
  1080. FlashLevel(nr) = FlashMin(nr)
  1081. FadingLevel(nr) = 0 'completely off
  1082. End if
  1083. Object.IntensityScale = FlashLevel(nr)
  1084. Case 5 ' on
  1085. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  1086. If FlashLevel(nr) > FlashMax(nr) Then
  1087. FlashLevel(nr) = FlashMax(nr)
  1088. FadingLevel(nr) = 1 'completely on
  1089. End if
  1090. Object.IntensityScale = FlashLevel(nr)
  1091. End Select
  1092. End Sub
  1093.  
  1094. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  1095. Object.IntensityScale = FlashLevel(nr)
  1096. End Sub
  1097.  
  1098. ' Desktop Objects: Reels & texts (you may also use lights on the desktop)
  1099.  
  1100. ' Reels
  1101.  
  1102. Sub FadeR(nr, object)
  1103. Select Case FadingLevel(nr)
  1104. Case 4:object.SetValue 1:FadingLevel(nr) = 6 'fading to off...
  1105. Case 5:object.SetValue 0:FadingLevel(nr) = 1 'ON
  1106. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  1107. Case 9:object.SetValue 2:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  1108. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  1109. Case 13:object.SetValue 3:FadingLevel(nr) = 0 'Off
  1110. End Select
  1111. End Sub
  1112.  
  1113. Sub FadeRm(nr, object)
  1114. Select Case FadingLevel(nr)
  1115. Case 4:object.SetValue 1
  1116. Case 5:object.SetValue 0
  1117. Case 9:object.SetValue 2
  1118. Case 3:object.SetValue 3
  1119. End Select
  1120. End Sub
  1121.  
  1122. 'Texts
  1123.  
  1124. Sub NFadeT(nr, object, message)
  1125. Select Case FadingLevel(nr)
  1126. Case 4:object.Text = "":FadingLevel(nr) = 0
  1127. Case 5:object.Text = message:FadingLevel(nr) = 1
  1128. End Select
  1129. End Sub
  1130.  
  1131. Sub NFadeTm(nr, object, b)
  1132. Select Case FadingLevel(nr)
  1133. Case 4:object.Text = ""
  1134. Case 5:object.Text = message
  1135. End Select
  1136. End Sub
  1137.  
  1138.  
  1139. '********************
  1140. ' Diverse Help/Sounds
  1141. '********************
  1142.  
  1143. Sub ARubbers_Hit(idx):PlaySound "fx_rubber":End Sub
  1144. Sub APostRubbers_Hit(idx):PlaySound "fx_rubber":End Sub
  1145. Sub AMetals_Hit(idx):PlaySound "fx_MetalHit":End Sub
  1146. Sub AGates_Hit(idx):PlaySound "fx_Gate":End Sub
  1147. Sub APlastics_Hit(idx):PlaySound "fx_plastichit":End Sub
  1148.  
  1149. Sub RHelp1_Hit:PlaySound "fx_ballhit":End Sub
  1150. Sub RHelp2_Hit:PlaySound "fx_ballhit":End Sub
  1151. Sub RHelp5_Hit:PlaySound "fx_ballhit":End Sub
  1152. Sub RHelp3_Hit
  1153. If ActiveBall.VelY < -10 Then
  1154. ActiveBall.VelY = -10
  1155. End If
  1156. End Sub
  1157.  
  1158. Sub RHelp4_Hit
  1159. ActiveBall.VelX = -5
  1160. End Sub
  1161.  
  1162. 'Sub Test (Enabled)
  1163. 'SetLamp 124, Enabled
  1164. 'SetLamp 117, Enabled
  1165. 'SetLamp 118, Enabled
  1166. 'SetLamp 119, Enabled
  1167. 'SetLamp 120, Enabled
  1168. 'End Sub
Advertisement
Add Comment
Please, Sign In to add comment