Arngrim

Untitled

Sep 26th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.25 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. Const cGameName="closeenc",UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="fx_Flipperup",SFlipperOff="fx_Flipperdown"
  10. Const SCoin="coin",cCredits=""
  11. Const VT_Delay_Factor = .88 'used to slow down the ball when hitting the vari target, smaller number slows down faster
  12.  
  13. LoadVPM"01150000","GTS1.VBS",3.22
  14.  
  15. '**********************************************************
  16. '******** OPTIONS *******************************
  17. '**********************************************************
  18.  
  19. Dim BallShadows: Ballshadows=0 '******************set to 1 to turn on Ball shadows
  20. Dim FlipperShadows: FlipperShadows=0 '***********set to 1 to turn on Flipper shadows
  21.  
  22.  
  23.  
  24. 'Solenoid Call backs
  25. '**********************************************************************************************************
  26. SolCallback(1)="DrainKick"
  27. SolCallback(2)="vpmSolSound SoundFX(""Knock"",DOFKnocker),"
  28. SolCallback(3)="vpmSolSound SoundFX(""10tone"",DOFChimes),"
  29. SolCallback(4)="vpmSolSound SoundFX(""100tone"",DOFChimes),"
  30. SolCallback(5)="vpmSolSound SoundFX(""1000tone"",DOFChimes),"
  31.  
  32.  
  33. SolCallback(7)="SolRoto"
  34. SolCallback(8)="Rraised" '"dtLeft.SolDropUp"
  35. SolCallback(17)= "FastFlips.TiltSol"
  36. SolCallback(sLRFlipper) = "SolRFlipper"
  37. SolCallback(sLLFlipper) = "SolLFlipper"
  38.  
  39. Sub Rraised(enabled)
  40. if enabled then Rreset.enabled=True
  41. End Sub
  42.  
  43. Sub Rreset_timer
  44. ' dtRight.DropSol_On
  45. for each objekt in a_droptargets
  46. objekt.isdropped=0
  47. next
  48. controller.switch(20) = 0
  49. controller.switch(30) = 0
  50. controller.switch(40) = 0
  51. controller.switch(50) = 0
  52. controller.switch(60) = 0
  53. PlaySoundAt SoundFX("DTreset", DOFContactors), sw40
  54. For each light in DTRightLights: light.state=0: Next
  55. Rreset.enabled=false
  56. End Sub
  57.  
  58. Sub DrainKick(enabled)
  59. If enabled Then
  60. Drain.kick 70, 10
  61. PlaySoundAt SoundFX("ballrelease",DOFContactors), Drain
  62. End If
  63. end Sub
  64.  
  65. Sub Drain_Hit
  66. PlaySoundAt "drain", Drain
  67. controller.switch(66) = 1
  68. End Sub
  69.  
  70. sub Drain_unhit
  71. controller.Switch(66) = 0
  72. end sub
  73.  
  74. Sub SolLFlipper(Enabled)
  75. If Enabled Then
  76. PlaySoundAt SoundFX("fx_flipperup",DOFFlippers), LeftFlipper
  77. LeftFlipper.RotateToEnd
  78. Else
  79. PlaySoundAt SoundFX("fx_flipperdown",DOFFlippers), LeftFlipper
  80. LeftFlipper.RotateToStart
  81. End If
  82. End Sub
  83.  
  84. Sub SolRFlipper(Enabled)
  85. If Enabled Then
  86. PlaySoundAt SoundFX("fx_flipperup",DOFFlippers), RightFlipper
  87. RightFlipper.RotateToEnd
  88. Else
  89. PlaySoundAt SoundFX("fx_flipperdown",DOFFlippers), RightFlipper
  90. RightFlipper.RotateToStart
  91. End If
  92. End Sub
  93.  
  94. '**********************************************************************************************************
  95.  
  96.  
  97. 'Primitive Flipper Code
  98.  
  99. Sub FlipperTimer_Timer
  100. dim PI:PI=3.1415926
  101. lflip.roty = LeftFlipper.currentangle
  102. rflip.roty = RightFlipper.currentangle
  103. Pgate1.rotz = (Gate1.currentangle*.75)+25
  104. PGate2.rotz = (Gate2.currentangle*.75)+25
  105. SpinnerP.Rotz = sw10.CurrentAngle
  106. SpinnerRod.TransZ = sin( (sw10.CurrentAngle+180) * (2*PI/360)) * 5
  107. SpinnerRod.TransX = -1*(sin( (sw10.CurrentAngle- 90) * (2*PI/360)) * 5)
  108.  
  109. if FlipperShadows=1 then
  110. FlipperLSh.RotZ = LeftFlipper.currentangle
  111. FlipperRSh.RotZ = RightFlipper.currentangle
  112. end if
  113.  
  114. End Sub
  115.  
  116. '**********************************************************************************************************
  117.  
  118. 'Initiate Table
  119. '**********************************************************************************************************
  120.  
  121. Dim dtRight
  122. Dim BPG, hsaward, n, plungerball, xx, Lstep, FastFlips, objekt
  123.  
  124. Sub CloseEncounters_Init
  125. vpmInit Me
  126. plungerball=0
  127. CurrRotoPos=1
  128. On Error Resume Next
  129. With Controller
  130. .GameName = cGameName
  131. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  132. .SplashInfoLine="Close Encounters (Gottlieb 1978)"
  133. .HandleMechanics=0
  134. .HandleKeyboard=0
  135. .ShowDMDOnly=1
  136. .ShowFrame=0
  137. .ShowTitle=0
  138. .hidden = 1
  139. If Err Then MsgBox Err.Description
  140. End With
  141. On Error Goto 0
  142. Controller.SolMask(0)=0
  143. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  144. Controller.Run
  145. If Err Then MsgBox Err.Description
  146. On Error Goto 0
  147.  
  148. PinMAMETimer.Interval=PinMAMEInterval
  149. PinMAMETimer.Enabled=1
  150. vpmNudge.TiltSwitch=4
  151. vpmNudge.Sensitivity=3
  152. vpmNudge.TiltObj=Array(BumperL,BumperR,SlingL)
  153.  
  154. Set FastFlips = new cFastFlips
  155. with FastFlips
  156. .CallBackL = "SolLflipper" 'Point these to flipper subs
  157. .CallBackR = "SolRflipper" '...
  158. ' .CallBackUL = "SolULflipper"'...(upper flippers, if needed)
  159. ' .CallBackUR = "SolURflipper"'...
  160. .TiltObjects = True 'Optional, if True calls vpmnudge.solgameon automatically. IF YOU GET A LINE 1 ERROR, DISABLE THIS! (or setup vpmNudge.TiltObj!)
  161. .InitDelay "FastFlips", 100 'Optional, if > 0 adds some compensation for solenoid jitter (occasional problem on Bram Stoker's Dracula)
  162. .DebugOn = False 'Debug, always-on flippers. Call FastFlips.DebugOn True or False in debugger to enable/disable.
  163. end with
  164.  
  165.  
  166. ' set dtRight = new cvpmdroptarget
  167. ' With dtRight
  168. ' .initdrop Array(sw20,sw50,sw30,sw60,sw40), array(20,50,30,60,40)
  169. ' .InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  170. ' End With
  171.  
  172. FindDips 'find balls per game and high score reward
  173.  
  174. If B2SOn Then 'Show Desktop components
  175. for each objekt in BackdropStuff: objekt.visible=0: next
  176. Else
  177. for each objekt in BackdropStuff: objekt.visible=1: next
  178. End if
  179.  
  180. if ballshadows=1 then
  181. BallShadowUpdate.enabled=1
  182. else
  183. BallShadowUpdate.enabled=0
  184. end if
  185.  
  186. if flippershadows=1 then
  187. FlipperLSh.visible=1
  188. FlipperRSh.visible=1
  189. else
  190. FlipperLSh.visible=0
  191. FlipperRSh.visible=0
  192. end if
  193.  
  194. drain.createball
  195. startGame.enabled=true
  196.  
  197. End Sub
  198.  
  199.  
  200. Sub CloseEncounters_Paused:Controller.Pause = 1:End Sub
  201.  
  202. Sub CloseEncounters_unPaused:Controller.Pause = 0:End Sub
  203.  
  204. Sub CloseEncounters_Exit
  205. If b2son then controller.stop
  206. End Sub
  207.  
  208. sub startGame_timer
  209. playsoundat "poweron", Plunger
  210. For each xx in GILights:xx.State = 1: Next '*****GI Lights On
  211. RotoFlasher.visible=1
  212. me.enabled=false
  213. end sub
  214.  
  215.  
  216. Sub CloseEncounters_KeyDown(ByVal keycode)
  217. If keycode = LeftFlipperKey Then FastFlips.FlipL True : FastFlips.FlipUL True
  218. If keycode = RightFlipperKey Then FastFlips.FlipR True : FastFlips.FlipUR True
  219. If vpmKeyDown(KeyCode) Then Exit Sub
  220. If keycode=AddCreditKey then PlaySoundAt "coin", Drain: vpmTimer.pulseSW (swCoin1): end if
  221. If keycode=PlungerKey Then Plunger.Pullback:PlaySoundAt "plungerpull", Plunger
  222.  
  223. '************************ Start Ball Control 1/3
  224. if keycode = 46 then ' C Key
  225. If contball = 1 Then
  226. contball = 0
  227. Else
  228. contball = 1
  229. End If
  230. End If
  231. if keycode = 48 then 'B Key
  232. If bcboost = 1 Then
  233. bcboost = bcboostmulti
  234. Else
  235. bcboost = 1
  236. End If
  237. End If
  238. if keycode = 203 then bcleft = 1 ' Left Arrow
  239. if keycode = 200 then bcup = 1 ' Up Arrow
  240. if keycode = 208 then bcdown = 1 ' Down Arrow
  241. if keycode = 205 then bcright = 1 ' Right Arrow
  242. '************************ End Ball Control 1/3
  243.  
  244. End Sub
  245.  
  246. Sub CloseEncounters_KeyUp(ByVal keycode)
  247. If keycode = LeftFlipperKey Then FastFlips.FlipL False : FastFlips.FlipUL False
  248. If keycode = RightFlipperKey Then FastFlips.FlipR False : FastFlips.FlipUR False
  249.  
  250. If keycode = 61 then FindDips
  251. If vpmKeyUp(KeyCode) Then Exit Sub
  252. If keycode=PlungerKey Then
  253. Plunger.Fire
  254. if plungerball=1 then
  255. PlaySoundAt "plungerreleaseball", Plunger
  256. else
  257. PlaySoundAt "plungerreleasefree", Plunger
  258. end if
  259. end if
  260.  
  261. '************************ Start Ball Control 2/3
  262. if keycode = 203 then bcleft = 0 ' Left Arrow
  263. if keycode = 200 then bcup = 0 ' Up Arrow
  264. if keycode = 208 then bcdown = 0 ' Down Arrow
  265. if keycode = 205 then bcright = 0 ' Right Arrow
  266. '************************ End Ball Control 2/3
  267.  
  268. End Sub
  269.  
  270. '************************ Start Ball Control 3/3
  271. Sub StartControl_Hit()
  272. Set ControlBall = ActiveBall
  273. contballinplay = true
  274. End Sub
  275.  
  276. Sub StopControl_Hit()
  277. contballinplay = false
  278. End Sub
  279.  
  280. Dim bcup, bcdown, bcleft, bcright, contball, contballinplay, ControlBall, bcboost
  281. Dim bcvel, bcyveloffset, bcboostmulti
  282.  
  283. bcboost = 1 'Do Not Change - default setting
  284. bcvel = 4 'Controls the speed of the ball movement
  285. bcyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  286. bcboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  287.  
  288. Sub BallControl_Timer()
  289. If Contball and ContBallInPlay then
  290. If bcright = 1 Then
  291. ControlBall.velx = bcvel*bcboost
  292. ElseIf bcleft = 1 Then
  293. ControlBall.velx = - bcvel*bcboost
  294. Else
  295. ControlBall.velx=0
  296. End If
  297.  
  298. If bcup = 1 Then
  299. ControlBall.vely = -bcvel*bcboost
  300. ElseIf bcdown = 1 Then
  301. ControlBall.vely = bcvel*bcboost
  302. Else
  303. ControlBall.vely= bcyveloffset
  304. End If
  305. End If
  306. End Sub
  307. '************************ End Ball Control 3/3
  308.  
  309. Sub Ballhome_hit
  310. plungerball=1
  311. end sub
  312.  
  313. sub ballhome_unhit
  314. plungerball=0
  315. end sub
  316.  
  317.  
  318.  
  319.  
  320. 'bumpers
  321. Sub BumperL_Hit
  322. vpmTimer.PulseSw 21
  323. PlaySoundAt SoundFXDOF("fx_bumper",105, DOFPulse, DOFContactors), BumperL
  324. End Sub
  325.  
  326. Sub BumperR_Hit
  327. vpmTimer.PulseSw 21
  328. PlaySoundAt SoundFXDOF("fx_bumper",106, DOFPulse, DOFContactors), BumperR
  329. End Sub
  330.  
  331. 'Hit Targets
  332.  
  333. Sub sw11_Hit:vpmTimer.PulseSw 11:End Sub
  334. Sub sw51_Hit:vpmTimer.PulseSw 51:End Sub
  335. Sub sw61_Hit:vpmTimer.PulseSw 61:End Sub
  336.  
  337.  
  338. 'Rollover wire Triggers
  339.  
  340. Sub sw12_Hit:Controller.Switch(12) = 1:End Sub
  341. Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
  342. Sub sw13_Hit:Controller.Switch(13) = 1:End Sub
  343. Sub sw13_UnHit:Controller.Switch(13) = 0:End Sub
  344. Sub sw14_Hit:Controller.Switch(14) = 1:End Sub
  345. Sub sw14_UnHit:Controller.Switch(14) = 0:End Sub
  346. Sub sw32_Hit:Controller.Switch(32) = 1:DOF 109, DOFOn:End Sub
  347. Sub sw32_UnHit:Controller.Switch(32) = 0:DOF 109, DOFOff:End Sub
  348. Sub sw34_Hit:Controller.Switch(34) = 1:DOF 110, DOFOn:End Sub
  349. Sub sw34_UnHit:Controller.Switch(34) = 0:DOF 110, DOFOff:End Sub
  350. Sub sw41_Hit:Controller.Switch(41) = 1:DOF 107, DOFOn:End Sub
  351. Sub sw41_UnHit:Controller.Switch(41) = 0:DOF 107, DOFOff:End Sub
  352. Sub sw41a_Hit:Controller.Switch(41) = 1:DOF 102, DOFOn:End Sub
  353. Sub sw41a_UnHit:Controller.Switch(41) = 0:DOF 102, DOFOff:End Sub
  354. Sub sw41b_Hit:Controller.Switch(41) = 1:DOF 101, DOFOn:End Sub
  355. Sub sw41b_UnHit:Controller.Switch(41) = 0:DOF 101, DOFOff:End Sub
  356.  
  357.  
  358. 'Slingshot
  359.  
  360. Sub LeftSlingShot_Slingshot
  361. vpmTimer.PulseSw 31
  362. PlaySoundAt SoundFX("left_slingshot",DOFContactors), slingL
  363. DOF 104, DOFPulse
  364. LSling.Visible = 0
  365. LSling1.Visible = 1
  366. slingL.objroty = 15
  367. LStep = 1
  368. LeftSlingShot.TimerEnabled = 1
  369. End Sub
  370.  
  371. Sub LeftSlingShot_Timer
  372. Select Case LStep
  373. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:slingL.objroty = 7
  374. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:slingL.objroty = 0:LeftSlingShot.TimerEnabled = 0:
  375. End Select
  376. LStep = LStep + 1
  377. End Sub
  378.  
  379. 'Scoring rubbers - ANIMATED!!!!!
  380.  
  381. Sub sw31a_hit()
  382. vpmTimer.PulseSw 31
  383. R31a.visible=0
  384. R31a1.visible=1
  385. me.uservalue=1
  386. me.timerenabled=1
  387. End Sub
  388.  
  389. sub sw31a_timer
  390. select case sw31a.uservalue
  391. Case 1: r31a1.visible=0: r31a.visible=1
  392. Case 2: r31a.visible=0: r31a2.visible=1
  393. Case 3: r31a2.visible=0: r31a.visible=1: me.timerenabled=0
  394. end Select
  395. me.uservalue=me.uservalue+1
  396. end sub
  397.  
  398. Sub sw31b_hit()
  399. vpmTimer.PulseSw 31
  400. R31b.visible=0
  401. R31b1.visible=1
  402. me.uservalue=1
  403. me.timerenabled=1
  404. End Sub
  405.  
  406. sub sw31b_timer
  407. select case sw31b.uservalue
  408. Case 1: r31b1.visible=0: r31b.visible=1
  409. Case 2: r31b.visible=0: r31b2.visible=1
  410. Case 3: r31b2.visible=0: r31b.visible=1: me.timerenabled=0
  411. end Select
  412. me.uservalue=me.uservalue+1
  413. end sub
  414.  
  415. Sub sw31c_hit()
  416. vpmTimer.PulseSw 31
  417. R31c.visible=0
  418. R31c1.visible=1
  419. me.uservalue=1
  420. me.timerenabled=1
  421. End Sub
  422.  
  423. sub sw31c_timer
  424. select case sw31c.uservalue
  425. Case 1: r31c1.visible=0: r31c.visible=1
  426. Case 2: r31c.visible=0: r31c2.visible=1
  427. Case 3: r31c2.visible=0: r31c.visible=1: me.timerenabled=0
  428. end Select
  429. me.uservalue=me.uservalue+1
  430. end sub
  431.  
  432. Sub sw31d_hit()
  433. vpmTimer.PulseSw 31
  434. R31d.visible=0
  435. R31d1.visible=1
  436. me.uservalue=1
  437. me.timerenabled=1
  438. End Sub
  439.  
  440. sub sw31d_timer
  441. select case sw31d.uservalue
  442. Case 1: r31d1.visible=0: r31d.visible=1
  443. Case 2: r31d.visible=0: r31d2.visible=1
  444. Case 3: r31d2.visible=0: r31d.visible=1: me.timerenabled=0
  445. end Select
  446. me.uservalue=me.uservalue+1
  447. end sub
  448.  
  449. Sub sw31e_hit()
  450. vpmTimer.PulseSw 31
  451. R31e.visible=0
  452. R31e1.visible=1
  453. me.uservalue=1
  454. me.timerenabled=1
  455. End Sub
  456.  
  457. sub sw31e_timer
  458. select case sw31e.uservalue
  459. Case 1: r31e1.visible=0: r31e.visible=1
  460. Case 2: r31e.visible=0: r31e2.visible=1
  461. Case 3: r31e2.visible=0: r31e.visible=1: me.timerenabled=0
  462. end Select
  463. me.uservalue=me.uservalue+1
  464. end sub
  465.  
  466. Sub sw31f_hit()
  467. vpmTimer.PulseSw 31
  468. R31f.visible=0
  469. R31f1.visible=1
  470. me.uservalue=1
  471. me.timerenabled=1
  472. End Sub
  473.  
  474. sub sw31f_timer
  475. select case sw31f.uservalue
  476. Case 1: r31f1.visible=0: r31f.visible=1
  477. Case 2: r31f.visible=0: r31f2.visible=1
  478. Case 3: r31f2.visible=0: r31f.visible=1: me.timerenabled=0
  479. end Select
  480. me.uservalue=me.uservalue+1
  481. end sub
  482.  
  483. Sub sw31g_hit()
  484. vpmTimer.PulseSw 31
  485. R31g.visible=0
  486. R31g1.visible=1
  487. me.uservalue=1
  488. me.timerenabled=1
  489. End Sub
  490.  
  491. sub sw31g_timer
  492. select case sw31g.uservalue
  493. Case 1: r31g1.visible=0: r31g.visible=1
  494. Case 2: r31g.visible=0: r31g2.visible=1
  495. Case 3: r31g2.visible=0: r31g.visible=1: me.timerenabled=0
  496. end Select
  497. me.uservalue=me.uservalue+1
  498. end sub
  499.  
  500. 'Drop Targets
  501.  
  502. Sub sw20_dropped
  503. controller.switch(20) = 1
  504. ' dtRight.Hit 1
  505. Lsw20.state=1
  506. End Sub
  507.  
  508. Sub sw30_dropped
  509. controller.switch(30) = 1
  510. ' dtRight.Hit 3
  511. Lsw30.state=1
  512. Lsw30a.state=1
  513. End Sub
  514.  
  515. Sub sw40_dropped
  516. controller.switch(40) = 1
  517. ' dtRight.Hit 5
  518. Lsw40.state=1
  519. End Sub
  520.  
  521. Sub sw50_dropped
  522. controller.switch(50) = 1
  523. ' dtRight.Hit 2
  524. Lsw50.state=1
  525. Lsw50a.state=1
  526. End Sub
  527.  
  528. Sub sw60_dropped
  529. controller.switch(60) = 1
  530. ' dtRight.Hit 4
  531. Lsw60.state=1
  532. End Sub
  533.  
  534. 'Spinner
  535. Sub sw10_Spin:vpmTimer.PulseSw 10 : playsoundat "fx_spinner", sw10 : End Sub
  536.  
  537. ' NEW ROTO CODE by Pinuck modified by BorgDog to fit primitive roto targets
  538. ' ========================
  539.  
  540. ' -- roto switches:
  541. ' Left Star = 32
  542. ' Left 300 = 42
  543. ' Left 400 = 52
  544. ' Left 500 = 62
  545. ' Center Star = 33
  546. ' Center 300 = 43
  547. ' Center 400 = 53
  548. ' Center 500 = 63
  549. ' Right Star = 34
  550. ' Right 300 = 44
  551. ' Right 400 = 54
  552. ' Right 500 = 64
  553.  
  554.  
  555. ' -- rotowheel's 15 targets
  556. ' 1 400
  557. ' 2 Star
  558. ' 3 300
  559. ' 4 400
  560. ' 5 Star
  561. ' 6 300
  562. ' 7 400
  563. ' 8 Star
  564. ' 9 300
  565. ' 10 500
  566. ' 11 Star
  567. ' 12 400
  568. ' 13 300
  569. ' 14 Star
  570. ' 15 500
  571.  
  572. Dim RotoTick, NewRotoPos, CurrRotoPos, RotoSpinning, rotoSW, rotoP
  573. 'Dim R1Value, R2Value, R3Value
  574. rotoSW = array(5,4,1,3,4,1,3,4,1,3,5,1,4,3,1,5,4)
  575. rotoP = array(n, Proto1, Proto2, Proto3, Proto4, Proto5, Proto6, Proto7, Proto8, Proto9, Proto10, Proto11, Proto12, Proto13, Proto14, Proto15)
  576.  
  577. Sub SolRoto(Enabled)
  578. if RotoTimer.enabled=0 then
  579. NewRotoPos = CurrRotoPos - 3 - Int(5 * Rnd) 'random but not overlapping old (from Scapino)
  580. If NewRotoPos<1 Then NewRotoPos=NewRotoPos+15
  581. RotoTimer.enabled=1 'spin it!
  582. DOF 112, DOFOn
  583. PlaySoundAt SoundFX("roto_9",DOFGear), TrotoCenter
  584. end if
  585. End Sub
  586.  
  587. Sub RotoTimer_Timer() 'enable to spin roto
  588. dim roti
  589. RotoTick=RotoTick+1
  590. for roti=1 to 15
  591. rotoP(roti).roty=rotoP(roti).roty+3
  592. next
  593. if rotoP(NewRotoPos).roty=12 then
  594. me.enabled=0
  595. DOF 112, DOFOff
  596. stopsound "roto_9"
  597. for roti=1 to 15
  598. rotoP(roti).roty=rotoP(roti).roty-12
  599. next
  600. CurrRotoPos=NewRotoPos
  601. end if
  602. for roti=1 to 15
  603. if rotoP(roti).roty>359 then rotoP(roti).roty=rotoP(roti).roty-360
  604. next
  605. End Sub
  606.  
  607.  
  608.  
  609. Sub TrotoLeft_Hit 'LEFT ROTO
  610. if CurrRotoPos=1 then
  611. rotoP(15).rotx=3
  612. else
  613. rotoP(CurrRotoPos-1).rotx=3
  614. end if
  615. me.timerenabled=1
  616. If RotoTimer.enabled=1 Then Exit Sub
  617. Select Case (rotoSW(CurrRotoPos-1))
  618. Case 1:vpmtimer.PulseSw(32):DOF 108, DOFPulse 'Star
  619. Case 3:vpmtimer.PulseSw(42) '300
  620. Case 4:vpmtimer.PulseSw(52) '400
  621. Case 5:vpmtimer.PulseSw(62) '500
  622. End Select
  623. End Sub
  624.  
  625. Sub TrotoLeft_timer
  626. if CurrRotoPos=1 then
  627. rotoP(15).rotx=0
  628. else
  629. rotoP(CurrRotoPos-1).rotx=0
  630. end if
  631. end sub
  632.  
  633. Sub TrotoCenter_Hit 'CENTER ROTO
  634. rotoP(CurrRotoPos).rotx=3
  635. me.timerenabled=1
  636. If RotoTimer.enabled=1 Then Exit Sub
  637. Select Case (rotoSW(CurrRotoPos))
  638. Case 1:vpmtimer.PulseSw(33) 'Star
  639. Case 3:vpmtimer.PulseSw(43) '300
  640. Case 4:vpmtimer.PulseSw(53) '400
  641. Case 5:vpmtimer.PulseSw(63) '500
  642. End Select
  643. End Sub
  644.  
  645. Sub TrotoCenter_timer
  646. rotoP(CurrRotoPos).rotx=0
  647. end sub
  648.  
  649. Sub TrotoRight_Hit 'RIGHT ROTO
  650. if CurrRotoPos=15 then
  651. rotoP(1).rotx=3
  652. else
  653. rotoP(CurrRotoPos+1).rotx=3
  654. end if
  655. me.timerenabled=1
  656. If RotoTimer.enabled=1 Then Exit Sub
  657. Select Case (rotoSW(CurrRotoPos+1))
  658. Case 1:vpmtimer.PulseSw(34):DOF 111, DOFPulse 'Star
  659. Case 3:vpmtimer.PulseSw(44) '300
  660. Case 4:vpmtimer.PulseSw(54) '400
  661. Case 5:vpmtimer.PulseSw(64) '500
  662. End Select
  663. End Sub
  664.  
  665. Sub TrotoRight_timer
  666. if CurrRotoPos=15 then
  667. rotoP(1).rotx=0
  668. else
  669. rotoP(CurrRotoPos+1).rotx=0
  670. end if
  671. end sub
  672.  
  673.  
  674. ' END ROTO -----
  675.  
  676. Dim N1,O1, Light
  677. N1=0:O1=0:
  678. Set LampCallback=GetRef("UpdateMultipleLamps")
  679.  
  680. Sub UpdateMultipleLamps
  681.  
  682. N1=Controller.Lamp(1) 'Game Over triggers match and BIP
  683. If N1 then
  684. EMReelBIP.setvalue 1
  685. EMReelNTM.setvalue 0
  686. EMReelGO.setvalue 0
  687. else
  688. EMReelBIP.setvalue 0
  689. EMReelNTM.setvalue 1
  690. EMReelGO.setvalue 1
  691. end if
  692.  
  693. N1=Controller.Lamp(2) 'Tilt
  694. If N1 then
  695. EMReelTilt.setvalue 1
  696. else
  697. EMReelTilt.setvalue 0
  698. end if
  699.  
  700. N1=Controller.Lamp(4) 'Shoot Again
  701. If N1 then
  702. EMReelSPSA.setvalue 1
  703. else
  704. EMReelSPSA.setvalue 0
  705. end if
  706.  
  707. N1=Controller.Lamp(3) 'HIGH SCORE TO DATE
  708. if N1 then
  709. EMReelHTD.setvalue 1
  710. else
  711. EMReelHTD.setvalue 0
  712. end if
  713.  
  714. End Sub
  715.  
  716.  
  717.  
  718. '**********************************************************************************************************
  719.  
  720. 'Map lights to an array
  721. '**********************************************************************************************************
  722. 'Set Lights(1) = l1 'Game Over Backbox
  723. 'Set Lights(2) = l2 'Tilt Backbox
  724. 'Set Lights(3) = l3 'High Score Backbox
  725. Set Lights(4) = l4 ' Shoot Again Playfield and backglass
  726. Set Lights(5) = l5
  727. Set Lights(6) = l6
  728. Set Lights(7) = l7
  729. Set Lights(8) = l8
  730. Set Lights(9) = l9
  731. Set Lights(10) = l10
  732. Set Lights(11) = l11
  733. Set Lights(12) = l12
  734. Set Lights(13) = l13
  735. Set Lights(14) = l14
  736. Set Lights(15) = l15
  737. Set Lights(16) = l16
  738. Set Lights(17) = l17
  739. Set Lights(18) = l18
  740. Set Lights(19) = l19
  741. Set Lights(20) = l20
  742. Set Lights(21) = l21
  743. Set Lights(22) = l22
  744. Set Lights(23) = l23
  745. Set Lights(24) = l24
  746. Set Lights(25) = l25
  747. Set Lights(26) = l26
  748. Set Lights(27) = l27
  749. Set Lights(28) = l28
  750. Set Lights(29) = l29
  751. Set Lights(30) = l30
  752. Set Lights(31) = l31
  753. Set Lights(32) = l32
  754. Set Lights(33) = l33
  755. Set Lights(34) = l34
  756. Set Lights(35) = L35
  757. Set Lights(36) = l36
  758.  
  759.  
  760.  
  761. Dim Digits(32)
  762.  
  763. 'Score displays
  764.  
  765. Digits(0)=Array(a1,a2,a3,a4,a5,a6,a7,n,a8)
  766. Digits(1)=Array(a9,a10,a11,a12,a13,a14,a15,n,a16)
  767. Digits(2)=Array(a17,a18,a19,a20,a21,a22,a23,n,a24)
  768. Digits(3)=Array(a25,a26,a27,a28,a29,a30,a31,n,a32)
  769. Digits(4)=Array(a33,a34,a35,a36,a37,a38,a39,n,a40)
  770. Digits(5)=Array(a41,a42,a43,a44,a45,a46,a47,n,a48)
  771. Digits(6)=Array(a49,a50,a51,a52,a53,a54,a55,n,a56)
  772. Digits(7)=Array(a57,a58,a59,a60,a61,a62,a63,n,a64)
  773. Digits(8)=Array(a65,a66,a67,a68,a69,a70,a71,n,a72)
  774. Digits(9)=Array(a73,a74,a75,a76,a77,a78,a79,n,a80)
  775. Digits(10)=Array(a81,a82,a83,a84,a85,a86,a87,n,a88)
  776. Digits(11)=Array(a89,a90,a91,a92,a93,a94,a95,n,a96)
  777. Digits(12)=Array(a97,a98,a99,a100,a101,a102,a103,n,a104)
  778. Digits(13)=Array(a105,a106,a107,a108,a109,a110,a111,n,a112)
  779. Digits(14)=Array(a113,a114,a115,a116,a117,a118,a119,n,a120)
  780. Digits(15)=Array(a121,a122,a123,a124,a125,a126,a127,n,a128)
  781. Digits(16)=Array(a129,a130,a131,a132,a133,a134,a135,n,a136)
  782. Digits(17)=Array(a137,a138,a139,a140,a141,a142,a143,n,a144)
  783. Digits(18)=Array(a145,a146,a147,a148,a149,a150,a151,n,a152)
  784. Digits(19)=Array(a153,a154,a155,a156,a157,a158,a159,n,a160)
  785. Digits(20)=Array(a161,a162,a163,a164,a165,a166,a167,n,a168)
  786. Digits(21)=Array(a169,a170,a171,a172,a173,a174,a175,n,a176)
  787. Digits(22)=Array(a177,a178,a179,a180,a181,a182,a183,n,a184)
  788. Digits(23)=Array(a185,a186,a187,a188,a189,a190,a191,n,a192)
  789.  
  790. 'Ball in Play and Credit displays
  791.  
  792. Digits(26)=Array(e00,e01,e02,e03,e04,e05,e06,n,e08)
  793. Digits(27)=Array(e10,e11,e12,e13,e14,e15,e16,n,e18)
  794. Digits(24)=Array(f00,f01,f02,f03,f04,f05,f06,n,f08)
  795. Digits(25)=Array(f10,f11,f12,f13,f14,f15,f16,n,f18)
  796.  
  797.  
  798.  
  799. Sub DisplayTimer_Timer
  800. Dim ChgLED,ii,num,chg,stat,obj
  801. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  802. If Not IsEmpty(ChgLED) Then
  803. If not b2son Then
  804. For ii = 0 To UBound(chgLED)
  805. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  806. if (num < 32) then
  807. For Each obj In Digits(num)
  808. If chg And 1 Then obj.State = stat And 1
  809. chg = chg\2 : stat = stat\2
  810. Next
  811. else
  812.  
  813. end if
  814. next
  815. end if
  816. end if
  817. End Sub
  818.  
  819.  
  820.  
  821. 'Finding an individual dip state based on scapino's Strikes and spares dip code - from unclewillys pinball pool
  822. Dim TheDips(32)
  823. Sub FindDips
  824. Dim DipsNumber
  825. DipsNumber = Controller.Dip(1)
  826. TheDips(16) = Int(DipsNumber/128)
  827. If TheDips(16) = 1 then DipsNumber = DipsNumber - 128 end if
  828. TheDips(15) = Int(DipsNumber/64)
  829. If TheDips(15) = 1 then DipsNumber = DipsNumber - 64 end if
  830. TheDips(14) = Int(DipsNumber/32)
  831. If TheDips(14) = 1 then DipsNumber = DipsNumber - 32 end if
  832. TheDips(13) = Int(DipsNumber/16)
  833. If TheDips(13) = 1 then DipsNumber = DipsNumber - 16 end if
  834. TheDips(12) = Int(DipsNumber/8)
  835. If TheDips(12) = 1 then DipsNumber = DipsNumber - 8 end if
  836. TheDips(11) = Int(DipsNumber/4)
  837. If TheDips(11) = 1 then DipsNumber = DipsNumber - 4 end if
  838. TheDips(10) = Int(DipsNumber/2)
  839. If TheDips(10) = 1 then DipsNumber = DipsNumber - 2 end if
  840. TheDips(9) = Int(DipsNumber)
  841. DipsNumber = Controller.Dip(2)
  842. TheDips(24) = Int(DipsNumber/128)
  843. If TheDips(24) = 1 then DipsNumber = DipsNumber - 128 end if
  844. TheDips(23) = Int(DipsNumber/64)
  845. If TheDips(23) = 1 then DipsNumber = DipsNumber - 64 end if
  846. TheDips(22) = Int(DipsNumber/32)
  847. If TheDips(22) = 1 then DipsNumber = DipsNumber - 32 end if
  848. TheDips(21) = Int(DipsNumber/16)
  849. If TheDips(21) = 1 then DipsNumber = DipsNumber - 16 end if
  850. TheDips(20) = Int(DipsNumber/8)
  851. If TheDips(20) = 1 then DipsNumber = DipsNumber - 8 end if
  852. TheDips(19) = Int(DipsNumber/4)
  853. If TheDips(19) = 1 then DipsNumber = DipsNumber - 4 end if
  854. TheDips(18) = Int(DipsNumber/2)
  855. If TheDips(18) = 1 then DipsNumber = DipsNumber - 2 end if
  856. TheDips(17) = Int(DipsNumber)
  857. DipsTimer.Enabled=1
  858. End Sub
  859.  
  860.  
  861. Sub DipsTimer_Timer()
  862. hsaward = TheDips(22)
  863. BPG = TheDips(9)
  864. dim ebplay: ebplay= TheDips(11)
  865. If BPG = 1 then
  866. if ebplay = 1 then
  867. instcard.image="InstCard3Balls"
  868. else
  869. instcard.image="InstCard3BallsEB"
  870. end if
  871. Else
  872. if ebplay = 1 then
  873. instcard.image="InstCard5Balls"
  874. else
  875. instcard.image="InstCard5BallsEB"
  876. end if
  877. End if
  878. if ebplay = 1 then
  879. repcard.image="replaycard"&hsaward
  880. else
  881. repcard.image="replaycardeb"&hsaward
  882. end if
  883. DipsTimer.enabled=0
  884. End Sub
  885.  
  886. 'Gottlieb System 1
  887. 'added by Inkochnito
  888. Sub editDips
  889. Dim vpmDips : Set vpmDips = New cvpmDips
  890. With vpmDips
  891. .AddForm 700,400,"System 1 - DIP switches"
  892. .AddFrame 205,0,190,"Maximum credits",&H00030000,Array("5 credits",0,"8 credits",&H00020000,"10 credits",&H00010000,"15 credits",&H00030000)'dip 17&18
  893. .AddFrame 0,0,190,"Coin chute control",&H00040000,Array("seperate",0,"same",&H00040000)'dip 19
  894. .AddFrame 0,46,190,"Game mode",&H00000400,Array("extra ball",0,"replay",&H00000400)'dip 11
  895. .AddFrame 0,92,190,"High game to date awards",&H00200000,Array("no award",0,"3 replays",&H00200000)'dip 22
  896. .AddFrame 0,138,190,"Balls per game",&H00000100,Array("5 balls",0,"3 balls",&H00000100)'dip 9
  897. .AddFrame 0,184,190,"Tilt effect",&H00000800,Array("game over",0,"ball in play only",&H00000800)'dip 12
  898. .AddChk 205,80,190,Array("Match feature",&H00000200)'dip 10
  899. .AddChk 205,95,190,Array("Credits displayed",&H00001000)'dip 13
  900. .AddChk 205,110,190,Array("Play credit button tune",&H00002000)'dip 14
  901. .AddChk 205,125,190,Array("Play tones when scoring",&H00080000)'dip 20
  902. .AddChk 205,140,190,Array("Play coin switch tune",&H00400000)'dip 23
  903. .AddChk 205,155,190,Array("High game to date displayed",&H00100000)'dip 21
  904. .AddLabel 50,240,300,20,"After hitting OK, press F3 to reset game with new settings."
  905. .ViewDips
  906. End With
  907. End Sub
  908. Set vpmShowDips = GetRef("editDips")
  909.  
  910. '**********************************************************************************************************
  911. '**********************************************************************************************************
  912. '**********************************************************************************************************
  913.  
  914.  
  915. '*********************************************************************
  916. ' Positional Sound Playback Functions
  917. '*********************************************************************
  918.  
  919. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  920. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  921. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  922. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  923. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  924. End Sub
  925.  
  926. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  927. Sub PlaySoundAt(soundname, tableobj)
  928. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  929. End Sub
  930.  
  931. Sub PlaySoundAtBall(soundname)
  932. PlaySoundAt soundname, ActiveBall
  933. End Sub
  934.  
  935.  
  936. '*********************************************************************
  937. ' Supporting Ball & Sound Functions
  938. '*********************************************************************
  939.  
  940. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  941. Dim tmp
  942. tmp = tableobj.y * 2 / CloseEncounters.height-1
  943. If tmp > 0 Then
  944. AudioFade = Csng(tmp ^10)
  945. Else
  946. AudioFade = Csng(-((- tmp) ^10) )
  947. End If
  948. End Function
  949.  
  950. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  951. Dim tmp
  952. tmp = tableobj.x * 2 / CloseEncounters.width-1
  953. If tmp > 0 Then
  954. AudioPan = Csng(tmp ^10)
  955. Else
  956. AudioPan = Csng(-((- tmp) ^10) )
  957. End If
  958. End Function
  959.  
  960. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  961. Vol = Csng(BallVel(ball) ^2 / 2000)
  962. End Function
  963.  
  964. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  965. Pitch = BallVel(ball) * 20
  966. End Function
  967.  
  968. Function BallVel(ball) 'Calculates the ball speed
  969. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  970. End Function
  971.  
  972. '*****************************************
  973. ' JP's VP10 Rolling Sounds
  974. '*****************************************
  975.  
  976. Const tnob = 5 ' total number of balls
  977. ReDim rolling(tnob)
  978. InitRolling
  979.  
  980. Sub InitRolling
  981. Dim i
  982. For i = 0 to tnob
  983. rolling(i) = False
  984. Next
  985. End Sub
  986.  
  987. Sub RollingTimer_Timer()
  988. Dim BOT, b
  989. BOT = GetBalls
  990.  
  991. ' stop the sound of deleted balls
  992. For b = UBound(BOT) + 1 to tnob
  993. rolling(b) = False
  994. StopSound("fx_ballrolling" & b)
  995. Next
  996.  
  997. ' exit the sub if no balls on the table
  998. If UBound(BOT) = -1 Then Exit Sub
  999.  
  1000. ' play the rolling sound for each ball
  1001. For b = 0 to UBound(BOT)
  1002. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  1003. rolling(b) = True
  1004. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  1005. Else
  1006. If rolling(b) = True Then
  1007. StopSound("fx_ballrolling" & b)
  1008. rolling(b) = False
  1009. End If
  1010. End If
  1011. Next
  1012. End Sub
  1013.  
  1014. '**********************
  1015. ' Ball Collision Sound
  1016. '**********************
  1017.  
  1018. Sub OnBallBallCollision(ball1, ball2, velocity)
  1019. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  1020. End Sub
  1021.  
  1022.  
  1023. '*****************************************
  1024. ' BALL SHADOW
  1025. '*****************************************
  1026. Dim BallShadow
  1027. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  1028.  
  1029. Sub BallShadowUpdate_timer()
  1030. Dim BOT, b
  1031. BOT = GetBalls
  1032. ' hide shadow of deleted balls
  1033. If UBound(BOT)<(tnob-1) Then
  1034. For b = (UBound(BOT) + 1) to (tnob-1)
  1035. BallShadow(b).visible = 0
  1036. Next
  1037. End If
  1038. ' exit the Sub if no balls on the table
  1039. If UBound(BOT) = -1 Then Exit Sub
  1040. ' render the shadow for each ball
  1041. For b = 0 to UBound(BOT)
  1042. If BOT(b).X < CloseEncounters.Width/2 Then
  1043. BallShadow(b).X = ((BOT(b).X) - (Ballsize/16) + ((BOT(b).X - (CloseEncounters.Width/2))/17))' + 13
  1044. Else
  1045. BallShadow(b).X = ((BOT(b).X) + (Ballsize/16) + ((BOT(b).X - (CloseEncounters.Width/2))/17))' - 13
  1046. End If
  1047. ballShadow(b).Y = BOT(b).Y + 10
  1048. If BOT(b).Z > 20 Then
  1049. BallShadow(b).visible = 1
  1050. Else
  1051. BallShadow(b).visible = 0
  1052. End If
  1053. Next
  1054. End Sub
  1055.  
  1056. '************************************
  1057. ' What you need to add to your table
  1058. '************************************
  1059.  
  1060. ' a timer called RollingTimer. With a fast interval, like 10
  1061. ' one collision sound, in this script is called fx_collide
  1062. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  1063. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  1064.  
  1065.  
  1066. '******************************************
  1067. ' Explanation of the rolling sound routine
  1068. '******************************************
  1069.  
  1070. ' sounds are played based on the ball speed and position
  1071.  
  1072. ' the routine checks first for deleted balls and stops the rolling sound.
  1073.  
  1074. ' The For loop goes through all the balls on the table and checks for the ball speed and
  1075. ' if the ball is on the table (height lower than 30) then then it plays the sound
  1076. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  1077.  
  1078. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  1079. ' will change according to the ball speed, and the PAN function will change the stereo position according
  1080. ' to the position of the ball on the table.
  1081.  
  1082.  
  1083. '**************************************
  1084. ' Explanation of the collision routine
  1085. '**************************************
  1086.  
  1087. ' The collision is built in VP.
  1088. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  1089. ' 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
  1090. ' depending of the speed of the collision.
  1091.  
  1092.  
  1093. Sub a_Triggers_Hit (idx)
  1094. playsound "sensor", 0,1,AudioPan(ActiveBall),0,0,0,1,AudioFade(ActiveBall)
  1095. End sub
  1096.  
  1097. Sub a_Pins_Hit (idx)
  1098. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1099. End Sub
  1100.  
  1101. Sub a_Targets_Hit (idx)
  1102. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1103. End Sub
  1104.  
  1105. Sub a_DropTargets_Hit (idx)
  1106. PlaySound "DTDrop", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  1107. End Sub
  1108.  
  1109. Sub a_Metals_Thin_Hit (idx)
  1110. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1111. End Sub
  1112.  
  1113. Sub a_Metals_Medium_Hit (idx)
  1114. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1115. End Sub
  1116.  
  1117. Sub a_Metals2_Hit (idx)
  1118. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1119. End Sub
  1120.  
  1121. Sub a_Gates_Hit (idx)
  1122. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1123. End Sub
  1124.  
  1125. Sub Spinner_Spin
  1126. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  1127. End Sub
  1128.  
  1129. Sub a_Rubbers_Hit(idx)
  1130. dim finalspeed
  1131. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1132. If finalspeed > 20 then
  1133. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1134. End if
  1135. If finalspeed >= 6 AND finalspeed <= 20 then
  1136. RandomSoundRubber()
  1137. End If
  1138. End Sub
  1139.  
  1140. Sub a_Posts_Hit(idx)
  1141. dim finalspeed
  1142. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1143. If finalspeed > 16 then
  1144. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1145. End if
  1146. If finalspeed >= 6 AND finalspeed <= 16 then
  1147. RandomSoundRubber()
  1148. End If
  1149. End Sub
  1150.  
  1151. Sub RandomSoundRubber()
  1152. Select Case Int(Rnd*3)+1
  1153. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1154. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1155. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1156. End Select
  1157. End Sub
  1158.  
  1159. Sub LeftFlipper_Collide(parm)
  1160. RandomSoundFlipper()
  1161. End Sub
  1162.  
  1163.  
  1164. Sub RightFlipper_Collide(parm)
  1165. RandomSoundFlipper()
  1166. End Sub
  1167.  
  1168. Sub RandomSoundFlipper()
  1169. Select Case Int(Rnd*3)+1
  1170. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1171. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1172. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1173. End Select
  1174. End Sub
  1175.  
  1176.  
  1177.  
  1178.  
  1179. 'cFastFlips by nFozzy
  1180. 'Bypasses pinmame callback for faster and more responsive flippers
  1181. 'Version 1.1 beta2 (More proper behaviour, extra safety against script errors)
  1182.  
  1183. 'Flipper / game-on Solenoid # reference
  1184. 'Atari: Sol16
  1185. 'Astro: ?
  1186. 'Bally Early 80's: Sol19
  1187. 'Bally late 80's (Blackwater 100, etc): Sol19
  1188. 'Game Plan: Sol16
  1189. 'Gottlieb System 1: Sol17
  1190. 'Gottlieb System 80: No dedicated flipper solenoid? GI circuit Sol10?
  1191. 'Gottlieb System 3: Sol32
  1192. 'Playmatic: Sol8
  1193. 'Spinball: Sol25
  1194. 'Stern (80's): Sol19
  1195. 'Taito: ?
  1196. 'Williams System 3, 4, 6: Sol23
  1197. 'Williams System 7: Sol25
  1198. 'Williams System 9: Sol23
  1199. 'Williams System 11: Sol23
  1200. 'Bally / Williams WPC 90', 92', WPC Security: Sol31
  1201. 'Data East (and Sega pre-whitestar): Sol23
  1202. 'Zaccaria: ???
  1203.  
  1204. '********************Setup*******************:
  1205.  
  1206. '....somewhere outside of any subs....
  1207. 'dim FastFlips
  1208.  
  1209. '....table init....
  1210. 'Set FastFlips = new cFastFlips
  1211. 'with FastFlips
  1212. ' .CallBackL = "SolLflipper" 'Point these to flipper subs
  1213. ' .CallBackR = "SolRflipper" '...
  1214. '' .CallBackUL = "SolULflipper"'...(upper flippers, if needed)
  1215. '' .CallBackUR = "SolURflipper"'...
  1216. ' .TiltObjects = True 'Optional, if True calls vpmnudge.solgameon automatically. IF YOU GET A LINE 1 ERROR, DISABLE THIS! (or setup vpmNudge.TiltObj!)
  1217. '' .InitDelay "FastFlips", 100 'Optional, if > 0 adds some compensation for solenoid jitter (occasional problem on Bram Stoker's Dracula)
  1218. '' .DebugOn = False 'Debug, always-on flippers. Call FastFlips.DebugOn True or False in debugger to enable/disable.
  1219. 'end with
  1220.  
  1221. '...keydown section... commenting out upper flippers is not necessary as of 1.1
  1222. 'If KeyCode = LeftFlipperKey then FastFlips.FlipL True : FastFlips.FlipUL True
  1223. 'If KeyCode = RightFlipperKey then FastFlips.FlipR True : FastFlips.FlipUR True
  1224. '(Do not use Exit Sub, this script does not handle switch handling at all!)
  1225.  
  1226. '...keyUp section...
  1227. 'If KeyCode = LeftFlipperKey then FastFlips.FlipL False : FastFlips.FlipUL False
  1228. 'If KeyCode = RightFlipperKey then FastFlips.FlipR False : FastFlips.FlipUR False
  1229.  
  1230. '...Solenoid...
  1231. 'SolCallBack(31) = "FastFlips.TiltSol"
  1232. '//////for a reference of solenoid numbers, see top /////
  1233.  
  1234.  
  1235. 'One last note - Because this script is super simple it will call flipper return a lot.
  1236. 'It might be a good idea to add extra conditional logic to your flipper return sounds so they don't play every time the game on solenoid turns off
  1237. 'Example:
  1238. 'Instead of
  1239. 'LeftFlipper.RotateToStart
  1240. 'playsound SoundFX("FlipperDown",DOFFlippers), 0, 1, 0.01 'return
  1241. 'Add Extra conditional logic:
  1242. 'LeftFlipper.RotateToStart
  1243. 'if LeftFlipper.CurrentAngle = LeftFlipper.StartAngle then
  1244. ' playsound SoundFX("FlipperDown",DOFFlippers), 0, 1, 0.01 'return
  1245. 'end if
  1246. 'That's it]
  1247. '*************************************************
  1248.  
  1249. Function NullFunction(aEnabled):End Function '1 argument null function placeholder
  1250. Class cFastFlips
  1251. Public TiltObjects, DebugOn, hi
  1252. Private SubL, SubUL, SubR, SubUR, FlippersEnabled, Delay, LagCompensation, Name, FlipState(3)
  1253.  
  1254. Private Sub Class_Initialize()
  1255. Delay = 0 : FlippersEnabled = False : DebugOn = False : LagCompensation = False
  1256. Set SubL = GetRef("NullFunction"): Set SubR = GetRef("NullFunction") : Set SubUL = GetRef("NullFunction"): Set SubUR = GetRef("NullFunction")
  1257. End Sub
  1258.  
  1259. 'set callbacks
  1260. Public Property Let CallBackL(aInput) : Set SubL = GetRef(aInput) : Decouple sLLFlipper, aInput: End Property
  1261. Public Property Let CallBackUL(aInput) : Set SubUL = GetRef(aInput) : End Property
  1262. Public Property Let CallBackR(aInput) : Set SubR = GetRef(aInput) : Decouple sLRFlipper, aInput: End Property
  1263. Public Property Let CallBackUR(aInput) : Set SubUR = GetRef(aInput) : End Property
  1264. Public Sub InitDelay(aName, aDelay) : Name = aName : delay = aDelay : End Sub 'Create Delay
  1265. 'Automatically decouple flipper solcallback script lines (only if both are pointing to the same sub) thanks gtxjoe
  1266. Private Sub Decouple(aSolType, aInput) : If StrComp(SolCallback(aSolType),aInput,1) = 0 then SolCallback(aSolType) = Empty End If : End Sub
  1267.  
  1268. 'call callbacks
  1269. Public Sub FlipL(aEnabled)
  1270. FlipState(0) = aEnabled 'track flipper button states: the game-on sol flips immediately if the button is held down (1.1)
  1271. If not FlippersEnabled and not DebugOn then Exit Sub
  1272. subL aEnabled
  1273. End Sub
  1274.  
  1275. Public Sub FlipR(aEnabled)
  1276. FlipState(1) = aEnabled
  1277. If not FlippersEnabled and not DebugOn then Exit Sub
  1278. subR aEnabled
  1279. End Sub
  1280.  
  1281. Public Sub FlipUL(aEnabled)
  1282. FlipState(2) = aEnabled
  1283. If not FlippersEnabled and not DebugOn then Exit Sub
  1284. subUL aEnabled
  1285. End Sub
  1286.  
  1287. Public Sub FlipUR(aEnabled)
  1288. FlipState(3) = aEnabled
  1289. If not FlippersEnabled and not DebugOn then Exit Sub
  1290. subUR aEnabled
  1291. End Sub
  1292.  
  1293. Public Sub TiltSol(aEnabled) 'Handle solenoid / Delay (if delayinit)
  1294. If delay > 0 and not aEnabled then 'handle delay
  1295. vpmtimer.addtimer Delay, Name & ".FireDelay" & "'"
  1296. LagCompensation = True
  1297. else
  1298. If Delay > 0 then LagCompensation = False
  1299. EnableFlippers(aEnabled)
  1300. end If
  1301. End Sub
  1302.  
  1303. Sub FireDelay() : If LagCompensation then EnableFlippers False End If : End Sub
  1304.  
  1305. Private Sub EnableFlippers(aEnabled)
  1306. If aEnabled then SubL FlipState(0) : SubR FlipState(1) : subUL FlipState(2) : subUR FlipState(3)
  1307. FlippersEnabled = aEnabled
  1308. If TiltObjects then vpmnudge.solgameon aEnabled
  1309. If Not aEnabled then
  1310. subL False
  1311. subR False
  1312. If not IsEmpty(subUL) then subUL False
  1313. If not IsEmpty(subUR) then subUR False
  1314. End If
  1315. End Sub
  1316.  
  1317. End Class
Advertisement
Add Comment
Please, Sign In to add comment