Arngrim

Untitled

Oct 3rd, 2017
186
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' **** XMEN LE ****
  2. '
  3. ' This table is based on the original FP conversion by Freneticamnesic
  4. ' Brought to you by: ICPJuggla, HauntFreaks, DJRobX and Arngrim
  5. '
  6.  
  7. Option Explicit
  8. Randomize
  9.  
  10. Const Ballsize = 51
  11. Const BallMass = 1.5
  12.  
  13. On Error Resume Next
  14. ExecuteGlobal GetTextFile("controller.vbs")
  15. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  16. On Error Goto 0
  17.  
  18. '***********
  19. 'Preferences
  20. '***********
  21.  
  22. 'Real GI is made from 3 lights - Red, White, and Blue. This makes some combinations not very different when white is toggled.
  23. '7 Color mod changes white to green.
  24. Const Use7ColorGI = False
  25. Const EnableFlipperShadows = True
  26. Const EnableBallShadows = True
  27. Const EnableIceManShadow = True
  28. Const EnableCheats = False
  29.  
  30.  
  31. Dim DesktopMode: DesktopMode = Table.ShowDT
  32. Dim UseVPMDMD: UseVPMDMD = False
  33.  
  34. If DesktopMode = True Then 'Show Desktop components
  35. Ramp16.visible=1
  36. Ramp15.visible=1
  37. Primitive58.visible=1
  38. UseVPMDMD = True
  39. Else
  40. Ramp16.visible=0
  41. Ramp15.visible=0
  42. Primitive58.visible=0
  43. End if
  44.  
  45. Const UseVPMModSol = True
  46.  
  47. LoadVPM "01560000", "sam.VBS", 3.10
  48.  
  49.  
  50.  
  51. '*************************************************************
  52. 'Toggle DOF sounds on/off based on cController value
  53. '*************************************************************
  54.  
  55. Sub DOF(dofevent, dofstate)
  56. If cNewController>2 Then
  57. If dofstate = 2 Then
  58. Controller.B2SSetData dofevent, 1:Controller.B2SSetData dofevent, 0
  59. Else
  60. Controller.B2SSetData dofevent, dofstate
  61. End If
  62. End If
  63. End Sub
  64.  
  65.  
  66.  
  67. '********************
  68. 'Standard definitions
  69. '********************
  70.  
  71. Const cGameName = "xmn_151h"
  72.  
  73. Const UseSolenoids = 1
  74. Const UseLamps = 0
  75. Const UseSync = 1
  76. Const HandleMech = 0
  77.  
  78. 'Standard Sounds
  79. Const SSolenoidOn = "Solenoid"
  80. Const SSolenoidOff = ""
  81. Const SCoin = "CoinIn"
  82.  
  83.  
  84. 'Variables
  85. Dim xx
  86. Dim bsL,mTLMag,mTRMag,mDMag,tbTrough,Bump1, Bump2, Bump3, bsRHole, MsLHole, bsLHole, bsTrough, bsSaucer, DTBank5, DTBank4, DTBank3, mDiverter
  87. Dim PlungerIM,ttSpinner
  88. Dim GI_State, GI_WhiteOn, GI_RedOn, GI_BlueOn
  89. GI_State = 0: GI_WhiteOn = 1: GI_RedOn = 1: GI_BlueOn = 1
  90.  
  91.  
  92. 'Table Init
  93. Sub Table_Init
  94. vpmInit Me
  95. With Controller
  96. .GameName = cGameName
  97. .SplashInfoLine = "XMEN LE, Stern 2012"
  98. .HandleKeyboard = 0
  99. .ShowTitle = 0
  100. .ShowDMDOnly = 1
  101. .ShowFrame = 0
  102. .HandleMechanics = 1
  103. if DesktopMode then
  104. .Hidden = 1
  105. Else
  106. .Hidden = 0
  107. end if
  108. On Error Resume Next
  109. .Run GetPlayerHWnd
  110. If Err Then MsgBox Err.Description
  111. End With
  112.  
  113. On Error Goto 0
  114.  
  115.  
  116. '**Trough
  117. Set bsTrough = New cvpmBallStack
  118. bsTrough.InitSw 0, 21, 20, 19, 18, 0, 0, 0
  119. bsTrough.InitKick BallRelease, 90, 8
  120. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  121. bsTrough.Balls = 4
  122.  
  123. '***Left Hole bsLHole
  124. Set bsLHole = New cvpmBallStack
  125. With bsLHole
  126. .InitSw 0, 4, 0, 0, 0, 0, 0, 0
  127. .InitKick sw4, 168, 12
  128. .KickZ = 0.4
  129. .InitExitSnd SoundFX("popper_ball",DOFContactors), SoundFX("Solenoid",DOFContactors)
  130. .KickForceVar = 2
  131. End With
  132.  
  133.  
  134.  
  135. Set mTLMag= New cvpmMagnet
  136. With mTLMag
  137. .InitMagnet Magnet1, 16
  138. .GrabCenter = False
  139. .solenoid=51 ' LE
  140. ' .solenoid=32 ' Pro
  141. .CreateEvents "mTLMag"
  142. End With
  143.  
  144. Set mDMag= New cvpmMagnet
  145. With mDMag
  146. .InitMagnet Magnet3, 16
  147. .GrabCenter = True
  148. .CreateEvents "mDMag"
  149. End With
  150.  
  151.  
  152. Set ttSpinner = New cvpmTurntable
  153. ttSpinner.InitTurntable TurnTable, 20
  154. ttSpinner.SpinDown = 10
  155. ttSpinner.CreateEvents "ttSpinner"
  156.  
  157. if not EnableFlipperShadows then
  158. FlipperLSh.visible = 0
  159. FlipperRSh.visible = 0
  160. FlipperRSh1.visible = 0
  161. end if
  162. if not EnableIceManShadow Then
  163. IceManRampShadow.visible =0
  164. end if
  165.  
  166. if EnableCheats then
  167. CheatWall1.Visible = 1
  168. CheatWall1.IsDropped = 0
  169. CheatWall2.Visible = 1
  170. CheatWall2.IsDropped = 0
  171. CheatWall3.Visible = 1
  172. CheatWall3.IsDropped = 0
  173. Else
  174. CheatWall1.Visible = 0
  175. CheatWall1.IsDropped = 1
  176. CheatWall2.Visible = 0
  177. CheatWall2.IsDropped = 1
  178. CheatWall3.Visible = 0
  179. CheatWall3.IsDropped = 1
  180. end if
  181.  
  182.  
  183.  
  184. 'Wolvie2.isdropped=1
  185. 'wr2.alpha = 0
  186.  
  187. '************************************************************************************************************************************
  188.  
  189. 'DropTargets
  190.  
  191. '**Main Timer init
  192. PinMAMETimer.Enabled = 1
  193.  
  194. ' Set bsSaucer=New cvpmBallStack
  195. ' bsSaucer.InitSaucer S37,37,283,15
  196. ' bsSaucer.InitExitSnd"Popper","SolOn"
  197.  
  198. 'Nudging
  199. vpmNudge.TiltSwitch=-7
  200. vpmNudge.Sensitivity=3
  201. vpmNudge.TiltObj=Array(LeftSlingshot,RightSlingshot)
  202.  
  203. 'Magneto Lock
  204. lockPin1.Isdropped=1:lockPin2.Isdropped=1
  205. 'switches
  206. ' sw1b.IsDropped = 1
  207. ' sw2b.IsDropped = 1
  208. ' sw7b.IsDropped = 1
  209. ' sw8b.IsDropped = 1
  210. ' sw41b.IsDropped = 1
  211. ' sw42b.IsDropped = 1
  212. End Sub
  213.  
  214. Sub Table_Paused:Controller.Pause = 1:End Sub
  215. Sub Table_unPaused:Controller.Pause = 0:End Sub
  216. Sub Table_exit()
  217.  
  218. Controller.Stop
  219.  
  220. End sub
  221.  
  222.  
  223. '*****Keys
  224. Sub Table_KeyDown(ByVal keycode)
  225.  
  226. If Keycode = LeftFlipperKey then
  227. 'SolLFlipper true
  228. End If
  229. If Keycode = RightFlipperKey then
  230. ' SolRFlipper true
  231. End If
  232. If keycode = PlungerKey Then Plunger.Pullback: PlaysoundAt "plungerpull",Plunger
  233. ' If keycode = LeftTiltKey Then LeftNudge 80, 1, 20
  234. ' If keycode = RightTiltKey Then RightNudge 280, 1, 20
  235. ' If keycode = CenterTiltKey Then CenterNudge 0, 1, 25
  236. If vpmKeyDown(keycode) Then Exit Sub
  237.  
  238. End Sub
  239.  
  240. Sub Table_KeyUp(ByVal keycode)
  241. If vpmKeyUp(keycode) Then Exit Sub
  242. If Keycode = LeftFlipperKey then
  243. 'SolLFlipper false
  244. End If
  245. If Keycode = RightFlipperKey then
  246. 'SolRFlipper False
  247. End If
  248. If Keycode = StartGameKey Then Controller.Switch(16) = 0
  249. If keycode = PlungerKey Then
  250. Plunger.Fire
  251. PlaySoundAt "plunger",Plunger
  252. End If
  253. End Sub
  254.  
  255. 'Solenoids
  256. SolCallback(1) = "solTrough"
  257. SolCallback(2) = "solAutofire"
  258. SolCallback(3) = "bsLHole.SolOut"
  259. SolModCallback(4) = "SolMagnetoMagnet"
  260. SolCallback(5) = "bsL.SolOut"
  261. SolCallback(6) = "CLockUp"
  262. SolCallback(7) = "CLockLatch"
  263. SolModCallback(9) = "SetLampMod 141,"
  264. SolModCallback(10) = "SetLampMod 142,"
  265. SolModCallback(11) = "SetLampMod 143,"
  266. 'SolCallback(12) = "SolURFlipper"
  267. SolCallback(15) = "SolLFlipper"
  268. SolCallback(16) = "SolRFlipper"
  269. SolCallback(26) = "vpmSolDiverter RampDiverter,SoundFX(""Diverter"",DOFContactors),"
  270.  
  271. ' LE Only
  272. SolCallback(23) = "solDiscMotor"
  273. SolModCallback(30) = "SetLampMod 127, "
  274. SolModCallback(31) = "SetLampMod 131," 'LE = Bottom Arch
  275. SolCallback(27) = "solIceManMotor"
  276. 'SolCallback(51) = "solWolverineMagnet" ' cvpmMagnet handles this for us.
  277. SolCallback(52) = "solLeftNightcrawler"
  278. SolCallback(53) = "solRightNightcrawler"
  279. SolCallback(54) = "solGIWhite"
  280. SolCallback(55) = "solGIRed"
  281. SolCallback(56) = "solGIBlue"
  282. SolCallback(57) = "solLeftNightcrawlerLatch"
  283. SolCallback(58) = "solRightNightcrawlerLatch"
  284.  
  285. ' PRO only
  286. 'SolModCallback(27) = "SetLampMod 127,"
  287.  
  288. ' Modulated Flasher and Lights objects
  289.  
  290. SolModCallback(17) = "SetLampMod 117,"
  291. SolModCallback(18) = "SetLampMod 118,"
  292. SolModCallback(19) = "SetLampMod 119,"
  293. SolModCallback(20) = "SetLampMod 120,"
  294. SolModCallback(21) = "SetLampMod 121,"
  295. SolModCallback(22) = "SetLampMod 122,"
  296. SolModCallback(25) = "SetLampMod 125,"
  297. SolModCallback(28) = "SetLampMod 128,"
  298. SolModCallback(29) = "SetLampMod 129,"
  299. SolModCallback(32) = "SetLampMod 132,"
  300.  
  301. Dim IceManMotor:IceManMotor = 0
  302. Dim IceManDir:IceManDir = -1
  303. Dim IceManAngle:IceManAngle = 90
  304. Dim IceManSpeed:IceManSpeed = .08
  305. Dim IceManHold:IceManHold = 0
  306. Const IceManMaxAngle = 65
  307. Const IceManMinAngle = 15
  308.  
  309. Sub TimerIceManMotor_Timer()
  310. ' VP doesn't do dynamic collideable objects. We want to pause the ramp movement if a ball is on the ramp and the ramp is at a destination.
  311. If IceManHold > 0 AND (IceManAngle = IceManMaxAngle OR IceManAngle = IceManMinAngle) Then Exit Sub
  312. ' Reset just in case is less than 0
  313. IceManHold = 0
  314. IceManAngle = IceManAngle + IceManDir * IceManSpeed
  315. if IceManAngle > IceManMaxAngle Then
  316. IceManAngle = IceManMaxAngle
  317. IceManDir = -1
  318. Controller.Switch(35) = 1
  319. StopSound "RampMotor"
  320. me.Enabled = 0
  321. Elseif IceManAngle < IceManMinAngle Then
  322. IceManAngle = IceManMinAngle
  323. IceManDir = 1
  324. Controller.Switch(34) = 1
  325. StopSound "RampMotor"
  326. me.Enabled = 0
  327. Else
  328. select case IceManDir
  329. case -1:
  330. IceManRampA.Collidable = 0
  331. IceManRampB.Collidable = 1
  332. case 1:
  333. IceManRampA.Collidable = 1
  334. IceManRampB.Collidable = 0
  335. end select
  336. Controller.Switch(34) = 0
  337. Controller.Switch(35) = 0
  338. End If
  339. IceManRamp.RotY = IceManAngle
  340. if EnableIceManShadow then
  341. IceManRampShadow.RotZ = 220 + IceManAngle - IceManminAngle
  342. end if
  343. End Sub
  344.  
  345. Sub solIceManMotor(Enabled)
  346. TimerIceManMotor.Enabled = Enabled
  347. if Enabled then PlaySoundAtVol SoundFX("RampMotor",DOFGear), RampBumpMetal1, 0.7
  348. End Sub
  349.  
  350. Sub solMagnetoMagnet(value)
  351. if Value > 0 then
  352. mDmag.Strength = 10 * value / 255
  353. mDMag.MagnetOn = 1
  354. Else
  355. mDMag.MagnetOn = 0
  356. end If
  357. end sub
  358.  
  359.  
  360.  
  361. '************************************************************************
  362. ' Night Crawlers
  363. '************************************************************************
  364.  
  365. Const NightCrawlerVertSpeed = .6
  366. Const NightCrawlerShakeSpeed = .2
  367. Const NightCrawlerShakeDecay = .99
  368. Const NightCrawlerHitFactor = .8
  369. Const NightCrawlerMin = 0
  370. Const NightCrawlerMax = 80
  371.  
  372. Dim LeftNightCrawlerState:LeftNightCrawlerState = 0
  373. Const NCStateMoveUp = 1
  374. Const NCStateShake = 2
  375. Const NCStateMoveDownShake = 3
  376. Const NCStateMoveDown = 4
  377.  
  378. Dim RightNightCrawlerState:RightNightCrawlerState = 0
  379. Dim LeftNightCrawlerShake:LeftNightCrawlerShake = 0
  380. Dim RightNightCrawlerShake:RightNightCrawlerShake = 0
  381. Dim LeftNightCrawlerShakeAngle:LeftNightCrawlerShakeAngle = 0
  382. Dim RightNightCrawlerShakeAngle:RightNightCrawlerShakeAngle = 0
  383.  
  384. Sub LeftNightCrawlerWall_Hit
  385. Controller.Switch(50) = 1
  386. PlaySoundAt "flip_hit_3", ActiveBall
  387. LeftNightCrawlerShakeAngle = 0
  388. LeftNightCrawlerShake = BallVel(ActiveBall) * NightCrawlerHitFactor
  389. LeftNightCrawlerState = NCStateShake
  390. LeftNightCrawlerWall.TimerEnabled = 1
  391. End Sub
  392.  
  393. Sub LeftNightCrawlerWall_UnHit:Controller.Switch(50) = 0:End Sub
  394.  
  395. Sub RightNightCrawlerWall_Hit
  396. Controller.Switch(51) = 1
  397. PlaySoundAt "flip_hit_3", ActiveBall
  398. RightNightCrawlerShakeAngle = 0
  399. RightNightCrawlerShake = BallVel(ActiveBall) * NightCrawlerHitFactor
  400. RightNightCrawlerState = NCStateShake
  401. RightNightCrawlerWall.TimerEnabled = 1
  402. End Sub
  403.  
  404. Sub RightNightCrawlerWall_UnHit:Controller.Switch(51) = 0:End Sub
  405.  
  406. Sub RightNightCrawlerWall_Timer
  407. select case RightNightCrawlerState
  408. case NCStateMoveDown:
  409. RightNightCrawler.Z = RightNightCrawler.Z - NightCrawlerVertSpeed
  410. if RightNightCrawler.Z <= NightCrawlerMin then
  411. RightNightCrawler.Z = NightCrawlerMin
  412. RightNightCrawlerWall.IsDropped = 1
  413. Controller.Switch(56) = 1
  414. Me.TimerEnabled = 0
  415. end If
  416. case NCStateMoveUp:
  417. RightNightCrawler.Z = RightNightCrawler.Z + NightCrawlerVertSpeed
  418. if RightNightCrawler.Z >= NightCrawlerMax then
  419. RightNightCrawler.Z = NightCrawlerMax
  420. RightNightCrawlerWall.IsDropped = 0
  421. Controller.Switch(56) = 0
  422. RightNightCrawlerShakeAngle = 0
  423. RightNightCrawlerShake = 8
  424. RightNightCrawlerState = NCStateShake
  425. end If
  426. case NCStateShake:
  427. RightNightCrawler.TransY = RightNightCrawlerShake * Sin(RightNightCrawlerShakeAngle)
  428. RightNightCrawlerShakeAngle = RightNightCrawlerShakeAngle + ((NightCrawlerShakeSpeed * RightNightCrawlerShake) / 30)
  429. RightNightCrawlerShake = RightNightCrawlerShake * NightCrawlerShakeDecay
  430. if RightNightCrawlerShake < 1 Then
  431. RightNightCrawler.TransY = 0
  432. Me.TimerEnabled =0
  433. end If
  434. case NCStateMoveDownShake:
  435. RightNightCrawler.TransY = RightNightCrawlerShake * Sin(RightNightCrawlerShakeAngle)
  436. RightNightCrawlerShakeAngle = RightNightCrawlerShakeAngle + ((NightCrawlerShakeSpeed * RightNightCrawlerShake) / 30)
  437. RightNightCrawlerShake = RightNightCrawlerShake * NightCrawlerShakeDecay
  438. if RightNightCrawlerShake < 1 Then
  439. RightNightCrawler.TransY = 0
  440. RightNightCrawlerState = NCStateMoveDown
  441. end If
  442. end Select
  443. End Sub
  444.  
  445. Sub LeftNightCrawlerWall_Timer
  446. select case LeftNightCrawlerState
  447. case NCStateMoveDown:
  448. LeftNightCrawler.Z = LeftNightCrawler.Z - NightCrawlerVertSpeed
  449. if LeftNightCrawler.Z <= NightCrawlerMin then
  450. LeftNightCrawler.Z = NightCrawlerMin
  451. LeftNightCrawlerWall.IsDropped = 1
  452. Controller.Switch(12) = 1
  453. Me.TimerEnabled = 0
  454. end If
  455. case NCStateMoveUp:
  456. LeftNightCrawler.Z = LeftNightCrawler.Z + NightCrawlerVertSpeed
  457. if LeftNightCrawler.Z >= NightCrawlerMax then
  458. LeftNightCrawler.Z = NightCrawlerMax
  459. LeftNightCrawlerWall.IsDropped = 0
  460. Controller.Switch(12) = 0
  461. LeftNightCrawlerShakeAngle = 0
  462. LeftNightCrawlerShake = 8
  463. LeftNightCrawlerState = NCStateShake
  464. end If
  465. case NCStateShake:
  466. LeftNightCrawler.TransY = LeftNightCrawlerShake * Sin(LeftNightCrawlerShakeAngle)
  467. LeftNightCrawlerShakeAngle = LeftNightCrawlerShakeAngle + ((NightCrawlerShakeSpeed * LeftNightCrawlerShake) / 30)
  468. LeftNightCrawlerShake = LeftNightCrawlerShake * NightCrawlerShakeDecay
  469. if LeftNightCrawlerShake < 1 Then
  470. LeftNightCrawler.TransY = 0
  471. Me.TimerEnabled =0
  472. end If
  473. case NCStateMoveDownShake:
  474. LeftNightCrawler.TransY = LeftNightCrawlerShake * Sin(LeftNightCrawlerShakeAngle)
  475. LeftNightCrawlerShakeAngle = LeftNightCrawlerShakeAngle + ((NightCrawlerShakeSpeed * LeftNightCrawlerShake) / 30)
  476. LeftNightCrawlerShake = LeftNightCrawlerShake * NightCrawlerShakeDecay
  477. if LeftNightCrawlerShake < 1 Then
  478. LeftNightCrawler.TransY = 0
  479. LeftNightCrawlerState = NCStateMoveDown
  480. end If
  481. end Select
  482. End Sub
  483.  
  484. Sub SolLeftNightCrawler(Enabled)
  485. If Enabled AND LeftNightCrawler.Z <> NightCrawlerMin then
  486. LeftNightCrawlerShakeAngle = 0
  487. LeftNightCrawlerShake = 8
  488. LeftNightCrawlerState = NCStateMoveDownShake
  489. LeftNightCrawlerWall.TimerEnabled = 1
  490. PlaySoundAtVol SoundFX("PopUp",DOFContactors), LeftNightCrawler, .001
  491. End If
  492. End Sub
  493.  
  494. Sub SolLeftNightCrawlerLatch(Enabled)
  495. If NOT Enabled AND LeftNightCrawler.Z = NightCrawlerMin Then
  496. PlaySoundAtVol SoundFX("solenoid",DOFContactors), LeftNightCrawler, .5
  497. LeftNightCrawlerState = NCStateMoveUp
  498. LeftNightCrawlerWall.TimerEnabled = 1
  499. End If
  500. End Sub
  501.  
  502. Sub SolRightNightCrawler(Enabled)
  503. If Enabled AND RightNightCrawler.Z <> NightCrawlerMin then
  504. RightNightCrawlerShakeAngle = 0
  505. RightNightCrawlerShake = 8
  506. RightNightCrawlerState = NCStateMoveDownShake
  507. RightNightCrawlerWall.TimerEnabled = 1
  508. PlaySoundAtVol SoundFX("PopUp",DOFContactors), RightNightCrawler, .001
  509. End If
  510. End Sub
  511.  
  512. Sub SolRightNightCrawlerLatch(Enabled)
  513. If NOT Enabled AND RightNightCrawler.Z = NightCrawlerMin Then
  514. PlaySoundAtVol SoundFX("solenoid",DOFContactors), RightNightCrawler, .5
  515. RightNightCrawlerState = NCStateMoveUp
  516. RightNightCrawlerWall.TimerEnabled = 1
  517. End If
  518. End Sub
  519.  
  520. '************************************************************************
  521. ' Turntable
  522. '************************************************************************
  523.  
  524.  
  525. Sub solDiscMotor(Enabled)
  526. if Enabled Then
  527. ttSpinner.MotorOn = True : Playsound SoundFX("disc_noise",DOFGear),-1,0.04,0,0,-60000,0,0,AudioFade(f120b1)
  528. Else
  529. ttSpinner.MotorOn = False : Stopsound "disc_noise"
  530. end If
  531. end sub
  532.  
  533. Sub TurnTable_Hit
  534. ttSpinner.AddBall ActiveBall
  535. if ttSpinner.MotorOn=true then ttSpinner.AffectBall ActiveBall
  536. End Sub
  537.  
  538. Sub TurnTable_unHit
  539. ttSpinner.RemoveBall ActiveBall
  540. End Sub
  541.  
  542. Sub solTrough(Enabled)
  543. If Enabled Then
  544. bsTrough.ExitSol_On
  545. vpmTimer.PulseSw 22
  546. End If
  547. End Sub
  548.  
  549. Sub solAutofire(Enabled)
  550. If Enabled Then
  551. PlungerIM.AutoFire:PlaySoundAt "plunger",Plunger
  552. End If
  553. End Sub
  554.  
  555. Sub CLockUp(Enabled)
  556. If Enabled Then
  557. lockPin1.Isdropped=0:lockPin2.Isdropped=0
  558. End If
  559. End Sub
  560.  
  561. Sub LockPin1_Timer
  562. 'Dozer would be proud...
  563. Me.TimerEnabled = 0
  564. lockPin1.Isdropped=1:lockPin2.Isdropped=1
  565. End Sub
  566.  
  567. Sub CLockLatch(Enabled)
  568. If Enabled Then
  569. lockPin1.TimerInterval=500
  570. lockPin1.TimerEnabled=True
  571. End If
  572. End Sub
  573.  
  574. 'Scoop
  575. Dim aBall, aZpos
  576. Dim bBall, bZpos
  577.  
  578. Sub sw4_Hit
  579. Set bBall = ActiveBall
  580. PlaySoundAt "kicker_enter_center", ActiveBall
  581. bZpos = 35
  582. ClearBallID
  583. Me.TimerInterval = 2
  584. Me.TimerEnabled = 1
  585. End Sub
  586.  
  587. Sub sw4_Timer
  588. bBall.Z = bZpos
  589. bZpos = bZpos-4
  590. If bZpos <-30 Then
  591. Me.TimerEnabled = 0
  592. Me.DestroyBall
  593. bsLHole.AddBall Me
  594. End If
  595. End Sub
  596.  
  597. Sub SolDiverter(enabled)
  598. If enabled Then
  599. RampDiverter.rotatetoend : PlaySoundAt SoundFX("Diverter",DOFContactors), l29a
  600. Else
  601. RampDiverter.rotatetostart : PlaySoundAt SoundFX("Diverter",DOFContactors), l29a
  602. End If
  603. End Sub
  604.  
  605. Set bsL = New cvpmBallStack
  606. With bsL
  607. .InitSw 0, 55, 0, 0, 0, 0, 0, 0
  608. .InitKick sw55, 180, 15
  609. .InitExitSnd SoundFX("popper_ball",DOFContactors), SoundFX("Solenoid",DOFContactors)
  610. .KickForceVar = 3
  611. End With
  612.  
  613. Sub Drain_Hit():PlaySoundAt "Drain", Drain
  614. 'ClearBallID
  615. BallCount = BallCount - 1
  616. bsTrough.AddBall Me
  617. End Sub
  618.  
  619. Sub sw1_Hit:Me.TimerEnabled = 1:sw1p.TransX = -2:vpmTimer.PulseSw 1:PlaySoundAt SoundFX("target",DOFTargets), ActiveBall:End Sub
  620. Sub sw1_Timer:Me.TimerEnabled = 0:sw1p.TransX = 0:End Sub
  621. Sub sw2_Hit:Me.TimerEnabled = 1:sw2p.TransX = -2:vpmTimer.PulseSw 2:PlaySoundAt SoundFX("target",DOFTargets), ActiveBall:End Sub
  622. Sub sw2_Timer:Me.TimerEnabled = 0:sw2p.TransX = 0:End Sub
  623. Sub sw7_Hit:Me.TimerEnabled = 1:sw7p.TransX = -2:vpmTimer.PulseSw 7:PlaySoundAt SoundFX("target",DOFTargets), ActiveBall:End Sub
  624. Sub sw7_Timer:Me.TimerEnabled = 0:sw7p.TransX = 0:End Sub
  625. Sub sw8_Hit:Me.TimerEnabled = 1:sw8p.TransX = -2:vpmTimer.PulseSw 8:PlaySoundAt SoundFX("target",DOFTargets), ActiveBall:End Sub
  626. Sub sw8_Timer:Me.TimerEnabled = 0:sw8p.TransX = 0:End Sub
  627. Sub sw11_Hit:Controller.Switch(11) = 1:PlaySoundAt "Gate", ActiveBall:End Sub
  628. Sub sw11_UnHit:Controller.Switch(11) = 0:End Sub
  629. Sub sw13_Hit:Controller.Switch(13) = 1:PlaySoundAt "Gate", ActiveBall:End Sub
  630. Sub sw13_UnHit:Controller.Switch(13) = 0:End Sub
  631. Sub sw14_Hit:Controller.Switch(14) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  632. Sub sw14_UnHit:Controller.Switch(14) = 0:End Sub
  633. Sub sw23_Hit:Controller.Switch(23) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  634. Sub sw23_UnHit:Controller.Switch(23) = 0:End Sub
  635. Sub sw24_Hit:Controller.Switch(24) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  636. Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
  637. Sub sw25_Hit:Controller.Switch(25) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  638. Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
  639. Sub sw28_Hit:Controller.Switch(28) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  640. Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
  641. Sub sw29_Hit:Controller.Switch(29) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  642. Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
  643. Sub sw33_Hit:Controller.Switch(33) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  644. Sub sw33_UnHit:Controller.Switch(33) = 0:End Sub
  645. Sub sw36_Hit:VengeanceHit 2:vpmTimer.PulseSw 36:PlaySoundAt SoundFX("target",DOFTargets), ActiveBall:End Sub
  646. 'Sub sw36_Timer:Wolvie1.IsDropped = 0:Wolvie2.IsDropped = 1:wr1.alpha = 1:wr1.triggersingleupdate:wr2.alpha = 0:wr2.triggersingleupdate:Me.TimerEnabled = 0:End Sub
  647. Sub sw38_Hit:PlaySoundAt "rollover", ActiveBall:Controller.Switch(38)=1:End Sub 'Lock 2
  648. Sub sw38_unHit:Controller.Switch(38)=0:End Sub
  649. Sub sw39_Hit:PlaySoundAt "rollover", ActiveBall:Controller.Switch(39)=1:End Sub 'Lock 3
  650. Sub sw39_unHit:Controller.Switch(39)=0:End Sub
  651. Sub sw40_Hit:PlaySoundAt "rollover", ActiveBall:Controller.Switch(40)=1:End Sub 'Lock 4
  652. Sub sw40_unHit:Controller.Switch(40)=0:End Sub
  653. Sub sw41_Hit:Me.TimerEnabled = 1:sw41p.TransX = -2:vpmTimer.PulseSw 41:PlaySoundAt SoundFX("target",DOFTargets), ActiveBall:End Sub
  654. Sub sw41_Timer:Me.TimerEnabled = 0:sw41p.TransX = 0:End Sub
  655. Sub sw42_Hit:Me.TimerEnabled = 1:sw42p.TransX = -2:vpmTimer.PulseSw 42:PlaySoundAt SoundFX("target",DOFTargets), ActiveBall:End Sub
  656. Sub sw42_Timer:Me.TimerEnabled = 0:sw42p.TransX = 0:End Sub
  657. Sub sw47_Spin:vpmTimer.PulseSw 47::playsoundat "spinner", sw47:End Sub
  658. Sub sw48_Hit:Controller.Switch(48) = 1:PlaySoundAt "Gate", ActiveBall:End Sub
  659. Sub sw48_UnHit:Controller.Switch(48) = 0:End Sub
  660. Sub sw49_Hit:Controller.Switch(49) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  661. Sub sw49_UnHit:Controller.Switch(49) = 0:End Sub
  662. Sub sw52_Hit:Controller.Switch(52) = 1:PlaySoundAt "Gate", ActiveBall:IceManHold = IceManHold + 1:sw52.TimerInterval=200:sw52.TimerEnabled=1:End Sub
  663. Sub sw52_Timer
  664. if IceManDir = -1 then ' Ramp is going across table
  665. PlaySoundAtVol "fx_ramp_metal", l30, .2
  666. Else
  667. PlaySoundAtVol "fx_ramp_metal", l7, .2
  668. end If
  669. me.TimerEnabled =0
  670. End Sub
  671. Sub sw52_UnHit:Controller.Switch(52) = 0:End Sub
  672. Sub sw53_Hit:Controller.Switch(53) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  673. Sub sw53_UnHit:Controller.Switch(53) = 0:End Sub
  674. Sub sw54_Hit:Controller.Switch(54) = 1:PlaySoundAt "fx_sensor", ActiveBall:End Sub
  675. Sub sw54_UnHit:Controller.Switch(54) = 0:End Sub
  676. Sub sw55a_Hit:ClearBallId:PlaySoundAt "kicker_enter", sw55a:bsL.AddBall Me:End Sub
  677.  
  678. Sub SolLFlipper(Enabled)
  679. If Enabled Then
  680. PlaySoundAt SoundFX("FlipperUp",DOFFlippers), f131a
  681. LeftFlipper.RotateToEnd
  682. Else
  683. PlaySoundAt SoundFX("FlipperDown",DOFFlippers), f131a
  684. LeftFlipper.RotateToStart
  685. End If
  686. End Sub
  687.  
  688. Sub SolRFlipper(Enabled)
  689. If Enabled Then
  690. PlaySoundAt SoundFX("FlipperUp",DOFFlippers), f131b
  691. RightFlipper.RotateToEnd:PlaySound SoundFX("FlipperUpUR",DOFFlippers),0,2,Pan(RightFlipper1),0,6000,0,0,AudioFade(RightFlipper1):RightFlipper1.RotateToEnd
  692. Else
  693. PlaySoundAt SoundFX("FlipperDown",DOFFlippers), f131b
  694. RightFlipper.RotateToStart:PlaySound SoundFX("FlipperDownUR",DOFFlippers),0,1,Pan(RightFlipper1),0,6000,0,0,AudioFade(RightFlipper1):RightFlipper1.RotateToStart
  695. End If
  696. End Sub
  697.  
  698.  
  699. Dim BallCount:BallCount = 0
  700. Sub BallRelease_UnHit()
  701. 'NewBallID
  702. BallCount = BallCount + 1
  703. End Sub
  704.  
  705. Dim RStep, LStep
  706.  
  707. Sub LeftSlingShot_Slingshot
  708. vpmTimer.PulseSw 26
  709. PlaySound SoundFX("left_slingshot", DOFContactors)
  710. LSling.Visible = 0
  711. LSling1.Visible = 1
  712. sling2.TransZ = -20
  713. LStep = 0
  714. Me.TimerEnabled = 1
  715. End Sub
  716.  
  717. Sub LeftSlingShot_Timer
  718. Select Case LStep
  719. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  720. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  721. End Select
  722. LStep = LStep + 1
  723. End Sub
  724.  
  725. Sub RightSlingShot_Slingshot
  726. vpmTimer.PulseSw 27
  727. PlaySound SoundFX("right_slingshot", DOFContactors)
  728. RSling.Visible = 0
  729. RSling1.Visible = 1
  730. sling1.TransZ = -20
  731. RStep = 0
  732. Me.TimerEnabled = 1
  733. End Sub
  734.  
  735. Sub RightSlingShot_Timer
  736. Select Case RStep
  737. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  738. Case 4 RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  739. End Select
  740. RStep = RStep + 1
  741. End Sub
  742.  
  743.  
  744.  
  745. Const IMPowerSetting = 45
  746. Const IMTime = 0.6
  747. Set plungerIM = New cvpmImpulseP
  748. With plungerIM
  749. .InitImpulseP swplunger, IMPowerSetting, IMTime
  750. .Random 0
  751. .InitExitSnd "plunger2", "plunger"
  752. .CreateEvents "plungerIM"
  753. End With
  754.  
  755.  
  756. 'Bumpers
  757. Sub Bumper1b_Hit
  758. vpmTimer.PulseSw 31
  759. PlaySoundAt SoundFX("fx_bumper1",DOFContactors),Bumper1b
  760. End Sub
  761.  
  762.  
  763. Sub Bumper2b_Hit
  764. vpmTimer.PulseSw 30
  765. PlaySoundAt SoundFX("fx_bumper1",DOFContactors),Bumper2b
  766. End Sub
  767.  
  768.  
  769. Sub Bumper3b_Hit
  770. vpmTimer.PulseSw 32
  771. PlaySoundAt SoundFX("fx_bumper1",DOFContactors), Bumper3b
  772. End Sub
  773.  
  774.  
  775.  
  776. '***********************************************
  777. ' Lamps
  778. '***********************************************
  779.  
  780.  
  781.  
  782. Dim LampState(200), FadingLevel(200), FadingState(200)
  783. Dim FlashState(200), FlashLevel(200)
  784. Dim FlashSpeedUp, FlashSpeedDown
  785. 'Dim x
  786.  
  787. AllLampsOff()
  788. LampTimer.Interval = -1 'lamp fading speed
  789. LampTimer.Enabled = 1
  790. '
  791.  
  792. Sub LampTimer_Timer()
  793. Dim chgLamp, num, chg, ii
  794. chgLamp = Controller.ChangedLamps
  795. If Not IsEmpty(chgLamp) Then
  796. For ii = 0 To UBound(chgLamp)
  797. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  798. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
  799. FlashState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  800. Next
  801. End If
  802. disc.roty = (disc.roty + ttSpinner.Speed) Mod 360
  803. f119.rotz = (disc.roty + 60) Mod 360
  804. f120.rotz = (disc.roty + 15) Mod 360
  805.  
  806. UpdateLamps
  807. if EnableBallShadows then
  808. UpdateBallShadow
  809. end if
  810. UpdateFlipperLogo
  811. End Sub
  812.  
  813. Sub FlashInit
  814. Dim i
  815. For i = 0 to 200
  816. FlashState(i) = 0
  817. FlashLevel(i) = 0
  818. Next
  819.  
  820. FlashSpeedUp = 50 ' fast speed when turning on the flasher
  821. FlashSpeedDown = 10 ' slow speed when turning off the flasher, gives a smooth fading
  822. AllFlashOff()
  823. End Sub
  824.  
  825. Sub AllFlashOff
  826. Dim i
  827. For i = 0 to 200
  828. FlashState(i) = 0
  829. Next
  830. End Sub
  831.  
  832.  
  833. Sub UpdateLampsLE()
  834. NFadeL 17, l71
  835. NFadeL 18, l70
  836. NFadeL 19, l69
  837. NFadeL 20, l57
  838. NFadeL 21, l50
  839. NFadeL 22, l51
  840. NFadeL 23, l52
  841. NFadeL 24, l53
  842. NFadeL 25, l54
  843. NFadeL 26, l55
  844. NFadeL 27, l56
  845. NFadeL 28, l65
  846. NFadeL 29, l66
  847. NFadeL 30, l67
  848. NFadeL 31, l68
  849. NFadeL 32, l3
  850. NFadeL 33, l4
  851. NFadeL 34, l5
  852. NFadeL 35, l9
  853. NFadeL 36, l10
  854. NFadeL 37, l31
  855. NFadeL 38, l30
  856. NFadeL 43, Bumper2l60 'top left bumper
  857. NFadeL 42, l61 'right bumper
  858. NFadeL 41, Bumper3l62 'lower left bumperNFadeL 43, l43
  859. NFadeL 45, l12
  860. NFadeL 46, l13
  861. NFadeL 47, l14
  862. NFadeL 48, l15
  863. NFadeL 49, l23
  864. NFadeL 50, l22
  865. NFadeL 51, l21
  866. NFadeL 52, l16
  867. NFadeL 53, l17
  868. NFadeL 54, l18
  869. NFadeL 55, l20
  870. NFadeL 56, l19
  871. NFadeL 57, l24
  872. NFadeL 58, l25
  873. NFadeL 59, f59
  874. NFadeL 60, l28
  875. NFadeL 63, f121 '' !!! ?
  876. NFadeL 65, l35 ' Magneto (Green)
  877. NFadeL 66, l34
  878. NFadeL 67, l33 ' Magneto (Red)
  879. NFadeL 68, l6
  880. NFadeL 69, l7
  881. NFadeL 70, l8
  882. NFadeL 71, l49
  883. NFadeL 72, l48
  884. NFadeL 73, l44
  885. NFadeL 75, l43
  886. NFadeL 76, l37
  887. NFadeL 77, l29
  888. NFadeL 78, l45
  889. NFadeL 79, l46
  890. NFadeL 80, l47
  891. End Sub
  892.  
  893. Sub UpdateLamps
  894. UpdateLampsLE
  895. LampMod 117, f117a
  896. LampMod 117, f117b
  897. LampMod 117, f117c
  898. LampMod 117, f117d
  899. LampMod 117, f117e
  900. LampMod 117, f117f
  901. LampMod 118, f118a
  902. LampMod 118, f118b
  903. LampMod 118, f118f
  904. LampMod 119, f119
  905. LampMod 119, f119b
  906. LampMod 120, f120
  907. LampMod 120, f120b
  908. LampMod 122, f122a
  909. LampMod 122, f122b
  910. 'NFadeL 121, f121
  911. LampMod 125, f25
  912. LampMod 132, f132
  913. LampMod 131, f131a
  914. LampMod 131, f131b
  915. LampMod 127, f127
  916. LampMod 128, l28a
  917. LampMod 128, l28b
  918. LampMod 128, l28c
  919. LampMod 129, l29a
  920. LampMod 129, l29b
  921. LampMod 129, l29c
  922. LampMod 141, f9
  923. LampMod 142, f10
  924. LampMod 143, f11
  925. LampMod 121, f121b
  926. LampMod 127, f127b
  927.  
  928. ' FadeModPrim 121, wolverine, "wolverine2_30", "wolverine2_20", "wolverine2_16","wolverine2"
  929. 'FadeModPrim 127, Primitive5, "magnetotxt3_30", "magnetotxt3_20", "magnetotxt3_16","magnetotxt3"
  930. End Sub
  931.  
  932.  
  933. Sub FadePrim(nr, pri, a, b, c, d)
  934. Select Case FadingLevel(nr)
  935. Case 2:pri.image = d:FadingLevel(nr) = 0
  936. Case 3:pri.image = c:FadingLevel(nr) = 1
  937. Case 4:pri.image = b:FadingLevel(nr) = 2
  938. Case 5:pri.image = a:FadingLevel(nr) = 3
  939. End Select
  940. End Sub
  941.  
  942. Sub FadeModPrim(nr, pri, a, b, c, d)
  943. dim lev
  944. lev = FadingLevel(nr) \ 32
  945. if lev > 3 then lev = 3
  946. Select Case lev
  947. Case 0:pri.image = d
  948. Case 1:pri.image = c
  949. Case 2:pri.image = b
  950. Case 3:pri.image = a
  951. End Select
  952. End Sub
  953.  
  954. ''Lights
  955.  
  956. Sub NFadeL(nr, a)
  957. Select Case FadingLevel(nr)
  958. Case 4:a.state = 0:FadingLevel(nr) = 0
  959. Case 5:a.State = 1:FadingLevel(nr) = 1
  960. End Select
  961. End Sub
  962.  
  963. Sub NFadeLm(nr, a)
  964. Select Case FadingLevel(nr)
  965. Case 4:a.state = 0
  966. Case 5:a.State = 1
  967. End Select
  968. End Sub
  969.  
  970. Sub SetLampMod(nr, value)
  971. If value > 0 Then
  972. LampState(nr) = 1
  973. Else
  974. LampState(nr) = 0
  975. End If
  976. FadingLevel(nr) = value
  977. End Sub
  978.  
  979. Sub LampMod(nr, object)
  980. If TypeName(object) = "Light" Then
  981. Object.IntensityScale = FadingLevel(nr)/128
  982. Object.State = LampState(nr)
  983. End If
  984. If TypeName(object) = "Flasher" Then
  985. Object.IntensityScale = FadingLevel(nr)/128
  986. Object.visible = LampState(nr)
  987. End If
  988. If TypeName(object) = "Primitive" Then
  989. Object.DisableLighting = LampState(nr)
  990. End If
  991. End Sub
  992.  
  993. Dim x
  994. Sub AllLampsOff():For x = 1 to 200:LampState(x) = 4:FadingLevel(x) = 4:Next:UpdateLamps:UpdateLamps:Updatelamps:End Sub
  995.  
  996.  
  997. Sub SetLamp(nr, value)
  998. If value = 0 AND LampState(nr) = 0 Then Exit Sub
  999. If value = 1 AND LampState(nr) = 1 Then Exit Sub
  1000. LampState(nr) = abs(value) + 4
  1001. FadingLevel(nr ) = abs(value) + 4: FadingState(nr ) = abs(value) + 4
  1002. End Sub
  1003.  
  1004. Sub SetFlash(nr, stat)
  1005. FlashState(nr) = ABS(stat)
  1006. End Sub
  1007.  
  1008. Sub swPlunger_Hit:BallinPlunger = 1:End Sub
  1009. Sub swPlunger_UnHit:BallinPlunger = 0:End Sub
  1010.  
  1011.  
  1012. ' Create ball in kicker and assign a Ball ID used mostly in non-vpm tables
  1013. Sub CreateBallID(Kickername)
  1014. For cnt = 1 to ubound(ballStatus)
  1015. If ballStatus(cnt) = 0 Then
  1016. Set currentball(cnt) = Kickername.createball
  1017. currentball(cnt).uservalue = cnt
  1018. ballStatus(cnt) = 1
  1019. ballStatus(0) = ballStatus(0) + 1
  1020. If coff = False Then
  1021. If ballStatus(0)> 1 and XYdata.enabled = False Then XYdata.enabled = True
  1022. End If
  1023. Exit For
  1024. End If
  1025. Next
  1026. End Sub
  1027.  
  1028. Sub ClearBallID
  1029. On Error Resume Next
  1030. iball = ActiveBall.uservalue
  1031. currentball(iball).UserValue = 0
  1032. If Err Then Msgbox Err.description & vbCrLf & iball
  1033. ballStatus(iBall) = 0
  1034. ballStatus(0) = ballStatus(0) -1
  1035. On Error Goto 0
  1036. End Sub
  1037.  
  1038.  
  1039. Sub Table_exit()
  1040. Controller.Pause = False
  1041. Controller.Stop
  1042. End Sub
  1043.  
  1044.  
  1045.  
  1046. '*******************************
  1047. '****Flipper Prims / Shadows****
  1048. '*******************************
  1049.  
  1050. Sub UpdateFlipperLogo
  1051. LFLogo.RotY = LeftFlipper.CurrentAngle
  1052. RFlogo.RotY = RightFlipper.CurrentAngle
  1053. RFlogo1.RotY = RightFlipper1.CurrentAngle
  1054. if EnableFlipperShadows then
  1055. FlipperLSh.RotZ = LeftFlipper.currentangle
  1056. FlipperRSh.RotZ = RightFlipper.currentangle
  1057. FlipperRSh1.RotZ = RightFlipper1.currentangle
  1058. end if
  1059. End Sub
  1060.  
  1061. '************************************************************************
  1062. ' Color GI
  1063. '************************************************************************
  1064.  
  1065. Sub SolGIWhite(Enabled)
  1066. if Enabled Then
  1067. GI_WhiteOn = 0
  1068. Else
  1069. GI_WhiteOn = 1
  1070. end If
  1071. UpdateGI
  1072. end Sub
  1073.  
  1074. Sub SolGIRed(Enabled)
  1075. if Enabled Then
  1076. GI_RedOn = 0
  1077. Else
  1078. GI_RedOn = 1
  1079. end If
  1080. UpdateGI
  1081. end Sub
  1082.  
  1083. Sub SolGIBlue(Enabled)
  1084. if Enabled Then
  1085. GI_BlueOn = 0
  1086. Else
  1087. GI_BlueOn = 1
  1088. end If
  1089. UpdateGI
  1090. end Sub
  1091.  
  1092. set GICallback = GetRef("ChangeGI")
  1093.  
  1094. Sub ChangeGI(nr,enabled)
  1095. Select Case nr
  1096. Case 0
  1097. If Enabled Then
  1098. Table.ColorGradeImage= "ColorGrade_8"
  1099. GI_State = 1
  1100. Else
  1101. Table.ColorGradeImage= "ColorGrade_1"
  1102. GI_State = 0
  1103. End If
  1104. End Select
  1105. UpdateGI
  1106. End Sub
  1107.  
  1108.  
  1109. Sub UpdateGI
  1110. dim bulb, targcolor
  1111.  
  1112. for each bulb in GI_Main
  1113. bulb.state = GI_State
  1114. next
  1115.  
  1116. If Use7ColorGI Then
  1117. TargColor = RGB(GI_RedOn * 255, GI_WhiteOn * 255, GI_BlueOn * 255)
  1118. Else
  1119. TargColor = RGB(GI_WhiteOn * 127 + GI_RedOn * 127, GI_WhiteOn * 127, GI_WhiteOn * 127 + GI_BlueOn * 127)
  1120. ' Tweaks...
  1121. if GI_RedOn = 1 AND GI_BlueOn = 0 AND GI_WhiteOn = 0 then TargColor = RGB(200,0,0):DOF 200, DOFOn:DOF 201, DOFOff:DOF 202, DOFOff
  1122. if GI_RedOn = 0 AND GI_BlueOn = 1 AND GI_WhiteOn = 0 then TargColor = RGB(0,0,200):DOF 200, DOFOff:DOF 201, DOFOn:DOF 202, DOFOff
  1123. if GI_RedOn = 1 AND GI_BlueOn = 1 AND GI_WhiteOn = 1 then TargColor = RGB(255,255,255):DOF 200, DOFOff:DOF 201, DOFOff:DOF 202, DOFOn
  1124. end If
  1125.  
  1126. for each bulb in GI_Color
  1127. if TargColor > 0 AND GI_State then
  1128. bulb.state = 1
  1129. Else
  1130. bulb.state = 0
  1131. end if
  1132. bulb.color = RGB(0,0,0)
  1133. bulb.colorfull = TargColor
  1134. next
  1135. End Sub
  1136.  
  1137.  
  1138. ' *********************************************************************
  1139. ' Supporting Ball & Sound Functions
  1140. ' *********************************************************************
  1141.  
  1142. Sub Pins_Hit (idx)
  1143. PlaySoundAtBall "pinhit_low"
  1144. End Sub
  1145.  
  1146. Sub Targets_Hit (idx)
  1147. PlaySoundAtBallVol"target",3
  1148. End Sub
  1149.  
  1150. Sub TargetBankWalls_Hit (idx)
  1151. PlaySoundAtBallVol"target",3
  1152. End Sub
  1153.  
  1154. Sub Metals_Thin_Hit (idx)
  1155. PlaySoundAtBall "metalhit_thin"
  1156. End Sub
  1157.  
  1158. Sub Metals_Medium_Hit (idx)
  1159. PlaySoundAtBall "metalhit_medium"
  1160. End Sub
  1161.  
  1162. Sub Metals2_Hit (idx)
  1163. PlaySoundAtBall "metalhit2"
  1164. End Sub
  1165.  
  1166. Sub Gates_Hit (idx)
  1167. PlaySoundAtBall "gate4"
  1168. End Sub
  1169.  
  1170. Sub Spinner_Spin
  1171. PlaySoundAt "fx_spinner", Spinner
  1172. End Sub
  1173.  
  1174.  
  1175. '*******************************************************************************************************
  1176. ' Random Rubber Bumps by RustyCardores - Used instead of the existing velocity based random rubber script
  1177. ' x is a volume variable. Decimals decrease volume. Whole Numbers increase volume.
  1178. ' More effective with PMD as bumps applied from minimum velocity & auto-governed by Vol(ActiveBall)
  1179. '*******************************************************************************************************
  1180.  
  1181. Sub Rubbers_Hit(idx)
  1182. RandomRubberSound()
  1183. End Sub
  1184.  
  1185. Sub Posts_Hit(idx)
  1186. RandomRubberSound()
  1187. End Sub
  1188.  
  1189. Sub RandomRubberSound()
  1190. Select Case Int(Rnd*3)+1
  1191. Case 1 : PlaySoundAtBallVol "rubber_hit_1",1
  1192. Case 2 : PlaySoundAtBallVol "rubber_hit_2",1
  1193. Case 3 : PlaySoundAtBallVol "rubber_hit_3",1
  1194. End Select
  1195. End Sub
  1196.  
  1197. '*****************************************
  1198. ' END Random Rubber Bumps by RustyCardores
  1199.  
  1200.  
  1201. Sub LeftFlipper_Collide(parm)
  1202. RandomSoundFlipper()
  1203. End Sub
  1204.  
  1205. Sub RightFlipper_Collide(parm)
  1206. RandomSoundFlipper()
  1207. End Sub
  1208.  
  1209. Sub RandomSoundFlipper()
  1210. Select Case Int(Rnd*3)+1
  1211. Case 1 : PlaySoundAtBall "flip_hit_1"
  1212. Case 2 : PlaySoundAtBall "flip_hit_2"
  1213. Case 3 : PlaySoundAtBall "flip_hit_3"
  1214. End Select
  1215. End Sub
  1216.  
  1217.  
  1218. '**********************************************************************************************************
  1219. ' Random Ramp Bumps by RustyCardores & DJRobX - Best used to compliment Rusty & Rob's Raised Ramp RollingBall Script
  1220. ' Switches added to ramps in key bend locations and called from these collections(idx).
  1221. '**********************************************************************************************************
  1222.  
  1223. Dim NextOrbitHit:NextOrbitHit = 0
  1224.  
  1225. Sub Orbit_Wall_Hit
  1226. if BallVel(ActiveBall) > .3 and Timer > NextOrbitHit then
  1227. RandomBump .001, -10000
  1228. ' Schedule the next possible sound time. This prevents it from rapid-firing noises too much.
  1229. ' Lowering these numbers allow more closely-spaced clunks.
  1230. NextOrbitHit = Timer + .03 + (Rnd * .2)
  1231. end if
  1232. End Sub
  1233.  
  1234. Sub PlasticRampbumps_Hit(idx)
  1235. RandomBump 1, Pitch(ActiveBall)
  1236. End Sub
  1237.  
  1238. Sub MetalRampbumps_Hit(idx)
  1239. RandomBump 1, 6000
  1240. End Sub
  1241.  
  1242. Sub RandomBump(voladj, freq)
  1243. dim BumpSnd:BumpSnd= "fx_rampbump" & CStr(Int(Rnd*7)+1)
  1244. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1245. PlaySound BumpSnd, 0, Vol(ActiveBall)*voladj, Pan(ActiveBall), 0, freq, 0, 1, AudioFade(ActiveBall)
  1246. Else
  1247. PlaySound BumpSnd, 0, Vol(ActiveBall)*voladj, Pan(ActiveBall), 0, freq, 0, 1
  1248. End If
  1249. End Sub
  1250.  
  1251. '****************************************
  1252.  
  1253. 'Sub LRRail_Hit:PlaySound "fx_metalrolling", 0, 150, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
  1254. '
  1255. 'Sub RLRail_Hit:PlaySound "fx_metalrolling", 0, 150, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
  1256.  
  1257. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1258. Vol = Csng(BallVel(ball) ^2 / 1)
  1259. End Function
  1260.  
  1261. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1262. Dim tmp
  1263. tmp = ball.x * 2 / table.width-1
  1264. If tmp > 0 Then
  1265. Pan = Csng(tmp ^10)
  1266. Else
  1267. Pan = Csng(-((- tmp) ^10) )
  1268. End If
  1269. End Function
  1270.  
  1271. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1272. Pitch = BallVel(ball) * 20
  1273. End Function
  1274.  
  1275. Function BallVel(ball) 'Calculates the ball speed
  1276. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1277. End Function
  1278.  
  1279. '*****************************************
  1280. ' JP's VP10 Rolling Sounds
  1281. '*****************************************
  1282.  
  1283. Const tnob = 6 ' total number of balls
  1284. ReDim rolling(tnob)
  1285. InitRolling
  1286.  
  1287. Sub InitRolling
  1288. Dim i
  1289. For i = 0 to tnob
  1290. rolling(i) = False
  1291. Next
  1292. End Sub
  1293.  
  1294. Sub RollingTimer_Timer()
  1295. Dim BOT, b
  1296. BOT = GetBalls
  1297.  
  1298. ' stop the sound of deleted balls
  1299. For b = UBound(BOT) + 1 to tnob
  1300. rolling(b) = False
  1301. StopSound("fx_ballrolling" & b)
  1302. Next
  1303.  
  1304. ' exit the sub if no balls on the table
  1305. If UBound(BOT) = -1 Then Exit Sub
  1306.  
  1307. ' play the rolling sound for each ball
  1308. For b = 0 to UBound(BOT)
  1309. If BallVel(BOT(b) ) > 1 AND BOT(b).z > 0 Then
  1310. rolling(b) = True
  1311. if BOT(b).z < 30 Then
  1312. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1313. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b) )*4 , Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0, AudioFade(BOT(b))
  1314. Else
  1315. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b) )*4 , Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1316. End If
  1317. Else ' ball in air, probably on plastic.
  1318. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1319. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b) )*2 , Pan(BOT(b) ), 0, Pitch(BOT(b) ) + 40000, 1, 0, AudioFade(BOT(b))
  1320. Else
  1321. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b) )*2 , Pan(BOT(b) ), 0, Pitch(BOT(b) ) + 40000, 1, 0
  1322. End If
  1323. End If
  1324. Else
  1325. If rolling(b) = True Then
  1326. StopSound("fx_ballrolling" & b)
  1327. rolling(b) = False
  1328. End If
  1329. End If
  1330. Next
  1331. End Sub
  1332.  
  1333. ''*****************************************
  1334. '' BALL SHADOW
  1335. ''*****************************************
  1336. Dim BallShadow
  1337. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5,BallShadow6)
  1338.  
  1339. Sub UpdateBallShadow()
  1340. Dim BOT, b
  1341. BOT = GetBalls
  1342. ' hide shadow of deleted balls
  1343. If UBound(BOT)<(tnob-1) Then
  1344. For b = (UBound(BOT) + 1) to (tnob-1)
  1345. BallShadow(b).visible = 0
  1346. Next
  1347. End If
  1348. ' exit the Sub if no balls on the table
  1349. If UBound(BOT) = -1 Then Exit Sub
  1350. ' render the shadow for each ball
  1351. For b = 0 to UBound(BOT)
  1352. If BOT(b).X < Table.Width/2 Then
  1353. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table.Width/2))/7)) + 13
  1354. Else
  1355. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table.Width/2))/7)) - 13
  1356. End If
  1357. ballShadow(b).Y = BOT(b).Y + 10
  1358. If BOT(b).Z > 20 Then
  1359. BallShadow(b).visible = 1
  1360. Else
  1361. BallShadow(b).visible = 0
  1362. End If
  1363. Next
  1364. End Sub
  1365.  
  1366. '**********************
  1367. ' Ball Collision Sound
  1368. '**********************
  1369.  
  1370. Sub OnBallBallCollision(ball1, ball2, velocity)
  1371. dim mball
  1372. for each mball in mDMag.Balls
  1373. if mball.ID = ball1.ID OR mball.ID = ball2.ID then exit sub
  1374. next
  1375. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1376. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 80, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  1377. else
  1378. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 80, Pan(ball1), 0, Pitch(ball1), 0, 0
  1379. end if
  1380. End Sub
  1381.  
  1382.  
  1383. ' Dummys used for positionals so timers could be added to balldrops
  1384. Sub BallDropSoundLeft(dummy):PlaySound "balldrop",0,1,-.4,0,0,0,0,.8:End Sub
  1385. Sub BallDropSoundRight(dummy):PlaySound "balldrop",0,1,.4,0,0,0,0,.8:End Sub
  1386.  
  1387. Sub leftdrop_Hit()
  1388. vpmTimer.AddTimer 150, "BallDropSoundLeft"
  1389. End Sub
  1390.  
  1391. Sub IceRampEnd1_Hit:IceManHold = IceManHold - 1:StopSound "fx_ramp_metal":End Sub
  1392. Sub IceRampEnd2_Hit:IceManHold = IceManHold - 1:vpmTimer.AddTimer 150, "BallDropSoundRight":StopSound "fx_ramp_metal":End Sub
  1393.  
  1394.  
  1395. Sub RLS_Timer()
  1396. RampGate3.RotZ = -(Spinner2.currentangle)
  1397. RampGate1.RotZ = -(Spinner1.currentangle)
  1398. RampGate4.RotZ = -(Spinner4.currentangle)
  1399. RampGate2.RotZ = -(Spinner3.currentangle)
  1400. ' SpinnerT1.RotZ = -(sw9.currentangle)
  1401. SpinnerT2.RotZ = -(sw47.currentangle)
  1402. ' ampprim.objrotx = ampf.currentangle
  1403. End Sub
  1404.  
  1405. 'Sub PrimT_Timer
  1406. ' If Wall455.isdropped = true then ampf.rotatetoend:end if
  1407. ' if Wall455.isdropped = false then ampf.rotatetostart:end if
  1408. ' ampprim.objrotx = ampf.currentangle
  1409. 'End Sub
  1410.  
  1411. Sub uppostt_Timer
  1412. If lockpin1.isdropped = true then uppostf.rotatetoend
  1413. if lockpin1.isdropped = false then uppostf.rotatetostart
  1414. uppostp.transy = uppostf.currentangle
  1415. End Sub
  1416.  
  1417. dim vengeanceBall,zz
  1418. set vengeanceBall = kicker1.createball
  1419. kicker1.kick 0,0
  1420. Dim Mag1
  1421. Set mag1= New cvpmMagnet
  1422. With mag1
  1423. .InitMagnet vengeanceTrigger, 25
  1424. .GrabCenter = False
  1425. .magnetOn = True
  1426. End With
  1427.  
  1428. Sub VengeanceHit (Vmove)
  1429. dim yy
  1430. vengeanceBall.vely = Vmove / 2
  1431. yy = (rnd(1) - 0.5) * Vmove
  1432. vengeanceBall.velx = yy
  1433. VengeanceTimer.Enabled = 1:zz=0
  1434. 'Playsound "solenoidon"
  1435. End Sub
  1436.  
  1437.  
  1438. Sub VengeanceTimer_Timer
  1439. wolverine.roty = (vengeanceBall.x - vengeanceTrigger.x) * 2
  1440. 'wolverine.transY = (vengeanceBall.y - vengeanceTrigger.y) '* 2
  1441. zz = zz + 1
  1442. if zz = 100 then VengeanceTimer.Enabled = 0
  1443. End Sub
  1444.  
  1445. Sub PrimT_Timer
  1446. if f9.State = 1 then f9a.visible = 1 else f9a.visible = 0
  1447. if f10.State = 1 then f10a.visible = 1 else f10a.visible = 0
  1448. if f11.State = 1 then f11a.visible = 1 else f11a.visible = 0
  1449. if l28a.State = 1 then f28a.visible = 1 else f28a.visible = 0
  1450. if l28a.State = 1 then f28b.visible = 1 else f28b.visible = 0
  1451. if l28a.State = 1 then f28c.visible = 1 else f28c.visible = 0
  1452. if l29a.State = 1 then f29a.visible = 1 else f29a.visible = 0
  1453. if l29a.State = 1 then f29b.visible = 1 else f29b.visible = 0
  1454. if l29a.State = 1 then f29c.visible = 1 else f29c.visible = 0
  1455. End Sub
  1456.  
  1457. function AudioFade(ball)
  1458. Dim tmp
  1459. tmp = ball.y * 2 / Table.height-1
  1460. If tmp > 0 Then
  1461. AudioFade = Csng(tmp ^10)
  1462. Else
  1463. AudioFade = Csng(-((- tmp) ^10) )
  1464. End If
  1465. End Function
  1466.  
  1467. Sub PlaySoundAtVol(sound, tableobj, Vol)
  1468. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1469. PlaySound sound, 1, Vol, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1470. Else
  1471. PlaySound sound, 1, Vol, Pan(tableobj)
  1472. End If
  1473. End Sub
  1474.  
  1475. Sub PlaySoundAtBallVol(sound, VolMult)
  1476. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1477. PlaySound sound, 0, Vol(ActiveBall) * VolMult, Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  1478. Else
  1479. PlaySound sound, 0, Vol(ActiveBall) * VolMult, Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1
  1480. End If
  1481. End Sub
  1482.  
  1483. Sub PlaySoundAt(sound, tableobj)
  1484. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1485. PlaySound sound, 1, 1, Pan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1486. Else
  1487. PlaySound sound, 1, 1, Pan(tableobj)
  1488. End If
  1489. End Sub
  1490.  
  1491. Sub PlaySoundAtBall(sound)
  1492. If Table.VersionMinor > 3 OR Table.VersionMajor > 10 Then
  1493. PlaySound sound, 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  1494. Else
  1495. PlaySound sound, 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 1
  1496. End If
  1497. End Sub
  1498.  
  1499. Sub BallRelease_Hit()
  1500.  
  1501. End Sub
RAW Paste Data