-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathAirborne (Capcom 1996) v1.0.vbs
1798 lines (1598 loc) · 52.2 KB
/
Airborne (Capcom 1996) v1.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
'************************************************************************************************
'***************************** Airborne by Capcom (1996) *********************************
'************************************************************************************************
' Based on the VP8 table by TAB and Destruk, and the VP9 table by Bodydump
' VPX conversion by robbo43 and DCrosby
' Thanks go to:
' the original table authors
' DCrosby for the ramps, graphical updates and general support
' those people who have contributed scripting techniques (JPSalas, ninuzzu, uncle willy)
' those people that contribute high quality resources (Dark, nFozzy, Zany, Flupper)
' My final thanks go the authors of VPX and VPinMame for making this all possible.
'
' This has been quite a start/stop build and taken longer than it should, so apologies If
' I have forgotten to credit anyone else. Please drop me a line if I've missed you off the
' credits and I'll add you.
'************************************************************************************************
'**************************************************************************************************
'*********************************** Table Notes / Calls for Help *********************************
' I'm not sure how far capcom emulation has come since the VP9 table was release, so I'll put
' out a call for help
'
' 1. I've tried many different methods to make the left drop ramp behave properly using rom
' commands however the best behaviours are those workarounds developed by Destruk / Bodydump
' I'm not sure whether these are 100% accurate, so please contribute any improvements
'
' 2. I'm not sure whether locked balls should be kicked out if you select eject co-pilot. The
' table currently does not do this and I do not know if this is correct behavour. I tried to
' script this but couldn't get it to work properly.
'
' 3. The table may still have many legacy commands / functions, please feel free to update and
' contribute - I've reached the limit of my knowledge/skill!!
'
'**************************************************************************************************
Option Explicit
Randomize
' Thalamus - added vpminit me to _init
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
Dim DesktopMode:DesktopMode = Table1.ShowDT
Dim UseVPMDMD:UseVPMDMD = DesktopMode
Const UseVPMModSol = 0
LoadVPM "01560000", "capcom.VBS", 3.26
' Thalamus - ffv2 should not be used for this table according to nFozzy
Const UseSolenoids=1,UseLamps=0,UseSync=1,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="",SFlipperOff="",SCoin="Coin3"
Set LampCallback=GetRef("UpdateMultipleLamps")
SolCallback(1)="bsTrough.SolIn"
SolCallback(2)="bsTrough.SolOut"
SolCallback(3)="vpmSolSound ""Knocker"","
SolCallback(4)="" 'sling
SolCallback(5)="" 'sling
SolCallback(6)="bsBottomSaucer.SolOut"
SolCallback(7)="SolLockDoor"
SolCallback(8)="bsLeftSaucer.SolOut"
SolCallback(11)="dtSHOW"
SolCallback(12)="BallSaveGate"
SolCallback(13)="" 'Bumper
SolCallback(14)="" 'Bumper
SolCallback(15)="" 'Bumper
SolCallback(16)="dtAIR"
SolCallback(17)="SolLDiverter"
SolCallback(19)="EnableRamp"
SolCallback(29)="SolBackKicker"
SolCallback(30)="bsVLock.SolExit"
SolCallback(31)="SolRDiverter"
SolCallback(32)="bsRightSaucer.SolOut"
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
SolCallback(51)="GameOn"
Dim bump1, bump2, bump3
Dim rampstate
'DropTarget Solenoids
Sub dtAIR(Enabled)
If Enabled Then
DropADir = 1:DropIDir = 1:DropRDir = 1
DropAa.TimerEnabled = 1:DropIa.TimerEnabled = 1:DropRa.TimerEnabled = 1
dtR.DropSol_On
End if
End Sub
Sub dtSHOW(Enabled)
If Enabled Then
DropSDir = 1:DropHDir = 1:DropODir = 1:DropWDir = 1
DropSa.TimerEnabled = 1:DropHa.TimerEnabled = 1:DropOa.TimerEnabled = 1:DropWa.TimerEnabled = 1
dtL.DropSol_On
End if
End Sub
'*********** Flipper Primitives ('0=yellow/black, 1=yellow/red)
Const FlippersType = 0
Select Case FlippersType
Case 0
CapcomLFlip.visible=1:CapcomRFlip.visible=1
CapcomLFlip.image="star_flip_left":CapcomRFlip.image="star_flip_right"
Case 1
CapcomLFlip.visible=1:CapcomRFlip.visible=1
CapcomLFlip.image="star_flip_leftRED":CapcomRFlip.image="star_flip_rightRED"
End Select
Sub FlipperTimer_Timer()
CapcomLFlip.RotY = LeftFlipper.CurrentAngle
CapcomRFlip.RotY = RightFlipper.CurrentAngle
FlipperLSh.RotZ = LeftFlipper.CurrentAngle
FlipperRSh.RotZ = RightFlipper.CurrentAngle
End Sub
'******Capcom Emulation Fixes (scripting by Destruk)
'Right Diverter requires HOLD timer
Sub SolRDiverter(Enabled)
If Enabled Then
RightDiverter.IsDropped=1
RightDiverter2.IsDropped=0
'RightDiverter.TimerEnabled=0
'RightDiverter.TimerEnabled=1
End If
End Sub
Sub RightDiverter_Timer
RightDiverter.TimerEnabled=0
If RightDiverter.IsDropped Then
RightDiverter2.IsDropped=1
RightDiverter.IsDropped=0
End If
End Sub
Sub Trigger23_Hit
If ActiveBall.VelY<0 Then
If RightDiverter.IsDropped Then
RightDiverter.TimerEnabled=0
RightDiverter2.IsDropped=1
RightDiverter.IsDropped=0
End If
End If
End Sub
Sub Trigger24_Hit
If ActiveBall.VelX<0 Then
If RightDiverter.IsDropped Then
RightDiverter.TimerEnabled=0
RightDiverter2.IsDropped=1
RightDiverter.IsDropped=0
End If
End If
End Sub
Sub Trigger1_Hit
Controller.Switch(69)=1
PlaySoundAtVol "Sensor", ActiveBall, 1
If ActiveBall.VelY>0 Then
If RightDiverter.IsDropped Then
RightDiverter.TimerEnabled=0
RightDiverter2.IsDropped=1
RightDiverter.IsDropped=0
End If
End If
End Sub
Sub Trigger1_unHit:Controller.Switch(69)=0:End Sub
Sub Trigger2_Hit
Controller.Switch(70)=1
PlaySoundAtVol "Sensor", ActiveBall, 1
If ActiveBall.VelY>0 Then
If RightDiverter.IsDropped Then
RightDiverter.TimerEnabled=0
RightDiverter2.IsDropped=1
RightDiverter.IsDropped=0
End If
End If
End Sub
Sub Trigger2_unHit:Controller.Switch(70)=0:End Sub
Sub Trigger3_Hit
Controller.Switch(71)=1
PlaySoundAtVol "Sensor", ActiveBall, 1
If ActiveBall.VelY>0 Then
If RightDiverter.IsDropped Then
RightDiverter.TimerEnabled=0
RightDiverter2.IsDropped=1
RightDiverter.IsDropped=0
End If
End If
End Sub
Sub Trigger3_unHit:Controller.Switch(71)=0:End Sub
'Left Diverter requires HOLD timer
Sub SolLDiverter(Enabled)
If Enabled Then
LeftDiverter.RotateToEnd
LeftDiverter.TimerEnabled=0
LeftDiverter.TimerEnabled=1
End If
End Sub
Sub LeftDiverter_Timer
LeftDiverter.TimerEnabled=0
LeftDiverter.RotateToStart
End Sub
Sub Trigger11_Hit:Controller.Switch(64)=1:End Sub
Sub Trigger11_unHit:Controller.Switch(64)=0:End Sub
'Back Kicker requires HOLD timer
Sub SolBackKicker(Enabled)
ModifyBall.Enabled=1
BKTTimer.Enabled=1
End Sub
Sub BKTTimer_Timer
BKTTimer.Enabled=0
InTheZone=0
ModifyBall.Enabled=0
End Sub
'Ball Save Gate - Gate is open based on Ball Save light
Sub BallSaveGate(Enabled)
If Enabled Then
Flipper1.RotateToEnd
SaveTimer.Enabled=0
SaveTimer.Enabled=1 'in case machine activates solenoid during ball search, enable the close timer
End If
End Sub
Sub Trigger22_Hit:Flipper1.RotateToStart:SaveTimer.Enabled=0:End Sub
Sub SaveTimer_Timer:Flipper1.RotateToStart:SaveTimer.Enabled=0:End Sub
'Lower Ball Lock/Kickback on 1st ball code
Sub SolLockDoor(Enabled)
If Enabled Then LockDoor.IsDropped=1
End Sub
Sub LeftOutlane_Hit
If ActiveBall.VelY<0 Then LockDoor.IsDropped=0
Controller.Switch(36)=1
PlaySoundAtVol "Sensor", ActiveBall, 1
End Sub
Sub LeftOutlane_unHit:Controller.Switch(36)=0:End Sub
'Left Drop Ramp Stuff (Modified Destruk script)
Dim undertheramp
undertheramp=0
rampstate=0
Sub EnableRamp(Enabled)
If Enabled AND rampstate=0 Then
RRampDir = 1
UpdateRamp.Enabled = True
rampstate=1
End If
End Sub
Dim RRampDir, RRAmpCurrPos, RRamp, rampdown
RRampCurrPos = 0 ' down
RRampDir = -1 '1 is up -1 is down dir
Sub UpdateRamp_Timer
RRampCurrPos = RRampCurrPos + RRampDir
If RRampCurrPos> 52 Then
RRampCurrPos = 52
PlaySoundAtVol "DTLReset", dropramp1, 1
UpdateRamp.Enabled = 0
dropramp1.Collidable= 0
End If
If RRampCurrPos <0 Then
RRampCurrPos = 0
PlaySoundAtVol "left_flipper_down", dropramp1, 1
dropramp1.Collidable= 1
UpdateRamp.Enabled = 0
End If
dropramp1.HeightBottom = RRampCurrPos
End Sub
Dim SA,OSA,RD,ORD
OSA=0:ORD=False
Sub UpdateMultipleLamps
RD=Controller.Lamp(48)
If RD<>ORD Then
ORD=RD
If RD Then
If undertheramp=0 AND rampstate=1 then
RRampDir = -1
RampTimer.Enabled = True
End If
End If
End If
SA=Controller.Lamp(72)
If SA<>OSA Then
SaveTimer.Enabled=0
SaveTimer.Enabled=1
OSA=SA
End If
End Sub
Sub UnderRamp_Hit
If ActiveBall.Vely>0 Then
'PlaySound "popper"
RRampDir = 1
UpdateRamp.Enabled = True
undertheramp = 1
rampstate = 1
End If
If ActiveBall.Vely<0 Then
undertheramp = 0
End If
End Sub
Sub underrampexit_Hit
If ActiveBall.Vely>10 Then
If rampstate=1 Then
RampTimer.Enabled = 1
End If
End If
If ActiveBall.Vely<10 Then
undertheramp = 1
End If
End Sub
Sub RampTimer_Timer '****NOTE: Kicker2_Hit also calls the RampTimer to drop the ramp if the top right lock is hit ***
undertheramp = 0
RRampDir = -1
UpdateRamp.Enabled = True
rampstate=0
RampTimer.Enabled = 0
End Sub
'Flipper Fix (Script by Uncle Willy)
dim GameOnFF
GameOnFF = 0
Sub GameOn(Enabled)
If Enabled Then
GameOnFF = 1
Else
GameOnFF = 0
RampTimer.Enabled = 1
End If
End Sub
'FLASHERS
SolCallback(20)= "SetLamp 170," 'Left Ramp Flasher (Playfield) And Backbox Flasher 1
SolCallback(26)= "SetLamp 176," 'Right Rear Flasher (Playfield) And Backbox 8
SolCallback(27)= "SetLamp 178," 'Left Back Flasher Playfield ONLY
Sub Sol22(Enabled)
End Sub
Sub Sol24(Enabled)
End Sub
Dim bsTrough,bsLeftSaucer,bsRightSaucer,dtL,dtR,bsVLock,bsBottomSaucer,PlungerIM, x
Sub Table1_Init
vpmInit Me
On Error Resume Next
With Controller
.GameName="abv106"
.SplashInfoLine="Airborne, CAPCOM" & vbnewline & "Table by robbbo43 and DCrosby"
.HandleMechanics=0
.HandleKeyboard=0
.ShowDMDOnly=1
.ShowFrame=0
.ShowTitle=0
.Run
End With
On Error Goto 0
vpmNudge.TiltSwitch=10
vpmNudge.Sensitivity=5
vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
PinMAMETimer.Interval=PinMAMEInterval:PinMAMETimer.Enabled=1
vpmCreateEvents AllSwitches
Set bsTrough=New cvpmBallStack
bsTrough.InitSw 28,29,30,31,0,0,0,0
bsTrough.InitKick BallRelease,105,6
bsTrough.Balls=3
bsTrough.InitExitSnd "ballrelease","ballrelease"
Set dtL = New cvpmDropTarget
With dtL
.InitDrop Array(array(DropS,DropSa),array(DropH,DropHa),array(DropO,DropOa),array(DropW,DropWa)), Array(61,60,59,58)
.Initsnd "DTL", "DTResetL"
End With
Set dtR = New cvpmDropTarget
With dtR
.InitDrop Array(array(DropA,DropAa),array(DropI,DropIa),array(DropR,DropRa)), Array(53,52,51)
.Initsnd "DTR", "DTResetR"
End With
Set bsLeftSaucer=New cvpmBallStack
bsLeftSaucer.InitSaucer Kicker1,57,138,20
'bsLeftSaucer.InitExitSnd "scoopexit","SolOn"
bsLeftSaucer.InitExitSnd "popper_ball", "popper_ball"
Set bsRightSaucer=New cvpmBallStack
bsRightSaucer.InitSaucer Kicker2,56,280,15
'bsRightSaucer.InitExitSnd "scoopexit","SolOn"
bsRightSaucer.InitExitSnd "popper_ball", "popper_ball"
Set bsVLock=New cvpmVLock
bsVLock.InitVLock Array(Trigger5,Trigger6),Array(Kicker3,Kicker4),Array(47,46)
bsVLock.CreateEvents "bsVLock"
bsVLock.InitSnd "popper", "popper"
Set bsBottomSaucer=New cvpmBallStack
bsBottomSaucer.InitSaucer Kicker5,39,0,50
'bsBottomSaucer.InitExitSnd "Popper","SolOn"
bsBottomSaucer.InitExitSnd "popper_ball", "popper_ball"
'Right Diverter Init
RightDiverter2.IsDropped=1
'Left Drop Ramp Init
dropramp1.collidable=true
dropramp1.visible=true
'Slingshot Init
LeftSling.IsDropped=1:LeftSling2.IsDropped=1:LeftSling3.IsDropped=1
LHammer.IsDropped=1:LHammer2.IsDropped=1:LHammer3.IsDropped=1
RightSling.IsDropped=1:RightSling2.IsDropped=1:RightSling3.IsDropped=1
RHammer.IsDropped=1:RHammer2.IsDropped=1:RHammer3.IsDropped=1
End Sub
'Keys
Sub Table1_KeyDown(ByVal KeyCode)
If KeyCode=LeftFlipperKey Then
Controller.Switch(5)=1
Controller.Switch(25)=1
End If
If KeyCode=RightFlipperKey Then
Controller.Switch(6)=1
Controller.Switch(26)=1
End If
If keycode = PlungerKey Then PlaysoundAtVol "PlungerPull", Plunger, 1:Plunger.Pullback
If KeyCode = 3 Then Controller.Switch(11) = True
If vpmKeyDown(KeyCode) Then Exit Sub
End Sub
Sub Table1_KeyUp(ByVal KeyCode)
If KeyCode=LeftFlipperKey Then
Controller.Switch(5)=0
Controller.Switch(25)=0
End If
If KeyCode=RightFlipperKey Then
Controller.Switch(6)=0
Controller.Switch(26)=0
End If
If keycode = PlungerKey Then StopSound "PlungerPull":Plunger.Fire
If KeyCode = 3 Then Controller.Switch(11) = False
'If KeyCode=KeyFront Then Controller.Switch(11)=0
If vpmKeyUp(KeyCode) Then Exit Sub
End Sub
'Switches
Sub Drain_Hit:PlaySoundAtVol "fx_drain", drain, 1:bsTrough.AddBall Me:End Sub
Sub BallRelease_UnHit():End Sub
Sub sw27_Hit:Controller.Switch(27)=1:PlaySoundAtVol "sensor", ActiveBall, 1:End Sub
Sub sw27_unHit:Controller.Switch(27)=0:End Sub
Sub Kicker1_Hit:PlaySoundAtVol "kicker_enter", kicker1, 1:bsLeftSaucer.AddBall 0:End Sub
Sub Kicker2_Hit:PlaySoundAtVol "kicker_enter", kicker2, 1:RightDiverter.TimerEnabled=0:RightDiverter.IsDropped=0:RightDiverter2.IsDropped=1:bsRightSaucer.AddBall 0:RampTimer.Enabled=1: End Sub
Sub RampRight_Hit:Controller.Switch(55)=1:End Sub
Sub RampRight_UnHit:Controller.Switch(55)=0:End Sub
Sub sw41_Hit():vpmTimer.PulseSw 41:PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw41_Timer():ME.TimerEnabled=0:End Sub
Sub sw42_Hit():vpmTimer.PulseSw 42:PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw42_Timer():ME.TimerEnabled=0:End Sub
Sub sw43_Hit():vpmTimer.PulseSw 43:PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw43_Timer():ME.TimerEnabled=0:End Sub
Sub sw49_Hit():vpmTimer.PulseSw 49:PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw49_Timer():ME.TimerEnabled=0:End Sub
Sub sw50_Hit():vpmTimer.PulseSw 50:PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw50_Timer():ME.TimerEnabled=0:End Sub
Sub sw62_Hit():vpmTimer.PulseSw 62:PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw62_Timer():ME.TimerEnabled=0:End Sub
Sub sw65_Hit():vpmTimer.PulseSw 65:PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw65_Timer():ME.TimerEnabled=0:End Sub
Sub sw66_Hit():vpmTimer.PulseSw 66: PlaySoundAtVol "target", ActiveBall, 1:ME.TimerEnabled=1:End Sub
Sub sw66_Timer():ME.TimerEnabled=0:End Sub
'Air Drop
Sub DropAa_Hit:dtr.Hit 1:DropADir = 0:DropAa.TimerEnabled = 1:End Sub
Sub DropIa_Hit:dtr.Hit 2:DropIDir = 0:DropIa.TimerEnabled = 1:End Sub
Sub DropRa_Hit:dtr.Hit 3:DropRDir = 0:DropRa.TimerEnabled = 1:End Sub
Sub DropSa_Hit:dtl.Hit 1:DropSDir = 0:DropSa.TimerEnabled = 1:End Sub
Sub DropHa_Hit:dtl.Hit 2:DropHDir = 0:DropHa.TimerEnabled = 1:End Sub
Sub DropOa_Hit:dtl.Hit 3:DropODir = 0:DropOa.TimerEnabled = 1:End Sub
Sub DropWa_Hit:dtl.Hit 4:DropWDir = 0:DropWa.TimerEnabled = 1:End Sub
Sub LeftInlane_Hit:Controller.Switch(35)=1:PlaySoundAtVol "Sensor", ActiveBall, 1:End Sub
Sub LeftInlane_UnHit:Controller.Switch(35)=0:End Sub
Sub RightInlane_Hit:Controller.Switch(37)=1:PlaySoundAtVol "Sensor", ActiveBall, 1:End Sub
Sub RightInlane_UnHit:Controller.Switch(37)=0:End Sub
Sub RightOutlane_Hit:Controller.Switch(38)=1:PlaySoundAtVol "Sensor", ActiveBall, 1:End Sub
Sub RightOutlane_UnHit:Controller.Switch(38)=0:End Sub
Sub Kicker5_Hit:PlaySoundAtVol "kicker_enter_left", Kicker5, 1:LockDoor.IsDropped=0:bsBottomSaucer.AddBall 0:End Sub
Dim Speed1
Sub Kicker6_Hit:Speed1=SQR(ActiveBall.VelY*ActiveBall.VelY)/3:vpmTimer.PulseSw 73:Kicker6.DestroyBall:PlaySoundAtVol "rail", Kicker6, 1:Kicker8.TimerEnabled=1:End Sub
Kicker8.TimerInterval=150
Sub Kicker8_Timer ()
Kicker8.CreateBall: kicker8.Kick 180,Speed1
Kicker8.TimerEnabled=0
End Sub
Dim Speed2
Sub Kicker7_Hit:Speed2=SQR(ActiveBall.VelY*ActiveBall.VelY)/3:vpmTimer.PulseSw 74:Kicker7.DestroyBall:PlaySoundAtVol "rail", Kicker7, 1:Kicker9.TimerEnabled=1:End Sub
Kicker9.TimerInterval=150
Sub Kicker9_Timer ()
Kicker9.CreateBall: Kicker9.Kick 180,Speed2
Kicker9.TimerEnabled=0
End Sub
Sub Trigger12_Hit:ActiveBall.VelX=0:ActiveBall.VelY=3:End Sub
Sub Trigger13_Hit:ActiveBall.VelX=0:ActiveBall.VelY=3:End Sub
Sub Trigger14_Hit:ActiveBall.VelX=0:ActiveBall.VelY=3:End Sub
Sub Trigger15_Hit:ActiveBall.VelX=0:ActiveBall.VelY=3:End Sub
Sub Trigger16_Hit:ActiveBall.VelX=0:ActiveBall.VelY=3:End Sub
Sub Trigger17_Hit:ActiveBall.VelX=0:ActiveBall.VelY=3:End Sub
Sub Trigger20_Hit:ActiveBall.VelX=0:ActiveBall.VelY=1:End Sub
Sub Trigger18_Hit:ActiveBall.VelX=1.5:ActiveBall.VelY=1.5:End Sub
Sub Trigger19_Hit:ActiveBall.VelX=-1.5:ActiveBall.VelY=1.5:End Sub
'Slingshots
'sling animation scripting from JPSalas
Dim LStep, RStep
Sub LeftSlingShot_Slingshot
PlaySoundAtBallVol "LSling", 1:vpmTimer.PulseSw 33:LStep = 0:Me.TimerEnabled = 1
End Sub
'Sub LeftSlingShot_Slingshot:PlaySound "LSling":LeftSling.IsDropped = 0:vpmTimer.PulseSw 33:LStep = 0:Me.TimerEnabled = 1:End Sub
Sub LeftSlingShot_Timer
Select Case LStep
Case 0:LeftSLing.IsDropped = 0:LHammer.IsDropped = 0
Case 1: 'pause
Case 2:LeftSLing.IsDropped = 1:LHammer.IsDropped=1:LeftSLing2.IsDropped = 0:LHammer2.IsDropped = 0
Case 3:LeftSLing2.IsDropped = 1:LHammer2.IsDropped = 1:LeftSLing3.IsDropped = 0:LHammer3.IsDropped = 0
Case 4:LeftSLing3.IsDropped = 1:LHammer3.IsDropped = 1:Me.TimerEnabled = 0
End Select
LStep = LStep + 1
End Sub
Sub RightSlingShot_Slingshot
PlaySoundAtBallVol "RSling", 1:vpmTimer.PulseSw 34:RStep = 0:Me.TimerEnabled = 1
End Sub
'Sub RightSlingShot_Slingshot:PlaySound "RSling":RightSling.IsDropped = 0:vpmTimer.PulseSw 34:RStep = 0:Me.TimerEnabled = 1:End Sub
Sub RightSlingShot_Timer
Select Case RStep
Case 0:RightSLing.IsDropped = 0:RHammer.IsDropped = 0
Case 1: 'pause
Case 2:RightSLing.IsDropped = 1:RHammer.IsDropped=1:RightSLing2.IsDropped = 0:RHammer2.IsDropped = 0
Case 3:RightSLing2.IsDropped = 1:RHammer2.IsDropped = 1:RightSLing3.IsDropped = 0:RHammer3.IsDropped = 0
Case 4:RightSLing3.IsDropped = 1:RHammer3.IsDropped = 1:Me.TimerEnabled = 0
End Select
RStep = RStep + 1
End Sub
'Bumpers
Sub Bumper1_Hit:RandomSoundBumper:vpmTimer.PulseSw 78:Bumper1Cover.image = "Bumper_On" :bump1 = 1:Me.TimerEnabled = 1:End Sub
Sub Bumper1_Timer:Bumper1Cover.image = "Bumper_off":Me.TimerEnabled = 0:End Sub
Sub Bumper2_Hit:RandomSoundBumper:vpmTimer.PulseSw 79:Bumper2Cover.image = "Bumper_On" :bump2 = 1:Me.TimerEnabled = 1:End Sub
Sub Bumper2_Timer:Bumper2Cover.image = "Bumper_off":Me.TimerEnabled = 0:End Sub
Sub Bumper3_Hit:RandomSoundBumper:vpmTimer.PulseSw 80:Bumper3Cover.image = "Bumper_On" :bump3 = 1:Me.TimerEnabled = 1:End Sub
Sub Bumper3_Timer:Bumper3Cover.image = "Bumper_off":Me.TimerEnabled = 0:End Sub
Sub RandomSoundBumper()
Select Case Int(Rnd*3)+1
Case 1 : PlaySoundAtVol "bumper_1", ActiveBall, 1
Case 2 : PlaySoundAtVol "bumper_2", ActiveBall, 1
Case 3 : PlaySoundAtVol "bumper_3", ActiveBall, 1
End Select
End Sub
'Upper Jet Ball Release direction (Script by Destruk)
Dim RM
Sub Trigger21_Hit
RM=RM+1
If RM>1 Then RM=0
If RM=0 Then
ActiveBall.VelX=1
Else
ActiveBall.VelX=-1
End If
End Sub
'Injector Scripting (by Destruk)
Dim BKTBall,InTheZone
InTheZone=0
Sub BKT_Hit
Set BKTBall=ActiveBall
InTheZone=1
End Sub
Sub BKT_unHit
InTheZone=0
'Injection_Bar_Fwd.IsDropped=1
Dim x
For each x in Injection_Bar_Fwd
x.visible=0
x.collidable=0
Next
'Injection_Bar_Back.isDropped=0
Dim y
For each y in Injection_Bar_Back
y.collidable=1
y.visible=1
Next
End Sub
Sub ModifyBall_Timer
If InTheZone=1 Then
BKTBall.VelY=BKTBall.VelY+5
Dim x
For each x in Injection_Bar_Fwd
x.collidable=1
x.visible=1
Next
Dim y
For each y in Injection_Bar_Back
y.collidable=0
y.visible=0
Next
If BKTBall.VelX<-2 Then BKTBall.VelX=BKTBall.VelX+5
End If
End Sub
'****************************************
' JP's Fading Lamps Routine
' Based on PD's Fading Lights
' SetLamp 0 is Off
' SetLamp 1 is On
' LampState(x) current state
'****************************************
Dim LampState(200), FadingLevel(200)
Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200), ModulationLevel(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 UpdateLamps
NFadeL 5, L5
NFadeL 6, L6
NFadeL 7, L7
NFadeLm 8, L8a
NFadeLm 8, L8b
NFadeL 8, L8
NFadeL 9, L9
NFadeLm 11, L11a
NFadeLm 11, L11b
NFadeLm 11, L11c
NFadeL 11, L11
NFadeLm 12, L12a
NFadeLm 12, L12b
NFadeLm 12, L12c
NFadeLm 12, L12d
NFadeLm 12, L12e
NFadeL 12, L12
NFadeL 13, L13
NFadeL 14, L14
NFadeL 15, L15
NFadeLm 16, L16
NFadeL 16, L16a
NFadeL 17, L17
NFadeL 18, L18
NFadeL 19, L19
NFadeL 20, L20
NFadeL 21, L21
NFadeL 22, L22
NFadeLm 23, L23a
NFadeLm 23, L23b
NFadeLm 23, L23c
NFadeL 23, L23
NFadeLm 24, L24a
NFadeLm 24, L24b
NFadeLm 24, L24c
NFadeLm 24, L24d
NFadeLm 24, L24e
NFadeL 24, L24
NFadeLm 25, L25a
NFadeLm 25, L25b
NFadeL 25, L25
NFadeLm 26, L26a
NFadeLm 26, L26b
NFadeL 26, L26
NFadeLm 27, L27a
NFadeLm 27, L27b
NFadeL 27, L27
NFadeLm 28, L28a
NFadeLm 28, L28b
NFadeL 28, L28
NFadeLm 29, L29a
NFadeLm 29, L29b
NFadeLm 29, L29c
NFadeLm 29, L29d
NFadeLm 29, L29e
NFadeL 29, L29
NFadeLm 30, L30
NFadeL 30, L30
NFadeLm 31, L31a
NFadeL 31, L31
NFadeLm 32, L32a
NFadeL 32, L32
NFadeL 33, L33
NFadeL 34, L34
NFadeLm 35, L35a
NFadeLm 35, L35b
NFadeLm 35, L35c
NFadeLm 35, L35d
NFadeLm 35, L35e
NFadeL 35, L35
NFadeL 36, L36
NFadeL 37, L37
NFadeL 38, L38
NFadeL 39, L39
NFadeL 40, L40
NFadeL 41, L41
NFadeL 42, L42
NFadeL 43, L43
NFadeLm 44, L44a
NFadeLm 44, L44b
NFadeL 44, L44
NFadeLm 45, L45a
NFadeLm 45, L45b
NFadeL 45, L45
NFadeLm 46, L46a
NFadeLm 46, L46b
NFadeLm 46, L46c
NFadeLm 46, L46d
NFadeLm 46, L46e
NFadeL 46, L46
NFadeLm 47, L47a
NFadeLm 47, L47b
NFadeL 47, L47
NFadeL 48, L48
NFadeL 49, L49
NFadeL 50, L50
NFadeL 51, L51
NFadeL 52, L52
NFadeL 53, L53
NFadeL 54, L54
NFadeLm 55, L55a
NFadeLm 55, L55b
NFadeL 55, L55
NFadeLm 56, L56a
NFadeLm 56, L56b
NFadeL 56, L56
NFadeL 57, L57
NFadeL 58, L58
NFadeL 59, L59
NFadeL 60, L60
NFadeL 61, L61
NFadeL 62, L62
NFadeL 63, L63
NFadeL 64, L64
NFadeL 65, L65
NFadeL 66, L66
NFadeL 67, L67
NFadeL 68, L68
NFadeL 69, L69
NFadeLm 70, L70a
NFadeLm 70, L70b
NFadeL 70, L70
NFadeL 71, L71
NFadeL 72, L72
NFadeL 73, L73
NFadeL 74, L74
NFadeL 75, L75
NFadeL 76, L76
NFadeLm 77, L77a
NFadeLm 77, L77b
NFadeL 77, L77
NFadeLm 78, L78a
NFadeLm 78, L78b
NFadeL 78, L78
NFadeLm 79, L79a
NFadeLm 79, L79b
NFadeL 79, L79
NFadeLm 80, L80a
NFadeL 80, L80
NFadeL 81, L81
NFadeL 82, L82
NFadeL 83, L83
NFadeL 84, L84
'NFadeLm 85, L91
NFadeLm 85, L85a
NFadeLm 85, L85b
NFadeLm 85, L85c
NFadeL 85, L85
NFadeLm 86, L86a
NFadeLm 86, L86b
NFadeL 86, L86
NFadeLm 87, L87a
NFadeLm 87, L87b
NFadeLm 87, L87c
NFadeLm 87, L87d
NFadeL 87, L87
NFadeLm 89, LBumper1a
NFadeL 89, LBumper1
NFadeLm 90, LBumper3a
NFadeL 90, LBumper3
NFadeLm 91, LBumper2a
NFadeLm 91, LBumper2
NFadeLm 91, L91a
NFadeLm 91, L91b
NFadeL 91, L91
'NFadeLm 93, rightcenterplastic
'NFadeLm 93, L105
NFadeLm 92, L92a
NFadeLm 92, L92b
NFadeL 92, L92
NFadeL 94, L93
NFadeL 95, L94
NFadeL 96, L95
NFadeL 97, L96
NFadeL 98, L97
NFadeL 99, L98
NFadeLm 100, L99a
NFadeL 100, L99
NFadeL 101, L100
NFadeL 102, L101
NFadeL 103, L102
NFadeLm 104, L103a
NFadeLm 104, L103b
NFadeLm 104, L103c
NFadeLm 104, L103d
NFadeLm 104, L103e
NFadeL 104, L103
'NFadeL 106, L105
FlashAR 178, InjectorLights, "InjectorPanel_On", "InjectorPanel_Half","InjectorPanel_Off"
Flash 170, F20
Flash 176, F26
Flashm 178, F27a
Flash 178, F27
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.2 ' faster speed when turning on the flasher
FlashSpeedDown(x) = 0.05 ' 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
ModulationLevel(x) = 0 ' the starting modulation level, from 0 to 255
Next
End Sub
Sub AllLampsOff
Dim x
For x = 0 to 200
SetLamp x, 0
Next
End Sub
Sub SetLamp(nr, value)
If value <> LampState(nr) Then
LampState(nr) = abs(value)
FadingLevel(nr) = abs(value) + 4
End If
End Sub
'Lights
Sub NFadeL(nr, object)
Select Case FadingLevel(nr)
Case 4:object.state = 0:FadingLevel(nr) = 0
Case 5:object.state = 1:FadingLevel(nr) = 1
End Select
End Sub
Sub NFadeLm(nr, object) ' used for multiple lights
Select Case FadingLevel(nr)
Case 4:object.state = 0
Case 5:object.state = 1
End Select
End Sub
' Flasher objects
Sub Flash(nr, object)
Select Case FadingLevel(nr)
Case 4 'off
FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
If FlashLevel(nr) < FlashMin(nr) Then
FlashLevel(nr) = FlashMin(nr)
FadingLevel(nr) = 0 'completely off
End if
Object.IntensityScale = FlashLevel(nr)
Case 5 ' on
FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
If FlashLevel(nr) > FlashMax(nr) Then
FlashLevel(nr) = FlashMax(nr)
FadingLevel(nr) = 1 'completely on
End if
Object.IntensityScale = FlashLevel(nr)
End Select
End Sub
Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
Object.IntensityScale = FlashLevel(nr)
End Sub
Sub SetLampMod(nr, value)
If value > 0 Then
LampState(nr) = 1
Else
LampState(nr) = 0
End If
ModulationLevel(nr) = value
End Sub
Sub LampMod(nr, object)
Object.IntensityScale = ModulationLevel(nr)/128
End Sub
Sub FlashAR(nr, ramp, a, b, c)
Select Case LampState(nr)
Case 2:LampState(nr) = 0 'Off
Case 3:ramp.image = c:LampState(nr) = 2 'fading...
Case 4:ramp.image = b:LampState(nr) = 3 'fading...
Case 5:ramp.image = a:LampState(nr) = 1 'ON
End Select
End Sub
Sub FlashARm(nr, ramp, a, b, c)
Select Case LampState(nr)
Case 2:LampState(nr) = 0 'Off
Case 3:ramp.image = c:LampState(nr) = 2 'fading...
Case 4:ramp.image = b:LampState(nr) = 3 'fading...
Case 5:ramp.image = a:LampState(nr) = 1 'ON
End Select
End Sub
' *******************************************************************************************************
' Positional Sound Playback Functions by DJRobX, Rothbauerw, Thalamus and Herweh
' PlaySound sound, 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
' *******************************************************************************************************
' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
End Sub
' Set position as table object (Use object or light but NOT wall) and Vol to 1
Sub PlaySoundAt(soundname, tableobj)
PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
End Sub
' set position as table object and Vol + RndPitch manually
Sub PlaySoundAtVolPitch(sound, tableobj, Vol, RndPitch)
PlaySound sound, 1, Vol, AudioPan(tableobj), RndPitch, 0, 0, 1, AudioFade(tableobj)
End Sub
'Set all as per ball position & speed.
Sub PlaySoundAtBall(soundname)
PlaySoundAt soundname, ActiveBall
End Sub
'Set position as table object and Vol manually.
Sub PlaySoundAtVol(sound, tableobj, Volume)
PlaySound sound, 1, Volume, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)