-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathBally Roller Derby 2.0.vbs
2559 lines (2327 loc) · 143 KB
/
Bally Roller Derby 2.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
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "You need the Controller.vbs file in order to run this table (installed with the VPX package in the scripts folder)"
On Error Goto 0
' Thalamus 2018-11-01 : Improved directional sounds
' Thalamus : tables seems to be lacking tilt routine
' !! 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
Const VolBump = 2 ' Bumpers volume.
Const VolRol = 1 ' Rollovers volume.
Const VolGates = 1 ' Gates volume.
Const VolMetal = 1 ' Metals volume.
Const VolRB = 1 ' Rubber bands volume.
Const VolRH = 1 ' Rubber hits volume.
Const VolPo = 1 ' Rubber posts volume.
Const VolPi = 1 ' Rubber pins volume.
Const VolPlast = 1 ' Plastics volume.
Const VolTarg = 1 ' Targets volume.
Const VolWood = 1 ' Woods volume.
Const VolKick = 1 ' Kicker volume.
Const VolSpin = 1.5 ' Spinners volume.
Const VolFlip = 1 ' Flipper volume.
Dim Attract
Dim AwardLR,AwardMR,AwardHR
Dim AwardLY,AwardMY,AwardHY
Dim AwardLG,AwardMG,AwardHG
Dim BIP
Dim BIL
Dim Bypass
Dim BWait
Dim credit,oldcredit,C
Dim Ballz
Dim ballinplay
Dim Coin
Dim LastB
Dim InProgress
Dim MX,MS,TT,xx,xxx,kk,ll,ff,ss,bb,fa,ex,sms,rl
Dim MaxCredit
Dim Odds
Dim Objekt
Dim Rollers
Dim ScreenLock
Dim RNDM,RNDMR,RNDMY,RNDMG,RNDMOK
Dim Red,Yellow,Green
Dim RArray,YArray,GArray,FArray,a,b,x
Dim EnableBallControl
EnableBallControl = false 'Change to true to enable manual ball control (or press C in-game) via the arrow keys and B (boost movement) keys
Const BallSize = 50 'Ball radius
'******************************************************************************************
'*************** Game Settings ***********************************************************
' Coin Choice: 1: Nickel (1 Credit)
' 2: Quarter (5 Credits
' 3: Half Dollar (10 Credits)
' 4: Dollar (20 Credits)
Coin = 4
'
' Max Credits: Set Maximium allowable buy-in credits to start (100 or less recommended, 999 Maximum)
'
MaxCredit = 100
'
'
'******************************************************************************************
'******************************************************************************************
RArray = Array(R1,R2,R3,R4,R5,R6,R7,R8)
YArray = Array(Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8)
GArray = Array(G1,G2,G3,G4,G5,G6,G7,G8)
FArray = Array(F1,F2,F3,F4,F5)
If Table1.ShowDT = True then
For each objekt in backdropstuff : objekt.visible = 1 : next
Else
For each objekt in backdropstuff : objekt.visible = 0 : next
End If
sub Table1_init
LoadEM
For each xx in GI:xx.State = 1: Next
MX=2
MS=2
TT=1
BIP = 0
Ballz = 6
RNDMR=1
RNDMY=1
RNDMG=1
RNDMOK=1
xxx = 1
LastB=0
Red = 0
Yellow =0
Green = 0
Attract = 1
InProgress = 0
ScreenLock = 0
gamov.text="GAME OVER"
ballz2play.text = ""
credittxt.setvalue(credit)
MagicScreen.setvalue(MX)
oldcredit=0
If B2SOn then
With Controller
.B2SSetCredits 1,MX
.B2SSetCredits 9,9
.B2SSetCredits 2,1
.B2SSetCredits 3,2
.B2SSetCredits 11,11
.B2SSetCredits 15,15
.B2SSetCredits 6,4
.B2SSetCredits 7,19
.B2SSetCredits 8,7
.B2SSetCredits 4,22
.B2SSetCredits 10,18
.B2SSetCredits 26,25
.B2SSetCredits 12,24
.B2SSetCredits 13,16
.B2SSetCredits 14,13
.B2SSetCredits 5,17
.B2SSetCredits 16,6
.B2SSetCredits 17,23
.B2SSetCredits 18,5
.B2SSetCredits 19,21
.B2SSetCredits 20,20
.B2SSetCredits 21,12
.B2SSetCredits 22,8
.B2SSetCredits 23,14
.B2SSetCredits 24,3
.B2SSetCredits 25,10
End With
End If
Playsound "IdleMachine",-1
End Sub
'-----------------------------------------------------------------------------------------
Sub coindelay_timer()
addcredit
coindelay.enabled=false
End Sub
Sub addcredit()
if credit > Maxcredit then Exit Sub
Select Case Coin
Case 1: credit = credit + 1
Case 2: credit = credit + 5
Case 3: credit = credit + 10
Case 4: credit = credit + 20
End Select
If credit > MaxCredit then credit = MaxCredit
UpdateCredits
End sub
Sub UpdateCredits()
C = Credit - OldCredit
credittxt.AddValue(C)
If B2SOn then
Controller.B2SSetCredits 29,Credit \ 10
Controller.B2SSetCredits 30,Credit Mod 10
Controller.B2SSetCredits 31,Credit \ 100
End If
If Credit > 998 then Credit = 999
If Credit = 999 then playsound "DoubleBells"
oldcredit=credit
End Sub
'-----------------------------------------------------------------------------------------
Sub Table1_KeyDown(ByVal keycode)
if keycode = 19 Then
if InProgress=0 then exit Sub
RollerCard.visible=True
RollerCard.image = "RollerCard"&rollers
end if
if keycode=AddCreditKey then
playsoundAtVol "coininsert", drain, 1
coindelay.enabled=true
end if
If keycode = PlungerKey Then
Plunger.PullBack
PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
End If
If keycode = 2 Then '*****Start Game #1
If Attract = 0 AND InProgress = 0 Then
NewGame
AttractOff
InProgress = 1
OldCredit = credit
End If
End If
If keycode = 3 Then '*****Blue Button (Scores) #2
If Credit > 0 AND InProgress = 0 Then
AttractOff
Credit = Credit - 1
For Each xx in Anticipation_Scores:xx.State = 2: Next
Anticipation_Scores_Timer.enabled = 1
If B2Son then Controller.B2SStartAnimation "scrs":End If
Scores
If Credit < 1 then Credit = 0
RandomSoundCycle
UpdateCredits
End If
End If
If keycode = 4 Then '*****Green Button (Features) #3
If Credit > 0 AND InProgress = 0 Then
AttractOff
Credit = Credit - 1
For Each xx in Anticipation:xx.State = 2: Next
Anticipation_Timer.enabled = 1
If B2Son then Controller.B2SStartAnimation "ftrs":End If
Features
If Credit < 1 then Credit = 0
RandomSoundCycle
UpdateCredits
End If
End If
If keycode = 5 Then '*****Red Button (Both) #4
If Credit > 0 AND InProgress = 0 Then
AttractOff
Credit = Credit - 1
For Each xx in Anticipation:xx.State = 2: Next
For Each xx in Anticipation_Scores:xx.State = 2: Next
Anticipation_Timer.enabled = 1
Anticipation_Scores_Timer.enabled = 1
If B2Son then
Controller.B2SStartAnimation "scrs"
Controller.B2SStartAnimation "ftrs"
End If
Select Case Int(Rnd*2)+1
Case 1: Scores
Case 2: Features
End Select
If Credit < 1 then Credit = 0
RandomSoundCycle
UpdateCredits
End If
End If
'-----------------------------------------------------------------------------------------
'******************Right/Left Arrows or Flipper Buttons = Scroll Magic Screen *******************************
' If keycode = 205 Then 'Right Arrow Key
If keycode = RightFlipperKey Then
If ScreenLock=1 then exit Sub
If InProgress=0 then exit Sub
IF LK.state = 1 then MS = 1 : End If
IF LO.state = 1 then MS = 2 : End If
IF LA.state = 1 then MS = 3 : End If
IF LB.state = 1 then MS = 4 : End If
IF LC.state = 1 then MS = 5 : End If
IF LD.state = 1 then MS = 6 : End If
IF LE.state = 1 then MS = 7 : End If
IF LF.state = 1 then MS = 8 : End If
IF LG.state = 1 then MS = 9 : End If
MX = MX + 1
IF MX > MS then MX = MS:End If
MagicScreen.setvalue(MX)
IF MX = MS then playsound "buzz":End If
IF MX <> MS then playsound "rotate":End If
If B2SOn then Controller.B2SSetCredits 1,MX
End If
' If keycode = 203 Then 'LeftArrow Key
If keycode = LeftFlipperKey Then
If Screenlock=1 then exit Sub
If InProgress=0 then exit Sub
IF MX = 0 then playsound "buzz": Exit Sub: End If
IF LK.state=0 and MX=2 then playsound "buzz": Exit Sub: End If
IF LO.state=0 and MX=1 then playsound "buzz": Exit Sub: End If
MX = MX - 1
IF MS = MX then MX = MS:End If
MagicScreen.setvalue(MX)
IF MX = MS then playsound "buzz":End If
IF MX <> MS then playsound "rotate":End If
If B2SOn then Controller.B2SSetCredits 1,MX
End If
'-----------------------------------------------------------------------------------------
'***************Nudge Keys **************************************************************
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 keycode = MechanicalTilt
' PlaySound "fx_nudge",0,1,1,0,25
' CheckTilt
End If
'-----------------------------------------------------------------------------------------
'************************************* Manual Ball Control*******************************
If keycode = 46 Then ' C Key
If EnableBallControl = 1 Then
EnableBallControl = 0
Else
EnableBallControl = 1
End If
End If
If EnableBallControl = 1 Then
If keycode = 48 Then ' B Key
If BCboost = 1 Then
BCboost = BCboostmulti
Else
BCboost = 1
End If
End If
If keycode = 203 Then BCleft = 1 ' Left Arrow
If keycode = 200 Then BCup = 1 ' Up Arrow
If keycode = 208 Then BCdown = 1 ' Down Arrow
If keycode = 205 Then BCright = 1 ' Right Arrow
End If
End Sub
'-----------------------------------------------------------------------------------------
Sub Table1_KeyUp(ByVal keycode)
if keycode = 19 Then 'R Key to show current "ROLLER" Card
if InProgress=0 then exit Sub
RollerCard.visible=false
end If
If keycode = PlungerKey Then
Plunger.Fire
PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
End If
If keycode = LeftFlipperKey Then
End If
If keycode = RightFlipperKey Then
End If
'************************************* Manual Ball Control*******************************
If EnableBallControl = 1 Then
If keycode = 203 Then BCleft = 0 ' Left Arrow
If keycode = 200 Then BCup = 0 ' Up Arrow
If keycode = 208 Then BCdown = 0 ' Down Arrow
If keycode = 205 Then BCright = 0 ' Right Arrow
End If
End Sub
'-----------------------------------------------------------------------------------------
Sub Drain_Hit()
Drain.DestroyBall
PlaySound "drain",0,1,AudioPan(Drain),0.25,0,0,1,AudioFade(Drain)
If BIL = 1 then BWait = 1:Exit Sub
Bypass=1
BallRelease.CreateBall
BallRelease.Kick 90, 7
PlaySound SoundFX("Ball_Lifter",DOFContactors), 0,1,AudioPan(BallRelease),0.25,0,0,1,AudioFade(BallRelease)
End Sub
Sub balltrigger_unHit()
If Bypass=1 then Bypass =0:Exit Sub
If BWait = 1 Then
BallRelease.CreateBall
BallRelease.Kick 90, 7
PlaySound SoundFX("Ball_Lifter",DOFContactors), 0,1,AudioPan(BallRelease),0.25,0,0,1,AudioFade(BallRelease)
BWait = 0
Else
If LastB=1 then Exit Sub
If InProgress=1 Then NextBall
End If
End Sub
Sub NextBall()
F21.State=0
BIP = BIP + 1
If BIP = Ballz Then LastB = 1: Exit Sub :End If
BallCountTimer.enabled=1
ScreenLock_Timer.enabled=1
BallRelease.CreateBall
BallRelease.Kick 90, 7
PlaySound SoundFX("Ball_Lifter",DOFContactors), 0,1,AudioPan(BallRelease),0.25,0,0,1,AudioFade(BallRelease)
End Sub
Sub BallCountTimer_Timer
Select Case xxx
Case 1: ballinplay1.text = 1:BallinPlay2.text = ""
Case 2: ballinplay2.text = 2:BallinPlay1.text = ""
Case 3: BallinPlay3.text = 3:BallinPlay2.text = ""
Case 4: BallinPlay4.text = 4:BallinPlay3.text = "":BallinPlay5.text = ""
Case 5: BallinPlay5.text = 5:BallinPlay4.text = "":BallinPlay6.text = ""
Case 6: BallinPlay6.text = 6:BallinPlay5.text = "":BallinPlay7.text = ""
Case 7: BallinPlay7.text = 7:BallinPlay6.text = "":Ballinplay8.text = ""
Case 8: Ballinplay8.text = 8:BallinPlay7.text = "":BallinPlay6.text = ""
End Select
xxx = xxx + 1
BallCountTimer.enabled=0
End Sub
Sub Trigger1_Hit(): BIL = 1:End Sub
Sub Trigger1_unHit(): BIL = 0:End Sub
Sub LastBall()
EndGame
End Sub
Sub ScreenLock_Timer_Timer
If BIP = 3 And F6.state=0 Then F21.State=2:End If
If BIP = 4 And F6.state=0 Then ScreenLock=1:End If
If BIP = 4 And F6.state=1 And F9.state=0 And F10.State=0 Then F21.State=2:End If
If BIP = 5 And F9.state=0 Then ScreenLock=1:End If
If BIP = 5 and F9.state=1 Then F21.State=2:End If
If BIP = 6 And F10.state=0 Then Screenlock=1:End If
If BIP = 6 And F10.state=1 Then F21.State=2:End If
If BIP > 6 Then ScreenLock=1:End If
ScreenLock_Timer.enabled=0
End Sub
'-----------------------------------------------------------------------------------------
Sub NewGame()
gamov.text=""
balls2play.text="BALL IN PLAY"
ballz2playText.text = "BALLS PER GAME"
ballz2play.text = (Ballz-1)
For each kk in Kickers:kk.DestroyBall:Next
Playsound "Balldrop"
For each ll in Num_Lights:ll.State = 0: Next
ScreenLock=0
LastB=0
BIP = 0
SS = 0
BB = 0
ex=1
sms = 1
xxx = 1
MX=2
MS=2
MagicScreen.setvalue(MX)
Select Case Int(Rnd*6)+1
Case 1: RedR.state=1 :Rollers=1
Case 2: RedO.state=1 :Rollers=2
Case 3: RedL.state=1 :Rollers=3
Case 4: RedL1.state=1 :Rollers=4
Case 5: RedE.state=1 :Rollers=5
Case 6: RedR1.state=1 :Rollers=6
End Select
RollerCard.image = "RollerCard"&rollers
If B2SOn then
Controller.B2SSetCredits 1,MX
for x = 101 to 125
Controller.B2SSetData (x),0
Next
End If
Playsound "StartGame"
AwardFeatures
NextBall
End Sub
Sub EndGame()
GameOverTimer.enabled=1
InProgress=0
gamov.text="GAME OVER"
For Each xx in BallsinPlayTxt:xx.text = "": Next
ballz2play.text = ""
End Sub
Sub GameOverTimer_Timer
' For Each xx in Score_Lights:xx.State = 2: Next
' For Each ff in Feature_lights:ff.State = 2: Next
Award
BIP = 0
Ballz = 6
xxx = 1
Attract = 1
RNDMR=1
RNDMY=1
RNDMG=1
RNDMOK=1
TT=1
F21.state=0
UpdateCredits
GameOverTimer.enabled=0
End Sub
Sub AttractOff()
If Attract = 0 then exit sub
For Each xx in Score_Lights:xx.State = 0: Next
For Each ff in Feature_lights:ff.State = 0: Next
For Each xx in RollerLights:xx.State = 0: Next
YellowLight.state=0
RedLight.state=0
Attract = 0
End Sub
Sub Anticipation_Timer_Timer
Anticipation_Timer.enabled=0
Stoplights.enabled=1
End Sub
Sub Anticipation_Scores_Timer_Timer
Anticipation_Scores_Timer.enabled=0
Stoplights.enabled=1
End Sub
Sub StopLights_Timer
For Each xx in Anticipation:xx.State = 0: Next
For Each xx in Anticipation_Scores:xx.State = 0: Next
Stoplights.enabled=0
End Sub
'-----------------------------------------------------------------------------------------
Sub BackglassTimer_Timer
If B2Son Then
If R1.state=1 then controller.B2SSetData 1,1 Else controller.B2SSetData 1,0:End If
If R2.state=1 then controller.B2SSetData 18,1 Else controller.B2SSetData 18,0:End If
If R3.state=1 then controller.B2SSetData 19,1 Else controller.B2SSetData 19,0:End If
If R4.state=1 then controller.B2SSetData 20,1 Else controller.B2SSetData 20,0:End If
If R5.state=1 then controller.B2SSetData 21,1 Else controller.B2SSetData 21,0:End If
If R6.state=1 then controller.B2SSetData 22,1 Else controller.B2SSetData 22,0:End If
If R7.state=1 then controller.B2SSetData 23,1 Else controller.B2SSetData 23,0:End If
If R8.state=1 then controller.B2SSetData 24,1 Else controller.B2SSetData 24,0:End If
If Y1.state=1 then controller.B2SSetData 10,1 Else controller.B2SSetData 10,0:End If
If Y2.state=1 then controller.B2SSetData 11,1 Else controller.B2SSetData 11,0:End If
If Y3.state=1 then controller.B2SSetData 12,1 Else controller.B2SSetData 12,0:End If
If Y4.state=1 then controller.B2SSetData 13,1 Else controller.B2SSetData 13,0:End If
If Y5.state=1 then controller.B2SSetData 14,1 Else controller.B2SSetData 14,0:End If
If Y6.state=1 then controller.B2SSetData 15,1 Else controller.B2SSetData 15,0:End If
If Y7.state=1 then controller.B2SSetData 16,1 Else controller.B2SSetData 16,0:End If
If Y8.state=1 then controller.B2SSetData 17,1 Else controller.B2SSetData 17,0:End If
If G1.state=1 then controller.B2SSetData 25,1 Else controller.B2SSetData 25,0:End If
If G2.state=1 then controller.B2SSetData 26,1 Else controller.B2SSetData 26,0:End If
If G3.state=1 then controller.B2SSetData 27,1 Else controller.B2SSetData 27,0:End If
If G4.state=1 then controller.B2SSetData 28,1 Else controller.B2SSetData 28,0:End If
If G5.state=1 then controller.B2SSetData 29,1 Else controller.B2SSetData 29,0:End If
If G6.state=1 then controller.B2SSetData 30,1 Else controller.B2SSetData 30,0:End If
If G7.state=1 then controller.B2SSetData 31,1 Else controller.B2SSetData 31,0:End If
If G8.state=1 then controller.B2SSetData 32,1 Else controller.B2SSetData 32,0:End If
If F1.state=1 then controller.B2SSetData 38,1 Else controller.B2SSetData 38,0:End If
If F2.state=1 then controller.B2SSetData 39,1 Else controller.B2SSetData 39,0:End If
If F3.state=1 then controller.B2SSetData 40,1 Else controller.B2SSetData 40,0:End If
If F4.state=1 then controller.B2SSetData 41,1 Else controller.B2SSetData 41,0:End If
If F5.state=1 then controller.B2SSetData 42,1 Else controller.B2SSetData 42,0:End If
If F6.state=1 then controller.B2SSetData 43,1 Else controller.B2SSetData 43,0:End If
If F7.state=1 then controller.B2SSetData 44,1 Else controller.B2SSetData 44,0:End If
If F8.state=1 then controller.B2SSetData 45,1 Else controller.B2SSetData 45,0:End If
If F9.state=1 then controller.B2SSetData 46,1 Else controller.B2SSetData 46,0:End If
If F10.state=1 then controller.B2SSetData 47,1 Else controller.B2SSetData 47,0:End If
If F21.state=2 then controller.B2SSetData 49,1 Else controller.B2SSetData 49,0:End If
If EB.state=1 then controller.B2SSetData 50,1 Else controller.B2SSetData 50,0:End If
If EB1.state=1 then controller.B2SSetData 51,1 Else controller.B2SSetData 51,0:End If
If EB2.state=1 then controller.B2SSetData 52,1 Else controller.B2SSetData 52,0:End If
If LO.state=1 then controller.B2SSetData 53,1 Else controller.B2SSetData 53,0:End If
If LK.state=1 then controller.B2SSetData 54,1 Else controller.B2SSetData 54,0:End If
If LA.state=1 then controller.B2SSetData 55,1 Else controller.B2SSetData 55,0:End If
If LB.state=1 then controller.B2SSetData 56,1 Else controller.B2SSetData 56,0:End If
If LC.state=1 then controller.B2SSetData 57,1 Else controller.B2SSetData 57,0:End If
If LD.state=1 then controller.B2SSetData 58,1 Else controller.B2SSetData 58,0:End If
If LE.state=1 then controller.B2SSetData 59,1 Else controller.B2SSetData 59,0:End If
If LF.state=1 then controller.B2SSetData 60,1 Else controller.B2SSetData 60,0:End If
If LG.state=1 then controller.B2SSetData 61,1 Else controller.B2SSetData 61,0:End If
If RedR.state=1 then controller.B2SSetData 62,1 Else controller.B2SSetData 62,0:End If
If RedO.state=1 then controller.B2SSetData 63,1 Else controller.B2SSetData 63,0:End If
If RedL.state=1 then controller.B2SSetData 64,1 Else controller.B2SSetData 64,0:End If
If RedL1.state=1 then controller.B2SSetData 65,1 Else controller.B2SSetData 65,0:End If
If RedE.state=1 then controller.B2SSetData 66,1 Else controller.B2SSetData 66,0:End If
If RedR1.state=1 then controller.B2SSetData 67,1 Else controller.B2SSetData 67,0:End If
End If
End Sub
' *******************************************************************************************************
' Positional Sound Playback Functions by DJRobX
' 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 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)
End Sub
'Set all as per ball position & speed, but Vol Multiplier may be used eg; PlaySoundAtBallVol "sound",3
Sub PlaySoundAtBallVol(sound, VolMult)
PlaySound sound, 0, Vol(ActiveBall) * VolMult, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
End Sub
'Set position as bumperX and Vol manually.
Sub PlaySoundAtBumperVol(sound, tableobj, Vol)
PlaySound sound, 1, Vol, AudioPan(tableobj), 0,0,1, 1, AudioFade(tableobj)
End Sub
'*********************************************************************
' Supporting Ball & Sound Functions
'*********************************************************************
Function RndNum(min, max)
RndNum = Int(Rnd() * (max-min + 1) ) + min ' Sets a random number between min and max
End Function
Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
Dim tmp
tmp = tableobj.y * 2 / table1.height-1
If tmp > 0 Then
AudioFade = Csng(tmp ^10)
Else
AudioFade = Csng(-((- tmp) ^10) )
End If
End Function
Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
Dim tmp
tmp = tableobj.x * 2 / table1.width-1
If tmp > 0 Then
AudioPan = Csng(tmp ^10)
Else
AudioPan = Csng(-((- tmp) ^10) )
End If
End Function
Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
Dim tmp
tmp = ball.x * 2 / table1.width-1
If tmp > 0 Then
Pan = Csng(tmp ^10)
Else
Pan = Csng(-((- tmp) ^10) )
End If
End Function
Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
Vol = Csng(BallVel(ball) ^2 / VolDiv)
End Function
Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
Pitch = BallVel(ball) * 20
End Function
Function BallVel(ball) 'Calculates the ball speed
BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
End Function
'*****************************************
' rothbauerw's Manual Ball Control
'*****************************************
Dim BCup, BCdown, BCleft, BCright
Dim ControlBallInPlay, ControlActiveBall
Dim BCvel, BCyveloffset, BCboostmulti, BCboost
BCboost = 1 'Do Not Change - default setting
BCvel = 4 'Controls the speed of the ball movement
BCyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
BCboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
ControlBallInPlay = false
Sub StartBallControl_Hit()
Set ControlActiveBall = ActiveBall
ControlBallInPlay = true
End Sub
Sub StopBallControl_Hit()
ControlBallInPlay = false
End Sub
Sub BallControlTimer_Timer()
If EnableBallControl and ControlBallInPlay then
If BCright = 1 Then
ControlActiveBall.velx = BCvel*BCboost
ElseIf BCleft = 1 Then
ControlActiveBall.velx = -BCvel*BCboost
Else
ControlActiveBall.velx = 0
End If
If BCup = 1 Then
ControlActiveBall.vely = -BCvel*BCboost
ElseIf BCdown = 1 Then
ControlActiveBall.vely = BCvel*BCboost
Else
ControlActiveBall.vely = bcyveloffset
End If
End If
End Sub
'*****************************************
' JP's VP10 Rolling Sounds
'*****************************************
Const tnob = 10 ' total number of balls
ReDim rolling(tnob)
InitRolling
Sub InitRolling
Dim i
For i = 0 to tnob
rolling(i) = False
Next
End Sub
Sub RollingTimer_Timer()
Dim BOT, b
BOT = GetBalls
' stop the sound of deleted balls
For b = UBound(BOT) + 1 to tnob
rolling(b) = False
StopSound("fx_ballrolling" & b)
Next
' exit the sub if no balls on the table
If UBound(BOT) = -1 Then Exit Sub
' play the rolling sound for each ball
For b = 0 to UBound(BOT)
If BallVel(BOT(b) ) > 1 Then
rolling(b) = True
if BOT(b).z < 30 Then ' Ball on playfield
PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), AudioPan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0, AudioFade(BOT(b) )
Else ' Ball on raised ramp
PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) )*.5, AudioPan(BOT(b) ), 0, Pitch(BOT(b) )+50000, 1, 0, AudioFade(BOT(b) )
End If
Else
If rolling(b) = True Then
StopSound("fx_ballrolling" & b)
rolling(b) = False
End If
End If
Next
End Sub
'**********************
' Ball Collision Sound
'**********************
Sub OnBallBallCollision(ball1, ball2, velocity)
PlaySound("fx_collide"), 0, Csng(velocity) ^2 / (VolDiv/VolCol), AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
End Sub
'*****************************************
' ninuzzu's BALL SHADOW
'*****************************************
Dim BallShadow
BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5,BallShadow6,BallShadow7,BallShadow8,BallShadow9,BallShadow10)
Sub BallShadowUpdate_timer()
Dim BOT, b
BOT = GetBalls
' 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
' exit the Sub if no balls on the table
If UBound(BOT) = -1 Then Exit Sub
' 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
'*****************************************
Sub Pins_Hit (idx)
PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Metals_Thin_Hit (idx)
PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Metals_Medium_Hit (idx)
PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Metals2_Hit (idx)
PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Gates_Hit (idx)
PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Rubber_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 10 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 2 AND finalspeed <= 10 then
RandomSoundRubber()
End If
End Sub
Sub RandomSoundRubber()
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
Sub RandomSoundCycle()
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "cycle1"
Case 2 : PlaySound "cycle2"
Case 3 : PlaySound "cycle3"
End Select
End Sub
Sub Kicker1_Hit()
L1.state=1
If B2Son Then controller.B2SSetData 101,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker2_Hit()
L2.state=1
If B2Son Then controller.B2SSetData 102,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker3_Hit()
L3.state=1
If B2Son Then controller.B2SSetData 103,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker4_Hit()
L4.state=1
If B2Son Then controller.B2SSetData 104,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker5_Hit()
L5.state=1
If B2Son Then controller.B2SSetData 105,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker6_Hit()
L6.state=1
If B2Son Then controller.B2SSetData 106,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker7_Hit()
L7.state=1
If B2Son Then controller.B2SSetData 107,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker8_Hit()
L8.state=1
If B2Son Then controller.B2SSetData 108,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker9_Hit()
L9.state=1
If B2Son Then controller.B2SSetData 109,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall:End If
End Sub
Sub Kicker10_Hit()
L10.state=1
If B2Son Then controller.B2SSetData 110,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker11_Hit()
L11.state=1
If B2Son Then controller.B2SSetData 111,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker12_Hit()
L12.state=1
If B2Son Then controller.B2SSetData 112,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker13_Hit()
L13.state=1
If B2Son Then controller.B2SSetData 113,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker14_Hit()
L14.state=1
If B2Son Then controller.B2SSetData 114,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker15_Hit()
L15.state=1
If B2Son Then controller.B2SSetData 115,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker16_Hit()
L16.state=1
If B2Son Then controller.B2SSetData 116,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker17_Hit()
L17.state=1
If B2Son Then controller.B2SSetData 117,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker18_Hit()
L18.state=1
If B2Son Then controller.B2SSetData 118,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker19_Hit()
L19.state=1
If B2Son Then controller.B2SSetData 119,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker20_Hit()
L20.state=1
If B2Son Then controller.B2SSetData 120,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker21_Hit()
L21.state=1
If B2Son Then controller.B2SSetData 121,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker22_Hit()
L22.state=1
If B2Son Then controller.B2SSetData 122,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker23_Hit()
L23.state=1
If B2Son Then controller.B2SSetData 123,1 :End If
Playsound "WoodHit" : If LastB=1 Then LastBall
End Sub
Sub Kicker24_Hit()
L24.state=1
If B2Son Then controller.B2SSetData 124,1 :End If