Arngrim

Millionaire

Feb 18th, 2021
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.27 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. Const cGameName="milln_l3",UseSolenoids=2,UseLamps=0,UseGI=0,sCoin="coin"
  10.  
  11. LoadVPM "01560000", "S11.VBS", 3.26
  12.  
  13. Dim DesktopMode: DesktopMode = Table1.ShowDT
  14. If DesktopMode = True Then 'Show Desktop components
  15. Ramp001.visible=1
  16. Ramp002.visible=1
  17. Primitive019.visible=1
  18. Else
  19. Ramp001.visible=0
  20. Ramp002.visible=0
  21. Primitive019.visible=0
  22. End if
  23.  
  24.  
  25. '*************************************************************
  26. 'Solenoid Call backs
  27. '**********************************************************************************************************
  28.  
  29. SolCallback(1)="bsTrough.SolIn"
  30. SolCallback(2)="bsTrough.SolOut"
  31. SolCallback(3)="bsLE.SolOut"
  32. SolCallback(4)="bsRI.SolOut"
  33. SolCallback(5)="SolDrop1"
  34. SolCallback(6)="SolDrop2"
  35. SolCallback(7)="bsRK.SolOut"
  36. SolCallback(8)="vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  37. SolCallback(9)="bsCK.SolOut"
  38. SolCallback(11)="PFGI"
  39. SolCallback(13)="SolRightGate"
  40. SolCallback(14)="SolBallGate"
  41. SolCallback(16) = "EngageRoulette" 'Playfield Wheel Relay
  42. SolCallback(17)="SolLeftGate"
  43. 'SolCallback(18)="vpmSolSound ""bumper"","
  44. 'SolCallback(19)="vpmSolSound ""bumper"","
  45. 'SolCallback(20)="vpmSolSound ""bumper"","
  46. 'SolCallback(21)="vpmSolSound ""slingshot"","
  47. 'SolCallback(22)="vpmSolSound ""slingshot"","
  48. SolCallback(25)="FlashYellow6" 'Top Right Flasher 01C
  49. SolCallback(26)="FlashYellow4" 'Top Left Flasher 02C
  50. SolCallback(27)="BsTP.SolOut"
  51. SolCallback(28)="FlashYellow1" 'Middle Top Flashers 04C
  52. SolCallback(29)="FlashYellow5" 'Middle Flashers 05C
  53. SolCallback(30)="FlashYellow9" 'Middle Buttom Flashers 06C
  54. SolCallback(31)="FlashYellow2" 'Left Flasher 07C
  55. SolCallback(32)="FlashYellow8" 'Right Flasher 08C
  56.  
  57. SolCallback(sLRFlipper) = "SolRFlipper"
  58. SolCallback(sLLFlipper) = "SolLFlipper"
  59.  
  60. Sub SolLFlipper(Enabled)
  61. If Enabled Then
  62. PlaySound SoundFx("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd
  63. Else
  64. PlaySound SoundFx("fx_FlipperDown",DOFFlippers):LeftFlipper.RotateToStart
  65. End If
  66. End Sub
  67.  
  68. Sub SolRFlipper(Enabled)
  69. If Enabled Then
  70. PlaySound SoundFx("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd:RightUpperFlipper.RotateToEnd
  71. Else
  72. PlaySound SoundFx("fx_FlipperDown",DOFFlippers):RightFlipper.RotateToStart:RightUpperFlipper.RotateToStart
  73. End If
  74. End Sub
  75.  
  76. '**********************************************************************************************************
  77. 'Solenoid Controlled toys
  78. '**********************************************************************************************************
  79.  
  80. 'Playfield GI
  81. Sub PFGI(Enabled)
  82. If Enabled Then
  83. dim xx
  84. For each xx in GI:xx.State = 0: Next
  85. PlaySound "fx_relay"
  86. Else
  87. For each xx in GI:xx.State = 1: Next
  88. PlaySound "fx_relay"
  89. End If
  90. End Sub
  91.  
  92. Sub SolDrop1(enabled)
  93. Controller.Switch(39)=0
  94. Playsound SoundFX("resetdrop",DOFDropTargets)
  95. End Sub
  96.  
  97. Sub SolDrop2(enabled)
  98. Controller.Switch(40)=0
  99. Playsound SoundFX("resetdrop",DOFDropTargets)
  100. End Sub
  101.  
  102.  
  103. Sub SolRightGate(enabled)
  104. If enabled Then
  105. RightGate.RotateToEnd
  106. Else
  107. RightGate.RotateToStart
  108. End If
  109. End Sub
  110.  
  111. Sub SolLeftGate(enabled)
  112. If enabled Then
  113. LeftGate.RotateToEnd
  114. Else
  115. LeftGate.RotateToStart
  116. End If
  117. End Sub
  118.  
  119. Sub SolBallGate(enabled)
  120. If enabled Then
  121. If GateStep=0 Then GateStep=1
  122. BallGate.Enabled=1 : Bgate=1
  123. Else
  124. Bgate=0
  125. End If
  126. End Sub
  127.  
  128. Sub BallGate_Timer()
  129. Select Case GateStep
  130. Case 1 : w1.IsDropped=1 : w2.IsDropped=0 : Ballgate.Interval=210 : GateStep=2
  131. Case 2 : w2.IsDropped=1 : w3.IsDropped=0 : Ballgate.Interval=175 : GateStep=3
  132. Case 3 : w3.IsDropped=1 : w4.IsDropped=0 : Ballgate.Interval=140 : GateStep=4
  133. Case 4 : w4.IsDropped=1 : w5.IsDropped=0 : Ballgate.Interval=105 : GateStep=5
  134. Case 5 : w5.IsDropped=1 : w6.IsDropped=0 : Ballgate.Interval=70 : GateStep=6
  135. Case 6 : w6.IsDropped=1 : w7.IsDropped=0 : Ballgate.Interval=35 : GateStep=7
  136. Case 7 : w7.IsDropped=1 : w8.IsDropped=0 : Ballgate.Interval=35 : GateStep=8
  137. Case 8 : w8.IsDropped=1 : w9.IsDropped=0 : Ballgate.Interval=35 : GateStep=9
  138. Case 9 : w9.IsDropped=1 : w10.IsDropped=0 : Ballgate.Interval=35 : GateStep=10
  139. Case 10 : w10.IsDropped=1 : w11.IsDropped=0 : Ballgate.Interval=35 : GateStep=11
  140. Case 11 : w11.IsDropped=1 : w12.IsDropped=0 : Ballgate.Interval=35 : GateStep=12
  141. Case 12 : w12.IsDropped=1 : w13.IsDropped=0 : Ballgate.Interval=35 : GateStep=13
  142. Case 13 : w13.IsDropped=1 : w14.IsDropped=0 : Ballgate.Interval=70 : GateStep=14
  143. Case 14 : w14.IsDropped=1 : w15.IsDropped=0 : Ballgate.Interval=105 : GateStep=15
  144. Case 15 : w15.IsDropped=1 : w16.IsDropped=0 : Ballgate.Interval=140 : GateStep=16
  145. Case 16 : w16.IsDropped=1 : w17.IsDropped=0 : Ballgate.Interval=175 : GateStep=17
  146. Case 17 : w17.IsDropped=1 : w18.IsDropped=0 : Ballgate.Interval=210 : GateStep=18
  147. Case 18 : w18.IsDropped=1 : w17.IsDropped=0 : Ballgate.Interval=175 : GateStep=19
  148. Case 19 : w17.IsDropped=1 : w16.IsDropped=0 : Ballgate.Interval=140 : GateStep=20
  149. Case 20 : w16.IsDropped=1 : w15.IsDropped=0 : Ballgate.Interval=105 : GateStep=21
  150. Case 21 : w15.IsDropped=1 : w14.IsDropped=0 : Ballgate.Interval=70 : GateStep=22
  151. Case 22 : w14.IsDropped=1 : w13.IsDropped=0 : Ballgate.Interval=35 : GateStep=23
  152. Case 23 : w13.IsDropped=1 : w12.IsDropped=0 : Ballgate.Interval=35 : GateStep=24
  153. Case 24 : w12.IsDropped=1 : w11.IsDropped=0 : Ballgate.Interval=35 : GateStep=25
  154. Case 25 : w11.IsDropped=1 : w10.IsDropped=0 : Ballgate.Interval=35 : GateStep=26
  155. Case 26 : w10.IsDropped=1 : w9.IsDropped=0 : Ballgate.Interval=35 : GateStep=27
  156. Case 27 : w9.IsDropped=1 : w8.IsDropped=0 : Ballgate.Interval=35 : GateStep=28
  157. Case 28 : w8.IsDropped=1 : w7.IsDropped=0 : Ballgate.Interval=35 : GateStep=29
  158. Case 29 : w7.IsDropped=1 : w6.IsDropped=0 : Ballgate.Interval=70 : GateStep=30
  159. Case 30 : w6.IsDropped=1 : w5.IsDropped=0 : Ballgate.Interval=105 : GateStep=31
  160. Case 31 : w5.IsDropped=1 : w4.IsDropped=0 : Ballgate.Interval=140 : GateStep=32
  161. Case 32 : w4.IsDropped=1 : w3.IsDropped=0 : Ballgate.Interval=175 : GateStep=33
  162. Case 33 : w3.IsDropped=1 : w2.IsDropped=0 : Ballgate.Interval=210 : GateStep=34
  163. Case 34 : w2.IsDropped=1 : w1.IsDropped=0
  164. If Bgate=0 Then Ballgate.Enabled=0
  165. GateStep=1
  166. End Select
  167. End Sub
  168.  
  169. '************
  170. ' Table init.
  171. '************
  172.  
  173. dim bsTrough, bsLE, bsRI, bsCK, bsTP, bsRK, ttRTE, x, BGate, GateStep, ttwheel, ii
  174.  
  175. Sub Table1_Init
  176. vpminit me
  177. On Error Resume Next
  178. With Controller
  179. .GameName = cGameName
  180. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  181. .SplashInfoLine = ""&chr(13)&"You Suck"
  182. .HandleMechanics=0
  183. .HandleKeyboard=0
  184. .ShowDMDOnly=1
  185. .ShowFrame=0
  186. .ShowTitle=0
  187. .hidden = 1 'enable to hide DMD if You use a B2S backglass
  188. .Games(cGameName).Settings.Value("sound")=1
  189. '.PuPHide = 1
  190. On Error Resume Next
  191. .Run GetPlayerHWnd
  192. If Err Then MsgBox Err.Description
  193. On Error Goto 0
  194. End With
  195. On Error Goto 0
  196.  
  197. PinMAMETimer.Interval=PinMAMEInterval
  198. PinMAMETimer.Enabled = true
  199.  
  200. vpmNudge.TiltSwitch=swTilt
  201. vpmNudge.Sensitivity=3
  202. vpmNudge.TiltObj=Array(LBumper, RBumper, BBumper, LeftSlingshot, RightSlingshot)
  203.  
  204. ' Trough
  205. Set bsTrough=New cvpmBallStack
  206. bsTrough.InitSw 36, 33, 34, 0, 0, 0, 0, 0
  207. bsTrough.InitKick BallRelease, 80, 6
  208. bsTrough.InitExitSnd SoundFX("BallRel",DOFContactors),SoundFX("Solenoid",DOFContactors)
  209. bsTrough.Balls=2
  210.  
  211. ' Left Eject
  212. Set bsLE=New cvpmBallStack
  213. bsLE.InitSaucer sw31, 31, 158, 8
  214. bsLE.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
  215. bsLE.KickAngleVar=1
  216. bsLE.KickForceVar=1
  217.  
  218. ' Right Eject
  219. Set bsRI=New cvpmBallStack
  220. bsRI.InitSaucer sw32, 32, 205, 8
  221. bsRI.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
  222. bsRI.KickAngleVar=1
  223. bsRI.KickForceVar=1
  224.  
  225. ' Top Kickbig
  226. Set bsTP=New cvpmBallStack
  227. bsTP.InitSaucer sw42, 42, 270, 20
  228. bsTP.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
  229.  
  230. ' Right Kickbig
  231. Set bsRK=New cvpmBallStack
  232. bsRK.InitSaucer sw60, 60, 90, 18
  233. bsRK.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
  234.  
  235. ' Center Kickbig
  236. Set bsCK=New cvpmBallStack
  237. bsCK.InitSaucer sw43, 43, 175, 16
  238. bsCK.InitExitSnd SoundFX("popper_ball",DOFContactors),SoundFX("Solenoid",DOFContactors)
  239. bsCK.KickAngleVar=5
  240. bsCK.KickForceVar=5
  241.  
  242.  
  243. ' Roulette
  244.  
  245. Set ttWheel = New cvpmTurntable
  246. ttWheel.InitTurntable ttWheelTrig, 30 '20
  247. ttWheel.spinup=100
  248. ttWheel.spindown=100
  249. ttWheel.CreateEvents "ttWheel"
  250.  
  251. Init_Roulette
  252.  
  253. End Sub
  254.  
  255. '**********************************************************************************************************
  256. 'Plunger code
  257. '**********************************************************************************************************
  258.  
  259. Sub Table1_KeyDown(ByVal Keycode)
  260. If keycode = LeftMagnaSave Then bLutActive = True
  261. If keycode = RightMagnaSave Then
  262. If bLutActive Then NextLUT: End If
  263. End If
  264. If keycode=RightFlipperKey Then Controller.Switch(38)=1
  265. If keycode=LeftFlipperKey Then Controller.Switch(37)=1
  266. If keycode=PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  267. If KeyDownHandler(keycode) Then Exit Sub
  268. End Sub
  269.  
  270. Sub Table1_KeyUp(ByVal Keycode)
  271. If keycode = LeftMagnaSave Then bLutActive = False
  272. If keycode=RightFlipperKey Then Controller.Switch(38)=0
  273. If keycode=LeftFlipperKey Then Controller.Switch(37)=0
  274. If keycode=PlungerKey Then Plunger.Fire:playsound"plunger"
  275. If KeyUpHandler(keycode) Then Exit Sub
  276. End Sub
  277.  
  278.  
  279. '*********
  280. ' Switches
  281. '*********
  282.  
  283. 'Rubber Wall
  284.  
  285. Sub sw59_Hit:vpmTimer.PulseSw 59:PlaySound"rubber":End Sub
  286.  
  287.  
  288. ' Eject holes
  289.  
  290. Sub Drain_Hit:bsTrough.addball me : playsound "Drain": End Sub
  291.  
  292. Sub sw31_Hit:bsLE.AddBall Me : playsound "Popper_Ball": End Sub
  293. Sub sw42_Hit : help1.enabled=1:bsTP.AddBall Me : End Sub
  294. Sub sw32_Hit : bsRI.AddBall Me : playsound "Popper_Ball": End Sub
  295. Sub sw43_Hit : bsCK.AddBall Me : playsound "Popper_Ball": End Sub
  296. Sub sw60_Hit : bsRK.AddBall Me : playsound "Popper_Ball": End Sub
  297.  
  298. 'Wire Triggers
  299.  
  300. Sub sw11_Hit:Controller.Switch(11)=1:PlaySound"sensor":End Sub
  301. Sub sw11_UnHit:Controller.Switch(11)=0:End Sub
  302. Sub sw15_Hit:Controller.Switch(15)=1:PlaySound"sensor":End Sub
  303. Sub sw15_UnHit:Controller.Switch(15)=0:End Sub
  304. Sub sw12_Hit:Controller.Switch(12)=1:PlaySound"sensor":End Sub
  305. Sub sw12_UnHit:Controller.Switch(12)=0:End Sub
  306. Sub sw16_Hit:Controller.Switch(16)=1:PlaySound"sensor":End Sub
  307. Sub sw16_UnHit:Controller.Switch(16)=0:End Sub
  308. Sub sw44_Hit:Controller.Switch(44)=1:PlaySound"sensor":End Sub
  309. Sub sw44_UnHit:Controller.Switch(44)=0:End Sub
  310. Sub sw49_Hit:Controller.Switch(49)=1:PlaySound"sensor":End Sub
  311. Sub sw49_UnHit:Controller.Switch(49)=0:End Sub
  312. Sub sw24Hit:Controller.Switch(24)=1:PlaySound"sensor":End Sub
  313. Sub sw24_UnHit:Controller.Switch(24)=0:End Sub
  314.  
  315. ' Targets
  316.  
  317. Sub sw10_Hit:vpmTimer.PulseSw(10):PlaySound SoundFX("Target",DOFTargets):End Sub
  318. Sub sw17_Hit:vpmTimer.PulseSw(17):PlaySound SoundFX("Target",DOFTargets):End Sub
  319. Sub sw18_Hit:vpmTimer.PulseSw(18):PlaySound SoundFX("Target",DOFTargets):End Sub
  320. Sub sw19_Hit:vpmTimer.PulseSw(19):PlaySound SoundFX("Target",DOFTargets):End Sub
  321. Sub sw20_Hit:vpmTimer.PulseSw(20):PlaySound SoundFX("Target",DOFTargets):End Sub
  322. Sub sw22_Hit:vpmTimer.PulseSw(22):PlaySound SoundFX("Target",DOFTargets):End Sub
  323. Sub sw25_Hit:vpmTimer.PulseSw(25):PlaySound SoundFX("Target",DOFTargets):End Sub
  324. Sub sw26_Hit:vpmTimer.PulseSw(26):PlaySound SoundFX("Target",DOFTargets):End Sub
  325. Sub sw27_Hit:vpmTimer.PulseSw(27):PlaySound SoundFX("Target",DOFTargets):End Sub
  326. Sub sw28_Hit:vpmTimer.PulseSw(28):PlaySound SoundFX("Target",DOFTargets):End Sub
  327. Sub sw29_Hit:vpmTimer.PulseSw(29):PlaySound SoundFX("Target",DOFTargets):End Sub
  328. Sub sw30_Hit:vpmTimer.PulseSw(30):PlaySound SoundFX("Target",DOFTargets):End Sub
  329.  
  330.  
  331. ' Drop targets
  332. Sub sw39_Hit : Controller.Switch(39)=1 : PlaySound SoundFX("droptarget",DOFDropTargets) : End Sub
  333. Sub sw40_Hit : Controller.Switch(40)=1 : PlaySound SoundFX("droptarget",DOFDropTargets) : End Sub
  334.  
  335. ' Gates
  336. Sub Gate1_Hit() : PlaySound "Gate5" : End Sub
  337. Sub Gate2_Hit() : PlaySound "Gate5" : End Sub
  338. Sub Gate3_Hit() : PlaySound "Gate5" : End Sub
  339. Sub sw41_Hit():vpmTimer.PulseSw(41):PlaySound "Gate5":End Sub
  340.  
  341. ' Bumpers
  342.  
  343. Sub LBumper_Hit:vpmTimer.PulseSw 50:Playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  344. Sub RBumper_Hit:vpmTimer.PulseSw 51:Playsound SoundFX("fx_bumper2",DOFContactors): End Sub
  345. Sub BBumper_Hit:vpmTimer.PulseSw 52:Playsound SoundFX("fx_bumper3",DOFContactors): End Sub
  346.  
  347. '*****************
  348. 'Ramp help kickers
  349. '*****************
  350.  
  351. Sub Help1_Hit()
  352. Help1.DestroyBall
  353. Help2.CreateBall
  354. help1.enabled=0
  355. Help2.Kick 90, 15
  356. End Sub
  357.  
  358. Sub Help3_Hit()
  359. ActiveBall.VelY=0.1
  360. End Sub
  361.  
  362. Sub Help5_Hit()
  363. Help5.DestroyBall
  364. Help6.CreateBall
  365. Help6.Kick 160, 2
  366. End Sub
  367.  
  368. '*****************************************************************
  369. 'Functions
  370. '*****************************************************************
  371.  
  372. '*** AngleIsNear returns true if the testangle is within range degrees of the target angle for 0 to 360 degree scale
  373.  
  374. Function AngleIsNear(testangle, target, range)
  375. If target <= range Then
  376. AngleIsNear = ( (testangle + (range*2) ) mod 360 >= target + range ) AND ( (testangle + (range*2) ) mod 360 <= target + (range*3) )
  377. ElseIf target >= 360 - range Then
  378. AngleIsNear = ( (testangle - (range*2) ) mod 360 >= target - (range*3) ) AND ( (testangle - (range*2) ) mod 360 <= target - range )
  379. Else
  380. AngleIsNear = (testangle >= target - range) AND (testangle <= target + range)
  381. End If
  382. End Function
  383.  
  384. '*** CalcAngle returns the angle of a point (x,y) on a circle with center (centerx, centery) with angle 0 at 3 o'clock
  385.  
  386. Function CalcAngle(x,y,centerX,centerY)
  387.  
  388. Dim tmpAngle
  389.  
  390. tmpAngle = Atan2(x - centerX, y - centerY) * 180 / (4*Atn(1)) + 90
  391.  
  392. If tmpAngle < 0 Then
  393. CalcAngle = tmpAngle + 360
  394. Else
  395. CalcAngle = tmpAngle
  396. End If
  397.  
  398. End Function
  399.  
  400. '*** Atan2 returns the Atan2 for a point on a circle (x,y)
  401.  
  402. Function Atan2(x,y)
  403.  
  404. If x > 0 Then
  405. Atan2 = Atn(y/x)
  406. ElseIf x < 0 Then
  407. Atan2 = Sgn(y) * ((4*Atn(1)) - Atn(Abs(y/x)))
  408. ElseIf y = 0 Then
  409. Atan2 = 0
  410. Else
  411. Atan2 = Sgn(y) * (4*Atn(1)) / 2
  412. End If
  413.  
  414. End Function
  415.  
  416. '********
  417. 'Roulette
  418. '********
  419.  
  420. Dim roulette_step, roulette_time, wheelangle, ball, isOn, isOff, holeangle, holeanglemod, prevholeangle, whxx
  421. roulette_step = 0
  422. roulette_time = 0
  423. wheelangle = 0
  424. isOn = True
  425. isOff = True
  426. holeangle = 0
  427.  
  428. Dim RouletteBall
  429.  
  430. Dim GWHoles
  431. GWHoles = Array (sw54, sw55, sw56, sw61, sw62, sw63, sw64, sw45, sw46, sw47, sw48, sw53)
  432.  
  433.  
  434. Sub Init_Roulette()
  435. ' GWRamp.collidable=0
  436. Set RouletteBall = sw54.CreateSizedBallWithMass(18,20) '23,1.0*((23*2)^3)/125000
  437. RouletteBall.image = "ball2"
  438. RouletteSw.enabled = 1
  439.  
  440. End Sub
  441. Sub EngageRoulette(enabled):If enabled then:isOn=True:isOff=true:roulette.enabled = 1:End If:End Sub
  442.  
  443. Sub Roulette_Timer()
  444. Wheel.Rotz = 180 + wheelangle
  445.  
  446. wheelangle = wheelangle + roulette_step
  447.  
  448. holeangle = wheelangle mod 30
  449. prevholeangle = holeangle
  450.  
  451. if roulette_time < 800 Then '1500
  452. if isOn = True And isOff = True Then
  453. For each ii in Rswitches:Controller.switch(ii)=1:next
  454. roulettesw.enabled = false
  455. For ii = 0 to 11
  456. GWHoles(ii).kick (ii+1)*30+60, (rnd(4))+12
  457. GWHoles(ii).enabled = false
  458. Next
  459. ' GWRamp.collidable = 1
  460. ttWheel.MotorOn = True
  461. isOn = False
  462. Playsound "fx_motor"
  463. End If
  464. If wheelangle > 360 Then: wheelangle=wheelangle-360:End If
  465. roulette_step = roulette_step + 0.05
  466. If roulette_step > 0.75 Then: roulette_step = 0.75:End If
  467. Else
  468. if isOff = True Then
  469. ttWheel.MotorOn = False
  470. isOff = False
  471. StopSound "fx_motor"
  472. End If
  473. roulette_step = roulette_step - 0.0005
  474. If roulette_step < 0.15 and holeangle = 0 Then
  475. ' GWRamp.collidable = 0
  476. roulette_step=0
  477. roulette.enabled = false
  478. roulettesw.enabled = true
  479. roulette_time = 0
  480. End If
  481. End If
  482.  
  483. roulette_time = roulette_time + 1
  484. End Sub
  485.  
  486.  
  487. Dim RouletteAtRest, RouletteBallAngle, RouletteX, RouletteY, RouletteAtn2, Rswitches, Rletters(12)
  488. Const RouletteCenterX = 435
  489. Const RouletteCenterY = 1222
  490. RouletteAtRest = 0
  491.  
  492. Rswitches = array(54, 55, 56, 61, 62, 63, 64, 45, 46, 47, 48, 53)
  493.  
  494. Sub GetRouletteSw()
  495. RouletteBallAngle = CalcAngle(RouletteBall.X,RouletteBall.Y,RouletteCenterX,RouletteCenterY)
  496. 'Rletters(0) = wheelangle + 38
  497. 'Rletters(0) = 0
  498. for ii = 0 to 11
  499. 'Rletters(ii) = (Rletters(0) + (ii*30)) mod 360
  500. Rletters(ii) = ii*30
  501. 'debug.print "BallAngle: " & RouletteBallAngle & " Rletters: " & Rletters(ii) & " ii: " & ii
  502. If AngleIsNear(RouletteBallAngle,Rletters(ii),15) Then
  503. Controller.Switch(Rswitches(ii)) = 0
  504. Exit For
  505. End If
  506. next
  507.  
  508. End Sub
  509.  
  510.  
  511. Sub RouletteSw_Timer()
  512. 'debug.print BallVel(RouletteBall)
  513. If BallVel(RouletteBall) < 2 Then
  514. For each ii in GWKickers
  515. ii.enabled = true
  516. next
  517. End If
  518. End Sub
  519.  
  520.  
  521. Sub sw54_hit():GetRouletteSw:End Sub
  522. Sub sw55_hit():GetRouletteSw:End Sub
  523. Sub sw56_hit():GetRouletteSw:End Sub
  524. Sub sw61_hit():GetRouletteSw:End Sub
  525. Sub sw62_hit():GetRouletteSw:End Sub
  526. Sub sw63_hit():GetRouletteSw:End Sub
  527. Sub sw64_hit():GetRouletteSw:End Sub
  528. Sub sw45_hit():GetRouletteSw:End Sub
  529. Sub sw46_hit():GetRouletteSw:End Sub
  530. Sub sw47_hit():GetRouletteSw:End Sub
  531. Sub sw48_hit():GetRouletteSw:End Sub
  532. Sub sw53_hit():GetRouletteSw:End Sub
  533.  
  534.  
  535.  
  536. '**********Sling Shot Animations
  537. ' Rstep and Lstep are the variables that increment the animation
  538. '****************
  539. Dim RStep, Lstep
  540.  
  541. Sub RightSlingShot_Slingshot
  542. vpmTimer.PulseSw 58
  543. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  544. RSling.Visible = 0
  545. RSling1.Visible = 1
  546. sling1.rotx = 20
  547. RStep = 0
  548. RightSlingShot.TimerEnabled = 1
  549. End Sub
  550.  
  551. Sub RightSlingShot_Timer
  552. Select Case RStep
  553. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
  554. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
  555. End Select
  556. RStep = RStep + 1
  557. End Sub
  558.  
  559. Sub LeftSlingShot_Slingshot
  560. vpmTimer.PulseSw 57
  561. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
  562. LSling.Visible = 0
  563. LSling1.Visible = 1
  564. sling2.rotx = 20
  565. LStep = 0
  566. LeftSlingShot.TimerEnabled = 1
  567. End Sub
  568.  
  569. Sub LeftSlingShot_Timer
  570. Select Case LStep
  571. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
  572. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0:
  573. End Select
  574. LStep = LStep + 1
  575. End Sub
  576.  
  577.  
  578.  
  579. '***************************
  580. ' LED display
  581. ' Based on the Eala's rutine
  582. '***************************
  583.  
  584. Dim Digits(32)
  585. Digits(0)=Array(a00,a05,a0c,a0d,a08,a01,a06,a0f,a02,a03,a04,a07,a0b,a0a,a09,a0e)
  586. Digits(1)=Array(a10,a15,a1c,a1d,a18,a11,a16,a1f,a12,a13,a14,a17,a1b,a1a,a19,a1e)
  587. Digits(2)=Array(a20,a25,a2c,a2d,a28,a21,a26,a2f,a22,a23,a24,a27,a2b,a2a,a29,a2e)
  588. Digits(3)=Array(a30,a35,a3c,a3d,a38,a31,a36,a3f,a32,a33,a34,a37,a3b,a3a,a39,a3e)
  589. Digits(4)=Array(a40,a45,a4c,a4d,a48,a41,a46,a4f,a42,a43,a44,a47,a4b,a4a,a49,a4e)
  590. Digits(5)=Array(a50,a55,a5c,a5d,a58,a51,a56,a5f,a52,a53,a54,a57,a5b,a5a,a59,a5e)
  591. Digits(6)=Array(a60,a65,a6c,a6d,a68,a61,a66,a6f,a62,a63,a64,a67,a6b,a6a,a69,a6e)
  592.  
  593. Digits(7)=Array(b00,b05,b0c,b0d,b08,b01,b06,b0f,b02,b03,b04,b07,b0b,b0a,b09,b0e)
  594. Digits(8)=Array(b10,b15,b1c,b1d,b18,b11,b16,b1f,b12,b13,b14,b17,b1b,b1a,b19,b1e)
  595. Digits(9)=Array(b20,b25,b2c,b2d,b28,b21,b26,b2f,b22,b23,b24,b27,b2b,b2a,b29,b2e)
  596. Digits(10)=Array(b30,b35,b3c,b3d,b38,b31,b36,b3f,b32,b33,b34,b37,b3b,b3a,b39,b3e)
  597. Digits(11)=Array(b40,b45,b4c,b4d,b48,b41,b46,b4f,b42,b43,b44,b47,b4b,b4a,b49,b4e)
  598. Digits(12)=Array(b50,b55,b5c,b5d,b58,b51,b56,b5f,b52,b53,b54,b57,b5b,b5a,b59,b5e)
  599. Digits(13)=Array(b60,b65,b6c,b6d,b68,b61,b66,b6f,b62,b63,b64,b67,b6b,b6a,b69,b6e)
  600.  
  601. Digits(14)=Array(c00,c02,c05,c06,c04,c01,c03,c07)
  602. Digits(15)=Array(c10,c12,c15,c16,c14,c11,c13,c17)
  603. Digits(16)=Array(c20,c22,c25,c26,c24,c21,c23,c27)
  604. Digits(17)=Array(c30,c32,c35,c36,c34,c31,c33,c37)
  605. Digits(18)=Array(c40,c42,c45,c46,c44,c41,c43,c47)
  606. Digits(19)=Array(c50,c52,c55,c56,c54,c51,c53,c57)
  607. Digits(20)=Array(c60,c62,c65,c66,c64,c61,c63,c67)
  608.  
  609. Digits(21)=Array(d00,d02,d05,d06,d04,d01,d03,d07)
  610. Digits(22)=Array(d10,d12,d15,d16,d14,d11,d13,d17)
  611. Digits(23)=Array(d20,d22,d25,d26,d24,d21,d23,d27)
  612. Digits(24)=Array(d30,d32,d35,d36,d34,d31,d33,d37)
  613. Digits(25)=Array(d40,d42,d45,d46,d44,d41,d43,d47)
  614. Digits(26)=Array(d50,d52,d55,d56,d54,d51,d53,d57)
  615. Digits(27)=Array(d60,d62,d65,d66,d64,d61,d63,d67)
  616.  
  617. Digits(30)=Array(e00,e02,e05,e06,e04,e01,e03)
  618. Digits(31)=Array(e10,e12,e15,e16,e14,e11,e13)
  619.  
  620. Digits(28)=Array(f00,f02,f05,f06,f04,f01,f03)
  621. Digits(29)=Array(f10,f12,f15,f16,f14,f11,f13)
  622.  
  623. Sub DisplayTimer_Timer
  624. Dim ChgLED,ii,num,chg,stat,obj
  625. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  626. If Not IsEmpty(ChgLED) Then
  627. If DesktopMode = True Then
  628. For ii = 0 To UBound(chgLED)
  629. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  630. if (num < 32) then
  631. For Each obj In Digits(num)
  632. If chg And 1 Then obj.State = stat And 1
  633. chg = chg\2 : stat = stat\2
  634. Next
  635. else
  636.  
  637. end if
  638. next
  639. end if
  640. end if
  641. End Sub
  642.  
  643. '***************************************************
  644. ' JP's VP10 Fading Lamps & Flashers
  645. ' Based on PD's Fading Light System
  646. ' SetLamp 0 is Off
  647. ' SetLamp 1 is On
  648. ' fading for non opacity objects is 4 steps
  649. '***************************************************
  650.  
  651. Dim LampState(200), FadingLevel(200)
  652. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  653.  
  654. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  655. LampTimer.Interval = 5 'lamp fading speed
  656. LampTimer.Enabled = 1
  657.  
  658. ' Lamp & Flasher Timers
  659.  
  660. Sub LampTimer_Timer()
  661. Dim chgLamp, num, chg, ii
  662. chgLamp = Controller.ChangedLamps
  663. If Not IsEmpty(chgLamp) Then
  664. For ii = 0 To UBound(chgLamp)
  665. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  666. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  667. Next
  668. End If
  669. UpdateLamps
  670. End Sub
  671.  
  672. Sub UpdateLamps()
  673.  
  674. ' NFadeL 0, L0
  675. ' NFadeL 1, L1
  676. ' NFadeL 2, L2
  677. ' NFadeL 3, L3
  678. NFadeL 4, L4
  679. NFadeL 5, L5
  680. NFadeL 6, L6
  681. NFadeL 7, L7
  682. NFadeL 8, L8
  683. NFadeL 9, L9
  684.  
  685. NFadeL 10, L10
  686. NFadeL 11, L11
  687. NFadeL 12, L12
  688. NFadeL 13, L13
  689. NFadeL 14, L14
  690. NFadeL 15, L15
  691. NFadeL 16, L16
  692. NFadeL 17, L17
  693. NFadeL 18, L18
  694. NFadeL 19, L19
  695.  
  696. NFadeL 20, L20
  697. NFadeL 21, L21
  698. NFadeL 22, L22
  699. NFadeL 23, L23
  700. NFadeL 24, L24
  701. NFadeL 25, L25
  702. NFadeL 26, L26
  703. NFadeL 27, L27
  704. NFadeL 28, L28
  705. NFadeL 29, L29
  706.  
  707. NFadeL 30, L30
  708. NFadeL 31, L31
  709. NFadeL 32, L32
  710. NFadeL 33, L33
  711. NFadeL 34, L34
  712. NFadeL 35, L35
  713. NFadeL 36, L36
  714. NFadeL 37, L37
  715. NFadeL 38, L38
  716. NFadeL 39, L39
  717.  
  718. NFadeL 40, L40
  719. NFadeL 41, L41
  720. NFadeL 42, L42
  721. NFadeL 43, L43
  722. NFadeL 44, L44
  723. NFadeL 45, L45
  724. NFadeL 46, L46
  725. NFadeL 47, L47
  726. NFadeL 48, L48
  727. NFadeL 49, L49
  728.  
  729. NFadeL 50, L50
  730. NFadeL 51, L51
  731. NFadeL 52, L52
  732. NFadeL 53, L53
  733. NFadeL 54, L54
  734. NFadeL 55, L55
  735. NFadeL 56, L56
  736. NFadeL 57, L57
  737. NFadeL 58, L58
  738. NFadeL 59, L59
  739.  
  740. NFadeL 60, L60
  741. NFadeL 61, L61
  742. NFadeL 62, L62
  743. NFadeL 63, L63
  744. NFadeL 64, L64
  745.  
  746.  
  747.  
  748. 'Solenid Controlled Lamps
  749.  
  750.  
  751. End Sub
  752.  
  753. ' div lamp subs
  754.  
  755. Sub InitLamps()
  756. Dim x
  757. For x = 0 to 200
  758. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  759. FadingLevel(x) = 4 ' used to track the fading state
  760. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  761. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  762. FlashMax(x) = 1 ' the maximum value when on, usually 1
  763. FlashMin(x) = 0 ' the minimum value when off, usually 0
  764. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  765. Next
  766. End Sub
  767.  
  768. Sub AllLampsOff
  769. Dim x
  770. For x = 0 to 200
  771. SetLamp x, 0
  772. Next
  773. End Sub
  774.  
  775. Sub SetLamp(nr, value)
  776. If value <> LampState(nr) Then
  777. LampState(nr) = abs(value)
  778. FadingLevel(nr) = abs(value) + 4
  779. End If
  780. End Sub
  781.  
  782. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  783.  
  784. Sub NFadeL(nr, object)
  785. Select Case FadingLevel(nr)
  786. Case 4:object.state = 0:FadingLevel(nr) = 0
  787. Case 5:object.state = 1:FadingLevel(nr) = 1
  788. End Select
  789. End Sub
  790.  
  791. Sub NFadeLm(nr, object) ' used for multiple lights
  792. Select Case FadingLevel(nr)
  793. Case 4:object.state = 0
  794. Case 5:object.state = 1
  795. End Select
  796. End Sub
  797.  
  798. 'Lights, Ramps & Primitives used as 4 step fading lights
  799. 'a,b,c,d are the images used from on to off
  800.  
  801. Sub FadeObj(nr, object, a, b, c, d)
  802. Select Case FadingLevel(nr)
  803. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  804. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  805. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  806. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  807. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  808. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  809. End Select
  810. End Sub
  811.  
  812. Sub FadeObjm(nr, object, a, b, c, d)
  813. Select Case FadingLevel(nr)
  814. Case 4:object.image = b
  815. Case 5:object.image = a
  816. Case 9:object.image = c
  817. Case 13:object.image = d
  818. End Select
  819. End Sub
  820.  
  821. Sub NFadeObj(nr, object, a, b)
  822. Select Case FadingLevel(nr)
  823. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  824. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  825. End Select
  826. End Sub
  827.  
  828. Sub NFadeObjm(nr, object, a, b)
  829. Select Case FadingLevel(nr)
  830. Case 4:object.image = b
  831. Case 5:object.image = a
  832. End Select
  833. End Sub
  834.  
  835. ' Flasher objects
  836.  
  837. Sub Flash(nr, object)
  838. Select Case FadingLevel(nr)
  839. Case 4 'off
  840. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  841. If FlashLevel(nr) < FlashMin(nr) Then
  842. FlashLevel(nr) = FlashMin(nr)
  843. FadingLevel(nr) = 0 'completely off
  844. End if
  845. Object.IntensityScale = FlashLevel(nr)
  846. Case 5 ' on
  847. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  848. If FlashLevel(nr) > FlashMax(nr) Then
  849. FlashLevel(nr) = FlashMax(nr)
  850. FadingLevel(nr) = 1 'completely on
  851. End if
  852. Object.IntensityScale = FlashLevel(nr)
  853. End Select
  854. End Sub
  855.  
  856. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  857. Object.IntensityScale = FlashLevel(nr)
  858.  
  859. End Sub
  860.  
  861. ' *********************************************************************
  862. 'Fluppers Domes V2
  863. ' *********************************************************************
  864.  
  865. Sub FlashYellow1(flstate) 'Yellow Domes
  866. If Flstate Then
  867. Objlevel(1) = 1 : FlasherFlash1_Timer
  868. PlaySound "fx_relay"
  869. Objlevel(3) = 1 : FlasherFlash3_Timer
  870. PlaySound "fx_relay"
  871. End If
  872. End Sub
  873.  
  874. Sub FlashYellow5(flstate) 'Yellow Domes
  875. If Flstate Then
  876. Objlevel(5) = 1 : FlasherFlash5_Timer
  877. PlaySound "fx_relay"
  878. Objlevel(7) = 1 : FlasherFlash7_Timer
  879. PlaySound "fx_relay"
  880. End If
  881. End Sub
  882.  
  883. Sub FlashYellow9(flstate) 'Yellow Domes
  884. If Flstate Then
  885. Objlevel(9) = 1 : FlasherFlash9_Timer
  886. PlaySound "fx_relay"
  887. Objlevel(11) = 1 : FlasherFlash11_Timer
  888. PlaySound "fx_relay"
  889. End If
  890. End Sub
  891.  
  892. Sub FlashYellow2(flstate) 'Yellow Domes
  893. If Flstate Then
  894. Objlevel(2) = 1 : FlasherFlash2_Timer
  895. PlaySound "fx_relay"
  896. End If
  897. End Sub
  898.  
  899. Sub FlashYellow4(flstate) 'Yellow Domes
  900. If Flstate Then
  901. Objlevel(4) = 1 : FlasherFlash4_Timer
  902. PlaySound "fx_relay"
  903. End If
  904. End Sub
  905.  
  906. Sub FlashYellow6(flstate) 'Yellow Domes
  907. If Flstate Then
  908. Objlevel(6) = 1 : FlasherFlash6_Timer
  909. PlaySound "fx_relay"
  910. End If
  911. End Sub
  912.  
  913. Sub FlashYellow8(flstate) 'Yellow Domes
  914. If Flstate Then
  915. Objlevel(8) = 1 : FlasherFlash8_Timer
  916. PlaySound "fx_relay"
  917. End If
  918. End Sub
  919.  
  920.  
  921. Dim TestFlashers, TableRef, FlasherLightIntensity, FlasherFlareIntensity, FlasherOffBrightness
  922.  
  923. ' *********************************************************************
  924. TestFlashers = 0 ' *** set this to 1 to check position of flasher object ***
  925. Set TableRef = Table1 ' *** change this, if your table has another name ***
  926. FlasherLightIntensity = 1 ' *** lower this, if the VPX lights are too bright (i.e. 0.1) ***
  927. FlasherFlareIntensity = 1 ' *** lower this, if the flares are too bright (i.e. 0.1) ***
  928. FlasherOffBrightness = 0.5 ' *** brightness of the flasher dome when switched off (range 0-2) ***
  929. ' *********************************************************************
  930.  
  931.  
  932. Dim ObjLevel(20), objbase(20), objlit(20), objflasher(20), objlight(20)
  933. Dim tablewidth, tableheight : tablewidth = TableRef.width : tableheight = TableRef.height
  934. 'initialise the flasher color, you can only choose from "green", "red", "purple", "blue", "white" and "yellow"
  935. InitFlasher 1, "yellow"
  936. InitFlasher 3, "yellow"
  937. InitFlasher 2, "yellow"
  938. InitFlasher 4, "yellow"
  939. InitFlasher 5, "yellow"
  940. InitFlasher 6, "yellow"
  941. InitFlasher 7, "yellow"
  942. InitFlasher 8, "yellow"
  943. InitFlasher 9, "yellow"
  944. InitFlasher 11, "yellow"
  945.  
  946.  
  947. ' rotate the flasher with the command below (first argument = flasher nr, second argument = angle in degrees)
  948. 'RotateFlasher 11,90
  949.  
  950. Sub InitFlasher(nr, col)
  951. ' store all objects in an array for use in FlashFlasher subroutine
  952. Set objbase(nr) = Eval("Flasherbase" & nr) : Set objlit(nr) = Eval("Flasherlit" & nr)
  953. Set objflasher(nr) = Eval("Flasherflash" & nr) : Set objlight(nr) = Eval("Flasherlight" & nr)
  954. ' If the flasher is parallel to the playfield, rotate the VPX flasher object for POV and place it at the correct height
  955. If objbase(nr).RotY = 0 Then
  956. objbase(nr).ObjRotZ = atn( (tablewidth/2 - objbase(nr).x) / (objbase(nr).y - tableheight*1.1)) * 180 / 3.14159
  957. objflasher(nr).RotZ = objbase(nr).ObjRotZ : objflasher(nr).height = objbase(nr).z + 60
  958. End If
  959. ' set all effects to invisible and move the lit primitive at the same position and rotation as the base primitive
  960. objlight(nr).IntensityScale = 0 : objlit(nr).visible = 0 : objlit(nr).material = "Flashermaterial" & nr
  961. objlit(nr).RotX = objbase(nr).RotX : objlit(nr).RotY = objbase(nr).RotY : objlit(nr).RotZ = objbase(nr).RotZ
  962. objlit(nr).ObjRotX = objbase(nr).ObjRotX : objlit(nr).ObjRotY = objbase(nr).ObjRotY : objlit(nr).ObjRotZ = objbase(nr).ObjRotZ
  963. objlit(nr).x = objbase(nr).x : objlit(nr).y = objbase(nr).y : objlit(nr).z = objbase(nr).z
  964. objbase(nr).BlendDisableLighting = FlasherOffBrightness
  965. ' set the texture and color of all objects
  966. select case objbase(nr).image
  967. Case "dome2basewhite" : objbase(nr).image = "dome2base" & col : objlit(nr).image = "dome2lit" & col :
  968. Case "ronddomebasewhite" : objbase(nr).image = "ronddomebase" & col : objlit(nr).image = "ronddomelit" & col
  969. Case "domeearbasewhite" : objbase(nr).image = "domeearbase" & col : objlit(nr).image = "domeearlit" & col
  970. end select
  971. If TestFlashers = 0 Then objflasher(nr).imageA = "domeflashwhite" : objflasher(nr).visible = 0 : End If
  972. select case col
  973. Case "blue" : objlight(nr).color = RGB(4,120,255) : objflasher(nr).color = RGB(200,255,255) : objlight(nr).intensity = 5000
  974. Case "green" : objlight(nr).color = RGB(12,255,4) : objflasher(nr).color = RGB(12,255,4)
  975. Case "red" : objlight(nr).color = RGB(255,32,4) : objflasher(nr).color = RGB(255,32,4)
  976. Case "purple" : objlight(nr).color = RGB(230,49,255) : objflasher(nr).color = RGB(255,64,255)
  977. Case "yellow" : objlight(nr).color = RGB(200,173,25) : objflasher(nr).color = RGB(255,200,50)
  978. Case "white" : objlight(nr).color = RGB(255,240,150) : objflasher(nr).color = RGB(100,86,59)
  979. end select
  980. objlight(nr).colorfull = objlight(nr).color
  981. If TableRef.ShowDT and ObjFlasher(nr).RotX = -45 Then
  982. objflasher(nr).height = objflasher(nr).height - 20 * ObjFlasher(nr).y / tableheight
  983. ObjFlasher(nr).y = ObjFlasher(nr).y + 10
  984. End If
  985. End Sub
  986.  
  987. Sub RotateFlasher(nr, angle) : angle = ((angle + 360 - objbase(nr).ObjRotZ) mod 180)/30 : objbase(nr).showframe(angle) : objlit(nr).showframe(angle) : End Sub
  988.  
  989. Sub FlashFlasher(nr)
  990. If not objflasher(nr).TimerEnabled Then objflasher(nr).TimerEnabled = True : objflasher(nr).visible = 1 : objlit(nr).visible = 1 : End If
  991. objflasher(nr).opacity = 1000 * FlasherFlareIntensity * ObjLevel(nr)^2.5
  992. objlight(nr).IntensityScale = 0.5 * FlasherLightIntensity * ObjLevel(nr)^3
  993. objbase(nr).BlendDisableLighting = FlasherOffBrightness + 10 * ObjLevel(nr)^3
  994. objlit(nr).BlendDisableLighting = 10 * ObjLevel(nr)^2
  995. UpdateMaterial "Flashermaterial" & nr,0,0,0,0,0,0,ObjLevel(nr),RGB(255,255,255),0,0,False,True,0,0,0,0
  996. ObjLevel(nr) = ObjLevel(nr) * 0.9 - 0.01
  997. If ObjLevel(nr) < 0 Then objflasher(nr).TimerEnabled = False : objflasher(nr).visible = 0 : objlit(nr).visible = 0 : End If
  998. End Sub
  999.  
  1000. Sub FlasherFlash1_Timer() : FlashFlasher(1) : End Sub
  1001. Sub FlasherFlash3_Timer() : FlashFlasher(3) : End Sub
  1002. Sub FlasherFlash2_Timer() : FlashFlasher(2) : End Sub
  1003. Sub FlasherFlash4_Timer() : FlashFlasher(4) : End Sub
  1004. Sub FlasherFlash5_Timer() : FlashFlasher(5) : End Sub
  1005. Sub FlasherFlash6_Timer() : FlashFlasher(6) : End Sub
  1006. Sub FlasherFlash7_Timer() : FlashFlasher(7) : End Sub
  1007. Sub FlasherFlash8_Timer() : FlashFlasher(8) : End Sub
  1008. Sub FlasherFlash9_Timer() : FlashFlasher(9) : End Sub
  1009. Sub FlasherFlash11_Timer() : FlashFlasher(11) : End Sub
  1010.  
  1011.  
  1012.  
  1013. '******************
  1014. ' real time updates
  1015. '******************
  1016.  
  1017. Set MotorCallback = GetRef("RealTimeUpdates")
  1018.  
  1019. Sub RealTimeUpdates
  1020. Rightgatep.Roty = Rightgate.CurrentAngle
  1021. Leftgatep.Roty = Leftgate.CurrentAngle
  1022. Wheel.rotY 360 = Wheel.currentangle
  1023. End Sub
  1024.  
  1025.  
  1026. '*************
  1027. ' JP'S LUT
  1028. '*************
  1029.  
  1030. Dim bLutActive, LUTImage
  1031. Sub LoadLUT
  1032. Dim x
  1033. x = LoadValue(cGameName, "LUTImage")
  1034. If(x <> "") Then LUTImage = x Else LUTImage = 0
  1035. UpdateLUT
  1036. End Sub
  1037.  
  1038. Sub SaveLUT
  1039. SaveValue cGameName, "LUTImage", LUTImage
  1040. End Sub
  1041.  
  1042. Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
  1043.  
  1044. Sub UpdateLUT
  1045. Select Case LutImage
  1046. Case 0: table1.ColorGradeImage = "LUT0"
  1047. Case 1: table1.ColorGradeImage = "LUT1"
  1048. Case 2: table1.ColorGradeImage = "LUT2"
  1049. Case 3: table1.ColorGradeImage = "LUT3"
  1050. Case 4: table1.ColorGradeImage = "LUT4"
  1051. Case 5: table1.ColorGradeImage = "LUT5"
  1052. Case 6: table1.ColorGradeImage = "LUT6"
  1053. Case 7: table1.ColorGradeImage = "LUT7"
  1054. Case 8: table1.ColorGradeImage = "LUT8"
  1055. Case 9: table1.ColorGradeImage = "LUT9"
  1056.  
  1057. End Select
  1058. End Sub
  1059.  
  1060. '*********************************************************************
  1061. ' Positional Sound Playback Functions
  1062. '*********************************************************************
  1063.  
  1064. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  1065. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  1066. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  1067. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  1068. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  1069. End Sub
  1070.  
  1071. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  1072. Sub PlaySoundAt(soundname, tableobj)
  1073. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1074. End Sub
  1075.  
  1076. Sub PlaySoundAtBall(soundname)
  1077. PlaySoundAt soundname, ActiveBall
  1078. End Sub
  1079.  
  1080.  
  1081. '*********************************************************************
  1082. ' Supporting Ball & Sound Functions
  1083. '*********************************************************************
  1084.  
  1085. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  1086. Dim tmp
  1087. tmp = tableobj.y * 2 / table1.height-1
  1088. If tmp > 0 Then
  1089. AudioFade = Csng(tmp ^10)
  1090. Else
  1091. AudioFade = Csng(-((- tmp) ^10) )
  1092. End If
  1093. End Function
  1094.  
  1095. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  1096. Dim tmp
  1097. tmp = tableobj.x * 2 / table1.width-1
  1098. If tmp > 0 Then
  1099. AudioPan = Csng(tmp ^10)
  1100. Else
  1101. AudioPan = Csng(-((- tmp) ^10) )
  1102. End If
  1103. End Function
  1104.  
  1105. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1106. Vol = Csng(BallVel(ball) ^2 / 2000)
  1107. End Function
  1108.  
  1109. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1110. Pitch = BallVel(ball) * 20
  1111. End Function
  1112.  
  1113. Function BallVel(ball) 'Calculates the ball speed
  1114. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1115. End Function
  1116.  
  1117.  
  1118. '********************************************************************
  1119. ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
  1120. '********************************************************************
  1121.  
  1122. Const tnob = 5 ' total number of balls
  1123. ReDim rolling(tnob)
  1124. InitRolling
  1125.  
  1126. Sub InitRolling
  1127. Dim i
  1128. For i = 0 to tnob
  1129. rolling(i) = False
  1130. Next
  1131. End Sub
  1132.  
  1133. Sub RollingTimer_Timer()
  1134. Dim BOT, b
  1135. BOT = GetBalls
  1136.  
  1137. ' stop the sound of deleted balls
  1138. For b = UBound(BOT) + 1 to tnob
  1139. rolling(b) = False
  1140. StopSound "fx_ballrolling" & b
  1141. StopSound "fx_plasticrolling" & b
  1142. StopSound "fx_metalrolling" & b
  1143. Next
  1144.  
  1145. ' exit the sub if no balls on the table
  1146. If UBound(BOT) = -1 Then Exit Sub
  1147.  
  1148. ' play the rolling sound for each ball
  1149. For b = 0 to UBound(BOT)
  1150. If BallVel(BOT(b) ) > 1 Then
  1151. rolling(b) = True
  1152. If BOT(b).Z > 30 Then
  1153. ' ball on plastic ramp
  1154. StopSound "fx_ballrolling" & b
  1155. StopSound "fx_metalrolling" & b
  1156. PlaySound "fx_plasticrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  1157. Else
  1158. ' ball on playfield
  1159. StopSound "fx_plasticrolling" & b
  1160. StopSound "fx_metalrolling" & b
  1161. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  1162. End If
  1163. Else
  1164. If rolling(b) Then
  1165. StopSound "fx_ballrolling" & b
  1166. StopSound "fx_plasticrolling" & b
  1167. StopSound "fx_metalrolling" & b
  1168. rolling(b) = False
  1169. End If
  1170. End If
  1171.  
  1172. ' ball drop sounds matching the adjusted height params but not the way down the ramps
  1173. If BOT(b).VelZ < -1 And BOT(b).Z < 55 And BOT(b).Z > 27 then 'And Not InRect(BOT(b).X, BOT(b).Y, 610,320, 740,320, 740,550, 610,550) And Not InRect(BOT(b).X, BOT(b).Y, 180,400, 230,400, 230, 550, 180,550) Then
  1174. PlaySound "fx_ball_drop" & Int(Rnd()*3), 0, ABS(BOT(b).VelZ)/17*5, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  1175. End If
  1176.  
  1177. Next
  1178. End Sub
  1179.  
  1180. '**********************
  1181. ' Ball Collision Sound
  1182. '**********************
  1183.  
  1184. Sub OnBallBallCollision(ball1, ball2, velocity)
  1185. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  1186. End Sub
  1187.  
  1188. '*****************************************
  1189. ' ninuzzu's FLIPPER SHADOWS
  1190. '*****************************************
  1191.  
  1192. sub FlipperTimer_Timer()
  1193. FlipperLSh.RotZ = LeftFlipper.currentangle
  1194. FlipperRSh.RotZ = RightFlipper.currentangle
  1195. FlipperURSh.RotZ = RightUpperFlipper.currentangle
  1196.  
  1197. Rightgatep.Roty = Rightgate.CurrentAngle
  1198. Leftgatep.Roty = Leftgate.CurrentAngle
  1199.  
  1200. End Sub
  1201.  
  1202.  
  1203. '************************************
  1204. ' What you need to add to your table
  1205. '************************************
  1206.  
  1207. ' a timer called RollingTimer. With a fast interval, like 10
  1208. ' one collision sound, in this script is called fx_collide
  1209. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  1210. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  1211.  
  1212.  
  1213. '******************************************
  1214. ' Explanation of the rolling sound routine
  1215. '******************************************
  1216.  
  1217. ' sounds are played based on the ball speed and position
  1218.  
  1219. ' the routine checks first for deleted balls and stops the rolling sound.
  1220.  
  1221. ' The For loop goes through all the balls on the table and checks for the ball speed and
  1222. ' if the ball is on the table (height lower than 30) then then it plays the sound
  1223. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  1224.  
  1225. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  1226. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  1227. ' according to the position of the ball on the table.
  1228.  
  1229.  
  1230. '**************************************
  1231. ' Explanation of the collision routine
  1232. '**************************************
  1233.  
  1234. ' The collision is built in VP.
  1235. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  1236. ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
  1237. ' depending of the speed of the collision.
  1238.  
  1239.  
  1240. Sub Pins_Hit (idx)
  1241. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1242. End Sub
  1243.  
  1244. Sub Targets_Hit (idx)
  1245. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1246. End Sub
  1247.  
  1248. Sub Metals_Thin_Hit (idx)
  1249. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1250. End Sub
  1251.  
  1252. Sub Metals_Medium_Hit (idx)
  1253. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1254. End Sub
  1255.  
  1256. Sub Metals2_Hit (idx)
  1257. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1258. End Sub
  1259.  
  1260. Sub Gates_Hit (idx)
  1261. PlaySound "Gate5", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1262. End Sub
  1263.  
  1264. Sub Spinner_Spin
  1265. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  1266. End Sub
  1267.  
  1268. Sub Rubbers_Hit(idx)
  1269. dim finalspeed
  1270. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1271. If finalspeed > 20 then
  1272. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1273. End if
  1274. If finalspeed >= 6 AND finalspeed <= 20 then
  1275. RandomSoundRubber()
  1276. End If
  1277. End Sub
  1278.  
  1279. Sub Posts_Hit(idx)
  1280. dim finalspeed
  1281. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1282. If finalspeed > 16 then
  1283. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1284. End if
  1285. If finalspeed >= 6 AND finalspeed <= 16 then
  1286. RandomSoundRubber()
  1287. End If
  1288. End Sub
  1289.  
  1290. Sub RandomSoundRubber()
  1291. Select Case Int(Rnd*3)+1
  1292. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1293. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1294. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1295. End Select
  1296. End Sub
  1297.  
  1298. Sub LeftFlipper_Collide(parm)
  1299. RandomSoundFlipper()
  1300. End Sub
  1301.  
  1302. Sub RightFlipper_Collide(parm)
  1303. RandomSoundFlipper()
  1304. End Sub
  1305.  
  1306. Sub RandomSoundFlipper()
  1307. Select Case Int(Rnd*3)+1
  1308. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1309. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1310. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1311. End Select
  1312. End Sub
  1313.  
  1314. Sub Table1_Exit()
  1315. If B2SOn Then
  1316. Controller.Pause = False
  1317. Controller.Stop
  1318. End If
  1319. End Sub
Advertisement
Add Comment
Please, Sign In to add comment