Guest User

Untitled

a guest
Aug 2nd, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.58 KB | None | 0 0
  1. '*****************************************************************************************************
  2. ' CREDITS
  3. ' Initial table created by fuzzel, jimmyfingers, jpsalas, toxie & unclewilly (in alphabetical order)
  4. ' Flipper primitives by zany
  5. ' Ball rolling sound script by jpsalas
  6. ' Ball shadow by ninuzzu
  7. ' Ball control by rothbauerw
  8. ' DOF by arngrim
  9. ' Positional sound helper functions by djrobx
  10. ' Plus a lot of input from the whole community (sorry if we forgot you :/)
  11. '*****************************************************************************************************
  12.  
  13.  
  14. Option Explicit
  15. Randomize
  16.  
  17. On Error Resume Next
  18. ExecuteGlobal GetTextFile("controller.vbs")
  19. If Err Then MsgBox "You need the Controller.vbs file in order to run this table (installed with the VPX package in the scripts folder)"
  20. On Error Goto 0
  21.  
  22. LoadVPM "01550000", "stern.vbs", 3.36
  23.  
  24. Dim cCredits,Objekt,bsTrough,bsSaucer,bsSaucerL,bsSaucerR,dtL,dtR
  25. cCredits="Flight 2000" & vbNewline & "Stern 1980"
  26. Const cGameName = "flight2k"
  27. Const UseSolenoids = 1
  28. Const UseLamps = 1
  29. Const UseGI = 0
  30. Const UseSync = 0
  31. Const HandleMech = 0
  32. Const SSolenoidOn = "solon"
  33. Const SSolenoidOff = "soloff"
  34. Const SCoin = "Coin"
  35. Set vpmShowDips = GetRef("editDips")
  36. SolCallback(7) = "dtL.SolDropUp"
  37. SolCallback(8) = "dtL.SolUnHit 5,"
  38. SolCallback(9) = "SolBallLock"
  39. SolCallback(10) = "bsTrough.SolOut"
  40. SolCallback(11) = "dtL.SolUnHit 4,"
  41. SolCallback(12) = "dtL.SolUnHit 3,"
  42. SolCallback(13) = "dtL.SolUnHit 1,"
  43. SolCallback(14) = "dtL.SolUnHit 2,"
  44. SolCallback(15) = "dtR.SolDropUp"
  45. SolCallback(17) = "bsSaucerR.SolOut"
  46. SolCallback(20) = "bsSaucerL.SolOut"
  47. SolCallback(sLRFlipper) = "SolRFlipper"
  48. SolCallback(sLLFlipper) = "SolLFlipper"
  49.  
  50. Sub SolLFlipper(Enabled)
  51. If Enabled Then
  52. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd
  53. Else
  54. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart
  55. End If
  56. End Sub
  57.  
  58. Sub SolRFlipper(Enabled)
  59. If Enabled Then
  60. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd
  61. Else
  62. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart
  63. End If
  64. End Sub
  65.  
  66. Sub Table1_Init
  67. On Error Resume Next
  68. With Controller
  69. .GameName=cGameName
  70. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description:Exit Sub
  71. .SplashInfoLine=cCredits
  72. .HandleMechanics=0
  73. .ShowDMDOnly=1
  74. .ShowFrame=0
  75. .ShowTitle=0
  76. .Hidden=0
  77. .Run
  78. If Err Then MsgBox Err.Description
  79. End With
  80. On Error Goto 0
  81.  
  82. Set bsTrough = New cvpmBallStack
  83. With bsTrough
  84. .InitSw 0, 33, 34, 35, 0, 0, 0, 0
  85. .InitKick BallRelease, 80, 6
  86. .InitEntrySnd "drain", "Solenoid"
  87. .InitExitSnd SoundFX("Ballrel",DOFContactors), SoundFX("Solenoid",DOFContactors)
  88. .Balls = 3
  89. End With
  90.  
  91. Set bsSaucerL = New cvpmBallStack
  92. With bsSaucerL
  93. .InitSaucer Kicker1, 15, 0, 25
  94. .InitExitSnd SoundFX("popper_ball",DOFContactors), SoundFX("popper",DOFContactors)
  95. .kickforcevar = 4
  96. End With
  97.  
  98. Set bsSaucerR = New cvpmBallStack
  99. With bsSaucerR
  100. .InitSaucer Kicker2, 16, 0, 25
  101. .InitExitSnd SoundFX("popper_ball",DOFContactors), SoundFX("popper",DOFContactors)
  102. .kickforcevar = 4
  103. End With
  104.  
  105. Set dtL = New cvpmDropTarget
  106. With dtL
  107. .InitDrop Array(Target1,Target2,Target3,Target4,Target5), Array(28, 29, 30, 31, 32)
  108. .InitSnd SoundFX("target",DOFTargets), SoundFX("fx_resetdrop",DOFDropTargets)
  109. End With
  110.  
  111. Set dtR = New cvpmDropTarget
  112. With dtR
  113. .InitDrop Array(Target6,Target7,Target8), Array(25, 26, 27)
  114. .InitSnd SoundFX("target",DOFTargets), SoundFX("fx_resetdrop",DOFDropTargets)
  115. End With
  116.  
  117. vpmNudge.TiltSwitch = 7
  118. vpmNudge.Sensitivity = 1
  119. vpmNudge.TiltObj = Array(Bumper1, Bumper2, LeftSlingshot, RightSlingshot, LeftSlingShot1, RightSlingShot1)
  120.  
  121. PinmameTimer.Interval = PinMameInterval
  122. PinmameTimer.Enabled = 1
  123. vpmMapLights aLights
  124.  
  125. If Table1.ShowDT = False then
  126. for each objekt in backdropstuff:objekt.visible = False:Next
  127. End If
  128.  
  129. End Sub
  130.  
  131. Sub table1_Paused:Controller.Pause = 1:End Sub
  132. Sub table1_unPaused:Controller.Pause = 0:End Sub
  133.  
  134. '*******************************************
  135. ' Ball Lock Maze
  136. '*******************************************
  137.  
  138. Sub TopTrigger_Hit:vpmTimer.PulseSw(39):Playsound "sensor":End Sub
  139.  
  140. Sub SolBallLock(Enabled):
  141. If Enabled Then
  142. PostDelay.Enabled=1
  143. MiddlePost.RotX = 90:MiddlePost.collidable = False
  144. BottomPost.RotX = 90:BottomPost.collidable = False
  145. '
  146. Else
  147. TopPost.RotX = 0:TopPost.collidable = True
  148. MiddlePost.RotX = 0:MiddlePost.collidable = True
  149. BottomPost.RotX = 0:BottomPost.collidable = True
  150. End If
  151. End Sub
  152.  
  153.  
  154. Sub PostDelay_Timer
  155. TopPost.RotX = 90:TopPost.collidable = False
  156. TopPost.RotX = 0:TopPost.collidable = False
  157. MiddlePost.RotX = 0:MiddlePost.collidable = True
  158. BottomPost.RotX = 0:BottomPost.collidable = True
  159. PostDelay.Enabled=0
  160. End Sub
  161.  
  162. '***************************
  163. 'Switches
  164. '***************************
  165. Sub Trigger2_Hit:Controller.Switch(18)=1:End Sub
  166. Sub Trigger2_unHit:Controller.Switch(18)=0:End Sub
  167. Sub Trigger3_Hit:Controller.Switch(19)=1:End Sub
  168. Sub Trigger3_unHit:Controller.Switch(19)=0:End Sub
  169. Sub Trigger4_Hit:Controller.Switch(20)=1:End Sub
  170. Sub Trigger4_unHit:Controller.Switch(20)=0:End Sub
  171. Sub Trigger5_Hit:Controller.Switch(21)=1:End Sub
  172. Sub Trigger5_unHit:Controller.Switch(21)=0:End Sub
  173. Sub Trigger6_Hit:Controller.Switch(40)=1:End Sub
  174. Sub Trigger6_unHit:Controller.Switch(40)=0:End Sub
  175. Sub LeftInlane_Hit:Controller.Switch(23)=1:End Sub
  176. Sub LeftInlane_unHit:Controller.Switch(23)=0:End Sub
  177. Sub RightInlane_Hit:Controller.Switch(24)=1:End Sub
  178. Sub RightInlane_unHit:Controller.Switch(24)=0:End Sub
  179. Sub LeftInlane1_Hit:Controller.Switch(17)=1:DOF 101, DOFOn:End Sub
  180. Sub LeftInlane1_unHit:Controller.Switch(17)=0:DOF 101, DOFOff:End Sub
  181. Sub RightInlane1_Hit:Controller.Switch(22)=1:End Sub
  182. Sub RightInlane1_unHit:Controller.Switch(22)=0:End Sub
  183. Sub LeftOutlane_Hit:Controller.Switch(36)=1:End Sub
  184. Sub LeftOutLane_unHit:Controller.Switch(36)=0:End Sub
  185. Sub RightOutlane_Hit:Controller.Switch(37)=1:End Sub
  186. Sub RightOutlane_unHit:Controller.Switch(37)=0:End Sub
  187. Sub Target9_Hit:vpmTimer.PulseSw(17):DOF 102, DOFPulse:End Sub
  188. Sub Target10_Hit:vpmTimer.PulseSw(38):End Sub
  189. Sub Target11_Hit:vpmTimer.PulseSw(17):DOF 103, DOFPulse:End Sub
  190. Sub Spinner1_Spin():vpmTimer.PulseSw(4):PlaySound "fx_spinner", 0, .25, AudioPan(Spinner1), 0.25, 0, 0, 1, AudioFade(Spinner1):End Sub
  191. Sub Spinner2_Spin():vpmTimer.PulseSw(5):PlaySound "fx_spinner", 0, .25, AudioPan(Spinner2), 0.25, 0, 0, 1, AudioFade(Spinner2):End Sub
  192. Sub Bumper1_Hit():vpmTimer.PulseSw(13):RandomSoundBumper:End Sub
  193. Sub Bumper2_Hit():vpmTimer.PulseSw(14):RandomSoundBumper:End Sub
  194. Sub Target1_Hit:dtL.Hit 1:End Sub
  195. Sub Target2_Hit:dtL.Hit 2:End Sub
  196. Sub Target3_Hit:dtL.Hit 3:End Sub
  197. Sub Target4_Hit:dtL.Hit 4:End Sub
  198. Sub Target5_Hit:dtL.Hit 5:End Sub
  199. Sub Target6_Hit:dtR.Hit 1:End Sub
  200. Sub Target7_Hit:dtR.Hit 2:End Sub
  201. Sub Target8_Hit:dtR.Hit 3:End Sub
  202. Sub Kicker1_Hit:bsSaucerL.AddBall 0:End Sub
  203. Sub Kicker2_Hit:bsSaucerR.AddBall 0:End Sub
  204. Sub Drain_Hit:bsTrough.addball me : playsound "drain" : End Sub
  205.  
  206. Dim EnableBallControl
  207. EnableBallControl = false 'Change to true to enable manual ball control (or press C in-game) via the arrow keys and B (boost movement) keys
  208. BallSize = 50
  209.  
  210. '****************
  211. 'Enhanced lighting
  212. '****************
  213. Sub lighttimer_Timer
  214. If Target6.isdropped then
  215. SpecialLight1.state=1
  216. GI10.state=0
  217. Else
  218. SpecialLight1.state=0
  219. GI10.state=1
  220. End If
  221. If Target7.isdropped then
  222. SpecialLight2.state=1
  223. Else
  224. SpecialLight2.state=0
  225. End If
  226. If Target8.isdropped then
  227. SpecialLight3.state=1
  228. GI11.state=0
  229. Else
  230. SpecialLight3.state=0
  231. GI11.state=1
  232. End If
  233. End Sub
  234.  
  235.  
  236.  
  237. Sub Table1_KeyDown(ByVal KeyCode)
  238. If keycode = PlungerKey Then
  239. Plunger.PullBack
  240. PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  241. End If
  242. If vpmKeyDown(KeyCode) Then Exit Sub
  243.  
  244. ' Manual Ball Control
  245. If keycode = 46 Then ' C Key
  246. If EnableBallControl = 1 Then
  247. EnableBallControl = 0
  248. Else
  249. EnableBallControl = 1
  250. End If
  251. End If
  252. If EnableBallControl = 1 Then
  253. If keycode = 48 Then ' B Key
  254. If BCboost = 1 Then
  255. BCboost = BCboostmulti
  256. Else
  257. BCboost = 1
  258. End If
  259. End If
  260. If keycode = 203 Then BCleft = 1 ' Left Arrow
  261. If keycode = 200 Then BCup = 1 ' Up Arrow
  262. If keycode = 208 Then BCdown = 1 ' Down Arrow
  263. If keycode = 205 Then BCright = 1 ' Right Arrow
  264. End If
  265. End Sub
  266.  
  267. Sub Table1_KeyUp(ByVal keycode)
  268. If keycode = PlungerKey Then
  269. Plunger.Fire
  270. PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  271. End If
  272. If vpmKeyUp(KeyCode) Then Exit Sub
  273. 'Manual Ball Control
  274. If EnableBallControl = 1 Then
  275. If keycode = 203 Then BCleft = 0 ' Left Arrow
  276. If keycode = 200 Then BCup = 0 ' Up Arrow
  277. If keycode = 208 Then BCdown = 0 ' Down Arrow
  278. If keycode = 205 Then BCright = 0 ' Right Arrow
  279. End If
  280. End Sub
  281.  
  282.  
  283.  
  284.  
  285.  
  286. '*****GI Lights On
  287. dim xx
  288.  
  289. For each xx in GI:xx.State = 1: Next
  290.  
  291.  
  292.  
  293. '**********Sling Shot Animations
  294. ' Rstep and Lstep are the variables that increment the animation
  295. '****************
  296. Dim RStep,RStep1,LStep,LStep1
  297.  
  298. Sub RightSlingShot_Slingshot
  299. vpmTimer.PulseSw(12)
  300. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05
  301. RSling.Visible = 0
  302. RSling1.Visible = 1
  303. sling1.TransZ = -20
  304. RStep = 0
  305. RightSlingShot.TimerEnabled = 1
  306. End Sub
  307.  
  308. Sub RightSlingShot_Timer
  309. Select Case RStep
  310. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  311. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  312. End Select
  313. RStep = RStep + 1
  314. End Sub
  315.  
  316. Sub RightSlingShot1_Slingshot
  317. vpmTimer.PulseSw(10)
  318. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05
  319. RSling5.Visible = 0
  320. RSling4.Visible = 1
  321. sling3.TransZ = -20
  322. RStep1 = 0
  323. RightSlingShot1.TimerEnabled = 1
  324. End Sub
  325.  
  326. Sub RightSlingShot1_Timer
  327. Select Case RStep1
  328. Case 3:RSLing4.Visible = 0:RSLing3.Visible = 1:sling3.TransZ = -10
  329. Case 4:RSLing3.Visible = 0:RSLing5.Visible = 1:sling3.TransZ = 0:RightSlingShot1.TimerEnabled = 0
  330. End Select
  331. RStep1 = RStep1 + 1
  332. End Sub
  333.  
  334. Sub LeftSlingShot_Slingshot
  335. vpmTimer.PulseSw(11)
  336. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05
  337. LSling.Visible = 0
  338. LSling1.Visible = 1
  339. sling2.TransZ = -20
  340. LStep = 0
  341. LeftSlingShot.TimerEnabled = 1
  342. End Sub
  343.  
  344. Sub LeftSlingShot_Timer
  345. Select Case LStep
  346. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  347. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  348. End Select
  349. LStep = LStep + 1
  350. End Sub
  351.  
  352.  
  353. Sub LeftSlingShot1_Slingshot
  354. vpmTimer.PulseSw(9)
  355. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05
  356. LSling5.Visible = 0
  357. LSling4.Visible = 1
  358. sling4.TransZ = -20
  359. LStep1 = 0
  360. LeftSlingShot1.TimerEnabled = 1
  361.  
  362. End Sub
  363.  
  364. Sub LeftSlingShot1_Timer
  365. Select Case LStep1
  366. Case 3:LSLing4.Visible = 0:LSLing3.Visible = 1:sling4.TransZ = -10
  367. Case 4:LSLing3.Visible = 0:LSLing5.Visible = 1:sling4.TransZ = 0:LeftSlingShot1.TimerEnabled = 0
  368. End Select
  369. LStep1 = LStep1 + 1
  370. End Sub
  371.  
  372.  
  373.  
  374.  
  375. '*********************************************************************
  376. ' Positional Sound Playback Functions
  377. '*********************************************************************
  378.  
  379. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  380. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  381. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  382. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  383. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  384. End Sub
  385.  
  386. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  387. Sub PlaySoundAt(soundname, tableobj)
  388. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  389. End Sub
  390.  
  391. Sub PlaySoundAtBall(soundname)
  392. PlaySoundAt soundname, ActiveBall
  393. End Sub
  394.  
  395.  
  396. '*********************************************************************
  397. ' Supporting Ball & Sound Functions
  398. '*********************************************************************
  399.  
  400. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  401. Dim tmp
  402. tmp = tableobj.y * 2 / table1.height-1
  403. If tmp > 0 Then
  404. AudioFade = Csng(tmp ^10)
  405. Else
  406. AudioFade = Csng(-((- tmp) ^10) )
  407. End If
  408. End Function
  409.  
  410. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  411. Dim tmp
  412. tmp = tableobj.x * 2 / table1.width-1
  413. If tmp > 0 Then
  414. AudioPan = Csng(tmp ^10)
  415. Else
  416. AudioPan = Csng(-((- tmp) ^10) )
  417. End If
  418. End Function
  419.  
  420. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  421. Vol = Csng(BallVel(ball) ^2 / 2000)
  422. End Function
  423.  
  424. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  425. Pitch = BallVel(ball) * 20
  426. End Function
  427.  
  428. Function BallVel(ball) 'Calculates the ball speed
  429. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  430. End Function
  431.  
  432.  
  433. '*****************************************
  434. ' rothbauerw's Manual Ball Control
  435. '*****************************************
  436.  
  437. Dim BCup, BCdown, BCleft, BCright
  438. Dim ControlBallInPlay, ControlActiveBall
  439. Dim BCvel, BCyveloffset, BCboostmulti, BCboost
  440.  
  441. BCboost = 1 'Do Not Change - default setting
  442. BCvel = 4 'Controls the speed of the ball movement
  443. BCyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  444. BCboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  445.  
  446. ControlBallInPlay = false
  447.  
  448. Sub StartBallControl_Hit()
  449. Set ControlActiveBall = ActiveBall
  450. ControlBallInPlay = true
  451. End Sub
  452.  
  453. Sub StopBallControl_Hit()
  454. ControlBallInPlay = false
  455. End Sub
  456.  
  457. Sub BallControlTimer_Timer()
  458. If EnableBallControl and ControlBallInPlay then
  459. If BCright = 1 Then
  460. ControlActiveBall.velx = BCvel*BCboost
  461. ElseIf BCleft = 1 Then
  462. ControlActiveBall.velx = -BCvel*BCboost
  463. Else
  464. ControlActiveBall.velx = 0
  465. End If
  466.  
  467. If BCup = 1 Then
  468. ControlActiveBall.vely = -BCvel*BCboost
  469. ElseIf BCdown = 1 Then
  470. ControlActiveBall.vely = BCvel*BCboost
  471. Else
  472. ControlActiveBall.vely = bcyveloffset
  473. End If
  474. End If
  475. End Sub
  476.  
  477.  
  478. '*****************************************
  479. ' JP's VP10 Rolling Sounds
  480. '*****************************************
  481.  
  482. Const tnob = 5 ' total number of balls
  483. ReDim rolling(tnob)
  484. InitRolling
  485.  
  486. Sub InitRolling
  487. Dim i
  488. For i = 0 to tnob
  489. rolling(i) = False
  490. Next
  491. End Sub
  492.  
  493. Sub RollingTimer_Timer()
  494. Dim BOT, b
  495. BOT = GetBalls
  496.  
  497. ' stop the sound of deleted balls
  498. For b = UBound(BOT) + 1 to tnob
  499. rolling(b) = False
  500. StopSound("fx_ballrolling" & b)
  501. Next
  502.  
  503. ' exit the sub if no balls on the table
  504. If UBound(BOT) = -1 Then Exit Sub
  505.  
  506. ' play the rolling sound for each ball
  507. For b = 0 to UBound(BOT)
  508. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  509. rolling(b) = True
  510. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  511. Else
  512. If rolling(b) = True Then
  513. StopSound("fx_ballrolling" & b)
  514. rolling(b) = False
  515. End If
  516. End If
  517. Next
  518. End Sub
  519.  
  520. '**********************
  521. ' Ball Collision Sound
  522. '**********************
  523.  
  524. Sub OnBallBallCollision(ball1, ball2, velocity)
  525. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  526. End Sub
  527.  
  528.  
  529. '*****************************************
  530. ' ninuzzu's FLIPPER SHADOWS (Spinners added)
  531. '*****************************************
  532.  
  533. sub FlipperTimer_Timer()
  534. FlipperLSh.RotZ = LeftFlipper.currentangle
  535. FlipperRSh.RotZ = RightFlipper.currentangle
  536. Spinner1Shadow.RotZ = Spinner1.currentangle
  537. Spinner2Shadow.RotZ = Spinner2.currentangle
  538. End Sub
  539.  
  540. '*****************************************
  541. ' ninuzzu's BALL SHADOW
  542. '*****************************************
  543. Dim BallShadow
  544. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  545.  
  546. Sub BallShadowUpdate_timer()
  547. Dim BOT, b
  548. BOT = GetBalls
  549. ' hide shadow of deleted balls
  550. If UBound(BOT)<(tnob-1) Then
  551. For b = (UBound(BOT) + 1) to (tnob-1)
  552. BallShadow(b).visible = 0
  553. Next
  554. End If
  555. ' exit the Sub if no balls on the table
  556. If UBound(BOT) = -1 Then Exit Sub
  557. ' render the shadow for each ball
  558. For b = 0 to UBound(BOT)
  559. If BOT(b).X < Table1.Width/2 Then
  560. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  561. Else
  562. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  563. End If
  564. ballShadow(b).Y = BOT(b).Y + 12
  565. If BOT(b).Z > 20 Then
  566. BallShadow(b).visible = 1
  567. Else
  568. BallShadow(b).visible = 0
  569. End If
  570. Next
  571. End Sub
  572.  
  573.  
  574.  
  575. '************************************
  576. ' What you need to add to your table
  577. '************************************
  578.  
  579. ' a timer called RollingTimer. With a fast interval, like 10
  580. ' one collision sound, in this script is called fx_collide
  581. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  582. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  583.  
  584.  
  585. '******************************************
  586. ' Explanation of the rolling sound routine
  587. '******************************************
  588.  
  589. ' sounds are played based on the ball speed and position
  590.  
  591. ' the routine checks first for deleted balls and stops the rolling sound.
  592.  
  593. ' The For loop goes through all the balls on the table and checks for the ball speed and
  594. ' if the ball is on the table (height lower than 30) then then it plays the sound
  595. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  596.  
  597. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  598. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  599. ' according to the position of the ball on the table.
  600.  
  601.  
  602. '**************************************
  603. ' Explanation of the collision routine
  604. '**************************************
  605.  
  606. ' The collision is built in VP.
  607. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  608. ' 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
  609. ' depending of the speed of the collision.
  610.  
  611.  
  612. Sub Pins_Hit (idx)
  613. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  614. End Sub
  615.  
  616. Sub Targets_Hit (idx)
  617. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  618. End Sub
  619.  
  620. Sub Metals_Thin_Hit (idx)
  621. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  622. End Sub
  623.  
  624. Sub Metals_Medium_Hit (idx)
  625. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  626. End Sub
  627.  
  628. Sub Metals2_Hit (idx)
  629. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  630. End Sub
  631.  
  632. Sub Gates_Hit (idx)
  633. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  634. End Sub
  635.  
  636. Sub Rubbers_Hit(idx)
  637. dim finalspeed
  638. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  639. If finalspeed > 20 then
  640. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  641. End if
  642. If finalspeed >= 6 AND finalspeed <= 20 then
  643. RandomSoundRubber()
  644. End If
  645. End Sub
  646.  
  647. Sub Posts_Hit(idx)
  648. dim finalspeed
  649. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  650. If finalspeed > 16 then
  651. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  652. End if
  653. If finalspeed >= 6 AND finalspeed <= 16 then
  654. RandomSoundRubber()
  655. End If
  656. End Sub
  657.  
  658. Sub RandomSoundRubber()
  659. Select Case Int(Rnd*3)+1
  660. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  661. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  662. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  663. End Select
  664. End Sub
  665.  
  666. Sub LeftFlipper_Collide(parm)
  667. RandomSoundFlipper()
  668. End Sub
  669.  
  670. Sub RightFlipper_Collide(parm)
  671. RandomSoundFlipper()
  672. End Sub
  673.  
  674. Sub RandomSoundFlipper()
  675. Select Case Int(Rnd*3)+1
  676. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  677. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  678. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  679. End Select
  680. End Sub
  681.  
  682. Sub RandomSoundBumper()
  683. Select Case Int(Rnd*4)+1
  684. Case 1 : PlaySound SoundFX("fx_bumper1",DOFContactors), 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  685. Case 2 : PlaySound SoundFX("fx_bumper2",DOFContactors), 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  686. Case 3 : PlaySound SoundFX("fx_bumper3",DOFContactors), 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  687. Case 4 : PlaySound SoundFX("fx_bumper4",DOFContactors), 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  688. End Select
  689. End Sub
  690.  
  691. 'Stern Flight 2000
  692. 'added by Inkochnito
  693. Sub editDips
  694. Dim vpmDips:Set vpmDips = New cvpmDips
  695. With vpmDips
  696. .AddForm 700, 400, "Flight 2000 - DIP switches"
  697. .AddChk 2, 10, 180, Array("Match feature", &H00100000) 'dip 21
  698. .AddChk 2, 25, 115, Array("Credits display", &H00080000) 'dip 20
  699. .AddFrame 2, 45, 190, "Maximum credits", &H00060000, Array("10 credits", 0, "15 credits", &H00020000, "25 credits", &H00040000, "40 credits", &H00060000) 'dip 18&19
  700. .AddFrame 2, 120, 190, "High game to date", 49152, Array("points", 0, "1 free game", &H00004000, "2 free games", 32768, "3 free games", 49152) 'dip 15&16
  701. .AddFrame 2, 195, 190, "High score feature", &H00000020, Array("extra ball", 0, "replay", &H00000020) 'dip 6
  702. .AddFrame 2, 241, 190, "Spot 1 or 2 'F' lites", &H00001000, Array("spot one 'F'", 0, "spot two 'FF'", &H00001000) 'dip 13
  703. .AddFrame 2, 287, 190, "Right spinner lites", &H00200000, Array("start fresh", 0, "retain", &H00200000) 'dip 22
  704. .AddChk 205, 10, 190, Array("Talking sound", &H00010000) 'dip 17
  705. .AddChk 205, 25, 190, Array("Background sound", &H00002000) 'dip 14
  706. .AddFrame 205, 45, 190, "Special award", &HC0000000, Array("no award", 0, "100,000 points", &H40000000, "free ball", &H80000000, "free game", &HC0000000) 'dip 31&32
  707. .AddFrame 205, 120, 190, "Add a ball memory", &H00000090, Array("one ball", 0, "three balls", &H00000010, "five balls", &H00000090) 'dip 5&8
  708. .AddFrame 205, 195, 190, "Balls per game", &H00000040, Array("3 balls", 0, "5 balls", &H00000040) 'dip 7
  709. .AddFrame 205, 241, 190, "Special limit", &H10000000, Array("no limit", 0, "one replay per ball", &H10000000) 'dip 29
  710. .AddFrame 205, 287, 190, "Apollo 1 and 2 lites", &H00800000, Array("are left off at start of the game", 0, "are turned on at start game", &H00800000) 'dip24
  711. .AddFrame 100, 333, 190, "Bonus multiplier", &H20000000, Array("kept in memory", 0, "reset", &H20000000) 'dip30
  712. .AddLabel 50, 385, 300, 20, "After hitting OK, press F3 to reset game with new settings."
  713. .ViewDips
  714. End With
  715. End Sub
  716.  
  717. '************************************
  718. ' LEDs Display
  719. 'Based on Scapino's 7 digit Reel LEDs
  720. '************************************
  721.  
  722. Dim Digits(32)
  723. Dim Patterns(11)
  724. Dim Patterns2(11)
  725.  
  726. Patterns(0) = 0 'empty
  727. Patterns(1) = 63 '0
  728. Patterns(2) = 6 '1
  729. Patterns(3) = 91 '2
  730. Patterns(4) = 79 '3
  731. Patterns(5) = 102 '4
  732. Patterns(6) = 109 '5
  733. Patterns(7) = 125 '6
  734. Patterns(8) = 7 '7
  735. Patterns(9) = 127 '8
  736. Patterns(10) = 111 '9
  737.  
  738. Patterns2(0) = 128 'empty
  739. Patterns2(1) = 191 '0
  740. Patterns2(2) = 134 '1
  741. Patterns2(3) = 219 '2
  742. Patterns2(4) = 207 '3
  743. Patterns2(5) = 230 '4
  744. Patterns2(6) = 237 '5
  745. Patterns2(7) = 253 '6
  746. Patterns2(8) = 135 '7
  747. Patterns2(9) = 255 '8
  748. Patterns2(10) = 239 '9
  749.  
  750. Set Digits(0) = a0
  751. Set Digits(1) = a1
  752. Set Digits(2) = a2
  753. Set Digits(3) = a3
  754. Set Digits(4) = a4
  755. Set Digits(5) = a5
  756. Set Digits(6) = a6
  757.  
  758. Set Digits(7) = b0
  759. Set Digits(8) = b1
  760. Set Digits(9) = b2
  761. Set Digits(10) = b3
  762. Set Digits(11) = b4
  763. Set Digits(12) = b5
  764. Set Digits(13) = b6
  765.  
  766. Set Digits(14) = c0
  767. Set Digits(15) = c1
  768. Set Digits(16) = c2
  769. Set Digits(17) = c3
  770. Set Digits(18) = c4
  771. Set Digits(19) = c5
  772. Set Digits(20) = c6
  773.  
  774. Set Digits(21) = d0
  775. Set Digits(22) = d1
  776. Set Digits(23) = d2
  777. Set Digits(24) = d3
  778. Set Digits(25) = d4
  779. Set Digits(26) = d5
  780. Set Digits(27) = d6
  781.  
  782. Set Digits(28) = e0
  783. Set Digits(29) = e1
  784. Set Digits(30) = e2
  785. Set Digits(31) = e3
  786.  
  787. Sub LED_Timer
  788. On Error Resume Next
  789. Dim ChgLED, ii, jj, chg, stat
  790. ChgLED = Controller.ChangedLEDs(&HFF, &HFFFF)
  791. If Not IsEmpty(ChgLED) Then
  792. For ii = 0 To UBound(ChgLED)
  793. chg = chgLED(ii, 1):stat = chgLED(ii, 2)
  794.  
  795. For jj = 0 to 10
  796. If stat = Patterns(jj) OR stat = Patterns2(jj) then Digits(chgLED(ii, 0) ).SetValue jj
  797. Next
  798. Next
  799. End IF
  800. End Sub
  801.  
  802.  
  803. Sub Trigger1_Timer()
  804.  
  805. End Sub
Advertisement
Add Comment
Please, Sign In to add comment