-
Notifications
You must be signed in to change notification settings - Fork 37
/
Creature From The Black Lagoon (Bally 1992)_1.2.vbs
1696 lines (1437 loc) · 56.2 KB
/
Creature From The Black Lagoon (Bally 1992)_1.2.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
'************************************************************
'************************************************************
'
' Creature from the Black Lagoon (Bally 1992) / IPD No. 588 / 4 Players
'
' Credits:
'
' VPX by fuzzel, flupper1
' Script by flupper, rothbauerw
' Primitives by fuzzel, flupper1
' Supported by randr, clarkkent, hauntfreaks
'
'************************************************************
'************************************************************
Option Explicit
Randomize
'******************************************************
' OPTIONS
'******************************************************
' Thalamus 2018-08-06
' Table has its own "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Changed UseSolenoids=1 to 2
' No special SSF tweaks yet.
Const EnableBallControl = true 'set to false to disable the C key from taking manual control
Const VolumeDial = 5 'Change bolume of hit events
Const RollingSoundFactor = 3 'set sound level factor here for Ball Rolling Sound, 1=default level
dim chaselightson, chaselightsintensity, chaselightsbloom, indirectlightsintensity, shadowopacity, bumperslit, fslutfading, dtlutfading
chaselightsintensity = 0.5 ' usable range is 0.5 - 1
chaselightsbloom = 1 ' 0 or 1 (0 for less bloom, 1 for more bloom)
indirectlightsintensity = 1 ' usable range is 0.5 - 1
shadowopacity = 90 ' usable range is 0 - 100 (90 default)
bumperslit = 0 ' 0 or 1 (0 bumpers without lights (original), 1 bumpers with lights
fslutfading = 1 ' 1 enables GI lut fading for full screen, 0 to disable
dtlutfading = 0 ' 1 enables GI lut fading for desk top, 0 to disable
'******************************************************
' STANDARD DEFINITIONS
'******************************************************
Dim Ballsize,BallMass
Ballsize = 50
Ballmass = 1.7
Const UseSolenoids = 2
' Thal : Added because of useSolenoid=2
Const cSingleLFlip = 0
Const cSingleRFlip = 0
Const UseLamps = 0
Const UseSync = 0
Const UseGI = 1
Const UseVPMModSol = 1
'******************************************************
' TABLE INIT
'******************************************************
if Version < 10400 then msgbox "This table requires Visual Pinball 10.4 beta or newer!" & vbnewline & "Your version: " & Version/1000
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
LoadVPM "01560000", "WPC.VBS", 3.50
Const cGameName="cftbl_l4"
dim bsSubway
Sub Table1_Init
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
.SplashInfoLine = "Creature from the Black Lagoon (Bally 1992)"
.HandleMechanics=0
.HandleKeyboard=0
.ShowDMDOnly=1
.ShowFrame=0
.ShowTitle=0
'.hidden = not table1.showdt
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
dim light
If chaselightsbloom = 0 Then
chaselightsintensity = chaselightsintensity * 8
For Each Light in chaselights: Light.Falloff=20:Light.Falloffpower=8:Light.IntensityScale = chaselightsintensity : Light.FadeSpeedUp = Light.IntensityScale * Light.Intensity / 20 : Light.FadeSpeedDown = Light.FadeSpeedUp / 3: Next
Else
For Each Light in chaselights: Light.IntensityScale = chaselightsintensity : Light.FadeSpeedUp = Light.IntensityScale * Light.Intensity / 20 : Light.FadeSpeedDown = Light.FadeSpeedUp / 3: Next
End If
For Each Light in indirectlights: Light.IntensityScale = indirectlightsintensity : Light.FadeSpeedUp = Light.IntensityScale * Light.Intensity / 60 : Light.FadeSpeedDown = Light.FadeSpeedUp : Next
Flasher21.opacity = shadowopacity
'************ Main Timer init ********************
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
'************ Nudging **************************
vpmNudge.TiltSwitch = 14
vpmNudge.Sensitivity = 5
'Add Slings - WJR
vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingShot, RightSlingShot)
'************ Trough **************************
sw58.CreateSizedballWithMass Ballsize/2,Ballmass
sw57.CreateSizedballWithMass Ballsize/2,Ballmass
sw56.CreateSizedballWithMass Ballsize/2,Ballmass
Controller.Switch(58) = 1
Controller.Switch(57) = 1
Controller.Switch(56) = 1
Controller.Switch(15) = 1
end sub
'******************************************************
' KEYS
'******************************************************
Sub Table1_KeyDown(ByVal keycode)
If keycode = PlungerKey Then
Plunger.PullBack
PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
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
'************************ Start Ball Control 1/3
if keycode = 46 then ' C Key
If contball = 1 Then
contball = 0
Else
contball = 1
End If
End If
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 Ball Control 1/3
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Table1_KeyUp(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Fire
PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
End If
'************************ Start Ball Control 2/3
'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 Ball Control 2/3
If vpmKeyUp(keycode) Then Exit Sub
End Sub
'******************************************************
' SOLENOIDS
'******************************************************
SolCallback(1) = "RightUpperKicker"
SolCallback(3) = "RightLowerKicker"
SolCallback(4) = "ReleaseBall"
SolCallback(12) = "SolOuthole"
'********Solenoids********
' SolCallBack(1) = "TopRightPopper"
' SolCallBack(2) = "SetLamp 103,"
' SolCallBack(3) = "bsSubway.SolOut"
' SolCallBack(4) = "bsTrough.SolOut"
SolCallBack(7) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
' SolCallBack(8) = "SetLamp 106,"
' SolCallBack(9) = "BackFlash"
' SolCallBack(10) = "SetLamp 100,"
' SolCallBack(11) = "CreatureFlash"
' SolCallBack(12) = "bsTrough.SolIn"
' SolCallBack(16) = "SetLamp 109,"
' SolCallBack(17) = "SetLamp 110,"
' SolCallBack(18) = "SetLamp 101,"
' SolCallBack(19) = "SetLamp 102,"
' ' SolCallBack(20) = "SeqGI1"
' ' SolCallBack(21) = "HologramPushMotor"
' SolCallBack(22) = "SetLamp 111,"
' SolCallBack(23) = "DropRUp"
' ' SolCallBack(24) = "SeqGI2"
' SolCallBack(25) = "StartMov"
' SolCallBack(26) = "DropRDown"
' SolCallBack(27) = "CreatureMotorMirror"
' SolCallBack(28) = "HoloLamp"
'
' '******Flipper Subs
'
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
'does not work properly with rom !!! so I did not use this, but for reference
'dim val1, val2,
'
'SolCallBack(20) = "SeqGI1"
'SolCallBack(24) = "SeqGI2"
'
'Sub SeqGI1(Enabled)
' If Enabled Then val1 = 1 Else val1 = 0 end if
' chaseval = val1 + val2
'End Sub
'
'Sub SeqGI2(Enabled)
' If Enabled Then val2 = 2 Else val2 = 0 end if
' chaseval = val1 + val2
'End Sub
dim chaseval
Sub swirlramplight1_Timer()
dim chase1, chase2, chase3, chase4
chaseval = chaseval + 1
If chaseval > 3 then chaseval = 0 end if
If chaselightson Then
Select Case chaseval
Case 0 : chase1 = 0 : chase2 = 1 : chase3 = 1 : chase4 = 1
Case 1 : chase1 = 1 : chase2 = 0 : chase3 = 1 : chase4 = 1
Case 2 : chase1 = 1 : chase2 = 1 : chase3 = 0 : chase4 = 1
Case 3 : chase1 = 1 : chase2 = 1 : chase3 = 1 : chase4 = 0
End Select
Else
chase1 = 0 : chase2 = 0 : chase3 = 0 : chase4 = 0
End if
swirlramplight1.state = chase1 : swirlramplight5.state = chase1 : swirlramplight9.state = chase1 : swirlramplight13.state = chase1 : swirlramplight17.state = chase1 : swirlramplight21.state = chase1 : swirlramplight25.state = chase1 : swirlramplight29.state = chase1
swirlramplight2.state = chase2 : swirlramplight6.state = chase2 : swirlramplight10.state = chase2 : swirlramplight14.state = chase2 : swirlramplight18.state = chase2 : swirlramplight22.state = chase2 : swirlramplight26.state = chase2 : swirlramplight30.state = chase2
swirlramplight3.state = chase3 : swirlramplight7.state = chase3 : swirlramplight11.state = chase3 : swirlramplight15.state = chase3 : swirlramplight19.state = chase3 : swirlramplight23.state = chase3 : swirlramplight27.state = chase3 : swirlramplight31.state = chase3
swirlramplight4.state = chase4 : swirlramplight8.state = chase4 : swirlramplight12.state = chase4 : swirlramplight16.state = chase4 : swirlramplight20.state = chase4 : swirlramplight24.state = chase4 : swirlramplight28.state = chase4 : swirlramplight32.state = chase4
if chase2=0 or swirlramplight2.intensityscale < 0.01 Then
wflash6.intensityScale=0
Else
wflash6.intensityscale=1
end if
if chase3=0 or swirlramplight3.intensityscale < 0.01 Then
wflash7.intensityScale=0
Else
wflash7.intensityscale=1
end if
End Sub
'******************************************************
' TROUGH
'******************************************************
Sub sw58_Hit():Controller.Switch(58) = 1:UpdateTrough:End Sub
Sub sw58_UnHit():Controller.Switch(58) = 0:UpdateTrough:End Sub
Sub sw57_Hit():Controller.Switch(57) = 1:UpdateTrough:End Sub
Sub sw57_UnHit():Controller.Switch(57) = 0:UpdateTrough:End Sub
Sub sw56_Hit():Controller.Switch(56) = 1:UpdateTrough:End Sub
Sub sw56_UnHit():Controller.Switch(56) = 0:UpdateTrough:End Sub
sub reflectionTrigger_Hit
if holoState=1 then
ActiveBall.ReflectionEnabled=0
end if
end sub
sub reflectionTrigger_UnHit
ActiveBall.ReflectionEnabled=1
end sub
Sub UpdateTrough()
UpdateTroughTimer.Interval = 300
UpdateTroughTimer.Enabled = 1
End Sub
Sub UpdateTroughTimer_Timer()
If sw56.BallCntOver = 0 Then sw57.kick 60, 9
If sw57.BallCntOver = 0 Then sw58.kick 60, 9
Me.Enabled = 0
End Sub
'******************************************************
' DRAIN & RELEASE
'******************************************************
Sub sw55_Hit() 'Drain
UpdateTrough
Controller.Switch(55) = 1
PlaySoundAT "drain", sw55
End Sub
Sub sw55_UnHit() 'Drain
Controller.Switch(55) = 0
End Sub
Sub SolOuthole(enabled)
If enabled Then
sw55.kick 60,20
PlaySoundAt SoundFX("solenoid",DOFContactors), sw55
End If
End Sub
Sub ReleaseBall(enabled)
If enabled Then
PlaySoundAt SoundFX("ballrelease",DOFContactors), sw56
sw56.kick 60, 12
UpdateTrough
End If
End Sub
'******************************************************
' RIGHT UPPER KICKER (sw34)
'******************************************************
Sub RightUpperKicker(enabled)
If enabled Then
sw34.kickz 0,45,1.56,0
PlaysoundAt SoundFX("solenoid",DOFContactors), sw34
If Controller.Switch(34) = True Then
PlaysoundAt SoundFX("vuk_exit",DOFContactors), sw34
End If
Controller.Switch(34) = 0
End If
End Sub
sub sw34_hit
PlaySoundAt "kicker_enter_center", sw34
Controller.Switch(34) = 1
End sub
'******************************************************
' RIGHT LOWER KICKER (sw37)
'******************************************************
Sub RightLowerKicker(enabled)
If enabled Then
sw37.kickz 180,20,1.56, 150
PlaysoundAt SoundFX("solenoid",DOFContactors), sw37
If Controller.Switch(37) = True Then
PlaysoundAt SoundFX("vuk_exit",DOFContactors), sw37
End If
Controller.Switch(37) = 0
End If
End Sub
sub sw37_hit
PlaySoundAt "kicker_enter_center", sw37
Controller.Switch(37) = 1
Stopsound "SubWay"
End sub
Sub sw17scoop_hit()
PlaySoundAt "scoopenter", sw17scoop
End Sub
Sub sw17_Hit()
PlaysoundAt "SubWay", sw17
vpmTimer.PulseSw 17
End Sub
Sub sw16scoop_hit()
PlaySoundAt "scoop_enter", sw17scoop
End Sub
Sub sw16_Hit()
PlaysoundAt "SubWay", sw16
vpmTimer.PulseSw 16
End Sub
'******************************************************
' FLIPPERS
'******************************************************
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, .67, AudioPan(LeftFlipper), 0.05,0,0,1,AudioFade(LeftFlipper)
LeftFlipper.RotateToEnd
Else
PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, AudioPan(LeftFlipper), 0.05,0,0,1,AudioFade(LeftFlipper)
LeftFlipper.RotateToStart
End If
End Sub
'
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, .67, AudioPan(RightFlipper), 0.05,0,0,1,AudioFade(RightFlipper)
RightFlipper.RotateToEnd
Else
PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, AudioPan(RightFlipper), 0.05,0,0,1,AudioFade(RightFlipper)
RightFlipper.RotateToStart
End If
End Sub
'******************************************************
' SWITCHES
'******************************************************
Sub sw51_Hit():VPMTimer.PulseSw 51:PlaySoundAt "Sensor", sw51: End Sub
Sub sw52_Hit():VPMTimer.PulseSw 52:PlaySoundAt "Sensor", sw52: End Sub
Sub sw53_Hit():VPMTimer.PulseSw 53:PlaySoundAt "Sensor", sw53: End Sub
Sub sw54_Hit():VPMTimer.PulseSw 54:PlaySoundAt "Sensor", sw54: End Sub
Sub sw15_Hit():controller.switch(15) = 0 :PlaySoundAt "Sensor", sw15: End Sub
Sub sw15_Unhit():controller.switch(15) = 1 End Sub
Sub sw25_Hit():VPMTimer.PulseSw 25:PlaySoundAt "Sensor", sw25: End Sub
Sub sw26_Hit():VPMTimer.PulseSw 26:PlaySoundAt "Sensor", sw26: End Sub
Sub sw27_Hit():VPMTimer.PulseSw 27:PlaySoundAt "Sensor", sw27: End Sub
Sub sw28_Hit():VPMTimer.PulseSw 28:PlaySoundAt "Sensor", sw28: End Sub
Sub sw41_Hit():VPMTimer.PulseSw 41:PlaySoundAt SoundFX("Target",DOFTargets), sw41: End Sub
Sub sw42_Hit():VPMTimer.PulseSw 42:PlaySoundAt SoundFX("Target",DOFTargets), sw42: End Sub
Sub sw43_Hit():VPMTimer.PulseSw 43:PlaySoundAt SoundFX("Target",DOFTargets), sw43: End Sub
Sub sw44_Hit():VPMTimer.PulseSw 44:PlaySoundAt SoundFX("Target",DOFTargets), sw44: End Sub
Sub sw63_Hit():VPMTimer.PulseSw 63:PlaySoundAt "Gate", sw63: End Sub
Sub sw35_Hit() 'Right Ramp Enter
VPMTimer.PulseSw 35
PlaySoundAt "Gate", sw35
If ActiveBall.vely < 0 then
PlaySound "RampEntrywGate", 0, Vol(ActiveBall)*0.5, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Else
StopSound "RampEntryGate"
End If
End Sub 'Right Ramp Enter
Sub sw36_Hit()
VPMTimer.PulseSw 36
PlaySoundAt "Gate", sw36
PlaySoundAt "Gate", sw36
If ActiveBall.vely < 0 then
PlaySound "RampEntrywGate", 0, Vol(ActiveBall)*0.5, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Else
StopSound "RampEntryGate"
End If
End Sub 'Left Ramp Enter
Sub sw61_Hit():VPMTimer.PulseSw 61:End Sub 'Right Ramp Exit
Sub sw62_Hit():VPMTimer.PulseSw 62:End Sub 'Left Ramp Exit
Sub sw64_Hit():VPMTimer.PulseSw 64:End Sub 'Upper Ramp Enter
Sub sw18_Hit():VPMTimer.PulseSw 18:PlaySoundAt "Gate", sw18: End Sub 'Center Shot
Sub sw65_Hit():VPMTimer.PulseSw 65:End Sub 'Pool switch
Sub sw66_Hit() : controller.switch(66) = 1 :PlaySoundAt "Sensor", sw66: End Sub 'Ball Shooter Lane
Sub sw66_UnHit() : controller.switch(66) = 0 : End Sub
'******************************************************
' BUMPERS
'******************************************************
Sub Bumper1_Hit()
PlaySoundAt SoundFX("fx_bumper1",DOFContactors), bumper1
vpmTimer.PulseSw 45
End Sub
Sub Bumper2_Hit()
PlaySoundAt SoundFX("fx_bumper1",DOFContactors), bumper2
vpmTimer.PulseSw 46
End Sub
Sub Bumper3_Hit()
PlaySoundAt SoundFX("fx_bumper1",DOFContactors), bumper3
vpmTimer.PulseSw 33
End Sub
'**************************************************************
' Moving Ramp
'**************************************************************
Dim RampAngle, RampDir
RampAngle= 0
RampDir = -1 '1 is up -1 is down dir
SolCallback(23) = "SolRampUp"
SolCallback(26) = "SolRampDown"
Sub SolRampUp(Enabled)
If Enabled Then
RampDir = 1
Controller.Switch(38) = False
UpdateRamp.Enabled = True
playsound SoundFX("diverter",DOFContactors)
End If
End Sub
Sub SolRampDown(Enabled)
If Enabled Then
RampDir = -1
Controller.Switch(38) = true
UpdateRamp.Enabled = True
playsound SoundFX("diverter",DOFContactors)
End If
End sub
Sub UpdateRamp_Timer
RampAngle = RampAngle + RampDir
If RampAngle> 0 Then '110
RampAngle = 0
RampDir=-1
UpdateRamp.Enabled = 0
collRamp.collidable=false
End If
If RampAngle < -25 Then
RampAngle = -25
RampDir=1
UpdateRamp.Enabled = 0
collRamp.collidable=true
End If
moveRamp.rotx=RampAngle
End Sub
Dim RStep, Lstep
Sub RightSlingShot_Slingshot
vpmTimer.pulsesw 48
PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
End Sub
Sub RightSlingShot_Timer
Select Case RStep
Case 2:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
Case 3:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
End Select
RStep = RStep + 1
End Sub
Sub LeftSlingShot_Slingshot
vpmTimer.pulsesw 47
PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
End Sub
Sub LeftSlingShot_Timer
Select Case LStep
Case 2:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
Case 3:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
End Select
LStep = LStep + 1
End Sub
'******************************************************
' CREATURE ANIMATION
'******************************************************
SolCallBack(27) = "CreatureMotorMirror"
SolCallBack(28) = "HoloLamp"
'SolCallBack(11) = "CreatureFlash"
dim holoState:holoState=0
dim holoIdx:holoIdx=18
dim posinc:posinc=1
Sub HoloLamp(enabled)
If enabled then
holoState=1
creature.visible=1
else
holoState=0
creature.visible=0
end if
End Sub
Sub CreatureFlash(enabled)
If enabled then
holoState=1
creature.visible=1
else
holoState=0
creature.visible=0
end if
End Sub
Sub CreatureMotorMirror(enabled)
if enabled then
Playsound SoundFX("Motor",DOFShaker),-1
holoIdx=18
posinc = 1
creatureTimer.enabled=1
else
Stopsound "Motor"
holoIdx=18
posinc = 1
creatureTimer.enabled=0
end if
End Sub
Sub creatureTimer_timer()
holoIdx=holoIdx+posinc
creature.visible=holoState
If holoIdx<1 then holoIdx=1:posinc=1
If holoIdx>46 then holoIdx=46:posinc=-1
creature.image = holoIdx
end Sub
sub startUpperLeftWireRamp_Hit
PlaySoundAtBall "WireRamp"
end Sub
sub endUpperLeftWireRamp_Hit():
StopSound "WireRamp":
vpmTimer.AddTimer 150, "PlayBallDrop endUpperLeftWireRamp, 0.1'"
end sub
Sub leftrampdrop_hit()
vpmTimer.AddTimer 150, "PlayBallDrop leftrampdrop, 0.1'"
End Sub
Sub rightrampdrop_hit()
vpmTimer.AddTimer 150, "PlayBallDrop rightrampdrop, 0.1'"
End Sub
Sub startCenterWireRamp_Hit
PlaySoundAtBall "CenterWireRamp"
End Sub
Sub stopCenterWireRamp_Hit
StopSound "CenterWireRamp"
End Sub
Sub swirlrampdrop_hit()
vpmTimer.AddTimer 150, "PlayBallDrop swirlrampdrop, 0.1'"
End Sub
Sub PlayBallDrop(obj,volume)
Playsound "BallDrop", 1, volume, AudioPan(obj), 0,0,0, 1, AudioFade(obj)'"
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
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
'*********************************************************************
' Supporting Ball & Sound Functions
'*********************************************************************
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 Vol(ball) ' Calculates the Volume of the sound based on the ball speed
Vol = Csng(BallVel(ball) ^2 / 2000)
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
'*****************************************
'************************ Start Ball Control 3/3
Sub StartBallControl_Hit()
Set ControlBall = ActiveBall
contballinplay = true
End Sub
Sub StopBallControl_Hit()
contballinplay = false
End Sub
Dim bcup, bcdown, bcleft, bcright
Dim contball, contballinplay, ControlBall
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)
Sub BallControlTimer_Timer()
If Contball and ContBallInPlay and EnableBallControl then
If bcright = 1 Then
ControlBall.velx = bcvel*bcboost
ElseIf bcleft = 1 Then
ControlBall.velx = - bcvel*bcboost
Else
ControlBall.velx=0
End If
If bcup = 1 Then
ControlBall.vely = -bcvel*bcboost
ElseIf bcdown = 1 Then
ControlBall.vely = bcvel*bcboost
Else
ControlBall.vely= bcyveloffset
End If
End If
End Sub
'************************ End Ball Control 3/3
'*****************************************
' JP's VP10 Rolling Sounds
'*****************************************
Const tnob = 5 ' total number of balls
ReDim rolling(tnob)
InitRolling
Sub InitRolling
Dim i
For i = 0 to tnob
rolling(i) = False
Next
End Sub
Sub BallRollingUpdate_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 AND BOT(b).z < 30 Then
StopSound("plasticroll" & b)
rolling(b) = True
PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b))*RollingSoundFactor, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
ElseIf BallVel(BOT(b) ) > 1 AND BOT(b).z > 30 Then
StopSound("fx_ballrolling" & b)
rolling(b) = True
PlaySound("plasticroll" & b), -1, Vol(BOT(b))*RollingSoundFactor*2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
Else
If rolling(b) = True Then
StopSound("fx_ballrolling" & b)
StopSound("plasticroll" & 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 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
End Sub
'*****************************************
' ninuzzu's FLIPPER SHADOWS
'*****************************************
sub FlipperTimer_Timer()
batleftshadow.objRotZ = LeftFlipper.currentangle
batrightshadow.objRotZ = RightFlipper.currentangle
batleft.objrotz = LeftFlipper.currentangle
batright.objrotz=RightFlipper.currentangle
End Sub
'*****************************************
' ninuzzu's BALL SHADOW
'*****************************************
Dim BallShadow
BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
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) + ((BOT(b).X - (Table1.Width/2))/40))
Else
BallShadow(b).X = ((BOT(b).X) + ((BOT(b).X - (Table1.Width/2))/40))
End If
ballShadow(b).Y = BOT(b).Y + 10
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)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Woods_Hit (idx)
PlaySound "woodhit", 0, Vol(ActiveBall)*VolumeDial*2, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Targets_Hit (idx)
PlaySound "target", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Metals_Thin_Hit (idx)
PlaySound "metalhit_thin", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Metals_Medium_Hit (idx)
PlaySound "metalhit_medium", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Metals2_Hit (idx)
PlaySound "metalhit2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Gates_Hit (idx)
PlaySound "gate4", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Spinner_Spin
PlaySound "fx_spinner", 0, .25*VolumeDial, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
End Sub
Sub Rubbers_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 20 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 6 AND finalspeed <= 20 then
RandomSoundRubber()
End If
End Sub
Sub Posts_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 16 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 6 AND finalspeed <= 16 then
RandomSoundRubber()
End If
End Sub
Sub RandomSoundRubber()
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
Sub LeftFlipper_Collide(parm)
RandomSoundFlipper()
End Sub
Sub RightFlipper_Collide(parm)