Arngrim

Nemesis

Dec 25th, 2020 (edited)
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.24 KB | None | 0 0
  1. '############################################################################################
  2. '############################################################################################
  3. '####### ########
  4. '####### Nemesis (Peyper 1986) ########
  5. '####### ########
  6. '############################################################################################
  7. '############################################################################################
  8.  
  9. ' VPX version by Batch 2020
  10.  
  11. ' VP9 version by MFuegemann (2014)
  12.  
  13. option Explicit
  14. Randomize
  15.  
  16. On Error Resume Next
  17. ExecuteGlobal GetTextFile("controller.vbs")
  18. If Err Then MsgBox "Can't open controller.vbs"
  19. On Error Goto 0
  20.  
  21. LoadVPM "01560000","PEYPER.VBS",3.2
  22.  
  23. Dim DesktopMode: DesktopMode = Nemesis.ShowDT
  24.  
  25. If DesktopMode = True Then 'Show Desktop components
  26. lrail.visible=1
  27. rrail.visible=1
  28. SideCab.visible=1
  29. Else
  30. lrail.visible=0
  31. rrail.visible=0
  32. SideCab.visible=0
  33. End if
  34.  
  35. '*************************************
  36. ' GLOBAL CONFIGURATIONS
  37. '*************************************
  38.  
  39. Const cgamename = "nemesis" 'name of ROM file to be used
  40. Const FreePlay = 1 'set to 1 for a faked FreePlay / otherwise, set to 0
  41.  
  42. Const UseSolenoids=2,UseLamps=1,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="FlipperUp",SFlipperOff="FlipperDown",SCoin="coin3"
  43.  
  44. '***********************************
  45. ' SOLENOID ASSIGNMENT
  46. '***********************************
  47.  
  48. 'Sol1 LSling
  49. SolCallback(6)="DropTargetBank1.SolDropUp"
  50. 'Sol3 RSling
  51. 'Sol4 Bumper
  52. 'Sol5 Bumper
  53. SolCallback(2)="DropTargetBank2.SolDropUp"
  54. SolCallback(7)="SolKnocker"
  55. SolCallback(8)="bsTrough.SolOut"
  56. 'SolCallback(30)="SolGameOver"
  57.  
  58. Ballsize = 50
  59. BallMass = 1
  60.  
  61. '***************************
  62. ' TABLE INIT
  63. '***************************
  64.  
  65. Dim bsTrough,obj,DropTargetBank1,DropTargetBank2,cLeftCaptive,cRightCaptive,Flipperactive
  66.  
  67. Sub Nemesis_Init
  68. vpminit me
  69.  
  70. dim xx
  71. For each xx in GIBulbs:xx.State = 1:Next
  72. For each xx in GIPlastics:xx.State = 1:Next
  73.  
  74. Controller.GameName=cGameName
  75. Controller.SplashInfoLine="Nemesis" & vbNewLine & "converted from VP9 to VPX by Batch"
  76. Controller.HandleKeyboard=False
  77. Controller.ShowTitle=0
  78. Controller.ShowFrame=0
  79. Controller.ShowDMDOnly=1
  80. Controller.Hidden = 0 'enable to hide DMD if You use a B2S backglass
  81.  
  82. ' 'DMD position for 3 Monitor Setup
  83. ' 'Controller.Games(cGameName).Settings.Value("dmd_pos_x")=3850 'set this to 0 if You cannot find the DMD
  84. ' 'Controller.Games(cGameName).Settings.Value("dmd_pos_y")=300 'set this to 0 if You cannot find the DMD
  85. ' 'Controller.Games(cGameName).Settings.Value("dmd_width")=505
  86. ' 'Controller.Games(cGameName).Settings.Value("dmd_height")=155
  87. ' 'Controller.Games(cGameName).Settings.Value("rol")=0
  88. '
  89. ' 'Controller.Games(cGameName).Settings.Value("ddraw") = 0 'set to 0 if You have problems with DMD showing or table stutter
  90.  
  91. Controller.HandleMechanics=0
  92. Controller.Run
  93. If Err Then MsgBox Err.Description
  94. On Error Goto 0
  95.  
  96. PinMAMETimer.Interval=PinMAMEInterval
  97. PinMAMETimer.Enabled = true
  98.  
  99. vpmNudge.TiltSwitch=-5
  100. vpmNudge.Sensitivity=5
  101. vpmNudge.TiltObj = Array(LeftFlipper,RightFlipper)
  102.  
  103. vpmMapLights AllLights
  104.  
  105. Set bsTrough=New cvpmBallStack
  106. bsTrough.InitSw 0,0.1,0,0,0,0,0,0 '0.1 = Switch 0
  107. bsTrough.InitKick BallRelease,90,5
  108. bsTrough.InitExitSnd SoundFX("BallRel",DOFContactors),SoundFX("Solenoid",DOFContactors)
  109. bsTrough.Balls=1
  110.  
  111. set DropTargetBank1 = new cvpmDropTarget
  112. DropTargetBank1.InitDrop Array(DT1,DT2), Array(18,19)
  113. DropTargetBank1.InitSnd SoundFX("fx_DropTarget",DOFDropTargets),SoundFX("TargetBankreset1",DOFContactors)
  114. DropTargetBank1.CreateEvents "DropTargetBank1"
  115.  
  116. set DropTargetBank2 = new cvpmDropTarget
  117. DropTargetBank2.InitDrop Array(DT3,DT4,DT5), Array(22,23,24)
  118. DropTargetBank2.InitSnd SoundFX("fx_DropTarget",DOFDropTargets),SoundFX("TargetBankreset1",DOFContactors)
  119. DropTargetBank2.CreateEvents "DropTargetBank2"
  120.  
  121. Set cLeftCaptive=New cvpmCaptiveBall
  122. cLeftCaptive.InitCaptive LeftCaptiveTrigger,LeftCaptiveWall,LeftCaptiveKicker,-22
  123. cLeftCaptive.Start
  124. cLeftCaptive.ForceTrans = 0.5
  125. cLeftCaptive.MinForce = 3.5'
  126. cLeftCaptive.CreateEvents "cLeftCaptive"
  127.  
  128. Set cRightCaptive=New cvpmCaptiveBall
  129. cRightCaptive.InitCaptive RightCaptiveTrigger,RightCaptiveWall,RightCaptiveKicker,-22
  130. cRightCaptive.Start
  131. cRightCaptive.ForceTrans = 0.5
  132. cRightCaptive.MinForce = 3.5
  133. cRightCaptive.CreateEvents "cRightCaptive"
  134.  
  135. End Sub
  136.  
  137. '******************************
  138. ' TROUGH HANDLER
  139. '******************************
  140.  
  141. 'Sub Drain_Hit()
  142. ' SoundTimer.enabled = False
  143. ' bsTrough.AddBall Me
  144. ' playsound "Drain5"
  145. 'End Sub
  146.  
  147. Sub Drain_Hit()
  148. SoundTimer.enabled = False
  149. vpmTimer.addTimer 2200, "bsTrough.addball Drain '"
  150. playsoundAtVol "Drain5", Drain, 1
  151. End Sub
  152.  
  153. '*******************************
  154. ' KEYBOARD HANDLER
  155. '*******************************
  156.  
  157. Sub Nemesis_KeyDown(ByVal keycode)
  158. if keycode = startgamekey then
  159. if FreePlay then
  160. vpmTimer.PulseSw -3
  161. end if
  162. Controller.Switch(-4) = 1
  163. end if
  164.  
  165. If keycode = PlungerKey Then
  166. Plunger.PullBack
  167. End If
  168.  
  169. If keycode = LeftFlipperKey Then
  170. if Flipperactive then
  171. LF.fire'LeftFlipper.RotatetoEnd
  172. controller.switch(103) = 1
  173. PlaySoundAtVol SoundFX("FlipperUp",DOFFlippers), LeftFlipper, 1
  174. end if
  175. End If
  176.  
  177. If keycode = RightFlipperKey Then
  178. if Flipperactive then
  179. RF.fire'RightFlipper.RotatetoEnd
  180. controller.switch(101) = 1
  181. PlaySoundAtVol SoundFX("FlipperUp",DOFFlippers), RightFlipper, 1
  182. end if
  183.  
  184. If keycode = LeftFlipperKey Then FlipperActivate LeftFlipper, LFPress
  185. If keycode = RightFlipperKey Then FlipperActivate RightFlipper, RFPress
  186. End If
  187.  
  188. if keycode = LeftMagnaSave then
  189. vpmNudge.DoNudge 45, 2
  190. end if
  191. if keycode = RightMagnaSave then
  192. vpmNudge.DoNudge -45, 2
  193. end if
  194.  
  195. If vpmKeyDown(KeyCode) Then Exit Sub
  196. End Sub
  197.  
  198. Sub Nemesis_KeyUp(ByVal keycode)
  199. if keycode = startgamekey then
  200. Controller.Switch(-4) = 0
  201. end if
  202.  
  203. If keycode = PlungerKey Then
  204. Plunger.Fire
  205. PlaySoundAtVol "fx_plunger", Plunger, 1
  206. End If
  207.  
  208. If keycode = LeftFlipperKey Then
  209. controller.switch(103) = 0
  210. LeftFlipper.RotatetoStart
  211. if Flipperactive then
  212. PlaySoundAtVol SoundFX("FlipperDown",DOFFlippers), LeftFlipper, 1
  213. end if
  214. End If
  215.  
  216. If keycode = RightFlipperKey Then
  217. controller.switch(101) = 0
  218. RightFlipper.RotatetoStart
  219. if Flipperactive then
  220. PlaySoundAtVol SoundFX("FlipperDown",DOFFlippers), RightFlipper, 1
  221. end if
  222.  
  223. If keycode = LeftFlipperKey Then FlipperDeActivate LeftFlipper, LFPress
  224. If keycode = RightFlipperKey Then FlipperDeActivate RightFlipper, RFPress
  225. End If
  226.  
  227. If vpmKeyUp(KeyCode) Then Exit Sub
  228. End Sub
  229.  
  230. '*********************************************************************
  231. ' FLIPPER CORRECTION INITIALIZATION (NFOZZY / ROTHBAUERW)
  232. '*********************************************************************
  233.  
  234. dim LF : Set LF = New FlipperPolarity
  235. dim RF : Set RF = New FlipperPolarity
  236.  
  237. InitPolarity
  238.  
  239. Sub InitPolarity()
  240. dim x, a : a = Array(LF, RF)
  241. for each x in a
  242. x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
  243. x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
  244. x.enabled = True
  245. x.TimeDelay = 60
  246. Next
  247.  
  248. AddPt "Polarity", 0, 0, 0
  249. AddPt "Polarity", 1, 0.05, -5
  250. AddPt "Polarity", 2, 0.4, -5
  251. AddPt "Polarity", 3, 0.6, -4.5
  252. AddPt "Polarity", 4, 0.65, -4.0
  253. AddPt "Polarity", 5, 0.7, -3.5
  254. AddPt "Polarity", 6, 0.75, -3.0
  255. AddPt "Polarity", 7, 0.8, -2.5
  256. AddPt "Polarity", 8, 0.85, -2.0
  257. AddPt "Polarity", 9, 0.9,-1.5
  258. AddPt "Polarity", 10, 0.95, -1.0
  259. AddPt "Polarity", 11, 1, -0.5
  260. AddPt "Polarity", 12, 1.1, 0
  261. AddPt "Polarity", 13, 1.3, 0
  262.  
  263. addpt "Velocity", 0, 0, 1
  264. addpt "Velocity", 1, 0.16, 1.06
  265. addpt "Velocity", 2, 0.41, 1.05
  266. addpt "Velocity", 3, 0.53, 1'0.982
  267. addpt "Velocity", 4, 0.702, 0.968
  268. addpt "Velocity", 5, 0.95, 0.968
  269. addpt "Velocity", 6, 1.03, 0.945
  270.  
  271. LF.Object = LeftFlipper
  272. LF.EndPoint = EndPointLp
  273. RF.Object = RightFlipper
  274. RF.EndPoint = EndPointRp
  275. End Sub
  276.  
  277. Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
  278. Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
  279. Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
  280. Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
  281.  
  282. '******************************************************
  283. ' FLIPPER CORRECTION FUNCTIONS (NFOZZY / ROTHBAUERW)
  284. '******************************************************
  285.  
  286. Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
  287. dim a : a = Array(LF, RF)
  288. dim x : for each x in a
  289. x.addpoint aStr, idx, aX, aY
  290. Next
  291. End Sub
  292.  
  293. Class FlipperPolarity
  294. Public DebugOn, Enabled
  295. Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
  296. Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
  297. private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
  298. Private Balls(20), balldata(20)
  299.  
  300. dim PolarityIn, PolarityOut
  301. dim VelocityIn, VelocityOut
  302. dim YcoefIn, YcoefOut
  303. Public Sub Class_Initialize
  304. redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
  305. Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
  306. End Sub
  307.  
  308. Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
  309. Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
  310. Public Property Get StartPoint : StartPoint = FlipperStart : End Property
  311. Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
  312. Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
  313. Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
  314.  
  315. Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
  316. Select Case aChooseArray
  317. case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
  318. Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
  319. Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
  320. End Select
  321. if gametime > 100 then Report aChooseArray
  322. End Sub
  323.  
  324. Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
  325. if not DebugOn then exit sub
  326. dim a1, a2 : Select Case aChooseArray
  327. case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
  328. Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
  329. Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
  330. case else :tbpl.text = "wrong string" : exit sub
  331. End Select
  332. dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  333. tbpl.text = str
  334. End Sub
  335.  
  336. Public Sub AddBall(aBall) : dim x : for x = 0 to uBound(balls) : if IsEmpty(balls(x)) then set balls(x) = aBall : exit sub :end if : Next : End Sub
  337.  
  338. Private Sub RemoveBall(aBall)
  339. dim x : for x = 0 to uBound(balls)
  340. if TypeName(balls(x) ) = "IBall" then
  341. if aBall.ID = Balls(x).ID Then
  342. balls(x) = Empty
  343. Balldata(x).Reset
  344. End If
  345. End If
  346. Next
  347. End Sub
  348.  
  349. Public Sub Fire()
  350. Flipper.RotateToEnd
  351. processballs
  352. End Sub
  353.  
  354. Public Property Get Pos 'returns % position a ball. For debug stuff.
  355. dim x : for x = 0 to uBound(balls)
  356. if not IsEmpty(balls(x) ) then
  357. pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
  358. End If
  359. Next
  360. End Property
  361.  
  362. Public Sub ProcessBalls() 'save data of balls in flipper range
  363. FlipAt = GameTime
  364. dim x : for x = 0 to uBound(balls)
  365. if not IsEmpty(balls(x) ) then
  366. balldata(x).Data = balls(x)
  367. End If
  368. Next
  369. PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
  370. PartialFlipCoef = abs(PartialFlipCoef-1)
  371. End Sub
  372. Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
  373.  
  374. Public Sub PolarityCorrect(aBall)
  375. if FlipperOn() then
  376. dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
  377.  
  378. 'y safety Exit
  379. if aBall.VelY > -8 then 'ball going down
  380. RemoveBall aBall
  381. exit Sub
  382. end if
  383.  
  384. 'Find balldata. BallPos = % on Flipper
  385. for x = 0 to uBound(Balls)
  386. if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
  387. idx = x
  388. BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
  389. if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  390. end if
  391. Next
  392.  
  393. If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
  394. BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
  395. if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
  396. End If
  397.  
  398. 'Velocity correction
  399. if not IsEmpty(VelocityIn(0) ) then
  400. Dim VelCoef
  401. : VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
  402.  
  403. if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
  404.  
  405. if Enabled then aBall.Velx = aBall.Velx*VelCoef
  406. if Enabled then aBall.Vely = aBall.Vely*VelCoef
  407. End If
  408.  
  409. 'Polarity Correction (optional now)
  410. if not IsEmpty(PolarityIn(0) ) then
  411. If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
  412. dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
  413.  
  414. if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
  415. 'playsound "knocker"
  416. End If
  417. End If
  418. RemoveBall aBall
  419. End Sub
  420. End Class
  421.  
  422. '******************************************************
  423. ' FLIPPER POLARITY AND RUBBER DAMPENER
  424. ' SUPPORTING FUNCTIONS (NFOZZY / ROTHBAUERW)
  425. '******************************************************
  426.  
  427. ' Used for flipper correction and rubber dampeners
  428. Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
  429. dim x, aCount : aCount = 0
  430. redim a(uBound(aArray) )
  431. for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
  432. if not IsEmpty(aArray(x) ) Then
  433. if IsObject(aArray(x)) then
  434. Set a(aCount) = aArray(x)
  435. Else
  436. a(aCount) = aArray(x)
  437. End If
  438. aCount = aCount + 1
  439. End If
  440. Next
  441. if offset < 0 then offset = 0
  442. redim aArray(aCount-1+offset) 'Resize original array
  443. for x = 0 to aCount-1 'set objects back into original array
  444. if IsObject(a(x)) then
  445. Set aArray(x) = a(x)
  446. Else
  447. aArray(x) = a(x)
  448. End If
  449. Next
  450. End Sub
  451.  
  452. ' Used for flipper correction and rubber dampeners
  453. Sub ShuffleArrays(aArray1, aArray2, offset)
  454. ShuffleArray aArray1, offset
  455. ShuffleArray aArray2, offset
  456. End Sub
  457.  
  458. ' Used for flipper correction, rubber dampeners, and drop targets
  459. Function BallSpeed(ball) 'Calculates the ball speed
  460. BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
  461. End Function
  462.  
  463. ' Used for flipper correction and rubber dampeners
  464. Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
  465. dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
  466. Y = M*x+b
  467. PSlope = Y
  468. End Function
  469.  
  470. ' Used for flipper correction
  471. Class spoofball
  472. Public X, Y, Z, VelX, VelY, VelZ, ID, Mass, Radius
  473. Public Property Let Data(aBall)
  474. With aBall
  475. x = .x : y = .y : z = .z : velx = .velx : vely = .vely : velz = .velz
  476. id = .ID : mass = .mass : radius = .radius
  477. end with
  478. End Property
  479. Public Sub Reset()
  480. x = Empty : y = Empty : z = Empty : velx = Empty : vely = Empty : velz = Empty
  481. id = Empty : mass = Empty : radius = Empty
  482. End Sub
  483. End Class
  484.  
  485. ' Used for flipper correction and rubber dampeners
  486. Function LinearEnvelope(xInput, xKeyFrame, yLvl)
  487. dim y 'Y output
  488. dim L 'Line
  489. dim ii : for ii = 1 to uBound(xKeyFrame) 'find active line
  490. if xInput <= xKeyFrame(ii) then L = ii : exit for : end if
  491. Next
  492. if xInput > xKeyFrame(uBound(xKeyFrame) ) then L = uBound(xKeyFrame) 'catch line overrun
  493. Y = pSlope(xInput, xKeyFrame(L-1), yLvl(L-1), xKeyFrame(L), yLvl(L) )
  494.  
  495. if xInput <= xKeyFrame(lBound(xKeyFrame) ) then Y = yLvl(lBound(xKeyFrame) ) 'Clamp lower
  496. if xInput >= xKeyFrame(uBound(xKeyFrame) ) then Y = yLvl(uBound(xKeyFrame) ) 'Clamp upper
  497.  
  498. LinearEnvelope = Y
  499. End Function
  500.  
  501. ' Used for drop targets and flipper tricks
  502. Function Distance(ax,ay,bx,by)
  503. Distance = SQR((ax - bx)^2 + (ay - by)^2)
  504. End Function
  505.  
  506. '******************************************************
  507. ' FLIPPER TRICKS (NFOZZY / ROTHBAUERW)
  508. '******************************************************
  509.  
  510. RightFlipper.timerinterval=1
  511. Rightflipper.timerenabled=True
  512.  
  513. sub RightFlipper_timer()
  514. FlipperTricks LeftFlipper, LFPress, LFCount, LFEndAngle, LFState
  515. FlipperTricks RightFlipper, RFPress, RFCount, RFEndAngle, RFState
  516. end sub
  517.  
  518.  
  519. dim LFPress, RFPress, LFCount, RFCount
  520. dim LFState, RFState
  521. dim EOST, EOSA,Frampup, FElasticity,FReturn
  522. dim RFEndAngle, LFEndAngle
  523.  
  524. EOST = leftflipper.eostorque
  525. EOSA = leftflipper.eostorqueangle
  526. Frampup = LeftFlipper.rampup
  527. FElasticity = LeftFlipper.elasticity
  528. FReturn = LeftFlipper.return
  529. Const EOSTnew = 1
  530. Const EOSAnew = 1
  531. Const EOSRampup = 0
  532. Dim SOSRampup
  533. SOSRampup = 2.5
  534. Const LiveCatch = 16
  535. Const LiveElasticity = 0.45
  536. Const SOSEM = 0.815
  537. Const EOSReturn = 0.055
  538.  
  539. LFEndAngle = Leftflipper.endangle
  540. RFEndAngle = RightFlipper.endangle
  541.  
  542. Sub FlipperActivate(Flipper, FlipperPress)
  543. FlipperPress = 1
  544. Flipper.Elasticity = FElasticity
  545.  
  546. Flipper.eostorque = EOST
  547. Flipper.eostorqueangle = EOSA
  548. End Sub
  549.  
  550. Sub FlipperDeactivate(Flipper, FlipperPress)
  551. FlipperPress = 0
  552. Flipper.eostorqueangle = EOSA
  553. Flipper.eostorque = EOST*EOSReturn/FReturn
  554.  
  555. If Abs(Flipper.currentangle) <= Abs(Flipper.endangle) + 0.1 Then
  556. Dim BOT, b
  557. BOT = GetBalls
  558.  
  559. For b = 0 to UBound(BOT)
  560. If Distance(BOT(b).x, BOT(b).y, Flipper.x, Flipper.y) < 55 Then 'check for cradle
  561. If BOT(b).vely >= -0.4 Then BOT(b).vely = -0.4
  562. End If
  563. Next
  564. End If
  565. End Sub
  566.  
  567. Sub FlipperTricks (Flipper, FlipperPress, FCount, FEndAngle, FState)
  568. Dim Dir
  569. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  570.  
  571. If Abs(Flipper.currentangle) > Abs(Flipper.startangle) - 0.05 Then
  572. If FState <> 1 Then
  573. Flipper.rampup = SOSRampup
  574. Flipper.endangle = FEndAngle - 3*Dir
  575. Flipper.Elasticity = FElasticity * SOSEM
  576. FCount = 0
  577. FState = 1
  578. End If
  579. ElseIf Abs(Flipper.currentangle) <= Abs(Flipper.endangle) and FlipperPress = 1 then
  580. if FCount = 0 Then FCount = GameTime
  581.  
  582. If FState <> 2 Then
  583. Flipper.eostorqueangle = EOSAnew
  584. Flipper.eostorque = EOSTnew
  585. Flipper.rampup = EOSRampup
  586. Flipper.endangle = FEndAngle
  587. FState = 2
  588. End If
  589. Elseif Abs(Flipper.currentangle) > Abs(Flipper.endangle) + 0.01 and FlipperPress = 1 Then
  590. If FState <> 3 Then
  591. Flipper.eostorque = EOST
  592. Flipper.eostorqueangle = EOSA
  593. Flipper.rampup = Frampup
  594. Flipper.Elasticity = FElasticity
  595. FState = 3
  596. End If
  597.  
  598. End If
  599. End Sub
  600.  
  601. Const LiveDistanceMin = 30 'minimum distance in vp units from flipper base live catch dampening will occur
  602. Const LiveDistanceMax = 114 'maximum distance in vp units from flipper base live catch dampening will occur (tip protection)
  603.  
  604. Sub CheckLiveCatch(ball, Flipper, FCount, parm) 'Experimental new live catch
  605. Dim Dir
  606. Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
  607. Dim LiveCatchBounce 'If live catch is not perfect, it won't freeze ball totally
  608. Dim CatchTime : CatchTime = GameTime - FCount
  609.  
  610. if CatchTime <= LiveCatch and parm > 6 and ABS(Flipper.x - ball.x) > LiveDistanceMin and ABS(Flipper.x - ball.x) < LiveDistanceMax Then
  611. if CatchTime <= LiveCatch*0.5 Then 'Perfect catch only when catch time happens in the beginning of the window
  612. LiveCatchBounce = 0
  613. else
  614. LiveCatchBounce = Abs((LiveCatch/2) - CatchTime) 'Partial catch when catch happens a bit late
  615. end If
  616.  
  617. If LiveCatchBounce = 0 and ball.velx * Dir > 0 Then ball.velx = 0
  618. ball.vely = LiveCatchBounce * (32 / LiveCatch) ' Multiplier for inaccuracy bounce
  619. ball.angmomx= 0
  620. ball.angmomy= 0
  621. ball.angmomz= 0
  622. End If
  623. End Sub
  624.  
  625. Sub LeftFlipper_Collide(parm)
  626. RandomSoundRubberFlipper(parm)
  627. CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
  628. 'LeftFlipperCollide parm
  629. End Sub
  630.  
  631. Sub RightFlipper_Collide(parm)
  632. RandomSoundRubberFlipper(parm)
  633. CheckLiveCatch Activeball, RightFlipper, RFCount, parm
  634. 'RightFlipperCollide parm
  635. End Sub
  636.  
  637. Sub RandomSoundRubberFlipper(parm)
  638. Select Case Int(Rnd*7)+1
  639. Case 1 : PlaySoundAtBallVol "TOM_Rubber_Flipper_Normal_1", parm
  640. Case 2 : PlaySoundAtBallVol "TOM_Rubber_Flipper_Normal_2", parm
  641. Case 3 : PlaySoundAtBallVol "TOM_Rubber_Flipper_Normal_3", parm
  642. Case 4 : PlaySoundAtBallVol "TOM_Rubber_Flipper_Normal_4", parm
  643. Case 5 : PlaySoundAtBallVol "TOM_Rubber_Flipper_Normal_5", parm
  644. Case 6 : PlaySoundAtBallVol "TOM_Rubber_Flipper_Normal_6", parm
  645. Case 7 : PlaySoundAtBallVol "TOM_Rubber_Flipper_Normal_7", parm
  646. End Select
  647. End Sub
  648.  
  649. '******************************
  650. ' SWITCH HANDLER
  651. '******************************
  652. ' Cabinet switches
  653. 'Const swStartButton = -4
  654. 'Const swCoin1 = -3
  655. 'Const swCoin2 = -1
  656. 'Const swCoin3 = -2
  657. 'Const swTilt = -5
  658. 'Const swSlamDoorHit = -6
  659. 'Const swLRFlip = 101
  660. 'Const swLLFlip = 103
  661.  
  662. '**********************************
  663. ' SLINGSHOT ANIMATIONS
  664. '**********************************
  665. Dim RStep, Lstep
  666.  
  667. Sub RightSlingShot_Slingshot
  668. vpmtimer.pulsesw 5
  669. PlaySoundAtVol SoundFX("LSling",DOFContactors), Sling1, 1
  670. RSling.Visible = 0
  671. RSling1.Visible = 1
  672. SLING1.TransZ = -20
  673. RStep = 0
  674. RightSlingShot.TimerEnabled = 1
  675. End Sub
  676.  
  677. Sub RightSlingShot_Timer
  678. Select Case RStep
  679. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:SLING1.TransZ = -10
  680. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:SLING1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  681. End Select
  682. RStep = RStep + 1
  683. End Sub
  684.  
  685.  
  686. Sub LeftSlingShot_Slingshot
  687. vpmtimer.pulsesw 3
  688. PlaySoundAtVol SoundFX("RSling",DOFContactors), Sling2, 1
  689. LSling.Visible = 0
  690. LSling1.Visible = 1
  691. SLING2.TransZ = -20
  692. LStep = 0
  693. LeftSlingShot.TimerEnabled = 1
  694. End Sub
  695.  
  696. Sub LeftSlingShot_Timer
  697. Select Case LStep
  698. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:SLING2.TransZ = -10
  699. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:SLING2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  700. End Select
  701. LStep = LStep + 1
  702. End Sub
  703.  
  704. '****************************
  705. ' ROLLOVERS
  706. '****************************
  707.  
  708. 'Top Left Rollover
  709. sub sw28_hit:Controller.Switch(28)=1:PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  710. sub sw28_unhit:Controller.Switch(28)=0:End Sub
  711.  
  712. '500/500 Rollovers
  713. sub sw10_hit:Controller.Switch(8)=1: PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  714. sub sw10_unhit:Controller.Switch(8)=0:End Sub
  715. sub sw11_hit:Controller.Switch(9)=1: PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  716. sub sw11_unhit:Controller.Switch(9)=0 :End Sub
  717. sub sw12_hit:Controller.Switch(12)=1: PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  718. sub sw12_unhit:Controller.Switch(12)=0:End Sub
  719. sub sw13_hit:Controller.Switch(13)=1 :PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  720. sub sw13_unhit:Controller.Switch(13)=0 :End Sub
  721. sub sw14_hit:Controller.Switch(14)=1 :PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  722. sub sw14_unhit:Controller.Switch(14)=0 :End Sub
  723. sub sw15_hit:Controller.Switch(15)=1 :PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  724. sub sw15_unhit:Controller.Switch(15)=0 :End Sub
  725. sub sw16_hit:Controller.Switch(16)=1 :PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  726. sub sw16_unhit:Controller.Switch(16)=0 :End Sub
  727. sub sw17_hit:Controller.Switch(17)=1 :PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  728. sub sw17_unhit:Controller.Switch(17)=0 :End Sub
  729.  
  730. 'Outlanes
  731. sub sw34_hit:Controller.Switch(34)=1 :PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  732. sub sw34_unhit:Controller.Switch(34)=0 :End Sub
  733. sub sw35_hit:Controller.Switch(35)=1 :PlaySoundAtVol "fx_Rollover", ActiveBall, 1:End Sub
  734. sub sw35_unhit:Controller.Switch(35)=0 :End Sub
  735.  
  736. 'Captive Balls and Target behind DT
  737. sub sw27_hit:Controller.Switch(27)=1
  738. PlaySoundAtVol "fx_sensor", ActiveBall, 1:End Sub
  739. sub sw27_unhit:Controller.Switch(27)=0:End Sub
  740.  
  741. '*********************************
  742. ' ROUND TARGETS
  743. '*********************************
  744.  
  745. Sub Target1_Hit:vpmTimer.PulseSw 25:PlaySoundAtVol SoundFX("fx_RoundTarget",DOFTargets), ActiveBall, 1:End Sub 'captive 1
  746. Sub Target4_Hit:vpmTimer.PulseSw 26:PlaySoundAtVol SoundFX("fx_RoundTarget",DOFTargets), ActiveBall, 1:End Sub 'captive 2
  747.  
  748. Sub Target2_Hit:vpmTimer.PulseSw 31:PlaySoundAtVol SoundFX("fx_RoundTarget",DOFTargets), ActiveBall, 1:End Sub 'Top 1Mio
  749. Sub Target3_Hit:vpmTimer.PulseSw 29:PlaySoundAtVol SoundFX("fx_RoundTarget",DOFTargets), ActiveBall, 1:End Sub 'Center
  750.  
  751. '****************************
  752. ' RUBBERS
  753. '****************************
  754.  
  755. Sub Rubber1_Hit:vpmTimer.PulseSw 36:PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  756. Sub Rubber2_Hit:vpmTimer.PulseSw 36:PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  757. Sub Rubber3_Hit:vpmTimer.PulseSw 36:PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  758. Sub Rubber4_Hit:vpmTimer.PulseSw 36:PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  759.  
  760. Sub Rubber11_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  761. Sub Rubber12_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  762. Sub Rubber13_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  763. Sub Rubber14_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  764. Sub Rubber15_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  765. Sub Rubber16_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  766. Sub Rubber17_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  767. Sub Rubber18_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  768. Sub Rubber19_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  769. Sub Rubber20_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  770. Sub Rubber21_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  771. Sub Rubber22_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  772. Sub Rubber23_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  773. Sub Rubber24_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  774. Sub Rubber25_Hit :PlaySoundAtVol "fx_Rubber", ActiveBall, 1:End Sub
  775.  
  776. '****************************************************************************
  777. ' PHYSICS DAMPENERS - RUBBER FUNCTIONS (NFOZZY / ROTHBAUERW)
  778. '****************************************************************************
  779.  
  780. 'These are data mined bounce curves,
  781. 'dialed in with the in-game elasticity as much as possible to prevent angle / spin issues.
  782. 'Requires tracking ballspeed to calculate COR
  783.  
  784.  
  785. Sub dPosts_Hit(idx)
  786. RubbersD.dampen Activeball
  787. End Sub
  788.  
  789. Sub dSleeves_Hit(idx)
  790. SleevesD.Dampen Activeball
  791. End Sub
  792.  
  793.  
  794. dim RubbersD : Set RubbersD = new Dampener 'frubber
  795. RubbersD.name = "Rubbers"
  796. RubbersD.debugOn = False 'shows info in textbox "TBPout"
  797. RubbersD.Print = False 'debug, reports in debugger (in vel, out cor)
  798. 'cor bounce curve (linear)
  799. 'for best results, try to match in-game velocity as closely as possible to the desired curve
  800. 'RubbersD.addpoint 0, 0, 0.935 'point# (keep sequential), ballspeed, CoR (elasticity)
  801. RubbersD.addpoint 0, 0, 0.96 'point# (keep sequential), ballspeed, CoR (elasticity)
  802. RubbersD.addpoint 1, 3.77, 0.96
  803. RubbersD.addpoint 2, 5.76, 0.967 'dont take this as gospel. if you can data mine rubber elasticitiy, please help!
  804. RubbersD.addpoint 3, 15.84, 0.874
  805. RubbersD.addpoint 4, 56, 0.64 'there's clamping so interpolate up to 56 at least
  806.  
  807. dim SleevesD : Set SleevesD = new Dampener 'this is just rubber but cut down to 85%...
  808. SleevesD.name = "Sleeves"
  809. SleevesD.debugOn = False 'shows info in textbox "TBPout"
  810. SleevesD.Print = False 'debug, reports in debugger (in vel, out cor)
  811. SleevesD.CopyCoef RubbersD, 0.85
  812.  
  813. Class Dampener
  814. Public Print, debugOn 'tbpOut.text
  815. public name, Threshold 'Minimum threshold. Useful for Flippers, which don't have a hit threshold.
  816. Public ModIn, ModOut
  817. Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): End Sub
  818.  
  819. Public Sub AddPoint(aIdx, aX, aY)
  820. ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
  821. if gametime > 100 then Report
  822. End Sub
  823.  
  824. public sub Dampen(aBall)
  825. if threshold then if BallSpeed(aBall) < threshold then exit sub end if end if
  826. dim RealCOR, DesiredCOR, str, coef
  827. DesiredCor = LinearEnvelope(cor.ballvel(aBall.id), ModIn, ModOut )
  828. RealCOR = BallSpeed(aBall) / cor.ballvel(aBall.id)
  829. coef = desiredcor / realcor
  830. if debugOn then str = name & " in vel:" & round(cor.ballvel(aBall.id),2 ) & vbnewline & "desired cor: " & round(desiredcor,4) & vbnewline & _
  831. "actual cor: " & round(realCOR,4) & vbnewline & "ballspeed coef: " & round(coef, 3) & vbnewline
  832. if Print then debug.print Round(cor.ballvel(aBall.id),2) & ", " & round(desiredcor,3)
  833.  
  834. aBall.velx = aBall.velx * coef : aBall.vely = aBall.vely * coef
  835. if debugOn then TBPout.text = str
  836. End Sub
  837.  
  838. Public Sub CopyCoef(aObj, aCoef) 'alternative addpoints, copy with coef
  839. dim x : for x = 0 to uBound(aObj.ModIn)
  840. addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef
  841. Next
  842. End Sub
  843.  
  844.  
  845. Public Sub Report() 'debug, reports all coords in tbPL.text
  846. if not debugOn then exit sub
  847. dim a1, a2 : a1 = ModIn : a2 = ModOut
  848. dim str, x : for x = 0 to uBound(a1) : str = str & x & ": " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
  849. TBPout.text = str
  850. End Sub
  851.  
  852.  
  853. End Class
  854.  
  855. '**************************************************************************************************
  856. ' TRACK ALL BALL VELOCITIES FOR RUBBER DAMPENER AND DROP TARGETS (NFOZZY / ROTHBAUERW)
  857. '**************************************************************************************************
  858.  
  859. dim cor : set cor = New CoRTracker
  860.  
  861. Class CoRTracker
  862. public ballvel, ballvelx, ballvely
  863.  
  864. Private Sub Class_Initialize : redim ballvel(0) : redim ballvelx(0): redim ballvely(0) : End Sub
  865.  
  866. Public Sub Update() 'tracks in-ball-velocity
  867. dim str, b, AllBalls, highestID : allBalls = getballs
  868.  
  869. for each b in allballs
  870. if b.id >= HighestID then highestID = b.id
  871. Next
  872.  
  873. if uBound(ballvel) < highestID then redim ballvel(highestID) 'set bounds
  874. if uBound(ballvelx) < highestID then redim ballvelx(highestID) 'set bounds
  875. if uBound(ballvely) < highestID then redim ballvely(highestID) 'set bounds
  876.  
  877. for each b in allballs
  878. ballvel(b.id) = BallSpeed(b)
  879. ballvelx(b.id) = b.velx
  880. ballvely(b.id) = b.vely
  881. Next
  882. End Sub
  883. End Class
  884.  
  885. Sub RDampen_Timer()
  886. Cor.Update
  887. End Sub
  888.  
  889. '****************************
  890. ' DROP TARGETS
  891. '****************************
  892.  
  893. Sub DT1_Dropped:DropTargetBank1.Hit 1:End Sub
  894. Sub DT2_Dropped:DropTargetBank1.Hit 2:End Sub
  895. Sub DT3_Dropped:DropTargetBank2.Hit 1:End Sub
  896. Sub DT4_Dropped:DropTargetBank2.Hit 2:End Sub
  897. Sub DT5_Dropped:DropTargetBank2.Hit 3:End Sub
  898.  
  899. '*****************************
  900. ' WIRE RAMPS
  901. '*****************************
  902.  
  903. Sub WireRamp9_Hit :PlaySoundAtVol "WireRamp", WireRamp9, 1:End Sub
  904.  
  905. '*****************************
  906. ' RUBBER POSTS
  907. '*****************************
  908.  
  909. Sub RubberPost1_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  910. Sub RubberPost2_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  911. Sub RubberPost3_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  912. Sub RubberPost4_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  913. Sub RubberPost5_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  914. Sub RubberPost6_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  915. Sub RubberPost7_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  916. Sub RubberPost8_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  917.  
  918. Sub RubberPost13_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  919. Sub RubberPost14_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  920. Sub RubberPost15_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  921. Sub RubberPost16_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  922. Sub RubberPost17_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  923. Sub RubberPost18_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  924. Sub RubberPost19_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  925. Sub RubberPost20_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  926. Sub RubberPost21_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  927. Sub RubberPost22_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  928. Sub RubberPost23_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  929. Sub RubberPost24_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  930. Sub RubberPost25_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  931. Sub RubberPost26_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  932. Sub RubberPost27_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  933.  
  934. Sub RubberPost29_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  935. Sub RubberPost30_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  936. Sub RubberPost31_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  937. Sub RubberPost32_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  938. Sub RubberPost33_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  939. Sub RubberPost34_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  940. Sub RubberPost35_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  941. Sub RubberPost36_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  942. Sub RubberPost37_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  943. Sub RubberPost38_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  944. Sub RubberPost39_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  945. Sub RubberPost40_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  946. Sub RubberPost41_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  947. Sub RubberPost42_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  948. Sub RubberPost43_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  949. Sub RubberPost44_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  950. Sub RubberPost45_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  951. Sub RubberPost46_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  952. Sub RubberPost47_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  953. Sub RubberPost48_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  954. Sub RubberPost49_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  955. Sub RubberPost50_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  956. Sub RubberPost51_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  957. Sub RubberPost52_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  958. Sub RubberPost53_Hit :PlaySoundAtVol "fx_rubber_post", ActiveBall, 1:End Sub
  959.  
  960. '*****************************
  961. ' RUBBER SLEEVES
  962. '*****************************
  963.  
  964. Sub RubberSleeve2_Hit :PlaySoundAtVol "fx_metalwire", ActiveBall, 1:End Sub
  965. Sub RubberSleeve4_Hit :PlaySoundAtVol "fx_metalwire", ActiveBall, 1:End Sub
  966. Sub RubberSleeve6_Hit :PlaySoundAtVol "fx_metalwire", ActiveBall, 1:End Sub
  967. Sub RubberSleeve8_Hit :PlaySoundAtVol "fx_metalwire", ActiveBall, 1:End Sub
  968. Sub RubberSleeve9_Hit :PlaySoundAtVol "fx_metalwire", ActiveBall, 1:End Sub
  969. Sub RubberSleeve10_Hit :PlaySoundAtVol "fx_metalwire", ActiveBall, 1:End Sub
  970.  
  971.  
  972.  
  973. '***********************************
  974. ' HELPER FUNCTIONS
  975. '***********************************
  976.  
  977. Sub LeftCaptiveHelper_Hit
  978. if Activeball.vely < 0 then
  979. RightCaptiveKicker.kick -22, abs(ActiveBall.vely) * 0.3
  980. end if
  981. End Sub
  982.  
  983. Sub RightCaptiveHelper_Hit
  984. if Activeball.vely < 0 then
  985. LeftCaptiveKicker.kick -22, abs(ActiveBall.vely) * 0.3
  986. end if
  987. End Sub
  988.  
  989. '****************************
  990. ' GATES
  991. '****************************
  992.  
  993. Sub Gate_Hit:PlaySoundAtVol "Gate5", Gate, 1:End Sub
  994. Sub Gate1_Hit:PlaySoundAtVol "Gate5", Gate1, 1:End Sub
  995.  
  996. '****************************
  997. ' BUMPERS
  998. '****************************
  999.  
  1000. Dim Bumper1_Dir,Bumper2_Dir
  1001.  
  1002. Sub Bumper1_Hit : vpmTimer.PulseSw(1) : playsoundAtVol SoundFX("bumper2",DOFContactors), ActiveBall, 1: End Sub
  1003. Sub Bumper2_Hit : vpmTimer.PulseSw(2) : playsoundAtVol SoundFX("bumper2",DOFContactors), ActiveBall, 1: End Sub
  1004.  
  1005. 'BUMPER RINGS
  1006. Sub Bumper1_Timer
  1007. P_B1Ring.TransZ = P_B1Ring.TransZ + Bumper1_Dir * 2.5
  1008. if P_B1Ring.TransZ <= -30 then Bumper1_Dir = 1
  1009. if P_B1Ring.TransZ >= 0 then
  1010. Bumper1.Timerenabled = False
  1011. Bumper1_Dir = 0
  1012. end if
  1013. End Sub
  1014. Sub Bumper2_Timer
  1015. P_B2Ring.TransZ = P_B2Ring.TransZ + Bumper2_Dir * 2.5
  1016. if P_B2Ring.TransZ <= -30 then Bumper2_Dir = 1
  1017. if P_B2Ring.TransZ >= 0 then
  1018. Bumper2.Timerenabled = False
  1019. Bumper2_Dir = 0
  1020. end if
  1021. End Sub
  1022.  
  1023. '********************************************
  1024. ' ADDITIONAL LAMPS CALLBACK
  1025. '********************************************
  1026.  
  1027. Dim LeftCaptiveActive,RightCaptiveActive
  1028.  
  1029. Sub CBTimer_Timer
  1030. if Controller.lamp(33) or Controller.lamp(40) then
  1031. LeftCaptiveActive = True
  1032. RightCaptiveActive = False
  1033. end if
  1034. if Controller.lamp(34) or Controller.lamp(39) then
  1035. LeftCaptiveActive = False
  1036. RightCaptiveActive = True
  1037. end if
  1038. if Controller.lamp(48) then
  1039. Lamp48.state = 1
  1040. else
  1041. Lamp48.state = 0
  1042. end if
  1043. Flipperactive = Controller.lamp(54)
  1044. End sub
  1045.  
  1046. '*****************************************
  1047. ' ninuzzu's FLIPPER SHADOWS
  1048. '*****************************************
  1049.  
  1050. sub FlipperTimer_Timer()
  1051. FlipperLSh.RotZ = LeftFlipper.currentangle
  1052. FlipperRSh.RotZ = RightFlipper.currentangle
  1053.  
  1054. End Sub
  1055.  
  1056. '*****************************************
  1057. ' ninuzzu's BALL SHADOW
  1058. '*****************************************
  1059. Dim BallShadow
  1060. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  1061.  
  1062. Sub BallShadowUpdate_timer()
  1063. Dim BOT, b
  1064. BOT = GetBalls
  1065. ' hide shadow of deleted balls
  1066. If UBound(BOT)<(tnob-1) Then
  1067. For b = (UBound(BOT) + 1) to (tnob-1)
  1068. BallShadow(b).visible = 0
  1069. Next
  1070. End If
  1071. ' exit the Sub if no balls on the table
  1072. If UBound(BOT) = -1 Then Exit Sub
  1073. ' render the shadow for each ball
  1074. For b = 0 to UBound(BOT)
  1075. If BOT(b).X < Nemesis.Width/2 Then
  1076. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Nemesis.Width/2))/7)) + 6
  1077. Else
  1078. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Nemesis.Width/2))/7)) - 6
  1079. End If
  1080. ballShadow(b).Y = BOT(b).Y + 12
  1081. If BOT(b).Z > 20 Then
  1082. BallShadow(b).visible = 1
  1083. Else
  1084. BallShadow(b).visible = 0
  1085. End If
  1086. Next
  1087. End Sub
  1088.  
  1089. '***********************************
  1090. ' DIP SWITCH SETTINGS
  1091. '***********************************
  1092.  
  1093. 'B A
  1094. '87654321 87654321
  1095.  
  1096. Sub editDips
  1097. Dim vpmDips:Set vpmDips=New cvpmDips
  1098. With vpmDips
  1099. .AddForm 700,280,"Nemesis - DIP switches"
  1100.  
  1101. .AddFrame 0,0,110,"Bonus Feature",&H00000100,Array("Adaptive",0,"Fixed",&H00000100)'dip B-1
  1102. .AddFrame 0,45,110,"Match Feature",&H00000002,Array("Credit",0,"Double Score",&H00000002)'dip A-2
  1103. .AddChk 0,95,150,Array("Attract Sound",&H00000004) 'dip A-3
  1104.  
  1105. ' .AddChk 0,115,150,Array("Enable Features below",&H00001000) 'dip B-5
  1106. ' .AddChk 15,130,150,Array("Show game-on time",&H00002000) 'dip B-6
  1107. ' .AddChk 15,145,150,Array("Show inserted coins",&H00004000) 'dip B-7
  1108. ' .AddChk 15,160,150,Array("Show played games",&H00008000) 'dip B-8
  1109. '
  1110. ' .AddChk 0,180,150,Array("Erase memory A",&H00000400) 'dip B-2
  1111. ' .AddChk 0,195,150,Array("Erase memory B",&H00000200) 'dip B-3
  1112. .AddFrame 160,0,110,"Coins per game",&H00000018,Array("1-3",0,"1-5",&H00000018,"1-6",&H00000008,"2-6",&H00000010)'dip A-4&A-5
  1113. .AddFrame 160,75,110,"Score threshold",&H000000C0,Array("1,400,000 points",&H000000C0,"1,600,000 points",&H00000080,"1,500,000 points",&H00000040,"1,700,000 points",0)'dip A-7&A-8
  1114. .AddFrame 160,150,110,"Balls per game",&H00000020,Array("5 balls",0,"3 balls",&H00000020)'dip A-6
  1115. .AddLabel 0,220,280,20,"After hitting OK, press F3 to reset game with new settings."
  1116. .ViewDips
  1117. End With
  1118. End Sub
  1119. Set vpmShowDips=GetRef("editDips")
  1120.  
  1121. ' *******************************************************************************************************
  1122. ' Positional Sound Playback Functions by DJRobX, Rothbauerw, Thalamus and Herweh
  1123. ' PlaySound sound, 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  1124. ' *******************************************************************************************************
  1125.  
  1126. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  1127. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  1128. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  1129.  
  1130. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  1131. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  1132. End Sub
  1133.  
  1134. ' Set position as table object (Use object or light but NOT wall) and Vol to 1
  1135.  
  1136. Sub PlaySoundAt(soundname, tableobj)
  1137. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1138. End Sub
  1139.  
  1140. ' set position as table object and Vol + RndPitch manually
  1141.  
  1142. Sub PlaySoundAtVolPitch(sound, tableobj, Vol, RndPitch)
  1143. PlaySound sound, 1, Vol, AudioPan(tableobj), RndPitch, 0, 0, 1, AudioFade(tableobj)
  1144. End Sub
  1145.  
  1146. 'Set all as per ball position & speed.
  1147.  
  1148. Sub PlaySoundAtBall(soundname)
  1149. PlaySoundAt soundname, ActiveBall
  1150. End Sub
  1151.  
  1152. 'Set position as table object and Vol manually.
  1153.  
  1154. Sub PlaySoundAtVol(sound, tableobj, Volume)
  1155. PlaySound sound, 1, Volume, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  1156. End Sub
  1157.  
  1158. 'Set all as per ball position & speed, but Vol Multiplier may be used eg; PlaySoundAtBallVol "sound",3
  1159.  
  1160. Sub PlaySoundAtBallVol(sound, VolMult)
  1161. PlaySound sound, 0, Vol(ActiveBall) * VolMult, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  1162. End Sub
  1163.  
  1164. Sub PlaySoundAtBallAbsVol(sound, VolMult)
  1165. PlaySound sound, 0, VolMult, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
  1166. End Sub
  1167.  
  1168. ' requires rampbump1 to 7 in Sound Manager
  1169.  
  1170. Sub RandomBump(voladj, freq)
  1171. Dim BumpSnd:BumpSnd= "rampbump" & CStr(Int(Rnd*7)+1)
  1172. PlaySound BumpSnd, 0, Vol(ActiveBall)*voladj, AudioPan(ActiveBall), 0, freq, 0, 1, AudioFade(ActiveBall)
  1173. End Sub
  1174.  
  1175. ' set position as bumperX and Vol manually. Allows rapid repetition/overlaying sound
  1176.  
  1177. Sub PlaySoundAtBumperVol(sound, tableobj, Vol)
  1178. PlaySound sound, 1, Vol, AudioPan(tableobj), 0,0,1, 1, AudioFade(tableobj)
  1179. End Sub
  1180.  
  1181. Sub PlaySoundAtBOTBallZ(sound, BOT)
  1182. PlaySound sound, 0, ABS(BOT.velz)/17, Pan(BOT), 0, Pitch(BOT), 1, 0, AudioFade(BOT)
  1183. End Sub
  1184.  
  1185. ' play a looping sound at a location with volume
  1186. Sub PlayLoopSoundAtVol(sound, tableobj, Vol)
  1187. PlaySound sound, -1, Vol, AudioPan(tableobj), 0, 0, 1, 0, AudioFade(tableobj)
  1188. End Sub
  1189.  
  1190. '*********************************************************************
  1191. ' Supporting Ball & Sound Functions
  1192. '*********************************************************************
  1193.  
  1194. Function RndNum(min, max)
  1195. RndNum = Int(Rnd() * (max-min + 1) ) + min ' Sets a random number between min and max
  1196. End Function
  1197.  
  1198. 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. "Nemesis" is the name of the table
  1199. Dim tmp
  1200. On Error Resume Next
  1201. tmp = tableobj.y * 2 / Nemesis.height-1
  1202. If tmp > 0 Then
  1203. AudioFade = Csng(tmp ^10)
  1204. Else
  1205. AudioFade = Csng(-((- tmp) ^10) )
  1206. End If
  1207. End Function
  1208.  
  1209. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "Nemesis" is the name of the table
  1210. Dim tmp
  1211. On Error Resume Next
  1212. tmp = tableobj.x * 2 / Nemesis.width-1
  1213. If tmp > 0 Then
  1214. AudioPan = Csng(tmp ^10)
  1215. Else
  1216. AudioPan = Csng(-((- tmp) ^10) )
  1217. End If
  1218. End Function
  1219.  
  1220. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "Nemesis" is the name of the table
  1221. Dim tmp
  1222. On Error Resume Next
  1223. tmp = ball.x * 2 / Nemesis.width-1
  1224. If tmp > 0 Then
  1225. Pan = Csng(tmp ^10)
  1226. Else
  1227. Pan = Csng(-((- tmp) ^10) )
  1228. End If
  1229. End Function
  1230.  
  1231. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1232. Vol = Csng(BallVel(ball) ^2 / 2000)
  1233. End Function
  1234.  
  1235. Function VolMulti(ball,Multiplier) ' Calculates the Volume of the sound based on the ball speed
  1236. VolMulti = Csng(BallVel(ball) ^2 / 150 ) * Multiplier
  1237. End Function
  1238.  
  1239. Function DVolMulti(ball,Multiplier) ' Calculates the Volume of the sound based on the ball speed
  1240. DVolMulti = Csng(BallVel(ball) ^2 / 150 ) * Multiplier
  1241. debug.print DVolMulti
  1242. End Function
  1243.  
  1244. Function BallRollVol(ball) ' Calculates the Volume of the sound based on the ball speed
  1245. BallRollVol = Csng(BallVel(ball) ^2 / (80000 - (79900 * Log(RollVol) / Log(100))))
  1246. End Function
  1247.  
  1248. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1249. Pitch = BallVel(ball) * 20
  1250. End Function
  1251.  
  1252. Function BallVel(ball) 'Calculates the ball speed
  1253. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1254. End Function
  1255.  
  1256. Function BallVelZ(ball) 'Calculates the ball speed in the -Z
  1257. BallVelZ = INT((ball.VelZ) * -1 )
  1258. End Function
  1259.  
  1260. Function VolZ(ball) ' Calculates the Volume of the sound based on the ball speed in the Z
  1261. VolZ = Csng(BallVelZ(ball) ^2 / 200)*1.2
  1262. End Function
  1263.  
  1264. '*** Determines if a Points (px,py) is inside a 4 point polygon A-D in Clockwise/CCW order
  1265.  
  1266. Function InRect(px,py,ax,ay,bx,by,cx,cy,dx,dy)
  1267. Dim AB, BC, CD, DA
  1268. AB = (bx*py) - (by*px) - (ax*py) + (ay*px) + (ax*by) - (ay*bx)
  1269. BC = (cx*py) - (cy*px) - (bx*py) + (by*px) + (bx*cy) - (by*cx)
  1270. CD = (dx*py) - (dy*px) - (cx*py) + (cy*px) + (cx*dy) - (cy*dx)
  1271. DA = (ax*py) - (ay*px) - (dx*py) + (dy*px) + (dx*ay) - (dy*ax)
  1272.  
  1273. If (AB <= 0 AND BC <=0 AND CD <= 0 AND DA <= 0) Or (AB >= 0 AND BC >=0 AND CD >= 0 AND DA >= 0) Then
  1274. InRect = True
  1275. Else
  1276. InRect = False
  1277. End If
  1278. End Function
  1279.  
  1280.  
  1281. '**********************************************
  1282. ' JP SALAS' VP10 ROLLING SOUNDS
  1283. '**********************************************
  1284.  
  1285. Const tnob = 3 ' total number of balls
  1286. ReDim rolling(tnob)
  1287. InitRolling
  1288.  
  1289. Sub InitRolling
  1290. Dim i
  1291. For i = 0 to tnob
  1292. rolling(i) = False
  1293. Next
  1294. End Sub
  1295.  
  1296. Sub RollingTimer_Timer()
  1297. Dim BOT, b
  1298. BOT = GetBalls
  1299.  
  1300. ' stop the sound of deleted balls
  1301. For b = UBound(BOT) + 1 to tnob
  1302. rolling(b) = False
  1303. StopSound("fx_ballrolling" & b)
  1304. Next
  1305.  
  1306. ' exit the sub if no balls on the table
  1307. If UBound(BOT) = -1 Then Exit Sub
  1308.  
  1309. ' play the rolling sound for each ball
  1310. For b = 0 to UBound(BOT)
  1311. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  1312. rolling(b) = True
  1313. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  1314. Else
  1315. If rolling(b) = True Then
  1316. StopSound("fx_ballrolling" & b)
  1317. rolling(b) = False
  1318. End If
  1319. End If
  1320. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  1321. PlaySoundAtBOTBallZ "fx_ball_drop" & b, BOT(b)
  1322. 'debug.print BOT(b).velz
  1323. End If
  1324. Next
  1325. End Sub
  1326.  
  1327. '****************************
  1328. ' BALL COLISION SOUND
  1329. '****************************
  1330.  
  1331. Sub OnBallBallCollision(ball1, ball2, velocity)
  1332. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / (VolDiv/VolCol), Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  1333. End Sub
  1334.  
  1335. Sub SolKnocker(Enabled)
  1336. If Enabled Then PlaySoundAt SoundFX("knocker",DOFKnocker), Plunger
  1337. End Sub
  1338.  
  1339. '**********************************
  1340. ' DESTRUK'S DISPLAY CODE
  1341. '**********************************
  1342.  
  1343. Dim Digits(53)
  1344. Digits(0)=Array(Light1,Light2,Light3,Light4,Light5,Light6,Light7,Light8)'ok
  1345. Digits(1)=Array(Light15,Light9,Light10,Light11,Light12,Light13,Light14)'ok
  1346. Digits(2)=Array(Light23,Light16,Light18,Light19,Light20,Light21,Light22)'ok
  1347. Digits(3)=Array(Light30,Light24,Light25,Light26,Light27,Light28,Light29,Light31)'ok
  1348. Digits(4)=Array(Light38,Light32,Light33,Light34,Light35,Light36,Light37)'ok
  1349. Digits(5)=Array(Light45,Light39,Light40,Light41,Light42,Light43,Light44)'ok
  1350. Digits(6)=Array(Light53,Light46,Light47,Light49,Light50,Light51,Light52)'ok
  1351.  
  1352. Digits(7)=Array(Light54,Light55,Light57,Light59,Light60,Light61,Light62,Light63)'ok
  1353. Digits(8)=Array(Light70,Light64,Light65,Light66,Light67,Light68,Light69)'ok
  1354. Digits(9)=Array(Light77,Light71,Light72,Light73,Light74,Light75,Light76)'ok
  1355. Digits(10)=Array(Light84,Light78,Light79,Light80,Light81,Light82,Light83,Light85)'ok
  1356. Digits(11)=Array(Light92,Light86,Light87,Light88,Light89,Light90,Light91)'ok
  1357. Digits(12)=Array(Light99,Light93,Light94,Light95,Light96,Light97,Light98)'ok
  1358. Digits(13)=Array(Light106,Light100,Light101,Light102,Light103,Light104,Light105)'ok
  1359.  
  1360. Digits(14)=Array(Light107,Light108,Light109,Light110,Light111,Light112,Light113,Light114)'ok
  1361. Digits(15)=Array(Light121,Light115,Light116,Light117,Light118,Light119,Light120)'ok
  1362. Digits(16)=Array(Light128,Light122,Light123,Light124,Light125,Light126,Light127)'ok
  1363. Digits(17)=Array(Light135,Light129,Light130,Light131,Light132,Light133,Light134,Light136)'ok
  1364. Digits(18)=Array(Light143,Light137,Light138,Light139,Light140,Light141,Light142)'ok
  1365. Digits(19)=Array(Light150,Light144,Light145,Light146,Light147,Light148,Light149)'ok
  1366. Digits(20)=Array(Light157,Light151,Light152,Light153,Light154,Light155,Light156)'ok
  1367.  
  1368. Digits(21)=Array(Light158,Light159,Light160,Light161,Light162,Light163,Light164,Light165)'ok
  1369. Digits(22)=Array(Light172,Light166,Light167,Light168,Light169,Light170,Light171)'ok
  1370. Digits(23)=Array(Light179,Light173,Light174,Light175,Light176,Light177,Light178)'ok
  1371. Digits(24)=Array(Light186,Light180,Light181,Light182,Light183,Light184,Light185,Light187)'ok
  1372. Digits(25)=Array(Light194,Light188,Light189,Light190,Light191,Light192,Light193)'ok
  1373. Digits(26)=Array(Light201,Light195,Light196,Light197,Light198,Light199,Light200)'ok
  1374. Digits(27)=Array(Light208,Light202,Light203,Light204,Light205,Light206,Light207)'ok
  1375.  
  1376. Digits(28)=Array(Light209,Light210,Light211,Light212,Light213,Light214,Light215)'ok
  1377. Digits(29)=Array(Light216,Light217,Light218,Light219,Light220,Light221,Light222)'ok
  1378.  
  1379. Digits(30)=Array(Light223,Light224,Light225,Light226,Light227,Light228,Light229)'ok
  1380. Digits(31)=Array(Light230,Light231,Light232,Light233,Light234,Light235,Light236)'ok
  1381.  
  1382. Digits(32)=Array(Light237,Light238,Light239,Light240,Light241,Light242,Light243)'ok
  1383.  
  1384. Digits(33)=Array(Light17,Light48,Light56,Light58,Light244,Light245,Light246,Light247)'ok
  1385. Digits(34)=Array(Light254,Light248,Light249,Light250,Light251,Light252,Light253)'ok
  1386. Digits(35)=Array(Light261,Light255,Light256,Light257,Light258,Light259,Light260)'ok
  1387. Digits(36)=Array(Light268,Light262,Light263,Light264,Light265,Light266,Light267,Light269)'ok
  1388. Digits(37)=Array(Light276,Light270,Light271,Light272,Light273,Light274,Light275)'ok
  1389. Digits(38)=Array(Light283,Light277,Light278,Light279,Light280,Light281,Light282)'ok
  1390. Digits(39)=Array(Light290,Light284,Light285,Light286,Light287,Light288,Light289)'ok
  1391.  
  1392. Digits(40)=Array(Light291,Light292,Light293,Light294,Light295,Light296,Light297,Light298)'ok
  1393. Digits(41)=Array(Light305,Light299,Light300,Light301,Light302,Light303,Light304)'ok
  1394. Digits(42)=Array(Light312,Light306,Light307,Light308,Light309,Light310,Light311)'ok
  1395. Digits(43)=Array(Light319,Light313,Light314,Light315,Light316,Light317,Light318,Light320)'ok
  1396. Digits(44)=Array(Light327,Light321,Light322,Light323,Light324,Light325,Light326)'ok
  1397. Digits(45)=Array(Light334,Light328,Light329,Light330,Light331,Light332,Light333)'ok
  1398. Digits(46)=Array(Light341,Light335,Light336,Light337,Light338,Light339,Light340)'ok
  1399.  
  1400. Digits(47)=Array(Light342,Light343,Light344,Light345,Light346,Light347,Light348,Light349)'ok
  1401. Digits(48)=Array(Light356,Light350,Light351,Light352,Light353,Light354,Light355)'ok
  1402. Digits(49)=Array(Light363,Light357,Light358,Light359,Light360,Light361,Light362)'ok
  1403. Digits(50)=Array(Light370,Light364,Light365,Light366,Light367,Light368,Light369,Light371)'ok
  1404. Digits(51)=Array(Light378,Light372,Light373,Light374,Light375,Light376,Light377)'ok
  1405. Digits(52)=Array(Light385,Light379,Light380,Light381,Light382,Light383,Light384)'ok
  1406. Digits(53)=Array(Light392,Light386,Light387,Light388,Light389,Light390,Light391)'ok
  1407.  
  1408.  
  1409. Sub DisplayTimer_Timer
  1410. Dim ChgLED,ii,num,chg,stat,obj
  1411. ChgLED = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  1412. If Not IsEmpty(ChgLED) Then
  1413. For ii = 0 To UBound(chgLED)
  1414. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  1415. For Each obj In Digits(num)
  1416. If chg And 1 Then obj.State = stat And 1
  1417. chg = chg\2 : stat = stat\2
  1418. Next
  1419. Next
  1420. End If
  1421. End Sub
  1422.  
  1423. Sub Nemesis_Exit()
  1424. If B2SOn Then
  1425. Controller.Pause = False
  1426. Controller.Stop
  1427. End If
  1428. End Sub
Add Comment
Please, Sign In to add comment