Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 61.20 KB | None | 0 0
  1. Option Explicit
  2. '
  3. ' _,---. .=-.-..-._ ,--.--------. ,-,--. ,--.--------. _,.---._ .-._ ,----. ,-,--.
  4. ' .-`.' , \ _.-. /==/_ /==/ \ .-._/==/, - , -\,-.'- _\/==/, - , -\,-.' , - `. /==/ \ .-._ ,-.--` , \ ,-.'- _\
  5. ' /==/_ _.-' .-,.'| |==|, ||==|, \/ /, |==\.-. - ,-./==/_ ,_.'\==\.-. - ,-./==/_, , - \|==|, \/ /, /==|- _.-`/==/_ ,_.' '
  6. '/==/- '..-.|==|, | |==| ||==|- \| | `--`\==\- \ \==\ \ `--`\==\- \ |==| .=. |==|- \| ||==| `.-.\==\ \
  7. '|==|_ , /|==|- | |==|- ||==| , | -| \==\_ \ \==\ -\ \==\_ \|==|_ : ;=: - |==| , | -/==/_ , / \==\ -\
  8. '|==| .--' |==|, | |==| ,||==| - _ | |==|- | _\==\ ,\ |==|- ||==| , '=' |==| - _ |==| .-' _\==\ ,\
  9. '|==|- | |==|- `-._|==|- ||==| /\ , | |==|, | /==/\/ _ | |==|, | \==\ - ,_ /|==| /\ , |==|_ ,`-._/==/\/ _ |
  10. '/==/ \ /==/ - , ,/==/. //==/, | |- | /==/ -/ \==\ - , / /==/ -/ '.='. - .' /==/, | |- /==/ , /\==\ - , /
  11. '`--`---' `--`-----'`--`-` `--`./ `--` `--`--` `--`---' `--`--` `--`--'' `--`./ `--`--`-----`` `--`---'
  12. 'Williams 1994
  13. ' .:::::::::.
  14. ' .::::::::::::::::, .::
  15. ' -'`;. ccccr -ccc,```'::,:::::::
  16. ' `,z$$$$$$c $$$F.::::::::::::
  17. ' 'c`$'cc,?$$$$ :::::`:. ``':
  18. ' $$$`4$$$,$$$$ :::', `
  19. ' .. F .`$ $$"$L,`,d$c$
  20. ' d$$$$$cc,,d$c,ccP'J$$$$,,`"$F
  21. ' $$$$$$$$$$$$$$$$$$$$$$$$$",$F
  22. ' $$$$$$$$$$$ ccc,,"?$$$$$$c$$F
  23. ' `?$$$PFF",zd$P??$$$c?$$$$$$$F
  24. ' .,cccc=,z$$$$$b$ c$$$ $$$$$$$
  25. ' cd$$$F",c$$$$$$$$P'<$$$$ $$$$$$$
  26. ' $$$$$$$c,"?????"" $$$$$ $$$$$$F
  27. ' :: $$$$L ""??" .. d$$$$$ $$$$$P'..
  28. ' ::: ?$$$$J$$cc,,,,,,c$$$$$$PJ$P".::::
  29. ' .,,,. `:: $$$$$$$$$$$$$$$$$$$$$P".::::::'
  30. ' ,,ccc$$$$$$$$$P" `::`$$$$$$$$$$$$$$$$P".::::::::' c$c.
  31. ' .,cd$$PPFFF????????" .$$$$$b,
  32. 'z$$$$$$$$$$$$$$$$$$$$bc.`'!>` -:.""?$$P".:::'``. `',<'` $$$$$$$$$c
  33. '$$$$$$$$$$$$$$$$$$$$$$$$$c,=$$ ::::: -`',;;!!!,,;!!>. J$$$$$$$$$$b,
  34. '?$$$$$$$$$$$$$$$$$$$$$$$$$$$cc,,,.` ."?$$$$$$$$$$$$$$$$$$.
  35. ' ""??""" ;!!!.$$$ `?$$$$$$P'!!!!; !!;.""?$$$$$$$$$$$$$$$r
  36. ' !!!'<$$$ :::.. .;!!!!!!; !!!!!!!!!!!!!> "?$$$$$$$$$$$"
  37. ' !!!!>`?$F::::::::`!!!!!!!!! ?"
  38. ' `!!!!>`::::: ::
  39. ' ` `!!! `:::: ,, ;!!!!!!!!!'` ;!!!!!!!!!!!
  40. ' \;;;;!!!! :::: !!!!!!!!!!! ;!!!!!!!!!!!!>
  41. ' `!!!!!!!!> ::: !!!!!!!!!!! ;!!!!!!!!!!!!!!>
  42. ' !!!!!!!!!!.` !!!!!!!!!!!!!;. ;!!!!!!!!!!!!!!!!>
  43. ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
  44. ' `!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
  45. ' `!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  46. ' `
  47. ' ?$$c``!!! d $$c,c$.`!',d$$$P
  48. ' `$$$$$c,,d$ 3$$$$$$cc$$$$$$F
  49. ' `$$$$$$$$$b`$$$$$$$$$$$$$$
  50. ' `$$$$$$$$$ ?$$$$$$$$$$$$$
  51. ' `$$$$$$$$$ $$$$$$$$$$$$F
  52. ' `$$$$$$$$,?$$$$$$$$$$$'
  53. ' `$$$$$$$$ $$$$$$$$$$P
  54. ' ?$$$$$$b`$$$$$$$$$F
  55. ' ,c$$$$$$$$c`$$"$$$$$$$cc,
  56. ' ,z$$$$$$$$$$$$$ $L')$$$$$$$$$$b,,,,, ,
  57. ' ,,-=P???$$$$$$$$$$PF $$$$$$$$$$$$$Lz =zr4%'
  58. ' `?'d$ $b = $$$$$$ "???????$$$P
  59. ' `"-"$$$$P"""" "
  60.  
  61. '*****************************************************************************************************
  62. ' CREDITS
  63. ' Authors: g5k, 3rdaxis, DJRobX
  64. ' Bronto, Dictabird models and 3d scan cleanup of building toys: Dark
  65. ' Color DMD : Slippifishi and Wob - To be available at vpuniverse.com
  66. ' Legends: SlyDog43, Dave Conn
  67. ' Some stuff from the vp9 version, DOF code etc (thanks to JPSalas and those who helped make that original one)
  68. ' DOF Updates: Arngrim
  69. ' Shout out to the VPX and VPM dev teams!
  70. ' Big thanks to all those who pitched in to help make this happen
  71. ' Yabba Dabba Doo
  72. '*****************************************************************************************************
  73.  
  74. 'Change log: RG5_Plastics Disable Lighting 1.0 (From G5K setting of 0.0) (Modified and renamed image, "RG5_Plastics_giON_AXS")
  75. ' BuildingL BuildingR Disable Lighting 0.9 (From G5K setting of 0.8) (Modified and renamed image, Lbuilding_giON2_AXS)
  76. ' RG5_Habitrail Disable Lighting 0.5 (From G5K setting of 0.0)
  77. ' RG789_Ramps Disable Lighting 0.5 (From G5K setting of 0.0)
  78. ' RG4_6 Disable Lighting 0.5 (From G5K setting of 0.0)
  79. ' Deleted unused Drop target images
  80. ' "DropTarget" image optimized
  81. ' Deleted 4K flasher images
  82. ' Deleted rear spot light images
  83. ' Modified image "RG10_blades_giON_AXS" (Made the wood wall slightly less reflective.)
  84. ' Modified image "g5k_playfield_ins_giON_AXS" (Made the image 10% more contrast, seemed a little de-saturated.)
  85. ' Additional Light added (Fl001) behind the machine where there is an exposed GI bulb. (Not switched in script)
  86. 'Too do: Delete playfield primitives
  87.  
  88. 'First, try to load the Controller.vbs (DOF), which helps controlling additional hardware like lights, gears, knockers, bells and chimes (to increase realism)
  89. 'This table uses DOF via the 'SoundFX' calls that are inserted in some of the PlaySound commands, which will then fire an additional event, instead of just playing a sample/sound effect
  90.  
  91. On Error Resume Next
  92. ExecuteGlobal GetTextFile("controller.vbs")
  93. If Err Then MsgBox "You need the Controller.vbs file in order to run this table (installed with the VPX package in the scripts folder)"
  94. On Error Goto 0
  95. Const cGameName = "fs_lx5"
  96.  
  97.  
  98.  
  99. '*****************************************************************************************************
  100. 'SCRIPT OPTIONS
  101. '*****************************************************************************************************
  102.  
  103. Dim LUTmeUP:LUTMeUp = 1 '0 = No LUT, will look nice and bright, 1 = 30% contrast and brightness adj, 2 = 50% contrast and brightness adj, 3 = 70% contrast and brightness adj, 4 = 100% contrast and brightness adj, 5 = 130% contrast and brightness
  104. Const UseSolenoids=2 'FastFlips
  105. Const FlipperShadows = 1 ' change to 0 to turn off flipper shadows
  106. Const OutlaneDifficulty = 2 ' 1 = EASY, 2 = MEDIUM (Factory), 3 = HARD
  107. Const BallShadowOn = 1 '0=Off 1=On (Off=Performance On=Quality)
  108. Const GiMethod = 2 ' 1 = GI control by materials less overhead; 2 = GI Double Prims, this has more overhead and will not run on shite setups
  109. Const PreloadMe = 1 ' To prevent in-game slowdowns
  110. Const VolRoll = 70 ' 0..100. Ball roll volume
  111. Const FlasherIntensity = 200' (0-1000) 200 = Default. Can be higher or lower (i.e. 220 to make them brighter, 180 to make them more dull)
  112. Const Flasher4k = 0 '0 Uses 1024x1024 flasher overlays will help performance on systems experience frame dips in lightshow moments, 1 = 4K Overlays for beasts
  113. 'If you still have performance issues you will need to select all the primitives on layer 4,5 and 6 and deselect "Reflection Enabled".
  114. 'Disabling playfield reflections would be best but at time of release this was creating an error with the inserts. Future VPX updates may fix this.
  115.  
  116.  
  117. Const UseLamps=0,UseGI=1,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin",SKickerOn="RearScoop"
  118. Dim UseVPMDMD:UseVPMDMD = True
  119. Const UseVPMModSol=1
  120. Const MaxLut = 4
  121.  
  122. If Table1.ShowDT = false then
  123. Scoretext.Visible = false
  124. UseVPMDMD = False
  125. End If
  126.  
  127.  
  128. LoadVPM "01560000", "WPC.VBS", 3.26
  129.  
  130. Dim bsTrough, bsKicker36, dtLeftDrop, dtRightDrop, ttMachine
  131. Set GiCallback2 = GetRef("UpdateGI")
  132.  
  133. Dim EnableBallControl
  134. EnableBallControl = false 'Change to true to enable manual ball control (or press C in-game) via the arrow keys and B (boost movement) keys
  135.  
  136. Dim NullFader : set NullFader = new NullFadingObject
  137. Dim FadeLights : Set FadeLights = New LampFader
  138. Dim GI_STATUS
  139. Dim DesktopMode: DesktopMode = Table1.ShowDT
  140. 'Dim autoflip 'AXS
  141. 'autoflip=0'(For Stress Testing)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  142.  
  143. 'Const BallSize = 25 'Ball radius
  144.  
  145.  
  146.  
  147. Sub Table1_Init
  148.  
  149. if table1.VersionMinor < 6 AND table1.VersionMajor = 10 then MsgBox "This table requires VPX 10.6, you have " & table1.VersionMajor & "." & table.VersionMinor
  150. if VPinMAMEDriverVer < 3.57 then MsgBox "This table requires core.vbs 3.57 or higher, which is included with VPX 10.6. You have " & VPinMAMEDriverVer & ". Be sure scripts folder is up to date, and that there are no old .vbs files in your table folder."
  151.  
  152. vpmInit Me
  153. NoUpperLeftFlipper
  154. NoUpperRightFlipper
  155.  
  156. With Controller
  157. .GameName = cGameName
  158. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  159. .SplashInfoLine = "The Flintstones - based on the table by Williams from 1994" & vbNewLine & "VPX table by g5k, 3rdAxis, DJRobX and Dark"
  160. 'DMD position and size for 1400x1050
  161. '.Games(cGameName).Settings.Value("dmd_pos_x")=500
  162. '.Games(cGameName).Settings.Value("dmd_pos_y")=2
  163. '.Games(cGameName).Settings.Value("dmd_width")=400
  164. '.Games(cGameName).Settings.Value("dmd_height")=92
  165. .Games(cGameName).Settings.Value("rol") = 0
  166. .HandleKeyboard = 0
  167. .ShowTitle = 0
  168. .ShowDMDOnly = 1
  169. .ShowFrame = 0
  170. .HandleMechanics = 0
  171. .Hidden = 0
  172. '.SetDisplayPosition 0, 0, GetPlayerHWnd 'uncomment this line if you don't see the DMD
  173. On Error Resume Next
  174. .Run GetPlayerHWnd
  175. If Err Then MsgBox Err.Description
  176. On Error Goto 0
  177. .Switch(22) = 1 'close coin door
  178. .Switch(24) = 1 'and keep it close
  179. End With
  180.  
  181. ' Nudging
  182. vpmNudge.TiltSwitch = 14
  183. vpmNudge.Sensitivity = 1
  184. ' vpmNudge.TiltObj = Array(bumper1, bumper2, bumper3, LeftSlingshot, RightSlingshot)
  185.  
  186. ' Trough
  187. Set bsTrough = New cvpmTrough
  188. With bsTrough
  189. .Size = 4
  190. .InitSwitches Array(32, 33, 34, 35)
  191. .InitExit BallRelease, 90, 4
  192. .InitExitSounds SoundFX(SSolenoidOn,DOFContactors), SoundFX("BallRelease",DOFContactors)
  193. .Balls = 4
  194. End With
  195.  
  196. ' Bronto/Machine VUK
  197. Set bsKicker36 = New cvpmSaucer
  198. With bsKicker36
  199. .InitKicker Kicker36, 36, 0, 35, 1.56
  200. .InitSounds "kicker_enter_center", SoundFX(SKickerOn,DOFContactors), SoundFX(SKickerOn,DOFContactors)
  201. .CreateEvents "bsKicker36", Kicker36
  202. End With
  203.  
  204. ' Left Drop Targets
  205. Set dtLeftDrop = New cvpmDropTarget
  206. With dtLeftDrop
  207. .InitDrop Array(sw45, sw46, sw47), Array(45, 46, 47)
  208. .initsnd "droptarget", SoundFX("DTReset", DOFContactors)
  209. .CreateEvents "dtLeftDrop"
  210. End With
  211.  
  212. ' Right Drop Targets
  213. Set dtRightDrop = New cvpmDropTarget
  214. With dtRightDrop
  215. .InitDrop Array(sw41, sw42, sw43, sw44), Array(44, 43, 42, 41)
  216. .initsnd SoundFX("droptarget", DOFDropTargets), SoundFX("DTReset",DOFContactors)
  217. .CreateEvents "dtRightDrop"
  218. End With
  219.  
  220.  
  221. ' Machine Toy
  222. Set ttMachine = New cvpmTurnTable
  223. With ttMachine
  224. .InitTurnTable ttMachineTrigger, 32
  225. .SpinUp = 32
  226. .SpinDown = 25
  227. .SpinCW = True
  228. .CreateEvents "ttMachine"
  229. End With
  230.  
  231. PinMAMETimer.Interval = PinMAMEInterval
  232. PinMAMETimer.Enabled = 1
  233. MachineLock.Collidable = false
  234.  
  235. AutoPlunger.Pullback
  236.  
  237. LUTBox.Visible = 0
  238. SetLUT
  239.  
  240. if Flasher4k = 1 Then
  241. FlPf17.ImageA = "fl17"
  242. FlPf17.ImageB = "fl17"
  243. FlPf18.ImageA = "fl18"
  244. FlPf18.ImageB = "fl18"
  245. FlPf19.ImageA = "fl19"
  246. FlPf19.ImageB = "fl19"
  247. FlPf20.ImageA = "fl20"
  248. FlPf20.ImageB = "fl20"
  249. FlPf21.ImageA = "fl21"
  250. FlPf21.ImageB = "fl21"
  251. FlPf22.ImageA = "fl22"
  252. FlPf22.ImageB = "fl22"
  253. FlPf24.ImageA = "fl24"
  254. FlPf24.ImageB = "fl24"
  255. FlPf25.ImageA = "fl25"
  256. FlPf25.ImageB = "fl25"
  257. FlPf28.ImageA = "fl28"
  258. FlPf28.ImageB = "fl28"
  259. end If
  260.  
  261. If DesktopMode = True Then
  262. Bar_Rails.visible=True
  263. Else
  264. Bar_Rails.visible=False
  265.  
  266. end If
  267.  
  268. If Table1.ShowDT = false then 'AXS
  269. Fl1.State = 1
  270. Fl001.State = 1
  271. else
  272. Fl1.State = 0
  273. Fl001.State = 0
  274. End If
  275.  
  276. End Sub
  277.  
  278. Sub SetLUT
  279. Select Case LUTmeUP
  280. Case 0:table1.ColorGradeImage = 0
  281. Case 1:table1.ColorGradeImage = "AA_FS_Lut30perc"
  282. Case 2:table1.ColorGradeImage = "AA_FS_Lut50perc"
  283. Case 3:table1.ColorGradeImage = "AA_FS_Lut70perc"
  284. Case 4:table1.ColorGradeImage = "AA_FS_Lut100perc"
  285. end Select
  286. end sub
  287.  
  288. Sub LUTBox_Timer
  289. LUTBox.TimerEnabled = 0
  290. LUTBox.Visible = 0
  291. End Sub
  292.  
  293. Sub ShowLUT
  294. LUTBox.visible = 1
  295. LUTBox.text = "LUTmeUP: " & CStr(LUTmeUP)
  296. LUTBox.TimerEnabled = 1
  297. End Sub
  298.  
  299. sub Drain_Hit
  300. RandomSoundDrain
  301. bsTrough.AddBall me
  302. end sub
  303.  
  304. '***********
  305. ' Update GI
  306. '***********
  307.  
  308. Dim LastGi0:LastGi0 = 7
  309.  
  310. Sub UpdateGI(no, value)
  311.  
  312.  
  313. dim obj
  314. Select Case no
  315. case 0:
  316. if value <2 Then RG_Bulbs_Machine.Visible = 0 Else RG_Bulbs_Machine.visible = 1
  317. if value >= 7 Then
  318. RG13_Plastics_Machine_GiOff.Visible=0
  319. TurnTable_giOFF.Visible=0
  320. RG_Bulbs_giOFF_Machine.Visible = 0
  321. LastGi0 = value
  322. debug.print "GI: " & CStr(no) & " to " & CStr(value) & "lastgi0 " & LastGi0
  323. else
  324. if LastGi0 >= 7 or LastGi0 = 0 or abs(value-LastGi0) < 3 then ' VPM output seems to be a little glitchy, throw out big changes
  325. RG13_Plastics_Machine_GiOff.Visible=1
  326. RG13_Plastics_Machine_GiOff.material = "GIShading_" & (value)
  327. TurnTable_giOFF.Visible=1
  328. TurnTable_giOFF.material = "GIShading_" & (value)
  329. RG_Bulbs_giOFF_Machine.Visible=1
  330. RG_Bulbs_giOFF_Machine.material = "GIShading_" & (value)
  331. LastGi0 = value
  332. debug.print "GI: " & CStr(no) & " to " & CStr(value) & "lastgi0 " & LastGi0
  333. Else
  334. debug.print "RejectGI: " & CStr(no) & " to " & CStr(value) & "lastgi0 " & LastGi0
  335. end if
  336.  
  337. end if
  338. if value >= 5 then Fl001.IntensityScale = ((Value-5) / 3) else Fl001.IntensityScale = 0
  339. RearBulbsCard.image = "RearWall_GI" & (value)
  340.  
  341.  
  342. Case 2
  343. if value >= 5 then Fl1.IntensityScale = ((Value-5) / 3) else Fl1.IntensityScale = 0
  344. 'Table1.ColorGradeImage = "LUT1_1_0" & (8-value) '''''' GI Fading via LUT (removed)
  345. 'PF_GiON_Flasher.IntensityScale = (value/8) '''''''''''''Additive GI playfield method (removed)
  346.  
  347.  
  348. 'GiOFF Playfield fade up/down
  349. 'if value <7 Then PF_GiOFF.Opacity = 100-(value*14.28) else PF_GiOFF.Opacity = 0 end If
  350.  
  351.  
  352. if value <7 Then
  353. DOF 104, DOFOff
  354. else
  355. DOF 104, DOFOn
  356. end if
  357.  
  358. select case value
  359. case 0:
  360. PF_GiOFF.Opacity = 100
  361. GI_STATUS=0
  362. SpotlightBeam.image = "BulbAlpha_GI0"
  363.  
  364. case 1:
  365. PF_GiOFF.Opacity = 100
  366. GI_STATUS=0
  367. SpotlightBeam.image = "BulbAlpha_GI1"
  368.  
  369. case 2:
  370. PF_GiOFF.Opacity = 85
  371. GI_STATUS=1
  372. SpotlightBeam.image = "BulbAlpha_GI2"
  373.  
  374. case 3:
  375. PF_GiOFF.Opacity = 68
  376. GI_STATUS=1
  377. SpotlightBeam.image = "BulbAlpha_GI3"
  378.  
  379. case 4:
  380. PF_GiOFF.Opacity = 51
  381. GI_STATUS=1
  382. SpotlightBeam.image = "BulbAlpha_GI4"
  383.  
  384. case 5:
  385. PF_GiOFF.Opacity = 34
  386. GI_STATUS=1
  387. SpotlightBeam.image = "BulbAlpha_GI5"
  388.  
  389. case 6:
  390. PF_GiOFF.Opacity = 17
  391. GI_STATUS=1
  392. SpotlightBeam.image = "BulbAlpha_GI6"
  393.  
  394. case 7:
  395. PF_GiOFF.Opacity = 0
  396. GI_STATUS=1
  397. SpotlightBeam.image = "BulbAlpha_GI7"
  398.  
  399. case 8:
  400. PF_GiOFF.Opacity = 0
  401. GI_STATUS=1
  402. SpotlightBeam.image = "BulbAlpha_GI8"
  403.  
  404.  
  405. end select
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413. if GiMethod = 2 then
  414.  
  415. ' This is the double prim method
  416.  
  417. for each obj in GIOFF_Collection
  418. obj.material = "GIShading_" & (value)
  419. if value >= 7 Then obj.Visible=0
  420. if value <7 Then obj.Visible=1
  421. if value <2 Then RG_Bulbs.Visible = 0 Else RG_Bulbs.visible = 1
  422.  
  423. next
  424.  
  425. for each obj in GION_DuplicateSet
  426. if value <2 Then obj.Visible=0 else obj.Visible=1
  427. next
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435. for each obj in GIOFF_MaterialShade
  436. obj.material = "GIMATERIALShading" & (value)
  437. next
  438.  
  439. Elseif GiMethod = 1 then
  440.  
  441. ' This is the single prim method
  442.  
  443. for each obj in GIOFF_Collection
  444. obj.Visible=0
  445. Next
  446.  
  447.  
  448. for each obj in GIOFF_SinglePrimMethod
  449. obj.material = "GIMATERIALShading" & (value)
  450. next
  451.  
  452. End If
  453.  
  454.  
  455. ' For each lightobj in Lamps
  456. end select
  457. end sub
  458.  
  459.  
  460. ' ***** Drop targets with ball hop *************
  461.  
  462. Dim HopLeftBall:HopLeftBall = Empty
  463. Dim HopRightBall:HopRightBall = Empty
  464.  
  465. Sub SolLeftDrop(Enabled)
  466. dtLeftDrop.SolDropUp Enabled
  467. If Not IsEmpty(HopLeftBall) Then
  468. HopLeftBall.velZ = 10
  469. SlingHopTimer.Enabled = 1
  470. End If
  471. End sub
  472.  
  473. Sub SolRightDrop(Enabled)
  474. dtRightDrop.SolDropUp Enabled
  475. If Not IsEmpty(HopRightBall) Then
  476. HopRightBall.velZ = 10
  477. SlingHopTimer.Enabled = 1
  478. End If
  479. End sub
  480.  
  481. Sub TargetResetHopLeft_Hit
  482. Set HopLeftBall = ActiveBall
  483. End Sub
  484.  
  485. Sub TargetResetHopLeft_UnHit
  486. HopLeftBall = Empty
  487. End Sub
  488.  
  489. Sub TargetResetHopRight_Hit
  490. Set HopRightBall = ActiveBall
  491. End Sub
  492.  
  493. Sub TargetResetHopRight_UnHit
  494. HopRightBall = Empty
  495. End Sub
  496.  
  497.  
  498. ' *** Nudge
  499.  
  500. Dim mMagnet, cBall
  501.  
  502. Sub WobbleMagnet_Init
  503. Set mMagnet = new cvpmMagnet
  504. With mMagnet
  505. .InitMagnet WobbleMagnet, 1
  506. .Size = 100
  507. .CreateEvents mMagnet
  508. .MagnetOn = True
  509. .GrabCenter = False
  510. End With
  511. Set cBall = ckicker.CreateBall
  512. ' Set cBall = ckicker.CreateSizedBallWithMass(25, 1)
  513. ckicker.Kick 0,0:mMagnet.addball cball
  514. End Sub
  515.  
  516.  
  517. Sub ShakeTimer_Timer
  518. dim NudgeAmount:NudgeAmount = cball.y - ckicker.y
  519. if abs(NudgeAmount) > .3 then
  520. cball.x = ckicker.x
  521. cball.y = ckicker.y
  522. cball.velx = 0
  523. cball.vely = 0
  524. NudgePins(NudgeAmount)
  525. if abs(NudgeAmount) > 4 then HTBronto.Start
  526. end if
  527. UpdatePins
  528. End Sub
  529.  
  530. Dim PinAngleMax:PinAngleMax = 30
  531. Dim PinAngleMin:PinAngleMin = -30
  532. Dim PinAngle(5)
  533. Dim PinSpeed(5)
  534. Dim PinObjs:PinObjs = Array(BPin1, BPin2, BPin3, BPin4, BPin5)
  535. Dim PinDamping:PinDamping = 0.985
  536. Dim PinGravity:PinGravity = 1
  537. InitPins
  538.  
  539. Sub InitPins
  540. dim i
  541. for i=0 to 4
  542. PinAngle(i) = 0
  543. PinSpeed(i) = 0
  544. Next
  545. end sub
  546.  
  547. Sub UpdatePins
  548. dim i
  549. for i=0 to 4
  550. UpdatePin(i)
  551. Next
  552. End Sub
  553.  
  554. Sub NudgePins(NudgeAmount)
  555. dim i
  556. for i=0 to 4
  557. PinSpeed(i) = PinSpeed(i) + (NudgeAmount + (-.5 + rnd(1)))
  558. Next
  559. End Sub
  560.  
  561. Sub UpdatePin(n)
  562. if abs(PinSpeed(n)) <> 0.0 Then
  563. PinSpeed(n) = PinSpeed(n) - sin(PinAngle(n) * 3.14159 / 180) * PinGravity
  564. PinSpeed(n) = PinSpeed(n) * PinDamping
  565. end if
  566. PinAngle(n) = PinAngle(n) + PinSpeed(n)
  567. if PinAngle(n) > PinAngleMax Then
  568. PinAngle(n) = PinAngleMax
  569. PinSpeed(n) = -PinSpeed(n)
  570. PinSpeed(n) = PinSpeed(n) * PinDamping * 0.8
  571. elseif PinAngle(n) < PinAngleMin Then
  572. PinAngle(n) = PinAngleMin
  573. PinSpeed(n) = -PinSpeed(n)
  574. PinSpeed(n) = PinSpeed(n) * PinDamping * 0.8
  575. end if
  576. 'debug.print PinSpeed & " " & PinAngle
  577. 'BowlingPin1.ObjRotX = (cball.y - ckicker.y)*2
  578. PinObjs(n).ObjRotX = PinAngle(n)
  579. ' PinAngle = PinAngle + PinVel
  580. ' if abs(PinAngle) > PinMax then PinVel = -PinVel
  581. End Sub
  582.  
  583. Sub BPTrigger_Hit
  584. RandomSoundFlipper
  585. NudgePins(10)
  586. End Sub
  587.  
  588.  
  589. Dim GIInit: GIInit=10 * 4
  590.  
  591. Sub PreloadImages
  592. If PreloadMe = 1 and GIInit > 0 Then
  593. GIInit = GIInit -1
  594. select case (GIInit \ 4) ' Divide by 4, this is not a frame timer, so we want to be sure frame is visible
  595. case 0:
  596. FlipperL.image="leftflipper_giON_BLK"
  597. FlipperR.image="rightflipper_giON_BLK"
  598. FlipperR1.image="rightUPPERflipper_giON_BLK"
  599.  
  600. case 1:
  601. FlipperL.image="leftflipper_giOFF_BLK"
  602. FlipperR.image="rightflipperUP_giOFF_BLK"
  603. FlipperR1.image="rightUPPERflipperUP_giOFF_BLK"
  604. case 2:
  605. FlipperL.image="leftflipperUP_giON_BLK"
  606. FlipperR.image="rightflipper_giOFF_BLK"
  607. FlipperR1.image="rightUPPERflipper_giOFF_BLK"
  608. case 3:
  609. FlipperL.image="leftflipperUP_giOFF_BLK"
  610. FlipperR.image="rightflipperUP_giON_BLK"
  611. FlipperR1.image="rightUPPERflipperUP_giON_BLK"
  612. end select
  613. End If
  614. End Sub
  615.  
  616.  
  617. Set MotorCallback = GetRef("RealTimeUpdates")
  618.  
  619. Sub RealTimeUpdates
  620.  
  621. Dim chgLamp, num, chg, ii
  622. chgLamp = Controller.ChangedLamps
  623. If Not IsEmpty(chgLamp) Then
  624. For ii = 0 To UBound(chgLamp)
  625. SetLamp ChgLamp(ii,0), ChgLamp(ii,1)
  626. Next
  627. End If
  628. FadeLights.Update
  629. UpdateTheMachine
  630. PreloadImages
  631.  
  632. IF GI_STATUS = 0 Then
  633. If FlipperLeft.CurrentAngle < 80 Then
  634. FlipperL.image = "leftflipperUp_giOff_BLK"
  635. Else
  636. FlipperL.image = "leftflipper_giOFF_BLK"
  637. End If
  638.  
  639. If FlipperRight.CurrentAngle < -80 Then
  640. FlipperR.image = "rightflipper_giOFF_BLK"
  641. Else
  642. FlipperR.image = "rightflipperUP_giOFF_BLK"
  643. End If
  644.  
  645. If FlipperRight1.CurrentAngle < -125 Then
  646. FlipperR1.image = "rightUPPERflipper_giOFF_BLK"
  647. Else
  648. FlipperR1.image = "rightUPPERflipperUp_giOFF_BLK"
  649. End If
  650.  
  651.  
  652.  
  653. Elseif GI_STATUS = 1 Then
  654. If FlipperLeft.CurrentAngle < 80 Then
  655. FlipperL.image = "leftflipperUP_giON_BLK"
  656. Else
  657. FlipperL.image = "leftflipper_giON_BLK"
  658. End If
  659.  
  660. If FlipperRight.CurrentAngle < -80 Then
  661. FlipperR.image = "rightflipper_giON_BLK"
  662. Else
  663. FlipperR.image = "rightflipperUP_giON_BLK"
  664. End If
  665.  
  666. If FlipperRight1.CurrentAngle < -125 Then
  667. FlipperR1.image = "rightUPPERFlipper_giON_BLK"
  668. Else
  669. FlipperR1.image = "rightUPPERflipperUP_giON_BLK"
  670. End If
  671. End if
  672.  
  673.  
  674.  
  675. WireGate.rotx= 0- Sw38.Currentangle / 1
  676. WireGate2.rotx= 0 - Gate5.Currentangle / 1
  677. GateFlapLeft.roty= 0- Gate4.Currentangle / 1
  678. GateFlapRight.roty= 150 - Gate2.Currentangle / -1
  679.  
  680. flipperL.RotZ = FlipperLeft.CurrentAngle
  681. flipperR.RotZ = FlipperRight.CurrentAngle
  682. flipperR1.RotZ = FlipperRight1.CurrentAngle
  683.  
  684. if BallShadowOn = 1 then BallShadowUpdate
  685.  
  686. If FlipperShadows = 1 Then
  687. FlipperShadowL.RotZ = FlipperLeft.currentAngle
  688. FlipperShadowR.RotZ = FlipperRight.currentAngle
  689. FlipperShadowR1.RotZ = FlipperRight1.currentAngle
  690. End If
  691.  
  692. If OutlaneDifficulty = 1 Then 'AXS
  693. OutlaneLeft1.Collidable = True
  694. OutlaneLeft2.Collidable = False
  695. OutlaneLeft3.Collidable = False
  696.  
  697. OutlaneRight1.Collidable = True
  698. OutlaneRight2.Collidable = False
  699. OutlaneRight3.Collidable = False
  700.  
  701. ' InlaneLeft1.Collidable = True
  702. ' InlaneLeft2.Collidable = False
  703. ' InlaneLeft3.Collidable = False
  704. '
  705. ' InlaneRight1.Collidable = True
  706. ' InlaneRight2.Collidable = False
  707. ' InlaneRight3.Collidable = False
  708. End If
  709.  
  710. If OutlaneDifficulty = 2 Then
  711. OutlaneLeft1.Collidable = False
  712. OutlaneLeft2.Collidable = True
  713. OutlaneLeft3.Collidable = False
  714.  
  715. OutlaneRight1.Collidable = False
  716. OutlaneRight2.Collidable = True
  717. OutlaneRight3.Collidable = False
  718.  
  719. ' InlaneLeft1.Collidable = False
  720. ' InlaneLeft2.Collidable = True
  721. ' InlaneLeft3.Collidable = False
  722. '
  723. ' InlaneRight1.Collidable = False
  724. ' InlaneRight2.Collidable = True
  725. ' InlaneRight3.Collidable = False
  726. End If
  727.  
  728. If OutlaneDifficulty = 3 Then
  729. OutlaneLeft1.Collidable = False
  730. OutlaneLeft2.Collidable = False
  731. OutlaneLeft3.Collidable = True
  732.  
  733. OutlaneRight1.Collidable = False
  734. OutlaneRight2.Collidable = False
  735. OutlaneRight3.Collidable = True
  736.  
  737. ' InlaneLeft1.Collidable = False
  738. ' InlaneLeft2.Collidable = False
  739. ' InlaneLeft3.Collidable = True
  740. '
  741. ' InlaneRight1.Collidable = False
  742. ' InlaneRight2.Collidable = False
  743. ' InlaneRight3.Collidable = True
  744. End If
  745.  
  746. End Sub
  747.  
  748. SolCallback(1) = "SolRelease"
  749. SolCallback(2) = "vpmSolAutoPlungeS AutoPlunger, SoundFX(SSolenoidOn, DOFContactors), 8,"
  750. SolCallback(3) = "SolTopDiverter"
  751. SolCallback(4) = "bsKicker36.SolOut"
  752. SolCallback(5) = "SolLeftDrop"
  753. SolCallback(6) = "SolRightDrop"
  754. SolCallback(7) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  755. SolCallback(8) = "SolBrontoDiverter"
  756. SolCallback(9) = "sRightSlingshot"
  757. SolCallback(10) = "sLeftSlingshot"
  758. SolModCallback(14) = "FadeLights.LampMod 114,"
  759. SolCallBack(15) = "SolLeftApronDiverter"
  760. SolCallback(16) = "SolRightApronDiverter"
  761. SolModCallback(17) = "FadeLights.LampMod 117,"
  762. SolModCallback(18) = "FadeLights.LampMod 118,"
  763. SolModCallback(19) = "FadeLights.LampMod 119,"
  764. SolModCallBack(20) = "FadeLights.LampMod 120,"
  765. SolModCallback(21) = "FadeLights.LampMod 121,"
  766. SolModCallback(22) = "FadeLights.LampMod 122,"
  767. SolCallback(23) = "SolMachine"
  768. SolModCallback(24) = "FadeLights.LampMod 124,"
  769. SolModCallback(25) = "FadeLights.LampMod 125,"
  770. SolCallback(26) = ""
  771. SolCallback(27) = ""
  772. SolModCallBack(28) = "Flasher28"
  773. SolCallback(35) = "SolGateRGate" '"vpmSolGate RGate,false,"
  774. SolCallback(36) = "SolGateLGate" '"vpmSolGate LGate,false,"
  775. SolCallback(sLRFlipper) = "SolRFlipper"
  776. SolCallback(sLLFlipper) = "SolLFlipper"
  777.  
  778. Sub Flasher28(Intensity)
  779. FadeLights.LampMod 128,(Intensity / 5)
  780. RG5_PlasticsFlasher.BlendDisableLighting = Intensity / 255
  781. RG13_PlasticsFlasher.BlendDisableLighting = Intensity / 255
  782. if Intensity = 0 Then
  783. RG5_PlasticsFlasher.visible = false
  784. RG13_PlasticsFlasher.visible = False
  785. Else
  786. RG5_PlasticsFlasher.visible = true
  787. RG13_PlasticsFlasher.visible = true
  788.  
  789. RG5_PlasticsFlasher.material = "GIShading_" & ((255-Intensity) * 6 \ 255)
  790. RG13_PlasticsFlasher.material = "GIShading_" & ((255 - Intensity) * 6 \ 255)
  791. end if
  792. ' if Enabled Then
  793. ' RG5_Plastics.image = "Flasher28FredsChoiceB"
  794. ' RG13_Plastics.image = "Flasher28FredsChoiceAC"
  795. ' else
  796. ' RG5_Plastics.image = "RG_15_plastics_giON_AXS"
  797. ' RG13_Plastics.image = "RG_13_giON"
  798. ' end if
  799. end sub
  800.  
  801. ' ************************************************
  802. ' The Machine
  803. ' ************************************************
  804.  
  805. dim MachineSpeedMax:MachineSpeedMax = 20.0
  806. dim MachineSpeedCur:MachineSpeedCur = 0
  807. dim MachineRamp:MachineRamp = .5
  808. dim MachinePos:MachinePos = 0
  809.  
  810. Sub SolMachine(Enabled)
  811. If Enabled Then
  812. ttMachine.MotorOn = 1
  813. Else
  814. ttMachine.MotorOn = 0
  815. End If
  816. End Sub
  817.  
  818. Sub UpdateTheMachine
  819. if ttMachine.MotorOn = 1 Then
  820. if MachineSpeedCur < MachineSpeedMax then MachineSpeedCur = MachineSpeedCur + MachineRamp
  821. if MachineSpeedCur > MachineSpeedMax then MachineSpeedCur = MachineSpeedMax
  822. Else
  823. if MachineSpeedCur > 0 then
  824. MachineSpeedCur = MachineSpeedCur - MachineRamp
  825. if MachineSpeedCur <= 0 then
  826. MachineSpeedCur = 0
  827. StopSound "machine"
  828. end if
  829. end if
  830. end if
  831.  
  832. ' This is a bit of a dirty trick to help keep the balls spinning in the machine longer. Blocks the exit at certain angles.
  833. if MachinePos < 90 and ttMachine.MotorOn then
  834. MachineLock.Collidable = true
  835. Else
  836. MachineLock.Collidable = False
  837. end if
  838. if MachineSpeedCur > 0 then
  839. PlaySound SoundFX("machine", DOFGear), -1, MachineSpeedCur / MachineSpeedMax / 400, AudioPan(ttMachineTrigger), 0, MachineSpeedCur * 100000/ MachineSpeedMax, 1, 0, AudioFade(ttMachineTrigger)
  840. MachinePos = MachinePos - MachineSpeedCur
  841. if MachinePos < 0 then MachinePos = MachinePos + 360
  842.  
  843. TurnTable.rotz = MachinePos
  844. TurnTable.image = "Turntable_giON_" & Right("00" & CStr(Int(MachinePos / 2.5)), 3)
  845. TurnTable_giOFF.rotz = MachinePos
  846. 'TurnTableNut.rotz = MachinePos 'AXS
  847. TurnTable_giOFF.image = "Turntable_giOFF_" & Right("00" & CStr(Int(MachinePos / 2.5)), 3)
  848. dim x: x= Int(MachinePos / 2.5)
  849. if x < 0 or x > 143 then debug.print "X out of range " & CStr(x) & " for degree " & MachinePos
  850. end if
  851. End Sub
  852.  
  853. ' ************************************************
  854. ' Dictabird
  855. ' ************************************************
  856.  
  857. Sub UpdateDictabird(Value)
  858. Dictabird.objrotx = -7 + (-Value) * 9
  859. End Sub
  860.  
  861.  
  862. Sub SolBrontoDiverter(Enabled)
  863. if Enabled Then
  864. BrontoDiverter.RotateToEnd'BrontoDiverter.RotateToStart'
  865. Diverter.TransX = -40
  866. Else
  867. BrontoDiverter.RotateToStart'BrontoDiverter.RotateToEnd'
  868. Diverter.TransX = 0
  869. end if
  870. End Sub
  871.  
  872. Sub SolLeftApronDiverter(Enabled)
  873. If Enabled Then
  874. 'LeftApronGate.RotatetoStart
  875. DiverterLeft.TransZ = -40
  876. DiverterLeft.Collidable = 0
  877. PlaySoundAt SoundFX("DiverterLeftUp", DOFContactors), DiverterLeft
  878. Else
  879. 'LeftApronGate.RotatetoEnd
  880. DiverterLeft.TransZ = -20
  881. DiverterLeft.Collidable = 1
  882. 'Playsound "DiverterLeftDown"
  883. LDTimer.Enabled = 1
  884. End If
  885. End Sub
  886.  
  887. Sub SolRightApronDiverter(Enabled)
  888. If Enabled Then
  889. 'RightApronGate.RotatetoStart
  890. DiverterRight.TransZ = -40
  891. DiverterRight.Collidable = 0
  892. PlaySoundAt SoundFX("DiverterRightUp", DOFContactors), DiverterRight
  893. Else
  894. 'RightApronGate.RotatetoEnd
  895. DiverterRight.TransZ = -20
  896. DiverterRight.Collidable = 1
  897. 'Playsound "DiverterRightDown"
  898. RDtimer.Enabled = 1
  899. End If
  900. End Sub
  901.  
  902. Sub SolGateLGate(Enabled) 'AXS
  903. 'Debug.Print "LGate: " & Enabled
  904. If Enabled Then
  905. Gate4.Collidable = False
  906. Else
  907. Gate4.Collidable = True
  908. End If
  909. End Sub
  910.  
  911. Sub SolGateRGate(Enabled) 'AXS
  912. 'Debug.Print "RGate: " & Enabled
  913. If Enabled Then
  914. Gate2.Collidable = False
  915. Else
  916. Gate2.Collidable = True
  917. End If
  918. End Sub
  919.  
  920. Sub SolTopDiverter(Enabled) 'AXS
  921. If Enabled Then
  922. DiverterPost.Collidable = True
  923. Else
  924. DiverterPost.Collidable = False
  925. End If
  926. End Sub
  927.  
  928. Sub LDTimer_Timer 'AXS
  929. DiverterLeft.TransZ = 0
  930. 'DiverterRight.TransZ = 0
  931. PlaySoundAt SoundFX("DiverterLeftDown", DOFContactors), DiverterLeft
  932. LDTimer.Enabled = 0
  933. End Sub
  934.  
  935. Sub RDTimer_Timer 'AXS
  936. 'DiverterLeft.TransZ = 0
  937. DiverterRight.TransZ = 0
  938. PlaySoundAt SoundFX("DiverterRightDown", DOFContactors), DiverterRight
  939. RDTimer.Enabled = 0
  940. End Sub
  941.  
  942. '************************************************** AXS AutoFlip (Testing)
  943. 'Sub TriggerAutoFlipLeft_Hit 'Axs
  944. 'if autoflip=1 Then
  945. ' FlipperLeft.RotateToEnd
  946. ' PlaySound SoundFX("FlipperUpLeft",DOFFlippers), 0, .67, AudioPan(FlipperLeft), 0.05,0,0,1,AudioFade(FlipperLeft)
  947. ' TimerFlipperLeft.Enabled=1
  948. 'end if
  949. 'End Sub
  950. '
  951. 'Sub TimerFlipperLeft_Timer
  952. ' FlipperLeft.RotateToStart
  953. ' TimerFlipperLeft.Enabled=0
  954. ' PlaySound SoundFX("FlipperDown",DOFFlippers), 0, 1, AudioPan(FlipperLeft), 0.05,0,0,1,AudioFade(FlipperLeft)
  955. 'End Sub
  956. '
  957. 'Sub TriggerAutoFlipRight_Hit
  958. 'if autoflip=1 Then
  959. ' PlaySound SoundFX("Flipper(s)UpRight",DOFFlippers), 0, .67, AudioPan(FlipperRight), 0.05,0,0,1,AudioFade(FlipperRight)
  960. ' FlipperRight.RotateToEnd
  961. ' TimerFlipperRight.Enabled=1
  962. 'end if
  963. 'End Sub
  964. '
  965. 'Sub TimerFlipperRight_Timer
  966. ' FlipperRight.RotateToStart
  967. ' TimerFlipperRight.Enabled=0
  968. ' PlaySound SoundFX("FlipperDown",DOFFlippers), 0, 1, AudioPan(FlipperRight), 0.05,0,0,1,AudioFade(FlipperRight)
  969. 'End Sub
  970. '
  971. 'Sub TriggerAutoFlipRight1_Hit
  972. 'if autoflip=1 Then
  973. ' PlaySound SoundFX("Flipper(s)UpRight",DOFFlippers), 0, .67, AudioPan(FlipperRight), 0.05,0,0,1,AudioFade(FlipperRight)
  974. ' FlipperRight1.RotateToEnd
  975. ' TimerFlipperRight1.Enabled=1
  976. 'end if
  977. 'End Sub
  978. '
  979. 'Sub TimerFlipperRight1_Timer
  980. ' FlipperRight1.RotateToStart
  981. ' TimerFlipperRight1.Enabled=0
  982. ' PlaySound SoundFX("FlipperDown",DOFFlippers), 0, 1, AudioPan(FlipperRight), 0.05,0,0,1,AudioFade(FlipperRight)
  983. 'End Sub
  984.  
  985. '**************************************************
  986.  
  987. Sub SolLFlipper(Enabled)
  988. If Enabled Then
  989. FlipperLeft.RotateToEnd
  990. PlaySound SoundFX("FlipperUpLeft",DOFFlippers), 0, .67, AudioPan(LT41d), 0.05,0,0,1,AudioFade(FlipperLeft)
  991. Else
  992. FlipperLeft.RotateToStart
  993. PlaySound SoundFX("FlipperDown",DOFFlippers), 0, 1, AudioPan(LT41d), 0.05,0,0,1,AudioFade(FlipperLeft)
  994. End If
  995. End Sub
  996.  
  997. Sub SolRFlipper(Enabled)
  998. If Enabled Then
  999. FlipperRight.RotateToEnd
  1000. FlipperRight1.RotateToEnd
  1001. PlaySound SoundFX("Flipper(s)UpRight",DOFFlippers), 0, .67, AudioPan(LT41c), 0.05,0,0,1,AudioFade(FlipperRight)
  1002. Else
  1003. FlipperRight.RotateToStart
  1004. FlipperRight1.RotateToStart
  1005. PlaySound SoundFX("FlipperDown",DOFFlippers), 0, 1, AudioPan(LT41c), 0.05,0,0,1,AudioFade(FlipperRight)
  1006. End If
  1007. End Sub
  1008.  
  1009.  
  1010.  
  1011. Sub Table1_KeyDown(ByVal Keycode)
  1012. If keycode = RightMagnaSave Then
  1013. LUTmeUP = LUTMeUp + 1
  1014. if LutMeUp > MaxLut then LUTmeUP = 0
  1015. SetLUT
  1016. ShowLUT
  1017. end if
  1018. If keycode = LeftMagnaSave Then
  1019. LUTmeUP = LUTMeUp - 1
  1020. if LutMeUp < 0 then LUTmeUP = MaxLut
  1021. SetLUT
  1022. ShowLUT
  1023. end if
  1024. If keycode = PlungerKey Then Controller.Switch(11) = 1
  1025. If keycode = keyFront Then Controller.Switch(23) = 1
  1026. If keycode = LeftTiltKey Then
  1027. Nudge 90, 2
  1028. End If
  1029.  
  1030. If keycode = RightTiltKey Then
  1031. Nudge 270, 2
  1032. End If
  1033.  
  1034. If keycode = CenterTiltKey Then
  1035. Nudge 0, 2
  1036. End If
  1037.  
  1038. 'If keycode = 31 then autoflip = 1 - autoflip: playsound "button-click" 'AXS
  1039. 'Msgbox Keycode
  1040. If vpmKeyDown(keycode) Then Exit Sub
  1041. End Sub
  1042.  
  1043. Sub table1_KeyUp(ByVal Keycode)
  1044. If vpmKeyUp(keycode) Then Exit Sub
  1045. If keycode = PlungerKey Then Controller.Switch(11) = 0
  1046. If keycode = keyFront Then Controller.Switch(23) = 0
  1047. End Sub
  1048.  
  1049.  
  1050. Sub SolRelease(Enabled)
  1051. If Enabled And bsTrough.Balls > 0 Then
  1052. vpmTimer.PulseSw 31
  1053. bsTrough.ExitSol_On
  1054. End If
  1055. End Sub
  1056.  
  1057. ' ************************************************
  1058. ' Slingshots
  1059. ' ************************************************
  1060.  
  1061. Dim RStep, Lstep
  1062.  
  1063. Sub RightSlingShot_Slingshot()
  1064. vpmTimer.PulseSW 62
  1065. End Sub
  1066.  
  1067. Sub LeftSlingShot_Slingshot()
  1068. vpmTimer.PulseSW 61
  1069. End Sub
  1070.  
  1071.  
  1072. Sub sRightSlingShot(enabled)
  1073. If enabled Then
  1074. PlaySound SoundFX("slingshotRight", DOFContactors), 0, 1, 0.05, 0.05
  1075. 'RSling.Visible = 0
  1076. RSling1.Visible = 1
  1077. 'sling1.TransZ = -20
  1078. RStep = 0
  1079. RightSlingShot.TimerEnabled = 1
  1080. End If
  1081. End Sub
  1082.  
  1083. Sub RightSlingShot_Timer
  1084. Select Case RStep
  1085. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:SlingArmR.TransZ = -10
  1086. Case 4:RSLing2.Visible = 0:RSling1.Visible = 0:SlingArmR.TransZ = 0:RightSlingShot.TimerEnabled = 0
  1087. End Select
  1088. RStep = RStep + 1
  1089. End Sub
  1090.  
  1091. Sub sLeftSlingShot(enabled)
  1092. If enabled Then
  1093. PlaySound SoundFX("slingshotLeft", DOFContactors),0,1,-0.05,0.05
  1094. 'LSling.Visible = 0
  1095. LSling1.Visible = 1
  1096. 'sling2.TransZ = -20
  1097. LStep = 0
  1098. LeftSlingShot.TimerEnabled = 1
  1099. End If
  1100. End Sub
  1101.  
  1102. Sub LeftSlingShot_Timer
  1103. Select Case LStep
  1104. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:SlingArmL.TransZ = -10
  1105. Case 4:LSLing2.Visible = 0:SlingArmL.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  1106. End Select
  1107. LStep = LStep + 1
  1108. End Sub
  1109.  
  1110. Sub SlingHopL_Hit
  1111. 'Msgbox Activeball.velx'Msgbox "left Hit"
  1112. If Activeball.velX < -7 Then
  1113. 'Msgbox Activeball.velx
  1114. SlingHopTimer.Enabled = 1
  1115. Activeball.velZ = 10
  1116. End If
  1117. End Sub
  1118.  
  1119. Sub SlingHopR_Hit
  1120. 'Msgbox Activeball.velx'Msgbox "Right hit"
  1121. If Activeball.velX > 7 Then
  1122. 'Msgbox Activeball.velx
  1123. SlingHopTimer.Enabled = 1
  1124. Activeball.velZ = 10
  1125. End If
  1126. End Sub
  1127.  
  1128. Sub SlingHopTimer_Timer
  1129. Playsound "ball_bounce",0,.05,0,.1
  1130. SlingHopTimer.Enabled = 0
  1131. End Sub
  1132.  
  1133.  
  1134. ' ************************************************
  1135. ' HitTarget and Bronto Crane animation
  1136. ' ************************************************
  1137.  
  1138.  
  1139.  
  1140. Class HTAnim
  1141. Dim HTPrimObj, HTSwitchObj, HTOsc, HTOscIncrement, HTDist, HTSwitchNum
  1142. Dim HTDistMax, HTStartOscDeg, HTDecay, HTOscInitialIncrement, HTTimerInterval, HTOscRampIncrement
  1143. Dim HTAxis
  1144.  
  1145. public default function Init(primobj, switchobj, switchnum)
  1146. set HTPrimObj = primobj
  1147. set HTSwitchObj = switchobj
  1148. HTTimerInterval = 8
  1149. HTSwitchObj.TimerEnabled = 0
  1150. HTSwitchNum = switchnum
  1151. HTDistMax = 6
  1152. HTStartOscDeg = 0
  1153. HTDecay = 0.6
  1154. HTOscInitialIncrement = .474
  1155. HTOscRampIncrement = .013
  1156.  
  1157. set Init = Me
  1158. end function
  1159.  
  1160. sub SetAxis(axis)
  1161. HTAxis = axis
  1162. end sub
  1163.  
  1164. sub Start
  1165. HTOsc = HTStartOscDeg
  1166. HTDist = HTDistMax
  1167. HTOscIncrement = HTOscInitialIncrement
  1168. HTSwitchObj.TimerInterval = HTTimerInterval
  1169. HTSwitchObj.TimerEnabled = 1
  1170. vpmTimer.PulseSw HTSwitchNum
  1171. end sub
  1172.  
  1173. sub Update
  1174. select case HTAxis
  1175. case "Y+"
  1176. HTPrimObj.RotY = HTDist * cos(HTOsc)
  1177. case "Y-"
  1178. HTPrimObj.RotY = -HTDist * cos(HTOsc)
  1179. case else
  1180. HTPrimObj.RotX = 180 + HTDist * cos(HTOsc)
  1181. end select
  1182. if HTDist > 0 Then
  1183. HTDist = HTDist - HTDecay
  1184. HTOsc = HTOsc + HTOscIncrement
  1185. HTOscIncrement = HTOscIncrement + HTOscRampIncrement
  1186. if HTOsc > 6.28 then HTOsc = HTOsc - 6.28
  1187. Else
  1188. HTSwitchObj.TimerEnabled = 0
  1189. end if
  1190. end sub
  1191. End Class
  1192.  
  1193. Dim HTAnim26:Set HTAnim26 = (new HTAnim)(Rg9_T26, Sw26, 26)
  1194.  
  1195. Sub sw26_Hit: HTAnim26.Start: PlaySoundAtBallVol SoundFX("target", DOFTargets): End Sub
  1196. Sub sw26_Timer: HTAnim26.Update:End Sub
  1197.  
  1198. Dim HTAnim51a:Set HTAnim51a = (new HTAnim)(Rg9_T51a, Sw51a, 51):HTAnim51a.SetAxis("Y+")
  1199.  
  1200. Sub sw51a_Hit: HTAnim51a.Start: PlaySoundAtBallVol SoundFXDOF("target",101,DOFPulse,DOFTargets): End Sub
  1201. Sub sw51a_Timer: HTAnim51a.Update:End Sub
  1202.  
  1203. Dim HTAnim51b:Set HTAnim51b = (new HTAnim)(Rg9_T51b, Sw51b, 51):HTAnim51b.SetAxis("Y-")
  1204.  
  1205. Sub sw51b_Hit: HTAnim51b.Start: PlaySoundAtBallVol SoundFXDOF("target",102,DOFPulse,DOFTargets): End Sub
  1206. Sub sw51b_Timer: HTAnim51b.Update:End Sub
  1207.  
  1208. Dim HTAnim52a:Set HTAnim52a = (new HTAnim)(Rg9_T52a, Sw52a, 52):HTAnim52a.SetAxis("Y+")
  1209.  
  1210. Sub sw52a_Hit: HTAnim52a.Start: PlaySoundAtBallVol SoundFXDOF("target",101,DOFPulse,DOFTargets): End Sub
  1211. Sub sw52a_Timer: HTAnim52a.Update:End Sub
  1212.  
  1213. Dim HTAnim52b:Set HTAnim52b = (new HTAnim)(Rg9_T52b, Sw52b, 52):HTAnim52b.SetAxis("Y-")
  1214.  
  1215. Sub sw52b_Hit: HTAnim52b.Start: PlaySoundAtBallVol SoundFXDOF("target",102,DOFPulse,DOFTargets): End Sub
  1216. Sub sw52b_Timer: HTAnim52b.Update:End Sub
  1217.  
  1218. Dim HTAnim53a:Set HTAnim53a = (new HTAnim)(Rg9_T53a, Sw53a, 53):HTAnim53a.SetAxis("Y+")
  1219.  
  1220. Sub sw53a_Hit: HTAnim53a.Start: PlaySoundAtBallVol SoundFXDOF("target",101,DOFPulse,DOFTargets): End Sub
  1221. Sub sw53a_Timer: HTAnim53a.Update:End Sub
  1222.  
  1223. Dim HTAnim53b:Set HTAnim53b = (new HTAnim)(Rg9_T53b, Sw53b, 53):HTAnim53b.SetAxis("Y-")
  1224.  
  1225. Sub sw53b_Hit: HTAnim53b.Start: PlaySoundAtBallVol SoundFXDOF("target",102,DOFPulse,DOFTargets):End Sub
  1226. Sub sw53b_Timer: HTAnim53b.Update:End Sub
  1227.  
  1228. Dim HTAnim54:Set HTAnim54 = (new HTAnim)(Rg9_T54, Sw54, 54)
  1229.  
  1230. Sub sw54_Hit: HTAnim54.Start: PlaySoundAtBallVol SoundFX("target", DOFTargets):End Sub
  1231. Sub sw54_Timer: HTAnim54.Update:End Sub
  1232.  
  1233. Dim HTAnim55:Set HTAnim55 = (new HTAnim)(Rg9_T55, Sw55, 55)
  1234.  
  1235. Sub sw55_Hit: HTAnim55.Start: PlaySoundAtBallVol SoundFX("target", DOFTargets):End Sub
  1236. Sub sw55_Timer: HTAnim55.Update:End Sub
  1237.  
  1238. Dim HTAnim56:Set HTAnim56 = (new HTAnim)(Rg9_T56, Sw56, 56)
  1239.  
  1240. Sub sw56_Hit: HTAnim56.Start: PlaySoundAtBallVol SoundFX("target", DOFTargets):End Sub
  1241. Sub sw56_Timer: HTAnim56.Update:End Sub
  1242.  
  1243. Dim HTBronto:Set HTBronto = (new HTAnim)(BrontoCrane, BrontoTrigger1, 200):HTBronto.HTDistMax = .75:HTBronto.HTDecay = 0.01:HTBronto.HTOscInitialIncrement = .05:HTBronto.HTStartOscDeg = 2.14
  1244.  
  1245. Sub BrontoTrigger1_Hit: HTBronto.Start: DOF 103, DOFOn: End Sub
  1246. Sub BrontoTrigger2_Hit: HTBronto.Start: DOF 103, DOFOn: BrontoTrigger2.TimerInterval = 100:BrontoTrigger2.TimerEnabled = 1:End Sub
  1247.  
  1248. Sub BrontoTrigger1_Timer
  1249. HTBronto.Update
  1250. if BrontoTrigger1.TimerEnabled = 0 then DOF 103, DOFOff
  1251. End Sub
  1252.  
  1253. Sub BrontoTrigger2_Timer:
  1254. PlaySound "ball_bounce", 1, .1, AudioPan(BrontoTrigger2), 0,0,0, 1, AudioFade(BrontoTrigger2)'PlaySoundAt "ball_bounce", BrontoTrigger2
  1255. BrontoTrigger2.TimerEnabled = 0
  1256. End Sub
  1257.  
  1258. ' ************************************************
  1259. ' Pop bumpers
  1260. ' ************************************************
  1261.  
  1262.  
  1263. Sub Sw63_Hit:vpmTimer.PulseSw 63:PlaySoundAtBall SoundFX("BumperTop_Hit", DOFContactors):End Sub
  1264. Sub Sw64_Hit:vpmTimer.PulseSw 64:PlaySoundAtBall SoundFX("BumperRight_Hit", DOFContactors):End Sub
  1265. Sub Sw65_Hit:vpmTimer.PulseSw 65:PlaySoundAtBall SoundFX("BumperLeft_Hit", DOFContactors):End Sub
  1266.  
  1267.  
  1268. ' ************************************************
  1269. ' Drop targets
  1270. ' ************************************************
  1271.  
  1272. 'Sub Sw41_Hit:vpmTimer.PulseSw 41:PlaySoundAtBallVol "target":End Sub
  1273. 'Sub Sw42_Hit:vpmTimer.PulseSw 42:PlaySoundAtBallVol "target":End Sub
  1274. 'Sub Sw43_Hit:vpmTimer.PulseSw 43:PlaySoundAtBallVol "target":End Sub
  1275. 'Sub Sw44_Hit:vpmTimer.PulseSw 44:PlaySoundAtBallVol "target":End Sub
  1276. 'Sub Sw45_Hit:vpmTimer.PulseSw 45:PlaySoundAtBallVol "target":End Sub
  1277. 'Sub Sw46_Hit:vpmTimer.PulseSw 46:PlaySoundAtBallVol "target":End Sub
  1278. 'Sub Sw47_Hit:vpmTimer.PulseSw 47:PlaySoundAtBallVol "target":End Sub
  1279.  
  1280. ' ************************************************
  1281. ' Other switches
  1282. ' ************************************************
  1283.  
  1284. Sub sw15_Hit:Controller.Switch(15) = 1:PlaySoundAtBallVol "sensor":End Sub
  1285. Sub sw15_Unhit:Controller.Switch(15) = 0:End Sub
  1286.  
  1287. Sub sw16_Hit:vpmTimer.PulseSw 16:PlaySoundAtBallVol "sensor":End Sub
  1288. 'Sub sw16_Unhit:Controller.Switch(16) = 0:End Sub
  1289.  
  1290. Sub sw17_Hit:vpmTimer.PulseSw 17:PlaySoundAtBallVol "sensor":End Sub
  1291. 'Sub sw17_Unhit:Controller.Switch(17) = 0:End Sub
  1292.  
  1293. Sub sw18_Hit:vpmTimer.PulseSw 18:PlaySoundAtBallVol "sensor":End Sub
  1294. 'Sub sw18_Unhit:Controller.Switch(18) = 0:End Sub
  1295.  
  1296. Sub sw25_Hit:Controller.Switch(25) = 1:PlaySoundAtBallVol "sensor":End Sub
  1297. Sub sw25_Unhit:Controller.Switch(25) = 0:End Sub
  1298.  
  1299.  
  1300. Sub sw48_Hit:Controller.Switch(48) = 1:PlaySoundAtBallVol "sensor":End Sub
  1301. Sub sw48_UnHit:Controller.Switch(48) = 0:End Sub
  1302.  
  1303. Sub sw27_Hit:Controller.Switch(27) = 1:PlaySoundAtBallVol "sensor":End Sub
  1304. Sub sw27_UnHit:Controller.Switch(27) = 0:End Sub
  1305.  
  1306.  
  1307. Sub sw28_Hit:Controller.Switch(28) = 1:PlaySoundAtBallVol "sensor":End Sub
  1308. Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
  1309.  
  1310. Sub sw37_Hit:vpmTimer.PulseSw 37:PlaySoundAtBallVol "gate":End Sub
  1311.  
  1312. Sub sw38_Hit:vpmTimer.PulseSw 38:PlaySoundAtBallVol "gate":End Sub
  1313.  
  1314. Sub sw75_Hit:vpmTimer.PulseSw 75:PlaySoundAtBallVol "sensor":End Sub
  1315.  
  1316. Sub sw66_Hit:Controller.Switch(66) = 1:PlaySoundAtBallVol "sensor":End Sub
  1317. Sub sw66_UnHit:Controller.Switch(66) = 0:End Sub
  1318.  
  1319. Sub sw67_Hit:Controller.Switch(67) = 1:PlaySoundAtBallVol "sensor":End Sub
  1320. Sub sw67_UnHit:Controller.Switch(67) = 0:End Sub
  1321.  
  1322. Sub sw68_Hit:Controller.Switch(68) = 1:PlaySoundAtBallVol "sensor":End Sub
  1323. Sub sw68_UnHit:Controller.Switch(68) = 0:End Sub
  1324.  
  1325. Sub sw71_Hit:Controller.Switch(71) = 1:PlaySoundAt "sensor", Sw71:End Sub
  1326. Sub sw71_UnHit:Controller.Switch(71) = 0:End Sub
  1327.  
  1328. Sub sw72_Hit:Controller.Switch(72) = 1:PlaySoundAtBallVol "sensor":End Sub
  1329. Sub sw72_UnHit:Controller.Switch(72) = 0:End Sub
  1330.  
  1331. Sub sw73_Hit:Controller.Switch(73) = 1:PlaySoundAtBallVol "sensor":End Sub
  1332. Sub sw73_UnHit:Controller.Switch(73) = 0:End Sub
  1333.  
  1334. Sub sw74_Hit:Controller.Switch(74) = 1:PlaySoundAtBallVol "sensor":End Sub
  1335. Sub sw74_UnHit:Controller.Switch(74) = 0:End Sub
  1336.  
  1337. Sub sw76_Hit:Controller.Switch(76) = 1:PlaySoundAtBallVol "sensor":End Sub
  1338. Sub sw76_Unhit:Controller.Switch(76) = 0:End Sub
  1339.  
  1340. Sub sw77_Hit:Controller.Switch(77) = 1:PlaySoundAtBallVol "sensor":End Sub
  1341. Sub sw77_Unhit:Controller.Switch(77) = 0:End Sub
  1342.  
  1343. Sub sw78_Hit:Controller.Switch(78) = 1:PlaySoundAtBallVol "sensor":End Sub
  1344. Sub sw78_Unhit:Controller.Switch(78) = 0:End Sub
  1345.  
  1346.  
  1347.  
  1348. '*********************************************************************
  1349. ' Positional Sound Playback Functions
  1350. '*********************************************************************
  1351.  
  1352. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  1353. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  1354. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  1355. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  1356. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  1357. End Sub
  1358.  
  1359. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  1360. Sub PlaySoundAt(soundname, tableobj)
  1361. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1362. End Sub
  1363.  
  1364. Sub PlaySoundAtBallVol(soundname)
  1365. PlaySound soundname, 1, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1366. End Sub
  1367.  
  1368. Sub PlaySoundAtBall(soundname)
  1369. PlaySoundAt soundname, ActiveBall
  1370. End Sub
  1371.  
  1372. Sub TriggerBallBounce1_UnHit:PlaySound "ball_bounce",0,.08,-0.05,.1:End Sub 'AXS
  1373. Sub TriggerBallBounce2_UnHit:PlaySound "ball_bounce" ,0, .08,0.05,.1:End Sub
  1374. Sub TriggerBallBounce3_UnHit:PlaySound "ball_bounce",0,.06,-0.05,.1:End Sub
  1375. Sub TriggerBallBounce4_UnHit:PlaySound "ball_bounce" ,0, .06,0.05,.1:End Sub
  1376.  
  1377. Sub LRHit1_Hit() : PlaySound "fx_lr1",0,.02,-0.05,.1: End Sub 'AXS
  1378. Sub LRHit2_Hit() : PlaySound "fx_lr2",0,.02,-0.05,.1: End Sub
  1379. Sub LRHit3_Hit() : PlaySound "fx_lr3",0,.02,-0.05,.1: End Sub
  1380. Sub LRHit4_Hit() : PlaySound "fx_lr4",0, .02,0.05,.1 : End Sub
  1381. Sub LRHit5_Hit() : PlaySound "fx_lr5",0, .02,0.05,.1: End Sub
  1382. Sub LRHit6_Hit() : PlaySound "fx_lr6",0, .02,0.05,.1: End Sub
  1383. Sub LRHit7_Hit() : PlaySound "fx_lr7",0,.01,-0.05,.1 : End Sub
  1384.  
  1385. '*********************************************************************
  1386. ' Supporting Ball & Sound Functions
  1387. '*********************************************************************
  1388.  
  1389. 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
  1390. Dim tmp
  1391. tmp = tableobj.y * 2 / table1.height-1
  1392. If tmp > 0 Then
  1393. AudioFade = Csng(tmp ^10)
  1394. Else
  1395. AudioFade = Csng(-((- tmp) ^10) )
  1396. End If
  1397. End Function
  1398.  
  1399. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  1400. Dim tmp
  1401. tmp = tableobj.x * 2 / table1.width-1
  1402. If tmp > 0 Then
  1403. AudioPan = Csng(tmp ^10)
  1404. Else
  1405. AudioPan = Csng(-((- tmp) ^10) )
  1406. End If
  1407. End Function
  1408.  
  1409. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1410. Vol = Csng(BallVel(ball) ^2 / 200)
  1411. End Function
  1412.  
  1413. Function RollVol(ball) ' Calculates the Volume of the sound based on the ball speed. Targets 100-80000 when VolRoll is 0-100
  1414. RollVol = Csng(BallVel(ball) ^2 / (80000 - (79900 * Log(VolRoll) / Log(100))))
  1415. End Function
  1416.  
  1417. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1418. Pitch = BallVel(ball) * 20
  1419. End Function
  1420.  
  1421. Function BallVel(ball) 'Calculates the ball speed
  1422. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1423. End Function
  1424.  
  1425. Sub WireRampSFX_Hit
  1426. Playsound "WireRolling"
  1427. End Sub
  1428.  
  1429.  
  1430. Sub RampDropSFX_Hit
  1431. Playsound "RampDrop"
  1432. End Sub
  1433.  
  1434.  
  1435. '*****************************************
  1436. ' rothbauerw's Manual Ball Control
  1437. '*****************************************
  1438.  
  1439. Dim BCup, BCdown, BCleft, BCright
  1440. Dim ControlBallInPlay, ControlActiveBall
  1441. Dim BCvel, BCyveloffset, BCboostmulti, BCboost
  1442.  
  1443. BCboost = 1 'Do Not Change - default setting
  1444. BCvel = 4 'Controls the speed of the ball movement
  1445. BCyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  1446. BCboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  1447.  
  1448. ControlBallInPlay = false
  1449.  
  1450. Sub StartBallControl_Hit()
  1451. Set ControlActiveBall = ActiveBall
  1452. ControlBallInPlay = true
  1453. End Sub
  1454.  
  1455. Sub StopBallControl_Hit()
  1456. ControlBallInPlay = false
  1457. End Sub
  1458.  
  1459. Sub BallControlTimer_Timer()
  1460. If EnableBallControl and ControlBallInPlay then
  1461. If BCright = 1 Then
  1462. ControlActiveBall.velx = BCvel*BCboost
  1463. ElseIf BCleft = 1 Then
  1464. ControlActiveBall.velx = -BCvel*BCboost
  1465. Else
  1466. ControlActiveBall.velx = 0
  1467. End If
  1468.  
  1469. If BCup = 1 Then
  1470. ControlActiveBall.vely = -BCvel*BCboost
  1471. ElseIf BCdown = 1 Then
  1472. ControlActiveBall.vely = BCvel*BCboost
  1473. Else
  1474. ControlActiveBall.vely = bcyveloffset
  1475. End If
  1476. End If
  1477. End Sub
  1478.  
  1479.  
  1480. '*****************************************
  1481. ' JP's VP10 Rolling Sounds
  1482. '*****************************************
  1483.  
  1484. Const tnob = 5 ' total number of balls
  1485. Const fakeballs = 1
  1486. ReDim rolling(tnob)
  1487. InitRolling
  1488.  
  1489. Sub InitRolling
  1490. Dim i
  1491. For i = 0 to tnob
  1492. rolling(i) = False
  1493. Next
  1494. End Sub
  1495.  
  1496.  
  1497. Sub RollingTimer_Timer()
  1498. if VolRoll = 0 then exit sub
  1499. Dim BOT, b
  1500. BOT = GetBalls
  1501.  
  1502. ' stop the sound of deleted balls
  1503. For b = UBound(BOT) + 1 to tnob-1
  1504. If rolling(b-fakeballs) = True Then
  1505. rolling(b-fakeballs) = False
  1506. StopSound("fx_ballrolling" & b-fakeballs)
  1507. end if
  1508. Next
  1509.  
  1510. ' exit the sub if no balls on the table
  1511. If UBound(BOT) = fakeballs-1 Then Exit Sub
  1512.  
  1513. ' play the rolling sound for each ball
  1514. For b = fakeballs to UBound(BOT)
  1515. If BallVel(BOT(b) ) > 1 Then
  1516. rolling(b-fakeballs) = True
  1517.  
  1518. If BOT(b).z < 30 Then
  1519. PlaySound("fx_ballrolling" & b-fakeballs), -1, RollVol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  1520. Else
  1521. PlaySound("fx_ballrolling" & b-fakeballs), -1, RollVol(BOT(b) )*.2, AudioPan(BOT(b) ), 0, Pitch(BOT(b) )+50000, 1, 0, AudioFade(BOT(b) )
  1522. End If
  1523. Else
  1524. If rolling(b-fakeballs) = True Then
  1525. StopSound("fx_ballrolling" & b-fakeballs)
  1526. rolling(b-fakeballs) = False
  1527. End If
  1528. End If
  1529. Next
  1530. End Sub
  1531.  
  1532.  
  1533.  
  1534. '**********************
  1535. ' Ball Collision Sound
  1536. '**********************
  1537.  
  1538. Sub OnBallBallCollision(ball1, ball2, velocity)
  1539. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 200, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  1540. End Sub
  1541.  
  1542.  
  1543. '*****************************************
  1544. ' ninuzzu's BALL SHADOW
  1545. '*****************************************
  1546. Dim BallShadow
  1547. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  1548.  
  1549. Sub BallShadowUpdate()
  1550. Dim BOT, b
  1551. BOT = GetBalls
  1552. ' hide shadow of deleted balls
  1553. If UBound(BOT)<(tnob-1) Then
  1554. For b = (UBound(BOT) + 1) to (tnob-1)
  1555. BallShadow(b).visible = 0
  1556. Next
  1557. End If
  1558. ' exit the Sub if no balls on the table
  1559. If UBound(BOT) = -1 Then Exit Sub
  1560. ' render the shadow for each ball
  1561. For b = fakeballs to UBound(BOT)
  1562. If BOT(b).X < Table1.Width/2 Then
  1563. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  1564. Else
  1565. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  1566. End If
  1567. ballShadow(b).Y = BOT(b).Y + 12
  1568. If BOT(b).Z > 20 Then
  1569. BallShadow(b).visible = 1
  1570. Else
  1571. BallShadow(b).visible = 0
  1572. End If
  1573. Next
  1574. End Sub
  1575.  
  1576.  
  1577. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  1578.  
  1579. ' Called every 1ms.
  1580. Sub OneMsec_Timer()
  1581. FadeLights.Update1
  1582. End Sub
  1583.  
  1584. ' div lamp subs
  1585.  
  1586.  
  1587. Sub InitLamps()
  1588. dim id, lightobj
  1589.  
  1590. For each lightobj in Lamps
  1591. ' Asumptions: Light is named "LTxxy" where x is the lamp number, and y is optionally a,b,c for multiple on the same id
  1592. dim arr
  1593. id = cInt(mid(lightobj.Name,3, 2))
  1594. if TypeName(FadeLights.Obj(id)) = "NullFadingObject" then
  1595. arr = array(lightobj)
  1596. Else
  1597. arr = FadeLights.Obj(id)
  1598. ReDim Preserve arr(UBound(arr) + 1)
  1599. set arr(UBound(arr)) = lightobj
  1600. end if
  1601. FadeLights.Obj(id) = arr
  1602. next
  1603. FadeLights.Callback(114) = "UpdateDictabird "
  1604. FadeLights.FadeSpeedUp(114) = 1/50 : FadeLights.FadeSpeedDown(114) = 1/50
  1605.  
  1606. FadeLights.Obj(117) = array(FlPf17,Fl17)
  1607. FadeLights.Obj(118) = array(FlPf18,Fl18)
  1608. FadeLights.Obj(119) = array(FlPf19,Fl19)
  1609. FadeLights.Obj(120) = array(FlPf20,Fl20)
  1610. FadeLights.Obj(121) = array(FlPf21,Fl21)
  1611. FadeLights.Obj(122) = array(FlPf22,Fl22)
  1612. FadeLights.Obj(124) = array(FlPf24,Fl24)
  1613. FadeLights.Obj(125) = array(FlPf25,Fl25,DigMillions)
  1614. FadeLights.Obj(128) = array(FlPf28,Fl28)
  1615. End Sub
  1616.  
  1617.  
  1618. Sub AllLampsOff
  1619. Dim x
  1620. For x = 0 to 200
  1621. SetLamp x, 0
  1622. Next
  1623. End Sub
  1624.  
  1625. Sub SetLamp(nr, value)
  1626. ' If the lamp state is not changing, just exit.
  1627. if FadeLights.state(nr) = value then exit sub
  1628.  
  1629. FadeLights.state(nr) = value
  1630. End Sub
  1631.  
  1632.  
  1633. ' *** NFozzy's lamp fade routines ***
  1634.  
  1635.  
  1636. Class NullFadingObject : Public Property Let IntensityScale(input) : : End Property : End Class 'todo do better
  1637.  
  1638. Class LampFader
  1639. Public FadeSpeedDown(140), FadeSpeedUp(140)
  1640. Private Lock(140), Loaded(140), OnOff(140)
  1641. Public UseFunction
  1642. Private cFilter
  1643. Private UseCallback(140), cCallback(140)
  1644. Public Lvl(140), Obj(140)
  1645.  
  1646. Sub Class_Initialize()
  1647. dim x : for x = 0 to uBound(OnOff) 'Set up fade speeds
  1648. if FadeSpeedDown(x) <= 0 then FadeSpeedDown(x) = 1/100 'fade speed down
  1649. if FadeSpeedUp(x) <= 0 then FadeSpeedUp(x) = 1/80'Fade speed up
  1650. UseFunction = False
  1651. lvl(x) = 0
  1652. OnOff(x) = False
  1653. Lock(x) = True : Loaded(x) = False
  1654. Next
  1655.  
  1656. for x = 0 to uBound(OnOff) 'clear out empty obj
  1657. if IsEmpty(obj(x) ) then Set Obj(x) = NullFader' : Loaded(x) = True
  1658. Next
  1659. End Sub
  1660.  
  1661. Public Property Get Locked(idx) : Locked = Lock(idx) : End Property 'debug.print Lampz.Locked(100) 'debug
  1662. Public Property Get state(idx) : state = OnOff(idx) : end Property
  1663. Public Property Let Filter(String) : Set cFilter = GetRef(String) : UseFunction = True : End Property
  1664. Public Property Let Callback(idx, String) : cCallback(idx) = String : UseCallBack(idx) = True : End Property
  1665.  
  1666. Public Property Let state(ByVal idx, input) 'Major update path
  1667. input = cBool(input)
  1668. if OnOff(idx) = Input then : Exit Property : End If 'discard redundant updates
  1669. OnOff(idx) = input
  1670. Lock(idx) = False
  1671. Loaded(idx) = False
  1672. End Property
  1673.  
  1674. Public sub LampMod(ByVal idx, input)
  1675. if Lvl(idx) = input then Exit Sub
  1676. Lvl(idx) = (input * FlasherIntensity) / 25500
  1677. Lock(idx) = True
  1678. Loaded(idx) = False
  1679. End Sub
  1680.  
  1681. Public Sub TurnOnStates() 'If obj contains any light objects, set their states to 1 (Fading is our job!)
  1682. dim debugstr
  1683. dim idx : for idx = 0 to uBound(obj)
  1684. if IsArray(obj(idx)) then
  1685. dim x, tmp : tmp = obj(idx) 'set tmp to array in order to access it
  1686. for x = 0 to uBound(tmp)
  1687. if typename(tmp(x)) = "Light" then DisableState tmp(x) : debugstr = debugstr & tmp(x).name & " state'd" & vbnewline
  1688.  
  1689. Next
  1690. Else
  1691. if typename(obj(idx)) = "Light" then DisableState obj(idx) : debugstr = debugstr & obj(idx).name & " state'd (not array)" & vbnewline
  1692.  
  1693. end if
  1694. Next
  1695. End Sub
  1696. Private Sub DisableState(ByRef aObj) : aObj.FadeSpeedUp = 1000 : aObj.State = 1 : End Sub 'turn state to 1
  1697.  
  1698. Public Sub Update1() 'Handle all boolean numeric fading. If done fading, Lock(True). Update on a '1' interval Timer!
  1699. dim x : for x = 0 to uBound(OnOff)
  1700. if not Lock(x) then 'and not Loaded(x) then
  1701. if OnOff(x) then 'Fade Up
  1702. Lvl(x) = Lvl(x) + FadeSpeedUp(x)
  1703. if Lvl(x) > 1 then Lvl(x) = 1 : Lock(x) = True
  1704. elseif Not OnOff(x) then 'fade down
  1705. Lvl(x) = Lvl(x) - FadeSpeedDown(x)
  1706. if Lvl(x) < 0 then Lvl(x) = 0 : Lock(x) = True
  1707. end if
  1708. end if
  1709. Next
  1710. End Sub
  1711.  
  1712.  
  1713. Public Sub Update() 'Handle object updates. Update on a -1 Timer! If done fading, loaded(x) = True
  1714. dim x,xx : for x = 0 to uBound(OnOff)
  1715. if not Loaded(x) then
  1716. if IsArray(obj(x) ) Then 'if array
  1717. If UseFunction then
  1718. for each xx in obj(x) : xx.IntensityScale = cFilter(Lvl(x)) : Next
  1719. Else
  1720. for each xx in obj(x) : xx.IntensityScale = Lvl(x) : Next
  1721. End If
  1722. else 'if single lamp or flasher
  1723. If UseFunction then
  1724. obj(x).Intensityscale = cFilter(Lvl(x))
  1725. Else
  1726. obj(x).Intensityscale = Lvl(x)
  1727. End If
  1728. end if
  1729. ' Sleazy hack for regional decimal point problem
  1730. If UseCallBack(x) then execute cCallback(x) & " CSng(" & CInt(10000 * Lvl(x)) & " / 10000)" 'Callback
  1731. If Lock(x) Then
  1732. Loaded(x) = True 'finished fading
  1733. end if
  1734. end if
  1735. Next
  1736. End Sub
  1737. End Class
  1738.  
  1739.  
  1740.  
  1741. '************************************
  1742. ' What you need to add to your table
  1743. '************************************
  1744.  
  1745. ' a timer called RollingTimer. With a fast interval, like 10
  1746. ' one collision sound, in this script is called fx_collide
  1747. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  1748. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  1749.  
  1750.  
  1751. '******************************************
  1752. ' Explanation of the rolling sound routine
  1753. '******************************************
  1754.  
  1755. ' sounds are played based on the ball speed and position
  1756.  
  1757. ' the routine checks first for deleted balls and stops the rolling sound.
  1758.  
  1759. ' The For loop goes through all the balls on the table and checks for the ball speed and
  1760. ' if the ball is on the table (height lower than 30) then then it plays the sound
  1761. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  1762.  
  1763. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  1764. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  1765. ' according to the position of the ball on the table.
  1766.  
  1767.  
  1768. '**************************************
  1769. ' Explanation of the collision routine
  1770. '**************************************
  1771.  
  1772. ' The collision is built in VP.
  1773. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  1774. ' 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
  1775. ' depending of the speed of the collision.
  1776.  
  1777.  
  1778. Sub RandomSoundDrain
  1779. dim DrainSnd:DrainSnd= "drain" & CStr(Int(Rnd*4)+1)
  1780. PlaySound DrainSnd, 0, 1, 0, .2
  1781. End Sub
  1782.  
  1783. Sub Pins_Hit (idx)
  1784. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1785. End Sub
  1786.  
  1787. Sub Targets_Hit (idx)
  1788. PlaySoundAtBallVol "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1789. End Sub
  1790.  
  1791. Sub Metals_Thin_Hit (idx)
  1792. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1793. End Sub
  1794.  
  1795. Sub Metals_Medium_Hit (idx)
  1796. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1797. End Sub
  1798.  
  1799. Sub Metals2_Hit (idx)
  1800. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1801. End Sub
  1802.  
  1803. Sub Gates_Hit (idx)
  1804. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1805. End Sub
  1806.  
  1807. Sub Rubbers_Hit(idx)
  1808. dim finalspeed
  1809. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1810. If finalspeed > 20 then
  1811. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1812. End if
  1813. If finalspeed >= 6 AND finalspeed <= 20 then
  1814. RandomSoundRubber()
  1815. End If
  1816. End Sub
  1817.  
  1818. Sub Posts_Hit(idx)
  1819. dim finalspeed
  1820. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1821. If finalspeed > 16 then
  1822. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1823. End if
  1824. If finalspeed >= 6 AND finalspeed <= 16 then
  1825. RandomSoundRubber()
  1826. End If
  1827. End Sub
  1828.  
  1829. Sub RandomSoundRubber()
  1830. Select Case Int(Rnd*3)+1
  1831. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1832. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1833. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1834. End Select
  1835. End Sub
  1836.  
  1837. Sub FlipperLeft_Collide(parm)
  1838. RandomSoundFlipper()
  1839. End Sub
  1840.  
  1841. Sub FlipperRight_Collide(parm)
  1842. RandomSoundFlipper()
  1843. End Sub
  1844.  
  1845. Sub RandomSoundFlipper()
  1846. Select Case Int(Rnd*3)+1
  1847. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1848. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1849. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1850. End Select
  1851. End Sub
  1852.  
  1853. Dim NextOrbitHit:NextOrbitHit = 0
  1854.  
  1855.  
  1856. Sub PlasticRampBump1_Hit
  1857. RandomBump 1, Pitch(ActiveBall)
  1858. End Sub
  1859.  
  1860. Sub PlasticRampBump2_Hit
  1861. RandomBump 1, Pitch(ActiveBall)
  1862. End Sub
  1863.  
  1864. Sub PlasticRampBumps_Hit(idx)
  1865. if BallVel(ActiveBall) > .3 and Timer > NextOrbitHit then
  1866. RandomBump 2, Pitch(ActiveBall)
  1867. ' Schedule the next possible sound time. This prevents it from rapid-firing noises too much.
  1868. ' Lowering these numbers allow more closely-spaced clunks.
  1869. NextOrbitHit = Timer + .1 + (Rnd * .2)
  1870. end if
  1871. End Sub
  1872.  
  1873. Sub MetalWallBumps_Hit(idx)
  1874. if BallVel(ActiveBall) > .3 and Timer > NextOrbitHit then
  1875. RandomBump 1, 20000 'Increased pitch to simulate metal wall
  1876. ' Schedule the next possible sound time. This prevents it from rapid-firing noises too much.
  1877. ' Lowering these numbers allow more closely-spaced clunks.
  1878. NextOrbitHit = Timer + .2 + (Rnd * .2)
  1879. end if
  1880. End Sub
  1881.  
  1882.  
  1883. '' Requires rampbump1 to 7 in Sound Manager
  1884. Sub RandomBump(voladj, freq)
  1885. dim BumpSnd:BumpSnd= "rampbump" & CStr(Int(Rnd*7)+1)
  1886. PlaySound BumpSnd, 0, Vol(ActiveBall)+voladj, AudioPan(ActiveBall), 0, freq, 0, 1, AudioFade(ActiveBall)
  1887. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement