-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathTaxi (Williams 1988) VPW.vbs
2933 lines (2467 loc) · 109 KB
/
Taxi (Williams 1988) VPW.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
' Taxi - IPDB No. 2505
' © Williams 1988
' https://www.ipdb.org/machine.cgi?id=2505
'
'*** V-Pin Workshop TFTC Team ***
'Tomate - Project Manager, new primitives and textures.
'Bord - nFozzy flippers and physics
'apophis - Fleep sound, rtx shadows, general tweaks.
'Sixtoe - VR Stuff, lots of fiddling about.
'oqqsan - Playfield inserts and fading GI.
'UnclePaulie - VR backbox improvements & fixes.
'fluffhead35 - Physics tweaks.
'
'Based on the Taxi VPX v1.2 table by ICPJuggla, Mfuegemann, Dark & Ben Logan.
'
'**CHANGE LOG **
' 001 - bord - Added nFozzy flippers and physics
' 002 - apophis - Added Fleep sound package
' 003 - apophis - Added missing knockerposition prim
' 004 - tomate - New flippers prims added
' 005 - tomate - Shadows flippers size fixed
' 006 - Sixtoe - VR stuff, fully operational built in backbox / dmd / backglass, fixed loads of light and glow weirdness, unified timers, added cabinet mode.
' 007 - tomate - upper left VUK direction corrected, exits of collidable wireRamps fixed, metal wall near express lane2 fixed, cab POV corrected
' 009 - tomate - new giOn baked textures added, warm lut added, plastic Ramps textures retouched with a warm photo filter to match
' 010 - tomate - some giOff textures aded, slingshots missing sounds fixed, deformed slings rubbers replaced by prims
' 011 - oqqsan - inserts and 4step sidewalls and pf .. needs adjustments
' 012 - tomate - rest of giOff textures added, plastics textures added to 4 steps fade, some GI lights repositioned, textures size optimized
' 013 - Sixtoe - Removed one set of GI, hooked it all back up and dropped under playfield, tidied up assets, set old walls to non-visible to stop clashes, played with loads of lights, removed redundant scripts and images.
' 014 - iaakki - fiddled with GI steps and PF flasher. Fixed flip shadow DP and Z issues. tied some prims to gi steps
' 015 - apophis - Replaced the ringing_bell sound effect. Increased alpha mask on PF images to get rid of insert jaggies. Increased inserts DL. Fixed BS DB.
' 016 - apophis - Added RTX BS. Fixed GI lights so that ball reflection work now.
' 017 - UnclePaulie - Animated the VR backglass flasher Lights. Fixed the jackpot displays. Hid the desktop / cabinet mode backbox lights. Moved ball shadow primatives. Added a VRCab bottom so you can't see the floor through cab.
' 018 - apophis - Updated RTX BS. Added target bouncer, flipper rubberizer, and flipper coil ramp up options. Fixed ball bouncing out left outlane after ramp drop.
' 019 - Sixtoe - Fixed playfield rendering weirdly, numerous other tweaks and adjustments, adjusted some lights, put the roof back on the spinout
' 020 - apophis - Fixed RTX shadow DB issue. Chnaged rampsDecals DL from below to 0 and DB to -100. Added a differnt ball HDR. Messed with the DT mode backglass.
' 021 - fluffhead35 - Updated Flipper Physics to be inline with nfozzy
' 022 - Sixtoe - Added physical wires under flippers and outlanes, hooked up bumpers to GI system, adjust shooter lane gate, messed around the table lights again including materials, set height walls to non-collidable.
' 023 - Sixtoe - Fixed GI, added bumper bulbs to GI system, some small tweaks and fixes here and there.
' 024 - apophis - Revered the DT backglass object positions. Force GI on at table initialization. Changed flipper DB. Increased plunger strength/speed. Increased target hit volume.
' 025 - iaakki - flip trigger areas reworked, rdampen 10ms timer added, rubberizer options added, catapult timer improved, tied drop target DL to GI, fixed insert fading for few inserts
' 026 - apophis - finished up fixing inserts fading
' 027 - Sixtoe - Target bounce set to 1.5
' 1.01 - iaakki - Null error fix workaround, Wall009 added near apron, Wall010, Wall011, Wall012 added everywhere, GI bulbs reworked, RTXBS adjusted.
' 1.02 - Sixtoe - Added denoised playfield, adjusted some gi things, fixed broken primitive shooter walls, removed duplicate post prim, hooked up bulb prims to GI system, fixed several duplicate and wrong position prims, added original red flipper optionm, updated description
' 1.1 - Sixtoe - Fixed blocker wall problems
' 1.2 - apophis - Fixed divide by zero bug
' 1.2.1 - apophis - removed ball shadow z-position dependency on ball z-position. Fixed walls_hit function.
' 1.2.2 - Hauntfreaks - New DT backdrop, and fixed up the DT lights (I didnt touch anything on the table)
Option Explicit
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
'///////////////////////-----General Sound Options-----///////////////////////
'// VolumeDial:
'// VolumeDial is the actual global volume multiplier for the mechanical sounds.
'// Values smaller than 1 will decrease mechanical sounds volume.
'// Recommended values should be no greater than 1.
Const VolumeDial = 0.8
'///////////////////////-----VR Room-----///////////////////////
Const VRRoom = 0 '0 - VR Room off, 1 - Minimal Room, 2 - Ultra Minimal
'/////////////////////-----Cabinet Mode-----/////////////////////
Const CabinetMode = 0 '0 - Off, 1 - Hides rails & scales side panels
'/////////////////////-----Ball Shadows-----/////////////////////
Const RtxBSon = 1 '0 = no RTX ball shadow, 1 = enable RTX ball shadow
'/////////////////////----Flipper Colour----/////////////////////
Const FlipperColour = 1 '0 = Blue / Yellow, 1 = Red / Yellow
'/////////////////////-----Physics Mods-----/////////////////////
Const RubberizerEnabled = 1 '0 = normal flip rubber, 1 = more lively rubber for flips, 2 = different rubberizer
Const FlipperCoilRampupMode = 0 '0 = fast, 1 = medium, 2 = slow (tap passes should work)
Const TargetBouncerEnabled = 1 '0 = normal standup targets, 1 = bouncy targets
Const TargetBouncerFactor = 1.0 'Level of bounces. 0.2 - 1.5 are probably usable values.
Const cGameName = "taxi_l4"
Const UseSolenoids = 2
Const UseLamps = 0
Const UseSync = 1
Const BallSize = 50
Const BallMass = 1
LoadVPM "01560000", "S11.VBS", 3.26
Dim DesktopMode: DesktopMode = Taxi.ShowDT
'-----------------------------------
'------ Solenoid Assignment ------
'-----------------------------------
SolCallback(1) = "bsTrough.SolIn"
SolCallback(2) = "bsTrough.SolOut"
SolCallback(3) = "SolCatapult"
SolCallback(4) = "CenterDTBank.SolDropUp"
SolCallback(5) = "bsTopHole.SolOut"
SolCallback(6) = "RightDTBank.SolDropUp"
SolCallback(7) = "SolSpinoutKicker"
SolCallback(8) = "bsRightHole.SolOut"
Solcallback(9) = "TopGateLeft.open ="
SolCallback(10) = "Sol10" 'Insert Gen Illum Relay
SolCallback(11) = "Sol11" 'Playfield Gen Illumination
'SolCallback(12) = 'A/C Select Relay
SolCallback(13) = "vpmSolSound SoundFX(""ringing_bell"",DOFBell),"
SolCallback(14) = "SolKnocker"
'SolCallback(15) = 'JACKPOT Flasher - handled in LampTimer
SolCallback(16) = "SetLamp 116," 'JOYRIDE Flasher - handled in LampTimer too
'SolCallback(17) = 'Bumper
'SolCallback(18) = 'Sling
'SolCallback(19) = 'Bumper
'SolCallback(20) = 'Sling
'SolCallback(21) = 'Bumper
SolCallback(23) = "SolGameOn"
SolCallback(25) = "SetLamp 125," 'Pinbot Insert - handled in LampTimer
SolCallback(26) = "SetLamp 126," 'Drac Insert - handled in LampTimer
SolCallback(27) = "SetLamp 127," 'Lola Insert - handled in LampTimer
SolCallback(28) = "SetLamp 128," 'Santa Insert - handled in LampTimer
SolCallback(29) = "SetLamp 129," 'Gorby Insert - handled in LampTimer
SolCallback(30) = "SetLamp 130," 'Left Ramp Flasher
SolCallback(31) = "SetLamp 131," 'Right Ramp Flasher
SolCallback(32) = "SetLamp 132," 'Spinout Flasher
Dim FlipperActive
FlipperActive = False
Sub SolGameOn(enabled)
FlipperActive = enabled
VpmNudge.SolGameOn(enabled)
if not FlipperActive then
RightFlipper.RotateToStart
LeftFlipper.RotateToStart
end if
End Sub
'Catapult
Sub SolCatapult(enabled)
if enabled then
FireCatapult
if Controller.Switch(35) then
bsCatapult.ExitSol_On
end If
end if
End Sub
Sub SolKnocker(Enabled)
If enabled Then
KnockerSolenoid 'Add knocker position object
End If
End Sub
Dim CatapultDir
Sub FireCatapult
catapultLaunchKicker.Timerenabled = False
CatapultDir = 15
catapultLaunchKicker.Timerenabled = True
End Sub
Sub catapultLaunchKicker_Timer
P_Catapult.rotx = P_Catapult.rotx + CatapultDir
if P_Catapult.rotx > 90 then
P_Catapult.rotx = 90
CatapultDir = -5
end if
if P_Catapult.rotx < 0 then
catapultLaunchKicker.Timerenabled = False
P_Catapult.rotx = 0
CatapultDir = 0
end if
end Sub
'Spinout Kicker
Sub SolSpinoutKicker(enabled)
if enabled then
bsSpinOutKicker.ExitSol_On
P_Spinout.TransZ = -60
SpinOutKicker.Timerenabled = True
end if
End Sub
Sub SpinOutKicker_Timer
P_Spinout.TransZ = P_Spinout.TransZ + 1
if P_Spinout.TransZ >= 0 then
SpinOutKicker.Timerenabled = False
P_Spinout.TransZ = 0
end if
end Sub
' GI
Sub Sol10(enabled)
SetLamp 99,enabled '#99 used for GI Inserts
End Sub
Dim GIstep : GIstep=2
Dim GiTarget : GiTarget=1
Dim BumpGI
Sub Imagetimer
if Gistep <> -1 then
If Gistep>GITarget Then
GIstep=GIstep-1
' Taxi.image="Taxi_PF0" & GIstep : debug.print GIstep
SideWood1.image="giCab_" & GIstep
SideWood.image="giCab_" & GIstep
plastics.image="giPlastics_" & GIstep
End If
If Gistep<GITarget Then
GIstep=GIstep+1
' Taxi.image="Taxi_PF0" & GIstep : debug.print gistep
SideWood1.image="giCab_" & GIstep
SideWood.image="giCab_" & GIstep
plastics.image="giPlastics_" & GIstep
End If
if GIstep = 1 Then
Playfield_Flasher.opacity=0
Playfield_Flasher.visible = False
Primitive_Ramp2.blenddisablelighting = 1.3
Primitive_SpintoutRamp.blenddisablelighting = 0.2
for each BumpGI in Bumperlamps:BumpGI.blenddisablelighting = 20:Next
for each BumpGI in Bumper_Col:BumpGI.blenddisablelighting = 2:Next
RFLogo.blenddisablelighting = 0.5 : LFLogo.blenddisablelighting = 0.5
GIstep = -1
elseif GIstep = 4 Then
Playfield_Flasher.opacity=100
Playfield_Flasher.visible = True
Primitive_Ramp2.blenddisablelighting = 0.3
Primitive_SpintoutRamp.blenddisablelighting = 0
for each BumpGI in Bumperlamps:BumpGI.blenddisablelighting = 0:Next
for each BumpGI in Bumper_Col:BumpGI.blenddisablelighting = 0:Next
RFLogo.blenddisablelighting = 0.3 : LFLogo.blenddisablelighting = 0.3
GIstep = -1
Else
Playfield_Flasher.opacity= (GIstep-1)*33
Playfield_Flasher.visible = True
Primitive_Ramp2.blenddisablelighting = (1-(((GIstep-1)*33)/100)) + 0.3
Primitive_SpintoutRamp.blenddisablelighting = 0.2 * (1-(((GIstep-1)*33)/100))
for each BumpGI in Bumperlamps:BumpGI.blenddisablelighting = (1-(((GIstep-1)*33)/100)) + 19:Next
for each BumpGI in Bumper_Col:BumpGI.blenddisablelighting = (1-(((GIstep-1)*33)/100)) + 1:Next
LFLogo.blenddisablelighting = 0.2 * (1-(((GIstep-1)*33)/100)) + 0.3
RFLogo.blenddisablelighting = 0.2 * (1-(((GIstep-1)*33)/100)) + 0.3
end if
'debug.print Gistep & " - " & (((GIstep-1)*33)/100) & " --> " & Primitive_Ramp2.blenddisablelighting
end if
End Sub
dim obj
Sub Sol11(enabled) 'inverse action, GI is Off if Solenoid is enabled
dim x
If enabled Then
GiTarget=4 : GIstep=1
debug.print "GIOFF"
Primitive_Ramp2.image = "giOff_ramps"
expressLanes.image="giOff_expressLanes"
rampsDecals.image="giOff_expressLanes"
metals01.image="giOff_metals"
backwallPrim.image="giOff_backwall"
wireRamps.image="giOff_wireramps"
rubbers_prim.image="giOff_rubbers"
LSling.image="giOff_rubbers"
LSling1.image="giOff_rubbers"
LSling2.image="giOff_rubbers"
RSling.image="giOff_rubbers"
RSling1.image="giOff_rubbers"
RSling2.image="giOff_rubbers"
screws.image="giOff_screws"
For each x in Targets
x.blenddisablelighting = 0
Next
For each x in GI
x.State = 0
Next
Else
GiTarget=1 : Gistep=4
debug.print "GION"
Primitive_Ramp2.image = "giOn_ramps"
expressLanes.image="giOn_expressLanes"
rampsDecals.image="giOn_expressLanes"
metals01.image="giOn_metals"
backwallPrim.image="giOn_backwall"
wireRamps.image="giOn_wireramps"
rubbers_prim.image="giOn_rubbers"
LSling.image="giOn_rubbers"
LSling1.image="giOn_rubbers"
LSling2.image="giOn_rubbers"
RSling.image="giOn_rubbers"
RSling1.image="giOn_rubbers"
RSling2.image="giOn_rubbers"
screws.image="giOn_screws"
For each x in Targets
x.blenddisablelighting = 0.3
Next
For each x in GI
x.State = 1
Next
end If
End Sub
Sub Gametimer_Timer()
FlipperTimer
DTCheckTimer
RollingTimer
LampTimer
'rdampen
Displaytimer
Imagetimer
If VRRoom<>0 then
If Controller.Lamp(1) = 0 Then: bg_f1.visible=0: else: bg_f1.visible=1
If Controller.Lamp(2) = 0 Then: bg_f2.visible=0: else: bg_f2.visible=1
If Controller.Lamp(3) = 0 Then: bg_f3.visible=0: else: bg_f3.visible=1
If Controller.Lamp(4) = 0 Then: bg_f4.visible=0: else: bg_f4.visible=1
If Controller.Lamp(5) = 0 Then: bg_f5.visible=0: else: bg_f5.visible=1
If Controller.Lamp(24) = 0 Then: PinCab_BG_s24.visible=0: else: PinCab_BG_s24.visible=1
If Controller.Lamp(25) = 0 Then: PinCab_BG_s25.visible=0: else: PinCab_BG_s25.visible=1
If Controller.Lamp(26) = 0 Then: PinCab_BG_s26.visible=0: else: PinCab_BG_s26.visible=1
If Controller.Lamp(27) = 0 Then: PinCab_BG_s27.visible=0: else: PinCab_BG_s27.visible=1
If Controller.Lamp(28) = 0 Then: PinCab_BG_s28.visible=0: else: PinCab_BG_s28.visible=1
If Controller.Lamp(29) = 0 Then: PinCab_BG_s29.visible=0: else: PinCab_BG_s29.visible=1
If Controller.Lamp(31) = 0 Then: PinCab_BG_s31.visible=0: else: PinCab_BG_s31.visible=1
If Controller.Lamp(32) = 0 Then: PinCab_BG_s32.visible=0: else: PinCab_BG_s32.visible=1
If Controller.Lamp(53) = 0 Then: PinCab_BG_s53.visible=0: else: PinCab_BG_s53.visible=1
If Controller.Lamp(54) = 0 Then: PinCab_BG_s54.visible=0: else: PinCab_BG_s54.visible=1
If Controller.Lamp(55) = 0 Then: PinCab_BG_s55.visible=0: else: PinCab_BG_s55.visible=1
PinCab_BG_s30.visible=l30.state
DIM VRThings
for each VRThings in BackboxLED:VRThings.visible = 0:Next
for each VRThings in Backboxlights:VRThings.visible = 0:Next
End If
Pincab_Shooter.Y = -126.3382 + (5* Plunger.Position) -20
End Sub
'--------------------------
'------ Table Init ------
'--------------------------
Dim bsTrough,bsTopEject,bsRightHole,bsTopHole,bsCatapult,bsSpinoutKicker,RightDTBank,CenterDTBank
Sub Taxi_Init()
Dim DesktopMode: DesktopMode = Taxi.ShowDT
If DesktopMode = True Then 'Show Desktop components
for Each obj in Backboxlights
obj.state = Lightstateon
next
LEDTimer.enabled = True
Else
for Each obj in Backboxlights
obj.state = Lightstateoff
next
LEDTimer.enabled = False
End if
vpmInit Me
With Controller
.GameName = cGameName
'If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
.SplashInfoLine = "Taxi"
.HandleKeyboard = 0
.ShowTitle = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.HandleMechanics = 0
.Hidden = 0
.Dip(0) = &H00
'DMD position for 3 Monitor Setup
Controller.Games(cGameName).Settings.Value("dmd_pos_x")=0
Controller.Games(cGameName).Settings.Value("dmd_pos_y")=0
'Controller.Games(cGameName).Settings.Value("dmd_width")=505
'Controller.Games(cGameName).Settings.Value("dmd_height")=155
'Controller.Games(cGameName).Settings.Value("rol")=0
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
On Error Goto 0
' Nudging
vpmNudge.TiltSwitch = 1
vpmNudge.Sensitivity = 1
vpmNudge.TiltObj = Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
' Trough handler
Set bsTrough = New cvpmBallStack
bsTrough.InitSw 10,11,12,0,0,0,0,0
bsTrough.InitKick BallRelease,60,8
'bsTrough.InitEntrySnd SoundFX("BallRelease",DOFContactors),SoundFX("Solon",DOFContactors)
'bsTrough.InitExitSnd SoundFX("BallRelease",DOFContactors), SoundFX("Solon",DOFContactors)
bsTrough.Balls=2
'Right Hole
set bsRightHole = new cvpmSaucer
bsRightHole.InitKicker RightHole,36,180,12,0
bsRightHole.InitExitVariance 5,2
'bsRightHole.InitSounds SoundFX("kicker_enter_center",DOFContactors),SoundFX("solon",DOFContactors),SoundFX("popper_ball",DOFContactors)
'Top Hole - Joy Ride
set bsTopHole = new cvpmSaucer
bsTopHole.InitKicker TopHole,13,184,20,0
bsTopHole.InitExitVariance 2, 2
'bsTopHole.InitSounds SoundFX("kicker_enter_center",DOFContactors),SoundFX("solon",DOFContactors),SoundFX("popper_ball",DOFContactors)
'Catapult
Set bsCatapult = New cvpmSaucer
bsCatapult.InitKicker CatapultLaunchKicker,35,0,40,0
bsCatapult.InitSounds SoundFX("kicker_enter_center",DOFContactors),SoundFX("solon",DOFContactors),SoundFX("popper_ball",DOFContactors)
'SpinOut Kicker
Set bsSpinoutKicker = New cvpmSaucer
bsSpinoutKicker.InitKicker SpinoutKicker,43,0,42,0
bsSpinoutKicker.InitExitVariance 5,2
'bsSpinoutKicker.InitSounds SoundFX("soloff",DOFContactors),SoundFX("solon",DOFContactors),SoundFX("popper_ball",DOFContactors)
Set RightDTBank = New cvpmDropTarget
RightDTBank.InitDrop Array(DT30,DT31,DT32),Array(30,31,32)
RightDTBank.InitSnd SoundFX("",DOFDropTargets),SoundFX("fx_resetdrop",DOFContactors)
RightDTBank.CreateEvents "RightDTBank"
Set CenterDTBank = New cvpmDropTarget
CenterDTBank.InitDrop Array(DT27,DT28,DT29),Array(27,28,29)
CenterDTBank.InitSnd SoundFX("",DOFDropTargets),SoundFX("fx_resetdrop",DOFContactors)
CenterDTBank.CreateEvents "CenterDTBank"
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
vpmtimer.PulseSW 24
center_digits()
'force GI on initially
Sol11 0
End Sub
'------------------------------
'------ Switch Handler ------
'------------------------------
Sub SpinoutKicker_Hit:bsSpinOutKicker.addball Me:SoundSaucerLock:End Sub
Sub RightHole_Hit:bsRightHole.addball Me:SoundSaucerLock:End Sub
Sub TopHole_Hit:bsTopHole.addball Me:SoundSaucerLock:End Sub
Sub CatapultKicker_Hit:bsCatapult.addball Me:SoundSaucerLock:End Sub
Sub BallRelease_UnHit: RandomSoundBallRelease BallRelease: End Sub
Sub RightHole_UnHit: SoundSaucerKick 1, RightHole: End Sub
Sub TopHole_UnHit: SoundSaucerKick 1, TopHole: End Sub
Sub CatapultKicker_UnHit: SoundSaucerKick 1, CatapultKicker: End Sub
Sub CatapultLaunchKicker_UnHit: SoundSaucerKick 1, CatapultLaunchKicker: End Sub
Sub SpinoutKicker_UnHit: SoundSaucerKick 1, SpinoutKicker: End Sub
Sub Bumper1_Hit:vpmTimer.PulseSw 21:RandomSoundBumperTop Bumper1:End Sub
Sub Bumper2_Hit:vpmTimer.PulseSw 17:RandomSoundBumperMiddle Bumper2:End Sub
Sub Bumper3_Hit:vpmTimer.PulseSw 19:RandomSoundBumperBottom Bumper3:End Sub
Sub SW14_Hit:Controller.Switch(14) = True:End Sub
Sub SW14_Unhit:Controller.Switch(14) = False:End Sub
Sub SW15_Hit:Controller.Switch(15) = True:End Sub
Sub SW15_Unhit:Controller.Switch(15) = False:End Sub
Sub SW16_Hit:Controller.Switch(16) = True:End Sub
Sub SW16_Unhit:Controller.Switch(16) = False:End Sub
Sub SW22_Hit:Controller.Switch(22) = True:End Sub
Sub SW22_Unhit:Controller.Switch(22) = False:End Sub
Sub SW23_Hit:Controller.Switch(23) = True:End Sub
Sub SW23_Unhit:Controller.Switch(23) = False:End Sub
Sub Target24_Hit:vpmtimer.PulseSW 24:End Sub
Sub SW25_Hit:vpmtimer.PulseSW 25:End Sub
Sub SW26_Hit:vpmtimer.PulseSW 26:End Sub
Sub SW33_Hit:Controller.Switch(33) = True:Primitive_SwitchArm33.objrotz = -15:End Sub
Sub SW33_Unhit:Controller.Switch(33) = False:SW33.Timerenabled = True:End Sub
Sub SW34_Hit:Controller.Switch(34) = True:Primitive_SwitchArm34.objrotz = 18:End Sub
Sub SW34_Unhit:Controller.Switch(34) = False:SW34.Timerenabled = True:End Sub
Sub SW37_Hit:Controller.Switch(37) = True:End Sub
Sub SW37_Unhit:Controller.Switch(37) = False:End Sub
Sub SW38_Hit:Controller.Switch(38) = True:End Sub
Sub SW38_Unhit:Controller.Switch(38) = False:End Sub
Sub SW39_Hit:Controller.Switch(39) = True:End Sub
Sub SW39_Unhit:Controller.Switch(39) = False:End Sub
Sub SW40_Hit:Controller.Switch(40) = True:End Sub
Sub SW40_Unhit:Controller.Switch(40) = False:End Sub
'SW43 handled via saucer
Sub SW44_Hit:vpmtimer.PulseSW 44 End Sub
Sub SW33_Timer
Primitive_SwitchArm33.objrotz = Primitive_SwitchArm33.objrotz + 3
if Primitive_SwitchArm33.objrotz >= 0 then
SW33.Timerenabled = False
Primitive_SwitchArm33.objrotz = 0
end If
End Sub
Sub SW34_Timer
Primitive_SwitchArm34.objrotz = Primitive_SwitchArm34.objrotz - 3
if Primitive_SwitchArm34.objrotz <= 0 then
SW34.Timerenabled = False
Primitive_SwitchArm34.objrotz = 0
end If
End Sub
'###########################################
'Sub SpinoutHelper_Hit
' if ActiveBall.Velx > 9 then
' ActiveBall.Velx = 1.01 * ActiveBall.Velx
' end if
'End Sub
Sub RampHelper1_Hit
ActiveBall.velZ = 0
End Sub
Sub RampHelper2_Hit
ActiveBall.velZ = 0
End Sub
Const ReflipAngle = 20
Sub Taxi_KeyDown(ByVal keycode)
If keycode = PlungerKey Then
Plunger.PullBack
SoundPlungerPull()
End If
If keycode = LeftFlipperKey Then
if FlipperActive then
lf.fire 'LeftFlipper.RotateToEnd
lfpress = 1
If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper
Else
SoundFlipperUpAttackLeft LeftFlipper
RandomSoundFlipperUpLeft LeftFlipper
End If
end if
End If
If keycode = RightFlipperKey Then
if FlipperActive then
rf.fire 'RightFlipper.RotateToEnd
rfpress = 1
If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper
Else
SoundFlipperUpAttackRight RightFlipper
RandomSoundFlipperUpRight RightFlipper
End If
end if
End If
If keycode = LeftTiltKey Then Nudge 90, 5:SoundNudgeLeft()
If keycode = RightTiltKey Then Nudge 270, 5:SoundNudgeRight()
If keycode = CenterTiltKey Then Nudge 0, 3:SoundNudgeCenter()
If keycode = keyInsertCoin1 or keycode = keyInsertCoin2 or keycode = keyInsertCoin3 or keycode = keyInsertCoin4 Then
Select Case Int(rnd*3)
Case 0: PlaySound ("Coin_In_1"), 0, CoinSoundLevel, 0, 0.25
Case 1: PlaySound ("Coin_In_2"), 0, CoinSoundLevel, 0, 0.25
Case 2: PlaySound ("Coin_In_3"), 0, CoinSoundLevel, 0, 0.25
End Select
End If
If keycode=StartGameKey Then soundStartButton()
'If keycode = RightMagnaSave Then sol11 true
'If keycode = LeftMagnaSave Then sol11 false
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Taxi_KeyUp(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Fire
SoundPlungerReleaseBall()
End If
If keycode = LeftFlipperKey Then
lfpress = 0
leftflipper.eostorqueangle = EOSA
leftflipper.eostorque = EOST
LeftFlipper.RotateToStart
if FlipperActive then
If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
RandomSoundFlipperDownLeft LeftFlipper
End If
FlipperLeftHitParm = FlipperUpSoundLevel
end if
End If
If keycode = RightFlipperKey Then
rfpress = 0
rightflipper.eostorqueangle = EOSA
rightflipper.eostorque = EOST
RightFlipper.RotateToStart
if FlipperActive then
If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper
End If
FlipperRightHitParm = FlipperUpSoundLevel
end if
End If
If vpmKeyUp(keycode) Then Exit Sub
End Sub
Sub Drain_Hit()
RF.PolarityCorrect Activeball: LF.PolarityCorrect Activeball
RandomSoundDrain Drain
bsTrough.AddBall Me
'Drain.DestroyBall
End Sub
'-----------------------------------
' Flipper Primitives
'-----------------------------------
sub FlipperTimer()
pleftFlipper.rotz=leftFlipper.CurrentAngle
prightFlipper.rotz=rightFlipper.CurrentAngle
LFLogo.RotZ = LeftFlipper.CurrentAngle
RFLogo.RotZ = RightFlipper.CurrentAngle
Primitive_LGateWire.rotx = LGate.currentangle
Primitive_RGateWire.rotx = RGate.currentangle
end sub
'**********Sling Shot Animations
' Rstep and Lstep are the variables that increment the animation
'****************
Dim RStep, Lstep
Sub RightSlingShot_Slingshot
vpmtimer.pulsesw 20
RandomSoundSlingshotRight SLING1
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
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 LeftSlingShot_Slingshot
vpmtimer.pulsesw 18
RandomSoundSlingshotLeft SLING2
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
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
'******************************************************
' BALL ROLLING AND DROP SOUNDS
'******************************************************
Const tnob = 5
Const lob = 0
ReDim rolling(tnob)
InitRolling
Dim isBallOnWireRamp : isBallOnWireRamp = False
Dim DropCount
ReDim DropCount(tnob)
Sub InitRolling
Dim i
For i = 0 to (tnob)
rolling(i) = False
Next
End Sub
Sub RollingTimer()
Dim BOT, b
BOT = GetBalls
' stop the sound of deleted balls
For b = UBound(BOT) + 1 to tnob
rolling(b) = False
StopSound "BallRoll_" & b
StopSound "fx_plasticrolling" & b
StopSound "fx_metalrolling" & 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 isBallOnWireRamp Then
' ball on wire ramp
StopSound "BallRoll_" & b
StopSound "fx_plasticrolling" & b
PlaySound "fx_metalrolling" & b, -1, VolPlayfieldRoll(BOT(b)) * 1.1 * VolumeDial, AudioPan(BOT(b)), 0, PitchPlayfieldRoll(BOT(b)), 1, 0, AudioFade(BOT(b))
ElseIf BOT(b).Z > 30 Then
' ball on plastic ramp
StopSound "BallRoll_" & b
StopSound "fx_metalrolling" & b
PlaySound "fx_plasticrolling" & b, -1, VolPlayfieldRoll(BOT(b)) * 0.4 * VolumeDial, AudioPan(BOT(b)), 0, PitchPlayfieldRoll(BOT(b)), 1, 0, AudioFade(BOT(b))
Else
' ball on playfield
StopSound "fx_plasticrolling" & b
StopSound "fx_metalrolling" & b
PlaySound "BallRoll_" & b, -1, VolPlayfieldRoll(BOT(b)) * 1.2 * VolumeDial, AudioPan(BOT(b)), 0, PitchPlayfieldRoll(BOT(b)), 1, 0, AudioFade(BOT(b))
End If
Else
If rolling(b) = True Then
StopSound "BallRoll_" & b
StopSound "fx_plasticrolling" & b
StopSound "fx_metalrolling" & b
rolling(b) = False
End If
End If
'***Ball Drop Sounds***
If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
If DropCount(b) >= 5 Then
DropCount(b) = 0
If BOT(b).velz > -7 Then
RandomSoundBallBouncePlayfieldSoft BOT(b)
Else
RandomSoundBallBouncePlayfieldHard BOT(b)
End If
End If
End If
If DropCount(b) < 5 Then
DropCount(b) = DropCount(b) + 1
End If
Next
End Sub
'*****************************************************
' RtxBS - Ray Tracing Ball Shadows by iaakki and Wylte
'*****************************************************
Dim fovY: fovY = 10 'Offset y axis to account for layback or inclination
Dim SizeOfBall: SizeOfBall = BallSize 'Regular ballsize isn't working right, as it's pulled from vpm?
Const RTXFactor = 0.9 '0 to 1, higher is darker
Dim sourcenames, currentShadowCount
sourcenames = Array ("","","","","","","","","","","","")
currentShadowCount = Array (0,0,0,0,0,0,0,0,0,0,0,0)
Sub BallShadowUpdate_Timer()
If RtxBSon=1 Then
RtxBSUpdate
Else
me.enabled=false
End If
End Sub
dim objrtx1(20), objrtx2(20), RtxBScnt
dim objBallShadow(20)
RtxInit
sub RtxInit()
Dim iii
For Each iii in RtxBS
RtxBScnt = RtxBScnt + 1 'count lights
' iii.state = 1 'lights on
next
for iii = 0 to tnob
Set objrtx1(iii) = Eval("RtxBallShadow" & iii)
objrtx1(iii).material = "RtxBallShadow" & iii
objrtx1(iii).z = iii/1000 + 0.10
objrtx1(iii).visible = 0
'objrtx1(iii).uservalue=0
Set objrtx2(iii) = Eval("RtxBall2Shadow" & iii)
objrtx2(iii).material = "RtxBallShadow2_" & iii
objrtx2(iii).z = (iii)/1000 + 0.12
objrtx2(iii).visible = 0
'objrtx2(iii).uservalue=0
currentShadowCount(iii) = 0
Set objBallShadow(iii) = Eval("BallShadow" & iii)
Next
'msgbox RtxBScnt
end sub
Sub RtxBSUpdate
Dim falloff: falloff = 200 'Max distance to light source for RTX BS calcs
Dim ShadowOpacity, ShadowOpacity2
Dim s, Source, LSd, CntDwn, b, currentMat, AnotherSource, BOT
BOT = GetBalls
' hide shadow of deleted balls
For s = UBound(BOT) + 1 to tnob
objrtx1(s).visible = 0
objrtx2(s).visible = 0
objBallShadow(s).visible = 0
Next
If UBound(BOT) = lob - 1 Then Exit Sub 'No balls in play exit, same as JP's
For s = lob to UBound(BOT)
'Normal ambient shadow
If BOT(s).X < tablewidth/2 Then
objBallShadow(s).X = ((BOT(s).X) - (SizeOfBall/6) + ((BOT(s).X - (tablewidth/2))/10)) + 6
Else
objBallShadow(s).X = ((BOT(s).X) + (SizeOfBall/6) + ((BOT(s).X - (tablewidth/2))/10)) - 6
End If
objBallShadow(s).Y = BOT(s).Y + fovY
'objBallShadow(s).Z = BOT(s).Z - (SizeOfBall/2) + s/1000 + 0.04 'make ball shadows to be on different z-order
objBallShadow(s).Z = s/1000 + 0.04 'make ball shadows to be on different z-order
If BOT(s).Z < 30 Then 'or BOT(s).Z > 105 Then
objBallShadow(s).visible = 1
Else
'other rules here, like ramps and upper pf
objBallShadow(s).visible = 0
end if
'RTX shadows
For Each Source in RtxBS 'Rename this to match your collection name
'LSd=((BOT(s).x-Source.x)^2+(BOT(s).y-Source.y)^2)^0.5 'Calculating the Linear distance to the Source
LSd=DistanceFast((BOT(s).x-Source.x),(BOT(s).y-Source.y)) 'Calculating the Linear distance to the Source
If BOT(s).Z < 30 Then 'Or BOT(s).Z > 105 Then
If LSd < falloff and Source.state=1 Then 'If the ball is within the falloff range of a light and light is on
CntDwn = RtxBScnt
currentShadowCount(s) = currentShadowCount(s) + 1
if currentShadowCount(s) = 1 Then
sourcenames(s) = source.name
currentMat = objrtx1(s).material
objrtx2(s).visible = 0 : objrtx1(s).visible = 1 : objrtx1(s).X = BOT(s).X : objrtx1(s).Y = BOT(s).Y + fovY
'objrtx1(s).Z = BOT(s).Z - (SizeOfBall/2) + s/1000 + 0.01
objrtx1(s).Z = s/1000 + 0.01
objrtx1(s).rotz = AnglePP(Source.x, Source.y, BOT(s).X, BOT(s).Y) + 90
ShadowOpacity = (falloff-LSd)/falloff
objrtx1(s).size_y = 15*ShadowOpacity+5
UpdateMaterial currentMat,1,0,0,0,0,0,ShadowOpacity*RTXFactor^2,RGB(0,0,0),0,0,False,True,0,0,0,0
'debug.print "update1" & source.name & " at:" & ShadowOpacity
'currentMat = objBallShadow(s).material
'UpdateMaterial currentMat,1,0,0,0,0,0,1-ShadowOpacity,RGB(0,0,0),0,0,False,True,0,0,0,0
Elseif currentShadowCount(s) = 2 Then
currentMat = objrtx1(s).material
set AnotherSource = Eval(sourcenames(s))
objrtx1(s).visible = 1 : objrtx1(s).X = BOT(s).X : objrtx1(s).Y = BOT(s).Y + fovY
'objrtx1(s).Z = BOT(s).Z - (SizeOfBall/2) + s/1000 + 0.01
objrtx1(s).Z = s/1000 + 0.01
objrtx1(s).rotz = AnglePP(AnotherSource.x, AnotherSource.y, BOT(s).X, BOT(s).Y) + 90
ShadowOpacity = (falloff-(((BOT(s).x-AnotherSource.x)^2+(BOT(s).y-AnotherSource.y)^2)^0.5))/falloff
objrtx1(s).size_y = 15*ShadowOpacity+5
UpdateMaterial currentMat,1,0,0,0,0,0,ShadowOpacity*RTXFactor^3,RGB(0,0,0),0,0,False,True,0,0,0,0
currentMat = objrtx2(s).material
objrtx2(s).visible = 1 : objrtx2(s).X = BOT(s).X : objrtx2(s).Y = BOT(s).Y + fovY
'objrtx2(s).Z = BOT(s).Z - (SizeOfBall/2) + s/1000 + 0.02
objrtx2(s).Z = s/1000 + 0.02
objrtx2(s).rotz = AnglePP(Source.x, Source.y, BOT(s).X, BOT(s).Y) + 90
ShadowOpacity2 = (falloff-LSd)/falloff
objrtx2(s).size_y = 15*ShadowOpacity2+5
UpdateMaterial currentMat,1,0,0,0,0,0,ShadowOpacity2*RTXFactor^3,RGB(0,0,0),0,0,False,True,0,0,0,0
'debug.print "update2: " & source.name & " at:" & ShadowOpacity & " and " & Eval(sourcenames(s)).name & " at:" & ShadowOpacity2
'currentMat = objBallShadow(s).material
'UpdateMaterial currentMat,1,0,0,0,0,0,1-max(ShadowOpacity,ShadowOpacity2),RGB(0,0,0),0,0,False,True,0,0,0,0
end if
Else
CntDwn = CntDwn - 1 'If ball is not in range of any light, this will hit 0
currentShadowCount(s) = 0
End If
Else
'other rules here, like ramps and upper pf
objrtx2(s).visible = 0 : objrtx1(s).visible = 0
End If
Next
If CntDwn <= 0 Then
if CntDwn = -(RtxBScnt) Then
For b = lob to UBound(BOT)
objrtx1(b).visible = 0
objrtx2(b).visible = 0
Next
end if
End If
Next
End Sub
Function DistanceFast(x, y)
dim ratio, ax, ay
'Get absolute value of each vector
ax = abs(x)
ay = abs(y)
'Create a ratio
ratio = 1 / max(ax, ay)
ratio = ratio * (1.29289 - (ax + ay) * ratio * 0.29289)
if ratio > 0 then
DistanceFast = 1/ratio
Else
DistanceFast = 0
End if
end Function
Function max(a,b)
if a > b then
max = a
Else
max = b
end if
end Function
''*****************************************
'' Ball Shadow
''*****************************************
'
'Dim BallShadow
'BallShadow = Array (BallShadow1, BallShadow2, BallShadow3, BallShadow4, BallShadow5, BallShadow6)
'
'Sub BallShadowUpdate()
' Dim BOT, b, shadowZ
' BOT = GetBalls
'
' ' render the shadow for each ball
' For b = 0 to UBound(BOT)
' BallShadow(b).X = BOT(b).X
' BallShadow(b).Y = BOT(b).Y + 10
' If BOT(b).Z > 0 and BOT(b).Z < 30 Then
' BallShadow(b).visible = 1
' Else
' BallShadow(b).visible = 0
' End If
' Next
'End Sub
Sub Spinner_Spin
PlaySound "fx_spinner",0,.25,0,0.25
End Sub