Guest User

Untitled

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