-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathDefender (Williams 1982) 1.0.vbs
1623 lines (1391 loc) · 56.3 KB
/
Defender (Williams 1982) 1.0.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
Option Explicit
Randomize
' Thalamus 2018-07-20
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Thalamus 2018-11-01 : Improved directional sounds
' !! NOTE : Table not verified yet !!
' Options
' Volume devided by - lower gets higher sound
Const VolDiv = 2000 ' Lower number, louder ballrolling/collition sound
Const VolCol = 10 ' Ball collition divider ( voldiv/volcol )
' The rest of the values are multipliers
'
' .5 = lower volume
' 1.5 = higher volume
' Most samples is given specific sound levels.
Const VolBump = 2 ' Bumpers volume.
Const VolTarg = 1 ' Targets volume.
Const VolKick = 1 ' Kicker volume.
Const VolFlip = 1 ' Flipper volume.
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
On Error Goto 0
'**********************Options********************************
dim FlipperReturnLow, FlipperReturnHigh, FlipperReturnOverride, SoundLevelMult, DesktopMode : DesktopMode = Table1.ShowDT
SoundLevelMult = 1 'Increase table SFX (may cause some normalization)
Const HardFlips = 1
Const FastFlips = 1
const FlipperReturnMod = 1 'Extra flipper return curve
FlipperReturnLow = 81 '% adjust flipper return min/max values
FlipperReturnHigh = 110 '%
FlipperReturnOverride = 0 'This can affect the rigidity of the flipper when it's at rest. 0 = Disabled
const SingleScreenFS = 0 '1 = VPX display 2 = Vpinmame display rotated
const VPXdisplay = 1 'Enable/Disable VPX display. Disable for greater performance. (Default: 1)
'*************************************************************
Ramp15.visible = Table1.ShowDT
Ramp16.visible = Table1.ShowDT
LoadVPM "", "S7.VBS", 2.0
Const cGameName="dfndr_l4"
dim VPMversion
Set MotorCallback = GetRef("UpdateSolenoids")
Sub UpdateSolenoids
Dim Changed, Count, funcName, ii, sol11, solNo
Changed = Controller.ChangedSolenoids
If Not IsEmpty(Changed) Then
sol11 = Controller.Solenoid(11)
Count = UBound(Changed, 1)
For ii = 0 To Count
solNo = Changed(ii, CHGNO)
' multiplex solenoid #11 fixed in VPM 1.52beta and newer
if VPMversion < "01519901" then
If SolNo < 11 And sol11 Then solNo = solNo + 32
else
' no need to evaluate sol 11 anymore, VPM does it
if SolNo > 50 then solNo = solNo - 18
end if
funcName = SolCallback(solNo)
If funcName <> "" Then Execute funcName & " CBool(" & Changed(ii, CHGSTATE) &")"
Next
End If
BRG.ObjRotZ = BallReturnGate.CurrentAngle -5
End Sub
dim BallMass : BallMass = 1
Dim gameRun
Const SCoin="fx_coin"
Const UseSolenoids = 0
Const UseLamps = 0
Const UseGi = 0
Const UseSync = 0
Const HandleMech = 0
'***********************************************************************************
'**** Solenoid ****
'***********************************************************************************
Const sDTLeft1 = 1 ' Drop Target 5-bank, Left Lander Drop Targets
Const sDTLeft2 = 2 ' Drop Target 5-bank, Left Lander Drop Targets
Const sDTLeft3 = 3 ' Drop Target 5-bank, Left Lander Drop Targets
Const sDTLeft4 = 4 ' Drop Target 5-bank, Left Lander Drop Targets
Const sDTLeft5 = 5 ' Drop Target 5-bank, Left Lander Drop Targets
Const sDTLeftRel = 6 ' Drop Target 5-bank, Left Lander Drop Targets
Const sDTRight1 = 33 ' Drop Target 5-bank, Right Lander Drop Targets
Const sDTRight2 = 34 ' Drop Target 5-bank, Right Lander Drop Targets
Const sDTRight3 = 35 ' Drop Target 5-bank, Right Lander Drop Targets
Const sDTRight4 = 36 ' Drop Target 5-bank, Right Lander Drop Targets
Const sDTRight5 = 37 ' Drop Target 5-bank, Right Lander Drop Targets
Const sDTRightRel = 38 ' Drop Target 5-bank, Right Lander Drop Targets
Const sDTPodBot = 7 ' First Drop Down Left Upper Lane
Const sDTPodTop = 39 ' Second Drop Down Left Upper Lane
Const sLockupRel = 40 ' Lock Right Lane
Const sDTBaitBot = 9 ' Playfield Drop Target Left
Const sDTBaitTop = 10 ' Drop Down Target Top, located at the start of the Right Lane
Const sDTBaitMid = 41 ' Playfield Drop Target Right
Const sDTBaitRel = 42 ' Playfield Drop Target Reset
Const BallRelease = 8 ' Ball Release
Const Drain = 12 ' Drain
Const sKickBack = 13 ' Left Auto Plunger
Const sGI = 14 ' Generall Illumination
Const sBell = 15 ' Bell Sound
Const sLJet = 17 ' Left Jet Bumper
Const sRJet = 18 ' Right Jet Bumper
Const sGate = 22
Const sEnable = 25
SolCallback(sDTLeft1) = "dtLBank.SolUnHit 1," ' Drop Target 5-bank, Left Lander Drop Targets
SolCallback(sDTLeft2) = "dtLBank.SolUnHit 2," ' Drop Target 5-bank, Left Lander Drop Targets
SolCallback(sDTLeft3) = "dtLBank.SolUnHit 3," ' Drop Target 5-bank, Left Lander Drop Targets
SolCallback(sDTLeft4) = "dtLBank.SolUnHit 4," ' Drop Target 5-bank, Left Lander Drop Targets
SolCallback(sDTLeft5) = "dtLBank.SolUnHit 5," ' Drop Target 5-bank, Left Lander Drop Targets
SolCallback(sDTLeftRel) = "dtLBank.SolDropDown" ' Drop Target 5-bank, Left Lander Drop Targets
SolCallback(sDTRight1) = "dtRBank.SolUnHit 1," ' Drop Target 5-bank, Right Lander Drop Targets
SolCallback(sDTRight2) = "dtRBank.SolUnHit 2," ' Drop Target 5-bank, Right Lander Drop Targets
SolCallback(sDTRight3) = "dtRBank.SolUnHit 3," ' Drop Target 5-bank, Right Lander Drop Targets
SolCallback(sDTRight4) = "dtRBank.SolUnHit 4," ' Drop Target 5-bank, Right Lander Drop Targets
SolCallback(sDTRight5) = "dtRBank.SolUnHit 5," ' Drop Target 5-bank, Right Lander Drop Targets
SolCallback(sDTRightRel) = "dtRBank.SolDropDown" ' Drop Target 5-bank, Right Lander Drop Targets
SolCallback(sDTBaitBot) = "dtBait.SolUnhit 1," ' Playfield Drop Target Left
SolCallback(sDTBaitMid) = "dtBait.SolUnhit 2,"
SolCallback(sDTBaitTop) = "dtBait.SolUnhit 3,"
SolCallback(sDTBaitRel) = "dtBait.SolDropDown" ' Playfield Drop Target Reset
SolCallback(sDTPodBot) = "dtBPod.SolDropUp" ' First Drop Down Left Upper Lane
SolCallback(sDTPodTop) = "dtTPod.SolDropUp" ' Second Drop Down Left Upper Lane
SolCallback(sLockupRel) = "bsLockup.SolOut" ' Lock Right Lane
SolCallback(sKickBack) = "SolKickBack" ' Left Auto Plunger
SolCallback(sGI) = "SolGI"
SolCallback(sBell) = "vpmSolSound ""Bell"","
SolCallback(sLJet) = "vpmSolSound ""RightBumper_Hit"","
SolCallback(sRJet) = "vpmSolSound ""RightBumper_Hit"","
SolCallback(sGate) = "vpmSolDiverter BallReturnGate,True," ' Ball Return Gate to Plunger Lane
SolCallback(sEnable) = "SolRun"
Dim bsTrough, bsLeftBallPopper, bsRightBallPopper, bsRightBallPopper42, bsRightBallPopper43, bsRightBallPopper44, bsRightLock, bsLeftLock, dtdrop, dt3bank
Dim bsLockup, dtLBank, dtRBank, dtBait, dtBaitBot, dtBPod, dtTPod
Sub Table1_Init
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description:Exit Sub
.SplashInfoLine = "Space Station (Williams 1987)"
' .Games(cGameName).Settings.Value("rol") = 0
.HandleKeyboard = 0
.ShowTitle = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.HandleMechanics = 0
' .Hidden = 0
.SetDisplayPosition 0,0,GetPlayerHWnd 'if you can't see the DMD then uncomment this line
On Error Resume Next
.Run GetPlayerHwnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
VPMversion=Controller.version
If SingleScreenFS = 2 and not Table1.ShowDT then
Controller.Games(cGameName).Settings.Value("rol") = 1
Else
Controller.Games(cGameName).Settings.Value("rol") = 0
Controller.Hidden = 1
End If
If VPXdisplay = 0 then
Controller.Hidden = 0
End If
On Error Goto 0
' Nudging
vpmNudge.TiltSwitch = 1
vpmNudge.Sensitivity = 2
vpmNudge.TiltObj = Array(SlingL, SlingR, bumper1, bumper2)
'Drop Target 5-bank, Left Lander Drop Targets
Set dtLBank = New cvpmDropTarget
with dtLBank
.InitDrop Array(sw13,sw14,sw15,sw16,sw17),Array(13,14,15,16,17)
.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
' .CreateEvents"dtLBank"
End With
'Drop Target 5-bank, Right Lander Drop Targets
Set dtRBank = New cvpmDropTarget
with dtRBank
.InitDrop Array(sw23,sw24,sw25,sw26,sw27),Array(23,24,25,26,27)
.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
' .CreateEvents"dtRBank"
End With
'Drop Target Left Upper Lane
Set dtBPod = New cvpmDropTarget
with dtBPod
.InitDrop sw39,39
.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
End With
Set dtTPod = New cvpmDropTarget
with dtTPod
.InitDrop sw40,40
.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
End With
Set bsLockup = New cvpmBallStack
bsLockup.InitSw 0, 42,43,44,0,0,0,0
bsLockup.InitKick sw42,180,1
bsLockup.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
Set dtBait = New cvpmDropTarget
with dtBait
.InitDrop Array(Array(sw33,sw33a),Array(sw34,sw34a),sw35),Array(33,34,35)
.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
End With
' Main Timer init
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
LampTimer.Enabled = 1
' Init Kickback
KickBack.Pullback
'start trough
sw49.CreateSizedBallWithMass 25, BallMass
Sw48.CreateSizedBallWithMass 25, BallMass
sw47.CreateSizedBallWithMass 25, BallMass
BallSearch 'init switches
gameRun = False
End Sub
Sub table1_Paused:Controller.Pause = 1:End Sub
Sub table1_unPaused:Controller.Pause = 0:End Sub
Sub Table1_exit():Controller.Pause = False:Controller.Stop:End Sub
Sub Destroyer_Hit:Me.destroyball : End Sub
'***********************************************************************************
'**** Plunger & Flipper ****
'***********************************************************************************
Sub Table1_KeyDown(ByVal keycode)
If vpmKeyDown(keycode) Then Exit Sub
If keycode = PlungerKey Then PlaySoundAtVol SoundFx("plungerpull",0),Plunger,1:Plunger.Pullback:End If
If keycode = LeftFlipperKey Then flipnf 0, 1: exit sub : End If
If keycode = RightFlipperKey Then flipnf 1, 1 : controller.Switch(59) = 1 : exit sub : End If
if Keycode = KeyRules then
If DesktopMode Then
P_InstructionsDT.PlayAnim 0, 3*CGT/500
Else
P_InstructionsFS.PlayAnim 0, 3*CGT/500
End If
Exit Sub
End If
If keycode = RightMagnaSave Then controller.Switch(60) = 1
If keycode = LeftMagnaSave Then controller.Switch(61) = 1
End Sub
Sub Table1_KeyUp(ByVal keycode)
If vpmKeyUp(keycode) Then Exit Sub
If keycode = PlungerKey Then
Plunger.Fire
if BallInPlunger then
PlaySoundAtVol SoundFX("plunger3",0), Plunger,1
Else
PlaySoundAtVol SoundFX("plunger",0), Plunger,.8
end if
End If
if Keycode = KeyRules then
If DesktopMode Then
P_InstructionsDT.ShowFrame 0
Else
P_InstructionsFs.ShowFrame 0
End If
Exit Sub
End If
If keycode = LeftFlipperKey Then : flipnf 0, 0: exit sub : End If
If keycode = RightFlipperKey Then : flipnf 1, 0: controller.Switch(59) = 0 : exit sub:End If
If keycode = RightMagnaSave Then controller.Switch(60) = 0
If keycode = LeftMagnaSave Then controller.Switch(61) = 0
End Sub
'***********************************************************************************
'**** Trough Handling ****
'***********************************************************************************
SolCallback(BallRelease) = "TroughOut" ' Ball Release
SolCallback(Drain) = "TroughIn" ' Drain
Sub TroughIn(enabled)
if Enabled then
sw46.Kick 58, 16 :
Tgate.Open = True
If sw46.BallCntOver > 0 Then PlaysoundAtVol SoundFX("Trough1",DOFcontactors), sw46, .5: End If
Else
Tgate.Open = False
BallSearch
End If
end Sub
Sub TroughOut(enabled)
if Enabled then
sw47.Kick 58, 8 :PlaysoundAtVol SoundFX("BallRelease",DOFcontactors), sw47, .4
End If
end Sub
'***********************************************************************************
'**** Ball Ramp Trough Switches ****
'***********************************************************************************
Sub Sw46_hit():controller.Switch(46) = 1 : End Sub 'Drain
Sub TroughSFX_Hit(): PlaysoundAtVol "Trough2", TroughSFX, .2: End Sub
Sub Sw49_hit():controller.Switch(49) = 1 : UpdateTrough : End Sub
Sub Sw48_hit():controller.Switch(48) = 1 : UpdateTrough : End Sub
Sub Sw47_hit():controller.Switch(47) = 1 : UpdateTrough : End Sub
Sub Sw46_UnHit():controller.Switch(46) = 0 : UpdateTrough : End Sub
Sub Sw49_UnHit():controller.Switch(49) = 0 : UpdateTrough : End Sub
Sub Sw48_UnHit():controller.Switch(48) = 0 : UpdateTrough : End Sub
Sub Sw47_UnHit():controller.Switch(47) = 0 : UpdateTrough : End Sub
Sub UpdateTrough: TroughTimer.enabled = 1 : TroughTimer.Interval = 200: end sub
Sub TroughTimer_Timer()
If sw47.BallCntOver = 0 then sw48.kick 58, 12
If sw48.BallCntOver = 0 then sw49.kick 58, 12
End Sub
Sub BallSearch() 'In case of hard pinmame reset. Called by PF solenoids firing empty.
if Sw46.BallCntOver > 0 then controller.Switch(46) = 1 else controller.Switch(46) = 0
if Sw49.BallCntOver > 0 then controller.Switch(49) = 1 else controller.Switch(49) = 0
if Sw48.BallCntOver > 0 then controller.Switch(48) = 1 else controller.Switch(48) = 0
if Sw47.BallCntOver > 0 then controller.Switch(47) = 1 else controller.Switch(47) = 0
End Sub
'***********************************************************************************
'**** Rollover Switches ****
'***********************************************************************************
'Primitives from Victory (Gottlieb 1987)
Sub sw9_Hit():PlaySoundAtVol "Sensor", sw9, 1:Controller.Switch(9) = 1:sw9p.Visible = 0:End Sub
Sub sw9_UnHit():Controller.Switch(9) = 0:sw9p.Visible = 1:End Sub
Sub sw10_Hit():PlaySoundAtVol "Sensor", sw10, 1:Controller.Switch(10) = 1:sw10p.Visible = 0:End Sub
Sub sw10_UnHit():Controller.Switch(10) = 0:sw10p.Visible = 1:End Sub
Sub sw11_Hit():PlaySoundAtVol "Sensor", sw11, 1:Controller.Switch(11) = 1:sw11p.Visible = 0:End Sub
Sub sw11_UnHit():Controller.Switch(11) = 0:sw11p.Visible = 1:End Sub
Sub sw12_Hit():PlaySoundAtVol "Sensor", sw12, 1:Controller.Switch(12) = 1:sw12p.Visible = 0:End Sub
Sub sw12_UnHit():Controller.Switch(12) = 0:sw12p.Visible = 1:End Sub
Sub sw45_Hit():PlaySoundAtVol "Sensor", sw45, 1:Controller.Switch(45) = 1:sw45p.Visible = 0:End Sub
Sub sw45_UnHit():Controller.Switch(45) = 0:sw45p.Visible = 1:End Sub
Sub sw51_Hit():PlaySoundAtVol "Sensor", sw51, 1:Controller.Switch(51) = 1:sw51p.Visible = 0:End Sub
Sub sw51_UnHit():Controller.Switch(51) = 0:sw51p.Visible = 1:End Sub
Sub sw52_Hit():PlaySoundAtVol "Sensor", sw52, 1:Controller.Switch(52) = 1:sw52p.Visible = 0:End Sub
Sub sw52_UnHit():Controller.Switch(52) = 0:sw52p.Visible = 1:End Sub
Sub sw53_Hit():PlaySoundAtVol "Sensor", sw53, 1:Controller.Switch(53) = 1:sw53p.Visible = 0:End Sub
Sub sw53_UnHit():Controller.Switch(53) = 0:sw53p.Visible = 1:End Sub
Sub sw54_Hit():PlaySoundAtVol "Sensor", sw54, 1:Controller.Switch(54) = 1:sw54p.Visible = 0:End Sub
Sub sw54_UnHit():Controller.Switch(54) = 0:sw54p.Visible = 1:End Sub
'***********************************************************************************
'**** Stand Up Targets ****
'***********************************************************************************
Sub sw18_hit:vpmTimer.pulseSw 18:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw19_hit:vpmTimer.pulseSw 19:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw20_hit:vpmTimer.pulseSw 20:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw21_hit:vpmTimer.pulseSw 21:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw22_hit:vpmTimer.pulseSw 22:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw28_hit:vpmTimer.pulseSw 28:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw29_hit:vpmTimer.pulseSw 29:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw30_hit:vpmTimer.pulseSw 30:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw31_hit:vpmTimer.pulseSw 31:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw32_hit:vpmTimer.pulseSw 32:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw36_hit:vpmTimer.pulseSw 36:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw37_hit:vpmTimer.pulseSw 37:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
Sub sw41_hit:vpmTimer.pulseSw 41:PlaySoundAtVol "target", ActiveBall, VolTarg:End Sub
'***********************************************************************************
'**** Drop Targets ****
'***********************************************************************************
'Left Lander Targets
Sub Sw13_Dropped:dtLBank.Hit 1 : End Sub
Sub Sw14_Dropped:dtLBank.Hit 2 : End Sub
Sub Sw15_Dropped:dtLBank.Hit 3 : End Sub
Sub Sw16_Dropped:dtLBank.Hit 4 : End Sub
Sub Sw17_Dropped:dtLBank.Hit 5 : End Sub
'Right Lander Targets
Sub sw23_Dropped:dtRBank.Hit 1 : End Sub
Sub Sw24_Dropped:dtRBank.Hit 2 : End Sub
Sub Sw25_Dropped:dtRBank.Hit 3 : End Sub
Sub Sw26_Dropped:dtRBank.Hit 4 : End Sub
Sub Sw27_Dropped:dtRBank.Hit 5 : End Sub
'Baiter Targets
Sub sw33_Dropped : dtBait.Hit 1 : End Sub
Sub sw34_Dropped : dtBait.Hit 2 : End Sub
Sub sw35_Dropped : dtBait.Hit 3 : End Sub
'Pod Targets
Sub sw39_Dropped:dtBPod.Hit 1 : End Sub
Sub sw40_Dropped:dtTPod.Hit 1 : End Sub
Sub Sw33a_Hit() : PlaysoundAtVol "soloff", ActiveBall, .2: End Sub 'dont drop target but play sound
Sub Sw34a_Hit() : PlaysoundAtVol "soloff", ActiveBall, .2: End Sub 'dont drop target but play sound
'***********************************************************************************
'**** Switches ****
'***********************************************************************************
Sub sw38_hit:vpmTimer.pulseSw 38 : PlaySoundAtVol "soloff", Primitive20, .1:End Sub
'***********************************************************************************
'**** Bumper ****
'***********************************************************************************
Const swJet1 = 55 ' Left Jet Bumper
Const swJet2 = 56 ' Right Jet Bumper
Sub Bumper1_Hit():vpmTimer.PulseSwitch (swJet1), 0, "" : PlaySoundAtVol SoundFX("LeftBumper_Hit",DOFContactors), Bumper1, VolBump : End Sub
Sub Bumper2_Hit():vpmTimer.PulseSwitch (swJet2), 0, "" : PlaySoundAtVol SoundFX("RightBumper_Hit",DOFContactors), Bumper2, VolBump : End Sub
'***********************************************************************************
'**** Drain hole & Kicker ****
'***********************************************************************************
Sub sw42_Hit:bsLockup.AddBall me : playsoundAtVol "popper_ball", sw42, VolKick: End Sub
'***********************************************************************************
'**** Knocker ****
'***********************************************************************************
Sub KnockerSol(enabled)
If enabled Then PlaySound SoundFX("Knocker",DOFKnocker)
End Sub
'***********************************************************************************
'**** KickBack ****
'***********************************************************************************
Sub SolKickBack(enabled)
If enabled Then
Kickback.Fire
PlaySoundAtVol SoundFX("DiverterLeft",DOFContactors), Kickback, VolKick
Else
KickBack.PullBack
End If
End Sub
'***********************************************************************************
'**** Shooter Lane ****
'***********************************************************************************
Sub sw50_Hit():PlaySoundAtVol "Sensor", sw50, 1:Controller.Switch(50) = 1:sw50p.Visible = 0:End Sub
Sub sw50_UnHit():Controller.Switch(50) = 0:sw50p.Visible = 1:End Sub
dim BallInPlunger :BallInPlunger = False
sub PlungerLane_hit():ballinplunger = True: End Sub
Sub PlungerLane_unhit():BallInPlunger = False: End Sub
'===================
' NF Flipper Return Mod 2017
'===================
dim returnspeed, lfstep, rfstep, LFstep1
returnspeed = cInt(leftflipper.return*100)
LFstep = 1
LFstep1 = 1
RFstep = 1
sub LeftFlipper_timer()
select case LFstep
Case 1: LeftFlipper.return = ReturnCurve(LFstep) :LFstep = LFstep + 1
Case 2: LeftFlipper.return = ReturnCurve(LFstep) :LFstep = LFstep + 1
Case 3: LeftFlipper.return = ReturnCurve(LFstep) :LFstep = LFstep + 1
Case 4: LeftFlipper.return = ReturnCurve(LFstep) :LFstep = LFstep + 1
Case 5: LeftFlipper.return = ReturnCurve(LFstep) :LFstep = LFstep + 1
Case 6: LeftFlipper.return = ReturnCurve(LFstep) :LFstep = LFstep + 1
Case 7: LeftFlipper.timerenabled = 0 : LFstep = 1
end select
' tb2.text = LeftFlipper.Return
end sub
sub LeftFlipper1_timer()
select case LFstep1
Case 1: LeftFlipper1.return = ReturnCurve(LFstep1) :LFstep1 = LFstep1 + 1
Case 2: LeftFlipper1.return = ReturnCurve(LFstep1) :LFstep1 = LFstep1 + 1
Case 3: LeftFlipper1.return = ReturnCurve(LFstep1) :LFstep1 = LFstep1 + 1
Case 4: LeftFlipper1.return = ReturnCurve(LFstep1) :LFstep1 = LFstep1 + 1
Case 5: LeftFlipper1.return = ReturnCurve(LFstep1) :LFstep1 = LFstep1 + 1
Case 6: LeftFlipper1.return = ReturnCurve(LFstep1) :LFstep1 = LFstep1 + 1
Case 7: LeftFlipper1.timerenabled = 0 : LFstep1 = 1
end select
' tb2.text = LeftFlipper.Return
end sub
sub RightFlipper_timer()
select case RFstep
Case 1: RightFlipper.return = ReturnCurve(RFstep) :RFstep = RFstep + 1
Case 2: RightFlipper.return = ReturnCurve(RFstep) :RFstep = RFstep + 1
Case 3: RightFlipper.return = ReturnCurve(RFstep) :RFstep = RFstep + 1
Case 4: RightFlipper.return = ReturnCurve(RFstep) :RFstep = RFstep + 1
Case 5: RightFlipper.return = ReturnCurve(RFstep) :RFstep = RFstep + 1
Case 6: RightFlipper.return = ReturnCurve(RFstep) :RFstep = RFstep + 1
Case 7: RightFlipper.timerenabled = 0 : RFstep = 1
end select
end sub
FlipperReturnLow = cInt(FlipperReturnLow) '% adjust flipper return min/max values
Function ReturnCurve(step) 'Adjust flipper curve
dim x, s
s = FlipperReturnHigh - FlipperReturnLow
Select Case step
case 0 'initial curve
x = FlipperReturnLow
case 1 '16ms
x = FlipperReturnLow + ((s/6) * 1)
case 2 '32ms
x = FlipperReturnLow + ((s/6) * 2)
case 3 'etc
x = FlipperReturnLow + ((s/6) * 3)
case 4
x = FlipperReturnLow + ((s/6) * 4)
case 5
x = FlipperReturnLow + ((s/6) * 5)
case 6
if FlipperReturnOverride > 0 then
ReturnCurve = FlipperReturnOverride
Exit Function
else
x = FlipperReturnHigh
End If
End Select
ReturnCurve = (returnspeed * x) / 10000
' tb.text = x & vbnewline & ReturnCurve
End Function
'====================
' HARD
' FLIPS
'====================
'just switches EOStorque when hit
dim defaultEOS, hardEOS
defaulteos = leftflipper.eostorque
hardeos = 2200 / leftflipper.strength 'eos equivalent to 2200 strength
hardeos = 2200 / leftflipper1.strength 'eos equivalent to 2200 strength
if hardflips = 0 then TriggerLF.enabled = 0 :TriggerLF1.enabled = 0 : TriggerRF.enabled = 0 end if
Sub TriggerLF_Hit()
dim finalspeed
finalspeed = SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 0 then
leftflipper.eostorque = hardeos
End if
end sub
Sub TriggerLF1_Hit()
dim finalspeed
finalspeed = SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 0 then
LeftFlipper1.eostorque = hardeos
End if
end sub
Sub TriggerRF_Hit()
dim finalspeed
finalspeed = SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 0 then
rightflipper.eostorque = hardeos
End if
end sub
'***********************************************************************************
'**** nFozzy's FastFlips NF 'Pre-solid state flippers lag reduction ****
'***********************************************************************************
dim FlippersEnabled
Sub SolRun(enabled)
FlippersEnabled = Enabled
if enabled then
gameRun = True
' PFGI.State = 1
SLingL.Disabled = 0
SLingR.Disabled = 0
Elseif not Enabled Then
gameRun = false
' PFGI.State = 0
if leftflipper.startangle > leftflipper.endangle Then
if leftflipper.currentangle < leftflipper.startangle then leftflipper.rotatetostart : leftflippersound 0 : end if
elseif leftflipper.startangle < leftflipper.endangle Then
if leftflipper.currentangle > leftflipper.startangle then leftflipper.rotatetostart : leftflippersound 0 : end If
end If
if leftflipper1.startangle > leftflipper1.endangle Then
if leftflipper1.currentangle < leftflipper1.startangle then leftflipper1.rotatetostart : end if
elseif leftflipper1.startangle < leftflipper1.endangle Then
if leftflipper1.currentangle > leftflipper1.startangle then leftflipper1.rotatetostart : end If
end If
if rightflipper.startangle > rightflipper.endangle Then
if rightflipper.currentangle < rightflipper.startangle then rightflipper.rotatetostart : rightflippersound 0 : end if
elseif rightflipper.startangle < rightflipper.endangle Then
if rightflipper.currentangle > rightflipper.startangle then rightflipper.rotatetostart : rightflippersound 0 : end If
end If
SLingL.Disabled = 1
SLingR.Disabled = 1
end if
vpmNudge.SolGameOn enabled
End Sub
sub flipnf(LR, DU) 'object, left-right, downup
if FastFlips = 0 then
if LR = 0 then
controller.switch(LLFlip) = DU
elseif LR = 1 then
controller.switch(LRFlip) = DU
End If
exit Sub
end if
if LR = 0 Then 'left flipper
if DU = 1 then
If FlippersEnabled = True then
leftflipper.rotatetoend
leftflipper1.rotatetoend
LeftFlipperSound 1
end if
controller.Switch(swLLFlip) = True
Elseif DU = 0 then
If FlippersEnabled = True then
leftflipper.rotatetoStart
leftflipper1.rotatetoStart
LeftFlipperSound 0
end if
controller.Switch(swLLFlip) = False
end if
elseif LR = 1 then ''right flipper
if DU = 1 then
If FlippersEnabled = True then
RightFlipper.rotatetoend
RightFlipperSound 1
end if
controller.Switch(swLRFlip) = True
Elseif DU = 0 then
If FlippersEnabled = True then
RightFlipper.rotatetoStart
RightFlipperSound 0
end if
controller.Switch(swLRFlip) = False
end if
end if
end sub
sub LeftFlipperSound(updown)'called along with the flipper, so feel free to add stuff, EOStorque tweaks, animation updates, upper flippers, whatever.
if updown = 1 Then
playsoundAtVol SoundFX("FlipperUp",DOFFlippers), LeftFlipper, VolFlip 'flip
playsoundAtVol "FlipperUp", LeftFlipper1, VolFlip 'flip
Else
playsoundAtVol SoundFX("FlipperDown",DOFFlippers), LeftFlipper, VolFlip 'return
playsoundAtVol "FlipperDown", LeftFlipper1, VolFlip 'return
LeftFlipper.eostorque = defaultEOS
LeftFlipper1.eostorque = defaultEOS
if FlipperReturnMod = 1 then
LeftFlipper.TimerEnabled = 1
LeftFlipper1.TimerEnabled = 1
LeftFlipper.TimerInterval = 16 '400 test
LeftFlipper1.TimerInterval = 16 '400 test
LeftFlipper.return = FlipperReturnLow / 10000
LeftFlipper1.return = FlipperReturnLow / 10000
LFstep = 1
LFstep1 = 1
end if
end if
end sub
sub RightFlipperSound(updown)
if updown = 1 Then
playsoundAtVol SoundFX("FlipperUp",DOFFlippers), RightFlipper, VolFlip 'flip
Else
playsoundAtVol SoundFX("FlipperDown",DOFFlippers), RightFlipper, VolFlip 'return
RightFlipper.eostorque = defaultEOS
if FlipperReturnMod = 1 then
rightflipper.TimerEnabled = 1
rightflipper.TimerInterval = 16
rightflipper.return = FlipperReturnLow / 10000
RFstep = 1
end if
end if
end sub
'***********************************************************************************
'**** Special JP Flippers 'Legacy Flippers using callbacks ****
'***********************************************************************************
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Sub SolLFlipper(Enabled)
if FastFlips = 0 then
If Enabled Then
playsoundAtVol SoundFX("FlipperUp",DOFFlippers), LeftFlipper, VolFlip 'flip
LeftFlipper.RotateToEnd
LeftFlipper1.RotateToEnd
Else
playsoundAtVol SoundFX("FlipperDown",DOFFlippers), LeftFlipper, VolFlip 'return
playsoundAtVol "FlipperDown", LeftFlipper1, VolFlip 'return
LeftFlipper.RotateToStart
LeftFlipper1.RotateToStart
LeftFlipper.eostorque = defaulteos
LeftFlipper1.eostorque = defaulteos
if FlipperReturnMod = 1 then
LeftFlipper.TimerEnabled = 1
LeftFlipper1.TimerEnabled = 1
LeftFlipper.TimerInterval = 16
LeftFlipper1.TimerInterval = 16
LeftFlipper.return = FlipperReturnLow / 10000
LeftFlipper1.return = FlipperReturnLow / 10000
LFstep = 1
LFstep1 = 1
end if
End If
End If
End Sub
Sub SolRFlipper(Enabled)
if FastFlips = 0 then
If Enabled Then
playsoundAtVol SoundFX("FlipperUp",DOFFlippers), RightFlipper, VolFlip 'flip
RightFlipper.RotateToEnd
Else
playsoundAtVol SoundFX("FlipperDown",DOFFlippers), RightFlipper, VolFlip 'return
RightFlipper.RotateToStart
RightFlipper.eostorque = defaulteos
if FlipperReturnMod = 1 then
rightflipper.TimerEnabled = 1
rightflipper.TimerInterval = 16
rightflipper.return = FlipperReturnLow / 10000
RFstep = 1
end if
End If
End If
End Sub
'***********************************************************************************
'**** Slingshot ****
'***********************************************************************************
Dim SLPos,SRPos
Sub SlingL_Slingshot()
' If FlipperEnabled = False Then Exit Sub
LSling1.Visible = 0:LSling2.Visible = 0:LSling3.Visible = 0: LSling4.Visible = 1: LSling.TransZ = -27
vpmTimer.PulseSw 57
PlaySound SoundFX ("left_slingshot",DOFContactors),1:DOF dLeftSlingshot, 2
SLPos = 0: Me.TimerEnabled = 1
' LightshowChangeSide
End Sub
Sub SlingL_Timer
Select Case SLPos
Case 2: LSling1.Visible = 0:LSling2.Visible = 0:LSling3.Visible = 1: LSling4.Visible = 0: LSling.TransZ = -17
Case 3: LSling1.Visible = 0:LSling2.Visible = 1:LSling3.Visible = 0: LSling4.Visible = 0: LSling.TransZ = -8
Case 4: LSling1.Visible = 1:LSling2.Visible = 0:LSling3.Visible = 0: LSling4.Visible = 0: LSling.TransZ = 0 :Me.TimerEnabled = 0
End Select
SLPos = SLPos + 1
End Sub
Sub SlingR_Slingshot()
' If FlipperEnabled = False Then Exit Sub
RSling1.Visible = 0:RSling2.Visible = 0:RSling3.Visible = 0: RSling4.Visible = 1: RSling.TransZ = -27
vpmTimer.PulseSw 58
PlaySound SoundFX ("right_slingshot",DOFContactors):DOF dRightSlingshot, 2
SRPos = 0: Me.TimerEnabled = 1
' LightshowChangeSide
End Sub
Sub SlingR_Timer
Select Case SRPos
Case 2: RSling1.Visible = 0:RSling2.Visible = 0:RSling3.Visible = 1: RSling4.Visible = 0: RSling.TransZ = -17
Case 3: RSling1.Visible = 0:RSling2.Visible = 1:RSling3.Visible = 0: RSling4.Visible = 0: RSling.TransZ = -8
Case 4: RSling1.Visible = 1:RSling2.Visible = 0:RSling3.Visible = 0: RSling4.Visible = 0: RSling.TransZ = 0 :Me.TimerEnabled = 0
End Select
SRPos = SRPos + 1
End Sub
Sub Slingshots_Init
LSling1.Visible = 1:LSling2.Visible = 0:LSling3.Visible = 0: LSling4.Visible = 0: LSling.TransZ = 0
RSling1.Visible = 1:RSling2.Visible = 0:RSling3.Visible = 0: RSling4.Visible = 0: RSling.TransZ = 0
End Sub
'***************************************************
' JP's VP10 Fading Lamps & Flashers
' Based on PD's Fading Light System
' SetLamp 0 is Off
' SetLamp 1 is On
' fading for non opacity objects is 4 steps
'***************************************************
'Dim bulb
Dim LampState(200), FadingLevel(200)
Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
InitLamps() ' turn off the lights and flashers and reset them to the default parameters
LampTimer.Interval = 10 'lamp fading speed
LampTimer.Enabled = 1
' Lamp & Flasher Timers
Sub LampTimer_Timer()
Dim chgLamp, num, chg, ii
chgLamp = Controller.ChangedLamps
If Not IsEmpty(chgLamp) Then
For ii = 0 To UBound(chgLamp)
LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
Next
End If
UpdateLamps
End Sub
Sub InitLamps()
Dim x
For x = 0 to 200
LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
FadingLevel(x) = 4 ' used to track the fading state
FlashSpeedUp(x) = 0.5 ' faster speed when turning on the flasher
FlashSpeedDown(x) = 0.1 ' slower speed when turning off the flasher
FlashMax(x) = 1 ' the maximum value when on, usually 1
FlashMin(x) = 0 ' the minimum value when off, usually 0
FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
Next
End Sub
Sub UpdateLamps
' On Error Resume Next
nFadeLm 9, Light9
nFadeLm 9, Light9a
nFadeLm 10, Light10
nFadeLm 10, Light10a
nFadeLm 11, Light11
nFadeLm 11, Light11a
nFadeLm 12, Light12
nFadeLm 12, Light12a
nFadeLm 13, Light13
nFadeLm 13, Light13a
nFadeLm 14, Light14
nFadeLm 14, Light14a
nFadeLm 15, Light15
nFadeLm 15, Light15a
nFadeLm 16, Light16
nFadeLm 16, Light16a
nFadeLm 17, Light17
nFadeLm 17, Light17a
nFadeLm 18, Light18
nFadeLm 18, Light18a
nFadeLm 19, Light19
nFadeLm 19, Light19a
nFadeLm 20, Light20
nFadeLm 20, Light20a
nFadeLm 21, Light21
nFadeLm 21, Light21a
nFadeLm 22, Light22
nFadeLm 22, Light22a
nFadeLm 23, Light23
nFadeLm 23, Light23a
nFadeLm 24, Light24
nFadeLm 24, Light24a
nFadeLm 25, Light25
nFadeLm 25, Light25a
nFadeLm 26, Light26
nFadeLm 26, Light26a
nFadeLm 27, Light27
nFadeLm 27, Light27a
nFadeLm 28, Light28
nFadeLm 28, Light28a
nFadeLm 29, Light29
nFadeLm 29, Light29a
nFadeLm 30, Light30
nFadeLm 30, Light30a
nFadeLm 31, Light31
nFadeLm 31, Light31a
nFadeLm 32, Light32
nFadeLm 32, Light32a
nFadeLm 33, Light33
nFadeLm 33, Light33a
nFadeLm 34, Light34
nFadeLm 34, Light34a
nFadeLm 35, Light35
nFadeLm 35, Light35a
NFadeLm 36, Light36
NFadeLm 36, Light36a
NFadeLm 37, Light37
NFadeLm 37, Light37a
NFadeLm 38, Light38
NFadeLm 38, Light38a
NFadeLm 39, Light39
NFadeLm 39, Light39a
FlashC 39, Flash39b
NFadeLm 40, Light40
NFadeLm 40, Light40a
FlashC 40, Flash40b
NFadeLm 41, Light41
NFadeLm 41, Light41a
FlashC 41, Flash41b
NFadeLm 42, Light42
NFadeLm 42, Light42a
FlashC 42, Flash42b
nFadeLm 43, Light43
nFadeLm 43, Light43a
nFadeLm 44, Light44
nFadeLm 44, Light44a
nFadeLm 45, Light45
nFadeLm 45, Light45a
NFadeLm 46, Light46
NFadeLm 46, Light46a
NFadeLm 47, Light47
NFadeLm 47, Light47a
NFadeLm 48, Light48
NFadeLm 48, Light48a
NFadeLm 49, Light49
NFadeLm 49, Light49a
NFadeLm 50, Light50
NFadeLm 50, Light50a
NFadeLm 51, Light51
NFadeLm 51, Light51a
NFadeLm 52, Light52
NFadeLm 52, Light52a
NFadeLm 53, Light53
NFadeLm 53, Light53a
NFadeLm 54, Light54
NFadeLm 54, Light54a
nFadeLm 55, Light55
nFadeLm 55, Light55a
nFadeLm 56, Light56
nFadeLm 56, Light56a
nFadeLm 57, Light57
nFadeLm 57, Light57a
nFadeLm 58, Light58
nFadeLm 58, Light58a
nFadeLm 59, Light59
nFadeLm 59, Light59a
nFadeLm 60, Light60
nFadeLm 60, Light60a
nFadeLm 61, Light61
nFadeLm 61, Light61a
nFadeLm 62, Light62
nFadeLm 62, Light62a
Flashc 49, Flash49
Flashc 50, Flash50
Flashc 51, Flash51
Flashc 52, Flash52
Flashc 53, Flash53
Flashc 54, Flash54
Flashc 60, Flash60
Flashc 61, Flash61
Flashc 61, Flash61a
End Sub