Outhere

married with children

Jul 28th, 2021 (edited)
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 73.94 KB | None | 0 0
  1. ' ****************************************************************
  2. ' married with children by phenom mod of:JPSalas
  3. ' Script Básico para juegos EM Script hasta 4 players
  4. ' usa el core.vbs para funciones extras
  5. ' Apache! - Taito do Brasil 1978
  6. ' ****************************************************************
  7.  
  8. Option Explicit
  9. Randomize
  10.  
  11. Dim UltraDMD
  12. Const ScoreType = 1 ' 1=UltraDMD MARIO (2=PuPlayer DMD 3=PuPlayer PostDMD, if you want to use different dmd's down the road)
  13.  
  14.  
  15. ' Valores Constantes de las físicas de los flippers - se usan en la creación de las bolas, tienen que cargarse antes del core.vbs
  16. Const BallSize = 50 ' el diametro de la bola. el tamaño normal es 50 unidades de VP
  17. Const BallMass = 1.7 ' la pesadez de la bola, este valor va de acuerdo a la fuerza de los flippers y el plunger
  18.  
  19. Const UltraDMD_VideoMode_Stretch = 0
  20. Const UltraDMD_VideoMode_Top = 1
  21. Const UltraDMD_VideoMode_Middle = 2
  22. Const UltraDMD_VideoMode_Bottom = 3
  23.  
  24. 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  25. ' X X X X X X X X X X X X X X X X X X X X X X X
  26. '/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
  27. '\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
  28. ' X X X X X X X X X X X X X X X X X X X X X X X
  29. '/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
  30. ' Player Options
  31. '\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
  32. ' X X X X X X X X X X X X X X X X X X X X X X X
  33. '/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
  34. '\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
  35. ' X X X X X X X X X X X X X X X X X X X X X X X
  36.  
  37. turnonultradmd = 1 ' change to 1 to turn on ultradmd
  38.  
  39. ' Carga el core.vbs para poder usas sus funciones, sobre todo el vpintimer.addtimer
  40. LoadCoreFiles
  41.  
  42. Sub LoadCoreFiles
  43. On Error Resume Next
  44. ExecuteGlobal GetTextFile("core.vbs")
  45. If Err Then MsgBox "Can't open core.vbs"
  46. On Error Resume Next
  47. ExecuteGlobal GetTextFile("controller.vbs")
  48. If Err Then MsgBox "Can't open controller.vbs"
  49. End Sub
  50.  
  51. ' Valores Constants
  52. Const TableName = "Married"
  53. Const cGameName = "Married"
  54. Const MaxPlayers = 4 ' de 1 a 4
  55. Const BallsPerGame = 3 ' normalmente 3 ó 5
  56. Const Special1 = 620000 ' puntuación a obtener para partida extra
  57. Const Special2 = 790000 ' puntuación a obtener para partida extra
  58. Const Special3 = 960000 ' puntuación a obtener para partida extra
  59.  
  60. ' Variables Globales
  61. Dim turnonultradmd
  62. Dim PlayersPlayingGame
  63. Dim CurrentPlayer
  64. Dim Credits
  65. Dim Bonus
  66. Dim BonusMultiplier
  67. Dim BallsRemaining(4)
  68. Dim ExtraBallsAwards(4)
  69. Dim Special1Awarded(4)
  70. Dim Special2Awarded(4)
  71. Dim Special3Awarded(4)
  72. Dim Score(4)
  73. Dim HighScore
  74. Dim Match
  75. Dim Tilt
  76. Dim TiltSensitivity
  77. Dim Tilted
  78. Dim Add10
  79. Dim Add100
  80. Dim Add1000
  81. Dim Add10000
  82.  
  83. ' Variables de control
  84. Dim BallsOnPlayfield
  85.  
  86. ' Variables de tipo Boolean (verdadero ó falso, True ó False)
  87. Dim bAttractMode
  88. Dim bromconfig
  89. Dim bInstantInfo
  90. Dim bFreePlay
  91. Dim bGameInPlay
  92. Dim bOnTheFirstBall
  93. Dim bExtraBallWonThisBall
  94. Dim bJustStarted
  95. Dim bBallInPlungerLane
  96. Dim bBallSaverActive
  97.  
  98. Dim x
  99. '****** PuP Variables ******
  100.  
  101. Dim usePUP: Dim cPuPPack: Dim PuPlayer: Dim PUPStatus: PUPStatus=false ' dont edit this line!!!
  102.  
  103. '*************************** PuP Settings for this table ********************************
  104.  
  105. usePUP = true ' enable Pinup Player functions for this table
  106. cPuPPack = "Married" ' name of the PuP-Pack / PuPVideos folder for this table
  107.  
  108. '//////////////////// PINUP PLAYER: STARTUP & CONTROL SECTION //////////////////////////
  109.  
  110. ' This is used for the startup and control of Pinup Player
  111.  
  112. Sub PuPStart(cPuPPack)
  113. If PUPStatus=true then Exit Sub
  114. If usePUP=true then
  115. Set PuPlayer = CreateObject("PinUpPlayer.PinDisplay")
  116. If PuPlayer is Nothing Then
  117. usePUP=false
  118. PUPStatus=false
  119. Else
  120. PuPlayer.B2SInit "",cPuPPack 'start the Pup-Pack
  121. PUPStatus=true
  122. End If
  123. End If
  124. End Sub
  125.  
  126. Sub pupevent(EventNum)
  127. if (usePUP=false or PUPStatus=false) then Exit Sub
  128. PuPlayer.B2SData "E"&EventNum,1 'send event to Pup-Pack
  129. End Sub
  130.  
  131. ' ******* How to use PUPEvent to trigger / control a PuP-Pack *******
  132.  
  133. ' Usage: pupevent(EventNum)
  134.  
  135. ' EventNum = PuP Exxx trigger from the PuP-Pack
  136.  
  137. ' Example: pupevent 102
  138.  
  139. ' This will trigger E102 from the table's PuP-Pack
  140.  
  141. ' DO NOT use any Exxx triggers already used for DOF (if used) to avoid any possible confusion
  142.  
  143. '************ PuP-Pack Startup **************
  144.  
  145. PuPStart(cPuPPack) 'Check for PuP - If found, then start Pinup Player / PuP-Pack
  146.  
  147. 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  148. ' X X X X X X X X X X X X X X X X X X X X X X X
  149. '/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
  150. '\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
  151. ' X X X X X X X X X X X X X X X X X X X X X X X
  152. '/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
  153. ' ULTRADMD SCRIPTING
  154. '\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
  155. ' X X X X X X X X X X X X X X X X X X X X X X X
  156. '/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
  157. '\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
  158. ' X X X X X X X X X X X X X X X X X X X X X X X
  159.  
  160.  
  161. 'UDMD Initialization
  162. Sub LoadUltraDMD
  163.  
  164. If turnonultradmd = 0 then exit sub
  165. Set UltraDMD = CreateObject("UltraDMD.DMDObject")
  166. If UltraDMD is Nothing Then
  167. MsgBox "No UltraDMD found. This table will NOT run without it."
  168. Exit Sub
  169. End If
  170.  
  171. Set UltraDMD = CreateObject("UltraDMD.DMDObject")
  172. UltraDMD.Init
  173.  
  174. ' A Major version change indicates the version is no longer backward compatible
  175. If turnonultradmd = 0 then exit sub
  176. If Not UltraDMD.GetMajorVersion = 1 Then
  177. MsgBox "Incompatible Version of UltraDMD found."
  178. Exit Sub
  179. End If
  180.  
  181. 'A Minor version change indicates new features that are all backward compatible
  182. If UltraDMD.GetMinorVersion < 0 Then
  183. MsgBox "Incompatible Version of UltraDMD found. Please update to version 1.0 or newer."
  184. Exit Sub
  185. End If
  186.  
  187. Dim fso:Set fso = CreateObject("Scripting.FileSystemObject")
  188. Dim curDir:curDir = fso.GetAbsolutePathName(".")
  189.  
  190. Dim DirName
  191. DirName = curDir& "\" &TableName& ".UltraDMD"
  192.  
  193. If Not fso.FolderExists(DirName) Then _
  194. Msgbox "UltraDMD userfiles directory '" & DirName & "' does not exist." & CHR(13) & "No graphic images will be displayed on the DMD"
  195. UltraDMD.SetProjectFolder DirName
  196.  
  197. ' wait for the animation to end
  198. While UltraDMD.IsRendering = True
  199. WEnd
  200.  
  201. UltraDMD.SetVideoStretchMode UltraDMD_VideoMode_Middle
  202.  
  203. End Sub
  204.  
  205. Sub MarriedIntro
  206.  
  207. UltraDMD.DisplayScene00 "Scene1.png", "", 15, "", -1, 14, 5000, 14
  208. UltraDMD.DisplayScene00 "Scene2.png", "", 15, "", -1, 14, 5000, 14
  209. UltraDMD.DisplayScene00 "Scene3.png", "", 15, "", -1, 14, 5000, 14
  210. UltraDMD.DisplayScene00 "Scene3.5.png", "", 15, "", -1, 14, 5000, 14
  211. UltraDMD.DisplayScene00 "Scene4.png", "", 15, "", -1, 14, 5000, 14
  212. UltraDMD.DisplayScene00 "Scene5.png", "", 15, "", -1, 14, 5000, 14
  213. UltraDMD.DisplayScene00 "Scene4.png", "", 15, "", -1, 14, 0, 14
  214.  
  215. End Sub
  216.  
  217. Sub Table1_InitSleepWhileRendering
  218.  
  219. Do
  220. If Not UltraDMD.IsRendering Then
  221. Exit Sub
  222. End If
  223. WScript.Sleep 500
  224. Loop Until False
  225.  
  226. End Sub
  227.  
  228. '---------------------------ULTRA DMD FUNCTIONS-------------------------------------------
  229.  
  230. Sub DMD(background, toptext, bottomtext, duration)
  231. If turnonultradmd = 0 then exit sub
  232. UltraDMD.SetScoreboardBackgroundImage "Main1.jpg", 15, 7
  233. UltraDMD.DisplayScene00 background, toptext, 15, bottomtext, 15, 14, duration, 14
  234. UltraDMDTimer.Enabled = 1 'to show the score after the animation/message
  235. End Sub
  236.  
  237. Sub DMDScore
  238. If turnonultradmd = 0 then exit sub
  239. UltraDMD.SetScoreboardBackgroundImage "Main1.jpg", 15, 7
  240. UltraDMD.DisplayScoreboard PlayersPlayingGame, CurrentPlayer, Score(1), Score(2), Score(3), Score(4), "Player " & CurrentPlayer, "Ball " & Balls
  241. End Sub
  242.  
  243. Sub DMDScoreNow
  244. If turnonultradmd = 0 then exit sub
  245. DMDFlush
  246. DMDScore
  247. End Sub
  248.  
  249. Sub DMDFLush
  250. If turnonultradmd = 0 then exit sub
  251. UltraDMDTimer.Enabled = 0
  252. UltraDMD.CancelRendering
  253. End Sub
  254.  
  255. Sub DMDScrollCredits(background, text, duration)
  256. If turnonultradmd = 0 then exit sub
  257. UltraDMD.ScrollingCredits background, text, 15, 14, duration, 14
  258. End Sub
  259.  
  260. Sub DMDId(id, background, toptext, bottomtext, duration)
  261. If turnonultradmd = 0 then exit sub
  262. UltraDMD.DisplayScene00ExwithID id, False, background, toptext, 15, 0, bottomtext, 15, 0, 14, duration, 14
  263. End Sub
  264.  
  265. Sub DMDMod(id, toptext, bottomtext, duration)
  266. If turnonultradmd = 0 then exit sub
  267. UltraDMD.ModifyScene00Ex id, toptext, bottomtext, duration
  268. End Sub
  269.  
  270. Sub UltraDMDTimer_Timer 'used for the attrackmode and the instant info.
  271. If turnonultradmd = 0 then exit sub
  272. If bInstantInfo Then
  273. InstantInfo
  274. ElseIf bAttractMode Then
  275. ElseIf NOT UltraDMD.IsRendering Then
  276. DMDScoreNow
  277. ElseIf bromconfig Then
  278. romconfig
  279. End If
  280. End Sub
  281.  
  282. Sub DMD_DisplayScene(toptext,bottomtext,animateIn,pauseTime,animateOut)
  283. If not ScoreType = 1 Then Exit Sub: End If
  284. UltraDMD.DisplayScene00 "", toptext, 13, bottomtext, 15, animateIn, pauseTime, animateOut
  285. ScoreTimer.enabled = true
  286. End Sub
  287.  
  288. Sub DMD_DisplaySceneExWithId(id,toptext,bottomtext,animateIn,pauseTime,animateOut)
  289. If not ScoreType = 1 Then Exit Sub: End If
  290. UltraDMD.DisplayScene00ExWithId id, 0, "", toptext, 13, 9, bottomtext, 15, 9, animateIn, pauseTime, animateOut
  291. ScoreTimer.enabled = true
  292. End Sub
  293.  
  294. Sub DMD_ScrollingCredits(text,animateIn,pauseTime,animateOut)
  295. If not ScoreType = 1 Then Exit Sub: End If
  296. UltraDMD.ScrollingCredits "", text, 15, animateIn, pauseTime, animateOut
  297. ScoreTimer.enabled = true
  298. End Sub
  299.  
  300. Sub DMD_ModifyScene(id,toptext,bottomtext)
  301. If not ScoreType = 1 Then Exit Sub: End If
  302. UltraDMD.ModifyScene00 id, toptext, bottomtext
  303. End Sub
  304.  
  305. Sub DMD_ModifySceneEx(id,toptext,bottomtext,pauseTime)
  306. If not ScoreType = 1 Then Exit Sub: End If
  307. UltraDMD.ModifyScene00Ex id, toptext, bottomtext,pauseTime
  308. End Sub
  309.  
  310. Sub DMDId(id, toptext, bottomtext, duration) 'used in the highscore entry routine
  311. If not ScoreType = 1 Then Exit Sub: End If
  312. UltraDMD.DisplayScene00ExwithID id, False, "", toptext, 15, 0, bottomtext, 15, 0, 14, duration, 14
  313. End Sub
  314.  
  315. Sub DMDMod(id, toptext, bottomtext, duration) 'used in the highscore entry routine
  316. If not ScoreType = 1 Then Exit Sub: End If
  317. UltraDMD.ModifyScene00Ex id, toptext, bottomtext, duration
  318. End Sub
  319.  
  320. Sub DMD_CancelScene(id)
  321. If not ScoreType = 1 Then Exit Sub: End If
  322. UltraDMD.CancelRenderingWithId id
  323. End Sub
  324.  
  325. Sub DMD_DisplayhighScene(toptext,bottomtext,animateIn,pauseTime,animateOut)
  326. If not ScoreType = 1 Then Exit Sub: End If
  327. UltraDMD.DisplayScene00 "", toptext, 13, bottomtext, 15, animateIn, pauseTime, animateOut
  328. 'ScoreTimer.enabled = true
  329. End Sub
  330.  
  331. Sub DMD_CancelRendering()
  332. scoreupdate = true
  333. addscore(0)
  334. If not ScoreType = 1 Then Exit Sub: End If
  335. UltraDMD.CancelRendering
  336. End Sub
  337. '------------------------------------------------------------------------------------------------
  338.  
  339. Function CL(id, NumString) 'center line
  340. Dim Temp, TempStr
  341. NumString = LEFT(NumString, dCharsPerLine(id))
  342. Temp = (dCharsPerLine(id)- Len(NumString)) \ 2
  343. TempStr = Space(Temp) & NumString & Space(Temp)
  344. CL = TempStr
  345. End Function
  346.  
  347.  
  348. Sub Table1_Init()
  349. LoadUltraDMD
  350. MarriedIntro
  351. 'UltraDMDIntro
  352. UltraDMD.DisplayScene00 "Main1.png", "", 15, "", -1, 14, 0, 14
  353.  
  354. ' Inicializar diversos objetos de la mesa, como droptargets, animations...
  355. VPObjects_Init
  356. LoadEM
  357.  
  358. ' Carga los valores grabados highscore y créditos
  359. Loadhs
  360. 'HighscoreReel.SetValue Highscore
  361. ' también pon el highscore en el reel del primer jugador
  362. ' ScoreReel1.SetValue Highscore
  363. ' en esta mesa el attractmode se encarga de mostrar el highscore
  364.  
  365. UpdateCredits
  366.  
  367. ' Juego libre o con monedas: si es True entonces no se usarán monedas
  368. bFreePlay = False 'queremos monedas
  369.  
  370. ' Inicialiar las variables globales de la mesa
  371. bAttractMode = False
  372. bOnTheFirstBall = False
  373. bGameInPlay = False
  374. bBallInPlungerLane = False
  375. BallsOnPlayfield = 0
  376. Tilt = 0
  377. TiltSensitivity = 6
  378. Tilted = False
  379. bJustStarted = True
  380. Add10 = 0
  381. Add100 = 0
  382. Add1000 = 0
  383.  
  384. ' pone la mesa en modo de espera
  385. EndOfGame
  386.  
  387. 'Enciende las luces GI despues de un segundo
  388. vpmtimer.addtimer 1500, "GiOn '"
  389.  
  390. ' quita reels
  391. If Table1.ShowDT = true then
  392. For each x in aReels
  393. x.Visible = 1
  394. Next
  395. else
  396. For each x in aReels
  397. x.Visible = 0
  398. Next
  399. end if
  400.  
  401. ' Arranca el Game Timer de las animaciones, sonido de las bolas rodando, etc
  402. GameTimer.Enabled = 1
  403.  
  404. If turnonultradmd > 0 then
  405. UltraDMD.SetScoreboardBackgroundImage "Main1.jpg", 15, 12
  406. end if
  407.  
  408. End Sub
  409.  
  410. ' Start the random music
  411. MusicOn
  412.  
  413. Sub MusicOn
  414. Dim x
  415. x = INT(6 * RND(1) )
  416. Select Case x
  417. Case 0:PlayMusic "married1.mp3"
  418. Case 1:PlayMusic "married2.mp3"
  419. Case 2:PlayMusic "married3.mp3"
  420. Case 3:PlayMusic "married4.mp3"
  421. Case 4:PlayMusic "married5.mp3"
  422. Case 5:PlayMusic "married6.mp3"
  423. End Select
  424. End Sub
  425.  
  426. Sub Table1_MusicDone()
  427. MusicOn
  428. End Sub
  429.  
  430. '******
  431. ' Keys
  432. '******
  433.  
  434. Sub Table1_KeyDown(ByVal Keycode)
  435.  
  436. ' añade monedas
  437. If Keycode = AddCreditKey Then
  438. If(Tilted = False)Then
  439. AddCredits 1
  440. PlaySound "fx_coin"
  441. PlaySound "coin"
  442. End If
  443. End If
  444.  
  445. ' el plunger
  446. If keycode = PlungerKey Then
  447. Plunger.Pullback
  448. PlaySoundAt "fx_plungerpull", plunger
  449. End If
  450.  
  451. ' iluminación
  452. If keycode = LeftMagnaSave Then bLutActive = True
  453. If keycode = RightMagnaSave Then
  454. If bLutActive Then NextLUT: End If
  455. End If
  456.  
  457. ' teclas de la falta
  458. If keycode = LeftTiltKey Then Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25:CheckTilt
  459. If keycode = RightTiltKey Then Nudge 270, 8:PlaySound "fx_nudge", 0, 1, 0.1, 0.25:CheckTilt
  460. If keycode = CenterTiltKey Then Nudge 0, 9:PlaySound "fx_nudge", 0, 1, 1, 0.25:CheckTilt
  461.  
  462. ' Funcionamiento normal de los flipers y otras teclas durante el juego
  463.  
  464. If bGameInPlay AND NOT Tilted Then
  465.  
  466. ' teclas de los flipers
  467. If keycode = LeftFlipperKey Then SolLFlipper 1
  468. If keycode = RightFlipperKey Then SolRFlipper 1
  469.  
  470. ' tecla de empezar el juego
  471. If keycode = StartGameKey Then
  472. If((PlayersPlayingGame < MaxPlayers)AND(bOnTheFirstBall = True))Then
  473.  
  474. If(bFreePlay = True)Then
  475. PlayersPlayingGame = PlayersPlayingGame + 1
  476. PlaySound "start"
  477. Else
  478. If(Credits > 0)then
  479. PlayersPlayingGame = PlayersPlayingGame + 1
  480. Credits = Credits - 1
  481. UpdateCredits
  482. UpdateBallInPlay
  483. PlaySound "start"
  484. Else
  485. ' no hay suficientes créditos para empezar el juego.
  486. PlaySound "10000"
  487. End If
  488. End If
  489. End If
  490. End If
  491. Else ' If (GameInPlay)
  492.  
  493. If keycode = StartGameKey Then
  494. If(bFreePlay = True)Then
  495. If(BallsOnPlayfield = 0)Then
  496. ResetScores
  497. ResetForNewGame()
  498. PlaySound "start"
  499. End If
  500. Else
  501. If(Credits > 0)Then
  502. If(BallsOnPlayfield = 0)Then
  503. Credits = Credits - 1
  504. UpdateCredits
  505. ResetScores
  506. ResetForNewGame()
  507. PlaySound "start" :pupevent 800
  508. End If
  509. Else
  510. ' Not Enough Credits to start a game.
  511. PlaySound "10000"
  512. End If
  513. End If
  514. End If
  515. End If ' If (GameInPlay)
  516. End Sub
  517.  
  518. Sub Table1_KeyUp(ByVal keycode)
  519. If keycode = LeftMagnaSave Then bLutActive = False
  520.  
  521. If bGameInPlay AND NOT Tilted Then
  522. ' teclas de los flipers
  523. If keycode = LeftFlipperKey Then SolLFlipper 0
  524. If keycode = RightFlipperKey Then SolRFlipper 0
  525. End If
  526.  
  527. If keycode = PlungerKey Then
  528. Plunger.Fire
  529. If bBallInPlungerLane Then
  530. PlaySoundAt "fx_plunger", plunger
  531. Else
  532. PlaySoundAt "fx_plunger_empty", plunger
  533. End If
  534. End If
  535. End Sub
  536.  
  537. ' LUT
  538.  
  539. Dim bLutActive, LUTImage
  540. Sub LoadLUT
  541. bLutActive = False
  542. x = LoadValue(cGameName, "LUTImage")
  543. If(x <> "") Then LUTImage = x Else LUTImage = 0
  544. UpdateLUT
  545. End Sub
  546.  
  547. Sub SaveLUT
  548. SaveValue cGameName, "LUTImage", LUTImage
  549. End Sub
  550.  
  551. Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 9: UpdateLUT: SaveLUT: End Sub
  552.  
  553. Sub UpdateLUT
  554. Select Case LutImage
  555. Case 0: table1.ColorGradeImage = "LUT0"
  556. Case 1: table1.ColorGradeImage = "LUT1"
  557. Case 2: table1.ColorGradeImage = "LUT2"
  558. Case 3: table1.ColorGradeImage = "LUT3"
  559. Case 4: table1.ColorGradeImage = "LUT4"
  560. Case 5: table1.ColorGradeImage = "LUT5"
  561. Case 6: table1.ColorGradeImage = "LUT6"
  562. Case 7: table1.ColorGradeImage = "LUT7"
  563. Case 8: table1.ColorGradeImage = "LUT8"
  564. End Select
  565. End Sub
  566.  
  567. '*************
  568. ' Para la mesa
  569. '*************
  570.  
  571. Sub table1_Paused
  572. End Sub
  573.  
  574. Sub table1_unPaused
  575. End Sub
  576.  
  577. Sub table1_Exit
  578. Savehs
  579. If B2SOn Then Controller.Stop
  580. End Sub
  581.  
  582. '********************
  583. ' Flippers
  584. '********************
  585.  
  586. Sub SolLFlipper(Enabled)
  587. If Enabled Then
  588. PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper
  589. LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
  590. Else
  591. PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper
  592. LeftFlipper.EOSTorque = 0.1:LeftFlipper.RotateToStart
  593. End If
  594. End Sub
  595.  
  596. Sub SolRFlipper(Enabled)
  597. If Enabled Then
  598. PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper
  599. RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
  600. Else
  601. PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper
  602. RightFlipper.EOSTorque = 0.1:RightFlipper.RotateToStart
  603. End If
  604. End Sub
  605.  
  606.  
  607. '*******************
  608. ' Luces GI
  609. '*******************
  610.  
  611. Sub GiOn 'enciende las luces GI
  612. Dim bulb
  613. For each bulb in aGiLights
  614. bulb.State = 1
  615. Next
  616. If B2SOn Then Controller.B2SSetData 60, 1
  617. End Sub
  618.  
  619. Sub GiOff 'apaga las luces GI
  620. Dim bulb
  621. For each bulb in aGiLights
  622. bulb.State = 0
  623. Next
  624. If B2SOn Then Controller.B2SSetData 60, 0
  625. End Sub
  626.  
  627. '**************
  628. ' TILT - Falta
  629. '**************
  630.  
  631. 'el "timer" TiltDecreaseTimer resta .01 de la variable "Tilt" cada ronda
  632.  
  633. Sub CheckTilt 'esta rutina se llama cada vez que das un golpe a la mesa
  634. Tilt = Tilt + TiltSensitivity 'añade un valor al contador "Tilt"
  635. TiltDecreaseTimer.Enabled = True
  636. If Tilt > 15 Then 'Si la variable "Tilt" es más de 15 entonces haz falta
  637. Tilted = True
  638. TiltReel.SetValue 1 'muestra Tilt en la pantalla
  639. If B2SOn then
  640. Controller.B2SSetTilt 1
  641. end if
  642. DisableTable True
  643. TiltRecoveryTimer.Enabled = True 'empieza una pausa a fin de que todas las bolas se cuelen
  644. End If
  645. End Sub
  646.  
  647. Sub TiltDecreaseTimer_Timer
  648. ' DecreaseTilt
  649. If Tilt > 0 Then
  650. Tilt = Tilt - 0.1
  651. Else
  652. TiltDecreaseTimer.Enabled = False
  653. End If
  654. End Sub
  655.  
  656. Sub DisableTable(Enabled)
  657. If Enabled Then
  658. 'Apaga todas las luces Gi de la mesa
  659. GiOff
  660.  
  661. 'Disable slings, bumpers etc
  662. LeftFlipper.RotateToStart
  663. RightFlipper.RotateToStart
  664. Bumper1.Force = 0
  665. Bumper2.Force = 0
  666. Bumper3.Force = 0
  667. Else
  668. 'enciende de nuevo todas las luces GI
  669. GiOn
  670. Bumper1.Force = 10
  671. Bumper2.Force = 10
  672. Bumper3.Force = 10
  673. End If
  674. End Sub
  675.  
  676. Sub TiltRecoveryTimer_Timer()
  677. ' si todas las bolas se han colado, entonces ..
  678. If(BallsOnPlayfield = 0)Then
  679. '... haz el fin de bola normal
  680. EndOfBall()
  681. TiltRecoveryTimer.Enabled = False
  682. End If
  683. ' de lo contrario la rutina mirará si todavía hay bolas en la mesa
  684. End Sub
  685.  
  686.  
  687.  
  688. '***************************************
  689. ' Sonidos de las colecciones de objetos
  690. ' como metales, gomas, plásticos, etc
  691. '***************************************
  692.  
  693. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  694. Sub aMetalWires_Hit(idx):PlaySoundAtBall "fx_MetalWire":End Sub
  695. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  696. Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
  697. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  698. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  699. Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
  700. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  701. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  702. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  703.  
  704. '************************************************************************************************************************
  705. ' Solo para VPX 10.2 y posteriores.
  706. ' FlashForMs hará parpadear una luz o un flash por unos milisegundos "TotalPeriod" cada tantos milisegundos "BlinkPeriod"
  707. ' Cuando el "TotalPeriod" haya terminado, la luz o el flasher se pondrá en el estado especificado por el valor "FinalState"
  708. ' El valor de "FinalState" puede ser: 0=apagado, 1=encendido, 2=regreso al estado anterior
  709. '************************************************************************************************************************
  710.  
  711. Sub FlashForMs(MyLight, TotalPeriod, BlinkPeriod, FinalState)
  712.  
  713. If TypeName(MyLight) = "Light" Then ' la luz es del tipo "light"
  714.  
  715. If FinalState = 2 Then
  716. FinalState = MyLight.State 'guarda el estado actual de la luz
  717. End If
  718. MyLight.BlinkInterval = BlinkPeriod
  719. MyLight.Duration 2, TotalPeriod, FinalState
  720. ElseIf TypeName(MyLight) = "Flasher" Then ' la luz es del tipo "flash"
  721. Dim steps
  722. ' Store all blink information
  723. steps = Int(TotalPeriod / BlinkPeriod + .5) 'número de encendidos y apagados que hay que ejecutar
  724. If FinalState = 2 Then 'guarda el estado actual del flash
  725. FinalState = ABS(MyLight.Visible)
  726. End If
  727. MyLight.UserValue = steps * 10 + FinalState 'guarda el número de parpadeos
  728.  
  729. ' empieza los parpadeos y crea la rutina que se va a ejecutar como un timer que se va a ejecutar los parpadeos
  730. MyLight.TimerInterval = BlinkPeriod
  731. MyLight.TimerEnabled = 0
  732. MyLight.TimerEnabled = 1
  733. 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"
  734. End If
  735. End Sub
  736.  
  737. '****************************************
  738. ' Inicializa la mesa para un juego nuevo
  739. '****************************************
  740.  
  741. Sub ResetForNewGame()
  742. 'debug.print "ResetForNewGame"
  743. Dim i
  744.  
  745. bGameInPLay = True
  746. bBallSaverActive = False
  747.  
  748. 'pone a cero los marcadores y apaga las luces de espera.
  749. StopAttractMode
  750. If B2SOn then
  751. Controller.B2SSetGameOver 0
  752. end if
  753. ' enciende las luces GI si estuvieran apagadas
  754. GiOn
  755.  
  756. MatchWheel.Enabled = true
  757.  
  758. CurrentPlayer = 1
  759. PlayersPlayingGame = 1
  760. bOnTheFirstBall = True
  761. For i = 1 To MaxPlayers
  762. Score(i) = 0
  763. ExtraBallsAwards(i) = 0
  764. Special1Awarded(i) = False
  765. Special2Awarded(i) = False
  766. Special3Awarded(i) = False
  767. BallsRemaining(i) = BallsPerGame
  768. Next
  769. Bonus = 0
  770. BonusMultiplier = 1
  771. UpdateBallInPlay
  772.  
  773. Clear_Match
  774.  
  775. ' inicializa otras variables
  776. Tilt = 0
  777.  
  778. ' inicializa las variables del juego
  779. Game_Init()
  780.  
  781. ' ahora puedes empezar una música si quieres
  782. ' empieza la rutina "Firstball" despues de una pequeña pausa
  783. vpmtimer.addtimer 2000, "FirstBall '"
  784. End Sub
  785.  
  786. ' esta pausa es para que la mesa tenga tiempo de poner los marcadores a cero y actualizar las luces
  787.  
  788. Sub FirstBall
  789. 'debug.print "FirstBall"
  790. ' ajusta la mesa para una bola nueva, sube las dianas abatibles, etc
  791. ResetForNewPlayerBall()
  792. ' crea una bola nueva en la zona del plunger
  793. CreateNewBall()
  794. End Sub
  795.  
  796. ' (Re-)inicializa la mesa para una bola nueva, tanto si has perdido la bola, oe le toca el turno al otro jugador
  797.  
  798. Sub ResetForNewPlayerBall()
  799. 'debug.print "ResetForNewPlayerBall"
  800. ' Se asegura que los marcadores están activados para el jugador de turno
  801. AddScore 0
  802.  
  803. ' ajusta el multiplicador del bonus multiplier a 1X (si hubiese multiplicador en la mesa)
  804.  
  805. ' enciende las luces, reinicializa las variables del juego, etc
  806. bExtraBallWonThisBall = False
  807. ResetNewBallLights
  808. ResetNewBallVariables
  809. End Sub
  810.  
  811. ' Crea una bola nueva en la mesa
  812.  
  813. Sub CreateNewBall()
  814. ' crea una bola nueva basada en el tamaño y la masa de la bola especificados al principio del script
  815. BallRelease.CreateSizedBallWithMass BallSize / 2, BallMass
  816.  
  817. ' incrementa el número de bolas en el tablero, ya que hay que contarlas
  818. BallsOnPlayfield = BallsOnPlayfield + 1
  819.  
  820. ' actualiza las luces del backdrop
  821. UpdateBallInPlay
  822.  
  823. ' y expulsa la bola
  824. PlaySoundAt SoundFXDOF("fx_Ballrel", 110, DOFPulse, DOFContactors), BallRelease :MusicOn
  825. BallRelease.Kick 90, 4
  826. End Sub
  827.  
  828. ' El jugador ha perdido su bola, y ya no hay más bolas en juego
  829. ' Empieza a contar los bonos
  830.  
  831. Sub EndOfBall()
  832. 'debug.print "EndOfBall"
  833. Dim AwardPoints, ii
  834. AwardPoints = 0
  835. ' La primera se ha perdido. Desde aquí ya no se puede aceptar más jugadores
  836. bOnTheFirstBall = False
  837.  
  838. ' solo recoge los bonos si no hay falta
  839. ' el sistema del la falta se encargará de nuevas bolas o del fin de la partida
  840.  
  841. If NOT Tilted Then
  842. BonusCountTimer.Interval = 200
  843. CreditLight.State = 2 'taito tables
  844. BonusCountTimer.Enabled = 1
  845. Else 'Si hay falta simplemente espera un momento y va directo a la segunta parte después de perder la bola
  846. vpmtimer.addtimer 400, "EndOfBall2 '"
  847. End If
  848. End Sub
  849.  
  850. Sub BonusCountTimer_Timer 'añade los bonos y actualiza las luces
  851. 'debug.print "BonusCount_Timer"
  852. If Bonus > 0 Then
  853. Bonus = Bonus -1
  854. AddScore 1000
  855. UpdateBonusLights
  856. Else
  857. ' termina la cuenta de los bonos y continúa con el fin de bola
  858. CreditLight.State = 0 'Taito tables
  859. BonusCountTimer.Enabled = 0
  860. vpmtimer.addtimer 1000, "EndOfBall2 '"
  861. End If
  862. End Sub
  863.  
  864. ' La cuenta de los bonos ha terminado. Mira si el jugador ha ganado bolas extras
  865. ' y si no mira si es el último jugador o la última bola
  866. '
  867. Sub EndOfBall2()
  868. 'debug.print "EndOfBall2"
  869. ' si hubiese falta, quítala, y pon la cuenta a cero de la falta para el próximo jugador, ó bola
  870.  
  871. Tilted = False
  872. Tilt = 0
  873. TiltReel.SetValue 0
  874. If B2SOn then
  875. Controller.B2SSetTilt 0
  876. end if
  877. DisableTable False 'activa de nuevo los bumpers y los slingshots
  878.  
  879. ' ¿ha ganado el jugador una bola extra?
  880. If(ExtraBallsAwards(CurrentPlayer) > 0)Then
  881. 'debug.print "Extra Ball"
  882.  
  883. ' sí? entonces se la das al jugador
  884. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer)- 1
  885.  
  886. ' si no hay más bolas apaga la luz de jugar de nuevo
  887. If(ExtraBallsAwards(CurrentPlayer) = 0)Then
  888. LightShootAgain.State = 0
  889. If B2SOn then
  890. Controller.B2SSetShootAgain 0
  891. end if
  892. End If
  893.  
  894. ' aquí se podría poner algún sonido de bola extra o alguna luz que parpadee
  895.  
  896. ' En esta mesa hacemos la bola extra igual como si fuese la siguente bola, haciendo un reset de las variables y dianas
  897. ResetForNewPlayerBall()
  898.  
  899. ' creamos una bola nueva en el pasillo de disparo
  900. CreateNewBall()
  901. Else ' no hay bolas extras
  902.  
  903. BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer)- 1
  904.  
  905. ' ¿Es ésta la última bola?
  906. If(BallsRemaining(CurrentPlayer) <= 0)Then
  907.  
  908. ' miramos si la puntuación clasifica como el Highscore
  909. CheckHighScore()
  910. End If
  911.  
  912. ' ésta no es la última bola para éste jugador
  913. ' y si hay más de un jugador continúa con el siguente
  914. EndOfBallComplete()
  915. End If
  916. End Sub
  917.  
  918. ' Esta rutina se llama al final de la cuenta del bonus
  919. ' y pasa a la siguente bola o al siguente jugador
  920. '
  921. Sub EndOfBallComplete()
  922. 'debug.print "EndOfBallComplete"
  923. Dim NextPlayer
  924.  
  925. 'debug.print "EndOfBall - Complete"
  926.  
  927. ' ¿hay otros jugadores?
  928. If(PlayersPlayingGame > 1)Then
  929. ' entonces pasa al siguente jugador
  930. NextPlayer = CurrentPlayer + 1
  931. ' ¿vamos a pasar del último jugador al primero?
  932. ' (por ejemplo del jugador 4 al no. 1)
  933. If(NextPlayer > PlayersPlayingGame)Then
  934. NextPlayer = 1
  935. End If
  936. Else
  937. NextPlayer = CurrentPlayer
  938. End If
  939.  
  940. 'debug.print "Next Player = " & NextPlayer
  941.  
  942. ' ¿Hemos llegado al final del juego? (todas las bolas se han jugado de todos los jugadores)
  943. If((BallsRemaining(CurrentPlayer) <= 0)AND(BallsRemaining(NextPlayer) <= 0))Then
  944.  
  945. ' aquí se empieza la lotería, normalmente cuando se juega con monedas
  946. If bFreePlay = False Then
  947. Verification_Match
  948. End If
  949.  
  950. ' ahora se pone la mesa en el modo de final de juego
  951. EndOfGame()
  952. Else
  953. ' pasamos al siguente jugador
  954. CurrentPlayer = NextPlayer
  955.  
  956. ' nos aseguramos de que el backdrop muestra el jugador actual
  957. AddScore 0
  958.  
  959. ' hacemos un reset del la mesa para el siguente jugador (ó bola)
  960. ResetForNewPlayerBall()
  961.  
  962. ' y sacamos una bola
  963. CreateNewBall()
  964. End If
  965. End Sub
  966.  
  967. ' Esta función se llama al final del juego
  968.  
  969. Sub EndOfGame()
  970. 'debug.print "EndOfGame"
  971. bGameInPLay = False
  972. bJustStarted = False
  973. If B2SOn then
  974. Controller.B2SSetGameOver 1
  975. Controller.B2SSetBallInPlay 0
  976. Controller.B2SSetPlayerUp 0
  977. Controller.B2SSetCanPlay 0
  978. end if
  979. ' asegúrate de que los flippers están en modo de reposo
  980. SolLFlipper 0
  981. SolRFlipper 0
  982.  
  983. ' pon las luces en el modo de fin de juego
  984. StartAttractMode
  985. End Sub
  986.  
  987. ' Esta función calcula el no de bolas que quedan
  988. Function Balls
  989. Dim tmp
  990. tmp = BallsPerGame - BallsRemaining(CurrentPlayer) + 1
  991. If tmp > BallsPerGame Then
  992. Balls = BallsPerGame
  993. Else
  994. Balls = tmp
  995. End If
  996. End Function
  997.  
  998. ' Esta función calcula el Highscore y te da una partida gratis si has conseguido el Highscore
  999. Sub CheckHighscore :pupevent 803
  1000. For x = 1 to PlayersPlayingGame
  1001. If Score(x) > Highscore Then
  1002. Highscore = Score(x) :pupevent 804
  1003. PlaySound "fx_knocker"
  1004. 'HighscoreReel.SetValue Highscore
  1005. AddCredits 1
  1006. End If
  1007. Next
  1008. End Sub
  1009.  
  1010. '******************
  1011. ' Match - Loteria
  1012. '******************
  1013.  
  1014. Dim MatchCounter
  1015. MatchCounter = 0
  1016.  
  1017. sub MatchWheel_timer
  1018. MatchCounter = (MatchCounter + 1)MOD 10
  1019.  
  1020. If B2SOn then
  1021. If MatchCounter = 0 Then
  1022. Controller.B2SSetMatch 100
  1023. Else
  1024. Controller.B2SSetMatch MatchCounter * 10
  1025. End If
  1026. end if
  1027.  
  1028. For each x in aMatchLights
  1029. x.state = 0
  1030. next
  1031. aMatchLights(MatchCounter).state = 1
  1032. End Sub
  1033.  
  1034. Sub Verification_Match()
  1035. MatchWheel.Enabled = False
  1036. 'PlaySound "fx_match"
  1037. Match = MatchCounter * 10
  1038. debug.print match
  1039. If(Score(CurrentPlayer)MOD 100) = Match Then
  1040. PlaySound "fx_knocker"
  1041. AddCredits 1
  1042. End If
  1043. End Sub
  1044.  
  1045. Sub Clear_Match()
  1046. For each x in aMatchLights
  1047. x.State = 0
  1048. Next
  1049. If B2SOn then
  1050. Controller.B2SSetMatch 0
  1051. end if
  1052. End Sub
  1053.  
  1054. ' *********************************************************************
  1055. ' Drain / Plunger Functions
  1056. ' *********************************************************************
  1057.  
  1058. ' has perdido la bola ;-( mira cuantas bolas hay en el tablero.
  1059. ' si solamente hay una entonces reduce el número de bola y mira si es la última para finalizar el juego
  1060. ' si hay más de una, significa que hay multiball, entonces continua con la partida
  1061. '
  1062. Sub Drain_Hit() :pupevent 801
  1063. ' destruye la bola
  1064. Drain.DestroyBall
  1065.  
  1066. BallsOnPlayfield = BallsOnPlayfield - 1
  1067.  
  1068. ' haz sonar el ruido de la bola
  1069. PlaySoundAt "fx_drain", Drain :EndMusic
  1070.  
  1071. 'si hay falta el systema de tilt se encargará de continuar con la siguente bola/jugador
  1072. If Tilted Then
  1073. Exit Sub
  1074. End If
  1075.  
  1076. ' si estás jugando y no hay falta
  1077. If(bGameInPLay = True)AND(Tilted = False)Then
  1078.  
  1079. ' ¿está el salva bolas activado?
  1080. If(bBallSaverActive = True)Then
  1081.  
  1082. ' ¿sí?, pues creamos una bola
  1083. CreateNewBall()
  1084. Else
  1085. ' ¿es ésta la última bola en juego?
  1086. If(BallsOnPlayfield = 0)Then
  1087. vpmtimer.addtimer 1000, "EndOfBall '" 'hacemos una pequeña pausa anter de continuar con el fin de bola
  1088. Exit Sub
  1089. End If
  1090. End If
  1091. End If
  1092. End Sub
  1093.  
  1094. Sub swPlungerRest_Hit()
  1095. bBallInPlungerLane = True
  1096. End Sub
  1097.  
  1098. ' La bola ha sido disparada, así que cambiamos la variable, que en esta mesa se usa solo para que el sonido del disparador cambie según hay allí una bola o no
  1099. ' En otras mesas podrá usarse para poner en marcha un contador para salvar la bola
  1100.  
  1101. Sub swPlungerRest_UnHit()
  1102. bBallInPlungerLane = False
  1103. End Sub
  1104.  
  1105. ' *********************************************************************
  1106. ' Funciones para la cuenta de los puntos
  1107. ' *********************************************************************
  1108.  
  1109. ' Añade puntos al jugador, hace sonar las campanas y actualiza el backdrop
  1110.  
  1111. Sub AddScore(Points)
  1112. If Tilted Then Exit Sub
  1113. ' añade los puntos a la variable del actual jugador
  1114. Score(CurrentPlayer) = Score(CurrentPlayer) + points
  1115. DMDScore
  1116. ' actualiza los contadores
  1117. UpdateScore Points
  1118.  
  1119. ' hace sonar las campanillas de acuerdo a los puntos obtenidos
  1120. Select Case Points
  1121. Case 10, 100, 1000, 10000
  1122.  
  1123. If Points = 1000 AND(Score(CurrentPlayer)MOD 10000) \ 1000 = 0 Then 'nuevo reel de 10000
  1124. PlaySound "10000"
  1125. ElseIf Points = 100 AND(Score(CurrentPlayer)MOD 1000) \ 100 = 0 Then 'nuevo reel de 1000
  1126. PlaySound "1000"
  1127. ElseIf Points = 10 AND(Score(CurrentPlayer)MOD 100) \ 10 = 0 Then 'nuevo reel de 100
  1128. PlaySound "100"
  1129. Else
  1130. PlaySound Points
  1131. End If
  1132. Case 20, 30, 40, 50, 60, 70, 80, 90
  1133. Add10 = Add10 + Points \ 10
  1134. AddScore10Timer.Enabled = TRUE
  1135. Case 200, 300, 400, 500, 600, 700, 800, 900
  1136. Add100 = Add100 + Points \ 100
  1137. AddScore100Timer.Enabled = TRUE
  1138. Case 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000
  1139. Add1000 = Add1000 + Points \ 1000
  1140. AddScore1000Timer.Enabled = TRUE
  1141. Case 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000
  1142. Add10000 = Add10000 + Points \ 10000
  1143. AddScore10000Timer.Enabled = TRUE
  1144. End Select
  1145.  
  1146. ' ' aquí se puede hacer un chequeo si el jugador ha ganado alguna puntuación alta y darle un crédito ó bola extra
  1147. If Score(CurrentPlayer) >= Special1 AND Special1Awarded(CurrentPlayer) = False Then
  1148. AwardSpecial
  1149. Special1Awarded(CurrentPlayer) = True
  1150. End If
  1151. If Score(CurrentPlayer) >= Special2 AND Special2Awarded(CurrentPlayer) = False Then
  1152. AwardSpecial
  1153. Special2Awarded(CurrentPlayer) = True
  1154. End If
  1155. If Score(CurrentPlayer) >= Special3 AND Special3Awarded(CurrentPlayer) = False Then
  1156. AwardSpecial
  1157. Special3Awarded(CurrentPlayer) = True
  1158. End If
  1159. End Sub
  1160.  
  1161. '************************************
  1162. 'TIMER DE 10, 100, 1000 y 1000 PUNTOS
  1163. '************************************
  1164.  
  1165. ' hace sonar las campanillas según los puntos
  1166.  
  1167. Sub AddScore10Timer_Timer()
  1168. if Add10 > 0 then
  1169. AddScore 10
  1170. Add10 = Add10 - 1
  1171. Else
  1172. Me.Enabled = FALSE
  1173. End If
  1174. End Sub
  1175.  
  1176. Sub AddScore100Timer_Timer()
  1177. if Add100 > 0 then
  1178. AddScore 100
  1179. Add100 = Add100 - 1
  1180. Else
  1181. Me.Enabled = FALSE
  1182. End If
  1183. End Sub
  1184.  
  1185. Sub AddScore1000Timer_Timer()
  1186. if Add1000 > 0 then
  1187. AddScore 1000
  1188. Add1000 = Add1000 - 1
  1189. Else
  1190. Me.Enabled = FALSE
  1191. End If
  1192. End Sub
  1193.  
  1194. Sub AddScore10000Timer_Timer()
  1195. if Add10000 > 0 then
  1196. AddScore 10000
  1197. Add10000 = Add10000 - 1
  1198. Else
  1199. Me.Enabled = FALSE
  1200. End If
  1201. End Sub
  1202.  
  1203. '*******************
  1204. ' BONOS
  1205. '*******************
  1206.  
  1207. Sub AddBonus(bonuspoints)
  1208. If(Tilted = False)Then
  1209. ' añade los bonos al jugador actual
  1210. Bonus = Bonus + bonuspoints
  1211. If Bonus > 19 Then
  1212. Bonus = 19
  1213. End If
  1214. ' actualiza las luces
  1215. UpdateBonusLights
  1216. End if
  1217. End Sub
  1218.  
  1219. Sub UpdateBonusLights 'enciende o apaga las luces de los bonos según la variable "Bonus"
  1220. Select Case Bonus
  1221. Case 0:litotem.State = 0:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 0:li5.State = 0:li10.State = 0:lifull.State = 0
  1222. Case 1:litotem.State = 1:li1.State = 1:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 0:li5.State = 0:li10.State = 0:lifull.State = 0
  1223. Case 2:litotem.State = 1:li1.State = 0:li2.State = 1:li3.State = 0:li4.State = 0:liplus.State = 0:li5.State = 0:li10.State = 0:lifull.State = 0
  1224. Case 3:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 1:li4.State = 0:liplus.State = 0:li5.State = 0:li10.State = 0:lifull.State = 0
  1225. Case 4:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 1:liplus.State = 0:li5.State = 0:li10.State = 0:lifull.State = 0
  1226. Case 5:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 0:li5.State = 1:li10.State = 0:lifull.State = 0
  1227. Case 6:litotem.State = 1:li1.State = 1:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 0:li5.State = 1:li10.State = 0:lifull.State = 0
  1228. Case 7:litotem.State = 1:li1.State = 0:li2.State = 1:li3.State = 0:li4.State = 0:liplus.State = 1:li5.State = 1:li10.State = 0:lifull.State = 0
  1229. Case 8:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 1:li4.State = 0:liplus.State = 1:li5.State = 1:li10.State = 0:lifull.State = 0
  1230. Case 9:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 1:liplus.State = 1:li5.State = 1:li10.State = 0:lifull.State = 0
  1231. Case 10:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 0:li5.State = 0:li10.State = 1:lifull.State = 0
  1232. Case 11:litotem.State = 1:li1.State = 1:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 1:li5.State = 0:li10.State = 1:lifull.State = 0
  1233. Case 12:litotem.State = 1:li1.State = 0:li2.State = 1:li3.State = 0:li4.State = 0:liplus.State = 1:li5.State = 0:li10.State = 1:lifull.State = 0
  1234. Case 13:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 1:li4.State = 0:liplus.State = 1:li5.State = 0:li10.State = 1:lifull.State = 0
  1235. Case 14:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 1:liplus.State = 1:li5.State = 0:li10.State = 1:lifull.State = 0
  1236. Case 15:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 1:li5.State = 1:li10.State = 1:lifull.State = 0
  1237. Case 16:litotem.State = 1:li1.State = 1:li2.State = 0:li3.State = 0:li4.State = 0:liplus.State = 1:li5.State = 1:li10.State = 1:lifull.State = 0
  1238. Case 17:litotem.State = 1:li1.State = 0:li2.State = 1:li3.State = 0:li4.State = 0:liplus.State = 1:li5.State = 1:li10.State = 1:lifull.State = 0
  1239. Case 18:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 1:li4.State = 0:liplus.State = 1:li5.State = 1:li10.State = 1:lifull.State = 0
  1240. Case 19:litotem.State = 1:li1.State = 0:li2.State = 0:li3.State = 0:li4.State = 1:liplus.State = 1:li5.State = 1:li10.State = 1:lifull.State = 1
  1241. End Select
  1242. End Sub
  1243.  
  1244. '***********************************************************************************
  1245. ' Score reels - puntuaciones - y actualiza otras luces del backdrop
  1246. '***********************************************************************************
  1247. 'esta es al rutina que actualiza la puntuación del jugador
  1248.  
  1249. Sub UpdateScore(playerpoints)
  1250. Select Case CurrentPlayer
  1251. Case 1:ScoreReel1.Addvalue playerpoints
  1252. Case 2:ScoreReel2.Addvalue playerpoints
  1253. Case 3:ScoreReel3.Addvalue playerpoints
  1254. Case 4:ScoreReel4.Addvalue playerpoints
  1255. End Select
  1256. If B2SOn then
  1257. Controller.B2SSetScorePlayer CurrentPlayer, Score(CurrentPlayer)
  1258. If Score(CurrentPlayer) >= 100000 then
  1259. Controller.B2SSetScoreRollover 24 + CurrentPlayer, 1
  1260. end if
  1261. end if
  1262. End Sub
  1263.  
  1264. ' pone todos los marcadores a 0
  1265. Sub ResetScores
  1266. ScoreReel1.ResetToZero
  1267. ScoreReel2.ResetToZero
  1268. ScoreReel3.ResetToZero
  1269. ScoreReel4.ResetToZero
  1270. If B2SOn then
  1271. Controller.B2SSetScorePlayer1 0
  1272. Controller.B2SSetScorePlayer2 0
  1273. Controller.B2SSetScorePlayer3 0
  1274. Controller.B2SSetScorePlayer4 0
  1275. Controller.B2SSetScoreRolloverPlayer1 0
  1276. Controller.B2SSetScoreRolloverPlayer2 0
  1277. Controller.B2SSetScoreRolloverPlayer3 0
  1278. Controller.B2SSetScoreRolloverPlayer4 0
  1279. end if
  1280. End Sub
  1281.  
  1282. Sub AddCredits(value)
  1283. If Credits < 9 Then
  1284. Credits = Credits + value
  1285. CreditReel.SetValue Credits
  1286. UpdateCredits
  1287. end if
  1288. End Sub
  1289.  
  1290. Sub UpdateCredits
  1291. If Credits > 0 Then 'this is for Bally tables
  1292. 'CreditLight.State = 1
  1293. Else
  1294. 'CreditLight.State = 0
  1295. End If
  1296. CreditReel.SetValue credits
  1297. If B2SOn then
  1298. If Credits = 0 then
  1299. Controller.B2SSetData 29, 10
  1300. Else
  1301. Controller.B2SSetData 29, Credits
  1302. End If
  1303. End If
  1304. End Sub
  1305.  
  1306. Sub UpdateBallInPlay 'actualiza los marcadores de las bolas, el número de jugador y el número total de jugadores
  1307. Select Case Balls
  1308. Case 1:bip1.State = 1:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1309. Case 2:bip1.State = 0:bip2.State = 1:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1310. Case 3:bip1.State = 0:bip2.State = 0:bip3.State = 1:bip4.State = 0:bip5.State = 0
  1311. Case 4:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 1:bip5.State = 0
  1312. Case 5:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 1
  1313. End Select
  1314. If B2SOn then
  1315. Controller.B2SSetBallInPlay Balls
  1316. end if
  1317. Select Case CurrentPlayer
  1318. Case 1:pl1.State = 1:pl2.State = 0:pl3.State = 0:pl4.State = 0
  1319. Case 2:pl1.State = 0:pl2.State = 1:pl3.State = 0:pl4.State = 0
  1320. Case 3:pl1.State = 0:pl2.State = 0:pl3.State = 1:pl4.State = 0
  1321. Case 4:pl1.State = 0:pl2.State = 0:pl3.State = 0:pl4.State = 1
  1322. End Select
  1323. If B2SOn then
  1324. Controller.B2SSetPlayerUp CurrentPlayer
  1325. end if
  1326. Select Case PlayersPlayingGame
  1327. Case 1:cp1.State = 1:cp2.State = 0:cp3.State = 0:cp4.State = 0
  1328. Case 2:cp1.State = 0:cp2.State = 1:cp3.State = 0:cp4.State = 0
  1329. Case 3:cp1.State = 0:cp2.State = 0:cp3.State = 1:cp4.State = 0
  1330. Case 4:cp1.State = 0:cp2.State = 0:cp3.State = 0:cp4.State = 1
  1331. End Select
  1332. If B2SOn then
  1333. Controller.B2SSetCanPlay PlayersPlayingGame
  1334. Controller.B2SSetCanPlay PlayersPlayingGame
  1335. end if
  1336. End Sub
  1337.  
  1338. '*************************
  1339. ' Partidas y bolas extras
  1340. '*************************
  1341.  
  1342. Sub AwardExtraBall() :pupevent 802
  1343. If NOT bExtraBallWonThisBall Then
  1344. PlaySound "fx_knocker"
  1345. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) + 1
  1346. bExtraBallWonThisBall = True
  1347. LightShootAgain.State = 1
  1348. If B2SOn then
  1349. Controller.B2SSetShootAgain 1
  1350. end if
  1351. END If
  1352. End Sub
  1353.  
  1354. Sub AwardSpecial()
  1355. PlaySound "fx_knocker"
  1356. AddCredits 1
  1357. End Sub
  1358.  
  1359. ' ********************************
  1360. ' Attract Mode
  1361. ' ********************************
  1362. ' las luces simplemente parpadean de acuerdo a los valores que hemos puesto en el "Blink Pattern" de cada luz
  1363.  
  1364. Sub StartAttractMode()
  1365. bAttractMode = True
  1366. For each x in aLights
  1367. x.State = 2
  1368. Next
  1369.  
  1370. ' enciente la luz de fin de partida
  1371. UltraDMDTimer.Enabled = 1
  1372. GameOverR.SetValue 1
  1373. ' empieza un timer
  1374. AttractTimer.Enabled = 1
  1375. End Sub
  1376.  
  1377. Sub StopAttractMode()
  1378. bAttractMode = False
  1379. ResetScores
  1380. For each x in aLights
  1381. x.State = 0
  1382. Next
  1383.  
  1384. ' apaga la luz de fin de partida
  1385. GameOverR.SetValue 0
  1386. ' apaga timer
  1387. AttractTimer.Enabled = 0
  1388. End Sub
  1389.  
  1390. Dim AttractStep
  1391. AttractStep = 0
  1392.  
  1393. Sub AttractTimer_Timer
  1394. Select Case AttractStep
  1395. Case 0
  1396. AttractStep = 1
  1397. ScoreReel1.SetValue Score(1)
  1398. ScoreReel2.SetValue Score(2)
  1399. ScoreReel3.SetValue Score(3)
  1400. ScoreReel4.SetValue Score(4)
  1401. If B2SOn then
  1402. Controller.B2SSetScorePlayer1 Score(1)
  1403. Controller.B2SSetScorePlayer2 Score(2)
  1404. Controller.B2SSetScorePlayer3 Score(3)
  1405. Controller.B2SSetScorePlayer4 Score(4)
  1406. end if
  1407. Case 1
  1408. AttractStep = 0
  1409. ScoreReel1.SetValue Highscore
  1410. ScoreReel2.SetValue Highscore
  1411. ScoreReel3.SetValue Highscore
  1412. ScoreReel4.SetValue Highscore
  1413. If B2SOn then
  1414. Controller.B2SSetScorePlayer1 Highscore
  1415. Controller.B2SSetScorePlayer2 Highscore
  1416. Controller.B2SSetScorePlayer3 Highscore
  1417. Controller.B2SSetScorePlayer4 Highscore
  1418. end if
  1419. End Select
  1420. End Sub
  1421.  
  1422. '************************************************
  1423. ' Load (cargar) / Save (guardar)/ Highscore
  1424. '************************************************
  1425.  
  1426. ' solamente guardamos el número de créditos y la puntuación más alta
  1427.  
  1428. Sub Loadhs
  1429. x = LoadValue(TableName, "HighScore")
  1430. If(x <> "")Then HighScore = CDbl(x)Else HighScore = 0 End If
  1431. x = LoadValue(TableName, "Credits")
  1432. If(x <> "")then Credits = CInt(x)Else Credits = 0 End If
  1433. End Sub
  1434.  
  1435. Sub Savehs
  1436. SaveValue TableName, "HighScore", HighScore
  1437. SaveValue TableName, "Credits", Credits
  1438. End Sub
  1439.  
  1440. ' por si se necesitara quitar la actual puntuación más alta, se le puede poner a una tecla,
  1441. ' o simplemente abres la ventana de debug y escribes Reseths y le das al enter
  1442. Sub Reseths
  1443. HighScore = 0
  1444. Savehs
  1445. End Sub
  1446.  
  1447. '****************************************
  1448. ' Actualizaciones en tiempo real
  1449. '****************************************
  1450. ' se usa sobre todo para hacer animaciones o sonidos que cambian en tiempo real
  1451. ' como por ejemplo para sincronizar los flipers, puertas ó molinillos con primitivas
  1452.  
  1453. Sub GameTimer_Timer
  1454. ' RollingUpdate 'actualiza el sonido de la bola rodando
  1455. ' y también algunas animaciones, sobre todo de primitivas
  1456. LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
  1457. RightFlipperTop.RotZ = RightFlipper.CurrentAngle
  1458. End Sub
  1459.  
  1460. '***********************************************************************
  1461. ' *********************************************************************
  1462. ' Aquí empieza el código particular a la mesa
  1463. ' (hasta ahora todas las rutinas han sido muy generales para todas las mesas)
  1464. ' (y hay muy pocas rutinas que necesitan cambiar de mesa a mesa)
  1465. ' *********************************************************************
  1466. '***********************************************************************
  1467.  
  1468. ' se inicia las dianas abatibles, primitivas, etc.
  1469. ' aunque en el VPX no hay muchos objetos que necesitan ser iniciados
  1470.  
  1471. Sub VPObjects_Init
  1472. End Sub
  1473.  
  1474. ' variables de la mesa
  1475.  
  1476. Sub Game_Init() 'esta rutina se llama al principio de un nuevo juego
  1477. Dim i
  1478.  
  1479. 'Empezar alguna música, si hubiera música en esta mesa
  1480.  
  1481. 'iniciar variables, en esta mesa hay muy pocas variables ya que usamos las luces, y el UserValue de las dianas
  1482.  
  1483. 'iniciar algún timer
  1484.  
  1485. 'Iniciar algunas luces, en esta mesa son las mismas luces que las de una bola nueva
  1486. TurnOffPlayfieldLights()
  1487. End Sub
  1488.  
  1489. Sub ResetNewBallVariables() 'inicia las variable para una bola ó jugador nuevo
  1490. ResetLeftDroptargets
  1491. vpmtimer.addtimer 300, "ResetRightDropTargets '"
  1492. End Sub
  1493.  
  1494. Sub ResetNewBallLights() 'enciende ó apaga las luces para una bola nueva
  1495. TurnOffPlayfieldLights()
  1496. UpperLightA.State = 1
  1497. UpperLightB.State = 1
  1498. UpperLightC.State = 1
  1499. LeftInlaneLightA.State = 1
  1500. LeftInlaneLightB.State = 1
  1501. RightInlaneLightB.State = 1
  1502. RightInlaneLightC.State = 1
  1503. TargetLeftLight1.State = 1
  1504. TargetRightLight1.State = 1
  1505. LeftTarget500.State = 1
  1506. RightTarget500.State = 1
  1507. End Sub
  1508.  
  1509. Sub TurnOffPlayfieldLights()
  1510. For each x in aLights
  1511. x.State = 0
  1512. Next
  1513. End Sub
  1514.  
  1515. ' *********************************************************************
  1516. ' Eventos de la mesa - choque de la bola contra dianas
  1517. '
  1518. ' En cada diana u objeto con el que la bola choque habrá que hacer:
  1519. ' - sonar un sonido físico
  1520. ' - hacer algún movimiento, si es necesario
  1521. ' - añadir alguna puntuación
  1522. ' - encender/apagar una luz
  1523. ' - hacer algún chequeo para ver si el jugador ha completado algo
  1524. ' *********************************************************************
  1525.  
  1526. '**************************
  1527. ' Gomas de 10 puntos
  1528. '**************************
  1529.  
  1530. ' animation rubbers
  1531. Dim Rub1, Rub2
  1532.  
  1533. Sub rlband001_Hit
  1534. If NOT Tilted Then
  1535. AddScore 10
  1536. End If
  1537. Rub1 = 1:rlband001_Timer
  1538. End Sub
  1539.  
  1540. Sub rlband001_Timer
  1541. Select Case Rub1
  1542. Case 1:r009.Visible = 0:r022.Visible = 1:rlband001.TimerEnabled = 1
  1543. Case 2:r022.Visible = 0:r023.Visible = 1
  1544. Case 3:r023.Visible = 0:r009.Visible = 1:rlband001.TimerEnabled = 0
  1545. End Select
  1546. Rub1 = Rub1 + 1
  1547. End Sub
  1548.  
  1549. Sub rlband002_Hit
  1550. If NOT Tilted Then
  1551. AddScore 10
  1552. End If
  1553. Rub2 = 1:rlband002_Timer
  1554. End Sub
  1555.  
  1556. Sub rlband002_Timer
  1557. Select Case Rub2
  1558. Case 1:r010.Visible = 0:r024.Visible = 1:rlband002.TimerEnabled = 1
  1559. Case 2:r024.Visible = 0:r025.Visible = 1
  1560. Case 3:r025.Visible = 0:r010.Visible = 1:rlband002.TimerEnabled = 0
  1561. End Select
  1562. Rub2 = Rub2 + 1
  1563. End Sub
  1564.  
  1565. Sub rlband003_Hit
  1566. If NOT Tilted Then
  1567. AddScore 10
  1568. End If
  1569. End Sub
  1570.  
  1571. Sub rlband004_Hit
  1572. If NOT Tilted Then
  1573. AddScore 10
  1574. End If
  1575. End Sub
  1576.  
  1577. '*********
  1578. ' Bumpers
  1579. '*********
  1580.  
  1581. Sub Bumper1_Hit
  1582. If Tilted Then Exit Sub
  1583. PlaySoundAt SoundFXDOF("fx_Bumper",107,DOFPulse,DOFContactors), bumper1
  1584. ' añade algunos puntos
  1585. AddScore 100 + 900 * LiBumper1a.State
  1586. End Sub
  1587.  
  1588. Sub LitBumper1:LiBumper1a.State = 1:liBumper1b.State = 1:End Sub
  1589.  
  1590. Sub Bumper2_Hit
  1591. If Tilted Then Exit Sub
  1592. PlaySoundAt SoundFXDOF("fx_Bumper",109,DOFPulse,DOFContactors), bumper2
  1593. ' añade algunos puntos
  1594. AddScore 100 + 900 * LiBumper2a.State
  1595. End Sub
  1596.  
  1597. Sub LitBumper2:LiBumper2a.State = 1:liBumper2b.State = 1:End Sub
  1598.  
  1599. Sub Bumper3_Hit
  1600. dim tmp
  1601. If Tilted Then Exit Sub
  1602. PlaySoundAt SoundFXDOF("fx_Bumper",108,DOFPulse,DOFContactors), bumper3
  1603. ' añade algunos puntos
  1604. AddScore 100 + 900 * LiBumper3a.State
  1605. ' rotates lights
  1606. tmp = TargetLeftLight1.State
  1607. TargetLeftLight1.State = TargetLeftLight2.State
  1608. TargetLeftLight2.State = tmp
  1609.  
  1610. tmp = TargetRightLight1.State
  1611. TargetRightLight1.State = TargetRightLight2.State
  1612. TargetRightLight2.State = tmp
  1613.  
  1614. tmp = LeftSpecialLight.State
  1615. LeftSpecialLight.State = RightSpecialLight.State
  1616. RightSpecialLight.State = tmp
  1617. End Sub
  1618.  
  1619. Sub LitBumper3:LiBumper3a.State = 1:liBumper3b.State = 1:End Sub
  1620.  
  1621. '******************************
  1622. ' Pasillos inferiores
  1623. '******************************
  1624.  
  1625. Sub sw001_Hit
  1626. PlaySoundAt "fx_sensor", sw001
  1627. If Tilted Then Exit Sub
  1628. AddScore 5000
  1629. End Sub
  1630.  
  1631. Sub sw002_Hit
  1632. PlaySoundAt "fx_sensor", sw002
  1633. If Tilted Then Exit Sub
  1634. AddScore 200
  1635. LeftInlaneLightA.State = 0
  1636. UpperLightA.State = 0
  1637. CenterLightA.State = 1
  1638. LitBumper1
  1639. CheckABC
  1640. End Sub
  1641.  
  1642. Sub sw003_Hit
  1643. PlaySoundAt "fx_sensor", sw003
  1644. If Tilted Then Exit Sub
  1645. AddScore 500
  1646. LeftInlaneLightB.State = 0
  1647. RightInlaneLightB.State = 0
  1648. UpperLightB.State = 0
  1649. CenterLightB.State = 1
  1650. LitBumper3
  1651. CheckABC
  1652. End Sub
  1653.  
  1654. Sub sw004_Hit
  1655. PlaySoundAt "fx_sensor", sw004
  1656. If Tilted Then Exit Sub
  1657. AddScore 500
  1658. LeftInlaneLightB.State = 0
  1659. RightInlaneLightB.State = 0
  1660. UpperLightB.State = 0
  1661. CenterLightB.State = 1
  1662. LitBumper3
  1663. CheckABC
  1664. End Sub
  1665.  
  1666. Sub sw005_Hit
  1667. PlaySoundAt "fx_sensor", sw005
  1668. If Tilted Then Exit Sub
  1669. AddScore 500
  1670. RightInlaneLightC.State = 0
  1671. UpperLightC.State = 0
  1672. CenterLightC.State = 1
  1673. LitBumper2
  1674. CheckABC
  1675. End Sub
  1676.  
  1677. Sub sw006_Hit
  1678. PlaySoundAt "fx_sensor", sw006
  1679. If Tilted Then Exit Sub
  1680. AddScore 5000
  1681. End Sub
  1682.  
  1683. '******************************
  1684. ' Pasillos superiores
  1685. '******************************
  1686.  
  1687. Sub sw007_Hit
  1688. PlaySoundAt "fx_sensor", sw007
  1689. If Tilted Then Exit Sub
  1690. AddScore 200
  1691. LeftInlaneLightA.State = 0
  1692. UpperLightA.State = 0
  1693. CenterLightA.State = 1
  1694. LitBumper1
  1695. CheckABC
  1696. End Sub
  1697.  
  1698. Sub sw008_Hit
  1699. PlaySoundAt "fx_sensor", sw008
  1700. If Tilted Then Exit Sub
  1701. AddScore 500
  1702. LeftInlaneLightB.State = 0
  1703. RightInlaneLightB.State = 0
  1704. UpperLightB.State = 0
  1705. CenterLightB.State = 1
  1706. LitBumper3
  1707. CheckABC
  1708. End Sub
  1709.  
  1710. Sub sw009_Hit
  1711. PlaySoundAt "fx_sensor", sw009
  1712. If Tilted Then Exit Sub
  1713. AddScore 500
  1714. RightInlaneLightC.State = 0
  1715. UpperLightC.State = 0
  1716. CenterLightC.State = 1
  1717. LitBumper2
  1718. CheckABC
  1719. End Sub
  1720.  
  1721. Sub CheckABC
  1722. If CenterLightA.State + CenterLightB.State + CenterLightC.State = 3 Then
  1723. DoubleBonus.State = 1
  1724. BonusMultiplier = 2
  1725. If BallsRemaining(CurrentPlayer) = 1 Then
  1726. BonusMultiplier = 3
  1727. End If
  1728. End If
  1729. End Sub
  1730.  
  1731. Function ABCComplete
  1732. If CenterLightA.State + CenterLightB.State + CenterLightC.State = 3 Then
  1733. ABCComplete = True
  1734. Else
  1735. ABCComplete = False
  1736. End If
  1737. End Function
  1738.  
  1739. '******************************
  1740. ' Targets
  1741. '******************************
  1742.  
  1743. Sub Target001_hit
  1744. PlaySoundAtBall "fx_target"
  1745. If Tilted Then Exit Sub
  1746. Addscore 5000
  1747. If TargetLeftLight1.State Then AddBonus 1
  1748. End Sub
  1749.  
  1750. Sub Target002_hit
  1751. PlaySoundAtBall "fx_target"
  1752. If Tilted Then Exit Sub
  1753. Addscore 5000
  1754. If TargetLeftLight2.State Then AddBonus 1
  1755. End Sub
  1756.  
  1757. Sub Target003_hit
  1758. PlaySoundAtBall "fx_target"
  1759. If Tilted Then Exit Sub
  1760. Addscore 5000
  1761. If TargetRightLight1.State Then AddBonus 1
  1762. End Sub
  1763.  
  1764. Sub Target004_hit
  1765. PlaySoundAtBall "fx_target"
  1766. If Tilted Then Exit Sub
  1767. Addscore 5000
  1768. If TargetRightLight2.State Then AddBonus 1
  1769. End Sub
  1770.  
  1771. '******************************
  1772. ' Drop Targets
  1773. '******************************
  1774.  
  1775. ' left bank
  1776.  
  1777. Sub dt001_Hit
  1778. PlaySoundAt "fx_droptarget", dt001
  1779. If Tilted Then Exit Sub
  1780. If LeftTarget500.State Then
  1781. AddBonus 1
  1782. Addscore 5000
  1783. dt001.UserValue = 1
  1784. CheckLeftBank
  1785. End If
  1786. End Sub
  1787.  
  1788. Sub dt002_Hit
  1789. PlaySoundAt "fx_droptarget", dt002
  1790. If Tilted Then Exit Sub
  1791. If LeftTarget500.State Then
  1792. AddBonus 1
  1793. Addscore 5000
  1794. dt002.UserValue = 1
  1795. CheckLeftBank
  1796. End If
  1797. End Sub
  1798.  
  1799. Sub dt003_Hit
  1800. PlaySoundAt "fx_droptarget", dt003
  1801. If Tilted Then Exit Sub
  1802. If LeftTarget500.State Then
  1803. AddBonus 1
  1804. Addscore 5000
  1805. dt003.UserValue = 1
  1806. CheckLeftBank
  1807. End If
  1808. If LeftTarget5000.State Then
  1809. Addscore 50000
  1810. dt003.UserValue = 2
  1811. If dt008.UserValue = 2 Then
  1812. If ABCComplete Then
  1813. LeftSpecialLight.State = 1
  1814. End If
  1815. vpmtimer.addtimer 1000, "ResetWhiteTargets '"
  1816. End If
  1817. End If
  1818. End Sub
  1819.  
  1820. Sub dt004_Hit
  1821. PlaySoundAt "fx_droptarget", dt004
  1822. If Tilted Then Exit Sub
  1823. If LeftTarget500.State Then
  1824. AddBonus 1
  1825. Addscore 5000
  1826. dt004.UserValue = 1
  1827. CheckLeftBank
  1828. End If
  1829. End Sub
  1830.  
  1831. Sub dt005_Hit
  1832. PlaySoundAt "fx_droptarget", dt005
  1833. If Tilted Then Exit Sub
  1834. If LeftTarget500.State Then
  1835. AddBonus 1
  1836. Addscore 5000
  1837. dt005.UserValue = 1
  1838. CheckLeftBank
  1839. End If
  1840. End Sub
  1841.  
  1842. Sub CheckLeftBank
  1843. If dt001.UserValue + dt002.UserValue + dt003.UserValue + dt004.UserValue + dt005.UserValue = 5 Then
  1844. If ABCComplete Then
  1845. LeftSpecialLight.State = 1
  1846. End If
  1847. CheckAllDown
  1848. End If
  1849. End Sub
  1850.  
  1851. ' right bank
  1852.  
  1853. Sub dt006_Hit
  1854. PlaySoundAt "fx_droptarget", dt006
  1855. If Tilted Then Exit Sub
  1856. If LeftTarget500.State Then
  1857. AddBonus 1
  1858. Addscore 5000
  1859. dt006.UserValue = 1
  1860. CheckRightBank
  1861. End If
  1862. End Sub
  1863.  
  1864. Sub dt007_Hit
  1865. PlaySoundAt "fx_droptarget", dt007
  1866. If Tilted Then Exit Sub
  1867. If LeftTarget500.State Then
  1868. AddBonus 1
  1869. Addscore 5000
  1870. dt007.UserValue = 1
  1871. CheckRightBank
  1872. End If
  1873. End Sub
  1874.  
  1875. Sub dt008_Hit
  1876. PlaySoundAt "fx_droptarget", dt008
  1877. If Tilted Then Exit Sub
  1878. If LeftTarget500.State Then
  1879. AddBonus 1
  1880. Addscore 5000
  1881. dt008.UserValue = 1
  1882. CheckRightBank
  1883. End If
  1884. If RightTarget5000.State Then
  1885. Addscore 50000
  1886. dt008.UserValue = 2
  1887. If dt003.UserValue = 2 Then
  1888. If ABCComplete Then
  1889. RightSpecialLight.State = 1
  1890. End If
  1891. vpmtimer.addtimer 1000, "ResetWhiteTargets '"
  1892. End If
  1893. End If
  1894. End Sub
  1895.  
  1896. Sub dt009_Hit
  1897. PlaySoundAt "fx_droptarget", dt009
  1898. If Tilted Then Exit Sub
  1899. If LeftTarget500.State Then
  1900. AddBonus 1
  1901. Addscore 5000
  1902. dt009.UserValue = 1
  1903. CheckRightBank
  1904. End If
  1905. End Sub
  1906.  
  1907. Sub dt010_Hit
  1908. PlaySoundAt "fx_droptarget", dt010
  1909. If Tilted Then Exit Sub
  1910. If LeftTarget500.State Then
  1911. AddBonus 1
  1912. Addscore 5000
  1913. dt010.UserValue = 1
  1914. CheckRightBank
  1915. End If
  1916. End Sub
  1917.  
  1918. Sub CheckRightBank
  1919. If dt006.UserValue + dt007.UserValue + dt008.UserValue + dt009.UserValue + dt010.UserValue = 5 Then
  1920. If ABCComplete Then
  1921. RightSpecialLight.State = 1
  1922. End If
  1923. CheckAllDown
  1924. End If
  1925. End Sub
  1926.  
  1927. Sub CheckAllDown
  1928. If dt001.UserValue + dt002.UserValue + dt003.UserValue + dt004.UserValue + dt005.UserValue + dt006.UserValue + dt007.UserValue + dt008.UserValue + dt009.UserValue + dt010.UserValue = 10 Then
  1929. LeftTarget500.State = 0
  1930. RightTarget500.State = 0
  1931. LeftTarget5000.State = 1
  1932. RightTarget5000.State = 1
  1933. vpmtimer.addtimer 1000, "ResetWhiteTargets '"
  1934.  
  1935. End If
  1936. End Sub
  1937.  
  1938. Sub ResetWhiteTargets
  1939. PlaySoundAt SoundFXDOF("fx_resetdrop",111,DOFPulse,DOFContactors), lifull
  1940. dt003.IsDropped = 0
  1941. dt003.UserValue = 0
  1942. dt008.IsDropped = 0
  1943. dt008.UserValue = 0
  1944. End Sub
  1945.  
  1946. Sub ResetLeftDroptargets
  1947. Dim i
  1948. PlaySoundAt SoundFXDOF("fx_resetdrop",111,DOFPulse,DOFContactors), dt003
  1949. For each i in aLeftDroptargets
  1950. i.IsDropped = 0
  1951. i.UserValue = 0
  1952. Next
  1953. End Sub
  1954.  
  1955. Sub ResetRightDroptargets
  1956. Dim i
  1957. PlaySoundAt SoundFXDOF("fx_resetdrop",111,DOFPulse,DOFContactors), dt008
  1958. For each i in aRightDroptargets
  1959. i.IsDropped = 0
  1960. i.UserValue = 0
  1961. Next
  1962. End Sub
  1963.  
  1964. '******************************
  1965. ' Holes
  1966. '******************************
  1967.  
  1968. Sub kicker001_Hit
  1969. PlaySoundAt "fx_kicker_enter", kicker001
  1970. If Not Tilted Then
  1971. AddScore 100
  1972. If LeftSpecialLight.State Then
  1973. LeftSpecialLight.State = 0
  1974. AwardSpecial
  1975. End If
  1976. End If
  1977. vpmtimer.addtimer 1500, "PlaySoundAt""fx_kicker"", kicker001: kicker001.kick 38,13 + RND(1) * 4:DOF 103, DOFPulse '"
  1978. End Sub
  1979.  
  1980. Sub kicker002_Hit 'center
  1981. PlaySoundAt "fx_kicker_enter", kicker002
  1982. If Not Tilted Then
  1983. AddScore 100
  1984. If RightSpecialLight.State Then
  1985. RightSpecialLight.State = 0
  1986. AwardSpecial
  1987. End If
  1988. End If
  1989. vpmtimer.addtimer 1500, "PlaySoundAt""fx_kicker"", kicker002: kicker002.kick 322,13 + RND(1) * 4:DOF 105, DOFPulse '"
  1990. End Sub
  1991.  
  1992.  
  1993. '-----------------------------
  1994. '----- FS Display Code -----
  1995. '-----------------------------
  1996.  
  1997. 'If You want to hide a display, set the reel value of every reel to 44. This picture is transparent
  1998. 'This is best done using collection:
  1999. '
  2000. ' If HideDisplay then
  2001. ' For Each obj in ReelsCollection:obj.setvalue(44):next
  2002. ' end if
  2003.  
  2004.  
  2005. Dim Char(32),TempText 'increase dimension if You need larger displays
  2006.  
  2007.  
  2008.  
  2009. '-----------------------------------------------
  2010. '----- B2S section, not used in the demo -----
  2011. '-----------------------------------------------
  2012.  
  2013. Sub DisplayB2SText(TextPar) 'Procedure to display Text on a 28 digit B2S LED reel. Assuming that it is display 1 with internal digit numbers 1-32
  2014. If B2SOn Then
  2015. TempText = TextPar
  2016. for i = 1 to 32
  2017. if i <= len(TextPar) then
  2018. Char(i) = left(TempText,1)
  2019. TempText = right(Temptext,len(TempText)-1)
  2020. else
  2021. Char(i) = " "
  2022. end if
  2023. next
  2024. if B2SOn Then
  2025. for i = 1 to 32
  2026. controller.B2SSetLED i,B2SLEDValue(Char(i))
  2027. next
  2028. end if
  2029. End If
  2030. End Sub
  2031.  
  2032. Dim i
  2033.  
  2034. Sub DisplayB2SText2(TextPar) 'Procedure to display Text on a 28 digit B2S LED reel. Assuming that it is display 1 with internal digit numbers 1-32
  2035. If B2SOn Then
  2036. TempText = TextPar
  2037. for i = 1 to 32
  2038. if i <= len(TextPar) then
  2039. Char(i) = left(TempText,1)
  2040. TempText = right(Temptext,len(TempText)-1)
  2041. else
  2042. Char(i) = " "
  2043. end if
  2044. next
  2045.  
  2046. for i = 1 to 32
  2047. controller.B2SSetLED i,B2SLEDValue(Char(i))
  2048.  
  2049. next
  2050. End If
  2051.  
  2052. DMDUpdate.interval = 2000
  2053. DMDUpdate.enabled = 1
  2054.  
  2055. End Sub
  2056.  
  2057.  
  2058.  
  2059. Function B2SLEDValue(CharPar) 'to be used with dB2S 15-segments-LED used in Herweh's Designer
  2060. B2SLEDValue = 0 'default for unknown characters
  2061. select case CharPar
  2062. Case "","": B2SLEDValue = 0
  2063. Case "0": B2SLEDValue = 63
  2064. Case "1": B2SLEDValue = 8704
  2065. Case "2": B2SLEDValue = 2139
  2066. Case "3": B2SLEDValue = 2127
  2067. Case "4": B2SLEDValue = 2150
  2068. Case "5": B2SLEDValue = 2157
  2069. Case "6": B2SLEDValue = 2172
  2070. Case "7": B2SLEDValue = 7
  2071. Case "8": B2SLEDValue = 2175
  2072. Case "9": B2SLEDValue = 2159
  2073. Case "A": B2SLEDValue = 2167
  2074. Case "B": B2SLEDValue = 10767
  2075. Case "C": B2SLEDValue = 57
  2076. Case "D": B2SLEDValue = 8719
  2077. Case "E": B2SLEDValue = 121
  2078. Case "F": B2SLEDValue = 2161
  2079. Case "G": B2SLEDValue = 2109
  2080. Case "H": B2SLEDValue = 2166
  2081. Case "I": B2SLEDValue = 8713
  2082. Case "J": B2SLEDValue = 31
  2083. Case "K": B2SLEDValue = 5232
  2084. Case "L": B2SLEDValue = 56
  2085. Case "M": B2SLEDValue = 1334
  2086. Case "N": B2SLEDValue = 4406
  2087. Case "O": B2SLEDValue = 63
  2088. Case "P": B2SLEDValue = 2163
  2089. Case "Q": B2SLEDValue = 4287
  2090. Case "R": B2SLEDValue = 6259
  2091. Case "S": B2SLEDValue = 2157
  2092. Case "T": B2SLEDValue = 8705
  2093. Case "U": B2SLEDValue = 62
  2094. Case "V": B2SLEDValue = 17456
  2095. Case "W": B2SLEDValue = 20534
  2096. Case "X": B2SLEDValue = 21760
  2097. Case "Y": B2SLEDValue = 9472
  2098. Case "Z": B2SLEDValue = 17417
  2099. Case "<": B2SLEDValue = 5120
  2100. Case ">": B2SLEDValue = 16640
  2101. Case "^": B2SLEDValue = 17414
  2102. Case ".": B2SLEDValue = 8
  2103. Case "!": B2SLEDValue = 0
  2104. Case ".": B2SLEDValue = 128
  2105. Case "*": B2SLEDValue = 32576
  2106. Case "/": B2SLEDValue = 17408
  2107. Case "\": B2SLEDValue = 4352
  2108. Case "|": B2SLEDValue = 8704
  2109. Case "=": B2SLEDValue = 2120
  2110. Case "+": B2SLEDValue = 10816
  2111. Case "-": B2SLEDValue = 2112
  2112. end select
  2113. B2SLEDValue = cint(B2SLEDValue)
  2114. End Function
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120. Dim Ball
  2121.  
  2122.  
  2123. Sub DMDUpdate_Timer
  2124. DMDUpdate.enabled = 0
  2125. If PlayersPlayingGame = 1 And BallsOnPlayfield >= 1 Then
  2126. DMDScore
  2127. AddScore (0)
  2128. DMDUpdate.interval = 1000
  2129. DMDUpdate.enabled = 1
  2130. Else
  2131. DMDUpdate.interval = 1500
  2132. DMDUpdate.enabled = 1
  2133. End If
  2134. End Sub
  2135.  
  2136. '*********************************************************************
  2137. ' Positional Sound Playback Functions
  2138. '*********************************************************************
  2139.  
  2140. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  2141. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  2142. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  2143. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  2144. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  2145. End Sub
  2146.  
  2147. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  2148. Sub PlaySoundAt(soundname, tableobj)
  2149. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  2150. End Sub
  2151.  
  2152. Sub PlaySoundAtBall(soundname)
  2153. PlaySoundAt soundname, ActiveBall
  2154. End Sub
  2155.  
  2156.  
  2157. '*********************************************************************
  2158. ' Supporting Ball & Sound Functions
  2159. '*********************************************************************
  2160.  
  2161. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  2162. Dim tmp
  2163. tmp = tableobj.y * 2 / table1.height-1
  2164. If tmp > 0 Then
  2165. AudioFade = Csng(tmp ^10)
  2166. Else
  2167. AudioFade = Csng(-((- tmp) ^10) )
  2168. End If
  2169. End Function
  2170.  
  2171. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  2172. Dim tmp
  2173. tmp = tableobj.x * 2 / table1.width-1
  2174. If tmp > 0 Then
  2175. AudioPan = Csng(tmp ^10)
  2176. Else
  2177. AudioPan = Csng(-((- tmp) ^10) )
  2178. End If
  2179. End Function
  2180.  
  2181. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  2182. Vol = Csng(BallVel(ball) ^2 / 2000)
  2183. End Function
  2184.  
  2185. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  2186. Pitch = BallVel(ball) * 20
  2187. End Function
  2188.  
  2189. Function BallVel(ball) 'Calculates the ball speed
  2190. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  2191. End Function
  2192.  
  2193.  
  2194. '********************************************************************
  2195. ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
  2196. '********************************************************************
  2197.  
  2198. Const tnob = 5 ' total number of balls
  2199. ReDim rolling(tnob)
  2200. InitRolling
  2201.  
  2202. Sub InitRolling
  2203. Dim i
  2204. For i = 0 to tnob
  2205. rolling(i) = False
  2206. Next
  2207. End Sub
  2208.  
  2209. Sub RollingTimer_Timer()
  2210. Dim BOT, b
  2211. BOT = GetBalls
  2212.  
  2213. ' stop the sound of deleted balls
  2214. For b = UBound(BOT) + 1 to tnob
  2215. rolling(b) = False
  2216. StopSound("fx_ballrolling" & b)
  2217. Next
  2218.  
  2219. ' exit the sub if no balls on the table
  2220. If UBound(BOT) = -1 Then Exit Sub
  2221.  
  2222. For b = 0 to UBound(BOT)
  2223. ' play the rolling sound for each ball
  2224. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  2225. rolling(b) = True
  2226. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  2227. Else
  2228. If rolling(b) = True Then
  2229. StopSound("fx_ballrolling" & b)
  2230. rolling(b) = False
  2231. End If
  2232. End If
  2233.  
  2234. ' play ball drop sounds
  2235. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  2236. PlaySound "fx_ball_drop" & b, 0, ABS(BOT(b).velz)/17, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  2237. End If
  2238. Next
  2239. End Sub
  2240.  
  2241. '**********************
  2242. ' Ball Collision Sound
  2243. '**********************
  2244.  
  2245. Sub OnBallBallCollision(ball1, ball2, velocity)
  2246. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  2247. End Sub
  2248.  
  2249.  
  2250.  
  2251.  
  2252. '************************************
  2253. ' What you need to add to your table
  2254. '************************************
  2255.  
  2256. ' a timer called RollingTimer. With a fast interval, like 10
  2257. ' one collision sound, in this script is called fx_collide
  2258. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  2259. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  2260.  
  2261.  
  2262. '******************************************
  2263. ' Explanation of the rolling sound routine
  2264. '******************************************
  2265.  
  2266. ' sounds are played based on the ball speed and position
  2267.  
  2268. ' the routine checks first for deleted balls and stops the rolling sound.
  2269.  
  2270. ' The For loop goes through all the balls on the table and checks for the ball speed and
  2271. ' if the ball is on the table (height lower than 30) then then it plays the sound
  2272. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  2273.  
  2274. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  2275. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  2276. ' according to the position of the ball on the table.
  2277.  
  2278.  
  2279. '**************************************
  2280. ' Explanation of the collision routine
  2281. '**************************************
  2282.  
  2283. ' The collision is built in VP.
  2284. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  2285. ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
  2286. ' depending of the speed of the collision.
  2287.  
  2288.  
  2289. Sub Pins_Hit (idx)
  2290. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2291. End Sub
  2292.  
  2293. Sub Targets_Hit (idx)
  2294. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  2295. End Sub
  2296.  
  2297. Sub Metals_Thin_Hit (idx)
  2298. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2299. End Sub
  2300.  
  2301. Sub Metals_Medium_Hit (idx)
  2302. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2303. End Sub
  2304.  
  2305. Sub Metals2_Hit (idx)
  2306. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2307. End Sub
  2308.  
  2309. Sub Gates_Hit (idx)
  2310. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2311. End Sub
  2312.  
  2313. Sub Spinner_Spin
  2314. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  2315. End Sub
  2316.  
  2317. Sub Rubbers_Hit(idx)
  2318. dim finalspeed
  2319. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2320. If finalspeed > 20 then
  2321. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2322. End if
  2323. If finalspeed >= 6 AND finalspeed <= 20 then
  2324. RandomSoundRubber()
  2325. End If
  2326. End Sub
  2327.  
  2328. Sub Posts_Hit(idx)
  2329. dim finalspeed
  2330. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2331. If finalspeed > 16 then
  2332. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2333. End if
  2334. If finalspeed >= 6 AND finalspeed <= 16 then
  2335. RandomSoundRubber()
  2336. End If
  2337. End Sub
  2338.  
  2339. Sub RandomSoundRubber()
  2340. Select Case Int(Rnd*3)+1
  2341. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2342. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2343. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2344. End Select
  2345. End Sub
  2346.  
  2347. Sub LeftFlipper_Collide(parm)
  2348. RandomSoundFlipper()
  2349. End Sub
  2350.  
  2351. Sub RightFlipper_Collide(parm)
  2352. RandomSoundFlipper()
  2353. End Sub
  2354.  
  2355. Sub RandomSoundFlipper()
  2356. Select Case Int(Rnd*3)+1
  2357. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2358. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2359. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  2360. End Select
  2361. End Sub
  2362.  
  2363.  
Advertisement
Add Comment
Please, Sign In to add comment