Advertisement
Guest User

WCS VPX Stereo sound

a guest
Jul 15th, 2017
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.30 KB | None | 0 0
  1.  
  2.  
  3. Option Explicit
  4.  
  5.  
  6. Dim cController, ROL, Hidden, DefaultOptions
  7. DefaultOptions = 1*optController + 2*optB2BEnable + 2*optGoalieSpeed
  8.  
  9. Const cGameName = "wcs_l2"
  10.  
  11. Dim FeedbackSounds:FeedbackSounds = Array("ballrel","bumper","diverter","flipperup","flipperdown","knocker","popper","popper_ball","solenoid","target","lsling","solon","jet3")
  12. '*** End Options ***
  13.  
  14. LoadVPM "01530000", "WPC.VBS", 3.10
  15.  
  16.  
  17. Sub LoadVPM(VPMver, VBSfile, VBSver) 'Add new call to InitializeOptions to allow selection of controller through F6 menu
  18. On Error Resume Next
  19. If ScriptEngineMajorVersion < 5 Then MsgBox "VB Script Engine 5.0 or higher required"
  20. ExecuteGlobal GetTextFile(VBSfile)
  21. If Err Then MsgBox "Unable to open " & VBSfile & ". Ensure that it is in the same folder as this table. " & vbNewLine & Err.Description
  22. If VPinMAMEDriverVer < VBSver Or Err Then MsgBox VBSFile & " ver " & VBSver & " or higher required."
  23.  
  24. InitializeOptions 'Enables New Controller change through F6 menu, so it needs to be placed before Controller selection
  25.  
  26. Select Case cController
  27. Case 1:
  28. Set Controller = CreateObject("VPinMAME.Controller")
  29. If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description
  30. If VPMver>"" Then If Controller.Version < VPMver Or Err Then MsgBox "VPinMAME ver " & VPMver & " required."
  31. Case 2:
  32. Set Controller = CreateObject("UltraVP.BackglassServ")
  33. Case 3:
  34. Set Controller = CreateObject("B2S.Server")
  35. End Select
  36. If Err then
  37. msgbox "Invalid controller selected, defaulting to VPinMame"
  38. Set controller = CreateObject("VPinMAME.Controller")
  39. End If
  40. On Error Goto 0
  41. End Sub
  42.  
  43. Const UseSolenoids = True
  44. Const UseLamps = False
  45. Const UseSync = True
  46. Const UseGI = True
  47. '******GI CALL********'
  48. Dim LeftGIs, RightGIs, UpGIs
  49. Dim GILevels
  50. ' InitGI
  51. 'Set GiCallback2 = GetRef("UpdateGI2")
  52. Set GICallback = GetRef("UpdateGI")
  53. 'Set MotorCallback = GetRef("UpdateFlipperLogos")
  54. ' Standard Sounds used by Driver help code
  55. 'Const SSolenoidOn = "SolOn"
  56. 'Const SSolenoidOff = "SolOff"
  57. Const SFlipperOn = "FlipperUp"
  58. Const SFlipperOff = "FlipperDown"
  59. Const SCoin="Coin"
  60.  
  61. '--------------------------------
  62. ' Init the table, Start VPinMAME
  63. '--------------------------------
  64. Dim bsTrough, bsLock, bsLeftEject, bsRightEject, bsLeft, bsRight, bsUpper, bsGoal, bsVUK, bsTV
  65. Dim ttBall,mGoalie,mBall,vlLock, LockMagnetSave, MagnaGoalie, plungerIM, x
  66. Dim BallRel, SolOn, Popper
  67. Dim RefreshARlight:RefreshARlight=False
  68. Sub TableWPC94_Init
  69. vpmInit me
  70. On Error Resume Next
  71. With Controller
  72. .GameName = cGameName
  73. .Games(cGameName).Settings.Value("rol") = ROL 'Set through the F6 menu
  74. .Hidden = HIDDEN 'Set through the F6 menu
  75. .SplashInfoLine = "World Cup Soccer 94, Bally 1994"
  76. .HandleMechanics = 0
  77. .HandleKeyboard = False
  78. .ShowDMDOnly = True : .ShowFrame = False : .ShowTitle = False
  79. .Run : If Err Then MsgBox Err.Description : Exit Sub
  80. End With
  81. On Error Goto 0 'Create Controller Object, and read in options
  82.  
  83. vpmNudge.TiltSwitch = swTilt
  84. vpmNudge.Sensitivity = 5
  85.  
  86. ' Main Timer init
  87. PinMAMETimer.Interval = PinMAMEInterval
  88. PinMAMETimer.Enabled = true
  89.  
  90. 'Impulse Plunger
  91. '--------------------
  92. Set plungerIM = New cvpmImpulseP
  93. With plungerIM
  94. .InitImpulseP swPlunger, IMPowerSetting, IMTime
  95. .Random IMScatter
  96. .InitEntrySnd "PlungerPull"
  97. .InitExitSnd "plunger2", "plunger"
  98. .CreateEvents "plungerIM"
  99. End With
  100.  
  101. '------------------------------
  102. ' Set Up Ballstacks and init info
  103. '------------------------------
  104. Set bsTrough = new cvpmBallStack
  105. bsTrough.InitSw 0,31,32,33,34,35,0,0
  106. bsTrough.InitKick BallRelease,40,8
  107. bsTrough.Balls = 5
  108. bsTrough.InitExitSnd BallRel,SolOn
  109.  
  110. Set bsLeft = New cvpmBallStack
  111. bsLeft.InitSaucer LeftEjectHole, swLeftEjectHole,150,7
  112. bsLeft.InitExitSnd BallRel,SolOn
  113.  
  114. Set bsRight = New cvpmBallStack
  115. bsRight.InitSaucer RightEjectHole, swRightEjectHole,210,8
  116. bsRight.InitExitSnd BallRel,SolOn
  117.  
  118. Set bsUpper = New cvpmBallStack
  119. bsUpper.InitSaucer UpperEjectHole, swUpperEjectHole,10,18
  120. ' bsupper.kickZ = 3.1415926/4
  121. bsupper.InitExitSnd BallRel,SolOn
  122.  
  123. Set bsTV = New cvpmBallStack
  124. bsTV.InitSw 0,swTVBallPopper,0,0,0,0,0,0
  125. bsTV.InitKick TVBallPopper, 213, 10
  126. bsTV.KickBalls = 2
  127. bsTV.InitExitSnd Popper,SolOn
  128.  
  129. Set bsGoal = New cvpmBallStack
  130. bsGoal.InitSw 0,swGoalTrough,0,0,0,0,0,0
  131. bsGoal.InitExitSnd Popper,SolOn
  132.  
  133. Set bsVUK = New cvpmBallStack
  134. bsVUK.InitSw 0,swGoalPopperOpto,0,0,0,0,0,0
  135. bsVUK.InitKick VUKKicker,146, 30 'ORIGINALE 146, 13
  136. bsVUK.KickZ = Pi/2
  137. bsVUK.InitExitSnd Popper,SolOn
  138.  
  139.  
  140. 'Setup magnets
  141. Set LockMagnetSave = New cvpmMagnet : With LockMagnetSave
  142. .InitMagnet LockMagnet, 20
  143. .Solenoid = sLockMagnet
  144. .CreateEvents "LockMagnetSave"
  145. End With
  146. Set MagnaGoalie = New cvpmMagnet : With MagnaGoalie
  147. .InitMagnet TrgMagnaGoalie, 50 'pretty weak orig at 15 testing
  148. .Solenoid = sMagnaGoalie
  149. .GrabCenter = True
  150. .CreateEvents "MagnaGoalie"
  151. End With
  152.  
  153. ' Visible Lock
  154. Set vlLock = New cvpmVLock : With vlLock
  155. .InitVLock Array(LockMechLow, LockMechHigh), Array(LockKickLow, LockKickHigh), Array(swLockMechLow, swLockMechHigh)
  156. .CreateEvents "vlLock"
  157. End With
  158.  
  159. ' Spinning ball
  160. Set ttBall = New cvpmturnTable : With ttBall
  161. .InitTurnTable BallTrigger, 100
  162. .SpinUp = 0 : .SpinDown = 0
  163. .CreateEvents "ttBall"
  164. End With
  165.  
  166. ' Mechs
  167. Set mGoalie = new cvpmMech : With mGoalie
  168. .Sol1 = sGoalieDrive
  169. .MType = vpmMechLinear + vpmMechReverse + vpmMechOneSol' + vpmMechFast
  170. .Length = GoalieSpeed
  171. .Steps = 320
  172. .AddSw swGoalIsLeft, 0, 8
  173. .AddSw swGoalIsRight, 152,168
  174. .AddSw swGoalIsLeft, 312, 320
  175. .Callback = GetRef("DrawGoalie")
  176. .Start
  177. End With
  178.  
  179. Set mBall = new cvpmMech : With mBall
  180. .Sol1 = sBallClockwise : .Sol2 = sBallCounterCW
  181. .MType = vpmMechLinear + vpmMechCircle + vpmMechTwoDirSol
  182. .Acc = 60 : .Ret = 2
  183. .Length = 12
  184. .Steps = 24
  185. .Callback = GetRef("UpdateBall")
  186. .Start
  187. End With
  188.  
  189. Set MotorCallback = GetRef("UpdateFlipperLogos")
  190.  
  191. GWall0.isdropped=1
  192. GWall1.isdropped=1
  193. GWall2.isdropped=1
  194. GWall3.isdropped=1
  195. GWall4.isdropped=1
  196. GWall5.isdropped=1
  197. GWall6.isdropped=1
  198. GWall7.isdropped=1
  199. GWall8.isdropped=1
  200. GWall9.isdropped=1
  201. GWall10.isdropped=1
  202. GWall11.isdropped=1
  203. GWall12.isdropped=1
  204. GWall13.isdropped=1
  205. GWall14.isdropped=1
  206. GWall15.isdropped=1
  207. GWall16.isdropped=1
  208. GWall17.isdropped=1
  209. GWall18.isdropped=1
  210. GWall19.isdropped=1
  211. GWall20.isdropped=1
  212. Controller.Switch(swCoinDoor) = 1
  213. End Sub
  214.  
  215. '-------------------
  216. ' keyboard routines
  217. '-------------------
  218. 'ExtraKeyHelp = KeyName(keyFront) & vbTab & "Buy-in Button" & vbNewLine &_
  219. ' KeyName(keyUpperLeft) & vbTab & "Magna Goalie"
  220.  
  221. Sub TableWPC94_KeyUp(ByVal keycode)
  222. If keycode = PlungerKey Then
  223. Plunger.Fire
  224. StopSound "PlungerPull"
  225. PlaySound "plunger"',0,1,0.25,0.25 (TOLTO)
  226. End If
  227. If (keycode = rightmagnasave or KeyCode = 3) Then Controller.Switch(swBuyInButton) = False
  228. If KeyCode = leftmagnasave Then Controller.Switch(swMagGoalieButton) = False
  229. If KeyUpHandler(keycode) Then Exit Sub
  230. End Sub
  231.  
  232. Sub TableWPC94_KeyDown(ByVal keycode)
  233. If keycode = PlungerKey Then
  234. Plunger.PullBack
  235. PlaySound "PlungerPull"',0,1,0.25,0.25 (TOLTO)
  236. End If
  237. If (keycode = rightmagnasave or KeyCode = 3) Then Controller.Switch(swBuyInButton) = True
  238. If KeyCode = leftmagnasave Then Controller.Switch(swMagGoalieButton) = True
  239. If KeyDownHandler(keycode) Then Exit Sub
  240. End Sub
  241.  
  242. ' Koadic's Alpha Ramp
  243. ' Impulse Plunger Scripting v6
  244. ' single ramp animated
  245. ' via image switching
  246. '------------------------------
  247. Dim PDelay, PCount, PImages, PStart, IMTime, IMPowerSetting, PlFrame, IMScatter
  248.  
  249. IMPowerSetting = Plunger.MechStrength ' Plunger Power - Set via Plunger MechStrength
  250. IMTime = Round(Plunger.PullSpeed/10, 2)' Time in 1/10th seconds for Full Plunge - Set via Plunger Pull Speed...
  251. ' 1 = .1 second, 5 = .5 second, 10 = 1 second, etc.
  252. IMScatter = Plunger.ScatterVelocity ' Plunger Scatter Velocity - Percentage of variation in Plunger Power
  253. ' Setting Scatter Velocity to 10 = 10%, if Power is 50, max plunge will vary from 47.5 to 52.5 (+/- 5%)
  254. PStart = 0 ' Set number of first plunger image, use 1 for legacy "1-12" setup
  255. PImages = 25 ' Set number of animation frames not including the PStart position, use 11 for legacy "1-12" setup
  256. PTime.Interval = INT(IMTime*1000/PImages)
  257.  
  258. PDelay = CINT(Plunger.FireSpeed/Plunger.TimerInterval)
  259. ReDim PlPos(PDelay)
  260.  
  261. Sub PTime2_Timer
  262. Select Case PCount
  263. Case 0:aPlunger.Image = "p" & PStart : PRefresh.state = ABS(PRefresh.state - 1)
  264. Case 1:aPlunger.Image = "p" & INT(PImages/5) : PRefresh.state = ABS(PRefresh.state - 1)
  265. Case 2:ResetPlungers:Plunger.TimerEnabled = 1:Me.Enabled = 0
  266. End Select
  267. Pcount = Pcount + 1
  268. End Sub
  269.  
  270. Sub Plunger_Timer()
  271. PlPos(PDelay) = Plunger.Position
  272. PlFrame = PlPos(PDelay)
  273. If PlPos(PDelay) <> PlPos(PDelay - 1) Then
  274. aPlunger.Image = "p" & PlFrame
  275. PRefresh.state = ABS(PRefresh.state - 1)
  276. If PlPos(PDelay) < 2 and PlPos(0) > 5 Then
  277. PlungerIM.Strength = (PlPos(0)/25*Plunger.MechStrength)
  278. PlungerIM.AutoFire
  279. PlungerIM.Strength = Plunger.MechStrength
  280. Plunger.TimerEnabled = 0:PTime2.Enabled = 1
  281. End If
  282. End If
  283. For x = 0 to ubound(PlPos)-1:PlPos(x)=PlPos(x+1):Next
  284. End Sub
  285.  
  286. '----------------
  287. ' Goalie Mech
  288. '----------------
  289. Dim GoalieWalls, GIWalls
  290. GoalieWalls = Array(GWall0, GWall1, GWall2, GWall3, GWall4, GWall5, GWall6, GWall7, GWall8, GWall9, GWall10, GWall11, GWall12, GWall13, GWall14, GWall15, GWall16, GWall17, GWall18, GWall19, GWall20)
  291.  
  292.  
  293.  
  294. Sub DrawGoalie(aCurrPos,aSpeed,aLast)
  295. GoalieWalls(Int(160-ABS(aLast-160))/8).IsDropped = True
  296. GoalieWalls(INT(160-ABS(aCurrPos-160))/8).IsDropped = False
  297. Goalie.roty = dSin((80 - ABS(160-aCurrPos)) * (9/8)) * 10
  298. End Sub
  299.  
  300. Sub UpdateBall(aCurrPos,aSpeed,aLast)
  301. ttBall.MotorOn = aSpeed <> 0
  302. ttBall.Speed = aSpeed
  303. SoccerBall.rotz = SoccerBall.rotz + aSpeed/1.5
  304. 'SoccerBall.TriggerSingleUpdate
  305. End Sub
  306.  
  307.  
  308.  
  309.  
  310. '--------------------------
  311. ' Goal & VUK handling
  312. '--------------------------
  313. Sub HandleGoalTrough(swNo)
  314. bsGoal.AddBall 0
  315. If bsVUK.Balls = 0 Then vpmTimer.AddTimer 100, "ExitGoal"
  316. End Sub
  317.  
  318. Sub ExitGoal(swNo)
  319. If bsVUK.Balls = 0 And bsGoal.Balls > 0 Then
  320. bsGoal.SolOut True : bsVUK.AddBall 0
  321. End If
  322. End Sub
  323.  
  324. Sub SolVUK(aEnabled)
  325. if aEnabled Then bsVUK.SolOut True : ExitGoal 0
  326. End Sub
  327.  
  328. '------------------------
  329. ' Lock
  330. '------------------------
  331. Sub MagnaLock_Hit : Me.Enabled = False : End Sub
  332. Sub SolMagnaLock(aEnabled)
  333. MagnaLock.Enabled = aEnabled
  334. If Not aEnabled Then MagnaLock.Kick 195,1
  335. End Sub
  336.  
  337. Sub Solenoide_Hit
  338. Playsound "Magnete"
  339. End Sub
  340.  
  341. '----------------------------
  342. ' Kicker Switches
  343. '----------------------------
  344. Sub UpperEjectHole_Hit : bsUpper.AddBall Me : Playsound "EnterHole" : End Sub
  345. Sub UpperEjectHole_UnHit : Playsound "ExitKicher": End Sub
  346. Sub RightEjectHole_Hit : bsRight.AddBall Me : Playsound "EnterHole" : End Sub
  347. Sub RightEjectHole_UnHit : Playsound "ExitKicher": End Sub
  348. Sub LeftEjectHole_Hit : bsLeft.AddBall Me : Playsound "EnterHole" : End Sub
  349. Sub LeftEjectHole_UnHit : Playsound "ExitKicher": End Sub
  350. Sub TVBallPopper_Hit : StopRollingSound: ClearBallid : bsTV.AddBall Me : vpPlay "kicker_enter", TVBallPopper : End Sub
  351. Sub GoalPopperOpto_Hit : StopRollingSound: ClearBallid :bsVUK.AddBall Me : vpPlay "kicker_enter", GoalPopperOpto : End Sub
  352. Sub Drain_Hit : StopRollingSound: ClearBallid : bsTrough.AddBall Me : StopRollingSound: vpPlay "Drain",Drain : Playsound "drain":End Sub
  353. Sub GoalTrough1_Hit : vpPlay "GoalEnter", ActiveBall : ClearBallid : Me.DestroyBall : vpmTimer.AddTimer 110,"HandleGoalTrough" : End Sub
  354. Sub GoalTrough2_Hit : vpPlay "GoalEnter", ActiveBall : ClearBallid : Me.DestroyBall : vpmTimer.AddTimer 90,"HandleGoalTrough" : End Sub
  355. Sub GoalTrough3_Hit : vpPlay "GoalEnter", ActiveBall : ClearBallid : Me.DestroyBall : vpmTimer.AddTimer 70,"HandleGoalTrough" : End Sub
  356. Sub GoalTrough4_Hit : vpPlay "GoalEnter", ActiveBall : ClearBallid : Me.DestroyBall : vpmTimer.AddTimer 50,"HandleGoalTrough" : End Sub
  357. Sub GoalTrough5_Hit : vpPlay "GoalEnter", ActiveBall : ClearBallid : Me.DestroyBall : vpmTimer.AddTimer 30,"HandleGoalTrough" : End Sub
  358. Sub GoalTrough6_Hit : vpPlay "GoalEnter", ActiveBall : ClearBallid : Me.DestroyBall : vpmTimer.AddTimer 10,"HandleGoalTrough" : End Sub
  359.  
  360. '-----------------------------------
  361. 'Switch Routines
  362. '-----------------------------------
  363. Sub BallShooter_Hit : Controller.Switch(swBallShooter) = true : End Sub
  364. Sub BallShooter_Unhit : Controller.Switch(swBallShooter) = false : End Sub
  365. Sub SkillShotFront_Hit : vpPlay "DropRamp", SkillShotFront :vpmTimer.PulseSw swSkillShotFront : End Sub
  366. Sub SkillShotCenter_Hit : vpPlay "DropRamp", SkillShotCenter :vpmTimer.PulseSw swSkillShotCenter : End Sub
  367. Sub SkillShotRear_Hit : vpPlay "DropRamp", SkillShotRear :vpmTimer.PulseSw swSkillShotRear : End Sub
  368.  
  369.  
  370. Sub RightOutLane_Hit() ' Kickback
  371. 'RightOutLane_a.IsDropped = 0
  372. Controller.Switch(swRightOutLane) = 1
  373. vpPlay "sensor", RightOutLane
  374. End Sub
  375. Sub RightOutLane_Unhit()
  376. 'RightOutLane_a.IsDropped = 1
  377. Controller.Switch(swRightOutLane) = 0
  378. End Sub
  379.  
  380. Sub RightFlipperLane_Hit() ' Kickback
  381. 'RightFlipperLane_a.IsDropped = 0
  382. Controller.Switch(swRightFlipperLane) = 1
  383. vpPlay "sensor", RightFlipperLane
  384. End Sub
  385. Sub RightFlipperLane_Unhit()
  386. 'RightFlipperLane_a.IsDropped = 1
  387. Controller.Switch(swRightFlipperLane) = 0
  388. End Sub
  389.  
  390. Sub LeftFlipperLane_Hit() ' Kickback
  391. 'LeftFlipperLane_a.IsDropped = 0
  392. Controller.Switch(swLeftFlipperLane) = 1
  393. vpPlay "sensor", LeftFlipperLane
  394. End Sub
  395. Sub LeftFlipperLane_Unhit()
  396. 'LeftFlipperLane_a.IsDropped = 1
  397. Controller.Switch(swLeftFlipperLane) = 0
  398. End Sub
  399.  
  400. Sub Kickback_Hit() ' Kickback
  401. 'Kickback_a.IsDropped = 0
  402. Controller.Switch(swKickback) = 1
  403. vpPlay "sensor", Kickback
  404. End Sub
  405. Sub Kickback_UnHit()
  406. 'Kickback_a.IsDropped = 1
  407. Controller.Switch(swKickback) = 0
  408. End Sub
  409.  
  410.  
  411. 'Sub Kickback_Hit : Controller.Switch(swKickback) = true : End Sub
  412. 'Sub Kickback_Unhit : Controller.Switch(swKickback) = false : End Sub
  413. 'Sub LightMagGoalie_Hit:LightMagGoalie.IsDropped = TRUE:LightMagGoaliea.IsDropped = FALSE:Me.TimerEnabled = 1:vpmTimer.PulseSw (swLightMagGoalie):vpPlay "target":End Sub
  414. 'Sub LightMagGoalie_Timer:LightMagGoalie.IsDropped = FALSE:LightMagGoaliea.IsDropped = TRUE:Me.TimerEnabled = 0:End Sub
  415. Sub LightMagGoalie_Hit : vpmTimer.PulseSw swLightMagGoalie : End Sub
  416. 'Sub LightKickback_Hit:LightKickback.IsDropped = TRUE:LightKickbacka.IsDropped = FALSE:Me.TimerEnabled = 1:vpmTimer.PulseSw (swLightKickback):vpPlay "target":End Sub
  417. 'Sub LightKickback_Timer:LightKickback.IsDropped = FALSE:LightKickbacka.IsDropped = TRUE:Me.TimerEnabled = 0:End Sub
  418. Sub LightKickback_Hit : vpmTimer.PulseSw swLightKickback : End Sub
  419. Sub Spinner1_Spin : vpmTimer.PulseSw swSpinner : vpPlay "spinner", Spinner1 : End Sub
  420. Sub LeftSlingshot_Slingshot : vpmTimer.PulseSw swLeftSlingshot:vpPlay "SlingshotSinistro", Sling1 : End Sub
  421. Sub RightSlingshot_Slingshot: vpmTimer.PulseSw swRightSlingshot:vpPlay "SlingshotDestro", Sling2 : End Sub
  422. Sub LeftJetBumper_Hit : vpmTimer.PulseSw swLeftJetBumper :vpPlay "BumperSinistro", LeftJetBumper : End Sub
  423. Sub UpperJetBumper_Hit : vpmTimer.PulseSw swUpperJetBumper:vpPlay "BumperDestro", UpperJetBumper : End Sub
  424. Sub LowerJetBumper_Hit : vpmTimer.PulseSw swLowerJetBumper:vpPlay "BumperCentrale", LowerJetBumper : End Sub
  425. 'Sub UpperLeftLane_Hit : Controller.Switch(swUpperLeftLane) = true : End Sub
  426. 'Sub UpperLeftLane_Unhit : Controller.Switch(swUpperLeftLane) = false : End Sub
  427. 'Sub UpperRightLane_Hit : Controller.Switch(swUpperRightLane) = true : End Sub
  428. 'Sub UpperRightLane_Unhit : Controller.Switch(swUpperRightLane) = false : End Sub
  429. 'Sub FreeKickTarget_Hit:FreeKickTarget.IsDropped = TRUE:FreeKickTargeta.IsDropped = FALSE:Me.TimerEnabled = 1:vpmTimer.PulseSw (swFreeKickTarget):vpPlay "target":End Sub
  430. 'Sub FreeKickTarget_Timer:FreeKickTarget.IsDropped = FALSE:FreeKickTargeta.IsDropped = TRUE:Me.TimerEnabled = 0:End Sub
  431. Sub FreeKickTarget_Hit : vpmTimer.PulseSw swFreeKickTarget : End Sub
  432. 'Sub KickbackUpper_Hit : vpmTimer.PulseSw swKickbackUpper : End Sub
  433. Sub UpperLeftLane_Hit() ' Kickback
  434. 'UpperLeftLane_a.IsDropped = 0
  435. Controller.Switch(swUpperLeftLane) = 1
  436. vpPlay "sensor", UpperLeftLane
  437. End Sub
  438.  
  439. '************************************************
  440. '************Slingshots Animation****************
  441. '************************************************
  442.  
  443. Dim RStep, Lstep
  444.  
  445. 'Sub LeftSlingShot_Slingshot: vpmTimer.PulseSw 26: End Sub
  446. 'Sub RightSlingShot_Slingshot: vpmTimer.PulseSw 27: End Sub
  447.  
  448. Sub solLSling(enabled)
  449. If enabled then
  450. 'PlaySound SoundFX ("SlingshotSinistro",DOFContactors)
  451. LSling.Visible = 0
  452. LSling1.Visible = 1
  453. sling1.TransZ = -27
  454. LStep = 0
  455. LeftSlingShot.TimerEnabled = 1
  456. End If
  457. End Sub
  458.  
  459. Sub solRSling(enabled)
  460. If enabled then
  461. 'PlaySound SoundFX ("SlingshotDestro",DOFContactors)
  462. RSling.Visible = 0
  463. RSling1.Visible = 1
  464. sling2.TransZ = -27
  465. RStep = 0
  466. RightSlingShot.TimerEnabled = 1
  467. End If
  468. End Sub
  469.  
  470. Sub LeftSlingShot_Timer
  471. Select Case LStep
  472. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling1.TransZ = -15
  473. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling1.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  474. End Select
  475. LStep = LStep + 1
  476. End Sub
  477.  
  478. Sub RightSlingShot_Timer
  479. Select Case RStep
  480. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling2.TransZ = -15
  481. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling2.TransZ = 0:RightSlingShot.TimerEnabled = 0
  482. End Select
  483. RStep = RStep + 1
  484. End Sub
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494. Sub UpperLeftLane_UnHit()
  495. 'UpperLeftLane_a.IsDropped = 1
  496. Controller.Switch(swUpperLeftLane) = 0
  497. End Sub
  498.  
  499. Sub UpperRightLane_Hit() ' Kickback
  500. 'UpperRightLane_a.IsDropped = 0
  501. Controller.Switch(swUpperRightLane) = 1
  502. vpPlay "sensor", UpperRightLane
  503. End Sub
  504. Sub UpperRightLane_UnHit()
  505. 'UpperRightLane_a.IsDropped = 1
  506. Controller.Switch(swUpperRightLane) = 0
  507. End Sub
  508.  
  509. Sub KickbackUpper_Hit() ' Kickback
  510. 'KickbackUpper_a.IsDropped = 0
  511. Controller.Switch(swKickbackUpper) = 1
  512. vpPlay "sensor", KickbackUpper
  513. End Sub
  514. Sub KickbackUpper_UnHit()
  515. 'KickbackUpper_a.IsDropped = 1
  516. Controller.Switch(swKickbackUpper) = 0
  517. End Sub
  518.  
  519.  
  520. Sub Rollover1_Hit : Controller.Switch(swRollover1) = true : End Sub
  521. Sub Rollover1_Unhit : Controller.Switch(swRollover1) = false : End Sub
  522. Sub Rollover2_Hit : Controller.Switch(swRollover2) = true : End Sub
  523. Sub Rollover2_Unhit : Controller.Switch(swRollover2) = false : End Sub
  524. Sub Rollover3_Hit : Controller.Switch(swRollover3) = true : End Sub
  525. Sub Rollover3_Unhit : Controller.Switch(swRollover3) = false : End Sub
  526. Sub Rollover4_Hit : Controller.Switch(swRollover4) = true : End Sub
  527. Sub Rollover4_Unhit : Controller.Switch(swRollover4) = false : End Sub
  528. Sub Striker1_Hit : vpmTimer.PulseSw swStriker1 : Playsound "target" : End Sub
  529. Sub Striker2_Hit : vpmTimer.PulseSw swStriker2: Playsound "target" : End Sub
  530. Sub Striker3High_Hit : vpmTimer.PulseSw swStriker3High : Playsound "target" : End Sub
  531. Sub LeftRampEntrance_Hit : Controller.Switch(swLeftRampEntrance) = true : vpPlay "gate", LeftRampEntrance : End Sub
  532. Sub LeftRampEntrance_Unhit : Controller.Switch(swLeftRampEntrance) = false : RampaSinistra : End Sub
  533. Sub LeftRampExit_Hit : Controller.Switch(swLeftRampExit) = true : End Sub
  534. Sub LeftRampExit_Unhit : Controller.Switch(swLeftRampExit) = false : End Sub
  535. Sub RightRampEntrance_Hit : Controller.Switch(swRightRampEntrance) = true : vpPlay "gate", RightRampEntrance : End Sub
  536. Sub RightRampEntrance_Unhit : Controller.Switch(swRightRampEntrance) = false : RampaDestra : End Sub
  537. Sub RightRampExit_Hit : Controller.Switch(swRightRampExit) = true : End Sub
  538. Sub RightRampExit_Unhit : Controller.Switch(swRightRampExit) = false : End Sub
  539.  
  540. 'Sub TravelLaneRolo_Hit : Controller.Switch(swTravelLaneRolo) = true : End Sub
  541. 'Sub TravelLaneRolo_Unhit : Controller.Switch(swTravelLaneRolo) = false : End Sub
  542.  
  543. Sub TravelLaneRolo_Hit() ' Kickback
  544. 'TravelLaneRolo_a.IsDropped = 0
  545. Controller.Switch(swTravelLaneRolo) = 1
  546. vpPlay "sensor", TravelLaneRolo
  547. End Sub
  548. Sub TravelLaneRolo_Unhit()
  549. 'TravelLaneRolo_a.IsDropped = 1
  550. Controller.Switch(swTravelLaneRolo) = 0
  551. End Sub
  552.  
  553. Sub RampaSinistra
  554. If ActiveBall.velY < 0 Then
  555. PlaySound "EntrataRampa"
  556. Playsound "plasticrolling"
  557. Else
  558. StopSound "rrenter"
  559. StopSound "plasticrolling"
  560. End If
  561. End Sub
  562.  
  563. Sub RampaDestra
  564. If ActiveBall.velY < 0 Then
  565. PlaySound "EntrataRampa"
  566. Playsound "plasticrolling"
  567. Else
  568. StopSound "EntrataRampa"
  569. StopSound "plasticrolling"
  570. End If
  571. End Sub
  572.  
  573.  
  574.  
  575. Sub TackleSwitch_Hit : vpmTimer.PulseSw swTackleSwitch : End Sub
  576. Sub LeftRampDiverter_Hit : Controller.Switch(swLeftRampDiverter) = true : End Sub
  577. Sub LeftRampDiverter_Unhit : Controller.Switch(swLeftRampDiverter) = false : End Sub
  578. Sub TroughStack_Hit : Controller.Switch(swTroughStack) = true : End Sub
  579. Sub TroughStack_Unhit : Controller.Switch(swTroughStack) = false : Playsound "ballrelease":End Sub
  580.  
  581. Sub GWalls_hit(idx):vpmTimer.PulseSw swGoalieTarget:vpPlay "target", ActiveBall:Goalie.rotx=1.5:GoalieHit.enabled=1:End Sub
  582.  
  583. Sub GoalieHit_Timer
  584. If me.uservalue = "" Then me.uservalue = 0
  585. Select Case me.uservalue
  586. Case 0 : Goalie.rotx = 1:me.uservalue=me.uservalue+1
  587. Case 1 : Goalie.rotx = 0.5:me.uservalue=me.uservalue+1
  588. Case 2 : Goalie.rotx = 0:Me.uservalue = 0:Me.enabled = 0:Exit Sub
  589. End Select
  590. End Sub
  591.  
  592. Dim SkillVelY
  593.  
  594. Sub SkillVelTrig_Hit()
  595. SkillVelY = ActiveBall.VelY
  596. End Sub
  597.  
  598. '-----------------------------------
  599. 'Map Solenoid Subroutines
  600. '-----------------------------------
  601.  
  602. SolCallback(12) = "solLSling"
  603. SolCallback(13) = "solRSling"
  604.  
  605.  
  606. SolCallback(sLRFlipper) = "SolRFlipper"
  607. SolCallback(sLLFlipper) = "SolLFlipper"
  608. SolCallback(sDiverterHold) = "SolRampDiverter"
  609. SolCallback(sLoopGate) = "vpmSolGate LoopGate1,False,"
  610. SolCallback(sKickback) = "SolKickBack"
  611. SolCallback(sLockRelease) = "SolLockRelease"
  612. 'SolCallback(sLockMagnet) = "SolMagnaLock"
  613. SolCallback(sKnocker) = "SolKnocker"
  614. SolCallback(sGoalPopper) = "SolVUK"
  615. SolCallback(sUpperEjectHole) = "bsUpper.SolOut"
  616. SolCallback(sRightEjectHole) = "bsRight.SolOut"
  617. SolCallback(sLeftEjectHole) = "bsLeft.SolOut"
  618. SolCallback(sTrough) = "bsTrough.SolOut"
  619. SolCallback(sTVPopper) = "bsTV.SolOut"
  620. SolCallBack(sLtRampEntrance) = "SetLamp 125,"
  621. SolCallBack(sSpinningBall) = "SetLamp 122,"
  622. SolCallback(sFlipperLanes) = "SetLamp 127,"
  623. 'SolCallback(sJetBumpers) = "Sol20"
  624. 'SolCallback(sGoal) = "Sol18"
  625. SolCallback(sRampRear) = "SetLamp 128,"
  626. SolCallback(sLockArea) = "SetLamp 126,"
  627. SolCallback(sGoalCageTop) = "SetLamp 117,"
  628. SolCallback(sSkillshot) = "SetLamp 119,"
  629.  
  630. Sub SolKnocker(Enabled)
  631. If Enabled Then vpPlay "Knocker", L83
  632. End Sub
  633.  
  634.  
  635. ' Solenoids | Status
  636. '-----------------------------------------
  637. Const sGoalPopper = 1 'installed
  638. Const sTVPopper = 2 'installed
  639. Const sKickback = 3 'installed
  640. Const sLockRelease = 4 'installed
  641. Const sUpperEjectHole = 5 'installed
  642. Const sTrough = 6 'installed
  643. Const sKnocker = 7 'installed
  644. Const sRampDiverter = 8 'taken care of with Sol 16
  645. Const sLeftJetBumper = 9 'handled by VP
  646. Const sUpperJetBumper = 10 'handled by VP
  647. Const sLowerJetBumper = 11 'handled by VP
  648. 'Const sLeftSlingshot = 12 'handled by VP
  649. 'Const sRightSlingshot = 13 'handled by VP
  650. Const sRightEjectHole = 14 'installed
  651. Const sLeftEjectHole = 15 'installed
  652. Const sDiverterHold = 16 'installed
  653. Const sGoalCageTop = 17 ' flasher - installed
  654. Const sGoal = 18 ' flasher - installed
  655. Const sSkillshot = 19 ' flasher - installed
  656. Const sJetBumpers = 20 ' flasher - installed
  657. Const sGoalieDrive = 21 'installed
  658. Const sSpinningBall = 22 ' flasher
  659. Const sBallClockwise = 23 'Spin the Ball
  660. Const sBallCounterCW = 24 'Spin the Ball
  661. Const sLtRampEntrance = 25 ' flasher
  662. Const sLockArea = 26 ' flasher - installed
  663. Const sFlipperLanes = 27 ' flasher
  664. Const sRampRear = 28 ' flasher - installed
  665. Const sMagnaGoalie = 33 'installed
  666. Const sLoopGate = 34 'installed
  667. Const sLockMagnet = 35 'installed - needs a little fine tuning
  668.  
  669.  
  670.  
  671. '**************
  672. ' Flipper Subs
  673. '**************
  674.  
  675. Sub SolLFlipper(Enabled)
  676. If Enabled Then
  677. vpPlay "FlipperSu", LeftFlipper:LeftFlipper.RotateToEnd
  678.  
  679. Else
  680. vpPlay "FlipperGiu", LeftFlipper:LeftFlipper.RotateToStart
  681. End If
  682. End Sub
  683.  
  684. Sub SolRFlipper(Enabled)
  685. If Enabled Then
  686. vpPlay "FlipperSu", RightFlipper:RightFlipper.RotateToEnd
  687. Else
  688. vpPlay "FlipperGiu", RightFlipper:RightFlipper.RotateToStart
  689. End If
  690. End Sub
  691.  
  692.  
  693. Sub UpdateFlipperLogos
  694. LFLogo.RotAndTra2 = LeftFlipper.CurrentAngle
  695. RFlogo.RotAndTra2 = RightFlipper.CurrentAngle
  696. End Sub
  697.  
  698. Sub SolRampDiverter(enabled)
  699. if enabled then
  700. Playsound "DiverterRamp"
  701. RampDiv.RotateToEnd
  702. 'PrimRampDiv.RotY= 2
  703. PrimRampDiv.RotY= -3
  704. PrimRampDiv.TransX = -45
  705. PrimRampDiv.TransZ= -55
  706. else
  707. Playsound "DiverterRamp"
  708. RampDiv.RotateToStart
  709. PrimRampDiv.RotY= 12
  710. PrimRampDiv.TransX = 0
  711. PrimRampDiv.TransZ= 0
  712. end if
  713. End Sub
  714.  
  715. Sub SolLockRelease(enabled)
  716. If enabled then
  717. PernoLock.TransY= -29
  718. Playsound "DiverterLock"
  719. lockrelease.isdropped = true
  720. vlLock.SolExit enabled
  721. LockReleaseTimer.Enabled = True
  722. End If
  723. End Sub
  724.  
  725. Sub LockReleaseTimer_Timer() 'Give LockRelease more time to be down
  726. PernoLock.TransY= 0
  727. Playsound "DiverterLock"
  728. LockRelease.IsDropped = False
  729. LockReleaseTimer.Enabled = False
  730. End Sub
  731.  
  732. Sub SolKickBack(enabled)
  733. if enabled then
  734. CornerKicker.Enabled = True
  735. else
  736. KickbackDisableTimer.enabled = true
  737. End if
  738. End Sub
  739.  
  740. Sub KickBackDisableTimer_Timer()
  741. Me.enabled = false
  742. CornerKicker.enabled = false
  743. End Sub
  744.  
  745. Sub CornerKicker_Hit()
  746. CornerKicker.kick 0, 35 'ERA 45
  747. vpPlay "Rilancio", CornerKicker
  748. End Sub
  749.  
  750. Sub LeftVelDamp_Hit()
  751. Activeball.velY = 2
  752. Activeball.VelX = -2
  753. End Sub
  754.  
  755. '--------------------------------------------------------
  756. ' Give meaningful name to switches and solenoids
  757. '--------------------------------------------------------
  758.  
  759.  
  760.  
  761. ' Switches | Status
  762. '-------------------------------------------
  763. 'switch 11 unused 'not used
  764. Const swMagGoalieButton = 12 'installed
  765. Const swStartButton = 13 'installed
  766. Const swTilt = 14 'installed
  767. Const swLeftFlipperLane = 15 'installed
  768. Const swStriker3High = 16 'installed
  769. Const swRightFlipperLane = 17 'installed
  770. Const swRightOutlane = 18 'installed
  771. Const swSlamTilt = 21 'installed
  772. Const swCoinDoor = 22 'installed
  773. Const swBuyInButton = 23 'installed
  774. Const swAlwaysClosed = 24 'not used - always closed
  775. Const swFreeKickTarget = 25 'installed
  776. Const swKickbackUpper = 26 'installed
  777. Const swSpinner = 27 'installed
  778. Const swLightKickback = 28 'installed
  779. Const swTrough1 = 31 'installed
  780. Const swTrough2 = 32 'installed
  781. Const swTrough3 = 33 'installed
  782. Const swTrough4 = 34 'installed
  783. Const swTrough5 = 35 'installed
  784. Const swTroughStack = 36 'installed
  785. Const swLightMagGoalie = 37 'installed
  786. Const swBallShooter = 38 'installed
  787. Const swGoalTrough = 41 'installed
  788. Const swGoalPopperOpto = 42 'installed
  789. Const swGoalIsLeft = 43 'installed
  790. Const swGoalIsRight = 44 'installed
  791. Const swTVBallPopper = 45 'installed
  792. 'switch 46 unused 'not used
  793. Const swTravelLaneRolo = 47 'installed
  794. Const swGoalieTarget = 48 'installed
  795. Const swSkillShotFront = 51 'installed
  796. Const swSkillShotCenter = 52 'installed
  797. Const swSkillShotRear = 53 'installed
  798. Const swRightEjectHole = 54 'installed
  799. Const swUpperEjectHole = 55 'installed
  800. Const swLeftEjectHole = 56 'installed
  801. Const swRightLaneHi = 57 'not used
  802. Const swRightLaneLo = 58 'not used
  803. Const swRollover1 = 61 'installed
  804. Const swRollover2 = 62 'installed
  805. Const swRollover3 = 63 'installed
  806. Const swRollover4 = 64 'installed
  807. Const swTackleSwitch = 65 'installed only using 1 long target - I think it might be 3 targets
  808. Const swStriker1 = 66 'installed
  809. Const swStriker2 = 67 'installed
  810. 'switch 68 is unused 'not used
  811. Const swLeftRampDiverter = 71 'installed
  812. Const swLeftRampEntrance = 72 'installed
  813. 'switch 73 is unused 'not used
  814. Const swLeftRampExit = 74 'installed
  815. Const swRightRampEntrance= 75 'installed
  816. Const swLockMechLow = 76 'installed
  817. Const swLockMechHigh = 77 'installed
  818. Const swRightRampExit = 78 'installed
  819. Const swLeftJetBumper = 81 'installed
  820. Const swUpperJetBumper = 82 'installed
  821. Const swLowerJetBumper = 83 'installed
  822. Const swLeftSlingshot = 84 'installed
  823. Const swRightSlingshot = 85 'installed
  824. Const swKickback = 86 'installed
  825. Const swUpperLeftLane = 87 'installed
  826. Const swUpperRightLane = 88 'installed
  827.  
  828.  
  829. Sub TopLeftVelCheck_Hit()
  830. Activeball.VelY = 1
  831. End Sub
  832.  
  833. Sub Trigger1_Hit:ActiveBall.VelZ=0:End Sub
  834. Sub Trigger2_Hit:ActiveBall.VelZ=0:End Sub
  835.  
  836. Sub LockRelease_Hit : vpPlay "MetalHit", PernoLock : End Sub
  837.  
  838.  
  839.  
  840. Sub LRHelp_Hit()
  841. Stopsound "plasticrolling"
  842. ActiveBall.Velz=0
  843. Activeball.Velx=0
  844. ActiveBall.Vely=0
  845. LRHelp.TimerEnabled=1
  846. End Sub
  847.  
  848. Sub LRHelp_Timer()
  849. Playsound "DropRamp"
  850. LRHelp.TimerEnabled=0
  851. End Sub
  852.  
  853. Sub RRHelp_Hit()
  854. Stopsound "plasticrolling"
  855. RRHelp.TimerEnabled=1
  856. End Sub
  857.  
  858. Sub RRHelp_Timer()
  859. Playsound "DropRamp"
  860. RRHelp.TimerEnabled=0
  861. End Sub
  862.  
  863. Sub TRHelp_Hit()
  864. Stopsound "plasticrolling"
  865. Playsound "DropRamp"
  866. ActiveBall.Velz=0
  867. Activeball.Velx=0
  868. ActiveBall.Vely=0
  869. End Sub
  870.  
  871. Sub ExitSkill_Hit()
  872. Playsound "balldrop3"
  873. End Sub
  874.  
  875.  
  876. Sub railsound_Hit()
  877. Playsound "metalrolling"
  878. End Sub
  879. Sub railend_Hit()
  880. StopSound "metalrolling"
  881. Playsound "WireRampHit"
  882. End Sub
  883. Sub railend_UnHit()
  884. vpPlay "bounce", railend
  885. End Sub
  886. Sub exit1_Hit()
  887. StopSound "metalrolling"
  888. exit1.TimerEnabled=1
  889. End Sub
  890. Sub exit1_Timer()
  891. Playsound "balldrop3"
  892. exit1.TimerEnabled=0
  893. End Sub
  894. Sub exit2_Hit()
  895. StopSound "metalrolling"
  896. exit2.TimerEnabled=1
  897. End Sub
  898. Sub exit2_Timer()
  899. Playsound "balldrop3"
  900. exit2.TimerEnabled=0
  901. End Sub
  902. Sub exit3_Hit()
  903. StopSound "metalrolling"
  904. exit3.TimerEnabled=1
  905. End Sub
  906. Sub exit3_Timer()
  907. Playsound "balldrop3"
  908. exit3.TimerEnabled=0
  909. End Sub
  910.  
  911.  
  912. '***********
  913. ' Update GI
  914. '***********
  915.  
  916.  
  917. Dim bulb
  918.  
  919.  
  920. Sub UpdateGI(nr,enabled)
  921. 'DOF 200, enabled*-1
  922. Select Case nr
  923. Case 0
  924. For each bulb in GI
  925. bulb.state=enabled
  926. ' GestioneGIWall
  927. next
  928. End Select
  929. End Sub
  930.  
  931.  
  932.  
  933. '**************************************
  934. ' Fading VPM Lamps VP9 (Reduced/Faster)
  935. ' Based on PD's Fading Lights
  936. ' SetLamp 0 is Off
  937. ' SetLamp 1 is On
  938. ' LampState(x) current state
  939. '**************************************
  940. '**************************************
  941.  
  942. Dim LampState(200), FadingLevel(200)
  943. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  944.  
  945. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  946. LampTimer.Interval = 10 'lamp fading speed
  947. LampTimer.Enabled = 1
  948.  
  949. Sub LampTimer_Timer()
  950. Dim chgLamp, num, chg, ii
  951. chgLamp = Controller.ChangedLamps
  952. If Not IsEmpty(chgLamp) Then
  953. For ii = 0 To UBound(chgLamp)
  954. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  955. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  956. Next
  957. End If
  958. UpdateLamps
  959. End Sub
  960.  
  961. Sub InitLamps()
  962. Dim x
  963. For x = 0 to 200
  964. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  965. FadingLevel(x) = 4 ' used to track the fading state
  966. FlashSpeedUp(x) = 0.5 ' faster speed when turning on the flasher
  967. FlashSpeedDown(x) = 0.35 ' slower speed when turning off the flasher
  968. FlashMax(x) = 1 ' the maximum value when on, usually 1
  969. FlashMin(x) = 0 ' the minimum value when off, usually 0
  970. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  971. Next
  972. End Sub
  973.  
  974. Sub UpdateLamps()
  975. NFadeL 11, L11
  976. NFadeL 12, L12
  977. NFadeL 13, L13
  978. NFadeL 14, L14
  979. NFadeL 15, L15
  980. NFadeL 16, L16
  981. NFadeL 17, L17
  982. NFadeL 18, L18
  983. NFadeL 21, L21
  984. NFadeL 22, L22
  985. NFadeL 23, L23
  986. NFadeL 24, L24
  987. NFadeL 25, L25
  988. NFadeL 26, L26
  989. NFadeL 27, L27
  990. NFadeL 28, L28
  991. NFadeL 31, L31
  992. NFadeL 32, L32
  993. NFadeL 33, L33
  994. NFadeL 34, L34
  995. NFadeL 35, L35
  996. NFadeL 36, L36
  997. NFadeL 37, L37
  998. NFadeL 38, L38
  999. NFadeL 41, L41
  1000. NFadeL 42, L42
  1001. NFadeL 43, L43
  1002. NFadeL 44, L44
  1003. NFadeLm 45, L45
  1004. NFadeL 45, l45a
  1005. NFadeLm 46, L46
  1006. NFadeL 46, l46a
  1007. NFadeLm 47, L47
  1008. NFadeL 47, l47a
  1009. NFadeLm 51, L51
  1010. NFadeL 51, L51a
  1011. NFadeL 52, L52
  1012. NFadeL 53, L53
  1013. NFadeL 54, L54
  1014. NFadeL 55, L55
  1015. NFadeL 56, L56
  1016. NFadeL 57, L57
  1017. NFadeL 58, L58
  1018. NFadeL 61, L61
  1019. NFadeL 62, L62
  1020. NFadeLm 63, L63
  1021. NFadeL 63, l63a
  1022. NFadeL 64, L64
  1023. NFadeLm 65, L65
  1024. NFadeL 65, L65a
  1025. NFadeL 66, L66
  1026. NFadeL 67, L67
  1027. NFadeL 72, L72
  1028. NFadeL 73, L73
  1029. NFadeL 74, L74
  1030. NFadeLm 75, L75
  1031. NFadeLn 75, l75a
  1032. NFadeL 75, L75b
  1033. NFadeL 81, L81
  1034. NFadeL 82, L82
  1035. NFadeL 83, L83
  1036. NFadeL 84, L84
  1037. 'NFadeL 85, F85
  1038.  
  1039. 'flashers
  1040.  
  1041. Flash 48, F48
  1042. Flash 68, F68
  1043. Flashm 71, F71A
  1044. Flash 71, F71
  1045. Flash 76, F76
  1046. Flash 77, F77
  1047. Flashm 78, F78A
  1048. Flash 78, F78
  1049. Flash 85, F85
  1050. Flash 86, F86
  1051. Flash 117, F117
  1052. Flash 119, F119
  1053. Flash 122, F122
  1054. Flash 125, F125
  1055. Flash 126, F126
  1056. Flashm 127, F127A
  1057. Flash 127, F127
  1058. Flashm 128, F128A
  1059. Flash 128, F128
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. End Sub
  1067.  
  1068. Sub SetLamp(nr, value)
  1069. If value <> LampState(nr) Then
  1070. LampState(nr) = abs(value)
  1071. FadingLevel(nr) = abs(value) + 4
  1072. End If
  1073. End Sub
  1074.  
  1075. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  1076.  
  1077. Sub NFadeL(nr, object)
  1078. Select Case FadingLevel(nr)
  1079. Case 4:object.state = 0:FadingLevel(nr) = 0
  1080. Case 5:object.state = 1:FadingLevel(nr) = 1
  1081. End Select
  1082. End Sub
  1083.  
  1084. Sub NFadeLm(nr, object) ' used for 2 lights
  1085. Select Case FadingLevel(nr)
  1086. Case 4:object.state = 0
  1087. Case 5:object.state = 1
  1088. End Select
  1089. End Sub
  1090.  
  1091. Sub NFadeLn(nr, object) ' used for 3 lights
  1092. Select Case FadingLevel(nr)
  1093. Case 4:object.state = 0
  1094. Case 5:object.state = 1
  1095. End Select
  1096. End Sub
  1097.  
  1098.  
  1099. Sub FadeObj(nr, object, a, b, c, d)
  1100. Select Case FadingLevel(nr)
  1101. Case 2:object.image = d:FadingLevel(nr) = 0 'Off
  1102. Case 3:object.image = c:FadingLevel(nr) = 2 'fading...
  1103. Case 4:object.image = b:FadingLevel(nr) = 3 'fading...
  1104. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  1105. End Select
  1106. End Sub
  1107.  
  1108. Sub FadeObjm(nr, object, a, b, c, d)
  1109. Select Case FadingLevel(nr)
  1110. Case 2:object.image = d
  1111. Case 3:object.image = c
  1112. Case 4:object.image = b
  1113. Case 5:object.image = d
  1114. End Select
  1115. End Sub
  1116.  
  1117. Sub NFadeObj(nr, object, a, b)
  1118. Select Case FadingLevel(nr)
  1119. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  1120. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  1121. End Select
  1122. End Sub
  1123.  
  1124. Sub NFadeObjm(nr, object, a, b)
  1125. Select Case FadingLevel(nr)
  1126. Case 4:object.image = b
  1127. Case 5:object.image = a
  1128. End Select
  1129. End Sub
  1130.  
  1131. Sub Flash(nr, object)
  1132. Select Case FadingLevel(nr)
  1133. Case 4 'off
  1134. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  1135. If FlashLevel(nr) < FlashMin(nr) Then
  1136. FlashLevel(nr) = FlashMin(nr)
  1137. FadingLevel(nr) = 0 'completely off
  1138. End if
  1139. Object.IntensityScale = FlashLevel(nr)
  1140. Case 5 ' on
  1141. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  1142. If FlashLevel(nr) > FlashMax(nr) Then
  1143. FlashLevel(nr) = FlashMax(nr)
  1144. FadingLevel(nr) = 1 'completely on
  1145. End if
  1146. Object.IntensityScale = FlashLevel(nr)
  1147. End Select
  1148. End Sub
  1149.  
  1150. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  1151. Object.IntensityScale = FlashLevel(nr)
  1152. End Sub
  1153.  
  1154.  
  1155. '******************
  1156. ' RealTime Updates
  1157. '******************
  1158. Set MotorCallback = GetRef("GameTimer")
  1159.  
  1160. Sub GameTimer
  1161. ' RollingSound
  1162. UpdateFlipperLogos
  1163. UpdateVisuals
  1164. End Sub
  1165.  
  1166. Sub GatesTimer_Timer()
  1167. 'UpdateFlipperLogos
  1168. End Sub
  1169.  
  1170. Sub UpdateFlipperLogos
  1171. flipperl.RotY = LeftFlipper.CurrentAngle
  1172. flipperr.RotY = RightFlipper.CurrentAngle
  1173. PrimSpinner1.RotZ= -Spinner1.CurrentAngle
  1174. End Sub
  1175.  
  1176.  
  1177. '****************************************
  1178. ' B2B Collision by Steely & Pinball Ken
  1179. '****************************************
  1180. ' For use with core.vbs 3.37 or greater to grab BSize variable
  1181.  
  1182. Dim tnopb, nosf, iball, cnt, errMessage, B2BOn
  1183.  
  1184. 'B2BOn = 2 '0=Off, 1=On, 2=AutoDetect
  1185. CheckB2B
  1186. XYdata.interval = 10 ' <<<<< ADD timer named XYData to table
  1187. tnopb = 5 ' <<<<< SET to the "Total Number Of Possible Balls" in play at any one time
  1188. nosf = 10 ' <<<<< SET to the "Number Of Sound Files" used / B2B collision volume levels
  1189.  
  1190. ReDim CurrentBall(tnopb), BallStatus(tnopb)
  1191.  
  1192. For cnt = 0 to ubound(BallStatus) : BallStatus(cnt) = 0 : Next
  1193.  
  1194. '****************************************
  1195. ' B2B AutoDisable for XP x64 Added by Koadic
  1196. '****************************************
  1197.  
  1198. Sub CheckB2B ' Added by Koadic for XP x64 handling
  1199. Dim osver, cpuver, check
  1200. On Error Resume Next
  1201. For x = 0 to 1 : If B2BOn = x Then Exit Sub : End If : Next 'If B2BOn is set manually, then end routine
  1202. Set check = CreateObject("WScript.Shell")
  1203. osver = check.RegRead ("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
  1204. cpuver = check.RegRead ("HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment\Processor_Architecture")
  1205. If osver < 6 and cpuver = "AMD64" Then B2BOn = 0 Else B2BOn = 1 'If OS is XP and 64bit, then disable B2B
  1206. If Err Then B2BOn = 1 'If there is an error in detecting either OS or x32/x64, then default to On
  1207. On Error Goto 0
  1208. End Sub
  1209.  
  1210. '======================================================
  1211. ' <<<<<<<<<<<<<< Ball Identification >>>>>>>>>>>>>>
  1212. '======================================================
  1213.  
  1214. '******************************
  1215. ' Destruk's alternative vpmCreateBall for use with B2B Enabled tables
  1216. ' Core.vbs calls vpmCreateBall when a ball is created from a ball stack
  1217. '******************************
  1218. If IsEmpty(Eval("vpmCreateBall"))=false Then Set vpmCreateBall = GetRef("B2BvpmCreateBall") ' Override the core.vbs and redefine vpmCreateBall
  1219.  
  1220. Function B2BvpmCreateBall(aKicker)
  1221. Dim bsize2:If IsEmpty(Eval("ballsize"))=true Then bsize2 = 25 Else bsize2 = ballsize/2
  1222. For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
  1223. If ballStatus(cnt) = 0 Then ' If ball ID is available...
  1224. If Not IsEmpty(vpmBallImage) Then ' Set ball object with the first available ID
  1225. Set CurrentBall(cnt) = aKicker.Createsizedball(bsize2).Image
  1226. Else
  1227. Set CurrentBall(cnt) = aKicker.Createsizedball(bsize2)
  1228. End If
  1229. Set B2BvpmCreateBall = aKicker
  1230. CurrentBall(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
  1231. ballStatus(cnt) = 1 ' Mark this ball status active
  1232. ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
  1233. If B2BOn > 0 Then ' If B2BOn is 0, it overrides auto-turn on collision detection
  1234. ' If more than one ball active, start collision detection process
  1235. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  1236. End If
  1237. Exit For ' New ball ID assigned, exit loop
  1238. End If
  1239. Next
  1240. End Function
  1241.  
  1242. ' Use CreateBallID(kickername) to manually create a ball with a BallID
  1243. ' Can also be used on nonVPM tables (EM or Custom)
  1244.  
  1245. Sub CreateBallID(aKicker)
  1246. Dim bsize2:If IsEmpty(Eval("ballsize"))=true Then bsize2 = 25 Else bsize2 = ballsize/2
  1247. For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
  1248. If ballStatus(cnt) = 0 Then ' If ball ID is available...
  1249. Set CurrentBall(cnt) = aKicker.Createsizedball(bsize2) ' Set ball object with the first available ID
  1250. CurrentBall(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
  1251. ballStatus(cnt) = 1 ' Mark this ball status active
  1252. ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
  1253. If B2BOn > 0 Then ' If B2BOn is 0, it overrides auto-turn on collision detection
  1254. ' If more than one ball active, start collision detection process
  1255. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  1256. End If
  1257. Exit For ' New ball ID assigned, exit loop
  1258. End If
  1259. Next
  1260. End Sub
  1261.  
  1262. ' Use CreateBallID2(kickername, ballsize) to manually create a custom sized ball with a BallID
  1263. ' Can also be used on nonVPM tables (EM or Custom)
  1264.  
  1265. Sub CreateBallID2(aKicker, bsize2) ' Use to manually create a ball with a BallID with a custom size
  1266. For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
  1267. If ballStatus(cnt) = 0 Then ' If ball ID is available...
  1268. Set CurrentBall(cnt) = aKicker.Createsizedball(bsize2/2) ' Set ball object with the first available ID
  1269. CurrentBall(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
  1270. ballStatus(cnt) = 1 ' Mark this ball status active
  1271. ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
  1272. If B2BOn > 0 Then ' If B2BOn is 0, it overrides auto-turn on collision detection
  1273. ' If more than one ball active, start collision detection process
  1274. If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
  1275. End If
  1276. Exit For ' New ball ID assigned, exit loop
  1277. End If
  1278. Next
  1279. End Sub
  1280.  
  1281. 'Call this sub from every kicker that destroys a ball, before the ball is destroyed.
  1282.  
  1283. Sub ClearBallid
  1284. On Error Resume Next ' Error handling for debugging purposes
  1285. iball = ActiveBall.uservalue ' Get the ball ID to be cleared
  1286. If Err Then Msgbox Err.description & vbCrLf & iball
  1287. ballStatus(iBall) = 0 ' Clear the ball status
  1288. ballStatus(0) = ballStatus(0)-1 ' Subtract 1 ball from the # of balls in play
  1289. On Error Goto 0
  1290. End Sub
  1291.  
  1292. '=====================================================
  1293. ' <<<<<<<<<<<<<<<<< XYdata_Timer >>>>>>>>>>>>>>>>>
  1294. '=====================================================
  1295.  
  1296. 'Ball data collection and B2B Collision detection.
  1297.  
  1298. ReDim baX(tnopb,4), baY(tnopb,4), baZ(tnopb,4), bVx(tnopb,4), bVy(tnopb,4), TotalVel(tnopb,4)
  1299. Dim cForce, bDistance, xyTime, cFactor, id, id2, id3, B1, B2
  1300.  
  1301. Sub XYdata_Timer()
  1302. xyTime = Timer+(XYdata.interval*.001) ' xyTime is the system timer plus the current interval time
  1303. If id2 >= 4 Then id2 = 0 ' Loop four times and start over
  1304. id2 = id2+1 ' Increment the ball sampler ID
  1305. For id = 1 to ubound(ballStatus) ' Loop once for each possible ball
  1306. If ballStatus(id) = 1 Then ' If ball is active...
  1307. baX(id,id2) = round(CurrentBall(id).x,2) ' Sample x-coord
  1308. baY(id,id2) = round(CurrentBall(id).y,2) ' Sample y-coord
  1309. baZ(id,id2) = round(CurrentBall(id).z,2) ' Sample z-coord
  1310. bVx(id,id2) = round(CurrentBall(id).velx,2) ' Sample x-velocity
  1311. bVy(id,id2) = round(CurrentBall(id).vely,2) ' Sample y-velocity
  1312. TotalVel(id,id2) = (bVx(id,id2)^2 + bVy(id,id2)^2) ' Calculate total velocity
  1313. If TotalVel(id,id2) > TotalVel(0,0) Then TotalVel(0,0) = int(TotalVel(id,id2))
  1314. End If
  1315. Next
  1316. id3 = id2 : B2 = 2 : B1 = 1 ' Set up the counters for looping
  1317. Do
  1318. If ballStatus(B1) = 1 and ballStatus(B2) = 1 Then ' If both balls are active...
  1319. bDistance = int((TotalVel(B1,id3)+TotalVel(B2,id3))^(1.04 * (CurrentBall(B1).radius + CurrentBall(B2).radius)/50))
  1320. If ((baX(B1,id3) - baX(B2,id3))^2 + (baY(B1,id3) - baY(B2,id3))^2) < (2800 * ((CurrentBall(B1).radius + CurrentBall(B2).radius)/50)^2) + bDistance Then
  1321. If ABS(baZ(B1,id3) - baZ(B2,id3)) < (CurrentBall(B1).radius + CurrentBall(B2).radius) Then collide B1,B2 : Exit Sub 'added z axis collision detection here
  1322. End If
  1323. End If
  1324. B1 = B1+1 ' Increment ball1
  1325. If B1 = ubound(ballstatus) Then Exit Do ' Exit loop if all ball combinations checked
  1326. If B1 >= B2 then B1 = 1:B2 = B2+1 ' If ball1 >= reset ball1 and increment ball2
  1327. Loop
  1328. If ballStatus(0) <= 1 Then XYdata.enabled = False ' Turn off timer if one ball or less
  1329. If XYdata.interval >= 40 Then B2BOn = 0 : XYdata.enabled = False ' Auto-shut off
  1330. If Timer > xyTime * 3 Then B2BOn = 0 : XYdata.enabled = False ' Auto-shut off
  1331. If Timer > xyTime Then XYdata.interval = XYdata.interval+1 ' Increment interval if needed
  1332. End Sub
  1333.  
  1334. '=========================================================
  1335. ' <<<<<<<<<<< Collide(ball id1, ball id2) >>>>>>>>>>>
  1336. '=========================================================
  1337. 'Calculate the collision force and play sound accordingly.
  1338.  
  1339. Dim cTime, cb1,cb2, avgBallx, cAngle, bAngle1, bAngle2
  1340.  
  1341. Sub Collide(cb1,cb2)
  1342. If TotalVel(0,0) / 1.8 > cFactor Then cFactor = int(TotalVel(0,0) / 1.8)
  1343. avgBallx = (bvX(cb2,1) + bvX(cb2,2) + bvX(cb2,3) + bvX(cb2,4)) / 4
  1344. If avgBallx < bvX(cb2,id2) + .1 and avgBallx > bvX(cb2,id2) - .1 Then
  1345. If ABS(TotalVel(cb1,id2) - TotalVel(cb2,id2)) < .000005 Then Exit Sub
  1346. End If
  1347. If Timer < cTime Then Exit Sub
  1348. cTime = Timer+.1 ' Limits collisions to .1 seconds apart
  1349. GetAngle baX(cb1,id3) - baX(cb2,id3), baY(cb1,id3) - baY(cb2,id3), cAngle ' Collision angle via x/y-coordinates
  1350. id3 = id3 - 1 : If id3 = 0 Then id3 = 4 ' Step back one xyData sampling for a good velocity reading
  1351. GetAngle bVx(cb1,id3), bVy(cb1,id3), bAngle1 ' ball 1 travel direction, via velocity
  1352. GetAngle bVx(cb2,id3), bVy(cb2,id3), bAngle2 ' ball 2 travel direction, via velocity
  1353. cForce = Cint((abs(TotalVel(cb1,id3)*Cos(cAngle-bAngle1))+abs(TotalVel(cb2,id3)*Cos(cAngle-bAngle2))))
  1354. If cForce < 4 Then Exit Sub ' Another collision limiter
  1355. cForce = Cint((cForce)/(cFactor/nosf)) ' Divides up cForce for the proper sound selection.
  1356. If cForce > nosf-1 Then cForce = nosf-1 ' First sound file 0(zero) minus one from number of sound files
  1357. PlaySound("collide" & cForce) ' Combines "collide" with the calculated sound level and play sound
  1358. End Sub
  1359.  
  1360. '=================================================
  1361. ' <<<<<<<< GetAngle(X, Y, Anglename) >>>>>>>>
  1362. '=================================================
  1363. Dim Xin,Yin,rAngle,Radit,wAngle
  1364. Function Pi:Pi = 4*Atn(1):End Function
  1365. Function dSin(degrees)
  1366. dsin = sin(degrees * Pi/180)
  1367. if ABS(dSin) < 0.000001 Then dSin = 0
  1368. if ABS(dSin) > 0.999999 Then dSin = 1 * sgn(dSin)
  1369. End Function
  1370.  
  1371. Sub GetAngle(Xin, Yin, wAngle)
  1372. If Sgn(Xin) = 0 Then
  1373. If Sgn(Yin) = 1 Then rAngle = 3 * Pi/2 Else rAngle = Pi/2
  1374. If Sgn(Yin) = 0 Then rAngle = 0
  1375. Else
  1376. rAngle = atn(-Yin/Xin)
  1377. End If
  1378. If sgn(Xin) = -1 Then Radit = Pi Else Radit = 0
  1379. If sgn(Xin) = 1 and sgn(Yin) = 1 Then Radit = 2 * Pi
  1380. wAngle = round((Radit + rAngle),4)
  1381. End Sub
  1382.  
  1383. '********************************JimmyFingers Sound Routines**********************************************
  1384. Sub arubberposts_Hit(idx)
  1385. dim finalspeed
  1386. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1387. If finalspeed > 14 then
  1388. vpPlay "bump", ActiveBall
  1389. End if
  1390. If finalspeed >= 4 AND finalspeed <= 14 then
  1391. RandomSoundRubber()
  1392. End If
  1393. If finalspeed < 4 AND finalspeed > 1 then
  1394. RandomSoundRubberLowVolume()
  1395. End If
  1396. Dampen 5, .9, 20
  1397. End sub
  1398.  
  1399. Sub arubbers_Hit(idx)
  1400. dim finalspeed
  1401. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1402. If finalspeed > 16 then
  1403. vpPlay "bump", ActiveBall
  1404. End if
  1405. If finalspeed >= 8 AND finalspeed <= 16 then
  1406. RandomSoundRubber()
  1407. End If
  1408. Dampen 5, .9, 20
  1409. End sub
  1410.  
  1411. Sub RandomSoundRubber()
  1412. Select Case Int(Rnd*3)+1
  1413. Case 1 : vpPlay "rubber_hit_1", ActiveBall
  1414. Case 2 : vpPlay "rubber_hit_2", ActiveBall
  1415. Case 3 : vpPlay "rubber_hit_3", ActiveBall
  1416. End Select
  1417. End Sub
  1418.  
  1419. Sub RandomSoundRubberLowVolume()
  1420. Select Case Int(Rnd*3)+1
  1421. Case 1 : vpPlay "rubber_hit_1_low", ActiveBall
  1422. Case 2 : vpPlay "rubber_hit_2_low", ActiveBall
  1423. Case 3 : vpPlay "rubber_hit_3_low", ActiveBall
  1424. End Select
  1425. End Sub
  1426.  
  1427. Sub Dampen(dt,df,r) 'dt is threshold speed, df is dampen factor 0 to 1 (higher more dampening), r is randomness
  1428. Dim dfRandomness
  1429. r=cint(r)
  1430. dfRandomness=INT(RND*(2*r+1))
  1431. df=df+(r-dfRandomness)*.01
  1432. If ABS(activeball.velx) > dt Then activeball.velx=activeball.velx*(1-df*(ABS(activeball.velx)/100))
  1433. If ABS(activeball.vely) > dt Then activeball.vely=activeball.vely*(1-df*(ABS(activeball.vely)/100))
  1434. End Sub
  1435.  
  1436.  
  1437. '******************************************
  1438. ' Use RollingSoundTimer to call div subs
  1439. '******************************************
  1440.  
  1441.  
  1442. Sub RollingSoundTimer_Timer()
  1443. RollingSound
  1444. End Sub
  1445.  
  1446.  
  1447. '****************************************
  1448. ' JimmyFingers Enhanced Ball Rolling Script (Extension of Rascal's Original)
  1449. '****************************************
  1450.  
  1451. ReDim BRVeloY(tnopb), BRVeloX(tnopb), rolling(tnopb), rollingfast(tnopb)
  1452. Dim b
  1453. b = 0
  1454.  
  1455. RollingSoundTimer.Interval = 60/tnopb
  1456.  
  1457. Sub RollingSound()
  1458. B = B + 1
  1459. If B > tnopb Then B = 1
  1460. If BallStatus(b) = 0 Then Exit Sub
  1461.  
  1462. BRVeloY(b) = Cint(CurrentBall(b).VelY)
  1463. BRVeloX(b) = Cint(CurrentBall(b).VelX)
  1464. If((ABS(BRVeloY(b))> 3 AND (ABS(BRVeloY(b))< 10) or (ABS(BRVeloX(b) )> 3 AND (ABS(BRVeloX(b))< 10)))) Then
  1465. If rolling(b) = True then
  1466. Exit Sub
  1467. Else
  1468. If rollingfast(b) = True then
  1469. StopSound "JF_rollingfaster"
  1470. rollingfast(b) = False
  1471. Else
  1472. rolling(b) = True
  1473. Select Case Int(Rnd*3)+1
  1474. Case 1 : vpPlay "JF_roll1", CurrentBall(b)
  1475. Case 2 : vpPlay "JF_roll2", CurrentBall(b)
  1476. Case 3 : vpPlay "JF_roll3", CurrentBall(b)
  1477. End Select
  1478. End If
  1479. End If
  1480. ElseIf (ABS(BRVeloY(b) )> 10 or ABS(BRVeloX(b) )> 10) Then
  1481. If rollingfast(b) = True then
  1482. Exit Sub
  1483. Else
  1484. If rolling(b) = True then
  1485. StopSound "JF_roll1"
  1486. StopSound "JF_roll2"
  1487. StopSound "JF_roll3"
  1488. rolling(b) = False
  1489. Else
  1490. rollingfast(b) = True
  1491. vpPlay "JF_rollingfaster", CurrentBall(b)
  1492. End If
  1493. End If
  1494. Else
  1495. If rolling(b) = True Then
  1496. StopSound "JF_roll1"
  1497. StopSound "JF_roll2"
  1498. StopSound "JF_roll3"
  1499. rolling(b) = False
  1500. ElseIf rollingfast(b) = True Then
  1501. StopSound "JF_rollingfaster"
  1502. rollingfast(b) = False
  1503. End If
  1504. End If
  1505. End Sub
  1506.  
  1507. Sub StopRollingSound()
  1508. StopSound "JF_roll1"
  1509. StopSound "JF_roll2"
  1510. StopSound "JF_roll3"
  1511. StopSound "JF_rollingfaster"
  1512. End Sub
  1513.  
  1514. 'REGISTRY LOCATIONS ***************************************************************************************************************************************
  1515.  
  1516. Const optOpenAtStart = &H000001
  1517. Const optDMDRotation = &H000002
  1518. Const optDMDHidden = &H000004
  1519. Const optBallGI = &H000008
  1520. Const optController = &H000010
  1521. Const optB2BEnable = &H000100
  1522. Const optGoalieSpeed = &H001000
  1523. Const optBallImage = &H010000
  1524. Const optFBSounds = &H100000
  1525.  
  1526. 'OPTIONS MENU *********************************************************************************************************************************************
  1527.  
  1528. Dim TableOptions, TableName, optReset
  1529. Private vpmShowDips1, vpmDips1
  1530.  
  1531. Sub InitializeOptions
  1532. TableName="WCS94" 'Replace with your descriptive table name, it will be used to save settings in VPReg.stg file
  1533. Set vpmShowDips1 = vpmShowDips 'Reassigns vpmShowDips to vpmShowDips1 to allow usage of default dips menu
  1534. Set vpmShowDips = GetRef("TableShowDips") 'Assigns new sub to vmpShowDips
  1535. TableOptions = LoadValue(TableName,"Options") 'Load saved table options
  1536. Set Controller = CreateObject("VPinMAME.Controller") 'Load vpm controller temporarily so options menu can be loaded if needed
  1537. If TableOptions = "" Or optReset Then 'If no existing options, reset to default through optReset, then open Options menu
  1538. TableOptions = DefaultOptions 'clear any existing settings and set table options to default options
  1539. TableShowOptions
  1540. ElseIf (TableOptions And optOpenAtStart) Then 'If Enable Next Start was selected then
  1541. TableOptions = TableOptions - optOpenAtStart 'clear setting to avoid future executions
  1542. TableShowOptions
  1543. Else
  1544. TableSetOptions
  1545. End If
  1546. Set Controller = Nothing 'Unload vpm controller so selected controller can be loaded
  1547. End Sub
  1548.  
  1549. Private Sub TableShowDips
  1550. vpmShowDips1 'Show original Dips menu
  1551. TableShowOptions 'Show new options menu
  1552. ' TableShowOptions2 'Add more options menus...
  1553. End Sub
  1554.  
  1555. Private Sub TableShowOptions 'New options menu, additional menus can be added as well, just follow similar format and add call to TableShowDips
  1556. Dim oldOptions : oldOptions = TableOptions
  1557. If Not IsObject(vpmDips1) Then 'If creating an additional menus, need to declare additional vpmDips variables above (ex. vpmDips2 and TableOptions2, etc.)
  1558. Set vpmDips1 = New cvpmDips
  1559. With vpmDips1
  1560. .AddForm 530, 250, "TABLE OPTIONS MENU"
  1561. .AddFrameExtra 0,0,105,"Controller Selection*",3*optController, Array("Visual PinMame", 1*optController, "UVP", 2*optController,_
  1562. "B2S Server", 3*optController)
  1563. .AddFrameExtra 0,60,105,"DMD Options*",0, Array("Rotate DMD", optDMDRotation, "Hide DMD", optDMDHidden)
  1564. .AddFrameExtra 0,106,105,"B2B Options",3*optB2BEnable, Array("Force Disable", 0*optB2BEnable, "Force Enable", 1*optB2BEnable, "Auto Detect", 2*optB2BEnable)
  1565. .AddLabel 5,166,100,15,"* Requires restart"
  1566.  
  1567. .AddFrameExtra 125,0,105,"Goalie Speed*",3*optGoalieSpeed, Array("Fast", 1*optGoalieSpeed, "Normal", 2*optGoalieSpeed,_
  1568. "Slow", 3*optGoalieSpeed)
  1569. .AddFrameExtra 125,60,105,"Ball Image",3*optBallImage, Array("Black/White", 0*optBallImage, "Teal/White", 1*optBallImage,_
  1570. "Design", 2*optBallImage)
  1571. .AddChkExtra 130,123,150, Array("Disable Ball Shading (FPS+)", optBallGI)
  1572. .AddChkExtra 130,138,150, Array("Disable Mech Sounds", optFBSounds)
  1573. .AddChkExtra 130,166,105, Array("Enable Next Start", optOpenAtStart)
  1574. End With
  1575. End If
  1576. TableOptions = vpmDips1.ViewDipsExtra(TableOptions)
  1577. SaveValue TableName,"Options",TableOptions
  1578. TableSetOptions
  1579. End Sub
  1580.  
  1581. Dim BallImage, BallType, BallGI, GoalieSpeed
  1582. BallImage = Array("soccerball", "soccerball2", "soccerball3")
  1583.  
  1584. Sub TableSetOptions 'define required settings before table is run
  1585. ROL = (TableOptions And optDMDRotation)\optDMDRotation
  1586. HIDDEN = (TableOptions And optDMDHidden)\optDMDHidden
  1587. cController = ((TableOptions And (3*optController))\optController)
  1588. B2Bon = ((TableOptions And (3*optB2BEnable))\optB2BEnable)
  1589. BallType = ((TableOptions And (3*optBallImage))\optBallImage)
  1590. BallGI = (TableOptions And optBallGI)\optBallGI
  1591. GoalieSpeed = ((TableOptions And (3*optGoalieSpeed))\optGoalieSpeed)
  1592. Select Case GoalieSpeed
  1593. Case 1:GoalieSpeed = 60
  1594. Case 2:GoalieSpeed = 80
  1595. Case 3:GoalieSpeed = 120
  1596. End Select
  1597. If IsObject(mGoalie) Then mGoalie.length = GoalieSpeed
  1598. If cbool(TableOptions AND optFBSounds) Then
  1599. FFBSounds = FeedbackSounds
  1600. BallRel = ""
  1601. SolOn = ""
  1602. Popper = ""
  1603. Else
  1604. FFBSounds = Empty
  1605. BallRel = "BallRel"
  1606. SolOn = "SolOn"
  1607. Popper = "Popper"
  1608. End If
  1609. End Sub
  1610.  
  1611. Sub UpdateVisuals
  1612. If SoccerBall.image <> BallImage(BallType) Then SoccerBall.image = BallImage(BallType)
  1613. If SoccerBallLight.TopVisible = cbool(BallGI) Then SoccerBallLight.TopVisible = Not cbool(BallGI)
  1614. End Sub
  1615.  
  1616. Dim FFBSounds
  1617. Sub vpPlay(sound, tableobj)
  1618. Dim x
  1619. If Not IsEmpty(FFBSounds) Then 'If FFBSounds is assigned to the feedbacksounds array... aka FeedBack sounds turned OFF
  1620. For x = 0 to Ubound(FFBSounds) 'Loop through all sounds in the array
  1621. If lcase(FFBSounds(x)) = lcase(sound) Then 'Check to see if sound is present in array, and if so
  1622. Exit Sub 'Exit the sub as no sound should then be played
  1623. End If
  1624. Next
  1625. End If 'If sound isn't found, then play sound as normal...
  1626. Debug.print sound
  1627.  
  1628. PlaySound sound, 1, 1, Pan(tableobj)
  1629. 'VPX 10.4 only
  1630. 'PlaySound sound, 1, 1, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1631.  
  1632. End Sub
  1633.  
  1634. function AudioFade(ball)
  1635. Dim tmp
  1636. tmp = ball.y * 2 / tablewpc94.height-1
  1637. If tmp > 0 Then
  1638. AudioFade = Csng(tmp ^10)
  1639. Else
  1640. AudioFade = Csng(-((- tmp) ^10) )
  1641. End If
  1642. End Function
  1643.  
  1644. Function Pan(tobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  1645. Dim tmp
  1646. tmp = tobj.x * 2 / tablewpc94.width-1
  1647. If tmp > 0 Then
  1648. Pan = Csng(tmp ^10)
  1649. Else
  1650. Pan = Csng(-((- tmp) ^10) )
  1651. End If
  1652. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement