Arngrim

Untitled

Nov 15th, 2017
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.88 KB | None | 0 0
  1. 'JPJ Chercher RSP et LSP
  2.  
  3. Const cGameName = "contest_1958"
  4.  
  5. Dim Score(4)
  6. dim truesc(4)
  7. dim ballrelenabled
  8. dim activeballs
  9. dim state
  10. dim playno
  11. dim credit
  12. dim eg
  13. dim currpl
  14. dim play(4)
  15. dim rst
  16. dim ballinplay
  17. dim tilt
  18. dim tiltsens
  19. dim rep(4)
  20. dim plm(4)
  21. dim matchnumb
  22. dim cred
  23. dim scn
  24. dim scn1
  25. dim scn2
  26. dim scn3
  27. dim points
  28. dim tempscore
  29. dim replay1
  30. dim replay2
  31. dim replay3
  32. dim replay4
  33. dim hisc
  34. dim pltilt(4)
  35. dim motion
  36. dim rv
  37. dim rt
  38. dim rt1
  39. dim tt
  40. dim rsv 'Rotor initial score value without multiply
  41. dim ylv
  42. dim rstep, rstepb, rstepc, rstepd, rstepe, lstep, lstepb, lstepc, lstepd, lstepe
  43. dim BallRadius, BallMass, cball1
  44. dim LaunchBall
  45. dim automatic
  46. dim rotorR, rotation
  47. dim wheelprice, rotationupdate
  48. dim c, a
  49. dim EMR(4)
  50. dim GL, bumpT, bumpB 'state of gi left and right and high bumper states
  51. DIM HZ 'Hit Zone for the gates to provide double hits
  52. dim b2svarlightA, b2svarlightB, b2sSunL, b2sSunR
  53. Dim GlobalSoundLevel 'Diner's Method for amplify mechanical sounds, thanks to them :
  54.  
  55. GlobalSoundLevel = 2
  56.  
  57. GL="L"
  58. bumpT=0
  59. bumpB=0
  60.  
  61. credit = 0
  62.  
  63. On Error Resume Next
  64. ExecuteGlobal GetTextFile("controller.vbs")
  65. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  66. On Error Goto 0
  67.  
  68. ' ExecuteGlobal GetTextFile("core.vbs")
  69.  
  70. sub table1_init
  71. LoadEM
  72. If ShowDT=false Then
  73. for each obj in DTItems
  74. obj.visible=False
  75. Next
  76. end If
  77.  
  78. '***********************************************************************
  79. '*** Automatic launch ball or not, if not use the RightMagnaSave Key ***
  80. '*** 0 = RightMagnaSave Key - 1 = automatic ***
  81. '***********************************************************************
  82. automatic = 1 '***
  83. '***********************************************************************
  84.  
  85. '***********************************************************************
  86. rm.enabled = 1 '********* JPJ Reflection mod *******************
  87. '***********************************************************************
  88. Scoreb2s.enabled = 1 '*** Activation of the Score sync on the b2s **
  89. '***********************************************************************
  90.  
  91. set EMR(1)=score1
  92. set EMR(2)=score2
  93. set EMR(3)=score3
  94. set EMR(4)=score4
  95. if credit="" then
  96. credit=0
  97. end If
  98. credittxt.text=credit
  99. If credit > 0 Then DOF 119, DOFOn
  100. GL="L"
  101. GILeft.enabled = 1
  102.  
  103.  
  104. BallRadius = 25
  105. BallMass = 2.5
  106. bouton01.z=2.5
  107. bouton01f.z=2.5
  108. bouton02.z=2.5
  109. bouton02f.z=2.5
  110. bouton03.z=2.5
  111. bouton03f.z=2.5
  112. rotorR=Wheel.objroty
  113. Wheelprice = 10
  114. c=0
  115.  
  116. randomize
  117. replay1=995
  118. replay2=1300
  119. replay3=1700
  120. replay4=1850
  121. r1.text=replay1
  122. r2.text=replay2
  123. r3.text=replay3
  124. r4.text=replay4
  125.  
  126. for each obj in droppers
  127. obj.isdropped=true
  128. next
  129.  
  130. loadhs
  131.  
  132. if hisc="" then hisc=1000
  133. hstxt.text=hisc
  134. if credit="" then credit=0
  135. credittxt.text=credit
  136. if B2SOn then
  137. Scoreb2s.enabled =1
  138. end If
  139. if matchnumb="" then matchnumb=int(rnd(1)*9)
  140. match(matchnumb).text=matchnumb
  141. for i=0 to 3
  142. currpl=i
  143. reel(i).setvalue(score(i))
  144. if score(i)>9999 then threel(i).setvalue(1)
  145. next
  146. currpl=0
  147. cred=0
  148.  
  149. credtimer.enabled=true
  150.  
  151. if rv="" then rv=0
  152. if ylv="" then ylv=0
  153. ylupdate
  154.  
  155. AutomaticBallLaunch.enabled=True
  156.  
  157.  
  158. '************************************************************
  159. '*** B2S ***
  160. '************************************************************
  161. If B2SOn Then
  162. for i=0 to 3
  163. Controller.B2SSetScore i, Score(i)
  164. next
  165. End If
  166.  
  167. 'bglight 25,1
  168. 'bglight 26,1
  169. 'bglight 27,1
  170. 'bglight 28,1
  171.  
  172. HZ = 0
  173. Ballinplay = 0
  174. b2svarlightA=1
  175. b2svarlightB=2
  176.  
  177. b2svar1.enabled = 1
  178. b2svar2.enabled = 1
  179. SunL.enabled = 1
  180. b2sSunL=1
  181. b2sSunR=1
  182.  
  183. if motion=0 and tilt=false and c=0 then
  184. rt=(int(rnd(1)*8)+4)
  185. motion=1
  186. c=1
  187. a=int((rnd*6)+1)
  188. rotort.enabled=true
  189. end if
  190. end sub
  191. '******** end of table ini *********
  192.  
  193.  
  194. Sub Table1_KeyDown(ByVal keycode)
  195.  
  196. If keycode = PlungerKey Then
  197. Plunger.PullBack
  198. End If
  199.  
  200.  
  201. if keycode = AddCreditKey then
  202. playsound "coin3"
  203. coindelay.enabled=true
  204. end if
  205.  
  206. if keycode = StartGameKey and credit>0 and state=false and playno=0 then
  207. credit=credit-1
  208. If credit < 1 Then DOF 119, DOFOff
  209. credittxt.text=credit
  210.  
  211. eg=0
  212. playno=1
  213. currpl=0
  214. activeballs=0
  215. tilt=false
  216. tilttxt.text=" "
  217. bumper1.force=5
  218. bumper2.force=5
  219. tiltseq.stopplay
  220.  
  221.  
  222. for each obj in indtilt
  223. obj.text=" "
  224. next
  225.  
  226.  
  227. gamov.text="GAME OVER"
  228. playup(currpl).setvalue(1)
  229. player.setvalue(1)
  230. playsound "click"
  231. rst=0
  232. playsound "initialize"
  233. resettimer.enabled=true
  234. if B2SOn then Scoreb2s.enabled =1
  235. end if
  236.  
  237. if keycode = StartGameKey and credit>0 and state=true and playno>0 and playno<4 and ballinplay<2 then
  238. credit=credit-1
  239. If credit < 1 Then DOF 119, DOFOff
  240. credittxt.text=credit
  241. player.addvalue(1)
  242. playno=playno+1
  243. playsound "click"
  244. if B2SOn then Scoreb2s.enabled =1
  245. End If
  246.  
  247.  
  248. if automatic = 0 and keycode = RightMagnaSave and activeballs=0 and state=true and ballinplay<6 then
  249. activeballs=activeballs+1
  250. nb.CreateSizedballWithMass BallRadius,BallMass 'old nb.createball
  251. nb.kick 270,10
  252. playsound SoundFXDOF("ballout",115,DOFPulse,DOFContactors)
  253. end if
  254.  
  255. if tilt=false and state=true then
  256.  
  257. If keycode = LeftFlipperKey Then
  258. LeftFlipper.RotateToEnd
  259. Flipper1.RotateToEnd
  260. PlaySound SoundFXDOF("FlipperDown",101,DOFOn,DOFFlippers)
  261. playsound "buzz"
  262. End If
  263.  
  264. If keycode = RightFlipperKey Then
  265. RightFlipper.RotateToEnd
  266. Flipper2.RotateToEnd
  267. PlaySound SoundFXDOF("FlipperDown",102,DOFOn,DOFFlippers)
  268. playsound "buzz1"
  269. End If
  270. End If
  271.  
  272. If keycode = LeftTiltKey Then
  273. Nudge 90, 2
  274. checktilt
  275. End If
  276.  
  277. If keycode = RightTiltKey Then
  278. Nudge 270, 2
  279. checktilt
  280. End If
  281.  
  282. If keycode = CenterTiltKey Then
  283. Nudge 0, 2
  284. checktilt
  285. End If
  286. End Sub
  287.  
  288.  
  289.  
  290. Sub Table1_KeyUp(ByVal keycode)
  291.  
  292. If keycode = PlungerKey Then
  293. Plunger.Fire
  294. playsound "plunger"
  295. End If
  296.  
  297. If keycode = LeftFlipperKey Then
  298. LeftFlipper.RotateToStart
  299. Flipper1.RotateToStart
  300. if state=true and tilt=false then PlaySound SoundFXDOF("FlipperUp",101,DOFOff,DOFFlippers)
  301. stopsound "buzz"
  302. End If
  303.  
  304. If keycode = RightFlipperKey Then
  305. RightFlipper.RotateToStart
  306. Flipper2.RotateToStart
  307. if state=true and tilt=false then PlaySound SoundFXDOF("FlipperUp",102,DOFOff,DOFFlippers)
  308. stopsound "buzz1"
  309. End If
  310.  
  311. End Sub
  312.  
  313. sub AutomaticBallLaunch_Timer
  314. if automatic = 1 and activeballs=0 and state=true and ballinplay<6 then
  315. activeballs=activeballs+1
  316. nb.CreateSizedballWithMass BallRadius,BallMass
  317. nb.kick 270,10
  318. DOF 115, DOFPulse
  319. end if
  320. End Sub
  321.  
  322. sub coindelay_timer
  323. playsound "click"
  324. credit=credit+1
  325. DOF 119, DOFOn
  326. credittxt.text=credit
  327. coindelay.enabled=false
  328. if B2SOn then Scoreb2s.enabled =1
  329. end sub
  330.  
  331. sub resettimer_timer
  332. rst=rst+1
  333. if rst=6 or rst=12 or rst=1 then
  334. tiltseq.play seqalloff
  335. playsound "clerker"
  336. for each obj in plast
  337. obj.isdropped=true
  338. next
  339. end if
  340. if rst=7 or rst=13 or rst=2 then
  341. tiltseq.stopplay
  342. playsound "relay"
  343. ylv=ylv+1
  344. if ylv>4 then ylv=0
  345. ylupdate
  346. for each obj in plast
  347. obj.isdropped=false
  348. next
  349. end if
  350. for i=0 to 3
  351. reel(i).resettozero
  352. next
  353. if rst=14 then
  354. playsound "kickerkick"
  355. end if
  356. ylv=ylv+1
  357. if ylv>4 then ylv=0
  358. ylupdate
  359. if rst=18 then
  360. newgame
  361. resettimer.enabled=false
  362. end if
  363. end sub
  364.  
  365. sub addscore(points)
  366. if tilt=false then
  367. bell=0
  368. if points=10 or points=1 then
  369. matchnumb=matchnumb+1
  370. if matchnumb=10 then matchnumb=0
  371. end if
  372. if points = 100 then
  373. reel(currpl).addvalue(100)
  374. playsound SoundFXDOF("gigibump4loud",142,DOFPulse,DOFChimes)
  375. end if
  376. if points = 10 then
  377. reel(currpl).addvalue(10)
  378. playsound SoundFXDOF("gigibump3loud",141,DOFPulse,DOFChimes)
  379. end if
  380. if points = 1 then
  381. reel(currpl).addvalue(1)
  382. ylv=ylv+1
  383. if ylv>4 then ylv=0
  384. ylupdate
  385. end if
  386. if points = 5 then
  387. playsound "motorshort1s"
  388. reel(currpl).addvalue(5)
  389. end if
  390. if points = 20 then
  391. reel(currpl).addvalue(20)
  392. scn=2
  393. scn1=0
  394. playsound "motorshort1s"
  395. scntimer.enabled=true
  396. end if
  397. if points = 30 then
  398. reel(currpl).addvalue(30)
  399. scn=3
  400. scn1=0
  401. playsound "motorshort1s"
  402. scntimer.enabled=true
  403. end if
  404. if points = 40 then
  405. reel(currpl).addvalue(40)
  406. scn=4
  407. scn1=0
  408. playsound "motorshort1s"
  409. scntimer.enabled=true
  410. end if
  411. if points = 50 then
  412. reel(currpl).addvalue(50)
  413. scn=5
  414. scn1=0
  415. playsound "motorshort1s"
  416. scntimer.enabled=true
  417. end if
  418. if points = 200 then
  419. reel(currpl).addvalue(200)
  420. scn2=2
  421. scn3=0
  422. playsound "motorshort1s"
  423. scntimer1.enabled=true
  424. end if
  425. if points = 300 then
  426. reel(currpl).addvalue(300)
  427. scn2=3
  428. scn3=0
  429. playsound "motorshort1s"
  430. scntimer1.enabled=true
  431. end if
  432. if points = 400 then
  433. reel(currpl).addvalue(400)
  434. scn2=4
  435. scn3=0
  436. playsound "motorshort1s"
  437. scntimer1.enabled=true
  438. end if
  439. if points = 500 then
  440. reel(currpl).addvalue(500)
  441. scn2=5
  442. scn3=0
  443. playsound "motorshort1s"
  444. scntimer1.enabled=true
  445. end if
  446. score(currpl)=score(currpl)+points
  447. truesc(currpl)=truesc(currpl)+points
  448. 'if truesc(currpl)>1999 then exsc(currpl).text=truesc(currpl)
  449. if score(currpl)>9999 then threel(currpl).setvalue(1)
  450. ' if score(currpl)>1999 then
  451. ' score(currpl)=score(currpl)-1000
  452. ' rep(currpl)=0
  453. ' end if
  454. if score(currpl)=>replay1 and rep(currpl)=0 then
  455. credit=credit+1
  456. DOF 119, DOFOn
  457. playsound SoundFXDOF("knocke",117,DOFPulse,DOFKnocker)
  458. DOF 118, DOFPulse
  459. credittxt.text=credit
  460. rep(currpl)=1
  461. playsound "click"
  462. if B2SOn then Scoreb2s.enabled =1
  463. end if
  464. if score(currpl)=>replay2 and rep(currpl)=1 then
  465. credit=credit+1
  466. DOF 119, DOFOn
  467. playsound SoundFXDOF("knocke",117,DOFPulse,DOFKnocker)
  468. DOF 118, DOFPulse
  469. credittxt.text=credit
  470. rep(currpl)=2
  471. playsound "click"
  472. if B2SOn then Scoreb2s.enabled =1
  473. End if
  474. if score(currpl)=>replay3 and rep(currpl)=2 then
  475. credit=credit+1
  476. DOF 119, DOFOn
  477. playsound SoundFXDOF("knocke",117,DOFPulse,DOFKnocker)
  478. DOF 118, DOFPulse
  479. credittxt.text=credit
  480. rep(currpl)=3
  481. playsound "click"
  482. if B2SOn then Scoreb2s.enabled =1
  483. end if
  484. if score(currpl)=>replay4 and rep(currpl)=3 then
  485. credit=credit+1
  486. DOF 119, DOFOn
  487. playsound SoundFXDOF("knocke",117,DOFPulse,DOFKnocker)
  488. DOF 118, DOFPulse
  489. credittxt.text=credit
  490. rep(currpl)=4
  491. playsound "click"
  492. if B2SOn then Scoreb2s.enabled =1
  493. end if
  494. end if
  495. end sub
  496.  
  497. sub scntimer_timer
  498. scn1=scn1 + 1
  499. playsound SoundFXDOF("gigibump3loud",141,DOFPulse,DOFChimes)
  500. if scn1=scn then scntimer.enabled=false
  501. end sub
  502.  
  503. sub scntimer1_timer
  504. scn3=scn3 + 1
  505. playsound SoundFXDOF("gigibump4loud",142,DOFPulse,DOFChimes)
  506. if scn2=scn3 then scntimer1.enabled=false
  507. end sub
  508.  
  509. sub matchnum
  510. match(matchnumb).text=matchnumb
  511. for i=1 to playno
  512. if matchnumb=(score(i-1) mod 10) then
  513. credit=credit+1
  514. DOF 119, DOFOn
  515. playsound SoundFXDOF("knocke",117,DOFPulse,DOFKnocker)
  516. DOF 118, DOFPulse
  517. credittxt.text= credit
  518. playsound "click"
  519. end if
  520. next
  521. playno=0
  522. end sub
  523.  
  524. Sub CheckTilt
  525. If Tilttimer.Enabled = True Then
  526. TiltSens = TiltSens + 1
  527. if TiltSens = 2 Then
  528. Tilt = True
  529. tilttxt.text="TILT"
  530. tiltsens = 0
  531. pltilt(currpl)=1
  532. indtilt(currpl).text="TILT"
  533. playsound "tilt"
  534. turnoff
  535. End If
  536. Else
  537. TiltSens = 0
  538. Tilttimer.Enabled = True
  539. End If
  540. End Sub
  541.  
  542. Sub Tilttimer_Timer()
  543. Tilttimer.Enabled = False
  544. End Sub
  545.  
  546. sub turnoff
  547. bumper1.force=0
  548. bumper2.force=0
  549. tiltseq.play seqalloff
  550. for each obj in match
  551. obj.text=" "
  552. next
  553. playup(currpl).setvalue(0)
  554. player.setvalue(0)
  555. for each obj in ballplay
  556. obj.text=" "
  557. next
  558. for each obj in GIGEN
  559. obj.state=0
  560. Next
  561. for each obj in GIR
  562. obj.state=0
  563. Next
  564. for each obj in GIL
  565. obj.state=0
  566. Next
  567. currpl=0
  568. ballinplay=0
  569. end sub
  570.  
  571. sub newgame
  572. credtimer.enabled=false
  573. credtxt.text="Ported To VP By Leon Spalding, Ported To VPX by Team PP, JPJ, Chucky"
  574. state=true
  575. eg=0
  576. for i=0 to 3
  577. score(i)=0
  578. truesc(i)=0
  579. rep(i)=0
  580. pltilt(i)=0
  581. threel(i).setvalue(0)
  582. next
  583. bumper1.force=5
  584. bumper2.force=5
  585. for each obj in GIGEN
  586. obj.state=1
  587. Next
  588.  
  589. ' for each obj in lights
  590. ' obj.state=0
  591. ' next
  592.  
  593. on1.state=1
  594. off2.state=1
  595. light3.state=1:light3z.state=1
  596. light4.state=1:light4z.state=1
  597. light5.state=1:light5z.state=1
  598.  
  599. if motion=0 then
  600. rt=(int(rnd(1)*8)+4)
  601. motion=1
  602. rotort.enabled=true
  603. end if
  604. bip5.text=" "
  605. bip1.text="1"
  606. for i=0 to 9
  607. match(i).text=" "
  608. next
  609. tilttxt.text=" "
  610. gamov.text=" "
  611. tilt=false
  612. tiltsens=0
  613. ballinplay=1
  614. playsound "reset1"
  615. if B2SOn then Scoreb2s.enabled =1
  616. end sub
  617.  
  618. Sub Drain_Hit()
  619. playsound "drainshort"
  620. DOF 116, DOFPulse
  621. Drain.DestroyBall
  622. if ballinplay<5 then playsound "motorshort"
  623. activeballs=activeballs-1
  624. if activeballs=0 then tt=0:nextball
  625. if B2SOn then Scoreb2s.enabled =1
  626. End Sub
  627.  
  628. sub nextball
  629. if ballinplay<5 and tilt=false then playsound "motorshorter1s"
  630.  
  631. for i=0 to 4
  632. if pltilt(i)=1 then tt=tt+1
  633. next
  634.  
  635. for each obj in GIGEN
  636. obj.state=1
  637. Next
  638.  
  639. if tt=playno then
  640. for i=0 to 4
  641. ballplay(i).text=" "
  642. next
  643. currpl=currpl+1
  644. state=false
  645. savehs
  646. playno=0
  647. 'ballreltimer.enabled=true
  648. exit sub
  649. end if
  650. if tilt=true then
  651. tilt=false
  652. tilttxt.text=" "
  653. bumper1.force=6
  654. bumper2.force=6
  655. tiltseq.stopplay
  656. ballplay(ballinplay).text=ballinplay
  657. player.setvalue(playno)
  658. end if
  659. currpl=currpl+1
  660. if currpl>playno-1 then
  661. ballinplay=ballinplay+1
  662. playsound "relay"
  663. if ballinplay>5 then
  664. playsound "motorleer"
  665. ballreltimer.enabled=true
  666. else
  667. if state=true and tilt=false then
  668. playup(currpl-1).setvalue(0)
  669. currpl=0
  670. playup(currpl).setvalue(1)
  671. playsound "relay"
  672. tilttxt.text=" "
  673. end if
  674. select case ballinplay
  675. case 0:
  676. bip1.text=" "
  677. bip2.text=" "
  678. bip3.text=" "
  679. bip4.text=" "
  680. bip5.text=" "
  681. case 1:
  682. bip1.text="1"
  683. bip2.text=" "
  684. bip3.text=" "
  685. bip4.text=" "
  686. bip5.text=" "
  687. case 2:
  688. bip1.text=" "
  689. bip2.text="2"
  690. bip3.text=" "
  691. bip4.text=" "
  692. bip5.text=" "
  693. case 3:
  694. bip1.text=" "
  695. bip2.text=" "
  696. bip3.text="3"
  697. bip4.text=" "
  698. bip5.text=" "
  699. case 4:
  700. bip1.text=" "
  701. bip2.text=" "
  702. bip3.text=" "
  703. bip4.text="4"
  704. bip5.text=" "
  705. case 5:
  706. bip1.text=" "
  707. bip2.text=" "
  708. bip3.text=" "
  709. bip4.text=" "
  710. bip5.text="5"
  711. end select
  712. playsound "relay"
  713. end if
  714. end if
  715. if currpl>0 and currpl<(playno) then
  716. if state=true and tilt=false then
  717. playup(currpl-1).setvalue(0)
  718. playup(currpl).setvalue(1)
  719. playsound "relay"
  720. tilttxt.text=" "
  721. end if
  722. end if
  723. if pltilt(currpl)=1 then tilttxt.text="TILT":tt=0:nextball
  724. end Sub
  725.  
  726. sub ballreltimer_timer
  727. if tilt=false then matchnum
  728. bip5.text=" "
  729. state=false
  730. for i=0 to 3
  731. if truesc(i)>hisc then
  732. hisc=truesc(i)
  733. hstxt.text=hisc
  734. end if
  735. next
  736. playup(currpl-1).setvalue(0)
  737. player.setvalue(0)
  738. gamov.text="GAME OVER"
  739. savehs
  740. cred=0
  741. credtimer.enabled=true
  742. if ballinplay > 5 then ballinplay = 0
  743. ballreltimer.enabled=false
  744. end sub
  745.  
  746. '**********************************************
  747. '** New wheel part jpj **
  748. '**********************************************
  749.  
  750. sub rotort_timer()
  751.  
  752. rotorR = Wheel.objroty
  753. playsound SoundFXDOF("lightmotor",120,DOFOn,DOFGear)
  754. rotationW.enabled=True
  755.  
  756. rt1=rt1+1
  757. ' rotoradv mis à la fin
  758. if rt1=rt*2 then
  759. rt1=0
  760. motion=0
  761. ylupdate
  762. end If
  763. if rsv<40 then
  764. l400.state=0:l400z.state=0
  765. l500.state=0:l500z.state=0
  766. end if
  767.  
  768. end sub
  769.  
  770.  
  771.  
  772.  
  773. sub rotationW_timer
  774. select case c
  775. case 1 :
  776. Wheel.objroty = Wheel.objroty + 9
  777. if wheel.objroty = 360 then wheel.objroty = 0:end If
  778. c=2
  779. case 2 :
  780. Wheel.objroty = Wheel.objroty + 9
  781. if wheel.objroty = 360 then wheel.objroty = 0:end If
  782. c=3
  783. case 3 :
  784. Wheel.objroty = Wheel.objroty + 9
  785. if wheel.objroty = 360 then wheel.objroty = 0:end If
  786. c=4
  787. case 4 :
  788. Wheel.objroty = Wheel.objroty + 9
  789. if wheel.objroty = 360 then wheel.objroty = 0:end If
  790. a=a-1
  791. if a >0 then
  792. c=1
  793. Else
  794. if a=0 then c=5
  795. rotoradv
  796. end If
  797.  
  798. case 5 :
  799. Wheel.objroty = Wheel.objroty + 25
  800. c=6
  801. case 6 :
  802. Wheel.objroty = Wheel.objroty + 10
  803. c=7
  804. case 7 :
  805. Wheel.objroty = Wheel.objroty + 5
  806. c=8
  807. case 8 :
  808. Wheel.objroty = Wheel.objroty +2
  809. c=9
  810. case 9 :
  811. Wheel.objroty = Wheel.objroty - 7
  812. c=10
  813. case 10 :
  814. Wheel.objroty = Wheel.objroty -46
  815. c=11
  816. ' Debug.print "c11"
  817. case 11 :
  818. Wheel.objroty = Wheel.objroty +11
  819. c=0:rotationW.enabled=false:DOF 120, DOFOff
  820. end Select
  821.  
  822.  
  823. motion=0 and tilt=false
  824.  
  825.  
  826. rotort.enabled=false
  827. if c=0 then rotationW.enabled=false:DOF 120, DOFOff:end if
  828. end Sub
  829. '*************************************************
  830.  
  831. '************** Slingshots ***********************
  832.  
  833. Sub RightSlingShot_Slingshot
  834. playsound SoundFXDOF("rightslingshot",104,DOFPulse,DOFContactors)
  835. DOF 106, DOFPulse
  836. if GI1.state=1 then
  837. addscore 10
  838. else
  839. addscore 1
  840. end if
  841. if GL = "L" then
  842. GL = "R"
  843. Else
  844. GL = "L"
  845. end if
  846. RSling.Visible = 0
  847. RSling1.Visible = 1
  848. slingR.objroty = -15
  849. RStep = 2
  850. RightSlingShot.TimerEnabled = 1
  851. End Sub
  852.  
  853. Sub RightSlingShot_Timer
  854. Select Case RStep
  855. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:slingR.objroty = -7
  856. Case 4: slingR.objroty = 0:RSLing2.Visible = 0:RSLing.Visible = 1:RightSlingShot.TimerEnabled = 0:b2sSunR=b2sSunR+1
  857. End Select
  858. RStep = RStep + 1
  859. End Sub
  860.  
  861. Sub LeftSlingShot_Slingshot
  862. playsound SoundFXDOF("leftslingshot",103,DOFPulse,DOFContactors)
  863. DOF 105, DOFPulse
  864. if GI01.state=1 then
  865. addscore 10
  866. else
  867. addscore 1
  868. end if
  869. if GL = "L" then
  870. GL = "R"
  871. Else
  872. GL = "L"
  873. end if
  874. LSling.Visible = 0
  875. LSling1.Visible = 1
  876. slingL.objroty = 15
  877. LStep = 2
  878. LeftSlingShot.TimerEnabled = 1
  879. End Sub
  880.  
  881. Sub LeftSlingShot_Timer()
  882. Select Case LStep
  883. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:slingL.objroty = 7
  884. Case 4:slingL.objroty = 0:LSLing2.Visible = 0:LSLing.Visible = 1:LeftSlingShot.TimerEnabled = 0:b2sSunL=b2sSunL+1
  885. End Select
  886. LStep = LStep + 1
  887. End Sub
  888.  
  889. Sub LeftSlingShotb_Slingshot
  890. playsound "leftslingshot"
  891. addscore 1
  892. if GL = "L" then
  893. GL = "R"
  894. Else
  895. GL = "L"
  896. end if
  897. LSlingb.Visible = 0
  898. LSlingb1.Visible = 1
  899. slingLb.objroty = 15
  900. LStepb = 2
  901. LeftSlingShotb.TimerEnabled = 1
  902. End Sub
  903.  
  904. Sub LeftSlingShotb_Timer()
  905. Select Case LStepb
  906. Case 3:LSLingb1.Visible = 0:LSLingb2.Visible = 1:slingLb.objroty = 7
  907. Case 4:slingLb.objroty = 0:LSLingb2.Visible = 0:LSLingb.Visible = 1:LeftSlingShotb.TimerEnabled = 0:b2sSunL=b2sSunL+1
  908. End Select
  909. LStepb = LStepb + 1
  910. End Sub
  911.  
  912. Sub LeftSlingShotc_Slingshot
  913. playsound "leftslingshot"
  914. addscore 5
  915. if motion=0 and tilt=false and c=0 then
  916. rt=(int(rnd(1)*8)+4)
  917. motion=1
  918. c=1
  919. a=int((rnd*6)+1)
  920. rotort.enabled=true
  921. end if
  922. if GL = "L" then
  923. GL = "R"
  924. Else
  925. GL = "L"
  926. end if
  927. LSlingc.Visible = 0
  928. LSlingc1.Visible = 1
  929. slingLc.objroty = 15
  930. LStepc = 2
  931. LeftSlingShotc.TimerEnabled = 1
  932. End Sub
  933.  
  934. Sub LeftSlingShotc_Timer()
  935. Select Case LStepc
  936. Case 3:LSLingc1.Visible = 0:LSLingc2.Visible = 1:slingLc.objroty = 7
  937. Case 4:slingLc.objroty = 0:LSLingc2.Visible = 0:LSLingc.Visible = 1:LeftSlingShotc.TimerEnabled = 0:b2sSunL=b2sSunL+1
  938. End Select
  939. LStepc = LStepc + 1
  940. End Sub
  941.  
  942. Sub LeftSlingShotd_Slingshot
  943. playsound "leftslingshot"
  944. addscore 1
  945. if GL = "L" then
  946. GL = "R"
  947. Else
  948. GL = "L"
  949. end if
  950. LSlingc.Visible = 0
  951. LSlingd1.Visible = 1
  952. slingLd.objroty = 15
  953. LStepd = 2
  954. LeftSlingShotd.TimerEnabled = 1
  955. End Sub
  956.  
  957. Sub LeftSlingShotd_Timer()
  958. Select Case LStepd
  959. Case 3:LSLingd1.Visible = 0:LSLingd2.Visible = 1:slingLd.objroty = 7
  960. Case 4:slingLd.objroty = 0:LSLingd2.Visible = 0:LSLingc.Visible = 1:LeftSlingShotd.TimerEnabled = 0:b2sSunL=b2sSunL+1
  961. End Select
  962. LStepd = LStepd + 1
  963. End Sub
  964.  
  965. Sub LeftSlingShote_Slingshot
  966. playsound "leftslingshot"
  967. addscore 1
  968. if GL = "L" then
  969. GL = "R"
  970. Else
  971. GL = "L"
  972. end if
  973. CentralSling.Visible = 0
  974. CentralSlingLe1.Visible = 1
  975. slingLe.objroty = 15
  976. LStepe = 2
  977. LeftSlingShote.TimerEnabled = 1
  978. End Sub
  979.  
  980. Sub LeftSlingShote_Timer()
  981. Select Case LStepe
  982. Case 3:CentralSlingLe1.Visible = 0:CentralSlingLe2.Visible = 1:slingLe.objroty = 7
  983. Case 4:slingLe.objroty = 0:CentralSlingLe2.Visible = 0:CentralSling.Visible = 1:LeftSlingShote.TimerEnabled = 0:b2sSunL=b2sSunL+1
  984. End Select
  985. LStepe = LStepe + 1
  986. End Sub
  987.  
  988. Sub RightSlingShotb_Slingshot
  989. playsound "leftslingshot"
  990. addscore 1
  991. if GL = "L" then
  992. GL = "R"
  993. Else
  994. GL = "L"
  995. end if
  996. RSlingb.Visible = 0
  997. RSlingb1.Visible = 1
  998. slingRb.objroty = -15
  999. RStepb = 2
  1000. RightSlingShotb.TimerEnabled = 1
  1001. End Sub
  1002.  
  1003. Sub RightSlingShotb_Timer()
  1004. Select Case RStepb
  1005. Case 3:RSLingb1.Visible = 0:RSLingb2.Visible = 1:slingRb.objroty = 7
  1006. Case 4:slingRb.objroty = 0:RSLingb2.Visible = 0:RSLingb.Visible = 1:RightSlingShotb.TimerEnabled = 0:b2sSunR=b2sSunR+1
  1007. End Select
  1008. RStepb = RStepb + 1
  1009. End Sub
  1010.  
  1011. Sub RightSlingShotc_Slingshot
  1012. playsound "leftslingshot"
  1013. addscore 5
  1014. if motion=0 and tilt=false and c=0 then
  1015. rt=(int(rnd(1)*8)+4)
  1016. motion=1
  1017. c=1
  1018. a=int((rnd*6)+1)
  1019. rotort.enabled=true
  1020. end if
  1021. if GL = "L" then
  1022. GL = "R"
  1023. Else
  1024. GL = "L"
  1025. end if
  1026. RSlingc.Visible = 0
  1027. RSlingc1.Visible = 1
  1028. slingRc.objroty = -15
  1029. RStepc = 2
  1030. RightSlingShotc.TimerEnabled = 1
  1031. End Sub
  1032.  
  1033. Sub RightSlingShotc_Timer()
  1034. Select Case RStepc
  1035. Case 3:RSLingc1.Visible = 0:RSLingc2.Visible = 1:slingRc.objroty = 7
  1036. Case 4:slingRc.objroty = 0:RSLingc2.Visible = 0:RSLingc.Visible = 1:RightSlingShotc.TimerEnabled = 0:b2sSunR=b2sSunR+1
  1037. End Select
  1038. RStepc = RStepc + 1
  1039. End Sub
  1040.  
  1041. Sub RightSlingShotd_Slingshot
  1042. playsound "leftslingshot"
  1043. addscore 1
  1044. if GL = "L" then
  1045. GL = "R"
  1046. Else
  1047. GL = "L"
  1048. end if
  1049. RSlingc.Visible = 0
  1050. RSlingd1.Visible = 1
  1051. slingRd.objroty = -15
  1052. RStepd = 2
  1053. RightSlingShotd.TimerEnabled = 1
  1054. End Sub
  1055.  
  1056. Sub RightSlingShotd_Timer()
  1057. Select Case RStepd
  1058. Case 3:RSLingd1.Visible = 0:RSLingd2.Visible = 1:slingRd.objroty = 7
  1059. Case 4:slingRd.objroty = 0:RSLingd2.Visible = 0:RSLingc.Visible = 1:RightSlingShotd.TimerEnabled = 0:b2sSunR=b2sSunR+1
  1060. End Select
  1061. RStepd = RStepd + 1
  1062. End Sub
  1063.  
  1064. Sub RightSlingShote_Slingshot
  1065. playsound "leftslingshot"
  1066. addscore 1
  1067. if GL = "L" then
  1068. GL = "R"
  1069. Else
  1070. GL = "L"
  1071. end if
  1072. CentralSling.Visible = 0
  1073. CentralSlingRe1.Visible = 1
  1074. slingRe.objroty = 15
  1075. RStepe = 2
  1076. RightSlingShote.TimerEnabled = 1
  1077. End Sub
  1078.  
  1079. Sub RightSlingShote_Timer()
  1080. Select Case RStepe
  1081. Case 3:CentralSlingRe1.Visible = 0:CentralSlingRe2.Visible = 1:slingRe.objroty = 7
  1082. Case 4:slingRe.objroty = 0:CentralSlingRe2.Visible = 0:CentralSling.Visible = 1:RightSlingShote.TimerEnabled = 0:b2sSunR=b2sSunR+1
  1083. End Select
  1084. RStepe = RStepe + 1
  1085. End Sub
  1086.  
  1087. '*********** End Slingshots *************
  1088.  
  1089. '*********** Bumpers + points **********
  1090. sub bumper1_hit
  1091. if GI10.state=1 then
  1092. addscore 10
  1093. else
  1094. addscore 1
  1095. end if
  1096. if tilt=false then
  1097. playsound SoundFXDOF("jet1",107,DOFPulse,DOFContactors)
  1098. DOF 109, DOFPulse
  1099. ring1.isdropped=false
  1100. popup.enabled=true
  1101. end if
  1102. b2sSunL=b2sSunL+1
  1103. end sub
  1104.  
  1105. sub bumper2_hit
  1106. if GI11.state=1 then
  1107. addscore 10
  1108. else
  1109. addscore 1
  1110. end if
  1111. if tilt=false then
  1112. playsound SoundFXDOF("jet1",108,DOFPulse,DOFContactors)
  1113. DOF 110, DOFPulse
  1114. ring2.isdropped=false
  1115. popup.enabled=true
  1116. end if
  1117. b2sSunR=b2sSunR+1
  1118. end sub
  1119.  
  1120. sub bumper3_hit
  1121. addscore 5
  1122. if motion=0 and tilt=false and c=0 then
  1123. rt=(int(rnd(1)*8)+4)
  1124. motion=1
  1125. c=1
  1126. a=int((rnd*6)+1)
  1127. rotort.enabled=true
  1128. end if
  1129. b2sSunL=b2sSunL+1
  1130. end sub
  1131.  
  1132. sub bumper4_hit
  1133. addscore 5
  1134. if motion=0 and tilt=false and c=0 then
  1135. rt=(int(rnd(1)*8)+4)
  1136. motion=1
  1137. c=1
  1138. a=int((rnd*6)+1)
  1139. rotort.enabled=true
  1140. end if
  1141. b2sSunR=b2sSunR+1
  1142. end sub
  1143. '**********************************
  1144.  
  1145. '****** Buttons points *****
  1146. sub ulbt_hit
  1147. addscore 1
  1148. bouton03.z=-1
  1149. bouton03f.z=-1
  1150. popup.enabled=true
  1151. b2sSunL=b2sSunL+1
  1152. end sub
  1153. sub ulbt_unhit
  1154. bouton03.z=2.5
  1155. bouton03f.z=2.5
  1156. end sub
  1157.  
  1158. sub urbt_hit
  1159. addscore 1
  1160. bouton02.z=-1
  1161. bouton02f.z=-1
  1162. popup.enabled=true
  1163. b2sSunR=b2sSunR+1
  1164. end sub
  1165. sub urbt_unhit
  1166. bouton02.z=2.5
  1167. bouton02f.z=2.5
  1168. end sub
  1169.  
  1170. sub lbt_hit
  1171. addscore 1
  1172. bouton01.z=-1
  1173. bouton01f.z=-1
  1174. popup.enabled=true
  1175. b2sSunL=b2sSunL+1
  1176. b2sSunR=b2sSunR+1
  1177. end sub
  1178. sub lbt_unhit
  1179. bouton01.z=2.5
  1180. bouton01f.z=2.5
  1181. end sub
  1182. '****************************
  1183.  
  1184. '****** Outlanes points *****
  1185. sub lout_hit
  1186. DOF 121, DOFPulse
  1187. if loutl.state=1 then
  1188. addscore 100
  1189. else
  1190. addscore 10
  1191. end if
  1192. end sub
  1193.  
  1194. sub rout_hit
  1195. DOF 122, DOFPulse
  1196. if routl.state=1 then
  1197. addscore 100
  1198. else
  1199. addscore 10
  1200. end if
  1201. end sub
  1202. '****************************
  1203.  
  1204.  
  1205. '********* Triggers between targets *************
  1206. sub lru_hit
  1207.  
  1208. if on1.state=1 and tilt=false and HZ=0 then
  1209. BumpT = 1
  1210. BumpB = 0
  1211. end if
  1212.  
  1213. if on1.state=0 and tilt=false and HZ=0 then
  1214. BumpT = 0
  1215. BumpB = 0
  1216. end if
  1217.  
  1218. if HZ=0 Then
  1219. if GL = "L" then
  1220. GL = "R"
  1221. Else
  1222. GL = "L"
  1223. end if
  1224. end If
  1225.  
  1226. HZ=1
  1227. End Sub
  1228.  
  1229. sub HitZoneL_unhit
  1230. HZ = 0
  1231. end Sub
  1232.  
  1233. sub rru_hit
  1234. if on2.state=1 and tilt=false and HZ=0 then
  1235. BumpT = 0
  1236. BumpB = 1
  1237. End If
  1238.  
  1239. if on2.state=0 and tilt=false and HZ=0 then
  1240. BumpT = 0
  1241. BumpB = 0
  1242. end if
  1243.  
  1244. if HZ=0 Then
  1245. if GL = "L" then
  1246. GL = "R"
  1247. Else
  1248. GL = "L"
  1249. end if
  1250. end If
  1251.  
  1252. HZ=1
  1253. end Sub
  1254.  
  1255. sub HitZoneR_unhit
  1256. HZ = 0
  1257. end Sub
  1258.  
  1259. sub gate1_hit
  1260. playsound "gate"
  1261. end Sub
  1262.  
  1263. sub gate2_hit
  1264. playsound "gate"
  1265. end Sub
  1266.  
  1267. '******************************************************
  1268.  
  1269.  
  1270. '******************************************************
  1271. '****** Targets *******
  1272. '******************************************************
  1273.  
  1274. sub ctarga
  1275. addscore 100
  1276. popup.enabled=true
  1277. end sub
  1278.  
  1279. Sub SW24_hit():sw24p.transx = -10:Me.TimerEnabled = 1:playsound "metal4":ltarga:DOF 111, DOFPulse:End Sub
  1280. Sub SW24_Timer():sw24p.transx = 0:Me.TimerEnabled = 0:End Sub
  1281.  
  1282. Sub SW25_hit():sw25p.transx = -10:Me.TimerEnabled = 1:playsound "metal4":ctarga:DOF 112, DOFPulse:End Sub
  1283. Sub SW25_Timer():sw25p.transx = 0:Me.TimerEnabled = 0:End Sub
  1284.  
  1285. Sub SW26_hit():sw26p.transx = -10:Me.TimerEnabled = 1:playsound "metal4":rtarga:DOF 113, DOFPulse:End Sub
  1286. Sub SW26_Timer():sw26p.transx = 0:Me.TimerEnabled = 0:End Sub
  1287.  
  1288. sub rtarga
  1289. if urtlb.state=0 and urtlf.state=0 then addscore 1
  1290. if urtlb.state=1 and urtlf.state=0 then addscore 10
  1291. if urtlf.state=1 then addscore (rsv*10)
  1292. popup.enabled=true
  1293. end sub
  1294.  
  1295. sub ltarga
  1296. if ultlb.state=0 and ultlf.state=0 then addscore 1
  1297. if ultlb.state=1 and ultlf.state=0 then addscore 10
  1298. if ultlf.state=1 then addscore (rsv*10)
  1299. popup.enabled=true
  1300. end sub
  1301.  
  1302. '*******************************************************
  1303.  
  1304. '******************************************************
  1305. '****** Wheel price et score *******
  1306. '******************************************************
  1307.  
  1308. Sub SWheelPrice_hit():Wheel.transx = 10:Me.TimerEnabled = 1:playsound "metal4":swheelscore:DOF 114, DOFPulse:End Sub
  1309. Sub SWheelPrice_Timer():Wheel.transx = 0:Me.TimerEnabled = 0:End Sub
  1310.  
  1311. sub swheelscore
  1312. If l400.state = 1 then
  1313. addscore 400
  1314. end if
  1315.  
  1316. If l500.state = 1 then
  1317. addscore 500
  1318. end if
  1319.  
  1320. if rl.state=1 and l400.state=0 and l500.state = 0 then
  1321. addscore (rsv*10)
  1322. end if
  1323.  
  1324. if rl.state=0 and l400.state=0 and l500.state = 0 then
  1325. addscore (rsv)
  1326. end if
  1327. end Sub
  1328.  
  1329.  
  1330.  
  1331. sub lgob_hit
  1332. playsound "drain"
  1333. gobtimer.enabled=1
  1334. if lgl.state=1 then
  1335. addscore (rsv*10)
  1336. else
  1337. addscore (rsv)
  1338. end if
  1339. ' blank1.isdropped=false
  1340. popup.enabled=1
  1341. end sub
  1342.  
  1343. sub rgob_hit
  1344. playsound "drain"
  1345. gobtimer.enabled=1
  1346.  
  1347. if rgl.state=1 then
  1348. addscore (rsv*10)
  1349. else
  1350. addscore (rsv)
  1351. end if
  1352. 'blank2.isdropped=false
  1353. popup.enabled=1
  1354. end sub
  1355.  
  1356. sub gobtimer_timer
  1357. dim Bot, tnob
  1358. if ballinplay<5 then playsound "motorshort"
  1359. activeballs=activeballs-1
  1360. if activeballs=0 then tt=0:nextball
  1361. if B2SOn then Scoreb2s.enabled =1:end If
  1362. gobtimer.enabled=false
  1363. end sub
  1364.  
  1365. sub popup_timer
  1366. rgob.destroyball
  1367. lgob.destroyball
  1368. popup.enabled=0
  1369. end sub
  1370.  
  1371.  
  1372. '************************************************
  1373. '**** wheel Price ****
  1374. '************************************************
  1375. sub rotoradv
  1376. If wheel.objroty = 0 then rsv =10
  1377. If wheel.objroty = 36 then rsv =20
  1378. If wheel.objroty = 72 then rsv =30
  1379. If wheel.objroty = 108 then rsv =40
  1380. If wheel.objroty = 144 then rsv =50
  1381. If wheel.objroty = 180 then rsv =10
  1382. If wheel.objroty = 216 then rsv =20
  1383. If wheel.objroty = 252 then rsv =30
  1384. If wheel.objroty = 288 then rsv =40
  1385. If wheel.objroty = 324 then rsv =50
  1386. debug.print rsv
  1387. rv=rv+1
  1388. if rv>9 then rv=0:end If
  1389. playsound "lightmotor"
  1390. end sub
  1391.  
  1392. '*************************************************
  1393. '********* Scoring lights ********
  1394. sub ylupdate
  1395. for each obj in rtvalue
  1396. obj.state=0
  1397. next
  1398. rtvalue(ylv).state=1
  1399. ' if ylv=0 or ylv=3 and rv>5 then
  1400. ' if rsv=40 then l400.state=1:l500.state=0:l400z.state=1:l500z.state=0:end if
  1401. ' if rsv=50 then l500.state=1:l400.state=0:l500z.state=1:l400z.state=0:end if
  1402. ' end if
  1403. ' if rsv<40 then
  1404. ' l400.state=0:l400z.state=0
  1405. ' l500.state=0:l500z.state=0
  1406. ' end if
  1407. end sub
  1408. '*************************************************
  1409.  
  1410. sub credtimer_timer
  1411. cred=cred+1
  1412. if cred=1 then credtxt.text="Ported To VPX By JPJ, from a Leon Spalding's Table"
  1413. if cred=2 then credtxt.text="'5'Coin:'S'Start:'Right magnet or automatic 'Load Ball"
  1414. if cred=3 then credtxt.text="Thanx Go To:"
  1415. if cred=4 then credtxt.text="Randy Davis & Black (VP GODS)"
  1416. if cred=5 then credtxt.text="Most At VPF, VPFF & MFF"
  1417. if cred=6 then credtxt.text="'5'Coin:'S'Start:'Right magnet or automatic 'Load Ball"
  1418. if cred=6 then cred=0
  1419. end sub
  1420.  
  1421. '****************** Save and load values, score, credit *********************
  1422. sub savehs
  1423. savevalue "Contest", "credit", credit
  1424. savevalue "Contest", "plsc1", score(0)
  1425. savevalue "Contest", "plsc2", score(1)
  1426. savevalue "Contest", "plsc3", score(2)
  1427. savevalue "Contest", "plsc4", score(3)
  1428. savevalue "Contest", "hiscore", hisc
  1429. savevalue "Contest", "match", matchnumb
  1430. savevalue "Contest", "rotpos", rv
  1431. savevalue "Contest", "yellowlpos", ylv
  1432. end sub
  1433.  
  1434. sub loadhs
  1435. dim temp
  1436. temp = LoadValue("Contest", "credit")
  1437. If (temp <> "") then credit = CDbl(temp)
  1438. temp = LoadValue("Contest", "plsc1")
  1439. If (temp <> "") then score(0) = CDbl(temp)
  1440. temp = LoadValue("Contest", "plsc2")
  1441. If (temp <> "") then score(1) = CDbl(temp)
  1442. temp = LoadValue("Contest", "plsc3")
  1443. If (temp <> "") then score(2) = CDbl(temp)
  1444. temp = LoadValue("Contest", "plsc4")
  1445. If (temp <> "") then score(3) = CDbl(temp)
  1446. temp = LoadValue("Contest", "hiscore")
  1447. If (temp <> "") then hisc = CDbl(temp)
  1448. temp = LoadValue("Contest", "match")
  1449. If (temp <> "") then matchnumb = CDbl(temp)
  1450. temp = LoadValue("Contest", "rotpos")
  1451. If (temp <> "") then rv = CDbl(temp)
  1452. temp = LoadValue("Contest", "yellowlpos")
  1453. If (temp <> "") then ylv = CDbl(temp)
  1454. If ylv>4 then ylv=0
  1455. end sub
  1456.  
  1457. '********* launching ball triger **********
  1458. sub ballhome_hit
  1459. ballrelenabled=1
  1460. end sub
  1461.  
  1462. sub ballrel_hit
  1463. if ballrelenabled=1 then
  1464. playsound "launchball"
  1465. ballrelenabled=0
  1466. end if
  1467. end sub
  1468.  
  1469. 'plus utile
  1470. 'sub ballout_hit
  1471. ' bb.isdropped=false
  1472. 'end sub
  1473.  
  1474. '******* Light to the B2S *******
  1475. Sub BGLight(id, value)
  1476. If B2SOn Then
  1477. Controller.B2SSetData id, value
  1478. End If
  1479. End Sub
  1480.  
  1481.  
  1482. '******* JPJ reflection mod *******
  1483. sub rm_timer()
  1484. if loutl.state = 1 then loutlz.state = 1 else loutlz.state = 0:end If
  1485. if routl.state = 1 then routlz.state = 1 else routlz.state = 0:end If
  1486. if lgl.state = 1 then
  1487. lgl2.state = 1
  1488. lglz.state = 1
  1489. else
  1490. lglz.state = 0
  1491. lgl2.state = 0
  1492. end If
  1493. if rl.state = 1 then rlz.state = 1 else rlz.state = 0:end If
  1494. if rgl.state = 1 then
  1495. rgl2.state = 1
  1496. rglz.state = 1
  1497. else
  1498. rglz.state = 0
  1499. rgl2.state = 0
  1500. end If
  1501. if ultlf.state = 1 then ultlfz.state = 1 else ultlfz.state = 0:end If
  1502. if ultlb.state = 1 then ultlbz.state = 1 else ultlbz.state = 0:end If
  1503. if on1.state = 1 then on1z.state = 1 else on1z.state = 0:end If
  1504. if off1.state = 1 then off1z.state = 1 else off1z.state = 0:end If
  1505. if on2.state = 1 then on2z.state = 1 else on2z.state = 0:end If
  1506. if off2.state = 1 then off2z.state = 1 else off2z.state = 0:end If
  1507. if urtlb.state = 1 then urtlbz.state = 1 else urtlbz.state = 0:end If
  1508. if urtlf.state = 1 then urtlfz.state = 1 else urtlfz.state = 0:end If
  1509.  
  1510.  
  1511. '** Include Flippers Primitives **
  1512.  
  1513. LeftFlipperP.ObjRotZ = LeftFlipper.CurrentAngle-130
  1514. LeftFlipperP1.ObjRotZ = Flipper1.CurrentAngle-125
  1515. RightFlipperP.ObjRotZ = RightFlipper.CurrentAngle-230
  1516. RightFlipperP1.ObjRotZ = Flipper2.CurrentAngle-235
  1517.  
  1518. end Sub
  1519.  
  1520.  
  1521. '******* Score, credit lights to B2s *******
  1522. sub Scoreb2s_timer()
  1523. 'dim b2svarlightA
  1524.  
  1525. '********** Scores ************
  1526. if B2SOn Then
  1527. Controller.B2SSetScore 1, Score(0)
  1528. Controller.B2SSetScore 2, Score(1)
  1529. Controller.B2SSetScore 3, Score(2)
  1530. Controller.B2SSetScore 4, Score(3)
  1531. Controller.B2SSetCredits credit
  1532.  
  1533. '********** active PLayer's light in game ************
  1534. if currpl=0 Then
  1535. if ballinplay>0 and ballinplay<6 then
  1536. Controller.B2SSetData 25, 1
  1537. end if
  1538. else
  1539. Controller.B2SSetData 25, 0
  1540. end If
  1541. if currpl=1 Then
  1542. if ballinplay>0 and ballinplay<6 then
  1543. Controller.B2SSetData 26, 1
  1544. end if
  1545. else
  1546. Controller.B2SSetData 26, 0
  1547. end If
  1548. if currpl=2 Then
  1549. if ballinplay>0 and ballinplay<6 then
  1550. Controller.B2SSetData 27, 1
  1551. end if
  1552. else
  1553. Controller.B2SSetData 27, 0
  1554. end If
  1555. if currpl=3 Then
  1556. if ballinplay>0 and ballinplay<6 then
  1557. Controller.B2SSetData 28, 1
  1558. end if
  1559. else
  1560. Controller.B2SSetData 28, 0
  1561. end If
  1562.  
  1563. '********** Tilt ************
  1564. Controller.B2SSetBallInPlay ballinplay
  1565. Controller.B2SSetTilt 33, pltilt(0)
  1566. Controller.B2SSetTilt 33, pltilt(1)
  1567. Controller.B2SSetTilt 33, pltilt(2)
  1568. Controller.B2SSetTilt 33, pltilt(3)
  1569. End If
  1570. '********** Game Over ************
  1571. If ballinplay<1 or ballinplay>5 and b2svarlightA=0 then
  1572. If B2SOn Then Controller.B2SSetData 35, 1
  1573. ' b2svarlightA=1
  1574. b2svar1.enabled=1
  1575. b2svar2.enabled=0
  1576. sunzero
  1577. sunL.enabled=0
  1578. sunR.enabled=0
  1579. Else
  1580. If B2SOn Then
  1581. Controller.B2SSetData 35, 0
  1582. Controller.B2SSetData 10, 0
  1583. Controller.B2SSetData 11, 0
  1584. End If
  1585. b2svarlightA=0
  1586. b2svar1.enabled=0
  1587. b2svar2.enabled=1
  1588. sunL.enabled=1
  1589. sunR.enabled=1
  1590. end If
  1591. If ballinplay<1 or ballinplay>5 and b2svarlightA<>0 then
  1592. If B2SOn Then Controller.B2SSetData 35, 1
  1593. b2svar1.enabled=1
  1594. b2svar2.enabled=0
  1595. sunzero
  1596. sunL.enabled=0
  1597. sunR.enabled=0
  1598. Else
  1599. If B2SOn Then
  1600. Controller.B2SSetData 35, 0
  1601. Controller.B2SSetData 10, 0
  1602. Controller.B2SSetData 11, 0
  1603. End If
  1604. b2svarlightA=0
  1605. b2svar1.enabled=0
  1606. b2svar2.enabled=1
  1607. sunL.enabled=1
  1608. sunR.enabled=1
  1609. end If
  1610. end Sub
  1611.  
  1612.  
  1613. sub B2svar1_timer
  1614. if b2svarlightA=0 then b2svar1.enabled = 0:end If
  1615. If B2SOn Then
  1616. select case b2svarlightA
  1617. case 1:Controller.B2SSetData 10, 0
  1618. Controller.B2SSetData 11, 0
  1619. case 2:Controller.B2SSetData 10, 1
  1620. Controller.B2SSetData 11, 1
  1621. case 3:
  1622. Controller.B2SSetData 10, 1
  1623. Controller.B2SSetData 11, 0
  1624. case 4:
  1625. Controller.B2SSetData 10, 0
  1626. Controller.B2SSetData 11, 1
  1627. case 5:
  1628. Controller.B2SSetData 10, 0
  1629. Controller.B2SSetData 11, 0
  1630. case 6:
  1631. Controller.B2SSetData 10, 1
  1632. Controller.B2SSetData 11, 1
  1633. end Select
  1634. End If
  1635.  
  1636. b2svarlightA=b2svarlightA+1
  1637. if b2svarlightA=7 then b2svarlightA=1
  1638. end sub
  1639.  
  1640. sub b2svar2_timer
  1641. if b2svarlightB=0 then b2svar2.enabled = 0:end If
  1642. If B2SOn Then
  1643. select case b2svarlightB
  1644. case 1:
  1645. Controller.B2SSetData 8, 1
  1646. Controller.B2SSetData 9, 0
  1647. case 2:
  1648. Controller.B2SSetData 8, 1
  1649. Controller.B2SSetData 9, 0
  1650. case 3:
  1651. Controller.B2SSetData 8, 0
  1652. Controller.B2SSetData 9, 1
  1653. case 4:
  1654. Controller.B2SSetData 8, 0
  1655. Controller.B2SSetData 9, 1
  1656. case 5:
  1657. Controller.B2SSetData 8, 0
  1658. Controller.B2SSetData 9, 0
  1659. case 6:
  1660. Controller.B2SSetData 8, 1
  1661. Controller.B2SSetData 9, 1
  1662. case 7:
  1663. Controller.B2SSetData 8, 0
  1664. Controller.B2SSetData 9, 0
  1665. case 8:
  1666. Controller.B2SSetData 8, 1
  1667. Controller.B2SSetData 9, 1
  1668. case 9:
  1669. Controller.B2SSetData 8, 0
  1670. Controller.B2SSetData 9, 0
  1671. case 10:
  1672. Controller.B2SSetData 8, 0
  1673. Controller.B2SSetData 9, 1
  1674. case 11:
  1675. Controller.B2SSetData 8, 1
  1676. Controller.B2SSetData 9, 0
  1677. case 12:
  1678. Controller.B2SSetData 8, 0
  1679. Controller.B2SSetData 9, 0
  1680. end Select
  1681. End If
  1682. b2svarlightB=b2svarlightB+1
  1683. if b2svarlightB=10 then b2svarlightB=1
  1684. End Sub
  1685.  
  1686. sub sunL_Timer
  1687. If B2SOn Then
  1688. select case b2sSunL
  1689. case 1:
  1690. Controller.B2SSetData 40, 1
  1691. Controller.B2SSetData 41, 0
  1692. Controller.B2SSetData 42, 0
  1693. Controller.B2SSetData 43, 0
  1694. case 2:
  1695. Controller.B2SSetData 40, 0
  1696. Controller.B2SSetData 41, 1
  1697. Controller.B2SSetData 42, 0
  1698. Controller.B2SSetData 43, 0
  1699. case 3:
  1700. Controller.B2SSetData 40, 0
  1701. Controller.B2SSetData 41, 0
  1702. Controller.B2SSetData 42, 1
  1703. Controller.B2SSetData 43, 0
  1704. case 4:
  1705. Controller.B2SSetData 40, 0
  1706. Controller.B2SSetData 41, 0
  1707. Controller.B2SSetData 42, 0
  1708. Controller.B2SSetData 43, 1
  1709. case 5:
  1710. Controller.B2SSetData 40, 0
  1711. Controller.B2SSetData 41, 0
  1712. Controller.B2SSetData 42, 1
  1713. Controller.B2SSetData 43, 0
  1714. case 6:
  1715. Controller.B2SSetData 40, 0
  1716. Controller.B2SSetData 41, 1
  1717. Controller.B2SSetData 42, 0
  1718. Controller.B2SSetData 43, 0
  1719. end Select
  1720. End If
  1721. ' b2sSunL=b2sSunL+1
  1722. if b2sSunL=7 then b2sSunL=1:end If
  1723.  
  1724. end Sub
  1725.  
  1726. Sub sunR_Timer
  1727. If B2SOn Then
  1728. select case b2sSunR
  1729. case 1:
  1730. Controller.B2SSetData 44, 0
  1731. Controller.B2SSetData 45, 0
  1732. Controller.B2SSetData 46, 0
  1733. Controller.B2SSetData 47, 1
  1734. case 2:
  1735. Controller.B2SSetData 44, 0
  1736. Controller.B2SSetData 45, 0
  1737. Controller.B2SSetData 46, 1
  1738. Controller.B2SSetData 47, 0
  1739. case 3:
  1740. Controller.B2SSetData 44, 0
  1741. Controller.B2SSetData 45, 1
  1742. Controller.B2SSetData 46, 0
  1743. Controller.B2SSetData 47, 0
  1744. case 4:
  1745. Controller.B2SSetData 44, 1
  1746. Controller.B2SSetData 45, 0
  1747. Controller.B2SSetData 46, 0
  1748. Controller.B2SSetData 47, 0
  1749. case 5:
  1750. Controller.B2SSetData 44, 0
  1751. Controller.B2SSetData 45, 1
  1752. Controller.B2SSetData 46, 0
  1753. Controller.B2SSetData 47, 0
  1754. case 6:
  1755. Controller.B2SSetData 44, 0
  1756. Controller.B2SSetData 45, 0
  1757. Controller.B2SSetData 46, 1
  1758. Controller.B2SSetData 47, 0
  1759. end Select
  1760. End If
  1761. ' b2sSunR=b2sSunR+1
  1762. if b2sSunR=7 then b2sSunR=1:end If
  1763. end Sub
  1764.  
  1765. Sub sunzero
  1766. If B2SOn Then
  1767. Controller.B2SSetData 40, 0
  1768. Controller.B2SSetData 41, 0
  1769. Controller.B2SSetData 42, 0
  1770. Controller.B2SSetData 43, 0
  1771. Controller.B2SSetData 44, 0
  1772. Controller.B2SSetData 45, 0
  1773. Controller.B2SSetData 46, 0
  1774. Controller.B2SSetData 47, 0
  1775. End If
  1776. end Sub
  1777.  
  1778.  
  1779. '******* Lights Timers, Lights mechanic *******
  1780.  
  1781. sub GILeft_Timer
  1782. if GL="R" then GIRight:end If
  1783. if GL="L" then GILeftt:end If
  1784.  
  1785. if ylv=0 or ylv=3 and rv>5 then
  1786. if rsv=40 then l400.state=1:l500.state=0:l400z.state=1:l500z.state=0:end if
  1787. if rsv=50 then l500.state=1:l400.state=0:l500z.state=1:l400z.state=0:end if
  1788. end if
  1789. if rsv<40 then
  1790. l400.state=0:l400z.state=0
  1791. l500.state=0:l500z.state=0
  1792. end if
  1793.  
  1794. End Sub
  1795.  
  1796. sub GIGen_Timer
  1797. for each obj in GIR
  1798. obj.state=0
  1799. Next
  1800. for each obj in GIL
  1801. obj.state=0
  1802. Next
  1803. 'condition hasard
  1804. GL="L"
  1805. end Sub
  1806.  
  1807. sub GILeftt
  1808. for each obj in GIR
  1809. obj.state=0
  1810. Next
  1811. for each obj in GIL
  1812. obj.state=1
  1813. Next
  1814. '********** bottom clouds in B2S ************
  1815. If B2SOn Then
  1816. if ballinplay>0 and ballinplay<6 then
  1817. Controller.B2SSetData 12, 1
  1818. Controller.B2SSetData 14, 0
  1819. Else
  1820. Controller.B2SSetData 12, 0
  1821. Controller.B2SSetData 14, 0
  1822. End If
  1823. End If
  1824. '********************************************
  1825.  
  1826. 'Targets Top
  1827. GI01.state = 1
  1828. GI02.state = 1
  1829. GI1.state = 0
  1830. GI2.state = 0
  1831.  
  1832. 'on/off
  1833. on1.state=1
  1834. off2.state=1
  1835. on2.state=0
  1836. off1.state=0
  1837.  
  1838. 'Right Outlane
  1839. routl.state = 1
  1840. loutl.state = 0
  1841.  
  1842. 'Bumpers
  1843. if bumpB = 1 or bumpT = 1 Then
  1844. GI11.state = 1
  1845. Light7.state = 1
  1846. GI10.state = 0
  1847. Light6.state = 0
  1848. end If
  1849. if bumpB = 0 and bumpT = 0 Then
  1850. GI11.state = 0
  1851. Light7.state = 0
  1852. GI10.state =0
  1853. Light6.state = 0
  1854. end if
  1855. end Sub
  1856.  
  1857. sub GIRight
  1858. for each obj in GIR
  1859. obj.state=1
  1860. Next
  1861. for each obj in GIL
  1862. obj.state=0
  1863. Next
  1864. '********** bottom clouds in B2S ************
  1865. If B2SOn Then
  1866. if ballinplay>0 and ballinplay<6 then
  1867. Controller.B2SSetData 12, 0
  1868. Controller.B2SSetData 14, 1
  1869. Else
  1870. Controller.B2SSetData 12, 0
  1871. Controller.B2SSetData 14, 0
  1872. End If
  1873. End If
  1874. '********************************************
  1875.  
  1876. 'condition
  1877. 'Targets Top
  1878. GI01.state = 0
  1879. GI02.state = 0
  1880. GI1.state = 1
  1881. GI2.state = 1
  1882.  
  1883. 'on/off
  1884. on1.state=0
  1885. off2.state=0
  1886. on2.state=1
  1887. off1.state=1
  1888.  
  1889. 'Left Outlane
  1890. loutl.state = 1
  1891. routl.state = 0
  1892.  
  1893. 'Bumpers
  1894. if bumpB = 1 or bumpT = 1 Then
  1895. GI11.state = 0
  1896. Light7.state = 0
  1897. GI10.state =1
  1898. Light6.state = 1
  1899. end If
  1900. if bumpB = 0 and bumpT = 0 Then
  1901. GI11.state = 0
  1902. Light7.state = 0
  1903. GI10.state =0
  1904. Light6.state = 0
  1905. end If
  1906. end Sub
  1907.  
  1908. ' *********************************************************************
  1909. ' Supporting Ball & Sound Functions
  1910. ' *********************************************************************
  1911.  
  1912. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1913. Vol = Csng(BallVel(ball) ^2 / 2000)
  1914. End Function
  1915.  
  1916. Function Vol2(ball1, ball2) ' Calculates the Volume of the sound based on the speed of two balls
  1917. Vol2 = (Vol(ball1) + Vol(ball2) ) / 2
  1918. End Function
  1919.  
  1920. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1921. Dim tmp
  1922. tmp = ball.x * 2 / table1.width-1
  1923. If tmp> 0 Then
  1924. Pan = Csng(tmp ^10)
  1925. Else
  1926. Pan = Csng(-((- tmp) ^10) )
  1927. End If
  1928. End Function
  1929.  
  1930. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1931. Pitch = BallVel(ball) * 20
  1932. End Function
  1933.  
  1934. Function BallVel(ball) 'Calculates the ball speed
  1935. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ))
  1936. End Function
  1937.  
  1938. '*****************************************
  1939. ' JP's VP10 Collision & Rolling Sounds
  1940. '*****************************************
  1941.  
  1942. Const tnob = 5 ' total number of balls
  1943. ReDim rolling(tnob)
  1944. ReDim collision(tnob)
  1945. Initcollision
  1946.  
  1947. Sub Initcollision
  1948. Dim i
  1949. For i = 0 to tnob
  1950. collision(i) = -1
  1951. rolling(i) = False
  1952. Next
  1953. End Sub
  1954.  
  1955. Sub CollisionTimer_Timer()
  1956. Dim BOT, B, B1, B2, dx, dy, dz, distance, radii
  1957. BOT = GetBalls
  1958.  
  1959. ' rolling
  1960.  
  1961. For B = UBound(BOT) +1 to tnob
  1962. rolling(b) = False
  1963. StopSound("fx_ballrolling" & b)'
  1964. Next
  1965.  
  1966. If UBound(BOT) = -1 Then Exit Sub
  1967.  
  1968. For B = 0 to UBound(BOT)
  1969. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 AND BOT(b).z > 0 Then
  1970. rolling(b) = True
  1971. PlaySound("fx_ballrolling" & b), -1, 100, Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1972. ' PlaySound("fx_ballrolling"), -1, Vol(BOT(b) )*15, Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1973.  
  1974. Else
  1975. If rolling(b) = True Then
  1976. StopSound("fx_ballrolling" & b)
  1977. rolling(b) = False
  1978. End If
  1979. End If
  1980. Next
  1981.  
  1982. 'collision
  1983.  
  1984. If UBound(BOT) < 1 Then Exit Sub
  1985.  
  1986. For B1 = 0 to UBound(BOT)
  1987. For B2 = B1 + 1 to UBound(BOT)
  1988. dz = INT(ABS((BOT(b1).z - BOT(b2).z) ) )
  1989. radii = BOT(b1).radius + BOT(b2).radius
  1990. If dz <= radii Then
  1991.  
  1992. dx = INT(ABS((BOT(b1).x - BOT(b2).x) ) )
  1993. dy = INT(ABS((BOT(b1).y - BOT(b2).y) ) )
  1994. distance = INT(SQR(dx ^2 + dy ^2) )
  1995.  
  1996. If distance <= radii AND (collision(b1) = -1 OR collision(b2) = -1) Then
  1997. collision(b1) = b2
  1998. collision(b2) = b1
  1999. PlaySound("fx_collide"), 0, Vol2(BOT(b1), BOT(b2)), Pan(BOT(b1)), 0, Pitch(BOT(b1)), 0, 0
  2000. Else
  2001. If distance > (radii + 10) Then
  2002. If collision(b1) = b2 Then collision(b1) = -1
  2003. If collision(b2) = b1 Then collision(b2) = -1
  2004. End If
  2005. End If
  2006. End If
  2007. Next
  2008. Next
  2009. End Sub
  2010.  
  2011. ' ********** Some sounds *************
  2012.  
  2013. Sub LeftFlipper_Collide(parm) : RandomSoundFlipper() : End Sub
  2014. Sub RightFlipper_Collide(parm) : RandomSoundFlipper() : End Sub
  2015. Sub MetalsThin_Hit (idx)
  2016. debug.print "metal sounds"
  2017. PlaySound "metalhit_thin", 0, Vol(ActiveBall)*GlobalSoundLevel, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2018. End Sub
  2019.  
  2020.  
  2021. Sub Rubbers_Hit(idx)
  2022. debug.print "rubbers sounds"
  2023. dim finalspeed
  2024. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2025. If finalspeed > 20 then
  2026. PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2027. End if
  2028. If finalspeed >= 1 AND finalspeed <= 20 then
  2029. RandomSoundRubber()
  2030. End If
  2031. End Sub
  2032.  
  2033. Sub wood_hit(idx)
  2034. debug.print "rubbers sounds case"
  2035.  
  2036. PlaySound "Post1", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2037. End Sub
  2038.  
  2039. Sub RandomSoundRubber()
  2040. debug.print "rubbers sounds case"
  2041.  
  2042. Select Case Int(Rnd*3)+1
  2043. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2044. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2045. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2046. End Select
  2047. End Sub
  2048.  
  2049. Sub RandomSoundFlipper()
  2050. Select Case Int(Rnd*3)+1
  2051. Case 1 :PlaySound "flip_hit_1", 0, GlobalSoundLevel * ballvel(ActiveBall) / 50, -0.1, 0.25
  2052. Case 2 :PlaySound "flip_hit_2", 0, GlobalSoundLevel * ballvel(ActiveBall) / 50, -0.1, 0.25
  2053. Case 3 :PlaySound "flip_hit_3", 0, GlobalSoundLevel * ballvel(ActiveBall) / 50, -0.1, 0.25
  2054. End Select
  2055. End Sub
Advertisement
Add Comment
Please, Sign In to add comment