Outhere

Football jpsalas(Taito do Brasil

Jun 9th, 2021 (edited)
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.88 KB | None | 0 0
  1. ' ****************************************************************
  2. ' VISUAL PINBALL X EM Script by JPSalas
  3. ' Basic EM script up to 4 players
  4. ' uses core.vbs for extra functions
  5. '
  6. '
  7. ' VPX - version by JPSalas 2018, version 2.0.0
  8. ' ****************************************************************
  9.  
  10. 'DOF Config by Outhere
  11. '101 Left Flipper
  12. '102 Right Flipper
  13. '103 Left Slingshot
  14. '104 Shaker
  15. '105 Right Slingshot
  16. '106
  17. '107 Bumper Left
  18. '108
  19. '109 Bumper Right
  20. '110 Ball Release
  21. '117 Strobe
  22. '118 Left Kick Out
  23. '119
  24. '120 Right Kick Out
  25. '128
  26.  
  27. Option Explicit
  28. Randomize
  29.  
  30. Const BallSize = 50
  31. Const BallMass = 1.7
  32.  
  33. LoadCoreFiles
  34.  
  35. Sub LoadCoreFiles
  36. On Error Resume Next
  37. ExecuteGlobal GetTextFile("core.vbs")
  38. If Err Then MsgBox "Can't open core.vbs"
  39. On Error Resume Next
  40. ExecuteGlobal GetTextFile("controller.vbs")
  41. If Err Then MsgBox "Can't open controller.vbs"
  42. End Sub
  43.  
  44. ' Constants
  45. Const TableName = "Football_1979_2"
  46. Const cGameName = "diablo" ' <---<----<----<----- Using Some of Diablo DOF Settings -----------------------------------
  47. 'Const cGameName = "Football_1979_2"
  48. Const MaxPlayers = 4
  49. Const BallsPerGame = 5
  50. Const Special1 = 620000 ' extra credits
  51. Const Special2 = 790000
  52. Const Special3 = 960000
  53.  
  54. ' Global Variables
  55. Dim PlayersPlayingGame
  56. Dim CurrentPlayer
  57. Dim Credits
  58. Dim Bonus(4)
  59. Dim BonusValue
  60. Dim BonusMultiplier
  61. Dim BonusCount
  62. Dim BallsRemaining(4)
  63. Dim ExtraBallsAwards(4)
  64. Dim Special1Awarded(4)
  65. Dim Special2Awarded(4)
  66. Dim Special3Awarded(4)
  67. Dim Score(4)
  68. Dim HighScore
  69. Dim Match
  70. Dim Tilt
  71. Dim TiltSensitivity
  72. Dim Tilted
  73. Dim Add1, Add10, Add100, Add1000, Add10000
  74.  
  75. ' Controll Variables
  76. Dim BallsOnPlayfield
  77.  
  78. ' Boolean Variables
  79. Dim bAttractMode
  80. Dim bFreePlay
  81. Dim bGameInPlay
  82. Dim bOnTheFirstBall
  83. Dim bExtraBallWonThisBall
  84. Dim bJustStarted
  85. Dim bBallInPlungerLane
  86. Dim bBallSaverActive
  87.  
  88. Dim x
  89.  
  90. ' core.vbs variables
  91.  
  92. Sub Table1_Init()
  93. VPObjects_Init
  94. LoadEM
  95. Loadhs
  96. UpdateCredits
  97. bFreePlay = False
  98.  
  99. ' Init global variables
  100. bAttractMode = False
  101. bOnTheFirstBall = False
  102. bGameInPlay = False
  103. bBallInPlungerLane = False
  104. BallsOnPlayfield = 0
  105. Tilt = 0
  106. TiltSensitivity = 6
  107. Tilted = False
  108. bJustStarted = True
  109. Add1 = 0
  110. Add10 = 0
  111. Add100 = 0
  112. Add1000 = 0
  113. Add10000 = 0
  114. BonusValue = 2000
  115.  
  116. EndOfGame
  117.  
  118. vpmtimer.addtimer 1500, "GiOn '"
  119.  
  120. ' Remove desktop elements
  121. If Table1.ShowDT = true then
  122. For each x in aReels
  123. x.Visible = 1
  124. Next
  125. else
  126. For each x in aReels
  127. x.Visible = 0
  128. Next
  129. end if
  130.  
  131. ' Start realtime animations
  132. GameTimer.Enabled = 1
  133. End Sub
  134.  
  135. '******
  136. ' Keys
  137. '******
  138.  
  139. Sub Table1_KeyDown(ByVal Keycode)
  140.  
  141. If keycode = LeftMagnaSave Then bLutActive = True
  142. If keycode = RightMagnaSave Then
  143. If bLutActive Then NextLUT:End If
  144. End If
  145.  
  146. If Keycode = AddCreditKey Then
  147. If(Tilted = False)Then
  148. AddCredits 1
  149. PlaySoundAt "fx_coin", drain
  150. PlaySound "so_coin"
  151. End If
  152. End If
  153.  
  154. If keycode = PlungerKey Then
  155. Plunger.Pullback
  156. PlaySoundAt "fx_plungerpull", plunger
  157. End If
  158.  
  159. If keycode = LeftTiltKey Then Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25:CheckTilt
  160. If keycode = RightTiltKey Then Nudge 270, 8:PlaySound "fx_nudge", 0, 1, 0.1, 0.25:CheckTilt
  161. If keycode = CenterTiltKey Then Nudge 0, 9:PlaySound "fx_nudge", 0, 1, 1, 0.25:CheckTilt
  162.  
  163. If bGameInPlay AND NOT Tilted Then
  164. If keycode = LeftFlipperKey Then SolLFlipper 1
  165. If keycode = RightFlipperKey Then SolRFlipper 1
  166. If keycode = StartGameKey Then
  167. If((PlayersPlayingGame < MaxPlayers)AND(bOnTheFirstBall = True))Then
  168. If(bFreePlay = True)Then
  169. PlayersPlayingGame = PlayersPlayingGame + 1
  170. PlaySound "start"
  171. Else
  172. If(Credits > 0)then
  173. PlayersPlayingGame = PlayersPlayingGame + 1
  174. Credits = Credits - 1
  175. UpdateCredits
  176. UpdateBallInPlay
  177. PlaySound "so_start"
  178. Else
  179. PlaySound "10000"
  180. End If
  181. End If
  182. End If
  183. End If
  184. Else
  185. If keycode = StartGameKey Then
  186. If(bFreePlay = True)Then
  187. If(BallsOnPlayfield = 0)Then
  188. ResetScores
  189. ResetForNewGame()
  190. PlaySound "start"
  191. End If
  192. Else
  193. If(Credits > 0)Then
  194. If(BallsOnPlayfield = 0)Then
  195. Credits = Credits - 1
  196. UpdateCredits
  197. ResetScores
  198. ResetForNewGame()
  199. PlaySound "start"
  200. End If
  201. Else
  202.  
  203. PlaySound "10000"
  204. End If
  205. End If
  206. End If
  207. End If
  208. End Sub
  209.  
  210. Sub Table1_KeyUp(ByVal keycode)
  211.  
  212. If keycode = LeftMagnaSave Then bLutActive = False
  213.  
  214. If bGameInPlay AND NOT Tilted Then
  215. If keycode = LeftFlipperKey Then SolLFlipper 0
  216. If keycode = RightFlipperKey Then SolRFlipper 0
  217. End If
  218. If keycode = PlungerKey Then
  219. Plunger.Fire
  220. If bBallInPlungerLane Then
  221. PlaySoundAt "fx_plunger", plunger
  222. Else
  223. PlaySoundAt "fx_plunger_empty", plunger
  224. End If
  225. End If
  226. End Sub
  227.  
  228. '*********
  229. ' LUT
  230. '*********
  231.  
  232. Dim bLutActive, LUTImage
  233. Sub LoadLUT
  234. bLutActive = False
  235. x = LoadValue(cGameName, "LUTImage")
  236. If(x <> "")Then LUTImage = x Else LUTImage = 0
  237. UpdateLUT
  238. End Sub
  239.  
  240. Sub SaveLUT
  241. SaveValue cGameName, "LUTImage", LUTImage
  242. End Sub
  243.  
  244. Sub NextLUT:LUTImage = (LUTImage + 1)MOD 9:UpdateLUT:SaveLUT:End Sub
  245.  
  246. Sub UpdateLUT
  247. Select Case LutImage
  248. Case 0:table1.ColorGradeImage = "LUT0"
  249. Case 1:table1.ColorGradeImage = "LUT1"
  250. Case 2:table1.ColorGradeImage = "LUT2"
  251. Case 3:table1.ColorGradeImage = "LUT3"
  252. Case 4:table1.ColorGradeImage = "LUT4"
  253. Case 5:table1.ColorGradeImage = "LUT5"
  254. Case 6:table1.ColorGradeImage = "LUT6"
  255. Case 7:table1.ColorGradeImage = "LUT7"
  256. Case 8:table1.ColorGradeImage = "LUT8"
  257. End Select
  258. End Sub
  259.  
  260. '*************
  261. ' Pause/exit
  262. '*************
  263.  
  264. Sub table1_Paused
  265. End Sub
  266.  
  267. Sub table1_unPaused
  268. End Sub
  269.  
  270. Sub table1_Exit
  271. Savehs
  272. If B2SOn Then Controller.Stop
  273. End Sub
  274.  
  275. '*******************
  276. ' Flipper Subs v3.0
  277. '*******************
  278.  
  279. Sub SolLFlipper(Enabled)
  280. If Enabled Then
  281. PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper
  282. LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
  283. Else
  284. PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper
  285. LeftFlipper.EOSTorque = 0.1:LeftFlipper.RotateToStart
  286. End If
  287. End Sub
  288.  
  289. Sub SolRFlipper(Enabled)
  290. If Enabled Then
  291. PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper
  292. RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
  293. Else
  294. PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper
  295. RightFlipper.EOSTorque = 0.1:RightFlipper.RotateToStart
  296. End If
  297. End Sub
  298.  
  299. Sub LeftFlipper_Collide(parm)
  300. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
  301. End Sub
  302.  
  303. Sub RightFlipper_Collide(parm)
  304. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
  305. End Sub
  306.  
  307. '*******************
  308. ' GI lights
  309. '*******************
  310.  
  311. Sub GiOn 'enciende las luces GI
  312. Dim bulb
  313. For each bulb in aGiLights
  314. bulb.State = 1
  315. Next
  316. If B2SOn Then Controller.B2SSetData 60, 1
  317. End Sub
  318.  
  319. Sub GiOff 'apaga las luces GI
  320. Dim bulb
  321. For each bulb in aGiLights
  322. bulb.State = 0
  323. Next
  324. If B2SOn Then Controller.B2SSetData 60, 0
  325. End Sub
  326.  
  327. '**************
  328. ' TILT
  329. '**************
  330.  
  331. Sub CheckTilt
  332. Tilt = Tilt + TiltSensitivity
  333. TiltDecreaseTimer.Enabled = True
  334. If Tilt > 15 Then
  335. PlaySound "so_tilt"
  336. Tilted = True
  337. TiltL.State = 1
  338. If B2SOn then
  339. Controller.B2SSetTilt 1
  340. end if
  341. DisableTable True
  342. TiltRecoveryTimer.Enabled = True
  343. End If
  344. End Sub
  345.  
  346. Sub TiltDecreaseTimer_Timer
  347. If Tilt > 0 Then
  348. Tilt = Tilt - 0.1
  349. Else
  350. TiltDecreaseTimer.Enabled = False
  351. End If
  352. End Sub
  353.  
  354. Sub DisableTable(Enabled)
  355. If Enabled Then
  356. GiOff
  357. LeftFlipper.RotateToStart
  358. RightFlipper.RotateToStart
  359. Bumper1.Force = 0
  360. Bumper2.Force = 0
  361. Else
  362. GiOn
  363. Bumper1.Force = 10
  364. Bumper2.Force = 10
  365. End If
  366. End Sub
  367.  
  368. Sub TiltRecoveryTimer_Timer()
  369. If(BallsOnPlayfield = 0)Then
  370. EndOfBall()
  371. TiltRecoveryTimer.Enabled = False
  372. End If
  373. End Sub
  374.  
  375. '***************************************************************
  376. ' Supporting Ball & Sound Functions v3.0
  377. ' includes random pitch in PlaySoundAt and PlaySoundAtBall
  378. '***************************************************************
  379.  
  380. Dim TableWidth, TableHeight
  381.  
  382. TableWidth = Table1.width
  383. TableHeight = Table1.height
  384.  
  385. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  386. Vol = Csng(BallVel(ball) ^2 / 2000)
  387. End Function
  388.  
  389. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  390. Dim tmp
  391. tmp = ball.x * 2 / TableWidth-1
  392. If tmp > 0 Then
  393. Pan = Csng(tmp ^10)
  394. Else
  395. Pan = Csng(-((- tmp) ^10))
  396. End If
  397. End Function
  398.  
  399. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  400. Pitch = BallVel(ball) * 20
  401. End Function
  402.  
  403. Function BallVel(ball) 'Calculates the ball speed
  404. BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
  405. End Function
  406.  
  407. Function AudioFade(ball) 'only on VPX 10.4 and newer
  408. Dim tmp
  409. tmp = ball.y * 2 / TableHeight-1
  410. If tmp > 0 Then
  411. AudioFade = Csng(tmp ^10)
  412. Else
  413. AudioFade = Csng(-((- tmp) ^10))
  414. End If
  415. End Function
  416.  
  417. Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
  418. PlaySound soundname, 0, 1, Pan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
  419. End Sub
  420.  
  421. Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
  422. PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.4, 0, 0, 0, AudioFade(ActiveBall)
  423. End Sub
  424.  
  425. '***********************************************
  426. ' JP's VP10 Rolling Sounds + Ballshadow v3.0
  427. ' uses a collection of shadows, aBallShadow
  428. '***********************************************
  429.  
  430. Const tnob = 19 'total number of balls, 20 balls, from 0 to 19
  431. Const lob = 0 'number of locked balls
  432. Const maxvel = 32 'max ball velocity 25-50
  433. ReDim rolling(tnob)
  434. InitRolling
  435.  
  436. Sub InitRolling
  437. Dim i
  438. For i = 0 to tnob
  439. rolling(i) = False
  440. Next
  441. End Sub
  442.  
  443. Sub RollingUpdate()
  444. Dim BOT, b, ballpitch, ballvol, speedfactorx, speedfactory
  445. BOT = GetBalls
  446.  
  447. ' stop the sound of deleted balls and hide the shadow
  448. For b = UBound(BOT) + 1 to tnob
  449. rolling(b) = False
  450. StopSound("fx_ballrolling" & b)
  451. aBallShadow(b).Y = 3000
  452. Next
  453.  
  454. ' exit the sub if no balls on the table
  455. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  456.  
  457. ' play the rolling sound for each ball and draw the shadow
  458. For b = lob to UBound(BOT)
  459. aBallShadow(b).X = BOT(b).X
  460. aBallShadow(b).Y = BOT(b).Y
  461.  
  462. If BallVel(BOT(b)) > 1 Then
  463. If BOT(b).z < 30 Then
  464. ballpitch = Pitch(BOT(b))
  465. ballvol = Vol(BOT(b))
  466. Else
  467. ballpitch = Pitch(BOT(b)) + 25000 'increase the pitch on a ramp
  468. ballvol = Vol(BOT(b)) * 10
  469. End If
  470. rolling(b) = True
  471. PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
  472. Else
  473. If rolling(b) = True Then
  474. StopSound("fx_ballrolling" & b)
  475. rolling(b) = False
  476. End If
  477. End If
  478.  
  479. ' rothbauerw's Dropping Sounds
  480. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  481. PlaySound "fx_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  482. End If
  483.  
  484. ' jps ball speed control
  485. If BOT(b).VelX AND BOT(b).VelY <> 0 Then
  486. speedfactorx = ABS(maxvel / BOT(b).VelX)
  487. speedfactory = ABS(maxvel / BOT(b).VelY)
  488. If speedfactorx < 1 Then
  489. BOT(b).VelX = BOT(b).VelX * speedfactorx
  490. BOT(b).VelY = BOT(b).VelY * speedfactorx
  491. End If
  492. If speedfactory < 1 Then
  493. BOT(b).VelX = BOT(b).VelX * speedfactory
  494. BOT(b).VelY = BOT(b).VelY * speedfactory
  495. End If
  496. End If
  497. Next
  498. End Sub
  499.  
  500. '*****************************
  501. ' Ball to ball hit sound
  502. '*****************************
  503.  
  504. Sub OnBallBallCollision(ball1, ball2, velocity)
  505. PlaySound "fx_collide", 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  506. End Sub
  507.  
  508. '************************************
  509. ' Diverse Collection Hit Sounds v3.0
  510. '************************************
  511.  
  512. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  513. Sub aMetalWires_Hit(idx):PlaySoundAtBall "fx_MetalWire":End Sub
  514. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  515. Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
  516. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  517. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  518. Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
  519. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  520. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  521. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  522.  
  523. '************************************************************************************************************************
  524. 'FlashForMs will blink a light for a total time of"TotalPeriod" every each miliseconds "BlinkPeriod"
  525. 'When "TotalPeriod" is finished, the light state will be set to the value of "FinalState"
  526. '"FinalState" can be: 0=off, 1=on, 2=original state
  527. '************************************************************************************************************************
  528.  
  529. Sub FlashForMs(MyLight, TotalPeriod, BlinkPeriod, FinalState)
  530.  
  531. If TypeName(MyLight) = "Light" Then
  532. If FinalState = 2 Then
  533. FinalState = MyLight.State
  534. End If
  535. MyLight.BlinkInterval = BlinkPeriod
  536. MyLight.Duration 2, TotalPeriod, FinalState
  537. ElseIf TypeName(MyLight) = "Flasher" Then
  538. Dim steps
  539. steps = Int(TotalPeriod / BlinkPeriod + .5)
  540. If FinalState = 2 Then
  541. FinalState = ABS(MyLight.Visible)
  542. End If
  543. MyLight.UserValue = steps * 10 + FinalState
  544. MyLight.TimerInterval = BlinkPeriod
  545. MyLight.TimerEnabled = 0
  546. MyLight.TimerEnabled = 1
  547. ExecuteGlobal "Sub " & MyLight.Name & "_Timer:" & "Dim tmp, steps, fstate:tmp=me.UserValue:fstate = tmp MOD 10:steps= tmp\10 -1:Me.Visible = steps MOD 2:me.UserValue = steps *10 + fstate:If Steps = 0 then Me.Visible = fstate:Me.TimerEnabled=0:End if:End Sub"
  548. End If
  549. End Sub
  550.  
  551. '****************************************
  552. ' Init the table for a new game
  553. '****************************************
  554.  
  555. Sub ResetForNewGame()
  556. 'debug.print "ResetForNewGame"
  557. Dim i
  558. bGameInPLay = True
  559. bBallSaverActive = False
  560. StopAttractMode
  561. If B2SOn then
  562. Controller.B2SSetGameOver 0
  563. end if
  564. GiOn
  565. CurrentPlayer = 1
  566. PlayersPlayingGame = 1
  567. bOnTheFirstBall = True
  568. For i = 1 To MaxPlayers
  569. Score(i) = 0
  570. ExtraBallsAwards(i) = 0
  571. Special1Awarded(i) = False
  572. Special2Awarded(i) = False
  573. Special3Awarded(i) = False
  574. BallsRemaining(i) = BallsPerGame
  575. Bonus(i) = 0
  576. Next
  577. BonusMultiplier = 1
  578. UpdateBallInPlay
  579. Clear_Match
  580. Tilt = 0
  581. Game_Init()
  582. ' start music?
  583. vpmtimer.addtimer 2000, "FirstBall '"
  584. End Sub
  585.  
  586. Sub FirstBall
  587. 'debug.print "FirstBall"
  588. ResetForNewPlayerBall()
  589. CreateNewBall()
  590. End Sub
  591.  
  592. Sub ResetForNewPlayerBall()
  593. 'debug.print "ResetForNewPlayerBall"
  594. AddScore 0
  595. ' Bonus(CurrentPlayer) = 0
  596. BonusMultiplier = 1
  597. UpdateBonusLights
  598. bExtraBallWonThisBall = False
  599. ResetNewBallVariables
  600. ResetNewBallLights
  601. End Sub
  602.  
  603. Sub CreateNewBall()
  604. BallRelease.CreateSizedBallWithMass BallSize / 2, BallMass
  605. BallsOnPlayfield = BallsOnPlayfield + 1
  606. UpdateBallInPlay
  607. PlaySoundAt SoundFXDOF( "fx_Ballrel", 110, DOFPulse, DOFContactors), BallRelease
  608. PlaySound "so_start"
  609. BallRelease.Kick 90, 4
  610. End Sub
  611.  
  612. Sub EndOfBall()
  613. 'debug.print "EndOfBall"
  614. Dim AwardPoints, ii
  615. AwardPoints = 0
  616. bOnTheFirstBall = False
  617. If NOT Tilted Then
  618. BonusCountTimer.Interval = 200
  619. CreditLight.State = 2 'taito tables
  620. BonusCountTimer.Enabled = 1
  621. Else
  622. vpmtimer.addtimer 400, "EndOfBall2 '"
  623. End If
  624. End Sub
  625.  
  626. Sub BonusCountTimer_Timer
  627. 'debug.print "BonusCount_Timer"
  628. If BonusCount > 0 Then
  629. BonusCount = BonusCount -1
  630. AddScore BonusValue * BonusMultiplier
  631. PlaySound "so_bonus"
  632. UpdateBonusLights
  633. Else
  634. CreditLight.State = 0 'Taito tables
  635. BonusCount = Bonus(CurrentPlayer)
  636. UpdateBonusLights
  637. BonusCountTimer.Enabled = 0
  638. vpmtimer.addtimer 1000, "EndOfBall2 '"
  639. End If
  640. End Sub
  641.  
  642. Sub EndOfBall2()
  643. 'debug.print "EndOfBall2"
  644. Tilted = False
  645. Tilt = 0
  646. TiltL.State = 0
  647. If B2SOn then
  648. Controller.B2SSetTilt 0
  649. end if
  650. DisableTable False
  651.  
  652. If(ExtraBallsAwards(CurrentPlayer) > 0)Then
  653. 'debug.print "Extra Ball"
  654. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer)- 1
  655. If(ExtraBallsAwards(CurrentPlayer) = 0)Then
  656. LightShootAgain.State = 0
  657. If B2SOn then
  658. Controller.B2SSetShootAgain 0
  659. end if
  660. End If
  661.  
  662. ' blink a extra ball light? dmd?
  663. ResetForNewPlayerBall()
  664. CreateNewBall()
  665. Else
  666. BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer)- 1
  667. If(BallsRemaining(CurrentPlayer) <= 0)Then
  668. CheckHighScore()
  669. End If
  670. EndOfBallComplete()
  671. End If
  672. End Sub
  673.  
  674. Sub EndOfBallComplete()
  675. 'debug.print "EndOfBall Complete"
  676. Dim NextPlayer
  677. If(PlayersPlayingGame > 1)Then
  678. NextPlayer = CurrentPlayer + 1
  679. If(NextPlayer > PlayersPlayingGame)Then
  680. NextPlayer = 1
  681. End If
  682. Else
  683. NextPlayer = CurrentPlayer
  684. End If
  685. 'debug.print "Next Player = " & NextPlayer
  686. If((BallsRemaining(CurrentPlayer) <= 0)AND(BallsRemaining(NextPlayer) <= 0))Then
  687. If bFreePlay = False Then
  688. Verification_Match
  689. End If
  690. EndOfGame()
  691. Else
  692. CurrentPlayer = NextPlayer
  693. AddScore 0
  694. ResetForNewPlayerBall()
  695. CreateNewBall()
  696. End If
  697. End Sub
  698.  
  699. Sub EndOfGame()
  700. 'debug.print "EndOfGame"
  701. PlaySound "so_gameover"
  702. bGameInPLay = False
  703. bJustStarted = False
  704. If B2SOn then
  705. Controller.B2SSetGameOver 1
  706. Controller.B2SSetBallInPlay 0
  707. Controller.B2SSetPlayerUp 0
  708. Controller.B2SSetCanPlay 0
  709. end if
  710. SolLFlipper 0
  711. SolRFlipper 0
  712. StartAttractMode
  713. End Sub
  714.  
  715. ' Balls left?
  716. Function Balls
  717. Dim tmp
  718. tmp = BallsPerGame - BallsRemaining(CurrentPlayer) + 1
  719. If tmp > BallsPerGame Then
  720. Balls = BallsPerGame
  721. Else
  722. Balls = tmp
  723. End If
  724. End Function
  725.  
  726. Sub CheckHighscore
  727. For x = 1 to PlayersPlayingGame
  728. If Score(x) > Highscore Then
  729. Highscore = Score(x)
  730. PlaySound SoundFXDOF("fx_knocker", 121, DOFPulse, DOFContactors)
  731. NewL.State = 1
  732. If B2SOn then Controller.B2SSetData 59, 1 'STAT Change, New as ID 59 on B2S
  733. RecordL.State = 1
  734. If B2SOn then Controller.B2SSetData 60, 1 'STAT Change, Record as ID 60 on B2S
  735. 'HighscoreReel.SetValue Highscore
  736. AddCredits 1
  737. End If
  738. Next
  739. End Sub
  740.  
  741. '******************
  742. ' Match - Loteria
  743. '******************
  744.  
  745. Sub Verification_Match()
  746. 'PlaySound "fx_match"
  747. Match = INT(RND * 10)
  748. If(Score(CurrentPlayer)MOD 10) = Match Then
  749. PlaySound SoundFXDOF("fx_knocker", 121, DOFPulse, DOFContactors)
  750. AddCredits 1
  751. If B2SOn then Controller.B2SSetScore 8, Match 'STAT Change, Match 1 Digit 0-9 Score ID 8 at BG
  752. End If
  753. End Sub
  754.  
  755. Sub Clear_Match()
  756. MatchReel.SetValue 0
  757. If B2SOn then Controller.B2SSetScore 8, 0 'STAT Change, Match 1 Digit 0-9 Score ID 8 at BG
  758. End Sub
  759.  
  760. ' ******************************
  761. ' Drain / Plunger Functions
  762. ' ******************************
  763.  
  764. Sub Drain_Hit()
  765. Drain.DestroyBall
  766. BallsOnPlayfield = BallsOnPlayfield - 1
  767. PlaySoundAt "fx_drain", Drain
  768.  
  769. If Tilted Then
  770. Exit Sub
  771. End If
  772.  
  773. If bGameInPLay = True Then
  774. If(bBallSaverActive = True)Then
  775. CreateNewBall()
  776. Else
  777. If(BallsOnPlayfield = 0)Then
  778. vpmtimer.addtimer 500, "EndOfBall '"
  779. Exit Sub
  780. End If
  781. End If
  782. End If
  783. End Sub
  784.  
  785. Sub swPlungerRest_Hit()
  786. bBallInPlungerLane = True
  787. End Sub
  788.  
  789. Sub swPlungerRest_UnHit()
  790. bBallInPlungerLane = False
  791. 'start a ball save counter?
  792. End Sub
  793.  
  794. ' *******************
  795. ' SCORE functions
  796. ' *******************
  797.  
  798. Sub AddScore(Points)
  799. If Tilted Then Exit Sub
  800. Score(CurrentPlayer) = Score(CurrentPlayer) + points
  801. UpdateScore points
  802.  
  803. If Score(CurrentPlayer) >= Special1 AND Special1Awarded(CurrentPlayer) = False Then
  804. AwardSpecial
  805. Special1Awarded(CurrentPlayer) = True
  806. End If
  807. If Score(CurrentPlayer) >= Special2 AND Special2Awarded(CurrentPlayer) = False Then
  808. AwardSpecial
  809. Special2Awarded(CurrentPlayer) = True
  810. End If
  811. If Score(CurrentPlayer) >= Special3 AND Special3Awarded(CurrentPlayer) = False Then
  812. AwardSpecial
  813. Special3Awarded(CurrentPlayer) = True
  814. End If
  815. End Sub
  816.  
  817. '*******************
  818. ' BONUS
  819. '*******************
  820.  
  821. Sub AddBonus(bonuspoints)
  822. If(Tilted = False)Then
  823. Bonus(CurrentPlayer) = Bonus(CurrentPlayer) + bonuspoints
  824. If Bonus(CurrentPlayer) > 18 then
  825. Bonus(CurrentPlayer) = 18
  826. End if
  827. BonusCount = Bonus(CurrentPlayer)
  828. LightSeqGoal.UpdateInterval = 1
  829. LightSeqGoal.Play SeqClockRightOn, 30, 3
  830. UpdateBonusLights
  831. End if
  832. End Sub
  833.  
  834. Sub AddBonusMultiplier(points)
  835. If(Tilted = False)Then
  836. li80.State = 1
  837. BonusMultiplier = BonusMultiplier + points
  838. If BonusMultiplier = 6 AND li42.State = 0 Then 'lit special
  839. If li119.State = 0 Then
  840. li129.State = 1
  841. li42.State = 1
  842. End If
  843. End If
  844. If BonusMultiplier > 3 Then BonusMultiplier = 5
  845. UpdateBonusLights
  846. End if
  847. End Sub
  848.  
  849. Sub UpdateBonusLights
  850. Select Case BonusCount
  851. Case 0:b1.State = 0:b2.State = 0:b3.State = 0:b4.State = 0:b5.State = 0:b6.State = 0:b7.State = 0:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  852. Case 1:b1.State = 1:b2.State = 0:b3.State = 0:b4.State = 0:b5.State = 0:b6.State = 0:b7.State = 0:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  853. Case 2:b1.State = 1:b2.State = 1:b3.State = 0:b4.State = 0:b5.State = 0:b6.State = 0:b7.State = 0:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  854. Case 3:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 0:b5.State = 0:b6.State = 0:b7.State = 0:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  855. Case 4:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 0:b6.State = 0:b7.State = 0:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  856. Case 5:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 0:b7.State = 0:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  857. Case 6:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 0:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  858. Case 7:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 0:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  859. Case 8:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 0:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  860. Case 9:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 0:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  861. Case 10:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 0:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  862. Case 11:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 0:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  863. Case 12:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 1:b13.State = 0:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  864. Case 13:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 1:b13.State = 1:b14.State = 0:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  865. Case 14:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 1:b13.State = 1:b14.State = 1:b15.State = 0:b16.State = 0:b17.State = 0:b18.State = 0
  866. Case 15:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 1:b13.State = 1:b14.State = 1:b15.State = 1:b16.State = 0:b17.State = 0:b18.State = 0
  867. Case 16:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 1:b13.State = 1:b14.State = 1:b15.State = 1:b16.State = 1:b17.State = 0:b18.State = 0
  868. Case 17:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 1:b13.State = 1:b14.State = 1:b15.State = 1:b16.State = 1:b17.State = 1:b18.State = 0
  869. Case 18:b1.State = 1:b2.State = 1:b3.State = 1:b4.State = 1:b5.State = 1:b6.State = 1:b7.State = 1:b8.State = 1:b9.State = 1:b10.State = 1:b11.State = 1:b12.State = 1:b13.State = 1:b14.State = 1:b15.State = 1:b16.State = 1:b17.State = 1:b18.State = 1
  870. End Select
  871. Select Case BonusMultiplier
  872. Case 1:bm2.State = 0:bm3.State = 0:bm5.State = 0
  873. Case 2:bm2.State = 1:bm3.State = 0:bm5.State = 0
  874. Case 3:bm2.State = 0:bm3.State = 1:bm5.State = 0
  875. Case 5:bm2.State = 0:bm3.State = 0:bm5.State = 1:li121.State = 1:li71.State = 1
  876. End Select
  877. End Sub
  878.  
  879. Sub UpdateScore(playerpoints)
  880. Select Case CurrentPlayer
  881. Case 1:ScoreReel1.Addvalue playerpoints
  882. Case 2:ScoreReel2.Addvalue playerpoints
  883. Case 3:ScoreReel3.Addvalue playerpoints
  884. Case 4:ScoreReel4.Addvalue playerpoints
  885. End Select
  886. If B2SOn then
  887. Controller.B2SSetScorePlayer CurrentPlayer, Score(CurrentPlayer)
  888. end if
  889. End Sub
  890.  
  891. ' pone todos los marcadores a 0
  892. Sub ResetScores
  893. ScoreReel1.ResetToZero
  894. ScoreReel2.ResetToZero
  895. ScoreReel3.ResetToZero
  896. ScoreReel4.ResetToZero
  897. If B2SOn then
  898. Controller.B2SSetScorePlayer1 0
  899. Controller.B2SSetScorePlayer2 0
  900. Controller.B2SSetScorePlayer3 0
  901. Controller.B2SSetScorePlayer4 0
  902. Controller.B2SSetScoreRolloverPlayer1 0
  903. Controller.B2SSetScoreRolloverPlayer2 0
  904. Controller.B2SSetScoreRolloverPlayer3 0
  905. Controller.B2SSetScoreRolloverPlayer4 0
  906. end if
  907. End Sub
  908.  
  909. Sub AddCredits(value)
  910. If Credits < 9 Then
  911. Credits = Credits + value
  912. UpdateCredits
  913. end if
  914. End Sub
  915.  
  916. Sub UpdateCredits
  917. If Credits > 0 Then 'this is for Bally tables
  918. 'CreditLight.State = 1
  919. Else
  920. 'CreditLight.State = 0
  921. End If
  922. CreditReel.SetValue Credits
  923. If B2SOn then Controller.B2SSetScore 6, Credits 'STAT Change, Note: only 1 Digit (0-9)
  924. End Sub
  925.  
  926. Sub UpdateBallInPlay
  927. BallInPlayReel.SetValue Balls
  928. If B2SOn then
  929. 'Controller.B2SSetBallInPlay Balls
  930. Controller.B2SSetScore 5, Balls 'STAT Change
  931. end if
  932. Select Case CurrentPlayer
  933. Case 1:pl1.State = 1:pl2.State = 0:pl3.State = 0:pl4.State = 0
  934. Case 2:pl1.State = 0:pl2.State = 1:pl3.State = 0:pl4.State = 0
  935. Case 3:pl1.State = 0:pl2.State = 0:pl3.State = 1:pl4.State = 0
  936. Case 4:pl1.State = 0:pl2.State = 0:pl3.State = 0:pl4.State = 1
  937. End Select
  938. If B2SOn then
  939. Controller.B2SSetPlayerUp CurrentPlayer
  940. end if
  941. PlayersReel.SetValue PlayersPlayingGame
  942. If B2SOn then
  943. 'Controller.B2SSetCanPlay PlayersPlayingGame
  944. Controller.B2SSetScore 7, PlayersPlayingGame 'STAT Change
  945. end if
  946. End Sub
  947.  
  948. '*************************
  949. ' Special & Extra Ball
  950. '*************************
  951.  
  952. Sub AwardExtraBall()
  953. If NOT bExtraBallWonThisBall Then
  954. PlaySound SoundFXDOF("fx_knocker", 121, DOFPulse, DOFContactors)
  955. PlaySound "so_shootagain"
  956. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) + 1
  957. bExtraBallWonThisBall = True
  958. LightShootAgain.State = 1
  959. If B2SOn then
  960. Controller.B2SSetShootAgain 1
  961. end if
  962. END If
  963. End Sub
  964.  
  965. Sub AwardSpecial()
  966. PlaySound SoundFXDOF("fx_knocker", 121, DOFPulse, DOFContactors)
  967. PlaySound "so_special"
  968. AddCredits 1
  969. End Sub
  970.  
  971. ' ********************************
  972. ' Attract Mode
  973. ' ********************************
  974.  
  975. Sub StartAttractMode()
  976. bAttractMode = True
  977. For each x in aLights
  978. x.State = 2
  979. Next
  980. GameOverL.State = 1
  981. AttractTimer.Enabled = 1
  982. End Sub
  983.  
  984. Sub StopAttractMode()
  985. bAttractMode = False
  986. ResetScores
  987. For each x in aLights
  988. x.State = 0
  989. Next
  990. GameOverL.State = 0
  991. NewL.State = 0
  992. If B2SOn then Controller.B2SSetData 59, 0 'STAT Change, New as ID 59 on B2S
  993. RecordL.State = 0
  994. If B2SOn then Controller.B2SSetData 60, 0 'STAT Change, Record as ID 60 on B2S
  995. AttractTimer.Enabled = 0
  996. End Sub
  997.  
  998. Dim AttractStep
  999. AttractStep = 0
  1000.  
  1001. Sub AttractTimer_Timer 'shows highscore
  1002. Select Case AttractStep
  1003. Case 0
  1004. AttractStep = 1
  1005. ScoreReel1.SetValue Score(1)
  1006. ScoreReel2.SetValue Score(2)
  1007. ScoreReel3.SetValue Score(3)
  1008. ScoreReel4.SetValue Score(4)
  1009. RecordL.State = 0
  1010. If B2SOn then
  1011. Controller.B2SSetScorePlayer1 Score(1)
  1012. Controller.B2SSetScorePlayer2 Score(2)
  1013. Controller.B2SSetScorePlayer3 Score(3)
  1014. Controller.B2SSetScorePlayer4 Score(4)
  1015. Controller.B2SSetData 60, 0 'STAT Change, Record as ID 60 on B2S
  1016. end if
  1017. Case 1
  1018. AttractStep = 0
  1019. ScoreReel1.SetValue Highscore
  1020. ScoreReel2.SetValue Highscore
  1021. ScoreReel3.SetValue Highscore
  1022. ScoreReel4.SetValue Highscore
  1023. RecordL.State = 1
  1024. If B2SOn then
  1025. Controller.B2SSetScorePlayer1 Highscore
  1026. Controller.B2SSetScorePlayer2 Highscore
  1027. Controller.B2SSetScorePlayer3 Highscore
  1028. Controller.B2SSetScorePlayer4 Highscore
  1029. Controller.B2SSetData 60, 1 'STAT Change, Record as ID 60 on B2S
  1030. end if
  1031. End Select
  1032. End Sub
  1033.  
  1034. '*****************************
  1035. ' Load / Save / Highscore
  1036. '*****************************
  1037.  
  1038. Sub Loadhs
  1039. x = LoadValue(TableName, "HighScore")
  1040. If(x <> "")Then HighScore = CDbl(x)Else HighScore = 0 End If
  1041. x = LoadValue(TableName, "Credits")
  1042. If(x <> "")then Credits = CInt(x)Else Credits = 0 End If
  1043. End Sub
  1044.  
  1045. Sub Savehs
  1046. SaveValue TableName, "HighScore", HighScore
  1047. SaveValue TableName, "Credits", Credits
  1048. End Sub
  1049.  
  1050. Sub Reseths
  1051. HighScore = 0
  1052. Savehs
  1053. End Sub
  1054.  
  1055. '*******************
  1056. ' Real time updates
  1057. '*******************
  1058. ' rolling sound, flipper tops, animations, gates
  1059.  
  1060. Sub GameTimer_Timer
  1061. RollingUpdate
  1062. LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
  1063. RightFlipperTop.RotZ = RightFlipper.CurrentAngle
  1064. End Sub
  1065.  
  1066. '***********************************************************************
  1067. ' *********************************************************************
  1068. ' TABLE SPECIFIC CODE STARTS HERE
  1069. ' *********************************************************************
  1070. '***********************************************************************
  1071.  
  1072. Sub VPObjects_Init 'mostly dropwalls
  1073. End Sub
  1074.  
  1075. ' tables own variables
  1076. Dim Advances
  1077. Dim sw54hits
  1078. Dim sw53hits
  1079. Dim kickerPos ' only one ball so we only need one variable for the animations
  1080. Dim Goalready
  1081.  
  1082. Sub Game_Init() 'called at the start of a new game
  1083. Dim i
  1084. 'start music?
  1085. 'init variables
  1086. Advances = 0
  1087. sw54hits = 0
  1088. sw53hits = 0
  1089. 'statrt a timer?
  1090. 'Init some lights?
  1091. TurnOffPlayfieldLights()
  1092. End Sub
  1093.  
  1094. Sub ResetNewBallVariables()
  1095. Goalready = False
  1096. BonusMultiplier = 1
  1097. Advances = 0
  1098. sw54hits = 0
  1099. sw53hits = 0
  1100. End Sub
  1101.  
  1102. Sub ResetNewBallLights()
  1103. TurnOffPlayfieldLights()
  1104. UpdateBonusLights
  1105. UpdateAdvances
  1106. ResetGoalLights
  1107. li133.State = 1
  1108. li133a.State = 1
  1109. End Sub
  1110.  
  1111. Sub TurnOffPlayfieldLights()
  1112. For each x in aLights
  1113. x.State = 0
  1114. Next
  1115. End Sub
  1116.  
  1117. '******************************************
  1118. ' Table Hit events
  1119. '
  1120. ' Each switch/target should do:
  1121. ' - play a physical sound
  1122. ' - check for tilt
  1123. ' - animation?
  1124. ' - add a score
  1125. ' - change lights?
  1126. ' - check for completion of something
  1127. '*******************************************
  1128.  
  1129. '******************************
  1130. ' Ball advances
  1131. '******************************
  1132.  
  1133. Sub AddAdvance(points)
  1134. If li81.State Then Exit Sub
  1135. Advances = Advances + points
  1136. UpdateAdvances
  1137. End Sub
  1138.  
  1139. Sub UpdateAdvances
  1140. Select Case Advances
  1141. Case 0:li133.State = 0:li133a.State = 0:li50.State = 0:li50a.State = 0:li51.State = 0:li51a.State = 0:li52.State = 0:li52a.State = 0
  1142. Case 1:li133.State = 1:li133a.State = 1:li50.State = 0:li50a.State = 0:li51.State = 0:li51a.State = 0:li52.State = 0:li52a.State = 0
  1143. Case 2:li133.State = 0:li133a.State = 0:li50.State = 1:li50a.State = 1:li51.State = 0:li51a.State = 0:li52.State = 0:li52a.State = 0
  1144. Case 3:li133.State = 0:li133a.State = 0:li50.State = 0:li50a.State = 0:li51.State = 1:li51a.State = 1:li52.State = 0:li52a.State = 0
  1145. Case 4:li133.State = 0:li133a.State = 0:li50.State = 0:li50a.State = 0:li51.State = 0:li51a.State = 0:li52.State = 1:li52a.State = 1
  1146. Case Else:li133.State = 0:li133a.State = 0:li50.State = 0:li50a.State = 0:li51.State = 0:li51a.State = 0:li52.State = 0:li52a.State = 0
  1147. li81.State = 1
  1148. li100.State = 1
  1149. li99.State = 1
  1150. Advances = 0
  1151. End Select
  1152. End Sub
  1153.  
  1154. Sub sw12_Hit
  1155. PlaySoundAt "fx_sensor", sw12
  1156. If Tilted Then Exit Sub
  1157. If li133.State Then
  1158. AddAdvance 1
  1159. playsound "so_staron"
  1160. Else
  1161. PlaySound "so_staroff"
  1162. End If
  1163. End Sub
  1164.  
  1165. Sub sw12a_Hit
  1166. PlaySoundAt "fx_sensor", sw12a
  1167. If Tilted Then Exit Sub
  1168. If li133a.State Then
  1169. AddAdvance 1
  1170. playsound "so_staron"
  1171. Else
  1172. PlaySound "so_staroff"
  1173. End If
  1174. End Sub
  1175.  
  1176. Sub sw22_Hit
  1177. PlaySoundAt "fx_sensor", sw22
  1178. If Tilted Then Exit Sub
  1179. If li50.State Then
  1180. AddAdvance 1
  1181. End If
  1182. End Sub
  1183.  
  1184. Sub sw22a_Hit
  1185. PlaySoundAt "fx_sensor", sw22a
  1186. If Tilted Then Exit Sub
  1187. If li50a.State Then
  1188. AddAdvance 1
  1189. playsound "so_staron"
  1190. Else
  1191. PlaySound "so_staroff"
  1192. End If
  1193. End Sub
  1194.  
  1195. Sub sw32_Hit
  1196. PlaySoundAt "fx_sensor", sw32
  1197. If Tilted Then Exit Sub
  1198. If li51.State Then
  1199. AddAdvance 1
  1200. playsound "so_staron"
  1201. Else
  1202. PlaySound "so_staroff"
  1203. End If
  1204. End Sub
  1205.  
  1206. Sub sw32a_Hit
  1207. PlaySoundAt "fx_sensor", sw32a
  1208. If Tilted Then Exit Sub
  1209. If li51a.State Then
  1210. AddAdvance 1
  1211. playsound "so_staron"
  1212. Else
  1213. PlaySound "so_staroff"
  1214. End If
  1215. End Sub
  1216.  
  1217. Sub sw42_Hit
  1218. PlaySoundAt "fx_sensor", sw42
  1219. If Tilted Then Exit Sub
  1220. If li52.State Then
  1221. AddAdvance 1
  1222. playsound "so_staron"
  1223. Else
  1224. PlaySound "so_staroff"
  1225. End If
  1226. End Sub
  1227.  
  1228. Sub sw42a_Hit
  1229. PlaySoundAt "fx_sensor", sw42a
  1230. If Tilted Then Exit Sub
  1231. If li52a.State Then
  1232. AddAdvance 1
  1233. playsound "so_staron"
  1234. Else
  1235. PlaySound "so_staroff"
  1236. End If
  1237. End Sub
  1238.  
  1239. '******************************
  1240. ' Rubbers
  1241. '******************************
  1242.  
  1243. Dim Rub1, Rub2, Rub3, Rub4, Rub5, Rub6, Rub7
  1244.  
  1245. Sub sw51_Hit
  1246. If Tilted then Exit Sub
  1247. AddScore 50
  1248. PlaySound "so_middleband"
  1249. Rub1 = 1:sw51_Timer
  1250. End Sub
  1251.  
  1252. Sub sw51_Timer
  1253. Select Case Rub1
  1254. Case 1:rubber16.Visible = 0:rubber26.Visible = 1:sw51.TimerEnabled = 1
  1255. Case 2:rubber26.Visible = 0:rubber27.Visible = 1
  1256. Case 3:rubber27.Visible = 0:rubber16.Visible = 1:sw51.TimerEnabled = 0
  1257. End Select
  1258. Rub1 = Rub1 + 1
  1259. End Sub
  1260.  
  1261. Sub sw31_Hit
  1262. If Tilted then Exit Sub
  1263. AddScore 50
  1264. PlaySound "so_lowerband"
  1265. SwapSpecialLights
  1266. Rub2 = 1:sw31_Timer
  1267. End Sub
  1268.  
  1269. Sub sw31_Timer
  1270. Select Case Rub2
  1271. Case 1:rubber35.Visible = 0:rubber36.Visible = 1:sw31.TimerEnabled = 1
  1272. Case 2:rubber36.Visible = 0:rubber37.Visible = 1
  1273. Case 3:rubber37.Visible = 0:rubber35.Visible = 1:sw31.TimerEnabled = 0
  1274. End Select
  1275. Rub2 = Rub2 + 1
  1276. End Sub
  1277.  
  1278. Sub sw23_Hit
  1279. If Tilted then Exit Sub
  1280. AddScore 50
  1281. PlaySound "so_slings"
  1282. SwapSpecialLights
  1283. Rub3 = 1:sw23_Timer
  1284. End Sub
  1285.  
  1286. Sub sw23_Timer
  1287. Select Case Rub3
  1288. Case 1:rubber29.Visible = 0:rubber6.Visible = 1:sw23.TimerEnabled = 1
  1289. Case 2:rubber6.Visible = 0:rubber7.Visible = 1
  1290. Case 3:rubber7.Visible = 0:rubber29.Visible = 1:sw23.TimerEnabled = 0
  1291. End Select
  1292. Rub3 = Rub3 + 1
  1293. End Sub
  1294.  
  1295. Sub sw33_Hit
  1296. If Tilted then Exit Sub
  1297. AddScore 50
  1298. PlaySound "so_middleband"
  1299. Rub4 = 1:sw33_Timer
  1300. End Sub
  1301.  
  1302. Sub sw33_Timer
  1303. Select Case Rub4
  1304. Case 1:rubber18.Visible = 0:rubber28.Visible = 1:sw33.TimerEnabled = 1
  1305. Case 2:rubber28.Visible = 0:rubber30.Visible = 1
  1306. Case 3:rubber30.Visible = 0:rubber18.Visible = 1:sw33.TimerEnabled = 0
  1307. End Select
  1308. Rub4 = Rub4 + 1
  1309. End Sub
  1310.  
  1311. Sub sw5_Hit
  1312. If Tilted then Exit Sub
  1313. AddScore 3
  1314. PlaySound "so_topband"
  1315. Rub5 = 1:sw5_Timer
  1316. End Sub
  1317.  
  1318. Sub sw5_Timer
  1319. Select Case Rub5
  1320. Case 1:rubber22.Visible = 0:rubber31.Visible = 1:sw5.TimerEnabled = 1
  1321. Case 2:rubber31.Visible = 0:rubber32.Visible = 1
  1322. Case 3:rubber32.Visible = 0:rubber22.Visible = 1:sw5.TimerEnabled = 0
  1323. End Select
  1324. Rub5 = Rub5 + 1
  1325. End Sub
  1326.  
  1327. Sub sw15_Hit
  1328. If Tilted then Exit Sub
  1329. AddScore 3
  1330. PlaySound "so_topband"
  1331. Rub6 = 1:sw15_Timer
  1332. End Sub
  1333.  
  1334. Sub sw15_Timer
  1335. Select Case Rub6
  1336. Case 1:rubber21.Visible = 0:rubber33.Visible = 1:sw15.TimerEnabled = 1
  1337. Case 2:rubber33.Visible = 0:rubber34.Visible = 1
  1338. Case 3:rubber34.Visible = 0:rubber21.Visible = 1:sw15.TimerEnabled = 0
  1339. End Select
  1340. Rub6 = Rub6 + 1
  1341. End Sub
  1342.  
  1343. Sub sw34_Hit
  1344. If Tilted then Exit Sub
  1345. AddScore 100
  1346. PlaySound "so_bandleftbumper"
  1347. AddAdvance 1
  1348. Rub7 = 1:sw34_Timer
  1349. End Sub
  1350.  
  1351. Sub sw34_Timer
  1352. Select Case Rub7
  1353. Case 1:rubber20.Visible = 0:rubber24.Visible = 1:sw34.TimerEnabled = 1
  1354. Case 2:rubber24.Visible = 0:rubber25.Visible = 1
  1355. Case 3:rubber25.Visible = 0:rubber20.Visible = 1:sw34.TimerEnabled = 0
  1356. End Select
  1357. Rub7 = Rub7 + 1
  1358. End Sub
  1359.  
  1360. '******************************
  1361. ' Bumpers
  1362. '******************************
  1363.  
  1364. Sub Bumper1_Hit
  1365. If Tilted Then Exit Sub
  1366. PlaySoundAt SoundFXDOF( "fx_Bumper",107,DOFPulse,DOFContactors), bumper1
  1367. PlaySound "so_bumper"
  1368. AddScore 100
  1369. End Sub
  1370.  
  1371. Sub Bumper2_Hit
  1372. If Tilted Then Exit Sub
  1373. PlaySoundAt SoundFXDOF( "fx_Bumper",109,DOFPulse,DOFContactors), bumper2
  1374. PlaySound "so_bumper"
  1375. AddScore 100
  1376. End Sub
  1377.  
  1378. '******************************
  1379. ' Outlanes
  1380. '******************************
  1381.  
  1382. Sub sw41_Hit
  1383. PlaySoundAt "fx_sensor", sw41
  1384. If Tilted Then Exit Sub
  1385. AddScore 500
  1386. If li119.State Then
  1387. AwardSpecial
  1388. li119.State = 0
  1389. PlaySound "so_special"
  1390. Else
  1391. PlaySound "so_outlane"
  1392. End If
  1393. End Sub
  1394.  
  1395. Sub sw13_Hit
  1396. PlaySoundAt "fx_sensor", sw13
  1397. If Tilted Then Exit Sub
  1398. AddScore 500
  1399. If li129.State Then
  1400. AwardSpecial
  1401. li129.State = 0
  1402. PlaySound "so_special"
  1403. Else
  1404. PlaySound "so_outlane"
  1405. End If
  1406. End Sub
  1407.  
  1408. '******************************
  1409. ' Top lanes
  1410. '******************************
  1411.  
  1412. Sub sw25_Hit
  1413. PlaySoundAt "fx_sensor", sw25
  1414. If Tilted Then Exit Sub
  1415. AddScore 100
  1416. If li153.State Then
  1417. li153.State = 0
  1418. li102.State = 0
  1419. AddAdvance 1
  1420. CheckGoal
  1421. ElseIf li70.State Then
  1422. li70.State = 0
  1423. li120.State = 0
  1424. AddAdvance 1
  1425. CheckGoal
  1426. End If
  1427. End Sub
  1428.  
  1429. Sub sw35_Hit
  1430. PlaySoundAt "fx_sensor", sw35
  1431. If Tilted Then Exit Sub
  1432. If li81.State Then 'goal is lit
  1433. AddScore 2000
  1434. AddBonus 1
  1435. If GoalReady Then
  1436. AddBonusMultiplier 1
  1437. Goalready = False
  1438. vpmtimer.AddTimer 1000, "ResetGoalLights '"
  1439. End If
  1440. TurnOffGoal
  1441. PlaySound "so_goal"
  1442. Else
  1443. AddScore 100
  1444. PlaySound "so_toplanes"
  1445. End If
  1446. If li71.State then
  1447. AwardExtraBall
  1448. li71.State = 0
  1449. End If
  1450. End Sub
  1451.  
  1452. Sub sw45_Hit
  1453. PlaySoundAt "fx_sensor", sw45
  1454. If Tilted Then Exit Sub
  1455. AddScore 100
  1456. If li72.State Then
  1457. li72.State = 0
  1458. li122.State = 0
  1459. AddAdvance 1
  1460. CheckGoal
  1461. Else
  1462. li79.State = 0
  1463. li101.State = 0
  1464. AddAdvance 1
  1465. CheckGoal
  1466. End If
  1467. End Sub
  1468.  
  1469. '******************************
  1470. ' Side lanes
  1471. '******************************
  1472.  
  1473. Sub sw54_Hit 'left
  1474. PlaySoundAt "fx_sensor", sw45
  1475. If Tilted Then Exit Sub
  1476. AddAdvance 5
  1477. AddScore 500
  1478. sw54hits = sw54hits + 1
  1479. AddScore 1000 * li89.State + 1000 * li90.State + 1000 * li91.State + 1000 * li92.State
  1480. Select Case sw54hits
  1481. Case 1:li89.State = 1:PlaySound "so_leftsidelanes"
  1482. Case 2:li90.State = 1:PlaySound "so_leftsidelanes"
  1483. Case 3:li91.State = 1:PlaySound "so_leftsidelanes"
  1484. Case 4:li92.State = 1:PlaySound "so_leftsidelanes"
  1485. Case 5:li89.State = 0:li90.State = 0:li91.State = 0:li92.State = 0:sw54hits = 0:PlaySound "so_resetlanes"
  1486. End Select
  1487. End Sub
  1488.  
  1489. Sub sw43_Hit 'right to bumper
  1490. PlaySoundAt "fx_sensor", sw43
  1491. If Tilted Then Exit Sub
  1492. AddAdvance 5
  1493. Addscore 500
  1494. PlaySound "so_bumperinlane"
  1495. End Sub
  1496.  
  1497. Sub sw53_Hit 'right
  1498. Dim tmp
  1499. PlaySoundAt "fx_sensor", sw53
  1500. If Tilted Then Exit Sub
  1501. AddAdvance 5
  1502. AddScore 500
  1503. sw53hits = sw53hits + 1
  1504. AddScore 1000 * li110.State + 1000 * li111.State + 1000 * li112.State
  1505. Select Case sw53hits
  1506. Case 1:li110.State = 1:PlaySound "so_rightsidelanes"
  1507. Case 2:li111.State = 1:PlaySound "so_rightsidelanes"
  1508. Case 3:li112.State = 1:PlaySound "so_rightsidelanes"
  1509. Case 4:li110.State = 0:li111.State = 0:li112.State = 0:sw53hits = 0::PlaySound "so_resetlanes"
  1510. End Select
  1511. End Sub
  1512.  
  1513. '******************************
  1514. ' Targets & Holes G-O-A-L
  1515. '******************************
  1516.  
  1517. Sub TargetG_hit
  1518. PlaySoundAtBall "fx_target"
  1519. If Tilted Then Exit Sub
  1520. Addscore 100
  1521. If li102.State Then
  1522. li102.State = 0
  1523. li153.State = 0
  1524. AddAdvance 1
  1525. CheckGoal
  1526. PlaySound "so_targeton"
  1527. Else
  1528. PlaySound "so_target"
  1529. End If
  1530. End Sub
  1531.  
  1532. Sub TargetL_hit
  1533. PlaySoundAtBall "fx_target"
  1534. If Tilted Then Exit Sub
  1535. Addscore 100
  1536. PlaySound "so_target"
  1537. If li101.State Then
  1538. li101.State = 0
  1539. li79.State = 0
  1540. AddAdvance 1
  1541. CheckGoal
  1542. PlaySound "so_targeton"
  1543. Else
  1544. PlaySound "so_target"
  1545. End If
  1546. End Sub
  1547.  
  1548. Sub kickerO_hit
  1549. PlaySoundAt "fx_kicker_enter", kickerO
  1550. If Not Tilted Then
  1551. Addscore 100
  1552. If li120.State Then
  1553. li120.State = 0
  1554. li70.State = 0
  1555. AddAdvance 1
  1556. CheckGoal
  1557. PlaySound "so_targeton"
  1558. Else
  1559. PlaySound "so_target"
  1560. End If
  1561. End If
  1562. kickerPos = 1
  1563. vpmtimer.addtimer 1500, "PlaySoundAt SoundFXDOF(""fx_kicker"", 103, DOFPulse, DOFContactors), kickerO: kickerO.kick 35+INT(RND*6), 26.5:kickerO_Timer '"
  1564. End Sub
  1565.  
  1566. Sub kickerO_Timer
  1567. Select Case kickerPos
  1568. Case 1:sw21p.rotx = 26:kickerO.TimerEnabled = 1
  1569. Case 2:sw21p.rotx = 14
  1570. Case 3:sw21p.rotx = 2
  1571. Case 4:sw21p.rotx = -15:kickerO.TimerEnabled = 0
  1572. End select
  1573. kickerPos = kickerPos + 1
  1574. End Sub
  1575.  
  1576. Sub kickerA_hit
  1577. PlaySoundAt "fx_kicker_enter", kickerA
  1578. If Not Tilted Then
  1579. Addscore 100
  1580. If li122.State Then
  1581. li122.State = 0
  1582. li72.State = 0
  1583. AddAdvance 1
  1584. CheckGoal
  1585. PlaySound "so_targeton"
  1586. Else
  1587. PlaySound "so_target"
  1588. End If
  1589. End If
  1590. kickerPos = 1
  1591. vpmtimer.addtimer 1500, "PlaySoundAt SoundFXDOF(""fx_kicker"", 105, DOFPulse, DOFContactors), kickerA: kickerA.kick 322 +INT(RND*6), 26.5:kickerA_Timer '"
  1592. End Sub
  1593.  
  1594. Sub kickerA_Timer
  1595. Select Case kickerPos
  1596. Case 1:sw11p.rotx = 26:kickerA.TimerEnabled = 1
  1597. Case 2:sw11p.rotx = 14
  1598. Case 3:sw11p.rotx = 2
  1599. Case 4:sw11p.rotx = -15:kickerA.TimerEnabled = 0
  1600. End select
  1601. kickerPos = kickerPos + 1
  1602. End Sub
  1603.  
  1604. Sub CheckGoal 'kickers
  1605. If li153.State + li70.State + li72.State + li79.State = 0 Then
  1606. AddScore 2000
  1607. Goalready = True
  1608. li81.State = 1
  1609. li100.State = 1
  1610. li99.State = 1
  1611. End If
  1612. End Sub
  1613.  
  1614. '******************************
  1615. ' Goal Holes
  1616. '******************************
  1617.  
  1618. Sub sw2_Hit
  1619. PlaySoundAt "fx_kicker_enter", sw2
  1620. If Not Tilted Then
  1621. If li100.State Then
  1622. AddScore 2000
  1623. AddBonus 1
  1624. TurnOffGoal
  1625. PlaySound "so_goal"
  1626. If GoalReady Then
  1627. AddBonusMultiplier 1
  1628. Goalready = False
  1629. vpmtimer.AddTimer 1000, "ResetGoalLights '"
  1630. End If
  1631. Else
  1632. AddScore 500
  1633. PlaySound "so_kickerhit"
  1634. End If
  1635. End If
  1636. kickerPos = 1
  1637. vpmtimer.addtimer 1500, "PlaySoundAt SoundFXDOF(""fx_kicker"",118,DOFPulse,DOFContactors), sw2: sw2.kick 152+INT(RND*6), 18:sw2_Timer '"
  1638. End Sub
  1639.  
  1640. Sub sw2_Timer
  1641. Select Case kickerPos
  1642. Case 1:sw2p.rotx = 30:sw2.TimerEnabled = 1
  1643. Case 2:sw2p.rotx = 20
  1644. Case 3:sw2p.rotx = 10
  1645. Case 4:sw2p.rotx = 0:sw2.TimerEnabled = 0
  1646. End select
  1647. kickerPos = kickerPos + 1
  1648. End Sub
  1649.  
  1650. Sub sw3_Hit
  1651. PlaySoundAt "fx_kicker_enter", sw3
  1652. If Not Tilted Then
  1653. If li100.State Then
  1654. AddScore 2000
  1655. AddBonus 1
  1656. TurnOffGoal
  1657. PlaySound "so_goal"
  1658. If GoalReady Then
  1659. AddBonusMultiplier 1
  1660. Goalready = False
  1661. vpmtimer.AddTimer 1000, "ResetGoalLights '"
  1662. End If
  1663. Else
  1664. AddScore 500
  1665. PlaySound "so_kickerhit"
  1666. End If
  1667. End If
  1668. kickerPos = 1
  1669. vpmtimer.addtimer 1500, "PlaySoundAt SoundFXDOF(""fx_kicker"",120,DOFPulse,DOFContactors), sw3: sw3.kick 202+INT(RND*6), 18:sw3_Timer '"
  1670. End Sub
  1671.  
  1672. Sub sw3_Timer
  1673. Select Case kickerPos
  1674. Case 1:sw3p.rotx = 30:sw3.TimerEnabled = 1
  1675. Case 2:sw3p.rotx = 20
  1676. Case 3:sw3p.rotx = 10
  1677. Case 4:sw3p.rotx = 0:sw3.TimerEnabled = 0
  1678. End select
  1679. kickerPos = kickerPos + 1
  1680. End Sub
  1681.  
  1682. '*****************************
  1683. ' Spinners
  1684. '*****************************
  1685.  
  1686. Sub sw52_Spin
  1687. PlaySoundAt SoundFXDOF("fx_spinner",104,DOFPulse,DOFShaker), sw52
  1688. DOF 117,DOFPulse
  1689. PlaySound "so_spinner"
  1690. If Tilted Then Exit Sub
  1691. If li80.State Then
  1692. Addscore 100
  1693. Else
  1694. AddScore 3
  1695. End If
  1696. End Sub
  1697.  
  1698. '******************************
  1699. ' Div. routines
  1700. '******************************
  1701.  
  1702. Sub TurnOffGoal
  1703. li100.State = 0
  1704. li99.State = 0
  1705. li81.State = 0
  1706. AddAdvance 1
  1707. End Sub
  1708.  
  1709. Sub ResetGoalLights
  1710. For each x in aGoalLights
  1711. x.State = 1
  1712. Next
  1713. End Sub
  1714.  
  1715. Sub SwapSpecialLights
  1716. Dim tmp
  1717. tmp = li119.State
  1718. li119.State = li129.State
  1719. li129.State = tmp
  1720. End Sub
Advertisement
Add Comment
Please, Sign In to add comment