-
Notifications
You must be signed in to change notification settings - Fork 39
/
Judge Dredd (Bally 1993) VPW v1.1.vbs
5187 lines (4434 loc) · 185 KB
/
Judge Dredd (Bally 1993) VPW v1.1.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'*********************** VPW Presents ***********************
' ___ _ _______ _____ _____ ____________ _________________
' |_ | | | | _ \ __ \| ___| | _ \ ___ \ ___| _ \ _ \
' | | | | | | | | | \/| |__ | | | | |_/ / |__ | | | | | | |
' | | | | | | | | | __ | __| | | | | /| __|| | | | | | |
'/\__/ / |_| | |/ /| |_\ \| |___ | |/ /| |\ \| |___| |/ /| |/ /
'\____/ \___/|___/ \____/\____/ |___/ \_| \_\____/|___/ |___/
'****************************************************************
'
' Judge Dredd - IPDB No. 1322
' © Bally/Midway 1993
' Widebody "Superpin" Line
' https://www.ipdb.org/machine.cgi?id=1322
'
'****************************************************************
' How To Play:
'****************************************************************
'
' - Start Button - Start normal Game
' - Plunger - Launch Ball (note: real machine does not have a plunger, right firebutton launches balls)
' - Right Magnasave - Start "Super Game" (instant multiball - needs 2 credits)
' - Left Magnasave - Change LUT until game starts, then launches ball from left plunger lane in Air Raid / Missile mode.
'
' - How to activate DeadWorld - Hit J-U-D-G-E drop targets in order (ball in judge subway lights a letter)
' - How to start DW multiball - Get 3 balls into deadworld using left pursuit ramp after lighting J-U-D-G-E.
' - How to get Ultimate Challenge - Defeat all 4 dark judges or light all chain missions.
'
'****************************************************************
' V-Pin Workshop Judge Dredd Team
'****************************************************************
'Sixtoe - Project Lead, VPX monkey, not sleeping, living on gin, jack of all trades, master of none.
'Tomate - The Baron of Blender, creator of 3d things, helping Sixtoe to not suck (as much) at Blender.
'iaakki - Scripting, Insert lighting.
'Benji - Physics work, deadworld & banana lamp inserts prims.
'Daphishbowl & iaakki - Custom Deadworld & Crane code.
'Cyberpez - Opto's and VUK prims, aftermarket crane models, general assistance.
'Flupper - Flipper primitives, ramp tutorials, general assistance with rendering issues.
'RothebauerW - Physics tutorial, drop and standup target bugfixing, general assistance.
'Fluffhead, Apophis & Wytle - RTX Ball Shadows.
'gtxjoe - Ball trough tweaking assistance, no more balls destroyed!
'3rdaxis - Primitive tweaks, VR cabinet improvements, Working coin door and manual.
'Embee & Kingdids - Original crane primitive and texture redraw
'DJRobX - Still answering Sixtoes coding questions...
'Rik & VPW Team - Testing
'Everyone in VPW for their support and encouragement!
'The PinMAME and VPX Developers for the programmes we all use!
'
'V1.0
'Initial Release
'
'V1.1
'Fixed missing flipper rubber sounds.
'Rebuilt entire subway entrance and fixed wall partially blocking subway (after it was added at last minute to fix a ball trap).
'Adjusted crane ramp exit hole area.
'Changed cabinet POV with 1:1 one from Hauntfreaks.
'Fixed DMD surround in VR.
Option Explicit
Randomize
'****************************************************************
' Table Options
'****************************************************************
'///////////////////////---- Volume ----/////////////////////////
'VolumeDial is the global volume for mechanical sounds
Const VolumeDial = 0.8 'Recommended values should be no higher than 1
'///////////////////////---- VR Room ----////////////////////////
Const VRRoom = 0 '0 - VR Room Off, 1 - Minimal Room, 2 - 360 Room, 3 - Ultra Minimal
'/////////////////////---- Cabinet Mode ----/////////////////////
Const CabinetMode = 0 '0 - Rails, 1 - Hidden Rails
'///////////////////////---- Crane Mod ----//////////////////////
Const CraneMod = 0 '0 - Original, 1 - 3D Printed, 2 - Powder Coated Black, 3 - Metal
'/////////////////////---- Physics Mods ----/////////////////////
Const RubberizerEnabled = 1 '0 = normal flip rubber, 1 = more lively rubber for flips, 2 = different rubberizer
Const FlipperCoilRampupMode = 0 '0 = fast, 1 = medium, 2 = slow (tap passes should work)
Const TargetBouncerEnabled = 1 '0 = normal standup targets, 1 = bouncy targets
Const TargetBouncerFactor = 1.0 'Level of bounces. 0.2 - 1.5 are probably usable values.
'/////////////////////---- Ball Shadows ----/////////////////////
Const DynamicBallShadowsOn = 1 '0 = no dynamic ball shadow, 1 = enable dynamic ball shadow
Const AmbientShadowOn = 1 '0 = ambient ball shadow, 1 = enable ambient shadow
'//////////////---- LUT (Colour Look Up Table) ----//////////////
'0 = Fleep Natural Dark 1
'1 = Fleep Natural Dark 2
'2 = Fleep Warm Dark
'3 = Fleep Warm Bright
'4 = Fleep Warm Vivid Soft
'5 = Fleep Warm Vivid Hard
'6 = Skitso Natural and Balanced
'7 = Skitso Natural High Contrast
'8 = 3rdaxis Referenced THX Standard
'9 = CalleV Punchy Brightness and Contrast
'10 = HauntFreaks Desaturated
'11 = Tomate Washed Out
'12 = VPW Original 1 to 1
'13 = Bassgeige
'14 = Blacklight
'15 = B&W Comic Book
Dim LUTset, DisableLUTSelector, LutToggleSound
LutToggleSound = True
LoadLUT
'LUTset = 11 ' Override saved LUT for debug
SetLUT
DisableLUTSelector = 0 ' Disables the ability to change LUT option with magna saves in game when set to 1
'****************************************************************
' END OF TABLE OPTIONS
'****************************************************************
Const BallSize = 50 'How big the ball is, don't change as it will break the physics.
Const BallMass = 1 'How "heavy" the ball is, don't change, don't change as it will break the physics.
Dim DesktopMode: DesktopMode = Table1.ShowDT
Dim UseVPMDMD
If VRRoom <> 0 Then UseVPMDMD = True Else UseVPMDMD = DesktopMode
Const UseVPMColoredDMD = true 'Passes raw colored DMD data from VPM to VPX.
Const UseVPMModSol = 1 'Modulated" solenoids for flashers / lights, give a dimming value of 0-255 rather than VPX smoothing between 0 and 1.
If Table1.ShowFSS = True or DesktopMode = False Then
ScoreText.visible = False
End If
'Set which rom / vpinmame shortname we're using, which is "JD_L1", DO NOT use any other rom (e.g. JD_L7).
'Before Judge Dredd was released a major operator apparently expressed concern over how reliable the deadworld ball lock would be so it was deactived for production machines.
Const cGameName = "jd_l1" '***DO NOT CHANGE***
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "Can't open controller.vbs"
debug.print Err.Description
On Error Goto 0
LoadVPM "01560000", "WPC.VBS", 3.36
'****************************************************************
' STANDARD DEFINITIONS
'****************************************************************
'Main definitions
Const UseSolenoids = 2 'Enable fastflips for williams tables (1 disables)
Const UseLamps = 0 'Use core.vbs script light support instead of the custom lamptimer scripts
Const UseGI = 0 'Use core.vbs GI routine for older machines or machines with no GI
Const UseSync = 0 'Use vsync - Use if table runs too fast
Const HandleMech = 0 'Use core.vbs mechanicals (cvpmMech) pre-programmed into VPX.
'Sounds definitions - Defaulted to empty as they are set elsewhere in the script.
Const SSolenoidOn = "" 'Set solonoid sound when they activate
Const SSolenoidOff = "" 'Set solonoid sound when they deactivate
Const SFlipperOn = "" 'Set flipper sound when they activate
Const SFlipperOff = "" 'Set flipper sound when they deactivate
Const SCoin = "" 'Set coin entry sound
'****************************************************************
' SOLENOID CALLBACKS
'****************************************************************
SolCallBack(1) = "CraneMag" 'Globe Magnet (Magnet inside of crane arm)
SolCallBack(2) = "bsBotVUK.SolOut" 'Bottom (Left) Vertical Up Kicker / Popper
SolCallBack(3) = "bsTopVUK.SolOut" 'Top (Right) Vertical Up Kicker / Popper
SolCallBack(4) = "CraneArm" 'Globe Arm (Crane arm movement)
SolCallBack(5) = "ResetDrops" 'Reset Drop Targets
SolCallBack(6) = "SolWheelDrive" 'Globe Motor (Rotate Deadworld)
SolCallBack(7) = "SolKnocker" 'Knocker
SolCallBack(8) = "JDPlunger" 'Right Shooter / Plunger
SolCallBack(9) = "KickBack" 'Left Shooter / Missile Launcher
SolCallBack(10) = "TripDrop" 'Trip Drop Target
SolCallBack(11) = "Diverter" 'Diverter (Top Ramp)
'SolCallBack(12) = 'Not Used
'SolCallBack(14) = 'Not Used
SolCallBack(13) = "JDTrough" 'Ball Trough
'SolCallBack(15) = 'Left Sllingshot
'SolCallBack(16) = 'Right Slingshot
SolCallBack(17) = "SetLamp 117," 'Judge Fire Flasher (Centre Playfield)
SolCallBack(18) = "SetLamp 118," 'Judge Fear Flasher (Centre Playfield)
SolCallBack(19) = "SetLamp 119," 'Judge Death Flasher (Centre Playfield)
SolCallBack(20) = "SetLamp 120," 'Judge Mortis Flasher (Centre Playfield)
SolCallBack(21) = "FlashSol21" '"SetLamp 121," 'Pursuit Left Flashers (Police Lights)
SolCallBack(22) = "FlashSol22" '"SetLamp 122," 'Pursuit Right Flashers (Police Lights)
SolCallBack(23) = "SetLamp 123," 'Blackout Flasher (Centre playfield on bike)
SolCallBack(24) = "SetLamp 124," 'Cursed Earth Flashers (Under Playfield underneath Deadworld)
SolCallBack(25) = "SetLamp 125," 'Lower Left Flashers x2 (Left Shooter Exit & Lower VUK Exit plastics)
SolCallBack(26) = "FlashSol26" '"SetLamp 126," 'Globe Flashers (Inside Deadworld)
SolCallBack(27) = "SetLamp 127," 'Under Ramp Flashers x2 (Under stakeout and sniper ramp)
SolCallBack(28) = "SetLamp 128," 'Backglass Flasher
'Flippers - Controlled directly from VPX
SolCallback(sLRFlipper) = "SolRFlipper" 'Right Flipper
SolCallback(sLLFlipper) = "SolLFlipper" 'Left Flipper
SolCallback(sURFlipper) = "SolURFlipper" 'Upper Right Flipper
SolCallback(sULFlipper) = "SolULFlipper" 'Upper Left Flipper
'****************************************************************
' TABLE INIT
'****************************************************************
'Using table width and height in script slows down the performance, so they're set here once.
Dim tablewidth: tablewidth = Table1.width
Dim tableheight: tableheight = Table1.height
Dim bsTopVUK, bsBotVUK
Dim activeShadowBall
Dim CoindoorIsOpen, CDA
Dim ManualPageNumber: ManualPageNumber = 1
Dim DoorReady: DoorReady = true
Dim ManualMove:ManualMove= 1
Dim DoorMove:DoorMove=-1
Dim DCO:DCO=False
Dim MA:MA=False
Sub Table1_Init()
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
.SplashInfoLine = "Judge Dredd - Bally 1993" & vbNewLine & "by V-Pin Workshop"
.HandleKeyboard = 0
.ShowTitle = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.HandleMechanics = 0
.Hidden = 0
On Error Resume Next
.Run
If Err Then MsgBox Err.Description
debug.print Err.Description
On Error Goto 0
End With
'Main Timer init
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
'Nudging & objects turned off when table tilted
vpmNudge.TiltSwitch = 14
vpmNudge.Sensitivity = 4
vpmNudge.TiltObj = Array(LeftSlingShot, RightSlingShot)
'****************************************************************
' SETUP MACHINE STATE
'****************************************************************
'Close coin door - High Power Mode On
Controller.Switch(22)=1
'VUK (Vertical Up Kicker) Setup for Top and Bottom
Set bsBotVUK = New cvpmBallStack
With bsBotVUK
.InitSaucer sw73, 73, 0, 100 'Kicker Name, Switch Activated, Direction Kicked in Degrees, Force of KickOut
.KickZ=1.2 'Vertical Angle of Kickout **in radians** (NOT degrees), 1.2 = 68 degrees
End With
Set bsTopVUK = New cvpmBallStack
With bsTopVUK
.InitSaucer sw74, 74, 280, 50
.KickZ=1.2
End With
Set activeShadowBall = new cvpmDictionary
'Reactor Lane Captive Ball Creation
CapBall1.createball 'Creates a ball in reactor lane at bottom when table loaded.
CapBall1.kick 180,1 'Kicks out the ball at 180 degrees at 1 power, just enough to get it on the playfield.
CapBall2.createball 'Middle Ball
CapBall2.kick 180,1
CapBall3.createball 'Top Ball
CapBall3.kick 180,1
'Ball Trough Wall Setup (Under Apron)
W81.isdropped = 1 'Drops the walls below apron when table loaded.
W82.isdropped = 1
W83.isdropped = 1
W84.isdropped = 1
W85.isdropped = 1
W86.isdropped = 1
'Impulse Plunger Setup
Sol8.Pullback 'Pulls back main plunger ready to fire when activated
Sol9.Pullback 'Kickback / Missile Plunger
'Backglass Setup
SetBackGlass
'Crane Mod Setup
SetCraneMod
End Sub
'****************************************************************
' SET UP BACKGLASS
'****************************************************************
'This enables objects (flashers) in the "BackGlass" collection to be set up "flat" in the editor
'It essentially moves them all together upright so they're in the right place.
'The makes is very easy to position them using a template as seen on layer 10.
Sub SetBackglass()
Dim obj
For Each obj In BackGlass
obj.x = obj.x
obj.height = - obj.y + 475
obj.y = -60
Next
End Sub
'****************************************************************
' CONTROLS
'****************************************************************
Sub Table1_Paused:Controller.Pause=1:End Sub
Sub Table1_unPaused:Controller.Pause=0:End Sub
Sub Table1_exit:SaveLUT:Controller.Stop:End Sub
Sub Table1_KeyDown(ByVal KeyCode) 'Sub for What happens when you push a button down
If keycode = LeftFlipperKey Then
PinCab_ButtonL.TransX = PinCab_ButtonL.TransX -10 'Moves Left Flipper Cabinet Button
FlipperActivate LeftFlipper, LFPress
If CoindoorIsOpen = 1 Then 'AXS Coindoor
Playsound "ball_bounce2"
ManualPageNumber = ManualPageNumber - 1
if ManualPageNumber = 0 then ManualPageNumber = 47 ' Set your instruction manual page number here.
VR_Instructions.Image = "Manual " & ManualPageNumber
End If
End If
If keycode = RightFlipperKey Then
PinCab_ButtonR.TransX = PinCab_ButtonR.TransX +10 'Moves Right Flipper Cabinet Button
FlipperActivate RightFlipper, RFPress
If CoindoorIsOpen = 1 Then 'AXS Coindoor
Playsound "ball_bounce2"
ManualPageNumber = ManualPageNumber + 1
if ManualPageNumber = 48 then ManualPageNumber = 1 ' Set your instruction manual page number +1 here.
VR_Instructions.Image = "Manual " & ManualPageNumber
End If
End If
If keycode = StartGameKey then 'Start Game
PinCab_Start.Y = PinCab_Start.Y -3 'Moves Start Game Cabinet Button
soundStartButton()
DisableLUTSelector = 1
End If
If KeyCode = 3 Then 'Extra ball (Buy-In)
PinCab_EB.Y = PinCab_EB.Y -3 'Moves Extra Ball Cabinet Button
Controller.Switch(31)=1
End If
If KeyCode = PlungerKey Then Controller.Switch(12)=1 'Right Fire Button / Launch Ball
If Keycode = LeftMagnaSave Then 'Left Fire Button
PinCab_MagL.TransX = PinCab_MagL.TransX -10
Controller.Switch(11)=1
if DisableLUTSelector = 0 then
LUTSet = LUTSet + 1
if LutSet > 15 then LUTSet = 0
lutsetsounddir = 1
If LutToggleSound then
If lutsetsounddir = 1 And LutSet <> 15 Then
Playsound "click", 0, LutToggleSoundLevel * VolumeDial, 0, 0.2, 0, 0, 0, 1
End If
If lutsetsounddir = -1 And LutSet <> 15 Then
Playsound "click", 0, LutToggleSoundLevel * VolumeDial, 0, 0.2, 0, 0, 0, -1
End If
If LutSet = 15 Then
Playsound "gun", 0, 1 * VolumeDial, 0, 0.2, 0, 0, 0, -1
End If
LutSlctr.enabled = true
end if
SetLUT
ShowLUT
end if
End If
If Keycode = RightMagnaSave Then 'Super Game
PinCab_MagR.TransX = PinCab_MagR.TransX +10 'Moves Right Fire Button
PinCab_Super.Y = PinCab_Super.Y -3 'Moves Super Game Cabinet Button
Controller.Switch(44)=1
' if DisableLUTSelector = 0 then
' LUTSet = LUTSet - 1
' if LutSet < 0 then LUTSet = 15
' lutsetsounddir = -1
' If LutToggleSound then
' If lutsetsounddir = 1 And LutSet <> 15 Then
' Playsound "click", 0, LutToggleSoundLevel * VolumeDial, 0, 0.2, 0, 0, 0, 1
' End If
' If lutsetsounddir = -1 And LutSet <> 15 Then
' Playsound "click", 0, LutToggleSoundLevel * VolumeDial, 0, 0.2, 0, 0, 0, -1
' End If
' If LutSet = 15 Then
' Playsound "scream", 0, 1 * VolumeDial, 0, 0.2, 0, 0, 0, -1
' End If
' LutSlctr.enabled = true
' end if
' SetLUT
' ShowLUT
' end if
End If
If keycode = LeftTiltKey Then Nudge 90, 5:SoundNudgeLeft()
If keycode = RightTiltKey Then Nudge 270, 5:SoundNudgeRight()
If keycode = CenterTiltKey Then Nudge 0, 3:SoundNudgeCenter()
If keycode = keyInsertCoin1 or keycode = keyInsertCoin2 or keycode = keyInsertCoin3 or keycode = keyInsertCoin4 Then
Select Case Int(rnd*3)
Case 0: PlaySoundAtLevelStatic ("Coin_In_1"), CoinSoundLevel, Drain
Case 1: PlaySoundAtLevelStatic ("Coin_In_2"), CoinSoundLevel, Drain
Case 2: PlaySoundAtLevelStatic ("Coin_In_3"), CoinSoundLevel, Drain
End Select
End If
If keycode = keyCoinDoor then ' use 'keyCoinDoor' instead of '207' for Rom driven tables.
If DoorReady = true then
DoorReady = false
If DoorMove = -1 then
PlaySound "CoindoorOpen":PlaySound "CoindoorOpen":PlaySound "CoindoorOpen":PlaySound "CoindoorOpen":PlaySound "CoindoorOpen":DCO = True:CoindoorIsOpen = 1
Else
PlaySound "page2":MA = True:CoindoorIsOpen = 0':ManualPageNumber = 1
VR_Instructions.Image = "Manual " & ManualPageNumber
End If
End If
End If
If keycode = 8 and CoindoorIsOpen = 1 Then CoindoorB1.transy = CoindoorB1.transy + 10: playsound "Coindoor_Button"
If keycode = 9 and CoindoorIsOpen = 1 Then CoindoorB2.transy = CoindoorB2.transy + 10: playsound "Coindoor_Button"
If keycode = 10 and CoindoorIsOpen = 1 Then CoindoorB3.transy = CoindoorB3.transy + 10: playsound "Coindoor_Button"
If keycode = 11 and CoindoorIsOpen = 1 Then CoindoorB4.transy = CoindoorB4.transy + 10: playsound "Coindoor_Button"
If Keycode = 5 then'AddCreditKey or keycode = 4 or keycode = 5 or keycode = 6 Then
If CoindoorIsOpen = 0 Then
If VRCoinTimer.enabled = False Then
VR_Coin.visible = True
VRCointimer.enabled = true
playsound"AXSCoinL"
End If
End If
End if
If Keycode = 6 then'AddCreditKey or keycode = 4 or keycode = 5 or keycode = 6 Then
If CoindoorIsOpen = 0 Then
If VRCoinTimer2.enabled = False Then
VR_Coin2.visible = True
VRCointimer2.enabled = true
playsound"AXSCoinR"
End If
End If
End if
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Table1_KeyUp(ByVal KeyCode) 'Sub for What happens when you let go of a button
If keycode = LeftFlipperKey Then
PinCab_ButtonL.TransX = PinCab_ButtonL.TransX +10 'Resets Left Flipper Cabinet Button Position
FlipperDeActivate LeftFlipper, LFPress
End If
If keycode = RightFlipperKey Then
PinCab_ButtonR.TransX = PinCab_ButtonR.TransX -10 'Resets Right Flipper Cabinet Button Position
FlipperDeActivate RightFlipper, RFPress
End If
If keycode = StartGameKey then 'Start Game
PinCab_Start.Y = PinCab_Start.Y +3 'Resets Start Game Cabinet Button Position
End If
If KeyCode = 3 Then 'Extra ball (Buy-In)
PinCab_EB.Y = PinCab_EB.Y +3 'Resets Extra Ball Game Cabinet Button Position
Controller.Switch(31)=0
End If
If KeyCode = PlungerKey Then Controller.Switch(12)=0 'Release Right Fire Cabinet Button / Launch Ball
If Keycode = LeftMagnaSave Then
PinCab_MagL.TransX = PinCab_MagL.TransX +10
Controller.Switch(11)=0
End If
If Keycode = RightMagnaSave Then 'Super Game
PinCab_MagR.TransX = PinCab_MagR.TransX -10 'Resets Right Fire Button Position
PinCab_Super.Y = PinCab_Super.Y +3 'Resets Super Game Cabinet Button Position
Controller.Switch(44)=0
End If
If keycode = 8 and CoindoorIsOpen = 1 Then CoindoorB1.transy = CoindoorB1.transy - 10: playsound "Coindoor_ButtonOff"
If keycode = 9 and CoindoorIsOpen = 1 Then CoindoorB2.transy = CoindoorB2.transy - 10: playsound "Coindoor_ButtonOff"
If keycode = 10 and CoindoorIsOpen = 1 Then CoindoorB3.transy = CoindoorB3.transy - 10: playsound "Coindoor_ButtonOff"
If keycode = 11 and CoindoorIsOpen = 1 Then CoindoorB4.transy = CoindoorB4.transy - 10: playsound "Coindoor_ButtonOff"
If vpmKeyUp(keycode) Then Exit Sub
End Sub
'LUT selector timer
dim lutsetsounddir
sub LutSlctr_timer
If lutsetsounddir = 1 And LutSet <> 15 Then
Playsound "squeek", 0, LutToggleSoundLevel * VolumeDial, 0, 0.2, 0, 0, 0, -1
End If
If lutsetsounddir = -1 And LutSet <> 15 Then
Playsound "squeek", 0, LutToggleSoundLevel * VolumeDial, 0, 0.2, 0, 0, 0, 1
End If
If LutSet = 15 Then
Playsound "scream", 0, 0.1*VolumeDial, 0, 0.2, 0, 0, 0, 1
End If
LutSlctr.enabled = False
end sub
'****************************************************************
' TIMER CODE & PRIMITIVE POSITION TRACKERS
'****************************************************************
Sub FrameTimer_Timer()
'Flipper Trackers
LeftBat.RotZ = LeftFlipper.CurrentAngle
LeftBatu.RotZ = LeftFlipper1.CurrentAngle
batleftshadow.ObjRotZ = LeftFlipper.CurrentAngle
batuleftshadow.ObjRotZ = LeftFlipper1.CurrentAngle
RightBat.RotZ = RightFlipper.CurrentAngle
RightBatU.RotZ = RightFlipper1.CurrentAngle
batrightshadow.ObjRotZ = RightFlipper.CurrentAngle
baturightshadow.ObjRotZ = RightFlipper1.CurrentAngle
'Standup Target Trackers
sw18p_off.rotx = sw18p.rotx
sw18p_off.roty = sw18p.roty
sw18ap_off.rotx = sw18ap.rotx
sw18ap_off.roty = sw18ap.roty
sw18bp_off.rotx = sw18bp.rotx
sw18bp_off.roty = sw18bp.roty
sw25p_off.rotx = sw25p.rotx
sw25p_off.roty = sw25p.roty
sw27p_off.rotx = sw27p.rotx
sw27p_off.roty = sw27p.roty
sw36p_off.rotx = sw36p.rotx
sw36p_off.roty = sw36p.roty
sw68p_off.rotx = sw68p.rotx
sw68p_off.roty = sw68p.roty
'Drop Target Trackers
sw54prim_off.transz = sw54prim.transz
sw54prim_off.rotx = sw54prim.rotx
sw54prim_off.roty = sw54prim.roty
sw55prim_off.transz = sw55prim.transz
sw55prim_off.rotx = sw55prim.rotx
sw55prim_off.roty = sw55prim.roty
sw56prim_off.transz = sw56prim.transz
sw56prim_off.rotx = sw56prim.rotx
sw56prim_off.roty = sw56prim.roty
sw57prim_off.transz = sw57prim.transz
sw57prim_off.rotx = sw57prim.rotx
sw57prim_off.roty = sw57prim.roty
sw58prim_off.transz = sw58prim.transz
sw58prim_off.rotx = sw58prim.rotx
sw58prim_off.roty = sw58prim.roty
'Other Graphics Trackers
DiverterP.ObjRotZ = JDDiverter.CurrentAngle -90
DiverterP_Off.ObjRotZ = JDDiverter.CurrentAngle -90
'Crane Mods -cp
Crane_Arm.rotx = crane.rotx
Crane_Arm.roty = crane.roty
Crane_Arm.rotz = crane.rotz
Crane_Mod3d_a.rotx = crane.rotx
Crane_Mod3d_a.roty = crane.roty
Crane_Mod3d_a.rotz = crane.rotz
Crane_Mod3d_b.rotx = crane.rotx
Crane_Mod3d_b.roty = crane.roty
Crane_Mod3d_b.rotz = crane.rotz
Crane_Mod3d_LEDs.rotx = crane.rotx
Crane_Mod3d_LEDs.roty = crane.roty
Crane_Mod3d_LEDs.rotz = crane.rotz
Crane_Mod_a.rotx = crane.rotx
Crane_Mod_a.roty = crane.roty
Crane_Mod_a.rotz = crane.rotz
Crane_Mod_b.rotx = crane.rotx
Crane_Mod_b.roty = crane.roty
Crane_Mod_b.rotz = crane.rotz
Crane_Mod_LEDs.rotx = crane.rotx
Crane_Mod_LEDs.roty = crane.roty
Crane_Mod_LEDs.rotz = crane.rotz
dw_screws_off.rotz = dw_screws.rotz
Ramp_Wire_Off.BlendDisableLighting = Ramp_Wire.BlendDisableLighting
PinCab_MagLC.TransX = PinCab_MagL.TransX
PinCab_MagRC.TransX = PinCab_MagR.TransX
LampTimer
Lampztimer
RollingUpdate
'BallShadowUpdate
End Sub
'****************************************************************
' FLIPPER CONTROL
'****************************************************************
Const ReflipAngle = 20
Sub SolRFlipper(Enabled)
If Enabled Then
RF.Fire
If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper
Else
SoundFlipperUpAttackRight RightFlipper
RandomSoundFlipperUpRight RightFlipper
End If
Else
RightFlipper.RotateToStart
If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolLFlipper(Enabled)
If Enabled Then
LF.Fire
If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper
Else
SoundFlipperUpAttackLeft LeftFlipper
RandomSoundFlipperUpLeft LeftFlipper
End If
Else
LeftFlipper.RotateToStart
If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
RandomSoundFlipperDownLeft LeftFlipper
End If
FlipperLeftHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolURFlipper(Enabled)
If Enabled Then
RightFlipper1.RotateToEnd
If rightflipper1.currentangle > rightflipper1.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper1
Else
SoundFlipperUpAttackRight RightFlipper1
RandomSoundFlipperUpRight RightFlipper1
End If
Else
RightFlipper1.RotateToStart
RightFlipper1.RotateToStart
If RightFlipper1.currentangle > RightFlipper1.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper1
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolULFlipper(Enabled)
If Enabled Then
LeftFlipper1.RotateToEnd
If leftflipper1.currentangle < leftflipper1.endangle + ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper1
Else
SoundFlipperUpAttackLeft LeftFlipper1
RandomSoundFlipperUpLeft LeftFlipper1
End If
Else
LeftFlipper1.RotateToStart
If LeftFlipper1.currentangle < LeftFlipper1.startAngle - 5 Then
RandomSoundFlipperDownLeft LeftFlipper1
End If
FlipperLeftHitParm = FlipperUpSoundLevel
End If
End Sub
'***********************************************************************
' Begin NFozzy Physics Scripting: Flipper Tricks and Rubber Dampening '
'***********************************************************************
'****************************************************************
' Flipper Collision Subs
'****************************************************************
Sub LeftFlipper_Collide(parm)
FlipperLeftHitParm = parm/10
If FlipperLeftHitParm > 1 Then
FlipperLeftHitParm = 1
End If
FlipperLeftHitParm = FlipperUpSoundLevel * FlipperLeftHitParm
RandomSoundRubberFlipper(parm)
CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
if RubberizerEnabled = 1 then Rubberizer(parm)
if RubberizerEnabled = 2 then Rubberizer2(parm)
End Sub
Sub RightFlipper_Collide(parm)
FlipperRightHitParm = parm/10
If FlipperRightHitParm > 1 Then
FlipperRightHitParm = 1
End If
FlipperRightHitParm = FlipperUpSoundLevel * FlipperRightHitParm
RandomSoundRubberFlipper(parm)
CheckLiveCatch Activeball, RightFlipper, RFCount, parm
if RubberizerEnabled = 1 then Rubberizer(parm)
if RubberizerEnabled = 2 then Rubberizer2(parm)
End Sub
Sub LeftFlipper1_Collide(parm)
FlipperLeftHitParm = parm/10
If FlipperLeftHitParm > 1 Then
FlipperLeftHitParm = 1
End If
FlipperLeftHitParm = FlipperUpSoundLevel * FlipperLeftHitParm
RandomSoundRubberFlipper(parm)
if RubberizerEnabled = 1 then Rubberizer(parm)
if RubberizerEnabled = 2 then Rubberizer2(parm)
End Sub
Sub RightFlipper1_Collide(parm)
FlipperRightHitParm = parm/10
If FlipperRightHitParm > 1 Then
FlipperRightHitParm = 1
End If
FlipperRightHitParm = FlipperUpSoundLevel * FlipperRightHitParm
RandomSoundRubberFlipper(parm)
CheckLiveCatch Activeball, RightFlipper1, RFCount1, parm
if RubberizerEnabled = 1 then Rubberizer(parm)
if RubberizerEnabled = 2 then Rubberizer2(parm)
End Sub
'****************************************************************
' iaakki's Rubberizer
'****************************************************************
sub Rubberizer(parm)
if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
activeball.angmomz = activeball.angmomz * 1.2
activeball.vely = activeball.vely * 1.2
'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
Elseif parm <= 2 and parm > 0.2 and activeball.vely < 0 Then
'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
activeball.angmomz = activeball.angmomz * -1.1
activeball.vely = activeball.vely * 1.4
'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
end if
end sub
sub Rubberizer2(parm)
if parm < 10 And parm > 2 And Abs(activeball.angmomz) < 10 then
'debug.print "parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
activeball.angmomz = -activeball.angmomz * 2
activeball.vely = activeball.vely * 1.2
'debug.print ">> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
Elseif parm <= 2 and parm > 0.2 and activeball.vely < 0 Then
'debug.print "* parm: " & parm & " momz: " & activeball.angmomz &" vely: "& activeball.vely
activeball.angmomz = -activeball.angmomz * 0.5
activeball.vely = activeball.vely * (1.2 + rnd(1)/3 )
'debug.print "**** >> newmomz: " & activeball.angmomz&" newvely: "& activeball.vely
end if
end sub
'****************************************************************
' FLIPPER CORRECTION INITIALIZATION
'****************************************************************
Const LiveCatch = 16
dim LF : Set LF = New FlipperPolarity
dim RF : Set RF = New FlipperPolarity
InitPolarity
Sub InitPolarity()
dim x, a : a = Array(LF, RF)
for each x in a
x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
x.enabled = True
x.TimeDelay = 60
Next
AddPt "Polarity", 0, 0, 0
AddPt "Polarity", 1, 0.05, -5.5
AddPt "Polarity", 2, 0.4, -5.5
AddPt "Polarity", 3, 0.6, -5.0
AddPt "Polarity", 4, 0.65, -4.5
AddPt "Polarity", 5, 0.7, -4.0
AddPt "Polarity", 6, 0.75, -3.5
AddPt "Polarity", 7, 0.8, -3.0
AddPt "Polarity", 8, 0.85, -2.5
AddPt "Polarity", 9, 0.9,-2.0
AddPt "Polarity", 10, 0.95, -1.5
AddPt "Polarity", 11, 1, -1.0
AddPt "Polarity", 12, 1.05, -0.5
AddPt "Polarity", 13, 1.1, 0
AddPt "Polarity", 14, 1.3, 0
addpt "Velocity", 0, 0, 1
addpt "Velocity", 1, 0.16, 1.06
addpt "Velocity", 2, 0.41, 1.05
addpt "Velocity", 3, 0.53, 1'0.982
addpt "Velocity", 4, 0.702, 0.968
addpt "Velocity", 5, 0.95, 0.968
addpt "Velocity", 6, 1.03, 0.945
LF.Object = LeftFlipper
LF.EndPoint = EndPointLp
RF.Object = RightFlipper
RF.EndPoint = EndPointRp
End Sub
Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
'****************************************************************
' FLIPPER CORRECTION FUNCTIONS
'****************************************************************
Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
dim a : a = Array(LF, RF)
dim x : for each x in a
x.addpoint aStr, idx, aX, aY
Next
End Sub
Class FlipperPolarity
Public DebugOn, Enabled
Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
Private Balls(20), balldata(20)
dim PolarityIn, PolarityOut
dim VelocityIn, VelocityOut
dim YcoefIn, YcoefOut
Public Sub Class_Initialize
redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
End Sub
Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
Public Property Get StartPoint : StartPoint = FlipperStart : End Property
Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
Select Case aChooseArray
case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
End Select
if gametime > 100 then Report aChooseArray
End Sub
Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
if not DebugOn then exit sub
dim a1, a2 : Select Case aChooseArray
case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
case else :tbpl.text = "wrong string" : exit sub
End Select
dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
tbpl.text = str
End Sub
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
Private Sub RemoveBall(aBall)
dim x : for x = 0 to uBound(balls)
if TypeName(balls(x) ) = "IBall" then
if aBall.ID = Balls(x).ID Then
balls(x) = Empty
Balldata(x).Reset
End If
End If
Next
End Sub
Public Sub Fire()
Flipper.RotateToEnd
processballs
End Sub
Public Property Get Pos 'returns % position a ball. For debug stuff.
dim x : for x = 0 to uBound(balls)
if not IsEmpty(balls(x) ) then
pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
End If
Next
End Property
Public Sub ProcessBalls() 'save data of balls in flipper range
FlipAt = GameTime
dim x : for x = 0 to uBound(balls)
if not IsEmpty(balls(x) ) then
balldata(x).Data = balls(x)
End If
Next
PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
PartialFlipCoef = abs(PartialFlipCoef-1)
End Sub
Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
Public Sub PolarityCorrect(aBall)
if FlipperOn() then
dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
'y safety Exit
if aBall.VelY > -8 then 'ball going down
RemoveBall aBall
exit Sub
end if
'Find balldata. BallPos = % on Flipper
for x = 0 to uBound(Balls)
if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
idx = x
BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
end if
Next
If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
End If
'Velocity correction
if not IsEmpty(VelocityIn(0) ) then
Dim VelCoef
: VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
if Enabled then aBall.Velx = aBall.Velx*VelCoef
if Enabled then aBall.Vely = aBall.Vely*VelCoef
End If
'Polarity Correction (optional now)
if not IsEmpty(PolarityIn(0) ) then
If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
'playsound "fx_knocker"
End If
End If
RemoveBall aBall
End Sub
End Class
'****************************************************************
' FLIPPER POLARITY AND RUBBER DAMPENER SUPPORTING FUNCTIONS
'****************************************************************
' Used for flipper correction and rubber dampeners
Sub ShuffleArray(ByRef aArray, byVal offset) 'shuffle 1d array
dim x, aCount : aCount = 0
redim a(uBound(aArray) )
for x = 0 to uBound(aArray) 'Shuffle objects in a temp array
if not IsEmpty(aArray(x) ) Then
if IsObject(aArray(x)) then
Set a(aCount) = aArray(x)
Else
a(aCount) = aArray(x)
End If
aCount = aCount + 1
End If
Next
if offset < 0 then offset = 0
redim aArray(aCount-1+offset) 'Resize original array
for x = 0 to aCount-1 'set objects back into original array
if IsObject(a(x)) then
Set aArray(x) = a(x)
Else
aArray(x) = a(x)
End If
Next
End Sub
' Used for flipper correction and rubber dampeners
Sub ShuffleArrays(aArray1, aArray2, offset)
ShuffleArray aArray1, offset
ShuffleArray aArray2, offset
End Sub
' Used for flipper correction, rubber dampeners, and drop targets
Function BallSpeed(ball) 'Calculates the ball speed
BallSpeed = SQR(ball.VelX^2 + ball.VelY^2 + ball.VelZ^2)
End Function
' Used for flipper correction and rubber dampeners
Function PSlope(Input, X1, Y1, X2, Y2) 'Set up line via two points, no clamping. Input X, output Y
dim x, y, b, m : x = input : m = (Y2 - Y1) / (X2 - X1) : b = Y2 - m*X2
Y = M*x+b
PSlope = Y
End Function