Arngrim

Untitled

Dec 30th, 2017
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.86 KB | None | 0 0
  1. ' -------------------------------------------------
  2. ' Super Straight SONIC
  3. ' -------------------------------------------------
  4. '
  5. Option Explicit
  6. Randomize
  7.  
  8. Const cGameName = "SuperStraight"
  9. Const Ballsize = 50
  10.  
  11. Dim bumperlitscore
  12. Dim bumperoffscore
  13. Dim balls
  14. dim ebcount
  15. Dim replays
  16. Dim Replay1Table
  17. Dim Replay2Table
  18. dim replay1
  19. dim replay2
  20. Dim hisc
  21. Dim Controller
  22. Dim maxplayers
  23. Dim players
  24. Dim player
  25. Dim credit, dbonus
  26. Dim score(4)
  27. Dim Add100, Add1000, Add10000
  28. Dim sreels(4)
  29. Dim Shoot(4), CanPlay(4)
  30. Dim state
  31. Dim tilt
  32. Dim tiltsens
  33. Dim target(9)
  34. Dim holebonus
  35. Dim StarState
  36. Dim Bonus
  37. Dim Bonuslight(19)
  38. Dim ballinplay
  39. Dim matchnumb
  40. dim ballrenabled
  41. Dim rep
  42. Dim rst
  43. Dim eg
  44. Dim bell
  45. Dim i,j,tnumber, objekt, light
  46. Dim awardcheck
  47. Dim DW1, DW2, DW3
  48.  
  49. On Error Resume Next
  50. ExecuteGlobal GetTextFile("controller.vbs")
  51. If Err Then MsgBox "Can't open controller.vbs"
  52. On Error Goto 0
  53.  
  54. sub SuperStraight_init
  55. LoadEM
  56. maxplayers=4
  57. Replay1Table=450000
  58. Replay2Table=630000
  59.  
  60. set sreels(1) = ScoreReel1
  61. set sreels(2) = ScoreReel2
  62. set sreels(3) = ScoreReel3
  63. set sreels(4) = ScoreReel4
  64. set Shoot(1)= Shoot1
  65. set Shoot(2)= Shoot2
  66. set Shoot(3)= Shoot3
  67. set Shoot(4)= Shoot4
  68. set CanPlay(1) = CanPlay1
  69. set CanPlay(2) = CanPlay2
  70. set CanPlay(3) = CANPLAY3
  71. set CanPlay(4) = CANPLAY4
  72. set target(1)=Tg1
  73. set target(2)=Tg2
  74. set target(3)=Tg3
  75. set target(4)=Tg4
  76. set target(5)=Tg5
  77. set target(6)=Tg6
  78. set target(7)=Tg7
  79. set target(8)=Drop1
  80. set target(9)=Drop2
  81. set bonuslight(1)=bonus1
  82. set bonuslight(2)=bonus2
  83. set bonuslight(3)=bonus3
  84. set bonuslight(4)=bonus4
  85. set bonuslight(5)=bonus5
  86. set bonuslight(6)=bonus6
  87. set bonuslight(7)=bonus7
  88. set bonuslight(8)=bonus8
  89. set bonuslight(9)=bonus9
  90. set bonuslight(10)=bonus10
  91. LTop1.state=0
  92. LRinlane.state=0
  93. LLinlane.state=0
  94. LRightSP.state=0
  95. LLeftSP.state=0
  96. LABspin.state=0
  97. Bonus10.state=0
  98. LSpin.state=0
  99. LRsideout.state=0
  100. player=1
  101. For each light in BumperLights:light.State = 0: Next
  102. For each light in Cardlights:light.State = 0: Next
  103. For each light in TGlights:light.State = 1: Next
  104. For each light in Lights:light.state=1:next
  105. loadhs
  106. if hisc="" then hisc=50000
  107. hstxt.text=hisc
  108. gamov.text="Game Over"
  109. gamov.timerenabled=1
  110. tilttxt.timerenabled=1
  111. credittxt.setvalue(credit)
  112. If credit =0 then light23.state=0 else light23.state=1
  113. if balls="" then balls=5
  114. if balls<>3 and balls<>5 then balls=5
  115. if replays="" then replays=2
  116. if replays<>1 and replays<>2 and replays<>3 then replays=2
  117. Replay1=Replay1Table
  118. bumperlitscore=1000
  119. bumperoffscore=100
  120.  
  121. If ShowDT = True Then
  122. For each objekt in backdropstuff
  123. Objekt.visible = 1
  124. Next
  125. End If
  126.  
  127. If ShowDt = False Then
  128. For each objekt in backdropstuff
  129. Objekt.visible = 0
  130. Next
  131. End If
  132.  
  133. If B2SOn Then
  134. setBackglass.enabled=true
  135. End If
  136. PlaySound "motor"
  137. tilt=false
  138. If credit>0 then DOF 133, DOFOn
  139. End sub
  140.  
  141. sub setBackglass_timer
  142. Controller.B2ssetCredits Credit
  143. Controller.B2ssetMatch 34, Matchnumb*10
  144. Controller.B2SSetGameOver 35,1
  145. Controller.B2SSetScorePlayer 5, hisc
  146. Controller.B2SSetScorePlayer 1, Score(1)
  147. Controller.B2SSetScorePlayer 2, Score(2)
  148. me.enabled=false
  149. end sub
  150.  
  151. sub gamov_timer
  152. if state=false then
  153. If B2SOn then Controller.B2SSetGameOver 35,0
  154. gamov.text=""
  155. gtimer.enabled=true
  156. end if
  157. gamov.timerenabled=0
  158. end sub
  159.  
  160. sub gtimer_timer
  161. if state=false then
  162. gamov.text="Game Over"
  163. If B2SOn then Controller.B2SSetGameOver 35,1
  164. gamov.timerenabled=1
  165. gamov.timerinterval= (INT (RND*10)+5)*100
  166. end if
  167. me.enabled=0
  168. end sub
  169.  
  170. sub tilttxt_timer
  171. if state=false then
  172. tilttxt.text=""
  173. If B2SOn then Controller.B2SSetTilt 33,0
  174. ttimer.enabled=true
  175. end if
  176. tilttxt.timerenabled=0
  177. end sub
  178.  
  179. sub ttimer_timer
  180. if state=false then
  181. tilttxt.text="TILT"
  182. If B2SOn then Controller.B2SSetTilt 33,1
  183. tilttxt.timerenabled=1
  184. tilttxt.timerinterval= (INT (RND*10)+5)*100
  185. end if
  186. me.enabled=0
  187. end sub
  188.  
  189. Sub SuperStraight_KeyDown(ByVal keycode)
  190.  
  191. if keycode=AddCreditKey then
  192. playsound "coinin"
  193. coindelay.enabled=true
  194. end if
  195.  
  196. if keycode=StartGameKey and credit>0 then
  197. if state=false then
  198. credit=credit-1
  199. if credit < 1 then DOF 133, DOFOff
  200. playsound "cluper"
  201. credittxt.setvalue(credit)
  202. If credit =0 then light23.state=0 else light23.state=1
  203. ballinplay=1
  204. player=1
  205. If b2son Then
  206. Controller.B2ssetCredits Credit
  207. Controller.B2ssetballinplay 32, Ballinplay
  208. Controller.B2ssetplayerup 30, 1
  209. Controller.B2ssetcanplay 31, 1
  210. Controller.B2SSetGameOver 0
  211. End If
  212. shoot(player).state=1
  213. tilt=false
  214. state=true
  215. CanPlay(player).state=1
  216. playsound "initialize"
  217. players=1
  218. rst=0
  219. resettimer.enabled=true
  220. else if state=true and players < maxplayers and Ballinplay=1 then
  221. credit=credit-1
  222. if credit < 1 then DOF 133, DOFOff
  223. players=players+1
  224. credittxt.setvalue(credit)
  225. if credit =0 then light23.state=0
  226. If b2son then
  227. Controller.B2ssetCredits Credit
  228. Controller.B2ssetcanplay 31, players
  229. End If
  230. CanPlay(players).state=1
  231. playsound "cluper"
  232. end if
  233. end if
  234. end if
  235.  
  236. If keycode = PlungerKey Then
  237. Plunger.PullBack
  238. PlaySound "plungerpull",0,1,0.25,0.25
  239. End If
  240.  
  241. if tilt=false and state=true then
  242. If keycode = LeftFlipperKey Then
  243. LeftFlipper.RotateToEnd
  244. PlaySound SoundFXDOF("flipperup",101,DOFOn,DOFFlippers), 0, .67, -0.05, 0.05
  245. PlaySound "Buzz",-1,.05,-0.05, 0.05
  246. End If
  247.  
  248. If keycode = RightFlipperKey Then
  249. RightFlipper.RotateToEnd
  250. PlaySound SoundFXDOF("flipperup",102,DOFOn,DOFFlippers), 0, .67, 0.05, 0.05
  251. PlaySound "Buzz1",-1,.05,0.05,0.05
  252. End If
  253.  
  254. If keycode = LeftTiltKey Then
  255. Nudge 90, 2
  256. checktilt
  257. End If
  258.  
  259. If keycode = RightTiltKey Then
  260. Nudge 270, 2
  261. checktilt
  262. End If
  263.  
  264. If keycode = CenterTiltKey Then
  265. Nudge 0, 2
  266. checktilt
  267. End If
  268. if keycode = 46 then ' C Key
  269. If contball = 1 Then
  270. contball = 0
  271. Else
  272. contball = 1
  273. End If
  274. End If
  275. if keycode = 48 then 'B Key
  276. If bcboost = 1 Then
  277. bcboost = bcboostmulti
  278. Else
  279. bcboost = 1
  280. End If
  281. End If
  282. if keycode = 203 then bcleft = 1 ' Left Arrow
  283. if keycode = 200 then bcup = 1 ' Up Arrow
  284. if keycode = 208 then bcdown = 1 ' Down Arrow
  285. if keycode = 205 then bcright = 1 ' Right Arrow
  286. end if
  287. End Sub
  288.  
  289. Sub SuperStraight_KeyUp(ByVal keycode)
  290.  
  291. If keycode = PlungerKey Then
  292. Plunger.Fire
  293. PlaySound "plunger",0,1,0.25,0.25
  294. End If
  295.  
  296. If tilt=false and state=true then
  297. If keycode = LeftFlipperKey Then
  298. LeftFlipper.RotateToStart
  299. PlaySound SoundFXDOF("flipperdown",101,DOFOff,DOFFlippers), 0, 1, -0.05, 0.05
  300. StopSound "Buzz"
  301. End If
  302.  
  303. If keycode = RightFlipperKey Then
  304. RightFlipper.RotateToStart
  305. PlaySound SoundFXDOF("flipperdown",102,DOFOff,DOFFlippers), 0, 1, 0.05, 0.05
  306. StopSound "Buzz1"
  307. End If
  308. if keycode = 203 then bcleft = 0 ' Left Arrow
  309. if keycode = 200 then bcup = 0 ' Up Arrow
  310. if keycode = 208 then bcdown = 0 ' Down Arrow
  311. if keycode = 205 then bcright = 0 ' Right Arrow
  312. End if
  313. End Sub
  314.  
  315. Sub StartControl_Hit()
  316. Set ControlBall = ActiveBall
  317. contballinplay = true
  318. End Sub
  319.  
  320. Sub StopControl_Hit()
  321. contballinplay = false
  322. End Sub
  323.  
  324. Dim bcup, bcdown, bcleft, bcright, contball, contballinplay, ControlBall, bcboost
  325. Dim bcvel, bcyveloffset, bcboostmulti
  326.  
  327. bcboost = 1 'Do Not Change - default setting
  328. bcvel = 4 'Controls the speed of the ball movement
  329. bcyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  330. bcboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  331.  
  332. Sub BallControl_Timer()
  333. If Contball and ContBallInPlay then
  334. If bcright = 1 Then
  335. ControlBall.velx = bcvel*bcboost
  336. ElseIf bcleft = 1 Then
  337. ControlBall.velx = - bcvel*bcboost
  338. Else
  339. ControlBall.velx=0
  340. End If
  341.  
  342. If bcup = 1 Then
  343. ControlBall.vely = -bcvel*bcboost
  344. ElseIf bcdown = 1 Then
  345. ControlBall.vely = bcvel*bcboost
  346. Else
  347. ControlBall.vely= bcyveloffset
  348. End If
  349. End If
  350. End Sub
  351.  
  352. sub flippertimer_timer()
  353. LFlip.RotY = LeftFlipper.CurrentAngle
  354. RFlip.RotY = RightFlipper.CurrentAngle
  355. FlipperLSh.RotZ = LeftFlipper.currentangle
  356. FlipperRSh.RotZ = RightFlipper.currentangle
  357. end sub
  358.  
  359.  
  360. sub coindelay_timer
  361. addcredit
  362. coindelay.enabled=false
  363. end sub
  364.  
  365. sub resettimer_timer
  366. rst=rst+1
  367. for i = 1 to maxplayers
  368. sreels(i).resettozero
  369.  
  370. next
  371. If b2son then
  372. for i = 1 to maxplayers
  373. Controller.B2SSetScorePlayer i, score(i)
  374.  
  375. next
  376. End If
  377. if rst=18 then
  378. playsound "kickerkick"
  379. end if
  380. if rst=22 then
  381. newgame
  382. resettimer.enabled=false
  383. end if
  384. end sub
  385.  
  386. Sub addcredit
  387. credit=credit+1
  388. DOF 133, DOFOn
  389. if credit>15 then credit=15
  390. credittxt.setvalue(credit)
  391. If b2son Then Controller.B2ssetCredits Credit
  392. If credit=0 then light23.state=0 else light23.state=1
  393. End sub
  394.  
  395. Sub Drain_Hit()
  396. DOF 129, DOFPulse
  397. PlaySound "drain",0,1,0,0.25
  398. Drain.DestroyBall
  399. LTop1.state=0
  400. Ltop2.state=0
  401. LRinlane.state=0
  402. LLinlane.state=0
  403. LRightSP.state=0
  404. LLeftSP.state=0
  405. me.timerenabled=1
  406. End Sub
  407.  
  408. Sub Drain_timer
  409. scorebonus.enabled=true
  410. me.timerenabled=0
  411. End Sub
  412.  
  413. sub ballhome_hit
  414. ballrenabled=1
  415. end sub
  416.  
  417. sub ballhome_unhit
  418. DOF 134, DOFPulse
  419. end sub
  420.  
  421. sub ballrel_hit
  422. if ballrenabled=1 then
  423. Lshootagain.state=0
  424. ballrenabled=0
  425. end if
  426. end sub
  427.  
  428. sub ScoreBonus_timer
  429. if tilt=false and bonus>0 then
  430. if Lbonusx2.state=1 then
  431. dbonus=2
  432. me.interval=200
  433. else
  434. dbonus=1
  435. me.interval=125
  436. End if
  437. score(player)=score(player)+(1000*dbonus)
  438. sreels(player).addvalue(1000*dbonus)
  439. If B2SOn Then Controller.B2SSetScorePlayer player, score(player)
  440. If dbonus=2 Then
  441. PlaySound SoundFXDOF("bell2000",143,DOFPulse,DOFChimes)
  442. Else
  443. PlaySound SoundFXDOF("bell1000",143,DOFPulse,DOFChimes)
  444. End If
  445. checkreplay
  446. bonuslight(bonus).state=0
  447. bonus=bonus-1
  448. LABspin.state=bonus mod 2
  449. if bonus>0 then bonuslight(bonus).state=1
  450. else
  451. bonus=0
  452. for each light in bonuslights: light.state=0: next
  453. end if
  454. if bonus=0 then
  455. if Lshootagain.state=lightstateon then
  456. newball
  457. ballreltimer.enabled=true
  458. else
  459. if players=1 or player=players then
  460. player=1
  461. Else
  462. player=player+1
  463. end if
  464. If b2son then Controller.B2ssetplayerup 30, player
  465. for i = 1 to 4: Shoot(i).state=0: Next
  466. shoot(player).state=1
  467. nextball
  468. end if
  469. scorebonus.enabled=false
  470. end if
  471. End sub
  472.  
  473.  
  474. sub newgame
  475. bumper1.force=13
  476. bumper2.force=13
  477. bumper3.force=13
  478. resetDT
  479. player=1
  480. shoot(player).state=1
  481. ebcount=0
  482. for i = 1 to 4:
  483. score(i)=0
  484. next
  485. If b2son then
  486. for i = 1 to maxplayers
  487. Controller.B2SSetScorePlayer i, score(i)
  488. next
  489. End If
  490. eg=0
  491. rep=0
  492. for each light in bonuslights:light.state=0:next
  493. addbonus
  494. LRightSP.state=0
  495. Lleftsp.state=0
  496. LExtraBall.state=0
  497. Lshootagain.state=lightstateoff
  498. LTop1.state=1
  499. LRinlane.state=0
  500. LLinlane.state=0
  501. LRightSP.state=0
  502. LLeftSP.state=0
  503. for each light in bumperlights:light.state=0:next
  504. for each light in TGlights:light.state=1:next
  505. for each light in Cardlights:light.state=0:next
  506. gamov.text=" "
  507. tilttxt.text=" "
  508. If b2son then
  509. Controller.B2SSetGameOver 35,0
  510. Controller.B2SSetTilt 33,0
  511. Controller.B2SSetMatch 34,0
  512. End If
  513. biptext.text="1"
  514. matchtxt.text=" "
  515. BallRelease.CreateBall
  516. BallRelease.kick 135,4,0
  517. playsound SoundFXDOF("kickerkick",135,DOFPulse,DOFContactors)
  518. end sub
  519.  
  520. sub newball
  521. for each light in bumperlights:light.state=0:next
  522. for each light in TGlights:light.state=1:next
  523. for each light in Cardlights:light.state=0:next
  524. for each light in starlights:light.state=0:next
  525. for each light in BonusLights:light.state=0:next
  526. if ebcount=0 then
  527. resetDT
  528. end if
  529. addbonus
  530. Lextraball.state=0
  531. LBonusx2.state=0
  532. Lleftsp.state=0
  533. LTop1.state=1
  534. Primitive4.RotX=0
  535. Lgate.state=0
  536. LRsideout.state=0
  537. Lkicker.state=0
  538. gatewall.isdropped=False
  539. End Sub
  540.  
  541. Sub resetDT
  542. playsound SoundFXDOF("BankReset",114,DOFPulse,DOFContactors)
  543. for each objekt in droptargets: objekt.isdropped=false: Next
  544. for each light in TGlights:light.state=1:next
  545. end sub
  546.  
  547. sub nextball
  548. if tilt=true then
  549. bumper1.force=0
  550. bumper2.force=0
  551. bumper3.force=0
  552. tilt=false
  553. tilttxt.text=" "
  554. If b2son then
  555. Controller.B2SSetTilt 33,0
  556. Controller.B2ssetdata 1, 1
  557. End If
  558. end if
  559. ebcount=0
  560. for i = 1 to 4
  561.  
  562. next
  563. if player=1 then ballinplay=ballinplay+1
  564. if ballinplay>balls then
  565. playsound "GameOver"
  566. eg=1
  567. ballreltimer.enabled=true
  568. else
  569. if state=true and tilt=false then
  570. newball
  571. ballreltimer.enabled=true
  572. end if
  573. biptext.text=ballinplay
  574. If b2son then Controller.B2ssetballinplay 32, Ballinplay
  575. end if
  576. End Sub
  577.  
  578. sub ballreltimer_timer
  579. if eg=1 then
  580. turnoff
  581. matchnum
  582. biptext.text=" "
  583. state=false
  584. gamov.text="GAME OVER"
  585. for i=1 to maxplayers
  586. CanPlay(i).state=0
  587. Shoot(i).state=0
  588. if score(i)>hisc then hisc=score(i)
  589. next
  590. hstxt.text=hisc
  591. savehs
  592. If b2son then
  593. Controller.B2SSetGameOver 35,1
  594. Controller.B2ssetballinplay 32, 0
  595. Controller.B2sStartAnimation "EOGame"
  596. Controller.B2SSetScorePlayer 5, hisc
  597. Controller.B2ssetcanplay 31, 0
  598. Controller.B2ssetPlayerUp 30, 0
  599. End If
  600. else
  601. BallRelease.CreateBall
  602. BallRelease.kick 135,4,0
  603. playsound SoundFXDOF("kickerkick",135,DOFPulse,DOFContactors)
  604. end if
  605. ballreltimer.enabled=false
  606. end sub
  607. sub matchnum
  608. 'matchnumb=INT(RND*10)
  609. if matchnumb=0 then
  610. matchtxt.text="000"
  611. else
  612. matchtxt.text=matchnumb*100
  613. end if
  614. If b2son then
  615. If Matchnumb = 0 then
  616. Controller.B2sSetMatch 100
  617. else
  618. Controller.B2SSetMatch Matchnumb*10
  619. end if
  620. end if
  621. For i=1 to players
  622. if (matchnumb*100)=(score(i) mod 1000) then
  623. addcredit
  624. playsound SoundFXDOF("knock",130,DOFPulse,DOFKnocker)
  625. DOF 131,DOFPulse
  626. end if
  627. next
  628. end sub
  629.  
  630.  
  631. 'slings
  632. Dim LStep, RStep
  633.  
  634. Sub RSling_Slingshot
  635. PlaySound SoundFXDOF("Slingshot",104,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05
  636. DOF 106, DOFPulse
  637. addscore 100
  638. if LTop1.state=0 then
  639. LTop1.state=1
  640. LTop2.state=0
  641. else
  642. LTop1.state=0
  643. LTop2.state=1
  644. end if
  645. if LRinlane.state=1 then
  646. LRinlane.state=0
  647. LLinlane.state=1
  648. else
  649. if LLinlane.state=1 then
  650. LRinlane.state=1
  651. LLinlane.state=0
  652. end if
  653. end if
  654. if LRightSP.state=1 then
  655. LRightSP.state=0
  656. LLeftSP.state=1
  657. else
  658. if LLeftSP.state=1 then
  659. LRightSP.state=1
  660. LLeftSP.state=0
  661. end if
  662. end if
  663. RightSling3.Visible = 1
  664. Rightsling.visible=0
  665. SlingR.RotX = 26
  666. RStep = 0
  667. RSling.TimerEnabled = 1
  668. End Sub
  669.  
  670. Sub RSling_Timer
  671. Select Case RStep
  672. Case 1:RightSLing3.Visible = 0:RightSLing2.Visible = 1:SlingR.RotX = 14
  673. Case 2:RightSLing2.Visible = 0:RightSLing.Visible = 1:SlingL.RotX = 2
  674. Case 3:RightSling.visible = 1:SlingR.RotX = 10:RSling.TimerEnabled = 0
  675. End Select
  676. RStep = RStep + 1
  677. End Sub
  678.  
  679. Sub LSling_Slingshot
  680. PlaySound SoundFXDOF("Slingshot",103,DOFPulse,DOFContactors),0,1,-0.05,0.05
  681. DOF 105, DOFPulse
  682. addscore 100
  683. if LTop1.state=0 then
  684. LTop1.state=1
  685. LTop2.state=0
  686. else
  687. LTop1.state=0
  688. LTop2.state=1
  689. end if
  690. if LRinlane.state=1 then
  691. LRinlane.state=0
  692. LLinlane.state=1
  693. else
  694. if LLinlane.state=1 then
  695. LRinlane.state=1
  696. LLinlane.state=0
  697. end if
  698. end if
  699. if LRightSP.state=1 then
  700. LRightSP.state=0
  701. LLeftSP.state=1
  702. else
  703. if LLeftSP.state=1 then
  704. LRightSP.state=1
  705. LLeftSP.state=0
  706. end if
  707. end if
  708. LeftSling2.Visible = 1
  709. leftsling.visible=0
  710. SlingL.Rotx=26
  711. LStep = 0
  712. Lsling.TimerEnabled = 1
  713. End Sub
  714.  
  715. Sub LSling_Timer
  716. Select Case LStep
  717. Case 1:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:SlingL.RotX = 14
  718. Case 2:LeftSling2.Visible = 0:LeftSling.Visible= 1:SlingL.RotX = 2
  719. Case 3:LeftSLing.Visible = 1:SlingL.RotX = 10:LSling.TimerEnabled = 0
  720. End Select
  721.  
  722. LStep = LStep + 1
  723. End Sub
  724.  
  725.  
  726.  
  727. '********** Bumpers
  728.  
  729. Sub Bumper1_Hit
  730. if tilt=false then
  731. playsound SoundFXDOF("fx_bumper4",107,DOFPulse,DOFContactors)
  732. DOF 108,DOFPulse
  733. addscore bumperoffscore
  734. me.timerenabled=1
  735. end if
  736. End Sub
  737.  
  738. Sub Bumper1_timer
  739. Bumper1Ring.Enabled=0
  740. BumperRing1.transz=BumperRing1.transz-4
  741. if BumperRing1.transz=-36 then
  742. Bumper1Ring.enabled=1
  743. me.timerenabled=0
  744. end if
  745. End Sub
  746.  
  747. Sub Bumper1Ring_timer
  748. BumperRing1.transz=BumperRing1.transz+4
  749. If BumperRing1.transz=0 then Bumper1Ring.enabled=0
  750. End sub
  751.  
  752.  
  753. Sub Bumper2_Hit
  754. if tilt=false then
  755. playsound SoundFXDOF("fx_bumper4",111,DOFPulse,DOFContactors)
  756. DOF 112,DOFPulse
  757. if bumper2light.state=1 then
  758. addscore bumperlitscore
  759. else
  760. addscore bumperoffscore
  761. end if
  762. me.timerenabled=1
  763. end if
  764. End Sub
  765.  
  766. Sub Bumper2_timer
  767. Bumper2Ring.enabled=0
  768. BumperRing2.transz=BumperRing2.transz-4
  769. if BumperRing2.transz=-36 then
  770. Bumper2Ring.enabled=1
  771. me.timerenabled=0
  772. end if
  773. End Sub
  774.  
  775. Sub Bumper2Ring_timer
  776. BumperRing2.transz=BumperRing2.transz+4
  777. If BumperRing2.transz=0 then Bumper2Ring.enabled=0
  778. End sub
  779.  
  780. Sub Bumper3_Hit
  781. if tilt=false then
  782. playsound SoundFXDOF("fx_bumper4",109,DOFPulse,DOFContactors)
  783. DOF 110,DOFPulse
  784. if bumper3light.state=1 then
  785. addscore bumperlitscore
  786. else
  787. addscore bumperoffscore
  788. end if
  789. me.timerenabled=1
  790. end if
  791. End Sub
  792.  
  793. Sub Bumper3_timer
  794. Bumper3Ring.enabled=0
  795. BumperRing3.transz=BumperRing3.transz-4
  796. if BumperRing3.transz=-36 then
  797. Bumper3Ring.enabled=1
  798. me.timerenabled=0
  799. end if
  800. End Sub
  801.  
  802. Sub Bumper3Ring_timer
  803. BumperRing3.transz=BumperRing3.transz+4
  804. If BumperRing3.transz=0 then Bumper3Ring.enabled=0
  805. End sub
  806.  
  807. 'Dingwalls
  808.  
  809. Sub DW1_Hit
  810. If tilt=False Then
  811. addscore 100
  812. LRsideout.state=1
  813. if LTop1.state=0 and LTop2.state=1 then
  814. LTop1.state=1
  815. LTop2.state=0
  816. else
  817. LTop1.state=0
  818. LTop2.state=1
  819. end if
  820. if LRinlane.state=1 then
  821. LRinlane.state=0
  822. LLinlane.state=1
  823. else
  824. if LLinlane.state=1 then
  825. LRinlane.state=1
  826. LLinlane.state=0
  827. end if
  828. end if
  829. if LRightSP.state=1 then
  830. LRightSP.state=0
  831. LLeftSP.state=1
  832. else
  833. if LLeftSP.state=1 then
  834. LRightSP.state=1
  835. LLeftSP.state=0
  836. end if
  837. end if
  838. end if
  839. end sub
  840.  
  841. Sub DW2_hit
  842. If tilt=False Then
  843. addscore 100
  844. if LTop1.state=0 and LTop2.state=1 then
  845. LTop1.state=1
  846. LTop2.state=0
  847. else
  848. LTop1.state=0
  849. LTop2.state=1
  850. end if
  851. if LRinlane.state=1 then
  852. LRinlane.state=0
  853. LLinlane.state=1
  854. else
  855. if LLinlane.state=1 then
  856. LRinlane.state=1
  857. LLinlane.state=0
  858. end if
  859. end if
  860. if LRightSP.state=1 then
  861. LRightSP.state=0
  862. LLeftSP.state=1
  863. else
  864. if LLeftSP.state=1 then
  865. LRightSP.state=1
  866. LLeftSP.state=0
  867. end if
  868. end if
  869. end if
  870. end Sub
  871. Sub DW3_hit
  872. If tilt=False Then
  873. addscore 100
  874. if LTop1.state=0 and LTop2.state=1 then
  875. LTop1.state=1
  876. LTop2.state=0
  877. else
  878. LTop1.state=0
  879. LTop2.state=1
  880. end if
  881. if LRinlane.state=1 then
  882. LRinlane.state=0
  883. LLinlane.state=1
  884. else
  885. if LLinlane.state=1 then
  886. LRinlane.state=1
  887. LLinlane.state=0
  888. end if
  889. end if
  890. if LRightSP.state=1 then
  891. LRightSP.state=0
  892. LLeftSP.state=1
  893. else
  894. if LLeftSP.state=1 then
  895. LRightSP.state=1
  896. LLeftSP.state=0
  897. end if
  898. end if
  899. end if
  900. end sub
  901.  
  902. sub TopHole_hit
  903. if Lkicker.state=1 then
  904. scorebonus1.enabled=true
  905. else
  906. addscore 5000
  907. addbonus
  908. Pkickarm.rotz=15
  909. me.timerenabled=1
  910. end if
  911. end sub
  912.  
  913. Sub TopHole_timer
  914. TopHole.Kick 135, 20 + (3*rnd())
  915. playsound SoundFXDOF("ballrelease",132,DOFPulse,DOFContactors),0,1,0,0.25
  916. DOF 131, DOFPulse
  917. Pkickarm.rotz=0
  918. me.timerenabled=0
  919. End Sub
  920.  
  921. sub ScoreBonus1_timer
  922. if tilt=false and bonus>0 then
  923. if Lbonusx2.state=1 then
  924. dbonus=2
  925. me.interval=200
  926. else
  927. dbonus=1
  928. me.interval=125
  929. End if
  930. score(player)=score(player)+(1000*dbonus)
  931. sreels(player).addvalue(1000*dbonus)
  932. If B2SOn Then Controller.B2SSetScorePlayer player, score(player)
  933. If dbonus=2 Then
  934. PlaySound SoundFXDOF("bell2000",143,DOFPulse,DOFChimes)
  935. Else
  936. PlaySound SoundFXDOF("bell1000",143,DOFPulse,DOFChimes)
  937. End If
  938. bonuslight(bonus).state=0
  939. bonus=bonus-1
  940. LABspin.state=bonus mod 2
  941. if bonus>0 then bonuslight(bonus).state=1
  942. else
  943. bonus=0
  944. scorebonus1.enabled=false
  945. TopHole.timerenabled=true
  946. LSpin.state=0
  947. end if
  948.  
  949. End sub
  950.  
  951.  
  952. sub Kicker1_hit
  953. if LRsideout.state=1 Then
  954. addscore 5000
  955. addbonus
  956. End If
  957. if LExtraball.state=1 Then
  958. LExtraball.state=0
  959. LShootAgain.state=1
  960. End if
  961. me.timerenabled=1
  962. end sub
  963.  
  964. sub Kicker1_timer
  965. Kicker1.kick 20, 40 + (3*rnd())
  966. playsound SoundFXDOF("HoleKick",139,DOFPulse,DOFContactors),0,1,0,0.25
  967. DOF 131, DOFPulse
  968. me.timerenabled=0
  969. end sub
  970. '****** Wire Triggers
  971.  
  972. Sub Toplane1_Hit
  973. if tilt=false then
  974. DOF 115,DOFPulse
  975. LRsideout.state=1
  976. if LTop1.state=1 then
  977. addscore 1000
  978. addbonus
  979. else
  980. addscore 1000
  981. end if
  982. end if
  983. End Sub
  984.  
  985. Sub Toplane2_Hit
  986. if tilt=false then
  987. DOF 116,DOFPulse
  988. addscore 1000
  989. addbonus
  990. LRsideout.state=1
  991. end if
  992. End Sub
  993.  
  994. Sub Toplane3_Hit
  995. if tilt=false then
  996. DOF 117,DOFPulse
  997. LRsideout.state=1
  998. if LTop2.state=1 then
  999. addscore 1000
  1000. addbonus
  1001. else
  1002. addscore 1000
  1003. end if
  1004. end if
  1005. End Sub
  1006.  
  1007. Sub shooterlane_Hit
  1008. if tilt=false then
  1009. if Lgate.state=1 then
  1010. addscore 10000
  1011. Lgate.state=0
  1012. Primitive4.RotX=0
  1013. gatewall.isdropped=false
  1014. end if
  1015. end if
  1016. End Sub
  1017.  
  1018. Sub LeftOutlane_Hit
  1019. if tilt=false then
  1020. DOF 124,DOFPulse
  1021. if LLeftSP.state=1 then
  1022. playsound SoundFXDOF("knock",130,DOFPulse,DOFKnocker)
  1023. DOF 131,DOFPulse
  1024. addcredit
  1025. else
  1026. addscore 10000
  1027. addbonus
  1028. end if
  1029. end if
  1030. End Sub
  1031.  
  1032. Sub LeftInlane_Hit
  1033. if tilt=false then
  1034. DOF 125,DOFPulse
  1035. if LLinlane.state=1 then
  1036. addscore 5000
  1037. addbonus
  1038. LBonusx2.state=1
  1039. else
  1040. addscore 5000
  1041. addbonus
  1042. end if
  1043. end if
  1044. End Sub
  1045.  
  1046. Sub RightInlane_Hit
  1047. if tilt=false then
  1048. DOF 126,DOFPulse
  1049. if LRinlane.state=1 then
  1050. addscore 5000
  1051. addbonus
  1052. LBonusx2.State=1
  1053. else
  1054. addscore 5000
  1055. addbonus
  1056. end if
  1057. end if
  1058. End Sub
  1059.  
  1060. Sub RightOutlane_Hit
  1061. if tilt=false then
  1062. DOF 127,DOFPulse
  1063. if LRightSP.state=1 then
  1064. playsound SoundFXDOF("knock",130,DOFPulse,DOFKnocker)
  1065. DOF 131,DOFPulse
  1066. addcredit
  1067. else
  1068. addscore 10000
  1069. addbonus
  1070. end if
  1071. end if
  1072. End Sub
  1073.  
  1074. '**** Rollovers
  1075.  
  1076. Sub Rollover1_Hit
  1077. if tilt=false then
  1078. if Lroll1.state=1 then
  1079. addscore 1000
  1080. LRsideout.state=1
  1081. else
  1082. addscore 100
  1083. LRsideout.state=1
  1084. end if
  1085. end if
  1086. end sub
  1087.  
  1088. Sub Rollover2_Hit
  1089. if tilt=false then
  1090. if Lroll2.state=1 then
  1091. addscore 1000
  1092. else
  1093. addscore 100
  1094. end if
  1095. end if
  1096. end sub
  1097.  
  1098. Sub Rollover3_Hit
  1099. if tilt=false then
  1100. if Lroll3.state=1 then
  1101. addscore 1000
  1102. else
  1103. addscore 100
  1104. end if
  1105. end if
  1106. end sub
  1107.  
  1108. Sub spinner1_spin
  1109. if tilt=False Then
  1110. DOF 119, DOFPulse
  1111. PlaySound "fx_spinner",0,.25,0,0.25
  1112. if lspin.state=1 Then
  1113. addscore 1000
  1114. Else
  1115. addscore 100
  1116. If LABspin.State=1 Then
  1117. LABspin.state=0
  1118. addbonus
  1119. End If
  1120. end If
  1121. end if
  1122. end Sub
  1123.  
  1124. ' Targets
  1125. Sub Tg1_Hit
  1126. playsound SoundFXDOF("target",120,DOFPulse,DOFContactors)
  1127. If LTg1a.state=0 Then
  1128. addscore 1000
  1129. else
  1130. LTg1a.state=0
  1131. Ltg1b.State=1
  1132. addscore 1000
  1133. if LTg4b.state=1 and LTg3b.State=1 and LTg7b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1134. end if
  1135. if ltg5b.state=1 then
  1136. for each light in bumperlights:light.state=1:Next
  1137. end If
  1138. 'if LTg4b.state=1 and LTg3b.State=1 and LTg7b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1139. End Sub
  1140.  
  1141. Sub Tg2_Hit
  1142. playsound SoundFXDOF("drop1",120,DOFPulse,DOFContactors)
  1143. If Ltg2a.state=0 then
  1144. addscore 1000
  1145. else
  1146. Ltg2a.state=0
  1147. LTg2b.State=1
  1148. addscore 1000
  1149. if LTg5b.state=1 and LTg3b.State=1 and LTg6b.state=1 and Ldrop1.state=1 Then LExtraBall.state=1
  1150. end if
  1151. if LTg4b.state=1 then Lkicker.state=1
  1152. 'if LTg5b.state=1 and LTg3b.State=1 and LTg6b.state=1 and Ldrop1.state=1 Then LExtraBall.state=1
  1153. End Sub
  1154.  
  1155. Sub Tg3_Hit
  1156. playsound SoundFXDOF("drop1",120,DOFPulse,DOFContactors)
  1157. If LTg3a.state=0 Then
  1158. addscore 1000
  1159. else
  1160. LTg3a.state=0
  1161. LTg3b.state=1
  1162. addscore 1000
  1163. if LTg1b.state=1 and LTg4b.State=1 and LTg7b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1164. end if
  1165. For each light in starlights:light.State = 1:next
  1166. if LTg5b.state=1 and LTg2b.State=1 and LTg6b.state=1 and Ldrop1.state=1 Then LExtraBall.state=1
  1167. 'if LTg1b.state=1 and LTg4b.State=1 and LTg7b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1168. End Sub
  1169.  
  1170. Sub Tg4_Hit
  1171. playsound SoundFXDOF("drop1",120,DOFPulse,DOFContactors)
  1172. if LTg4a.state=0 Then
  1173. addscore 1000
  1174. else
  1175. LTg4a.state=0
  1176. LTg4b.state=1
  1177. addscore 1000
  1178. if LTg1b.state=1 and LTg3b.State=1 and LTg7b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1179. end if
  1180. if LTg2b.state=1 then Lkicker.state=1
  1181. 'if LTg1b.state=1 and LTg3b.State=1 and LTg7b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1182. End Sub
  1183.  
  1184. Sub Tg5_Hit
  1185. playsound SoundFXDOF("drop1",120,DOFPulse,DOFContactors)
  1186. if LTg5a.state=0 Then
  1187. addscore 1000
  1188. else
  1189. LTg5a.state=0
  1190. Ltg5b.state=1
  1191. addscore 1000
  1192. if LTg2b.state=1 and LTg3b.State=1 and LTg6b.state=1 and Ldrop1.state=1 Then LExtraBall.state=1
  1193. end if
  1194. if ltg1b.state=1 then
  1195. for each light in bumperlights:light.state=1:Next
  1196. end if
  1197. 'if LTg2b.state=1 and LTg3b.State=1 and LTg6b.state=1 and Ldrop1.state=1 Then LExtraBall.state=1
  1198. End Sub
  1199.  
  1200. Sub Tg6_Hit
  1201. playsound SoundFXDOF("drop1",121,DOFPulse,DOFContactors)
  1202. If LTg6a.state=0 then
  1203. addscore 1000
  1204. else
  1205. LTg6a.state=0
  1206. Ltg6b.state=1
  1207. addscore 1000
  1208. if LShootAgain.state=0 and LTg5b.state=1 and LTg2b.State=1 and LTg3b.state=1 and Ldrop1.state=1 Then LExtraBall.state=1
  1209. if Ltg7b.state=1 Then
  1210. Primitive4.RotX=60
  1211. gatewall.isdropped=true
  1212. Lgate.state=1
  1213. end if
  1214. end if
  1215. 'if LShootAgain.state=0 and LTg5b.state=1 and LTg2b.State=1 and LTg3b.state=1 and Ldrop1.state=1 Then LExtraBall.state=1
  1216. End Sub
  1217.  
  1218. Sub Tg7_Hit
  1219. Playsound SoundFXDOF("drop1",121,DOFPulse,DOFContactors)
  1220. if LTg7a.state=0 then
  1221. addscore 1000
  1222. else
  1223. LTg7a.state=0
  1224. Ltg7b.state=1
  1225. addscore 1000
  1226. if LTg1b.state=1 and LTg4b.State=1 and LTg3b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1227. if Ltg6b.state=1 Then
  1228. Primitive4.RotX=60
  1229. gatewall.isdropped=true
  1230. Lgate.state=1
  1231. end if
  1232. end if
  1233. 'if LTg1b.state=1 and LTg4b.State=1 and LTg3b.state=1 and Ldrop2.state=1 Then LRightSP.state=1
  1234.  
  1235.  
  1236. End Sub
  1237.  
  1238. '**** Drop Targets
  1239. Sub Drop1_Hit
  1240. If Ldrop2.state=1 then LRinlane.state=1
  1241. if LTg5b.state=1 and LTg2b.State=1 and LTg3b.state=1 and LTg6b.state=1 then LExtraBall.state=1
  1242. playsound SoundFXDOF("drop1",113,DOFPulse,DOFContactors)
  1243. addscore 10000
  1244. Ldrop1.state=1
  1245.  
  1246. End Sub
  1247.  
  1248. Sub Drop2_Hit
  1249. If Ldrop1.state=1 then LRinlane.state=1
  1250. if LTg1b.state=1 and LTg4b.State=1 and LTg3b.state=1 and LTg7b.state=1 Then LRightSP.state=1
  1251. playsound SoundFXDOF("drop1",113,DOFPulse,DOFContactors)
  1252. addscore 10000
  1253. Ldrop2.state=1
  1254.  
  1255. End Sub
  1256.  
  1257.  
  1258. sub addscore(points)
  1259. if tilt=false then
  1260. if points=100 then
  1261. matchnumb=matchnumb+1
  1262. if matchnumb>9 then matchnumb=0
  1263. end if
  1264. If Points < 1000 and AddScore100Timer.enabled = false Then
  1265. Add100 = Points \ 100
  1266. AddScore100Timer.Enabled = TRUE
  1267. ElseIf Points < 10000 and AddScore1000Timer.enabled = false Then
  1268. Add1000 = Points \ 1000
  1269. AddScore1000Timer.Enabled = TRUE
  1270. ElseIf AddScore10000Timer.enabled = false Then
  1271. Add10000 = Points \ 10000
  1272. AddScore10000Timer.Enabled = TRUE
  1273. End If
  1274. end if
  1275. End Sub
  1276.  
  1277.  
  1278.  
  1279. Sub AddScore100Timer_Timer()
  1280. if Add100 > 0 then
  1281. AddPoints 100
  1282. Add100 = Add100 - 1
  1283. Else
  1284. Me.Enabled = FALSE
  1285. End If
  1286. End Sub
  1287.  
  1288. Sub AddScore1000Timer_Timer()
  1289. if Add1000 > 0 then
  1290. AddPoints 1000
  1291. Add1000 = Add1000 - 1
  1292. Else
  1293. Me.Enabled = FALSE
  1294. End If
  1295. End Sub
  1296.  
  1297. Sub AddScore10000Timer_Timer()
  1298. if Add10000 > 0 then
  1299. AddPoints 10000
  1300. Add10000 = Add10000 - 1
  1301. Else
  1302. Me.Enabled = FALSE
  1303. End If
  1304. End Sub
  1305.  
  1306. Sub AddPoints(Points)
  1307. score(player)=score(player)+points
  1308. sreels(player).addvalue(points)
  1309. If B2SOn Then Controller.B2SSetScorePlayer player, score(player)
  1310.  
  1311. ' Sounds: there are 3 sounds: tens, hundreds and thousands
  1312. If Points = 1000 AND(Score(player) MOD 100) \ 1000 = 0 Then
  1313. PlaySound SoundFXDOF("bell1000",143,DOFPulse,DOFChimes)
  1314. ElseIf Points = 100 AND(Score(player) MOD 100) \ 100 = 0 Then
  1315. PlaySound SoundFXDOF("bell100",142,DOFPulse,DOFChimes)
  1316. ElseIf points = 10000 Then
  1317. PlaySound SoundFXDOF("bell1000",143,DOFPulse,DOFChimes)
  1318. elseif Points = 1000 Then
  1319. PlaySound SoundFXDOF("bell100",142,DOFPulse,DOFChimes)
  1320. Else
  1321. PlaySound SoundFXDOF("bell10",141,DOFPulse,DOFChimes)
  1322.  
  1323. End If
  1324. checkreplay
  1325. end sub
  1326.  
  1327. sub checkreplay
  1328.  
  1329. if score(player)=>replay1 and rep=0 then
  1330. playsound SoundFXDOF("knock",130,DOFPulse,DOFKnocker)
  1331. DOF 131,DOFPulse
  1332. addcredit
  1333. rep=1
  1334. end if
  1335. if score(player)=>replay2 and rep=1 then
  1336. playsound SoundFXDOF("knock",130,DOFPulse,DOFKnocker)
  1337. DOF 131,DOFPulse
  1338. addcredit
  1339. rep=2
  1340. end if
  1341.  
  1342. end sub
  1343.  
  1344. Sub CheckTilt
  1345. If Tilttimer.Enabled = True Then
  1346. TiltSens = TiltSens + 1
  1347. if TiltSens = 3 Then
  1348. Tilt = True
  1349. tilttxt.text="TILT"
  1350. If b2son Then Controller.B2SSetTilt 33,1
  1351. If b2son Then Controller.B2ssetdata 1, 0
  1352. playsound "tilt"
  1353. turnoff
  1354. End If
  1355. Else
  1356. TiltSens = 0
  1357. Tilttimer.Enabled = True
  1358. End If
  1359. End Sub
  1360.  
  1361. Sub Tilttimer_Timer()
  1362. Tilttimer.Enabled = False
  1363. End Sub
  1364.  
  1365. sub turnoff
  1366. bumper1.force=0
  1367. bumper2.force=0
  1368. LeftFlipper.RotateToStart
  1369. DOF 101, DOFOff
  1370. StopSound "Buzz"
  1371. RightFlipper.RotateToStart
  1372. DOF 102, DOFOff
  1373. StopSound "Buzz1"
  1374. end sub
  1375.  
  1376.  
  1377. Sub addbonus
  1378. bonus=bonus+1
  1379. if bonus > 10 then bonus = 10
  1380. Bonuslight(bonus).state=1
  1381. LABspin.state=bonus mod 2
  1382. LSpin.state=bonus10.state
  1383. if bonus>1 then Bonuslight(bonus-1).state=0
  1384. if bonus>10 then Bonuslight(10).state=1
  1385. End sub
  1386.  
  1387. ' *********************************************************************
  1388. ' Supporting Ball & Sound Functions
  1389. ' *********************************************************************
  1390.  
  1391. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1392. Vol = Csng(BallVel(ball) ^2 / 500)
  1393. End Function
  1394.  
  1395. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1396. Dim tmp
  1397. tmp = ball.x * 2 / SuperStraight.width-1
  1398. If tmp > 0 Then
  1399. Pan = Csng(tmp ^10)
  1400. Else
  1401. Pan = Csng(-((- tmp) ^10) )
  1402. End If
  1403. End Function
  1404.  
  1405. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1406. Pitch = BallVel(ball) * 20
  1407. End Function
  1408.  
  1409. Function BallVel(ball) 'Calculates the ball speed
  1410. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1411. End Function
  1412.  
  1413. '*****************************************
  1414. ' JP's VP10 Rolling Sounds
  1415. '*****************************************
  1416.  
  1417. Const tnob = 2 ' total number of balls
  1418. ReDim rolling(tnob)
  1419. InitRolling
  1420.  
  1421. Sub InitRolling
  1422. Dim i
  1423. For i = 0 to tnob
  1424. rolling(i) = False
  1425. Next
  1426. End Sub
  1427.  
  1428. Sub RollingTimer_Timer()
  1429. Dim BOT, b
  1430. BOT = GetBalls
  1431.  
  1432. ' stop the sound of deleted balls
  1433. For b = UBound(BOT) + 1 to tnob
  1434. rolling(b) = False
  1435. StopSound("fx_ballrolling" & b)
  1436. Next
  1437.  
  1438. ' exit the sub if no balls on the table
  1439. If UBound(BOT) = -1 Then Exit Sub
  1440.  
  1441. ' play the rolling sound for each ball
  1442. For b = 0 to UBound(BOT)
  1443. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  1444. rolling(b) = True
  1445. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1446. Else
  1447. If rolling(b) = True Then
  1448. StopSound("fx_ballrolling" & b)
  1449. rolling(b) = False
  1450. End If
  1451. End If
  1452. Next
  1453. End Sub
  1454.  
  1455. '**********************
  1456. ' Ball Collision Sound
  1457. '**********************
  1458.  
  1459. Sub OnBallBallCollision(ball1, ball2, velocity)
  1460. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  1461. End Sub
  1462.  
  1463. '*****************************************
  1464. ' BALL SHADOW
  1465. '*****************************************
  1466. Dim BallShadow
  1467. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  1468.  
  1469. Sub BallShadowUpdate_timer()
  1470. Dim BOT, b
  1471. BOT = GetBalls
  1472. ' hide shadow of deleted balls
  1473. If UBound(BOT)<(tnob-1) Then
  1474. For b = (UBound(BOT) + 1) to (tnob-1)
  1475. BallShadow(b).visible = 0
  1476. Next
  1477. End If
  1478. ' exit the Sub if no balls on the table
  1479. If UBound(BOT) = -1 Then Exit Sub
  1480. ' render the shadow for each ball
  1481. For b = 0 to UBound(BOT)
  1482. If BOT(b).X < SuperStraight.Width/2 Then
  1483. BallShadow(b).X = ((BOT(b).X) - (Ballsize/16) + ((BOT(b).X - (SuperStraight.Width/2))/17))' + 13
  1484. Else
  1485. BallShadow(b).X = ((BOT(b).X) + (Ballsize/16) + ((BOT(b).X - (SuperStraight.Width/2))/17))' - 13
  1486. End If
  1487. ballShadow(b).Y = BOT(b).Y + 10
  1488. If BOT(b).Z > 20 Then
  1489. BallShadow(b).visible = 1
  1490. Else
  1491. BallShadow(b).visible = 0
  1492. End If
  1493. Next
  1494. End Sub
  1495.  
  1496. '************************************
  1497. ' What you need to add to your table
  1498. '************************************
  1499.  
  1500. ' a timer called RollingTimer. With a fast interval, like 10
  1501. ' one collision sound, in this script is called fx_collide
  1502. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  1503. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  1504.  
  1505.  
  1506. '******************************************
  1507. ' Explanation of the rolling sound routine
  1508. '******************************************
  1509.  
  1510. ' sounds are played based on the ball speed and position
  1511.  
  1512. ' the routine checks first for deleted balls and stops the rolling sound.
  1513.  
  1514. ' The For loop goes through all the balls on the table and checks for the ball speed and
  1515. ' if the ball is on the table (height lower than 30) then then it plays the sound
  1516. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  1517.  
  1518. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  1519. ' will change according to the ball speed, and the PAN function will change the stereo position according
  1520. ' to the position of the ball on the table.
  1521.  
  1522.  
  1523. '**************************************
  1524. ' Explanation of the collision routine
  1525. '**************************************
  1526.  
  1527. ' The collision is built in VP.
  1528. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  1529. ' 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
  1530. ' depending of the speed of the collision.
  1531.  
  1532.  
  1533. Sub Metals_Thin_Hit (idx)
  1534. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1535. End Sub
  1536.  
  1537. Sub Metals_Medium_Hit (idx)
  1538. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1539. End Sub
  1540.  
  1541. Sub Metals2_Hit (idx)
  1542. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1543. End Sub
  1544.  
  1545. Sub Gates_Hit (idx)
  1546. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1547. End Sub
  1548.  
  1549. Sub Rubbers_Hit(idx)
  1550. dim finalspeed
  1551. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1552. If finalspeed > 20 then
  1553. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1554. End if
  1555. If finalspeed >= 6 AND finalspeed <= 20 then
  1556. RandomSoundRubber()
  1557. End If
  1558. End Sub
  1559.  
  1560. Sub RubberWheel_Hit()
  1561. dim finalspeed
  1562. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1563. If finalspeed > 20 then
  1564. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1565. End if
  1566. If finalspeed >= 6 AND finalspeed <= 20 then
  1567. RandomSoundRubber()
  1568. End If
  1569. End Sub
  1570.  
  1571. Sub Posts_Hit(idx)
  1572. dim finalspeed
  1573. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1574. If finalspeed > 16 then
  1575. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1576. End if
  1577. If finalspeed >= 6 AND finalspeed <= 16 then
  1578. RandomSoundRubber()
  1579. End If
  1580. End Sub
  1581.  
  1582. Sub RandomSoundRubber()
  1583. Select Case Int(Rnd*3)+1
  1584. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1585. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1586. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1587. End Select
  1588. End Sub
  1589.  
  1590. Sub LeftFlipper_Collide(parm)
  1591. RandomSoundFlipper()
  1592. End Sub
  1593.  
  1594. Sub RightFlipper_Collide(parm)
  1595. RandomSoundFlipper()
  1596. End Sub
  1597.  
  1598. Sub RandomSoundFlipper()
  1599. Select Case Int(Rnd*3)+1
  1600. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1601. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1602. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1603. End Select
  1604. End Sub
  1605.  
  1606. sub savehs
  1607.  
  1608. savevalue "SuperStraight", "credit", credit
  1609. savevalue "SuperStraight", "hiscore", hisc
  1610. savevalue "SuperStraight", "match", matchnumb
  1611. savevalue "SuperStraight", "score1", score(1)
  1612. savevalue "SuperStraight", "score2", score(2)
  1613. savevalue "SuperStraight", "score3", score(3)
  1614. savevalue "SuperStraight", "score4", score(4)
  1615. savevalue "SuperStraight", "replays", replays
  1616. savevalue "SuperStraight", "balls", balls
  1617.  
  1618. end sub
  1619.  
  1620. sub loadhs
  1621. dim temp
  1622. temp = LoadValue("SuperStraight", "credit")
  1623. If (temp <> "") then credit = CDbl(temp)
  1624. temp = LoadValue("SuperStraight", "hiscore")
  1625. If (temp <> "") then hisc = CDbl(temp)
  1626. temp = LoadValue("SuperStraight", "match")
  1627. If (temp <> "") then matchnumb = CDbl(temp)
  1628. temp = LoadValue("SuperStraight", "score1")
  1629. If (temp <> "") then score(1) = CDbl(temp)
  1630. temp = LoadValue("SuperStraight", "score2")
  1631. If (temp <> "") then score(2) = CDbl(temp)
  1632. temp = LoadValue("SuperStraight", "score3")
  1633. If (temp <> "") then score(3) = CDbl(temp)
  1634. temp = LoadValue("SuperStraight", "score4")
  1635. If (temp <> "") then score(4) = CDbl(temp)
  1636. temp = LoadValue("SuperStraight", "replays")
  1637. If (temp <> "") then replays = CDbl(temp)
  1638. temp = LoadValue("SuperStraight", "balls")
  1639. If (temp <> "") then balls = CDbl(temp)
  1640. end sub
  1641.  
  1642. Sub SuperStraight_Exit()
  1643. turnoff
  1644. Savehs
  1645. If B2SOn Then Controller.stop
  1646. End Sub
Advertisement
Add Comment
Please, Sign In to add comment