Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.28 KB | None | 0 0
  1. 'Spider-Man Vault Edition
  2. 'Stern 2016
  3. 'Table Recreation by Alessio for Visual Pinball 10
  4.  
  5. '******************************************************
  6. '* LAYERS *********************************************
  7. '******************************************************
  8. '* LAYER 1 = COLLISION OBJECTS ************************
  9. '* LAYER 2 = PLASTICS AND DECALS **********************
  10. '* LAYER 3 = RAMPS ***********************************
  11. '* LAYER 4 = 3D OBJECTS *******************************
  12. '* LAYER 5 = LIGHTS REFLECTIONS ***********************
  13. '* LAYER 6 = GI LIGHTS ********************************
  14. '* LAYER 7 = FLASHERS *********************************
  15. '* LAYER 8 = INSERTS AND SPOTLIGHTS *******************
  16. '******************************************************
  17.  
  18. Option Explicit
  19. Randomize
  20.  
  21. On Error Resume Next
  22. ExecuteGlobal GetTextFile("controller.vbs")
  23. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  24. On Error Goto 0
  25.  
  26. 'Const BallSize = 50
  27.  
  28. Dim Ballsize,BallMass
  29. BallSize = 50
  30. BallMass = (Ballsize^3)/125000
  31.  
  32.  
  33. Const UseVPMModSol = 1
  34.  
  35. Dim DesktopMode:DesktopMode = Table1.ShowDT
  36. Dim UseVPMColoredDMD
  37.  
  38. UseVPMColoredDMD = DesktopMode
  39.  
  40. LoadVPM "01560000", "sam.VBS", 3.10
  41.  
  42. lamptimer.interval = -1
  43.  
  44. '********************
  45. 'Standard definitions
  46. '********************
  47.  
  48. Const UseSolenoids = 1
  49. Const UseLamps = 0
  50. Const UseSync = 0
  51. Const HandleMech = 0
  52.  
  53. 'Standard Sounds
  54. Const SSolenoidOn = "Solenoid"
  55. Const SSolenoidOff = ""
  56. Const SFlipperOn = "FlipperUp"
  57. Const SFlipperOff = "FlipperDown"
  58. Const SCoin = "coin"
  59.  
  60. '************
  61. ' Table init.
  62. '************
  63.  
  64. 'Const cGameName = "sman_261" 'ENGLISH VERSION
  65.  
  66. 'Const cGameName = "smanve_101" 'ENGLISH VERSION
  67.  
  68. Const cGameName = "smanve_101c" 'ENGLISH VERSION DMD COLORED
  69.  
  70.  
  71. 'Const cGameName = "sman_210ai" 'ITALIAN VERSION
  72.  
  73. 'Variables
  74. Dim bsTrough, bsSandman, bsDocOck, x
  75. Dim mag1
  76. Dim PlungerIM
  77. Dim PalleInGioco
  78. Dim Attendi
  79. Dim DocMagnet
  80.  
  81. Sub Table1_Init
  82. vpmInit Me
  83. With Controller
  84. .GameName = cGameName
  85. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  86. .SplashInfoLine = "Spider Man Vault Edition(Stern 2016)"
  87. .Games(cGameName).Settings.Value("rol") = 0
  88. .HandleKeyboard = 0
  89. .ShowTitle = 0
  90. .ShowDMDOnly = 1
  91. .ShowFrame = 0
  92. .HandleMechanics = 0
  93. .Hidden = DesktopMode
  94. On Error Resume Next
  95. .Run GetPlayerHWnd
  96. If Err Then MsgBox Err.Description
  97. On Error Goto 0
  98. End With
  99.  
  100.  
  101. 'Trough
  102. Set bsTrough = New cvpmTrough
  103. bsTrough.Size = 4
  104. bsTrough.InitSwitches Array(21, 20, 19, 18)
  105. ' bsTrough.EntrySw = 0
  106. bsTrough.InitExit BallRelease, 90, 8
  107. bsTrough.InitExitSounds SoundFX("Solenoid",DOFContactors), SoundFX("ballrelease",DOFContactors)
  108. bsTrough.Balls = 4
  109.  
  110. 'Sandman VUK
  111. Set bsSandman = New cvpmSaucer
  112. bsSandman.InitKicker sw59, 59, 0, 45, 1.56 'ORIGINALE: 59,0,35,1.56
  113. bsSandman.InitSounds "kicker_enter", SoundFX("Solenoid",DOFContactors), SoundFX("ExitSandman",DOFContactors)
  114.  
  115. 'Doc Ock VUK
  116. Set bsDocOck = New cvpmSaucer
  117. bsDocOck.InitKicker sw36, 36, 0, 45, 1.56 'ORIGINALE: 36,0,35,1.56
  118.  
  119. bsDocOck.InitSounds "kicker_enter", SoundFX("Solenoid",DOFContactors), SoundFX("ExitDoc",DOFContactors)
  120.  
  121. 'Doc Ock Magmet
  122. Set DocMagnet = New cvpmMagnet
  123. DocMagnet.InitMagnet DocOckMagnet, 50
  124. DocMagnet.Solenoid = 3
  125. 'DocMagnet.GrabCenter = True
  126. DocMagnet.CreateEvents "DocMagnet"
  127.  
  128. 'Loop Diverter
  129. diverter.IsDropped = 1
  130.  
  131. 'Nudging
  132. vpmNudge.TiltSwitch=-7
  133. vpmNudge.Sensitivity=3
  134. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
  135.  
  136. 'Main Timer init
  137. PinMAMETimer.Interval = PinMAMEInterval
  138. PinMAMETimer.Enabled = 1
  139.  
  140. ' Impulse Plunger
  141. Const IMPowerSetting = 55
  142. Const IMTime = 0.6
  143. Set plungerIM = New cvpmImpulseP
  144. With plungerIM
  145. .InitImpulseP swplunger, IMPowerSetting, IMTime
  146. .Switch 23
  147. .Random 0.3
  148. .InitExitSnd SoundFX("solenoid",DOFContactors), ""
  149. .CreateEvents "plungerIM"
  150. End With
  151. Attendi=1
  152. PausaAnimazione.Enabled=1
  153. Controller.Switch(50)=1
  154. Controller.Switch(53)=1
  155. Controller.Switch(57)=1
  156. BankAlto=1
  157. SandmanPronto=0
  158. PalleInGioco=0
  159. SandmanAlto=0
  160. PallaBucoOctopus=0
  161. PallaBucoSandman=0
  162. PallaSuMagnete=0
  163. sw16Premuto=0
  164. sw17Premuto=0
  165. 'AlzaSandman
  166. sw36.Enabled=0
  167. sw59.Enabled=0
  168.  
  169. InitVpmFFlipsSAM
  170.  
  171. End Sub
  172.  
  173. Sub table1_Paused:Controller.Pause = 1:End Sub
  174. Sub table1_unPaused:Controller.Pause = 0:End Sub
  175. Sub table1_exit():Controller.Stop:End Sub
  176.  
  177. '************************************
  178. ' PAUSA ANIMAZIONE DOPO AVVIO TAVOLO
  179. '************************************
  180.  
  181. Sub PausaAnimazione_Timer()
  182. Attendi=0
  183. sw63.IsDropped=1
  184. Me.Enabled=0
  185. End Sub
  186.  
  187. Dim bulb
  188.  
  189. Set GICallback = GetRef("UpdateGI")
  190.  
  191. Sub UpdateGI(nr,enabled)
  192. DOF 200, enabled*-1
  193. Select Case nr
  194. Case 0
  195. For each bulb in GI
  196. bulb.state=enabled
  197. GestioneGIWall
  198. next
  199. End Select
  200. End Sub
  201.  
  202. Sub GestioneGIWall
  203. If LAPiano.state= 0 Then
  204. SpegniLuciWall
  205. Else
  206. AccendiLuciWall
  207. End If
  208. End Sub
  209.  
  210. Sub LHP1_UnHit()
  211. If ActiveBall.velY < 0 Then 'ball is going up
  212. PlaySound "rrenter"
  213. Playsound "plasticrolling"
  214. Else
  215. StopSound "rrenter"
  216. StopSound "plasticrolling"
  217. End If
  218. End Sub
  219.  
  220. Sub LHP2_UnHit()
  221. If ActiveBall.velY < 0 Then 'ball is going up
  222. Playsound "plasticrolling"
  223. PlaySound "rrenter"
  224. Else
  225. StopSound "plasticrolling"
  226. StopSound "rrenter"
  227. End If
  228. End Sub
  229.  
  230. Sub RHP1_UnHit()
  231. If ActiveBall.velY < 0 Then 'ball is going up
  232. Playsound "plasticrolling"
  233. PlaySound "rrenter"
  234. Else
  235. StopSound "plasticrolling"
  236. StopSound "rrenter"
  237. End If
  238. End Sub
  239.  
  240. '********************************************
  241. ' Depotenzia magnete dopo presa della palla
  242. '********************************************
  243.  
  244. Dim PallaSuMagnete
  245.  
  246. Sub PresenzaSuMagnete_Hit() 'CON PALLA SUL MAGNETE RIDUCE LA POTENZA DELLA CALAMITA
  247. If DocMagnet.MagnetON= True Then DepotenziaMagnete.Enabled=True: Playsound "Magnete"
  248. PallaSuMagnete=1
  249. End Sub
  250.  
  251.  
  252. Sub PresenzaSuMagnete_UnHit() 'IN USCITA DAL MAGNETE VIENE RIPRISTINATA LA POTENZA DELLA CALAMITA
  253. If DocMagnet.MagnetON= False Then DocMagnet.InitMagnet DocOckMagnet, 50
  254. PallaSuMagnete=0
  255. End Sub
  256.  
  257.  
  258. Sub DepotenziaMagnete_timer() 'TIMER PER RIDURRE LA POTENZA DEL MAGNETE
  259. DocMagnet.MagnetON= False
  260. DocMagnet.InitMagnet DocOckMagnet, 2
  261. DocMagnet.MagnetON= True
  262. Me.Enabled = 0
  263. End Sub
  264.  
  265.  
  266. '************************************
  267. ' Lancio palla dopo sgancio magnete
  268. '************************************
  269.  
  270. Dim Pausa
  271.  
  272. Sub solDocMagnet(enabled)
  273. MagnetOffTimer.Enabled = Not enabled
  274. If enabled Then DocMagnet.MagnetOn = True
  275. End Sub
  276.  
  277. Sub MagnetOffTimer_Timer
  278. Dim ball
  279. For Each ball In DocMagnet.Balls
  280. With ball
  281. 'RilanciaPallaMagnete.Enabled=1
  282. .VelX = 15: .VelY = -8: Pausa= 1 'ERA VelX = 15: .VelY = -7
  283. 'If PalleIngioco=1 Then .VelX = 15: .VelY = -15: Pausa= 1 'REGOLARE VELY PER AUMENTARE IL LANCIO DELLA PALLA (NEGATIVO PER ANDARE VERSO L'ALTO)
  284. 'If PalleIngioco>1 Then .VelX = 15: .VelY = -15: Pausa= 1 'REGOLARE VELY PER AUMENTARE IL LANCIO DELLA PALLA (NEGATIVO PER ANDARE VERSO L'ALTO)
  285. End With
  286. Next
  287. Me.Enabled = False:DocMagnet.MagnetOn = False
  288. End Sub
  289.  
  290. Sub DocOckMagnet_UnHit()
  291. If Pausa=1 Then
  292. DocMagnet.MagnetON= False
  293. DocMagnet.InitMagnet DocOckMagnet, 0
  294. DocOckMagnet.Enabled=0
  295. MagneteDisabilitato.Enabled=1
  296. End If
  297. End Sub
  298.  
  299. Sub MagneteDisabilitato_Timer()
  300. DocMagnet.InitMagnet DocOckMagnet, 50
  301. Pausa= 0
  302. DocOckMagnet.Enabled=1
  303. Me.Enabled=0
  304. End Sub
  305.  
  306. '**********
  307. ' Keys
  308. '**********
  309.  
  310. Sub Table1_KeyDown(ByVal Keycode)
  311.  
  312. If keycode = PlungerKey Then
  313. Plunger.PullBack:Playsound "plungerpull"
  314. End If
  315.  
  316. If Keycode = RightFlipperKey then
  317. Controller.Switch(86)=1 ' UR Flipper
  318. End If
  319.  
  320. If keycode = LeftTiltKey Then PlaySound SoundFX("fx_nudge",0)
  321. If keycode = RightTiltKey Then PlaySound SoundFX("fx_nudge",0)
  322. If keycode = CenterTiltKey Then PlaySound SoundFX("fx_nudge",0)
  323. If vpmKeyDown(Keycode) Then Exit Sub
  324. End Sub
  325.  
  326. Sub Table1_KeyUp(ByVal Keycode)
  327. If keycode = PlungerKey Then
  328. Plunger.Fire: Playsound "Plunger"
  329. End If
  330. If vpmKeyUp(Keycode) Then Exit Sub
  331.  
  332. If Keycode = RightFlipperKey then
  333. Controller.Switch(86)=0 ' UR flipper
  334. End If
  335. End Sub
  336.  
  337. 'Realtime updates
  338.  
  339. Sub GatesTimer_Timer()
  340. GateSWsx.RotZ= -Gate2.currentangle
  341. GateSWdx.RotZ= -Gate3.currentangle
  342. GateP0.RotX = -Gate4.currentangle + 90
  343. GateP1.RotX = -Gate5.currentangle + 90
  344. GateP2.RotX = -LeftRampEnd.currentangle + 90 'gate V shape
  345. GateP3.RotX = -LeftRampStart.currentangle + 90
  346. GateP4.RotX = -RightRampEnd.currentangle +90 'gate V shape
  347. GateP5.RotX = -RightRampStart.currentangle +90
  348. UpdateFlipperLogos
  349. End Sub
  350.  
  351. Sub UpdateFlipperLogos
  352. flipperl.RotY = LeftFlipper.CurrentAngle
  353. flipperr.RotY = RightFlipper.CurrentAngle
  354. flipperr1.RotY = RightFlipper2.CurrentAngle
  355. End Sub
  356.  
  357. 'Solenoids
  358. SolCallback(1) = "solTrough"
  359. SolCallback(2) = "solAutofire"
  360. SolCallback(3) = "solDocMagnet"
  361. SolModCallback(3) = "SetModLampmm 0, 200,"
  362.  
  363. SolCallback(4) = "solDocVUK"
  364. SolCallback(5) = "solDocMotor"
  365. 'SolCallback(6) = "ShakerMotor"
  366. SolCallback(7) = "Gate2.open ="
  367. SolCallback(8) = "Gate3.open ="
  368. SolCallback(9) = "solLBump"
  369. SolCallback(10) = "solRBump"
  370. SolCallback(11) = "solBBump"
  371. SolCallback(12) = "solSandVUK"
  372. SolCallback(13) = "solSandMotor"
  373. SolCallback(14) = "solURFlipper"
  374. SolCallback(15) = "solLFlipper"
  375. SolCallback(16) = "solRFlipper"
  376. SolCallback(17) = "solLSling"
  377. SolCallback(18) = "solRSling"
  378. 'SolCallback(19) = "solGoblin" 'SHAKE GOBLIN VERSIONE VE DISABILITATO
  379. SolCallback(20) = "sol3Bank"
  380. SolCallback(22) = "solDivert"
  381. SolCallback(24) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  382. SolModCallBack(21) = "SetModLamp 121,"
  383. SolModCallBack(23) = "SetModLamp 123,"
  384. SolModCallBack(25) = "SetModLamp 125,"
  385. SolModCallBack(26) = "SetModLamp 126,"
  386. SolModCallBack(27) = "SetModLamp 127,"
  387. SolModCallBack(28) = "SetModLamp 128,"
  388. SolModCallBack(29) = "SetModLamp 129,"
  389. SolModCallBack(30) = "SetModLamp 130,"
  390. SolModCallBack(31) = "SetModLamp 131,"
  391.  
  392. 'Solenoid Functions
  393. Sub solTrough(Enabled)
  394. If Enabled Then
  395. bsTrough.ExitSol_On
  396. vpmTimer.PulseSw 22
  397. End If
  398. End Sub
  399.  
  400. Sub solAutofire(Enabled)
  401. If Enabled Then
  402. PlungerIM.AutoFire
  403. End If
  404. End Sub
  405.  
  406.  
  407. Sub solDocMotor(Enabled)
  408. If Enabled Then
  409. If sw63.IsDropped Then
  410. Controller.Switch(58) = 0
  411. Controller.Switch(57) = 1
  412. sw63.IsDropped=0
  413. AbbassaOctopus
  414. Else
  415. Controller.Switch(57) = 0
  416. Controller.Switch(58) = 1
  417. If Attendi=0 Then AlzaOctopus
  418. End If
  419. End If
  420. End Sub
  421.  
  422. Sub solSandMotor(Enabled)
  423. If Enabled Then
  424. If sw42.IsDropped Then
  425. Controller.Switch(54) =0
  426. Controller.Switch(53) =1
  427. sw42.IsDropped=0
  428. AbbassaSandman
  429. Else
  430. Controller.Switch(53) =0
  431. Controller.Switch(54) =1
  432. AlzaSandman
  433. End If
  434. End If
  435. End Sub
  436.  
  437. Sub Sol3Bank(Enabled)
  438. If Enabled Then
  439. If sw11.IsDropped Then
  440. Controller.Switch(49)=0
  441. Controller.Switch(50)=1
  442. ParetiBankSu
  443. AlzaBank
  444. Else
  445. Controller.Switch(50)=0
  446. Controller.Switch(49)=1
  447. AbbassaBank
  448. End If
  449. End If
  450. End Sub
  451.  
  452. Sub solSandVUK(Enabled) 'GESTIONE SOLENOIDE Sandman
  453. If Enabled Then
  454. bsSandman.ExitSol_On
  455. SolenoideSandmanAbilitato
  456. Playsound "SolenoideFuori"
  457. End If
  458. End Sub
  459.  
  460. Sub SolenoideSandmanAbilitato
  461. SolenoideSandman.TransZ= -50
  462. SolenoideUscitaSandman.enabled=1
  463. End Sub
  464.  
  465. Sub SolenoideUscitaSandman_Timer 'GESTIONE PISTONE LANCIO PALLA Octopus
  466. SolenoideSandman.TransZ= -59
  467. Playsound "SolenoideDentro"
  468. Me.Enabled=0
  469. End Sub
  470.  
  471. Sub solDocVUK(Enabled) 'GESTIONE SOLENOIDE Octopus
  472. If Enabled Then
  473. bsDocOck.ExitSol_On
  474. SolenoideOctopusAbilitato
  475. Playsound "SolenoideFuori"
  476. End If
  477. End Sub
  478.  
  479. Sub SolenoideOctopusAbilitato
  480. SolenoideOctopus.TransZ= -50
  481. SolenoideUscitaOctopus.enabled=1
  482. End Sub
  483.  
  484. Sub SolenoideUscitaOctopus_Timer 'GESTIONE PISTONE LANCIO PALLA Octopus
  485. SolenoideOctopus.TransZ= -59
  486. Playsound "SolenoideDentro"
  487. Me.Enabled=0
  488. End Sub
  489.  
  490. Dim LockAttivo
  491.  
  492. Sub solDivert(Enabled)
  493. If Enabled Then
  494. Diverter.IsDropped = 0
  495. Playsound SoundFX("Diverter",DOFContactors)
  496. LockAttivo = 1
  497. Else
  498. Diverter.IsDropped = 1
  499. Playsound SoundFX("Diverter",DOFContactors)
  500. LockAttivo=0
  501. End If
  502. End Sub
  503.  
  504. 'Drains and Kickers
  505. Sub drain_Hit()
  506. PalleInGioco = PalleInGioco - 1
  507. bsTrough.AddBall Me
  508. PlaySound "drain"
  509.  
  510. End Sub
  511.  
  512. Sub BallRelease_UnHit()
  513. PalleInGioco = PalleInGioco + 1
  514. End Sub
  515.  
  516. '************************************************
  517. '************Slingshots Animation****************
  518. '************************************************
  519.  
  520. Dim RStep, Lstep
  521.  
  522. Sub LeftSlingShot_Slingshot: vpmTimer.PulseSw 26: End Sub
  523. Sub RightSlingShot_Slingshot: vpmTimer.PulseSw 27: End Sub
  524.  
  525. Sub solLSling(enabled)
  526. If enabled then
  527. PlaySound SoundFX ("SlingshotSinistro",DOFContactors)
  528. LSling.Visible = 0
  529. LSling1.Visible = 1
  530. sling1.TransZ = -27
  531. LStep = 0
  532. LeftSlingShot.TimerEnabled = 1
  533. End If
  534. End Sub
  535.  
  536. Sub solRSling(enabled)
  537. If enabled then
  538. PlaySound SoundFX ("SlingshotDestro",DOFContactors)
  539. RSling.Visible = 0
  540. RSling1.Visible = 1
  541. sling2.TransZ = -27
  542. RStep = 0
  543. RightSlingShot.TimerEnabled = 1
  544. End If
  545. End Sub
  546.  
  547. Sub LeftSlingShot_Timer
  548. Select Case LStep
  549. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling1.TransZ = -15
  550. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling1.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  551. End Select
  552. LStep = LStep + 1
  553. End Sub
  554.  
  555. Sub RightSlingShot_Timer
  556. Select Case RStep
  557. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling2.TransZ = -15
  558. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling2.TransZ = 0:RightSlingShot.TimerEnabled = 0
  559. End Select
  560. RStep = RStep + 1
  561. End Sub
  562.  
  563. '************************************************
  564. '**************Bumpers Animation*****************
  565. '************************************************
  566.  
  567. Dim dirRing1:dirRing1 = -1
  568. Dim dirRing2:dirRing2 = -1
  569. Dim dirRing3:dirRing3 = -1
  570.  
  571. Sub Bumper1_Hit:vpmTimer.PulseSw 30:End Sub
  572. Sub Bumper2_Hit:vpmTimer.PulseSw 31:End Sub
  573. Sub Bumper3_Hit:vpmTimer.PulseSw 32:End Sub
  574.  
  575. Sub solLBump (enabled): If enabled then Bumper1.TimerEnabled = 1: PlaySound SoundFX("BumperSinistro",DOFContactors): End If: End Sub
  576. Sub solRBump (enabled): If enabled then Bumper2.TimerEnabled = 1: PlaySound SoundFX("BumperDestro",DOFContactors): End If: End Sub
  577. Sub solBBump (enabled): If enabled then Bumper3.TimerEnabled = 1: PlaySound SoundFX("BumperCentrale",DOFContactors): End If: End Sub
  578.  
  579. Sub Bumper1_timer()
  580. BumperRing1.Z = BumperRing1.Z + (5 * dirRing1)
  581. If BumperRing1.Z <= -40 Then dirRing1 = 1
  582. If BumperRing1.Z >= 0 Then
  583. dirRing1 = -1
  584. BumperRing1.Z = 0
  585. Me.TimerEnabled = 0
  586. End If
  587. End Sub
  588.  
  589. Sub Bumper2_timer()
  590. BumperRing2.Z = BumperRing2.Z + (5 * dirRing2)
  591. If BumperRing2.Z <= -40 Then dirRing2 = 1
  592. If BumperRing2.Z >= 0 Then
  593. dirRing2 = -1
  594. BumperRing2.Z = 0
  595. Me.TimerEnabled = 0
  596. End If
  597. End Sub
  598.  
  599. Sub Bumper3_timer()
  600. BumperRing3.Z = BumperRing3.Z + (5 * dirRing3)
  601. If BumperRing3.Z <= -40 Then dirRing3 = 1
  602. If BumperRing3.Z >= 0 Then
  603. dirRing3 = -1
  604. BumperRing3.Z = 0
  605. Me.TimerEnabled = 0
  606. End If
  607. End Sub
  608.  
  609. 'Rollovers
  610. Sub sw23_Hit:Controller.Switch(23) = 1:PlaySound "rollover":End Sub
  611. Sub sw23_UnHit:Controller.Switch(23) = 0:Playsound "plunger2":End Sub
  612.  
  613. 'Lower Lanes
  614. Sub sw24_Hit:Controller.Switch(24) = 1:PlaySound "rollover":End Sub
  615. Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
  616. Sub sw25_Hit:Controller.Switch(25) = 1:PlaySound "rollover":End Sub
  617. Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
  618. Sub sw28_Hit:Controller.Switch(28) = 1:PlaySound "rollover":End Sub
  619. Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
  620. Sub sw29_Hit:Controller.Switch(29) = 1:PlaySound "rollover":End Sub
  621. Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
  622.  
  623. 'Upper Lanes
  624. Sub sw8_Hit:Controller.Switch(8) = 1:PlaySound "rollover"
  625. End Sub
  626. Sub sw8_UnHit:Controller.Switch(8) = 0:End Sub
  627. Sub sw33_Hit:Controller.Switch(33) = 1:PlaySound "rollover":End Sub
  628. Sub sw33_UnHit:Controller.Switch(33) = 0:End Sub
  629. Sub sw34_Hit:Controller.Switch(34) = 1:PlaySound "rollover":End Sub
  630. Sub sw34_UnHit:Controller.Switch(34) = 0:End Sub
  631. Sub sw35_Hit:Controller.Switch(35) = 1:PlaySound "rollover":End Sub
  632. Sub sw35_UnHit:Controller.Switch(35) = 0:End Sub
  633.  
  634. 'Right
  635. Sub sw37_Hit:Controller.Switch(37) = 1:PlaySound "rollover":End Sub
  636. Sub sw37_UnHit:Controller.Switch(37) = 0:End Sub
  637. Sub sw38_Hit:Controller.Switch(38) = 1:PlaySound "rollover"
  638. End Sub
  639. Sub sw38_UnHit:Controller.Switch(38) = 0:End Sub
  640.  
  641. 'Right Under Flipper
  642. Sub sw46_Hit:Controller.Switch(46) = 1:PlaySound "rollover":End Sub
  643. Sub sw46_UnHit:Controller.Switch(46) = 0:End Sub
  644.  
  645. 'Spinner
  646. Sub sw7_Spin:vpmTimer.PulseSw 7:PlaySound "spinner":End Sub
  647.  
  648. 'Right Ramp
  649. Sub sw44_Hit:Controller.Switch(44) = 1:Playsound "gate":End Sub
  650.  
  651. Sub sw44_UnHit:Controller.Switch(44) = 0:End Sub
  652.  
  653. Sub sw45_Hit:Controller.Switch(45) = 1:Playsound "gate"
  654. End Sub
  655. Sub sw45_UnHit:Controller.Switch(45) = 0:End Sub
  656.  
  657. 'Left Ramp
  658. Sub sw47_Hit:Controller.Switch(47) = 1:Playsound "gate":End Sub
  659. Sub sw47_UnHit:Controller.Switch(47) = 0:End Sub
  660.  
  661. Sub sw48_Hit:Controller.Switch(48) = 1:Playsound "gate"
  662. End Sub
  663.  
  664. Sub sw48_UnHit:Controller.Switch(48) = 0:End Sub
  665.  
  666. Sub sw49_Hit
  667. Playsound "gate"
  668. End Sub
  669.  
  670. 'Venom da rampa venom
  671. Sub sw43_Hit:vpmTimer.PulseSw 43:PlaySound SoundFX("target",DOFContactors)
  672. End Sub
  673.  
  674. Sub sw43a_Hit
  675. Playsound "target"
  676. End Sub
  677.  
  678.  
  679. 'Doc Ock
  680. Sub S63_Hit:Controller.Switch(63)=1:End Sub
  681.  
  682. Sub S63_unHit:Controller.Switch(63)=0:End Sub
  683.  
  684. 'Sandman
  685. Sub s42_Hit:Controller.Switch(42)=1:End Sub
  686. Sub s42_unHit:Controller.Switch(42)=0:End Sub
  687. 'Lock Opto
  688. Sub sw6_Hit:vpmTimer.PulseSw 6
  689. sw6p.TransX = -5:sw6.TimerEnabled = 1: PlaySound SoundFX("target",DOFContactors)
  690. End Sub
  691.  
  692. Sub sw6_Timer:sw6p.TransX = 0: Me.TimerEnabled = 0: End Sub
  693.  
  694. Dim SandmanPronto
  695.  
  696. Sub SandmanOK_Hit
  697. SandmanPronto=1
  698. If ActiveBall.velY > 2 Then 'ball is going up
  699. sw59.enabled=1
  700. Else
  701. sw59.enabled=0
  702. End If
  703. End Sub
  704.  
  705. Sub OctopusOK_Hit
  706. If ActiveBall.velY > 2 Then 'ball is going up
  707. sw36.enabled=1
  708. Else
  709. sw36.enabled=0
  710. End If
  711. End Sub
  712.  
  713. Sub RHP1_Hit()
  714. If ActiveBall.velY < 0 Then 'ball is going up
  715. PlaySound "rrenter"
  716. Else
  717. StopSound "rrenter"
  718. End If
  719. End Sub
  720.  
  721. 'Sandman Optos
  722.  
  723. Sub sw9_Hit
  724. PlaySound SoundFX("target",DOFContactors)
  725. If SandmanPronto=0 Then vpmTimer.PulseSw 9
  726. Bank.TransX = 5
  727. BankColpito.Enabled = 1
  728. End Sub
  729.  
  730. Sub sw10_Hit
  731. PlaySound SoundFX("target",DOFContactors)
  732. If SandmanPronto=0 Then vpmTimer.PulseSw 10
  733. Bank.TransX = 5
  734. BankColpito.Enabled = 1
  735. End Sub
  736.  
  737. Sub sw11_Hit
  738. PlaySound SoundFX("target",DOFContactors)
  739. If SandmanPronto=0 Then vpmTimer.PulseSw 11
  740. Bank.TransX = 5
  741. BankColpito.Enabled = 1
  742. End Sub
  743.  
  744. Sub BankColpito_Timer()
  745. Bank.TransX = -0
  746. Me.Enabled = 0
  747. End Sub
  748.  
  749. Sub sw12_Hit:vpmTimer.PulseSw 12
  750. sw12p.TransX = -5:sw12.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  751. End Sub
  752.  
  753. Sub sw12_Timer:sw12p.TransX = 0:Me.TimerEnabled = 0: End Sub
  754.  
  755. Sub sw13_Hit:vpmTimer.PulseSw 13
  756. sw13p.TransX = -5:sw13.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  757. End Sub
  758.  
  759. Sub sw13_Timer:sw13p.TransX = 0:Me.TimerEnabled = 0:End Sub
  760.  
  761. 'Green Goblin Optos
  762. Sub sw1_Hit:vpmTimer.PulseSw 1
  763. sw1p.TransX = -5: sw1.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  764. End Sub
  765.  
  766. Sub sw1_Timer:sw1p.TransX = 0:Me.TimerEnabled = 0:End Sub
  767.  
  768. Sub sw2_Hit:vpmTimer.PulseSw 2
  769. sw2p.TransX = -5: sw2.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  770. End Sub
  771.  
  772. Sub sw2_Timer:sw2p.TransX = 0:Me.TimerEnabled = 0:End Sub
  773.  
  774. Sub sw3_Hit:vpmTimer.PulseSw 3
  775. sw3p.TransX = -5: sw3.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  776. End Sub
  777.  
  778. Sub sw3_Timer:sw3p.TransX = 0:Me.TimerEnabled = 0:End Sub
  779.  
  780. Sub sw4_Hit:vpmTimer.PulseSw 4
  781. sw4p.TransX = -5: sw4.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  782. End Sub
  783.  
  784. Sub sw4_Timer:sw4p.TransX = 0:Me.TimerEnabled = 0:End Sub
  785.  
  786. Sub sw5_Hit:vpmTimer.PulseSw 5
  787. sw5p.TransX = -5: sw5.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  788. End Sub
  789.  
  790. Sub sw5_Timer:sw5p.TransX = 0:Me.TimerEnabled = 0:End Sub
  791.  
  792. 'Right 3Bank Optos
  793. Sub sw39_Hit:vpmTimer.PulseSw 39
  794. sw39p.TransX = -5: sw39.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  795. End Sub
  796.  
  797. Sub sw39_Timer:sw39p.TransX = 0:sw39.TimerEnabled = 0:End Sub
  798.  
  799. Sub sw40_Hit:vpmTimer.PulseSw 40
  800. sw40p.TransX = -5: sw40.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  801. End Sub
  802.  
  803. Sub sw40_Timer:sw40p.TransX = 0:sw40.TimerEnabled = 0:End Sub
  804.  
  805. Sub sw41_Hit:vpmTimer.PulseSw 41
  806. sw41p.TransX = -5: sw41.TimerEnabled = 1:PlaySound SoundFX("target",DOFContactors)
  807. End Sub
  808.  
  809. Sub sw41_Timer:sw41p.TransX = 0:sw41.TimerEnabled = 0:End Sub
  810.  
  811. 'Sub PallaBloccata_Hit: vpmTimer.PulseSw 9:vpmTimer.PulseSw 10:vpmTimer.PulseSw 11:End Sub
  812.  
  813. 'Switch 14
  814. Sub RPostColl21_Hit():vpmTimer.PulseSw 14:End Sub
  815.  
  816. 'Sandman VUK
  817.  
  818. Sub MuroSandman_Hit()
  819. Playsound "Parete"
  820. End Sub
  821.  
  822. Sub sw59Abilitato_Hit()
  823. Playsound "EnterHole"
  824. If PallaBucoSandman=0 Then
  825. sw59.Enabled=1
  826. End If
  827. End Sub
  828.  
  829. Sub sw59Abilitato_UnHit()
  830. If PallaBucoSandman=0 Then
  831. sw59.Enabled=1
  832. End If
  833. End Sub
  834.  
  835. Sub sw59_UnHit() 'Uscita buco sandman
  836. SandmanPronto=0
  837. PallaBucoSandman=0
  838. Playsound "popper"
  839. sw59.Enabled=0
  840. End Sub
  841.  
  842. Sub sw59_Hit() 'Entrata buco sandman
  843. bsSandman.AddBall Me
  844. PallaBucoSandman=1
  845. End Sub
  846.  
  847. 'DocOck VUK
  848.  
  849. Dim PallaBucoOctopus, PallaBucoSandman
  850.  
  851. Sub MuroOctopus_Hit()
  852. Playsound "Parete"
  853. End Sub
  854.  
  855. Sub sw36Abilitato_UnHit()
  856. sw36.Enabled=1
  857. End Sub
  858.  
  859. Sub sw36Abilitato_Hit()
  860. Playsound "EnterHole"
  861. End Sub
  862.  
  863. Sub sw36_UnHit() 'Buco doc uscita
  864. PallaBucoOctopus=0
  865. sw36.Enabled=0
  866. End Sub
  867.  
  868. Sub sw36_Hit() 'Buco doc entrata
  869. bsDocOck.AddBall Me
  870. PallaBucoOctopus=1
  871. End Sub
  872.  
  873. '**************
  874. ' Flipper Subs
  875. '**************
  876.  
  877. Sub SolLFlipper(Enabled)
  878. If Enabled Then
  879. PlaySound SoundFX (SFlipperOn,DOFContactors):LeftFlipper.RotateToEnd
  880.  
  881. Else
  882. PlaySound SoundFX (SFlipperOff,DOFContactors):LeftFlipper.RotateToStart
  883.  
  884. End If
  885. End Sub
  886.  
  887. Sub SolRFlipper(Enabled)
  888. If Enabled Then
  889. PlaySound SoundFX (SFlipperOn,DOFContactors):RightFlipper.RotateToEnd
  890. RightFlipper2.RotateToEnd ' UR flip
  891.  
  892. Else
  893. PlaySound SoundFX (SFlipperOff,DOFContactors):RightFlipper.RotateToStart
  894. RightFlipper2.RotateToStart ' UR Flip
  895.  
  896. End If
  897. End Sub
  898.  
  899. Sub SolURFlipper(Enabled)
  900. ' If Enabled Then
  901. ' PlaySound SoundFX (SFlipperOn,DOFContactors):RightFlipper2.RotateToEnd
  902. '
  903.  
  904. ' Else
  905. ' PlaySound SoundFX (SFlipperOff,DOFContactors):
  906. '
  907.  
  908. ' End If
  909. End Sub
  910.  
  911. '*********************************
  912. ' GESTIONE MOVIMENTAZIONE GOBLIN
  913. '*********************************
  914.  
  915. Dim GoblinPos
  916.  
  917. Sub ShakeGoblin
  918. GoblinPos = 8
  919. GoblinShakeTimer.Enabled = 1
  920. End Sub
  921.  
  922. Sub GoblinShakeTimer_Timer
  923. Playsound "shake"
  924. Goblin.TransZ = GoblinPos
  925. If GoblinPos = 0 Then GoblinShakeTimer.Enabled = 0:Exit Sub
  926. If GoblinPos < 0 Then
  927. GoblinPos = ABS(GoblinPos) - 1
  928. Else
  929. GoblinPos = - GoblinPos + 1
  930. End If
  931. End Sub
  932.  
  933. Sub AccendiGoblin
  934. If LampState (76) = 0 Then
  935. IlluminaGoblin.Visible=0
  936. Else
  937. If LampState (76) > 0 Then
  938. IlluminaGoblin.Visible=1
  939. End If
  940. End If
  941. End Sub
  942.  
  943. Sub AccendiVenom
  944. If LampState (75) = 0 Then
  945. IlluminaVenom.Visible=0
  946. Else
  947. If LampState (75) > 0 Then
  948. IlluminaVenom.Visible=1
  949. End If
  950. End If
  951. End Sub
  952.  
  953. '*********************************
  954. ' GESTIONE MOVIMENTAZIONE OCTOPUS
  955. '*********************************
  956.  
  957. Dim OctopusDir, OctopusPos
  958.  
  959. Sub sw63_Hit()
  960. Playsound "bersaglio"
  961. Octopus.TransZ = 5
  962. BracketOctopus.TransZ = 5
  963. OctopusColpito.Enabled = 1
  964. End Sub
  965.  
  966. Sub Fotocellula1Disattiva_Hit()
  967. FotocellulaOctopus.Visible=0
  968. End Sub
  969.  
  970. Sub Fotocellula1Disattiva_UnHit()
  971. TimerFotocellula1.enabled=1
  972. End Sub
  973.  
  974. Sub TimerFotocellula1_Timer()
  975. FotocellulaOctopus.Visible=1
  976. Me.Enabled=0
  977. End Sub
  978.  
  979. Sub Fotocellula2Disattiva_Hit()
  980. FotocellulaSandmanDx.Visible=0
  981. FotocellulaSandmanSx.Visible=0
  982. End Sub
  983.  
  984. Sub Fotocellula2Disattiva_UnHit()
  985. TimerFotocellula2.enabled=1
  986. End Sub
  987.  
  988. Sub TimerFotocellula2_Timer()
  989. FotocellulaSandmanDx.Visible=1
  990. FotocellulaSandmanSx.Visible=1
  991. Me.Enabled=0
  992. End Sub
  993.  
  994. Sub Fotocellula3Disattiva_Hit()
  995. FotocellulaVenom.Visible=0
  996. End Sub
  997.  
  998. Sub Fotocellula3Disattiva_UnHit()
  999. TimerFotocellula3.enabled=1
  1000. End Sub
  1001.  
  1002. Sub TimerFotocellula3_Timer()
  1003. FotocellulaVenom.Visible=1
  1004. Me.Enabled=0
  1005. End Sub
  1006.  
  1007. Sub OctopusColpito_Timer()
  1008. Octopus.TransZ = 0
  1009. BracketOctopus.TransZ = 0
  1010. Me.Enabled = 0
  1011. End Sub
  1012.  
  1013. Sub AlzaOctopus
  1014. OctopusDir = -1 ' removing 1 will make Oct go up
  1015. OctopusTimer.Enabled = 1
  1016. End Sub
  1017.  
  1018. Sub AbbassaOctopus
  1019. OctopusDir = 1 ' adding 1 will make Oct to go down by one step
  1020. OctopusTimer.Enabled = 1
  1021. End Sub
  1022.  
  1023.  
  1024. Sub OctopusTimer_Timer
  1025. Playsound "Motor"
  1026. Octopus.TransY = -OctopusPos
  1027. BracketOctopus.TransY = -OctopusPos
  1028. OctopusPos = OctopusPos + OctopusDir
  1029. If OctopusPos < 0 Then OctopusPos=0: sw63.IsDropped=1: Me.Enabled = 0
  1030. If OctopusPos > 50 Then OctopusPos = 50: Me.Enabled = 0
  1031. End Sub
  1032.  
  1033.  
  1034. Sub AccendiOctopus
  1035. If LampState (77) = 0 Then
  1036. IlluminaOctopus.Visible=0
  1037. Else
  1038. If LampState (77) > 0 Then
  1039. IlluminaOctopus.Visible=1
  1040. End If
  1041. End If
  1042. End Sub
  1043.  
  1044. '*********************************
  1045. ' GESTIONE MOVIMENTAZIONE SANDMAN
  1046. '*********************************
  1047.  
  1048. Dim SandmanDir, SandmanPos, SandmanAlto
  1049.  
  1050. Sub sw42_Hit()
  1051. Playsound "bersaglio"
  1052. Sandman.TransZ = 5
  1053. BracketSandman.TransZ = 5
  1054. SandmanColpito.Enabled = 1
  1055. End Sub
  1056.  
  1057. Sub SandmanColpito_Timer()
  1058. Sandman.TransZ = 0
  1059. BracketSandman.TransZ = 0
  1060. Me.Enabled = 0
  1061. End Sub
  1062.  
  1063. Sub AlzaSandman
  1064. SandmanDir = 1 ' removing 1 will make Oct go up
  1065. SandmanTimer.Enabled = 1
  1066. SandmanAlto=1
  1067. End Sub
  1068.  
  1069. Sub AbbassaSandman
  1070. SandmanDir = -1 ' adding 1 will make Oct to go down by one step
  1071. SandmanTimer.Enabled = 1
  1072. SandmanAlto=0
  1073. End Sub
  1074.  
  1075.  
  1076. Sub SandmanTimer_Timer
  1077. Playsound "Motor"
  1078. Sandman.TransY = SandmanPos
  1079. BracketSandman.TransY = SandmanPos
  1080. SandmanPos = SandmanPos + SandmanDir
  1081. If SandmanPos < 0 Then SandmanPos=0: Me.Enabled = 0
  1082. If SandmanPos > 50 Then SandmanPos = 50: sw42.IsDropped=1: Me.Enabled = 0
  1083. End Sub
  1084.  
  1085. Sub AccendiSandman
  1086. If LampState (74) = 0 Then
  1087. IlluminaSandman.Visible=0
  1088. Else
  1089. If LampState (74) > 0 Then
  1090. IlluminaSandman.Visible=1
  1091. End If
  1092. End If
  1093. End Sub
  1094.  
  1095. '***********************************
  1096. ' GESTIONE MOVIMENTAZIONE MURO BABK
  1097. '***********************************
  1098.  
  1099. Dim BankDir, BankPos
  1100.  
  1101. Sub AlzaBank
  1102. BankDir = -1
  1103. BankTimer.Enabled = 1
  1104. End Sub
  1105.  
  1106. Sub AbbassaBank
  1107. BankDir = 1
  1108. BankTimer.Enabled = 1
  1109. End Sub
  1110.  
  1111. Sub BankTimer_Timer
  1112. Bank.TransY = -BankPos
  1113. BankPos = BankPos + BankDir
  1114. If BankPos < 0 Then BankPos = 0: Me.Enabled = 0
  1115. If BankPos > 52 Then BankPos = 52: ParetiBankGiu: Me.Enabled = 0
  1116. End Sub
  1117.  
  1118. Dim BankAlto
  1119.  
  1120. Sub PallaBloccata_Hit()
  1121. If BankAlto=1 AND Attendi=0 Then
  1122. Controller.Switch(50)=0
  1123. Controller.Switch(49)=1
  1124. AbbassaBank
  1125. ParetiBankGiu
  1126. SbloccaPallaBank.Enabled= True
  1127. End If
  1128. End Sub
  1129.  
  1130. Sub SbloccaPallaBank_Timer()
  1131. If Attendi=0 Then
  1132. Controller.Switch(49)=0
  1133. Controller.Switch(50)=1
  1134. AlzaBank
  1135. ParetiBankSu
  1136. Me.Enabled=0
  1137. End If
  1138. End Sub
  1139.  
  1140. Sub ParetiBankSu
  1141. sw9.IsDropped=0
  1142. sw10.IsDropped=0
  1143. sw11.IsDropped=0
  1144. BankAlto=1
  1145. End Sub
  1146.  
  1147. Sub ParetiBankGiu
  1148. sw9.IsDropped=1
  1149. sw10.IsDropped=1
  1150. sw11.IsDropped=1
  1151. BankAlto=0
  1152. End Sub
  1153.  
  1154. '***************************************************
  1155. ' JP's VP10 Fading Lamps & Flashers
  1156. ' Based on PD's Fading Light System
  1157. ' SetLamp 0 is Off
  1158. ' SetLamp 1 is On
  1159. ' fading for non opacity objects is 4 steps
  1160. '***************************************************
  1161.  
  1162.  
  1163. Sub SetModLamp(nr, value)
  1164. If value <> SolModValue(nr) Then
  1165. SolModValue(nr) = value
  1166. if value > 0 then LampState(nr) = 1 else LampState(nr) = 0
  1167. FadingLevel(nr) = LampState(nr) + 4
  1168. End If
  1169. End Sub
  1170.  
  1171. Sub SetModLampM(nr, value) 'setlamp NR, but also NR + 50
  1172. If value <> SolModValue(nr) Then
  1173. SolModValue(nr) = value
  1174. if value > 0 then LampState(nr) = 1 else LampState(nr) = 0
  1175. FadingLevel(nr) = LampState(nr) + 4
  1176. End If
  1177. If value <> SolModValue(nr+50) Then
  1178. SolModValue(nr+50) = value
  1179. if value > 0 then LampState(nr+50) = 1 else LampState(nr+50) = 0
  1180. FadingLevel(nr+50) = LampState(nr+50) + 4
  1181. End If
  1182. End Sub
  1183.  
  1184.  
  1185. Sub SetModLampMM(nr, nr2, value) 'setlamp two NRs
  1186. If value <> SolModValue(nr) Then
  1187. SolModValue(nr) = value
  1188. if value > 0 then LampState(nr) = 1 else LampState(nr) = 0
  1189. FadingLevel(nr) = LampState(nr) + 4
  1190. End If
  1191. If value <> SolModValue(nr2) Then
  1192. SolModValue(nr2) = value
  1193. if value > 0 then LampState(nr2) = 1 else LampState(nr2) = 0
  1194. FadingLevel(nr2) = LampState(nr2) + 4
  1195. End If
  1196. End Sub
  1197.  
  1198. Sub SetModLampMMM(nr, nr2, nr3, value) 'setlamp 3 NRs
  1199. If value <> SolModValue(nr) Then
  1200. SolModValue(nr) = value
  1201. if value > 0 then LampState(nr) = 1 else LampState(nr) = 0
  1202. FadingLevel(nr) = LampState(nr) + 4
  1203. End If
  1204. If value <> SolModValue(nr2) Then
  1205. SolModValue(nr2) = value
  1206. if value > 0 then LampState(nr2) = 1 else LampState(nr2) = 0
  1207. FadingLevel(nr2) = LampState(nr2) + 4
  1208. End If
  1209. If value <> SolModValue(nr3) Then
  1210. SolModValue(nr3) = value
  1211. if value > 0 then LampState(nr3) = 1 else LampState(nr3) = 0
  1212. FadingLevel(nr3) = LampState(nr3) + 4
  1213. End If
  1214. End Sub
  1215.  
  1216. Dim LampState(200), FadingLevel(200)
  1217. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  1218. ' turn off the lights and flashers and reset them to the default parameters
  1219. dim SolModValue(200)
  1220. dim LightFallOff(200, 4) '2d array to hold alt falloff values in different columns
  1221. dim FlashersOpacity(200)
  1222. dim FlashersFalloff(200) '??? (could use multiply? or some other kind of mixing?...)
  1223. dim GIscale(200)
  1224. InitLamps()
  1225. Sub InitLamps()
  1226. Dim x
  1227. For x = 0 to 200
  1228. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  1229. FadingLevel(x) = 4 ' used to track the fading state
  1230. FlashSpeedUp(x) = 0.01 ' faster speed when turning on the flasher
  1231. FlashSpeedDown(x) = 0.008 ' slower speed when turning off the flasher
  1232. FlashMax(x) = 1 ' the maximum value when on, usually 1
  1233. FlashMin(x) = 0 ' the minimum value when off, usually 0
  1234. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  1235. giscale(x) = 1
  1236.  
  1237. SolModValue(x) = 0
  1238. FlashersOpacity(x) = 0
  1239. ' FlashersFalloff(x) = 0 '????
  1240. LightFallOff(x, 0) = 0
  1241. LightFallOff(x, 1) = 0
  1242. LightFallOff(x, 2) = 0
  1243. LightFallOff(x, 3) = 0
  1244. Next
  1245. for x = 100 to 200 'flashers
  1246. FlashSpeedUp(x) = 1.1 '0.4 ' faster speed when turning on the flasher
  1247. FlashSpeedDown(x) = 0.9 '0.2 ' slower speed when turning off the flasher
  1248. next
  1249.  
  1250. LightFallOff(123, 0) = f23.falloff
  1251. LightFallOff(123, 1) = f23a.falloff
  1252.  
  1253. LightFallOff(125, 0) = f25.falloff
  1254. LightFallOff(125, 1) = f25a.falloff
  1255.  
  1256. LightFallOff(126, 0) = f26.falloff
  1257.  
  1258. f23.state = 1
  1259. f23a.state = 1
  1260. f25.state = 1
  1261. f25a.state = 1
  1262. f26.state = 1
  1263.  
  1264. End Sub
  1265.  
  1266. 'NmodLight subs: 'lampnumber, object, falloff column, ScaleType (see Function ScaleLights below)
  1267. dim CGT 'compensated game time
  1268. Sub LampTimer_Timer()
  1269. cgt = gametime - InitFadeTime(0)
  1270. Dim chgLamp, num, chg, ii
  1271. chgLamp = Controller.ChangedLamps
  1272. If Not IsEmpty(chgLamp) Then
  1273. For ii = 0 To UBound(chgLamp)
  1274. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  1275. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  1276. Next
  1277.  
  1278. End If
  1279. UpdateLamps
  1280.  
  1281. nModLight 123, f23, 0, 0, 1
  1282. nModLightm 123, F23a, 0, 0
  1283. nModLight 125, f25, 0, 0, 1
  1284. nModLightm 125, f25a, 0, 0
  1285. nModLight 126, f26, 0, 0, 1
  1286.  
  1287. nModFlash 121, FlashOctopus, 0, 9, 1
  1288. nModFlash 127, FlashGiallo, 0, 9, 1 'nr, object, offset (not used for Flashers), scaletype, offscale
  1289. nModFlash 128, FlasherGoblin, 0, 0, 1
  1290. nModFlash 129, FlashBlu, 0, 9, 1
  1291. nModFlash 130, FlashRosso, 0, 9, 1
  1292. nModFlash 131, FlasherBumpers, 0, 0, 1
  1293.  
  1294. InitFadeTime(0) = gametime
  1295. End Sub
  1296.  
  1297. sub f127t_timer 'debug
  1298. me.text = "SolModValue" & SolModValue(127) & vbnewline & _
  1299. "fadinglevel" & FadingLevel(127) & vbnewline & _
  1300. "FlashLevel" & FlashLevel(127) & vbnewline & _
  1301. "Intensityscale" & FlashGiallo.IntensityScale & vbnewline & _
  1302. " "
  1303. end sub
  1304.  
  1305. Function ScaleLights(value, scaletype) 'returns an intensityscale-friendly 0->100% value out of 255
  1306. dim i
  1307. Select Case scaletype 'select case because bad at maths 'TODO: Simplify these functions. B/c this is absurdly bad.
  1308. case 0
  1309. i = value * (1 / 255) '0 to 1
  1310. case 6 '0.0625 to 1
  1311. i = (value + 17)/272
  1312. case 9 '0.089 to 1
  1313. i = (value + 25)/280
  1314. case 15
  1315. i = (value / 300) + 0.15
  1316. case 20
  1317. i = (4 * value)/1275 + (1/5)
  1318. case 25
  1319. i = (value + 85) / 340
  1320. case 37 '0.375 to 1
  1321. i = (value+153) / 408
  1322. case 40
  1323. i = (value + 170) / 425
  1324. case 50
  1325. i = (value + 255) / 510 '0.5 to 1
  1326. case 75
  1327. i = (value + 765) / 1020 '0.75 to 1
  1328. case Else
  1329. i = 10
  1330. End Select
  1331. ScaleLights = i
  1332. End Function
  1333.  
  1334. Function ScaleByte(value, scaletype) 'returns a number between 1 and 255
  1335. dim i
  1336. Select Case scaletype
  1337. case 0
  1338. i = value * 1 '0 to 1
  1339. case 9 'ugh
  1340. i = (5*(200*value + 1887))/1037
  1341. case 15
  1342. i = (16*value)/17 + 15
  1343. case else
  1344. i = (3*(value + 85))/4 '63.75 to 255
  1345. End Select
  1346. ScaleByte = i
  1347. End Function
  1348.  
  1349. Function ScaleGI(value, scaletype) 'returns an intensityscale-friendly 0->100% value out of 1>8 'it does go to 8
  1350. dim i
  1351. Select Case scaletype 'select case because bad at maths
  1352. case 0
  1353. i = value * (1/8) '0 to 1
  1354. case 25
  1355. i = (1/28)*(3*value + 4)
  1356. case 50
  1357. i = (value+5)/12
  1358. case else
  1359. ' x = (4*value)/3 - 85 '63.75 to 255
  1360.  
  1361. End Select
  1362. ScaleGI = i
  1363. End Function
  1364.  
  1365.  
  1366. Function ScaleFalloff(value, nr) 'TODO make more options here
  1367. if nr > 128 then 'do not scale special bulb NRs
  1368. ScaleFalloff = 1
  1369. Else
  1370. ' ScaleFalloff = (value + 255) / 510 '0.5 to 1
  1371. ScaleFalloff = (value + 765) / 1020 '0.75 to 1
  1372. end if
  1373. End Function
  1374.  
  1375. dim InitFadeTime(200)
  1376.  
  1377. Sub nModLight(nr, object, offset, scaletype, offscale) 'Fading using intensityscale with modulated callbacks
  1378. dim DesiredFading
  1379. Select Case FadingLevel(nr)
  1380. case 3 'workaround - wait a frame to let M sub finish fading
  1381. FadingLevel(nr) = 0
  1382. Case 4 'off
  1383. ' FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)*offscale
  1384. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * cgt ) * offscale
  1385. If FlashLevel(nr) < 0 then FlashLevel(nr) = 0 : FadingLevel(nr) = 3
  1386. Object.IntensityScale = ScaleLights(FlashLevel(nr),0 ) * GIscale(nr)
  1387. Object.Falloff = LightFallOff(nr, offset) * ScaleFalloff(FlashLevel(nr), nr)
  1388. ' InitFadeTime(nr) = gametime
  1389. ' tbt.text = (cgt - InitFadeTime(0) )
  1390. Case 5 ' Fade (Dynamic)
  1391. DesiredFading = ScaleByte(SolModValue(nr), scaletype)
  1392.  
  1393. if FlashLevel(nr) < DesiredFading Then
  1394. ' tb5.text = "+"
  1395. 'FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  1396. FlashLevel(nr) = FlashLevel(nr) + (FlashSpeedUp(nr) * cgt )
  1397. If FlashLevel(nr) >= DesiredFading Then FlashLevel(nr) = DesiredFading : FadingLevel(nr) = 1
  1398. elseif FlashLevel(nr) > DesiredFading Then
  1399. ' tb5.text = "-"
  1400. ' FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  1401. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * cgt )
  1402. If FlashLevel(nr) <= DesiredFading Then FlashLevel(nr) = DesiredFading : FadingLevel(nr) = 1
  1403. End If
  1404. Object.Intensityscale = ScaleLights(FlashLevel(nr),0 ) * GIscale(nr)
  1405. Object.Falloff = LightFallOff(nr, offset) * ScaleFalloff(FlashLevel(nr), nr)
  1406. ' tbt.text = (cgt - InitFadeTime(0) )
  1407. ' InitFadeTime(nr) = gametime
  1408. ' tbt.text = (FlashSpeedDown(nr) * cgt ) & vbnewline & (FlashSpeedup(nr) * cgt ) & "cgt:" & cgt
  1409. End Select
  1410. End Sub
  1411.  
  1412. Sub nModFlash(nr, object, offset, scaletype, offscale) 'Fading using intensityscale with modulated callbacks 'gametime compensated
  1413. dim DesiredFading
  1414. Select Case FadingLevel(nr)
  1415. case 3 'workaround - wait a frame to let M sub finish fading
  1416. FadingLevel(nr) = 0
  1417. Case 4 'off
  1418. ' FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)*offscale
  1419. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * cgt ) * offscale
  1420. If FlashLevel(nr) < 0 then FlashLevel(nr) = 0 : FadingLevel(nr) = 3
  1421. Object.IntensityScale = ScaleLights(FlashLevel(nr),0 ) * GIscale(nr)' Object.Falloff = LightFallOff(nr, offset) * ScaleFalloff(FlashLevel(nr), nr)
  1422. ' InitFadeTime(nr) = gametime
  1423. ' tbt.text = (cgt - InitFadeTime(0) )
  1424. Case 5 ' Fade (Dynamic)
  1425. DesiredFading = ScaleByte(SolModValue(nr), scaletype)
  1426. ' tb1.text = DesiredFading & " ...5"
  1427. if FlashLevel(nr) < DesiredFading Then
  1428. ' tb5.text = "+"
  1429. 'FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  1430. FlashLevel(nr) = FlashLevel(nr) + (FlashSpeedUp(nr) * cgt )
  1431. If FlashLevel(nr) >= DesiredFading Then FlashLevel(nr) = DesiredFading : FadingLevel(nr) = 1
  1432. elseif FlashLevel(nr) > DesiredFading Then
  1433. ' tb5.text = "-"
  1434. ' FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  1435. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * cgt )
  1436. If FlashLevel(nr) <= DesiredFading Then FlashLevel(nr) = DesiredFading : FadingLevel(nr) = 1
  1437. End If
  1438. Object.Intensityscale = ScaleLights(FlashLevel(nr),0 ) * GIscale(nr)
  1439. End Select
  1440. End Sub
  1441.  
  1442. Sub nModLightM(nr, Object, offset, scaletype) 'uses offset to store different falloff values in a unused lamp number. default 0
  1443. Select Case FadingLevel(nr)
  1444. Case 3, 4, 5
  1445. Object.Intensityscale = ScaleLights(FlashLevel(nr),0 ) * GIscale(nr)
  1446. ' Object.IntensityScale = ScaleLights(FlashLevel(nr),scaletype ) * GIscale(nr)
  1447. Object.Falloff = LightFallOff(nr, offset) * ScaleFalloff(FlashLevel(nr), nr)
  1448. End Select
  1449. End Sub
  1450.  
  1451. Sub nModFlashM(nr, Object, offset, scaletype)
  1452. Select Case FadingLevel(nr)
  1453. Case 3, 4, 5
  1454. Object.Intensityscale = ScaleLights(FlashLevel(nr),0 ) * GIscale(nr)
  1455. End Select
  1456. End Sub
  1457.  
  1458. Sub Flashc(nr, object)
  1459. Select Case FadingLevel(nr)
  1460. Case 4 'off
  1461. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * CGT)
  1462. If FlashLevel(nr) < FlashMin(nr) Then
  1463. FlashLevel(nr) = FlashMin(nr)
  1464. FadingLevel(nr) = 0 'completely off
  1465. End if
  1466. Object.IntensityScale = FlashLevel(nr)
  1467. Case 5 ' on
  1468. FlashLevel(nr) = FlashLevel(nr) + (FlashSpeedUp(nr) * CGT)
  1469. If FlashLevel(nr) > FlashMax(nr) Then
  1470. FlashLevel(nr) = FlashMax(nr)
  1471. FadingLevel(nr) = 1 'completely on
  1472. End if
  1473. Object.IntensityScale = FlashLevel(nr)
  1474. End Select
  1475. End Sub
  1476.  
  1477. Sub Gate2_Hit()
  1478. Playsound "gate"
  1479. End Sub
  1480.  
  1481. Sub Gate3_Hit()
  1482. Playsound "gate"
  1483. End Sub
  1484.  
  1485. Sub AccendiLuciWall
  1486. LuceWall1.Visible=1
  1487. LuceWall2.Visible=1
  1488. LuceWall3.Visible=1
  1489. LuceWall4.Visible=1
  1490. LuceWall5.Visible=1
  1491. LuceWall6.Visible=1
  1492. LuceWall7.Visible=1
  1493. LuceWall8.Visible=1
  1494. End Sub
  1495.  
  1496. Sub SpegniLuciWall
  1497. LuceWall1.Visible=0
  1498. LuceWall2.Visible=0
  1499. LuceWall3.Visible=0
  1500. LuceWall4.Visible=0
  1501. LuceWall5.Visible=0
  1502. LuceWall6.Visible=0
  1503. LuceWall7.Visible=0
  1504. LuceWall8.Visible=0
  1505. End Sub
  1506.  
  1507. Sub UpdateLamps
  1508. NFadeL 3, l3
  1509. NFadeL 4, l4
  1510. NFadeL 5, l5
  1511. NFadeL 6, l6
  1512. NFadeL 7, l7
  1513. NFadeL 8, l8
  1514. NFadeL 9, l9
  1515. NFadeL 10, l10
  1516. NFadeL 11, l11
  1517. NFadeL 12, l12
  1518. NFadeL 13, l13
  1519. NFadeL 14, l14
  1520. NFadeL 15, l15
  1521. NFadeL 16, l16
  1522. NFadeL 17, l17
  1523. NFadeL 18, l18
  1524. NFadeL 19, l19
  1525. NFadeL 20, l20
  1526. NFadeL 21, l21
  1527. NFadeL 22, l22
  1528. NFadeL 23, l23
  1529. NFadeL 24, l24
  1530. NFadeL 25, l25
  1531. NFadeL 26, l26
  1532. NFadeL 27, l27
  1533. NFadeL 28, l28
  1534. NFadeL 29, l29
  1535. NFadeL 30, l30
  1536. NFadeL 31, l31
  1537. NFadeL 32, l32
  1538. NFadeL 33, l33
  1539. NFadeL 34, l34
  1540. NFadeL 35, l35
  1541. NFadeL 36, l36
  1542. NFadeL 37, l37
  1543. NFadeL 38, l38
  1544. NFadeL 39, l39
  1545. NFadeL 40, l40
  1546. NFadeLm 41, l41
  1547. Flashc 41, l41r
  1548. NFadeL 42, l42
  1549. NFadeL 43, l43
  1550. NFadeLm 44, l44
  1551. Flashc 44, l44r
  1552. NFadeL 45, l45
  1553. NFadeL 46, l46
  1554. NFadeL 47, l47
  1555. NFadeL 48, l48
  1556. NFadeL 49, l49
  1557. NFadeL 50, l50
  1558. NFadeL 51, l51
  1559. NFadeLm 52, l52
  1560. Flashc 52, l52r
  1561. NFadeLm 53, l53
  1562. Flashc 53, l53r
  1563. NFadeLm 54, l54
  1564. Flashc 54, l54r
  1565. NFadeL 57, l57
  1566. NFadeL 58, l58
  1567. NFadeL 59, l59
  1568. NFadeLm 60, l60
  1569. NFadeL 60, l60a
  1570. NFadeLm 61, l61
  1571. NFadeL 61, l61a
  1572. NFadeLm 62, l62
  1573. NFadeL 62, l62a
  1574. NFadeL 63, l63
  1575. NFadeL 64, l64
  1576. NFadeL 65, l65
  1577. Flashc 66, MissioneVenom3
  1578. Flashc 67, MissioneVenom2
  1579. Flashc 68, MissioneVenom1
  1580. Flashc 69, MissioneSandman3
  1581. Flashc 70, MissioneSandman2
  1582. Flashc 71, MissioneSandman1
  1583. NFadeLm 72, l72
  1584. Flashc 72, l72r
  1585. NFadeLm 74, l74: AccendiSandman
  1586. NFadeLm 75, l75: AccendiVenom
  1587. NFadeLm 76, l76: AccendiGoblin
  1588. NFadeLm 77, l77: AccendiOctopus
  1589. NFadeL 78, l78
  1590. End Sub
  1591.  
  1592. Sub SetLamp(nr, value)
  1593. If value = 0 AND LampState(nr) = 0 Then Exit Sub
  1594. If value = 1 AND LampState(nr) = 1 Then Exit Sub
  1595. If value <> LampState(nr) Then
  1596. LampState(nr) = abs(value)
  1597. FadingLevel(nr) = abs(value) + 4
  1598. End If
  1599. End Sub
  1600.  
  1601.  
  1602. Sub NFadeL(nr, object)
  1603. Select Case FadingLevel(nr)
  1604. Case 4:object.state = 0:FadingLevel(nr) = 0
  1605. Case 5:object.state = 1:FadingLevel(nr) = 1
  1606. End Select
  1607. End Sub
  1608.  
  1609. Sub NFadeLm(nr, object) ' used for multiple lights
  1610. Select Case FadingLevel(nr)
  1611. Case 4:object.state = 0
  1612. Case 5:object.state = 1
  1613. End Select
  1614. End Sub
  1615.  
  1616.  
  1617. Sub Flash(nr, object)
  1618. Select Case FadingLevel(nr)
  1619. Case 4 'off
  1620. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  1621. If FlashLevel(nr) < FlashMin(nr) Then
  1622. FlashLevel(nr) = FlashMin(nr)
  1623. FadingLevel(nr) = 0 'completely off
  1624. End if
  1625. Object.IntensityScale = FlashLevel(nr)
  1626. Case 5 ' on
  1627. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  1628. If FlashLevel(nr) > FlashMax(nr) Then
  1629. FlashLevel(nr) = FlashMax(nr)
  1630. FadingLevel(nr) = 1 'completely on
  1631. End if
  1632. Object.IntensityScale = FlashLevel(nr)
  1633. End Select
  1634. End Sub
  1635.  
  1636. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  1637. Object.IntensityScale = FlashLevel(nr)
  1638. End Sub
  1639.  
  1640. ' *********************************************************************
  1641. ' JP's Supporting Ball & Sound Functions
  1642. ' *********************************************************************
  1643.  
  1644. Sub ShooterEnd_UnHit():If activeball.z > 30 Then vpmTimer.AddTimer 150, "BallHitSound":End If:End Sub
  1645.  
  1646. Sub BallHitSound(dummy):PlaySound "ballhit":End Sub
  1647.  
  1648. Sub Rhelp1_Hit()
  1649. ActiveBall.VelZ = -2
  1650. ActiveBall.VelY = 0
  1651. ActiveBall.VelX = 0
  1652. StopSound "metalrolling"
  1653. StopSound "metalrolling"
  1654. sw16Premuto=0
  1655. 'Playsound "ballrampdrop"
  1656. Playsound "WireRampHit"
  1657. CadutaSuTavolo.Enabled=1
  1658. End Sub
  1659.  
  1660. Sub Rhelp2_Hit()
  1661. ActiveBall.VelZ = -2
  1662. ActiveBall.VelY = 0
  1663. ActiveBall.VelX = 0
  1664. StopSound "metalrolling"
  1665. StopSound "metalrolling"
  1666. sw17Premuto=0
  1667. 'Playsound "ballrampdrop"
  1668. Playsound "WireRampHit"
  1669. CadutaSuTavolo.Enabled=1
  1670. End Sub
  1671.  
  1672. Sub CadutaSuTavolo_Timer()
  1673. Playsound "ballrampdrop"
  1674. Me.Enabled=0
  1675. End Sub
  1676.  
  1677. Dim sw16Premuto
  1678.  
  1679. Sub sw16_Hit 'Venom da rampa sinistra
  1680. Playsound "WireRampHit"
  1681. Playsound "metalrolling"
  1682. StopSound "plasticrolling"
  1683. sw16Premuto= 1
  1684. End Sub
  1685.  
  1686. Dim sw17Premuto
  1687.  
  1688. Sub sw17_Hit
  1689. Playsound "WireRampHit"
  1690. Playsound "metalrolling"
  1691. StopSound "plasticrolling"
  1692. sw17Premuto=1
  1693. End Sub
  1694.  
  1695. Sub DocVUKexit_Hit
  1696. If sw17Premuto= 0 Then Playsound "WireRampHit": Playsound "metalrolling"
  1697. End Sub
  1698.  
  1699. Sub VenomOK_Hit
  1700. If sw16Premuto= 0 Then Playsound "WireRampHit": Playsound "metalrolling": StopSound "plasticrolling"
  1701. End Sub
  1702.  
  1703.  
  1704. Sub sw100_Hit()
  1705. Playsound "muro"
  1706. End Sub
  1707.  
  1708. Sub sw101_Hit()
  1709. Playsound "muro"
  1710. End Sub
  1711.  
  1712. Sub sw102_Hit()
  1713. Playsound "muro"
  1714. End Sub
  1715.  
  1716. Sub sw103_Hit()
  1717. Playsound "muro"
  1718. End Sub
  1719.  
  1720. Sub sw104_Hit()
  1721. Playsound "muro"
  1722. End Sub
  1723.  
  1724. Sub Rubbers_Hit(idx)
  1725. dim finalspeed
  1726. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1727. If finalspeed > 20 then
  1728. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1729. End if
  1730. If finalspeed >= 6 AND finalspeed <= 20 then
  1731. RandomSoundRubber()
  1732. End If
  1733. End Sub
  1734.  
  1735. Sub Posts_Hit(idx)
  1736. dim finalspeed
  1737. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1738. If finalspeed > 16 then
  1739. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1740. End if
  1741. If finalspeed >= 6 AND finalspeed <= 16 then
  1742. RandomSoundRubber()
  1743. End If
  1744. End Sub
  1745.  
  1746. Sub RandomSoundRubber()
  1747. Select Case Int(Rnd*3)+1
  1748. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1749. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1750. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1751. End Select
  1752. End Sub
  1753.  
  1754. Sub LeftFlipper_Collide(parm)
  1755. RandomSoundFlipper()
  1756. End Sub
  1757.  
  1758. Sub RightFlipper_Collide(parm)
  1759. RandomSoundFlipper()
  1760. End Sub
  1761.  
  1762. Sub RightFlipper2_Collide(parm)
  1763. RandomSoundFlipper()
  1764. End Sub
  1765.  
  1766. Sub RandomSoundFlipper()
  1767. Select Case Int(Rnd*3)+1
  1768. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1769. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1770. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1771. End Select
  1772. End Sub
  1773.  
  1774. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1775. Vol = Csng(BallVel(ball) ^2 / 1)
  1776. End Function
  1777.  
  1778. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1779. Dim tmp
  1780. tmp = ball.x * 2 / table1.width-1
  1781. If tmp > 0 Then
  1782. Pan = Csng(tmp ^10)
  1783. Else
  1784. Pan = Csng(-((- tmp) ^10) )
  1785. End If
  1786. End Function
  1787.  
  1788. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1789. Pitch = BallVel(ball) * 20
  1790. End Function
  1791.  
  1792. Function BallVel(ball) 'Calculates the ball speed
  1793. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1794. End Function
  1795.  
  1796. '**********************
  1797. ' Ball Collision Sound
  1798. '**********************
  1799.  
  1800. Sub OnBallBallCollision(ball1, ball2, velocity)
  1801. PlaySound("collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  1802. End Sub
  1803.  
  1804. '*****************************************
  1805. ' JP's VP10 Rolling Sounds
  1806. '*****************************************
  1807.  
  1808. Const tnob = 4 ' total number of balls
  1809. ReDim rolling(tnob)
  1810. InitRolling
  1811.  
  1812. Sub InitRolling
  1813. Dim i
  1814. For i = 0 to tnob
  1815. rolling(i) = False
  1816. Next
  1817. End Sub
  1818.  
  1819. Sub RollingTimer_Timer()
  1820. Dim BOT, b
  1821. BOT = GetBalls
  1822.  
  1823. ' stop the sound of deleted balls
  1824. For b = UBound(BOT) + 1 to tnob
  1825. rolling(b) = False
  1826. StopSound("fx_ballrolling" & b)
  1827. Next
  1828.  
  1829. ' exit the sub if no balls on the table
  1830. If UBound(BOT) = -1 Then Exit Sub
  1831.  
  1832. ' play the rolling sound for each ball
  1833. For b = 0 to UBound(BOT)
  1834. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 AND BOT(b).z > 0 Then
  1835. rolling(b) = True
  1836. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1837. Else
  1838. If rolling(b) = True Then
  1839. StopSound("fx_ballrolling" & b)
  1840. rolling(b) = False
  1841. End If
  1842. End If
  1843. Next
  1844. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement