Arngrim

space shuttle

Nov 11th, 2016
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.49 KB | None | 0 0
  1. '*********************************************************************************************************************
  2. 'SPACE SHUTTLE
  3. 'Williams 1984
  4. 'version 1.0
  5. 'VPX SS recreation by pinball58
  6. '3D ramp,shuttle toy texture modifications and ambient light tuning by Tom Tower
  7. 'Thanks to Sepeteus for the shuttle toy borrowed from his FP table
  8. '*********************************************************************************************************************
  9.  
  10. Option Explicit
  11. Randomize
  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. Dim bsTrough,bsLeftHole,bsRightHole,dtBank,dtDrop,ShuttleLightMod,FallingAstronautMod,Astronaut,TDT,HiddenValue,CabinetMode
  19.  
  20. LoadVPM "01560000", "S11.vbs", 3.36
  21.  
  22. '*********************************************** TABLE OPTIONS *******************************************************
  23. '---------------------------------------------------------------------------------------------------------------------
  24. '*********************************************************************************************************************
  25.  
  26.  
  27. ShuttleLightMod = 1 '1 = enables the light inside the Shuttle 0 = disabled
  28.  
  29. FallingAstronautMod = 1 '1 = enables astronaut's spin when the ball falls in the outlanes 0 = disabled
  30.  
  31. CabinetMode = 1 '1 = hides pinball's side and rails in cabinet mode 0 = visibles
  32.  
  33.  
  34. '*********************************************************************************************************************
  35. '---------------------------------------------------------------------------------------------------------------------
  36. '*********************************************************************************************************************
  37.  
  38. '*********** Desktop/Cabinet settings ************************
  39.  
  40. If SpaceShuttle.ShowDT = true Then
  41. HiddenValue = 0
  42. Else
  43. HiddenValue = 1
  44. If CabinetMode = 1 Then
  45. Ramp16.visible=0:Ramp15.visible=0:Primitive52.visible=0:Primitive12.visible=0
  46. Primitive87.visible=0:Primitive89.visible=0:Primitive88.visible=0:Primitive90.visible=0
  47. End If
  48. End If
  49.  
  50. '*************************************************************
  51.  
  52. '*********** Standard definitions ****************
  53.  
  54. Const UseSolenoids = 1
  55. Const UseLamps = 0
  56. Const UseSync = 0
  57. Const HandleMech = 0
  58.  
  59. 'Standard Sounds
  60. Const SSolenoidOn = "solenoid"
  61. Const SSolenoidOff = ""
  62. Const SFlipperOn = ""
  63. Const SFlipperOff = ""
  64. Const SCoin = "CoinIn"
  65.  
  66. Const cGameName = "sshtl_l7"
  67.  
  68. '*************************************************
  69.  
  70. '************ Space Shuttle Init *****************
  71.  
  72. Sub SpaceShuttle_Init
  73. vpmInit me
  74. With Controller
  75. .GameName = cGameName
  76. .SplashInfoLine = "Space Shuttle - Williams 1984"
  77. .HandleKeyboard = 0
  78. .ShowTitle = 0
  79. .ShowDMDOnly = 1
  80. .ShowFrame = 0
  81. .HandleMechanics = 0
  82. .Hidden = HiddenValue
  83. On Error Resume Next
  84. .Run GetPlayerHWnd
  85. If Err Then MsgBox Err.Description
  86. On Error Goto 0
  87. SolGI(0)
  88. Wall119.IsDropped=true : Wall118.IsDropped=false : CPwall.IsDropped=true
  89. Astronaut=0
  90. End With
  91.  
  92. 'Nudging
  93. vpmNudge.TiltSwitch = swTilt
  94. vpmNudge.Sensitivity = 3
  95. vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingShot, RightSlingShot)
  96.  
  97. 'Trough
  98. Set bsTrough=New cvpmBallStack
  99. With bsTrough
  100. .InitSw 9,12,11,10,0,0,0,0
  101. .InitKick BallRelease,85,7
  102. .InitExitSnd SoundFX("ballrelease",DOFContactors),SoundFX("",DOFContactors)
  103. .Balls=3
  104. End With
  105.  
  106. 'Left Kicker
  107. Set bsLeftHole=New cvpmBallStack
  108. With bsLeftHole
  109. .InitSaucer sw16,16,190,8
  110. .InitExitSnd SoundFX("",DOFContactors),SoundFX("",DOFContactors)
  111. End With
  112.  
  113. 'Right Kicker
  114. Set bsRightHole=New cvpmBallStack
  115. With bsRightHole
  116. .InitSaucer sw24,24,170,8
  117. .InitExitSnd SoundFX("",DOFContactors),SoundFX("",DOFContactors)
  118. End With
  119.  
  120. '3 Bank Target
  121. Set dtbank = new cvpmdroptarget
  122. With dtbank
  123. .initdrop array(sw33, sw34, sw35), array(33, 34, 35)
  124. .initsnd SoundFX("droptarget",DOFContactors),SoundFX("resetdrop",DOFContactors)
  125. .CreateEvents "dtbank"
  126. End With
  127.  
  128. End Sub
  129.  
  130. '*************************************************
  131.  
  132. '********* Solenoids ************
  133.  
  134. SolCallback(1) = "bsTrough.SolIn" 'Outhole
  135. SolCallback(2) = "bsTrough.SolOut" 'BallRelease
  136. SolCallback(3) = "bsLeftHole.SolOut" 'Left Kicker
  137. SolCallback(4) = "bsRightHole.SolOut" 'Right Kicker
  138. SolCallback(5) = "TdtUP" 'T Drop Target
  139.  
  140. Sub TdtUP(enabled)
  141. If enabled Then
  142. Controller.Switch(20)=0
  143. PlaySound SoundFX("resetdrop",DOFContactors)
  144. sw20t.IsDropped=false
  145. TDT=0
  146. updateTDT.enabled=1
  147. End If
  148. End Sub
  149.  
  150. SolCallback(6) = "dtbank.SolDropUp" '3 Bank Target
  151. SolCallback(7) = "UPpost" 'Up Post
  152. SolCallback(8) = "DOWNpost" 'Down Post
  153. SolCallback(9) = "Space" 'Shuttle Flash Lamp
  154. SolCallback(10) = "Shuttle" 'Space Flash Lamp
  155.  
  156. Sub Space(enabled)
  157. If enabled Then
  158. FlashSP.visible=1:FlashSP1.visible=1:FlashSP2.visible=1:Light76.state=1:Light77.state=1:Light78.state=1:Light93.state=1:l1.state=1
  159. If ShuttleLightMod=1 Then
  160. ShuttleLightON
  161. End If
  162. Else
  163. FlashSP.visible=0:FlashSP1.visible=0:FlashSP2.visible=0:Light76.state=0:Light77.state=0:Light78.state=0:Light93.state=0:l1.state=0
  164. If ShuttleLightMod=1 Then
  165. ShuttleLightOFF
  166. End If
  167. End If
  168. End Sub
  169.  
  170. Sub Shuttle(enabled)
  171. If enabled Then
  172. FlashSH.visible=1:FlashSH1.visible=1:FlashSH2.visible=1:Light79.state=1:Light80.state=1:Light81.state=1:Light94.state=1:l2.state=1
  173. Else
  174. FlashSH.visible=0:FlashSH1.visible=0:FlashSH2.visible=0:Light79.state=0:Light80.state=0:Light81.state=0:Light94.state=0:l2.state=0
  175. End If
  176. End Sub
  177.  
  178. SolCallback(11) = "SolGI"
  179.  
  180. Sub SolGI(enabled)
  181. If enabled Then
  182. For each lights in GI:lights.state=0:Next
  183. For each lights in GI2:lights.state=0:Next
  184. SpaceShuttle.ColorGradeImage="ColorGradeDark"
  185. usal.visible=0:usal1.visible=0:usal2.visible=0:usal3.visible=0
  186. Primitive105.image="p1_text":Primitive97.image="p2_text"
  187. Else
  188. For each lights in GI:lights.state=1:Next
  189. For each lights in GI2:lights.state=1:Next
  190. SpaceShuttle.ColorGradeImage="ColorGradeBright"
  191. usal.visible=1:usal1.visible=1:usal2.visible=1:usal3.visible=1
  192. Primitive105.image="p1_textON":Primitive97.image="p2_textON"
  193. End If
  194. End Sub
  195.  
  196. 'SolCallback(12) = "" Not Used
  197. SolCallback(13) = "RLdiv" 'Diverter Gate
  198. 'SolCallback(14) = "" Insert Flash Lamp
  199. SolCallback(15) = "RingingBell" 'Bell
  200.  
  201. Sub RingingBell(enabled)
  202. If enabled Then
  203. PlaySound "ringing_bell"
  204. Else
  205. StopSound "ringing_bell"
  206. End If
  207. End Sub
  208.  
  209. 'SolCallback(16) = "" Coin LockOut
  210. 'SolCallback(17) = "" Left SlingShot
  211. 'SolCallback(18) = "" Right SlingShot
  212. 'SolCallback(19) = "" Left Jet Bumper
  213. 'SolCallback(20) = "" Bottom Jet Bumper
  214. 'SolCallback(21) = "" Right Jet Bumper
  215. 'SolCallback(22) = "" Not Used
  216.  
  217. Sub RLdiv(enabled)
  218. If enabled Then
  219. Primitive11.RotY=7 : Wall119.IsDropped=false : Wall118.IsDropped=true
  220. PlaySound SoundFX("barrier_click",DOFContactors)
  221. Else
  222. Primitive11.RotY=52 : Wall119.IsDropped=true : Wall118.IsDropped=false
  223. PlaySound SoundFX("barrier_click",DOFContactors)
  224. End If
  225. End Sub
  226.  
  227. Sub UPpost(enabled)
  228. If CenterPost.TransZ=0 Then PlaySound SoundFX("centerpost",DOFContactors) End If
  229. If enabled Then
  230. CPwall.IsDropped=false : CenterPost.TransZ=25
  231. End If
  232. End Sub
  233.  
  234. Sub DOWNpost(enabled)
  235. If CenterPost.TransZ=25 Then PlaySound SoundFX("centerpost",DOFContactors) End If
  236. If enabled Then
  237. CPwall.IsDropped=true : CenterPost.TransZ=0
  238. End If
  239. End Sub
  240.  
  241. 'Drain
  242. Sub Drain_Hit():Playsound "drain":bsTrough.AddBall Me:End Sub
  243.  
  244. '********************************
  245.  
  246. '********* Flippers *************
  247.  
  248. SolCallback(sLLFlipper) = "SolLFlipper"
  249. SolCallback(sLRFlipper) = "SolRFlipper"
  250.  
  251. Sub SolLFlipper(Enabled)
  252. If Enabled Then
  253. PlaySound SoundFX("FlipperUp",DOFFlippers),1,1,-0.1,0.05
  254. LeftFlipper.RotateToEnd
  255. Else
  256. PlaySound SoundFX("FlipperDown",DOFFlippers),1,0.4,-0.1,0.05
  257. LeftFlipper.RotateToStart
  258. End If
  259. End Sub
  260.  
  261. Sub SolRFlipper(Enabled)
  262. If enabled Then
  263. PlaySound SoundFX("FlipperUp",DOFFlippers),1,1,0.1,0.05
  264. RightFlipper.RotateToEnd
  265. Else
  266. PlaySound SoundFX("FlipperDown",DOFFlippers),1,0.4,0.1,0.05
  267. RightFlipper.RotateToStart
  268. End If
  269. End Sub
  270.  
  271. '*******************************
  272.  
  273. '************** Keys *************************
  274.  
  275. Sub SpaceShuttle_KeyDown(ByVal keycode)
  276. If keycode = PlungerKey Then
  277. Plunger.PullBack
  278. PlaySound "plungerpull",0,1,0.25,0.25
  279. End If
  280. If keycode = LeftTiltKey Then PlaySound SoundFX("fx_nudge",0)
  281. If keycode = RightTiltKey Then PlaySound SoundFX("fx_nudge",0)
  282. If keycode = CenterTiltKey Then PlaySound SoundFX("fx_nudge",0)
  283. If vpmKeyDown(keycode) Then Exit Sub
  284.  
  285. End Sub
  286.  
  287. Sub SpaceShuttle_KeyUp(ByVal keycode)
  288. If keycode = PlungerKey Then
  289. Plunger.Fire
  290. PlaySound "plunger",0,1,0.25,0.25
  291. End If
  292. If vpmKeyUp(keycode) Then Exit Sub
  293. End Sub
  294.  
  295. '*********************************************
  296.  
  297. '********** Switches ***********
  298.  
  299. Sub sw29_Hit():VPMTimer.PulseSw 29:End Sub 'U Lane
  300. Sub sw30_Hit():VPMTimer.PulseSw 30:End Sub 'S Lane
  301. Sub sw31_Hit():VPMTimer.PulseSw 31:End Sub 'A Lane
  302. Sub sw16_Hit():PlaySound "kicker_enter_center": bsLeftHole.Addball me:Controller.Switch(16) = 1:End Sub 'Left Kicker
  303. Sub sw24_Hit():PlaySound "kicker_enter_center": bsRightHole.Addball me:Controller.Switch(24) = 1:End Sub 'Right Kicker
  304. Sub sw45_Hit():VPMTimer.PulseSw 45:End Sub 'Center Ramp Lower Switch
  305. Sub sw32_Hit():VPMTimer.PulseSw 32:End Sub 'Center Ramp Upper Switch
  306. Sub LeftOutLane_Hit():VPMTimer.PulseSw 28:If FallingAstronautMod=1 And Astronaut=0 Then:RotateAstronaut:End If:End Sub 'Left OutLane
  307. Sub LeftInLane_Hit():VPMTimer.PulseSw 14:End Sub 'Left InLane
  308. Sub RightInLane_Hit():VPMTimer.PulseSw 15:End Sub 'Right InLane
  309. Sub RightOutLane_Hit():VPMTimer.PulseSw 13:If FallingAstronautMod=1 And Astronaut=0 And Wall118.IsDropped=true Then:RotateAstronaut:End If:End Sub 'Right OutLane
  310. Sub sw37_Spin():VPMTimer.PulseSw 37:End Sub 'Spinner
  311. Sub sw38_Hit():VPMTimer.PulseSw 38:PlaySound SoundFX("target",DOFTargets),1,0.5:End Sub 'Ramp Target
  312. Sub sw36_Hit():Controller.Switch(36)=1:End Sub 'Plunger Switch
  313. Sub sw36_unHit():Controller.Switch(36)=0:End Sub 'Plunger Switch
  314. Sub sw17_Hit():VPMTimer.PulseSw 17:PlaySound SoundFX("target",DOFTargets),1,0.5:End Sub 'S Target
  315. Sub sw18_Hit():VPMTimer.PulseSw 18:PlaySound SoundFX("target",DOFTargets),1,0.5:End Sub 'H Target
  316. Sub sw19_Hit():VPMTimer.PulseSw 19:PlaySound SoundFX("target",DOFTargets),1,0.5:End Sub 'U Target
  317. Sub sw20_Hit():Controller.Switch(20)=1:PlaySound "target",1,0.5:PlaySound SoundFX("droptarget",DOFDropTargets):sw20t.IsDropped=true:TDT=1:updateTDT.enabled=1:End Sub 'T Drop Target
  318. Sub sw21_Hit():VPMTimer.PulseSw 21:PlaySound SoundFX("target",DOFTargets),1,0.5:End Sub 'T Target
  319. Sub sw22_Hit():VPMTimer.PulseSw 22:PlaySound SoundFX("target",DOFTargets),1,0.5:End Sub 'L Target
  320. Sub sw23_Hit():VPMTimer.PulseSw 23:PlaySound SoundFX("target",DOFTargets),1,0.5:End Sub 'E Target
  321.  
  322. '*******************************
  323.  
  324. '********** Slingshots ***************
  325.  
  326. Dim Lstep,RStep
  327.  
  328. Sub LeftSlingShot_Slingshot
  329. VPMTimer.PulseSw 39
  330. PlaySound SoundFX("LSling",DOFContactors),0,1,-0.05,0.05
  331. LSling.Visible = 0
  332. LSling1.Visible = 1
  333. sling2.TransZ = -25
  334. LStep = 0
  335. LeftSlingShot.TimerEnabled = 1
  336. End Sub
  337.  
  338. Sub LeftSlingShot_Timer
  339. Select Case LStep
  340. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  341. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  342. End Select
  343. LStep = LStep + 1
  344.  
  345. End Sub
  346.  
  347. Sub RightSlingShot_Slingshot
  348. VPMTimer.PulseSw 40
  349. PlaySound SoundFX("RSling",DOFContactors), 0, 1, 0.05, 0.05
  350. RSling.Visible = 0
  351. RSling1.Visible = 1
  352. sling1.TransZ = -25
  353. RStep = 0
  354. RightSlingShot.TimerEnabled = 1
  355. End Sub
  356.  
  357. Sub RightSlingShot_Timer
  358. Select Case RStep
  359. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  360. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  361. End Select
  362. RStep = RStep + 1
  363. End Sub
  364.  
  365. '*******************************************
  366.  
  367. '********** Bumpers **********************************************
  368.  
  369. Dim dirRing : dirRing = -1
  370. Dim dirRing2 : dirRing2 = -1
  371. Dim dirRing3 : dirRing3 = -1
  372.  
  373. Sub Bumper1_Hit
  374. VPMTimer.PulseSw 25
  375. Me.TimerEnabled = 1
  376. Dim BumpSound
  377. BumpSound = Int(rnd*4)+1
  378. Select Case BumpSound
  379. Case 1: PlaySound SoundFX("fx_bumper1",DOFContactors)
  380. Case 2: PlaySound SoundFX("fx_bumper2",DOFContactors)
  381. Case 3: PlaySound SoundFX("fx_bumper3",DOFContactors)
  382. Case 4: PlaySound SoundFX("fx_bumper4",DOFContactors)
  383. End Select
  384. End Sub
  385.  
  386. Sub Bumper1_timer()
  387. 'If Tilt = false Then
  388. BumperRing1.Z = BumperRing1.Z + (5 * dirRing)
  389. If BumperRing1.Z <= 0 Then dirRing = 1
  390. If BumperRing1.Z >= 40 Then
  391. dirRing = -1
  392. BumperRing1.Z = 40
  393. Me.TimerEnabled = 0
  394. End If
  395. 'End If
  396. End Sub
  397.  
  398. Sub Bumper2_Hit
  399. VPMTimer.PulseSw 26
  400. Me.TimerEnabled = 1
  401. Dim BumpSound
  402. BumpSound = Int(rnd*4)+1
  403. Select Case BumpSound
  404. Case 1: PlaySound SoundFX("fx_bumper1",DOFContactors)
  405. Case 2: PlaySound SoundFX("fx_bumper2",DOFContactors)
  406. Case 3: PlaySound SoundFX("fx_bumper3",DOFContactors)
  407. Case 4: PlaySound SoundFX("fx_bumper4",DOFContactors)
  408. End Select
  409. End Sub
  410.  
  411. Sub Bumper2_timer()
  412. BumperRing2.Z = BumperRing2.Z + (5 * dirRing2)
  413. If BumperRing2.Z <= 0 Then dirRing2 = 1
  414. If BumperRing2.Z >= 40 Then
  415. dirRing2 = -1
  416. BumperRing2.Z = 40
  417. Me.TimerEnabled = 0
  418. End If
  419. End Sub
  420.  
  421. Sub Bumper3_Hit
  422. VPMTimer.PulseSw 27
  423. Me.TimerEnabled = 1
  424. Dim BumpSound
  425. BumpSound = Int(rnd*4)+1
  426. Select Case BumpSound
  427. Case 1: PlaySound SoundFX("fx_bumper1",DOFContactors)
  428. Case 2: PlaySound SoundFX("fx_bumper2",DOFContactors)
  429. Case 3: PlaySound SoundFX("fx_bumper3",DOFContactors)
  430. Case 4: PlaySound SoundFX("fx_bumper4",DOFContactors)
  431. End Select
  432. End Sub
  433.  
  434. Sub Bumper3_timer()
  435. BumperRing3.Z = BumperRing3.Z + (5 * dirRing3)
  436. If BumperRing3.Z <= 0 Then dirRing3 = 1
  437. If BumperRing3.Z >= 40 Then
  438. dirRing3 = -1
  439. BumperRing3.Z = 40
  440. Me.TimerEnabled = 0
  441. End If
  442. End Sub
  443.  
  444. '***************************************************************
  445.  
  446. '*********** Standup Switches ****************
  447.  
  448. Sub Wall122_Hit
  449. VPMTimer.PulseSw 42
  450. PlaySound SoundFX("target",DOFTargets), 1,0.3
  451. PlaySound "rubber_hit_3"
  452. Rubber2.visible=0
  453. Rubber19.visible=1
  454. RubberTimer.enabled=1
  455. End Sub
  456.  
  457. Sub RubberTimer_timer()
  458. Rubber2.visible=1
  459. Rubber19.visible=0
  460. RubberTimer.enabled=0
  461. End Sub
  462.  
  463. Sub Wall123_Hit
  464. VPMTimer.PulseSw 43
  465. PlaySound SoundFX("target",DOFTargets), 1,0.3
  466. PlaySound "rubber_hit_3"
  467. Rubber17.visible=0
  468. Rubber20.visible=1
  469. RubberTimer1.enabled=1
  470. End Sub
  471.  
  472. Sub RubberTimer1_timer()
  473. Rubber17.visible=1
  474. Rubber20.visible=0
  475. RubberTimer1.enabled=0
  476. End Sub
  477.  
  478. Sub Wall124_Hit
  479. VPMTimer.PulseSw 44
  480. PlaySound SoundFX("target",DOFTargets), 1,0.3
  481. PlaySound "rubber_hit_3"
  482. Rubber16.visible=0
  483. Rubber21.visible=1
  484. RubberTimer2.enabled=1
  485. End Sub
  486.  
  487. Sub RubberTimer2_timer()
  488. Rubber16.visible=1
  489. Rubber21.visible=0
  490. RubberTimer2.enabled=0
  491. End Sub
  492.  
  493. Sub Wall125_Hit
  494. VPMTimer.PulseSw 46
  495. PlaySound SoundFX("target",DOFTargets), 1,0.3
  496. PlaySound "rubber_hit_3"
  497. Rubber5.visible=0
  498. Rubber23.visible=1
  499. RubberTimer3.enabled=1
  500. End Sub
  501.  
  502. Sub RubberTimer3_timer()
  503. Rubber5.visible=1
  504. Rubber23.visible=0
  505. RubberTimer3.enabled=0
  506. End Sub
  507.  
  508. Sub Wall126_Hit
  509. VPMTimer.PulseSw 47
  510. PlaySound SoundFX("target",DOFTargets), 1,0.3
  511. PlaySound "rubber_hit_3"
  512. Rubber4.visible=0
  513. Rubber22.visible=1
  514. RubberTimer4.enabled=1
  515. End Sub
  516.  
  517. Sub RubberTimer4_timer()
  518. Rubber4.visible=1
  519. Rubber22.visible=0
  520. RubberTimer4.enabled=0
  521. End Sub
  522.  
  523. Sub Wall127_Hit
  524. VPMTimer.PulseSw 48
  525. PlaySound SoundFX("target",DOFTargets), 1,0.3
  526. PlaySound "rubber_hit_3"
  527. Rubber1.visible=0
  528. Rubber24.visible=1
  529. RubberTimer5.enabled=1
  530. End Sub
  531.  
  532. Sub RubberTimer5_timer()
  533. Rubber1.visible=1
  534. Rubber24.visible=0
  535. RubberTimer5.enabled=0
  536. End Sub
  537.  
  538. '************************************
  539.  
  540. '********************** InGame Updates ***************************
  541.  
  542. Sub UpdateWG_timer()
  543. GWL.RotZ=Gate.CurrentAngle
  544. s_wiregate.RotX=sw32.CurrentAngle-180
  545. Primitive50.RotY=Primitive96.RotY
  546. End Sub
  547.  
  548. Sub updateTDT_timer()
  549. If TDT=0 Then
  550. sw20bw.ISDropped=false
  551. sw20.IsDropped=false
  552. End If
  553. If TDT=1 Then
  554. sw20bw.ISDropped=true
  555. sw20.IsDropped=true
  556. End If
  557. updateTDT.enabled=0
  558. End Sub
  559.  
  560. '*****************************************************************
  561.  
  562. '*********** Shuttle Light Mod ************
  563.  
  564. Sub ShuttleLightON:shuttleprim.image="shuttle_textmapON":shuttlelight.state=1:End Sub
  565. Sub ShuttleLightOFF::shuttleprim.image="shuttle_textmap":shuttlelight.state=0:End Sub
  566.  
  567. '******************************************
  568.  
  569. '*********** Falling Astronaut Mod ************************
  570.  
  571. Dim RotVel
  572.  
  573. Sub RotateAstronaut()
  574. RotateAstronautTimer.Enabled = 1
  575. RotVel=12
  576. Astronaut=1
  577. End Sub
  578.  
  579. Sub RotateAstronautTimer_Timer()
  580. Primitive96.RotY =Primitive96.RotY + RotVel
  581. If Primitive96.RotY >= 3*360 Then RotVel = RotVel - 0.1
  582. If RotVel <= 0 Then RotateAstronautTimer.Enabled = 0 : Primitive96.RotY = Primitive96.RotY : Astronaut=0
  583. End Sub
  584.  
  585. '*******************************************************
  586.  
  587. '***************************************************
  588. ' JP's VP10 Fading Lamps & Flashers
  589. ' Based on PD's Fading Light System
  590. ' SetLamp 0 is Off
  591. ' SetLamp 1 is On
  592. ' fading for non opacity objects is 4 steps
  593. '***************************************************
  594.  
  595. Dim LampState(200), FadingLevel(200)
  596. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  597.  
  598. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  599. LampTimer.Interval = 5 'lamp fading speed
  600. LampTimer.Enabled = 1
  601.  
  602. ' Lamp & Flasher Timers
  603.  
  604. Sub LampTimer_Timer()
  605. Dim chgLamp, num, chg, ii
  606. chgLamp = Controller.ChangedLamps
  607. If Not IsEmpty(chgLamp) Then
  608. For ii = 0 To UBound(chgLamp)
  609. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  610. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  611. Next
  612. End If
  613. UpdateLamps
  614. End Sub
  615.  
  616. Sub UpdateLamps
  617. 'NFadeL 1, l1
  618. 'NFadeL 2, l2
  619. 'NFadeL 3, l3
  620. 'NFadeL 4, l4
  621. 'NFadeL 5, l5
  622. 'NFadeL 6, l6
  623. NFadeLm 7, l7:CPL
  624. FadeObj 7, CenterPost, "Centerpost4", "Centerpost3", "Centerpost2", "Centerpost"
  625. NFadeL 8, l8
  626. NFadeL 9, l9
  627. NFadeL 10, l10
  628. NFadeL 11, l11
  629. NFadeL 12, l12
  630. NFadeL 13, l13
  631. NFadeL 14, l14
  632. NFadeLm 15, l15
  633. NFadeL 15, l15a
  634. NFadeL 16, l16
  635. NFadeL 17, l17
  636. NFadeL 18, l18
  637. NFadeL 19, l19
  638. NFadeL 20, l20
  639. NFadeL 21, l21
  640. NFadeL 22, l22
  641. NFadeL 23, l23
  642. NFadeL 24, l24
  643. NFadeLm 25, l25:BCL1
  644. NFadeLm 25, l25a
  645. FadeObj 25, Bumpercap1, "bumpercap4", "bumpercap3", "bumpercap2", "bumpercap"
  646. NFadeLm 26, l26:BCL2
  647. NFadeLm 26, l26a
  648. FadeObj 26, Bumpercap2, "bumpercap4", "bumpercap3", "bumpercap2", "bumpercap"
  649. NFadeLm 27, l27:BCL3
  650. NFadeLm 27, l27a
  651. FadeObj 27, Bumpercap3, "bumpercap4", "bumpercap3", "bumpercap2", "bumpercap"
  652. NFadeL 28, l28
  653. NFadeL 29, l29
  654. NFadeL 30, l30
  655. NFadeL 31, l31
  656. NFadeL 32, l32
  657. NFadeL 33, l33
  658. NFadeL 34, l34
  659. NFadeL 35, l35
  660. NFadeL 36, l36
  661. NFadeL 37, l37
  662. 'NFadeL 38, l38
  663. 'NFadeL 39, l39
  664. 'NFadeL 40, l40
  665. NFadeLm 41, l41
  666. NFadeL 41, l41a
  667. NFadeL 42, l42
  668. NFadeL 43, l43
  669. NFadeL 44, l44
  670. NFadeL 45, l45
  671. NFadeL 46, l46
  672. NFadeL 47, l47
  673. NFadeL 48, l48
  674. NFadeL 49, l49
  675. NFadeL 50, l50
  676. NFadeL 51, l51
  677. NFadeL 52, l52
  678. NFadeL 53, l53
  679. NFadeL 54, l54
  680. NFadeL 55, l55
  681. NFadeL 56, l56
  682. NFadeL 57, l57
  683. NFadeL 58, l58
  684. NFadeL 59, l59
  685. NFadeL 60, l60
  686. NFadeL 61, l61
  687. NFadeL 62, l62
  688. NFadeL 63, l63
  689. NFadeL 64, l64
  690.  
  691. 'Solenoid Controlled lamps
  692.  
  693. End Sub
  694.  
  695. 'Center Post illumination
  696. Sub CPL()
  697. If l7.state=1 Then
  698. CPLight.visible=1
  699. Else
  700. CPLight.visible=0
  701. End If
  702. CPLight.Height=CenterPost.TransZ+1
  703. End Sub
  704.  
  705. 'Bumpers illumination
  706. Sub BCL1()
  707. If l25.state=1 Then
  708. bclight1.visible=1:bclight1a.visible=1
  709. Else
  710. bclight1.visible=0:bclight1a.visible=0
  711. End If
  712. End Sub
  713.  
  714. Sub BCL2()
  715. If l26.state=1 Then
  716. bclight2.visible=1:bclight2a.visible=1
  717. Else
  718. bclight2.visible=0:bclight2a.visible=0
  719. End If
  720. End Sub
  721.  
  722. Sub BCL3()
  723. If l27.state=1 Then
  724. bclight3.visible=1:bclight3a.visible=1
  725. Else
  726. bclight3.visible=0:bclight3a.visible=0
  727. End If
  728. End Sub
  729.  
  730. ' div lamp subs
  731.  
  732. Sub InitLamps()
  733. Dim x
  734. For x = 0 to 200
  735. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  736. FadingLevel(x) = 4 ' used to track the fading state
  737. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  738. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  739. FlashMax(x) = 1 ' the maximum value when on, usually 1
  740. FlashMin(x) = 0 ' the minimum value when off, usually 0
  741. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  742. Next
  743. End Sub
  744.  
  745. Sub AllLampsOff
  746. Dim x
  747. For x = 0 to 200
  748. SetLamp x, 0
  749. Next
  750. End Sub
  751.  
  752. Sub SetLamp(nr, value)
  753. If value <> LampState(nr) Then
  754. LampState(nr) = abs(value)
  755. FadingLevel(nr) = abs(value) + 4
  756. End If
  757. End Sub
  758.  
  759. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  760.  
  761. Sub NFadeL(nr, object)
  762. Select Case FadingLevel(nr)
  763. Case 4:object.state = 0:FadingLevel(nr) = 0
  764. Case 5:object.state = 1:FadingLevel(nr) = 1
  765. End Select
  766. End Sub
  767.  
  768. Sub NFadeLm(nr, object) ' used for multiple lights
  769. Select Case FadingLevel(nr)
  770. Case 4:object.state = 0
  771. Case 5:object.state = 1
  772. End Select
  773. End Sub
  774.  
  775. 'Lights, Ramps & Primitives used as 4 step fading lights
  776. 'a,b,c,d are the images used from on to off
  777.  
  778. Sub FadeObj(nr, object, a, b, c, d)
  779. Select Case FadingLevel(nr)
  780. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  781. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  782. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  783. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  784. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  785. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  786. End Select
  787. End Sub
  788.  
  789. Sub FadeObjm(nr, object, a, b, c, d)
  790. Select Case FadingLevel(nr)
  791. Case 4:object.image = b
  792. Case 5:object.image = a
  793. Case 9:object.image = c
  794. Case 13:object.image = d
  795. End Select
  796. End Sub
  797.  
  798. Sub NFadeObj(nr, object, a, b)
  799. Select Case FadingLevel(nr)
  800. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  801. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  802. End Select
  803. End Sub
  804.  
  805. Sub NFadeObjm(nr, object, a, b)
  806. Select Case FadingLevel(nr)
  807. Case 4:object.image = b
  808. Case 5:object.image = a
  809. End Select
  810. End Sub
  811.  
  812. ' Flasher objects
  813.  
  814. Sub Flash(nr, object)
  815. Select Case FadingLevel(nr)
  816. Case 4 'off
  817. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  818. If FlashLevel(nr) < FlashMin(nr) Then
  819. FlashLevel(nr) = FlashMin(nr)
  820. FadingLevel(nr) = 0 'completely off
  821. End if
  822. Object.IntensityScale = FlashLevel(nr)
  823. Case 5 ' on
  824. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  825. If FlashLevel(nr) > FlashMax(nr) Then
  826. FlashLevel(nr) = FlashMax(nr)
  827. FadingLevel(nr) = 1 'completely on
  828. End if
  829. Object.IntensityScale = FlashLevel(nr)
  830. End Select
  831. End Sub
  832.  
  833. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  834. Object.IntensityScale = FlashLevel(nr)
  835. End Sub
  836.  
  837. '*******************************************************
  838.  
  839. ' *********************************************************************
  840. ' Supporting Ball & Sound Functions
  841. ' *********************************************************************
  842.  
  843. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  844. Vol = Csng(BallVel(ball) ^2 / 1000)
  845. End Function
  846.  
  847. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  848. Dim tmp
  849. tmp = ball.x * 2 / SpaceShuttle.width-1
  850. If tmp > 0 Then
  851. Pan = Csng(tmp ^10)
  852. Else
  853. Pan = Csng(-((- tmp) ^10) )
  854. End If
  855. End Function
  856.  
  857. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  858. Pitch = BallVel(ball) * 20
  859. End Function
  860.  
  861. Function BallVel(ball) 'Calculates the ball speed
  862. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  863. End Function
  864.  
  865. '*****************************************
  866. ' JP's VP10 Rolling Sounds
  867. '*****************************************
  868.  
  869. Const tnob = 5 ' total number of balls
  870. ReDim rolling(tnob)
  871. InitRolling
  872.  
  873. Sub InitRolling
  874. Dim i
  875. For i = 0 to tnob
  876. rolling(i) = False
  877. Next
  878. End Sub
  879.  
  880. Sub RollingTimer_Timer()
  881. Dim BOT, b
  882. BOT = GetBalls
  883.  
  884. ' stop the sound of deleted balls
  885. For b = UBound(BOT) + 1 to tnob
  886. rolling(b) = False
  887. StopSound("fx_ballrolling" & b)
  888. Next
  889.  
  890. ' exit the sub if no balls on the table
  891. If UBound(BOT) = -1 Then Exit Sub
  892.  
  893. ' play the rolling sound for each ball
  894. For b = 0 to UBound(BOT)
  895. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  896. rolling(b) = True
  897. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  898. Else
  899. If rolling(b) = True Then
  900. StopSound("fx_ballrolling" & b)
  901. rolling(b) = False
  902. End If
  903. End If
  904. Next
  905. End Sub
  906.  
  907. '**********************
  908. ' Ball Collision Sound
  909. '**********************
  910.  
  911. Sub OnBallBallCollision(ball1, ball2, velocity)
  912. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  913. End Sub
  914.  
  915. '************************************
  916. ' What you need to add to your table
  917. '************************************
  918.  
  919. ' a timer called RollingTimer. With a fast interval, like 10
  920. ' one collision sound, in this script is called fx_collide
  921. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  922. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  923.  
  924. '******************************************
  925. ' Explanation of the rolling sound routine
  926. '******************************************
  927.  
  928. ' sounds are played based on the ball speed and position
  929.  
  930. ' the routine checks first for deleted balls and stops the rolling sound.
  931.  
  932. ' The For loop goes through all the balls on the table and checks for the ball speed and
  933. ' if the ball is on the table (height lower than 30) then then it plays the sound
  934. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  935.  
  936. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  937. ' will change according to the ball speed, and the PAN function will change the stereo position according
  938. ' to the position of the ball on the table.
  939.  
  940. '**************************************
  941. ' Explanation of the collision routine
  942. '**************************************
  943.  
  944. ' The collision is built in VP.
  945. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  946. ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
  947. ' depending of the speed of the collision.
  948.  
  949. Sub Spinner_Spin
  950. PlaySound "fx_spinner",0,.25,0,0.25
  951. End Sub
  952.  
  953. Sub Rubbers_Hit(idx)
  954. dim finalspeed
  955. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  956. If finalspeed > 20 then
  957. PlaySound "rubber", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  958. End if
  959. If finalspeed >= 6 AND finalspeed <= 20 then
  960. RandomSoundRubber()
  961. End If
  962. End Sub
  963.  
  964. Sub RandomSoundRubber()
  965. Select Case Int(Rnd*3)+1
  966. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  967. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  968. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  969. End Select
  970. End Sub
  971.  
  972. Sub LeftFlipper_Collide(parm)
  973. PlaySound "rubber", 0, parm / 10, -0.1, 0.15
  974. End Sub
  975.  
  976. Sub RightFlipper_Collide(parm)
  977. PlaySound "rubber", 0, parm / 10, 0.1, 0.15
  978. End Sub
  979.  
  980. '******** Others Table Sounds *********
  981.  
  982. Sub Trigger1_Hit:me.timerenabled=1:End Sub
  983.  
  984. Sub Trigger1_timer()
  985. Dim HopSound
  986. HopSound = Int(rnd*2)+1
  987. Select Case HopSound
  988. Case 1: PlaySound "ballhop"
  989. Case 2: PlaySound "ballhoptwice"
  990. End Select
  991. me.timerenabled=0
  992. End Sub
  993.  
  994. Sub CPWall_Hit:PlaySound "post_hit":End Sub
  995.  
  996. Sub sw16_UnHit:PlaySound "popper_ball":End Sub
  997.  
  998. Sub sw24_UnHit:PlaySound "popper_ball":End Sub
  999.  
  1000. Sub Wall48_Hit:PlaySound "rubber":End Sub
  1001.  
  1002. Sub Wall54_Hit:PlaySound "rubber":End Sub
  1003.  
  1004. Sub Wall50_Hit:PlaySound "flip_hit_3":End Sub
  1005.  
  1006. Sub Wall56_Hit:PlaySound "flip_hit_3":End Sub
  1007.  
  1008. Sub Wall68_Hit:PlaySound "flip_hit_3":End Sub
  1009.  
  1010. Sub Wall74_Hit:PlaySound "flip_hit_3":End Sub
  1011.  
  1012. Sub Wall71_Hit:PlaySound "flip_hit_3":End Sub
  1013.  
  1014. Sub Wall128_Hit:PlaySound "metalhit_medium":End Sub
  1015.  
  1016. Sub Wall27_Hit:PlaySound "metalhit_medium":End Sub
  1017.  
  1018. Sub Wall120_Hit:PlaySound "metalhit_thin":End Sub
  1019.  
  1020. Sub Wall121_Hit:PlaySound "metalhit_thin":End Sub
  1021.  
  1022. Sub Wall88_Hit:PlaySound "metalhit_thin":End Sub
  1023.  
  1024. Sub Wall15_Hit:PlaySound "metalhit_thin":End Sub
  1025.  
  1026. Sub Wall21_Hit:PlaySound "metalhit_thin":End Sub
  1027.  
  1028. Sub Wall228_Hit:PlaySound "metalhit_thin":End Sub
  1029.  
  1030. Sub Wall11_Hit:PlaySound "metalhit_thin":End Sub
  1031.  
  1032. Sub Wall79_Hit:PlaySound "metalhit_thin":End Sub
  1033.  
  1034. Sub Wall13_Hit:PlaySound "metalhit_thin":End Sub
  1035.  
  1036. Sub Wall119_Hit:PlaySound "metalhit_thin":End Sub
  1037.  
  1038. Sub Wall118_Hit:PlaySound "metalhit_thin":End Sub
  1039.  
  1040. Sub Wall57_Hit:PlaySound "metalhit_medium":End Sub
  1041.  
  1042. Sub Wall62_Hit:PlaySound "metalhit_medium":End Sub
  1043.  
  1044. Sub Wall82_Hit:PlaySound "metalhit_thin":End Sub
  1045.  
  1046. Sub Wall83_Hit:PlaySound "metalhit_thin":End Sub
  1047.  
  1048. Sub Wall116_Hit:PlaySound "metalhit_thin":End Sub
  1049.  
  1050. Sub Wall117_Hit:PlaySound "metalhit_thin":End Sub
  1051.  
  1052. Sub Wall86_Hit:PlaySound "metalhit_thin":End Sub
  1053.  
  1054. Sub Wall34_Hit:PlaySound "metalhit_medium":End Sub
  1055.  
  1056. Sub Gate_Hit:PlaySound "gate":End Sub
  1057.  
  1058. Sub Wall129_Hit:PlaySound "rubber",1,0.6:End Sub
  1059.  
  1060. Sub Wall130_Hit:PlaySound "rubber",1,0.6:End Sub
  1061.  
  1062. Sub Trigger2_Hit:PlaySound "enter_ramp":End Sub
  1063.  
  1064. Sub Trigger4_Hit:PlaySound "ramp_down":End Sub
  1065.  
  1066. Sub Trigger3_Hit:PlaySound "ramp":End Sub
  1067.  
  1068. Sub Trigger6_Hit:PlaySound "hop2":End Sub
  1069.  
  1070. Sub Trigger7_Hit:PlaySound "hop2":End Sub
  1071.  
  1072. Sub Trigger8_Hit:PlaySound "ramp_down":End Sub
  1073.  
  1074. Sub Trigger9_Hit:PlaySound "enter_ramp":End Sub
  1075.  
  1076. '**************************************
Advertisement
Add Comment
Please, Sign In to add comment