-
Notifications
You must be signed in to change notification settings - Fork 37
/
Algar (Williams 1980) 1.34.vbs
1330 lines (1106 loc) · 40.8 KB
/
Algar (Williams 1980) 1.34.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
' Special thanks goes to previous authors of this tables : Practicedummy, UncleWilly, LuvThatApex and Kristian.
' Background image for Desktop by Batch. Flippers by Flupper. A few primitives from GtxJoe's primitive collection.
' Main table by Thalamus and playfield done mostly by Kalavera ( thank you so much )
' The biggest thanks goes to the main devs - without you this would not be possible. You guys rock !
' The table started out from the example table and there is code and resources there provided by the community.
' JP, Ninuzzu, DjRobX, Rothbauerw probably also 32assassins. Thanks guys !
' Thalamus 2020-09-19
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Changed UseSolenoids=1 to 2
' Wob 2018-08-08
' Added vpmInit Me to table init and both cSingleLFlip and /cSingleRFlip
' Thalamus 2020-09-19 : Improved directional sounds
' Thalamus 2021-04-12 : Patched ballshadow
' Thalamus 2021-11-20 : Fixed missing score for spinners, changed tiltsw.
Const BallSize = 50
Const BallMass = 1.7
' Options
' Volume devided by - lower gets higher sound
Const VolDiv = 1000 ' 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
Const VolBump = 1 ' Bumpers volume.
Const VolGates = 1 ' Gates volume.
Const VolMetal = 0.1 ' Metals volume.
Const VolRH = 0.5 ' Rubber hits volume.
Const VolPo = 1 ' Rubber posts volume.
Const VolPi = 1 ' Rubber pins volume.
Const VolTarg = 1 ' Targets volume.
Const VolSpin = 0.03 ' Spinners volume.
Const VolFlip = 1 ' Flipper volume.
Dim bstrough,bslow,bshig
Dim dtbank3,dtbank5,i
Dim Bumper1AnimationCount
Dim Bumper2AnimationCount
Dim Bumper3AnimationCount
Dim ShowBallShadow
Dim FlipperShadows
Dim SMapEnabled
Dim luts, lutpos
Dim EnableRightMagnasave
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
Const cGameName="algar_l1",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="solenoid",SFlipperOn="FlipperUp",SFlipperOff="FlipperDown"
Const SCoin="coin3",cCredits="Algar"
' Wob: Added for Fast Flips (No upper Flippers)
Const cSingleLFlip = 0
Const cSingleRFlip = 0
' Options
FlipperShadows = 1 ' 1 turns on, 0 turns off flipper shadows.
ShowBallShadow = 1 ' 1 turns on, 0 turns off ball shadows
SMapEnabled = 1 ' 1 turns on, 0 turns off table and drop shadows
EnableRightMagnasave = 1 ' 1 turns on lut selection, change "lutpos" below if you want another default
lutpos = 2 ' Sets the nr of the LUT you want to use (0 = first in the list below, 1 = second, etc)
TextBox001.visible = 0
' Lut code shamelessly stolen from Totan - Tnanks Flupper
luts = array( "cg256x16_1to1SL20", "cg256x16_1to1SL30", "cg256x16_1to1SL40", "cg256x16_1to1SL50", "cg256x16_1to1SL60", "cg256x16_1to1SL70", "cg256x16_1to1SL80" )
LoadVPM "01520000","s4.vbs",3.1
Dim DesktopMode: DesktopMode = Table1.ShowDT
If DesktopMode = True Then 'Show Desktop components
lrail.visible=1
rrail.visible=1
SideCab.visible=1
Backwall.visible=1
Screw1.visible=1
Screw2.visible=1
Screw3.visible=1
Screw4.visible=1
Screw5.visible=1
Light56.visible=1
Else
lrail.visible=0
rrail.visible=0
SideCab.visible=0
Backwall.visible=0
Screw1.visible=0
Screw2.visible=0
Screw3.visible=0
Screw4.visible=0
Screw5.visible=0
Light56.visible=1
End if
If FlipperShadows = 1 Then
GraphicsTimer.Enabled=1
End If
If SMapEnabled = 1 Then
Flasher001.visible=1
DropShadowTimer.Enabled=1
Else
Flasher001.visible=0
Targ1.visible=0
Targ2.visible=0
Targ3.visible=0
Targ4.visible=0
Targ5.visible=0
Targ6.visible=0
DropShadowTimer.Enabled=0
End If
Sub Plunger_Init
PlaySoundAtVol SoundFX("ballrelease",DOFContactors), BallRelease, 1
End Sub
Sub Table1_KeyDown(ByVal keycode)
If keycode = PlungerKey Then
Plunger.PullBack
PlaySoundAtVol "plungerpull", Plunger, 1
End If
If keycode = RightMagnaSave and EnableRightMagnasave = 1 then
textbox001.visible = 1
lutpos = lutpos + 1 : If lutpos > ubound(luts) Then lutpos = 0 : end if
table1.ColorGradeImage = luts(lutpos)
dim tekst : tekst = "lutpos:" & lutpos & " " & luts(lutpos)
textbox001.text = tekst
vpmTimer.AddTimer 2000, "If textbox001.text =" + chr(34) + tekst + chr(34) + " then textbox001.visible = 0'"
End if
If keycode = LeftTiltKey Then
Nudge 90, 2
End If
If keycode = RightTiltKey Then
Nudge 270, 2
End If
If keycode = CenterTiltKey Then
Nudge 0, 2
End If
if vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Table1_KeyUp(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Fire
PlaySoundAtVol "plunger",Plunger, 1
End If
if vpmKeyUp(keycode) Then Exit Sub
End Sub
' SolCallbacks
SolCallback(1)="solballrelease"
SolCallback(2)="bslow.solout"
SolCallback(3)="dtbank3.soldropup"
SolCallback(4)="dtbank5.soldropup"
SolCallback(5)="bshig.solout"
' SolCallback(6)= "vpmSolDiverter OutlaneGate, solon, Not"
SolCallback(6)="SolDiverterSub"
SolCallback(7)="chamber"
SolCallback(14)="vpmsolsound SoundFX(""knocker"",DOFKnocker),"
' SolCallback(sllflipper)="vpmsolflipper leftflipper,nothing,"
' SolCallback(slrflipper)="vpmsolflipper rightflipper,nothing,"
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
' SolCallback(32) = "VpmNudge.SolGameOn"
SolCallback(23) = "VpmNudge.SolGameOn"
if Light37.State = 0 Then
OutlaneGate.RotateToEnd
End if
Sub SolDiverterSub(Enabled)
If Enabled Then
OutlaneGate.RotateToStart
Light37.State = LightStateOn
PlaySound SoundFX(SSolenoidOn,DOFContactors)
Else
OutlaneGate.RotateToEnd
PlaySound SoundFX(SSolenoidOn,DOFContactors)
Light37.State = LightStateOff
End If
End Sub
Sub SolLFlipper(Enabled)
If Enabled Then
LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
PlaySoundAtVol SoundFX("fx_flipperup",DOFFlippers), LeftFlipper, VolFlip
Else
LeftFlipper.EOSTorque = 0.1:LeftFlipper.RotateToStart
PlaySoundAtVol SoundFX("fx_flipperdown",DOFFlippers), LeftFlipper, VolFlip / 3
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
PlaySoundAtVol SoundFX("fx_flipperup",DOFFlippers), RightFlipper, VolFlip
controller.switch(50)=false
Else
RightFlipper.EOSTorque = 0.1:RightFlipper.RotateToStart
PlaySoundAtVol SoundFX("fx_flipperdown",DOFFlippers), RightFlipper, VolFlip / 3
controller.switch(50)=true
End If
End Sub
Sub Table1_Init
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox"Can't start Game"&cGameName&vbNewLine&Err.Description:Exit Sub
.SplashInfoLine = "Algar, Williams 1980. Table playfield recreation by VPX by Thalamus & Kalavera"
.HandleMechanics=0
.HandleKeyboard=0
.ShowDMDOnly=1
.ShowFrame=0
.ShowTitle=0
.Hidden=0
On Error Resume Next
Controller.SolMask(0)=0
vpmTimer.AddTimer 4000,"Controller.SolMask(0)=&Hffffffff'"
.Run GetPlayerHwnd
If Err Then MsgBox Err.Description
End With
NVOffset(0)
PinMAMETimer.Interval=PinMAMEInterval:PinMAMETimer.Enabled=1
Set bsTrough=New cvpmBallStack
bsTrough.InitNoTrough BallRelease,9,80,8
bsTrough.InitExitSnd SoundFX("BallRelease",DOFContactors),SoundFX("SolOn",DOFContactors)
Set bslow =new cvpmballstack
bslow.initsaucer kicker2,19,5,17 ' 17
bslow.kickanglevar=3
bslow.kickforcevar=3
bslow.initexitsnd SoundFX("diverter",DOFContactors), ","
set bshig =new cvpmballstack
bshig.initsaucer kicker1,26,175,9 '8
bshig.kickanglevar=3
bshig.kickforcevar=3
bshig.InitAddSnd "saucer_in1"
bshig.initexitsnd SoundFX("ExitKick",DOFContactors),","
set dtbank3=new cvpmdroptarget
dtbank3.initdrop array(DropTarget1,DropTarget2,DropTarget3),array(14,15,16)
dtbank3.initsnd SoundFX("dtl",DOFContactors), SoundFX("dts",DOFContactors)
dtbank3.AllDownSw = 17
set dtbank5=new cvpmdroptarget
dtbank5.initdrop array (DropTarget4,DropTarget5,DropTarget6),array(39,40,41)
dtbank5.initsnd SoundFX("dtl2",DOFContactors), SoundFX("dts2",DOFContactors)
dtbank5.AllDownSw = 42
vpmNudge.TiltSwitch=1
vpmnudge.sensitivity=5
vpmNudge.TiltObj = Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot,URightSlingshot)
If ShowBallShadow = 1 Then
BallShadowUpdate.enabled=1
GI9.state=1
Else
BallShadowUpdate.enabled=0
GI9.state=0
End If
If FlipperShadows = 1 then
FlipperLSh.visible=1
FlipperRSh.visible=1
else
FlipperLSh.visible=0
FlipperRSh.visible=0
End If
Sw11.IsDropped = True
Sw12.IsDropped = True
Sw13.IsDropped = True
Sw24.IsDropped = True
Sw25.IsDropped = True
Sw27.IsDropped = True
Sw28.IsDropped = True
Sw35.IsDropped = True
Sw37.IsDropped = True
Sw44.IsDropped = True
' Create Captive Ball
RCaptKicker1.CreateBall
RCaptKicker1.Kick 180,10
RCaptKicker2.CreateBall
RCaptKicker2.Kick 180,10
RCaptKicker3.CreateBall
RCaptKicker3.Kick 180,10
GameTimer.Enabled = 1
End Sub
' Bumpers
Sub Bumper1_Hit
PlaySoundAtVol SoundFX("fx_bumper1",DOFContactors), Bumper1, VolBump
vpmtimer.pulsesw 47
Me.TimerEnabled = 1
End Sub
Sub Bumper1_Timer
Me.Timerenabled = 0
End Sub
Sub Bumper2_Hit
PlaySoundAtVol SoundFX("fx_bumper2",DOFContactors), Bumper2, VolBump
vpmtimer.pulsesw 48
Me.TimerEnabled = 1
End Sub
Sub Bumper2_Timer
Me.Timerenabled = 0
End Sub
Sub Bumper3_Hit
PlaySoundAtVol SoundFX("fx_bumper3",DOFContactors), Bumper3, VolBump
vpmtimer.pulsesw 49
Me.TimerEnabled = 1
End Sub
Sub Bumper3_Timer
Me.Timerenabled = 0
End Sub
Sub solballrelease(enabled)
bstrough.solexit SoundFX(ssolenoidon,DOFContactors), SoundFX(ssolenoidon,DOFContactors),enabled
End Sub
Sub DrainSound_Hit
PlaySoundAtVol "drain", Drain, 1
End Sub
Sub Drain_Hit
bstrough.addball me
End Sub
sub chamber(enabled)
'light1000.state=1:timer1.enabled=1
PlaySoundAtVol "solenoid", CircularTarget1, 1
CapturedBallPost1.IsDropped=1
CapturedBallPost2.IsDropped=1
CapturedBallPost3.IsDropped=1
end sub
'Sub Timer1_Timer
' light1000.state=0:timer1.enabled=0
'End Sub
Set LampCallback = GetRef("UpdateLamps")
Sub UpdateLamps
Light5a.State=Light5.State
Light4f.State=Light4.State
Light9f.State=Light9.State
Light10f.State=Light10.State
Light11f.State=Light11.State
Light12f.State=Light12.State
Light13f.State=Light13.State
Light14f.State=Light14.State
Light21f.State=Light21.State
Light22f.State=Light22.State
Light23f.State=Light23.State
Light24f.State=Light24.State
'++++++++Banner Lights
If Light62.State = 1 Then
Light62a.State = 0
Light62b.State = 0
Light62c.State = 0
Light62d.State = 0
Light62e.State = 0
Else
Light62a.State = 1
Light62b.State = 1
Light62c.State = 1
Light62d.State = 1
Light62e.State = 1
End If
If Light57.State = 1 OR Light58.State = 1 OR Light59.State = 1 OR Light60.State = 1 Then
Light55a.State = 1
Light55b.State = 1
Light55c.State = 1
Light55d.State = 1
Else
Light55a.State = 0
Light55b.State = 0
Light55c.State = 0
Light55d.State = 0
End If
End Sub
set lights(1)=light1 ' same player shoot again
set lights(2)=light2 ' left special
set lights(3)=light3 ' right special
set lights(4)=light4 ' loop gate x2
set lights(5)=light5 ' chamber 50k
set lights(6)=light6 ' chamber 40k
set lights(7)=light7 ' chamber 30k
set lights(8)=light8 ' chamber reset
set lights(9)=light9 ' loop lane 10
set lights(10)=light10 ' loop lane 20
set lights(11)=light11 ' loop lane 30
set lights(12)=light12 ' loop lane 40
set lights(13)=light13 ' loop lane 50
set lights(14)=light14 ' loop lane 60
set lights(15)=light15 ' extra ball when lit
'set lights(16)=light16 ' was off - says not used but why the hell not ?
set lights(17)=light17 ' 2x
set lights(18)=light18 ' 3x
set lights(19)=light19 ' 4x
set lights(20)=light20 ' 5x
set lights(21)=light21 ' K rollover
set lights(22)=light22 ' O rollover
set lights(23)=light23 ' R rollover
set lights(24)=light24 ' A rollover
set lights(25)=light25 ' left 3 bank left target arrow
set lights(26)=light26 ' left 3 bank center target arrow
set lights(27)=light27 ' left 3 bank right target arrow
set lights(28)=light28 ' center 3 bank left target arrow
set lights(29)=light29 ' center 3 bank center target arrow
set lights(30)=light30 ' center 3 bank right target arrow
set lights(31)=light31 ' left spinner
set lights(32)=light32 ' right spinner
set lights(33)=light33 ' 3 banks 10 bonus
set lights(34)=light34 ' 3 banks 30 bonus
set lights(35)=light35 ' 3 banks 50 bonus
set lights(36)=light36 ' 3 banks 100 bonus
' set lights(37)=light37 ' was off - doc say, not used
set lights(38)=light38 ' 20k bonus
set lights(39)=light39 ' 10k bonus
set lights(40)=light40 ' 1k bonus
set lights(41)=light41 ' 2k bonus
set lights(42)=light42 ' 3k bonus
set lights(43)=light43 ' 4k bonus
set lights(44)=light44 ' 5k bonus
set lights(45)=light45 ' 6k bonus
set lights(46)=light46 ' 7k bonus
set lights(47)=light47 ' 8k bonus
set lights(48)=light48 ' 9k bonus
set lights(49)=light49 ' was off - doc say, not used
set lights(50)=light50 ' was off - 1 can play
set lights(51)=light51 ' was off - 2 can play
set lights(52)=light52 ' was off - 3 can play
set lights(53)=light53 ' was off - 4 can play
set lights(54)=light54 ' was off - match
set lights(55)=light55 ' ball in play
set lights(56)=light56 ' credits on apron
set lights(57)=light57 ' 1 player up
set lights(58)=light58 ' 2 player up
set lights(59)=light59 ' 3 player up
set lights(60)=light60 ' 4 player up
set lights(61)=light61 ' tilt
set lights(62)=light62 ' game over
set lights(63)=light63 ' same player shoots again in backbox
set lights(64)=light64 ' high score
' Switches
Sub Sw18_hit:vpmtimer.pulsesw 18:End Sub
Sub Sw20_hit:vpmtimer.pulsesw 20:End Sub
Sub Sw21_hit:vpmtimer.pulsesw 21:End Sub
Sub Sw23_hit:vpmtimer.pulsesw 23:End Sub
Sub Sw30_hit:vpmtimer.pulsesw 30:End Sub
Sub Sw34_hit:vpmtimer.pulsesw 34:End Sub
Sub Sw43_hit:vpmtimer.pulsesw 43:End Sub
Sub Sw45_hit:vpmtimer.pulsesw 45:End Sub
Sub Sw46_hit:vpmtimer.pulsesw 46:End Sub
Sub Sw52_hit:vpmtimer.pulsesw 52:End Sub
Sub Sw53_hit:vpmtimer.pulsesw 53:End Sub
' Captive balls
Sub CircularTarget1_hit
vpmtimer.pulsesw 31
CapturedBallPost1.isdropped=0
CircularTarget1.IsDropped = True
CircularTarget1.TimerEnabled = True
End Sub
Sub CircularTarget2_hit
vpmtimer.pulsesw 32
CapturedBallPost2.isdropped=0
CircularTarget2.IsDropped = True
CircularTarget2.TimerEnabled = True
End Sub
Sub CircularTarget3_hit
vpmtimer.pulsesw 33
CapturedBallPost3.isdropped=0
CircularTarget3.IsDropped = True
CircularTarget3.TimerEnabled = True
End Sub
Sub CircularTarget1_Timer
CircularTarget1.IsDropped = False
CircularTarget1.TimerEnabled = False
End Sub
Sub CircularTarget2_Timer
CircularTarget2.IsDropped = False
CircularTarget2.TimerEnabled = False
End Sub
Sub CircularTarget3_Timer
CircularTarget3.IsDropped = False
CircularTarget3.TimerEnabled = False
End Sub
Sub LeftOutlane_Hit
controller.switch (13)=true
Switch2.isDropped= False
End Sub
' Triggers
Sub sw11_Hit:Controller.Switch(11) = 1:End Sub
Sub sw11_UnHit:Controller.Switch(11) = 0:End Sub
Sub sw13_Hit:Controller.Switch(13) = 1:End Sub
Sub sw13_UnHit:Controller.Switch(13) = 0:End Sub
Sub sw12_Hit:Controller.Switch(12) = 1:End Sub
Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
Sub sw24_Hit:Controller.Switch(24) = 1:End Sub
Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
Sub sw25_Hit:Controller.Switch(25) = 1:End Sub
Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
Sub sw27_Hit:Controller.Switch(27) = 1:End Sub
Sub sw27_UnHit:Controller.Switch(27) = 0:End Sub
Sub sw28_Hit:Controller.Switch(28) = 1:End Sub
Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
Sub sw35_Hit:Controller.Switch(35) = 1:End Sub
Sub sw35_UnHit:Controller.Switch(35) = 0:End Sub
Sub sw37_Hit:Controller.Switch(37) = 1:End Sub
Sub sw37_UnHit:Controller.Switch(37) = 0:End Sub
Sub sw44_Hit:Controller.Switch(44) = 1:End Sub
Sub sw44_UnHit:Controller.Switch(44) = 0:End Sub
Sub Kicker1_Hit:bshig.addball 0:Kicker1.TimerEnabled = True:Pkickarm.rotz=15: End Sub
Sub Kicker1_Timer
Kicker1.TimerEnabled = False
Pkickarm.rotz=0
End Sub
Sub Kicker2_Hit:bslow.addball 0:End Sub
Sub Spinner1_Spin
vpmtimer.pulsesw 22
PlaySound "fx_spinner", 0, VolSpin, AudioPan(Spinner1), 0.25, 0, 0, 1, AudioFade(Spinner1)
End Sub
Sub Spinner2_Spin
vpmtimer.pulsesw 29
PlaySound "fx_spinner", 0, VolSpin, AudioPan(Spinner2), 0.25, 0, 0, 1, AudioFade(Spinner2)
End Sub
Sub DropTarget1_Hit:dtbank3.hit 1:End sub
Sub DropTarget2_Hit:dtbank3.hit 2:End sub
Sub DropTarget3_Hit:dtbank3.hit 3:End sub
Sub DropTarget4_Hit:dtbank5.hit 1:End sub
Sub DropTarget5_Hit:dtbank5.hit 2:End sub
Sub DropTarget6_Hit:dtbank5.hit 3:End sub
'Sub Gate1_Hit:PlaySoundAtVol "gate",Gate1, VolGates:End Sub
'Sub Gate2_Hit:PlaySoundAtVol "gate",Gate2, VolGates:End Sub
Sub Gate3_Hit:PlaySoundAtVol "gate",Gate3, VolGates:End Sub
Sub Gate4_Hit:PlaySoundAtVol "gate",Gate4, VolGates:End Sub
'***** GI Lights On
dim xx
For each xx in GI:xx.State = 1: Next
'********** Sling Shot Animations
' Rstep and Lstep are the variables that increment the animation
'****************
Dim RStep, Lstep
Sub RightSlingShot_Slingshot
PlaySoundAtVol SoundFX("right_slingshot",DOFContactors), sling1, 1
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
vpmtimer.pulsesw 38
End Sub
Sub RightSlingShot_Timer
Select Case RStep
Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
End Select
RStep = RStep + 1
End Sub
Sub URightSlingShot_Slingshot
PlaySoundAtVol SoundFX("right_slingshot",DOFContactors), sling3, 1
URSling.Visible = 0
URSling1.Visible = 1
sling3.TransZ = -20
RStep = 0
URightSlingShot.TimerEnabled = 1
vpmtimer.pulsesw 36
End Sub
Sub URightSlingShot_Timer
Select Case RStep
Case 3:URSLing1.Visible = 0:URSLing2.Visible = 1:sling3.TransZ = -10
Case 4:URSLing2.Visible = 0:URSLing.Visible = 1:sling3.TransZ = 0:RightSlingShot.TimerEnabled = 0
End Select
RStep = RStep + 1
End Sub
Sub LeftSlingShot_Slingshot
PlaySoundAtVol SoundFX("left_slingshot",DOFContactors), sling2, 1
LSling.Visible = 0
LSling1.Visible = 1
Sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
vpmtimer.pulsesw 10
End Sub
Sub LeftSlingShot_Timer
Select Case LStep
Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
End Select
LStep = LStep + 1
End Sub
'*********************************************************************
' Positional Sound Playback Functions
'*********************************************************************
' 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
' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
Sub PlaySoundAt(soundname, tableobj)
PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
End Sub
Sub PlaySoundAtBall(soundname)
PlaySoundAt soundname, ActiveBall
End Sub
'*****************************************
' ninuzzu's BALL SHADOW
'*****************************************
'
Dim BallShadow
BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
Sub BallShadowUpdate_timer
Dim BOT, b
BOT = GetBalls
' exit the Sub if no balls on the table
If UBound(BOT) = -1 Then Exit Sub
' hide shadow of deleted balls
If UBound(BOT)<(tnob-1) Then
For b = (UBound(BOT) + 1) to (tnob-1)
BallShadow(b).visible = 0
Next
End If
' render the shadow for each ball
For b = 0 to UBound(BOT)
If BOT(b).X < Table1.Width/2 Then
BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) + 6
Else
BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) - 6
End If
ballShadow(b).Y = BOT(b).Y + 4
If BOT(b).Z > 20 Then
BallShadow(b).visible = 1
Else
BallShadow(b).visible = 0
End If
Next
End Sub
'************************************
' What you need to add to your table
'************************************
' a timer called RollingTimer. With a fast interval, like 10
' one collision sound, in this script is called fx_collide
' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
'******************************************
' Explanation of the rolling sound routine
'******************************************
' sounds are played based on the ball speed and position
' the routine checks first for deleted balls and stops the rolling sound.
' The For loop goes through all the balls on the table and checks for the ball speed and
' if the ball is on the table (height lower than 30) then then it plays the sound
' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
' according to the position of the ball on the table.
'**************************************
' Explanation of the collision routine
'**************************************
' The collision is built in VP.
' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
' depending of the speed of the collision.
Sub Pins_Hit (idx)
PlaySound "pinhit_low", 0, Vol(ActiveBall)*VolPi, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Targets_Hit (idx)
PlaySound "target", 0, Vol(ActiveBall)*VolTarg, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Metals_Thin_Hit (idx)
RandomThinHit
End Sub
Sub RandomThinHit
Select Case Int(Rnd*3)+1
Case 1 : PlaySound ("Small_Hit1"), 0, VolMulti(ActiveBall,VolMetal), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound ("Small_Hit2"), 0, VolMulti(ActiveBall,VolMetal), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound ("Small_Hit3"), 0, VolMulti(ActiveBall,VolMetal), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
Sub Metals_Medium_Hit (idx)
PlaySound "metalhit_medium", 0, VolMulti(ActiveBall,VolMetal), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Metals2_Hit (idx)
PlaySound "metal_hit1", 0, VolMulti(ActiveBall,VolMetal), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Gates_Hit (idx)
PlaySound "gate4", 0, Vol(ActiveBall)*VolGates, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub ApronWall_Hit(idx)
RandomSoundApron
End Sub
Sub RandomSoundApron
Select Case Int(Rnd*3)+1
Case 1 : PlaySoundAtBall ("WD_Drain_On_Metal_Under_Apron_1")
Case 2 : PlaySoundAtBall ("WD_Drain_On_Metal_Under_Apron_2")
Case 3 : PlaySoundAtBall ("WD_Drain_On_Metal_Under_Apron_3")
End Select
End Sub
Sub Rubbers_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 11 then
PlaySound "fx_rubber2", 0, VolMulti(ActiveBall,VolRH), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 6 AND finalspeed <= 11 then
RandomSoundRubber
End If
End Sub
Sub Posts_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 11 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolPo, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 6 AND finalspeed <= 11 then
RandomSoundRubber
End If
End Sub
Sub Gate2_Hit
PlaySoundAtVol "TOM_Small_Gate_1", Gate2, 1
End Sub
Sub Gate1_Hit
PlaySoundAtVol "TOM_Small_Gate_1", Gate1, 1
End Sub
Sub Wood_Hit(idx)
PlaySoundAtVol "wood_hit_outlane1", ActiveBall, .2
End Sub
Sub RandomSoundRubber
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "rubber_hit_1", 0, VolMulti(ActiveBall,VolRH), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "rubber_hit_2", 0, VolMulti(ActiveBall,VolRH), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "rubber_hit_3", 0, VolMulti(ActiveBall,VolRH), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
Sub LeftFlipper_Collide(parm)
RandomSoundFlipper
End Sub
Sub RightFlipper_Collide(parm)
RandomSoundFlipper
End Sub
Sub RandomSoundFlipper
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "flip_hit_1", 0, VolMulti(ActiveBall,VolRH), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "flip_hit_2", 0, VolMulti(ActiveBall,VolRH), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "flip_hit_3", 0, VolMulti(ActiveBall,VolRH), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
'**********************************************************************************************************
'Digital Display
'**********************************************************************************************************
Dim Digits(32)
' 1st Player
Digits(0) = Array(a1,a2,a3,a4,a5,a6,a7)
Digits(1) = Array(a8,a9,a10,a11,a12,a13,a14)
Digits(2) = Array(a15,a16,a17,a18,a19,a20,a21)
Digits(3) = Array(a22,a23,a24,a25,a26,a27,a28)
Digits(4) = Array(a29,a30,a31,a32,a33,a34,a35)
Digits(5) = Array(a36,a37,a38,a39,a40,a41,a42)
Digits(6) = Array(a43,a44,a45,a46,a47,a48,a49)
' 2nd Player
Digits(7) = Array(a50,a51,a52,a53,a54,a55,a56)
Digits(8) = Array(a57,a58,a59,a60,a61,a62,a63)
Digits(9) = Array(a64,a65,a66,a67,a68,a69,a70)
Digits(10) = Array(a71,a72,a73,a74,a75,a76,a77)
Digits(11) = Array(a78,a79,a80,a81,a82,a83,a84)
Digits(12) = Array(a85,a86,a87,a88,a89,a90,a91)
Digits(13) = Array(a92,a93,a94,a95,a96,a97,a98)
' 3rd Player
Digits(14) = Array(a99,a100,a101,a102,a103,a104,a105)
Digits(15) = Array(a106,a107,a108,a109,a110,a111,a112)
Digits(16) = Array(a113,a114,a115,a116,a117,a118,a119)
Digits(17) = Array(a120,a121,a122,a123,a124,a125,a126)
Digits(18) = Array(a127,a128,a129,a130,a131,a132,a133)
Digits(19) = Array(a134,a135,a136,a137,a138,a139,a140)
Digits(20) = Array(a141,a142,a143,a144,a145,a146,a147)
' 4th Player
Digits(21) = Array(a148,a149,a150,a151,a152,a153,a154)
Digits(22) = Array(a155,a156,a157,a158,a159,a160,a161)
Digits(23) = Array(a162,a163,a164,a165,a166,a167,a168)
Digits(24) = Array(a169,a170,a171,a172,a173,a174,a175)
Digits(25) = Array(a176,a177,a178,a179,a180,a181,a182)
Digits(26) = Array(a183,a184,a185,a186,a187,a188,a189)
Digits(27) = Array(a190,a191,a192,a193,a194,a195,a196)
' Credits
Digits(28) = Array(a197,a198,a199,a200,a201,a202,a203)
Digits(29) = Array(a204,a205,a206,a207,a208,a209,a210)
' Balls
Digits(30) = Array(a211,a212,a213,a214,a215,a216,a217)
Digits(31) = Array(a218,a219,a220,a221,a222,a223,a224)
Sub DisplayTimer_Timer
Dim ChgLED,ii,num,chg,stat,obj
ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
If Not IsEmpty(ChgLED) Then
If DesktopMode = True Then
For ii = 0 To UBound(chgLED)
num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
if (num < 32) then
For Each obj In Digits(num)
If chg And 1 Then obj.State = stat And 1
chg = chg\2 : stat = stat\2
Next
else
end if
next
end if
end if
End Sub
'=========================================================
' LED Handling
'=========================================================
'Modified version of Scapino's LED code for Fathom
'
'Dim SevenDigitOutput(32)
'Dim DisplayPatterns(11)
'Dim DigStorage(32)
'
'dim ledstatus : ledstatus = 2
'
''Binary/Hex Pattern Recognition Array
'DisplayPatterns(0) = 0 '0000000 Blank
'DisplayPatterns(1) = 63 '0111111 zero
'DisplayPatterns(2) = 6 '0000110 one
'DisplayPatterns(3) = 91 '1011011 two
'DisplayPatterns(4) = 79 '1001111 three
'DisplayPatterns(5) = 102 '1100110 four
'DisplayPatterns(6) = 109 '1101101 five
'DisplayPatterns(7) = 125 '1111101 six
'DisplayPatterns(8) = 7 '0000111 seven
'DisplayPatterns(9) = 127 '1111111 eight
'DisplayPatterns(10)= 111 '1101111 nine
'
''Assign 7-digit output to reels
'Set SevenDigitOutput(0) = P3D7
'Set SevenDigitOutput(1) = P3D6
'Set SevenDigitOutput(2) = P3D5
'Set SevenDigitOutput(3) = P3D4
'Set SevenDigitOutput(4) = P3D3
'Set SevenDigitOutput(5) = P3D2
'Set SevenDigitOutput(6) = P3D1
'
'Set SevenDigitOutput(7) = P4D7
'Set SevenDigitOutput(8) = P4D6
'Set SevenDigitOutput(9) = P4D5
'Set SevenDigitOutput(10) = P4D4
'Set SevenDigitOutput(11) = P4D3
'Set SevenDigitOutput(12) = P4D2
'Set SevenDigitOutput(13) = P4D1
'
'Set SevenDigitOutput(14) = P1D7
'Set SevenDigitOutput(15) = P1D6
'Set SevenDigitOutput(16) = P1D5
'Set SevenDigitOutput(17) = P1D4
'Set SevenDigitOutput(18) = P1D3
'Set SevenDigitOutput(19) = P1D2
'Set SevenDigitOutput(20) = P1D1
'
'Set SevenDigitOutput(21) = P2D7
'Set SevenDigitOutput(22) = P2D6
'Set SevenDigitOutput(23) = P2D5
'Set SevenDigitOutput(24) = P2D4