forked from LegendsUnchained/vpx-standalone-alp4k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJunk Yard (Williams 1996) v1.83.vbs
3903 lines (3309 loc) · 143 KB
/
Junk Yard (Williams 1996) v1.83.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
'############################################################################################
'############################################################################################
'####### ########
'####### Junk Yard ########
'####### (Williams 1996) ########
'####### ########
'############################################################################################
'############################################################################################
' Version 1.3 FS mfuegemann 2016
' Version 1.6 FS TastyWasps 2022
'
' Thanks to:
' 3D primitives and images provided by Fuzzel (Toilet, Dog/House, Fridge, Bus, Flippers)
' 3D primitives and images provided by Dark (Toilet Ramp, Bus Ramp, Car Switch Assembly)
' Hauntfreaks for the lighting review and texture cleanups
'
' Version 1.1
' - corrected ramp end drop sound
' - corrected toilet ramp cover DepthBias setting to show ramp beneath
' - delete unused images
' - DOF sound review by Arngrim
' - Flipper and Wall friction settings reviewed by ClarkKent
' - removed Wire Triggers from collection to get correct Hit events
'
' Version 1.2
' - corrected backdrop flasher and lower left flasher RotX in DT mode
' - corrected SideWood material for correct DT backdrop display
' - adjustable sound level for ball rolling sound
' - option to increase BallSize (must be placed before LoadVPM)
' - fixed the plunger animation for mech plungers
'
' Version 1.3
' - corrected error on table start if B2S backglass was active
'
' Version 1.4 - TastyWasps
' - Added nFozzy physics with the guidance of Apophis (Jedi Master) and Bord's YouTube videos / documentation.
' - Added Dynamic Ball Shadows with assistance from Wylte.
' - Small lighting clean-ups to make the lighting pop more on the playfield.
' - Ball change to reflect more light from the Dynamic Ball Shadows.
' - DOF changes suggested to VPUniverse to make the crane less annoying on shaker motors.
' - Used a real Junkyard machine to accurately simulate play difficulty / shot geometry for the new physics.
' - Utilized dtatane's amazing alt color rendering of the Junk Yard DMD located at https://vpuniverse.com/forums/topic/6943-junk-yard-64-colors. You will have to download and install on your own. (Highly Recommended!)
'
' Version 1.5 - TastyWasps
' - Added Fleep sounds with the guidance of Apophis' YouTube videos.
' - Desktop background change to more muted background and desktop POV updates - 1.51
' - Peg primitive cleanups - 1.52
' - Playfield update - 1.53
' - Flupper Domes added - 1.54
' - Aesthetic fixes - 1.55
' - Desktop background change / darker tone. - 1.56
' - Gameplay balances to flippers, updated Dynamic Shadow code from Wylte to deal with crane, small bug fixes after user testing - 1.57
' Version 1.58 - bord
'- added playfield mesh, reworked Sewer area for accuracy, can now brick a sewer shot
'- removed visible sewer hole from playfield texture (now part of mesh)
'- added flupper flipper bats
' Version 1.59 - apophis
' - updated the A_JY Plastics_VPX image with new slingshot plastics textures
' - added dSleeves collection and put sleeve objects in the collection
' - removed redundant slingshot wall on Layer_1, updated names of slingshot walls on Layer_10
' - adjust flipper length to be 147 vpunits long (3.125") as per physical flippers. Adjusted flipper triggers accordingly
' - moved physics related options out of user option area
' - lowered visual flippers
'
' Version 1.60 - apophis
' - Fixed issue with ball getting stuck on playfield_mesh near the wrecking ball
' - Added missing visible posts
' - Made rubber phyiscs walls invisible
' - Made drain bulb invisible
'
' Version 1.61 - TastyWasps
' - Stuck ball issue fixed on sewer scoop. Radius increased to 27.5.
' - Lighting inserts brightened for "Collect Junk" and "DOG" to make them easier to spot when playing.
' - Digital nudge toned down.
' - LUT options added, Fridge kicker kick softened to help with too many ski jumps - 1.62
' Version 1.82 - Rajo Joey / TastyWasps
' - 2 automatic detection VR rooms added. Change room / LUT by using magna save buttons when ball not in plunger.
' - GI lights slightly brightened on playfield upon detection of VR mode.
' - Slope of table slightly increased to match Williams standards.
' - Simple flashers added to VR backglass - 1.83
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
'-----------------------------------
' Configuration
'-----------------------------------
Const cGameName = "jy_12"
Const DimFlashers = -0.4 ' Set between -1 and 0 to dim or brighten the Flashers (minus is darker)
Const OutLanePosts = 2 ' 1=Easy, 2=Medium, 3=Hard
Const BallSize = 50
Const BallMass = 1
Const UseVPMModSol = 1
'----- Shadow Options -----
Const DynamicBallShadowsOn = 1 '0 = no dynamic ball shadow ("triangles" near slings and such), 1 = enable dynamic ball shadow
Const AmbientBallShadowOn = 1 '0 = Static shadow under ball ("flasher" image, like JP's)
' '1 = Moving ball shadow ("primitive" object, like ninuzzu's) - This is the only one that shows up on the pf when in ramps and fades when close to lights!
' '2 = flasher image shadow, but it moves like ninuzzu's
'----- General Sound Options -----
Const VolumeDial = 0.8 ' Overall Mechanical sound effect volume. Recommended values should be no greater than 1.
Const BallRollVolume = 0.5 ' Level of ball rolling volume. Value between 0 and 1
Const RampRollVolume = 0.5 ' Level of ramp rolling volume. Value between 0 and 1
' Standard Sounds and Settings
Const SSolenoidOn="Solon",SSolenoidOff="Soloff",SFlipperOn="",SFlipperOff=""
Const UseSolenoids=2,UseLamps=1
' General Illumination light state tracked for Dynamic Ball Shadows
dim gilvl:gilvl = 1
' Determine if Window Shopping is shown on apron as it is generally only needed in desktop mode.
Dim DesktopMode, ApronShopping
DesktopMode = JunkYard.ShowDT
If DesktopMode = True Then
ApronShopping = True ' Show WindowShopping on top of the apron. WindowShopping feature also shown on backglass.
Else
ApronShopping = False ' Window shopping is shown on backglass and apron shows the real machine insert.
End If
' VRRoom set based on RenderingMode
Dim VRRoom
Dim bulb
' Set brightness of VR playfields slightly higher than desktop/cab mode.
If RenderingMode = 2 Then
For Each bulb in GIString1
bulb.IntensityScale = bulb.IntensityScale * 1.75
Next
For Each bulb in GIString2
bulb.IntensityScale = bulb.IntensityScale * 1.75
Next
End If
Sub VRChangeRoom()
If RenderingMode = 2 and VRRoom = 2 Then ' VR-mode sphere
for each Obj in ColRoomMinimal : Obj.visible = 0 : next
for each Obj in ColRoomSphere : Obj.visible = 1 : next
for each Obj in ColCabinet : Obj.visible = 1 : next
for each Obj in ColBackdrop : Obj.visible = 0 : next
End If
If RenderingMode = 2 and VRRoom = 1 Then ' VR-mode minimal room
for each Obj in ColRoomMinimal : Obj.visible = 1 : next
for each Obj in ColRoomSphere : Obj.visible = 0 : next
for each Obj in ColCabinet : Obj.visible = 1 : next
for each Obj in ColBackdrop : Obj.visible = 0 : next
End If
If RenderingMode <> 2 and DesktopMode = True Then ' desktopmode
for each Obj in ColRoomMinimal : Obj.visible = 0 : next
for each Obj in ColRoomSphere : Obj.visible = 0 : next
for each Obj in ColCabinet : Obj.visible = 0 : next
for each Obj in ColBackdrop : Obj.visible = 1 : next
End If
If RenderingMode <> 2 and DesktopMode = False Then ' cabinet mode
for each Obj in ColRoomMinimal : Obj.visible = 0 : next
for each Obj in ColRoomSphere : Obj.visible = 0 : next
for each Obj in ColCabinet : Obj.visible = 0 : next
for each Obj in ColBackdrop : Obj.visible = 0 : next
End If
End Sub
InitWreckerBall ' Must be called before LoadVPM becaus of B2s caused delay on trigger code
LoadVPM "01560000","WPC.VBS",3.2
'-----------------------------------
' Solenoids
'-----------------------------------
' Flupper Flasher Dome Solenoids (modulated)
SolModCallBack(20) = "SolModFlash20" ' Left Red Flasher (modulated)
SolModCallBack(26) = "SolModFlash26" ' Scoop Flasher (modulated)
SolModCallBack(23) = "SolModFlash23" ' Back Left Flasher (modulated)
SolModCallBack(24) = "SolModFlash24" ' Back Right Flasher (modulated)
SolCallBack(1) = "AutoPlunger"
SolCallBack(2) = "bsFridgePopper.SolOut"
SolCallBack(3) = "SolPowerCrane"
SolCallBack(5) = "ScoopDown"
SolCallBack(6) = "BusDiverter"
SolCallBack(7) = "SolKnocker"
SolCallBack(9) = "SolTrough"
SolCallBack(10) = "vpmSolSound SoundFX(""Slingshot"",DOFContactors),"
SolCallBack(11) = "vpmSolSound SoundFX(""Slingshot"",DOFContactors),"
SolCallBack(15) = "SolHoldCrane"
SolCallBack(16) = "SpikeBark" 'Move Dog
SolCallBack(17) = "SolFlash17" 'Dog Face Flasher
'SolCallBack(18) = "SolWindowShopFlasher"
SolCallBack(19) = "vpmFlasher Sol19," 'Autofire Flasher
SolCallBack(21) = "ScoopUp"
SolCallBack(22) = "SolFlash22" 'Under Crane Flasher
SolCallBack(25) = "SolFlash25" 'Shooter Flasher
SolCallBack(27) = "SolFlash27" 'Dog House Flasher
SolCallBack(28) = "SolFlash28" 'Car Flashers (2)
SolCallback(sLLFlipper) = "SolLFlipper"
SolCallback(sLRFlipper) = "SolRFlipper"
Set GICallBack = GetRef("UpdateGI")
Sub Autoplunger(enabled)
if enabled then
if controller.switch(18) then
SoundPlungerReleaseBall()
Auto_Plunger.Pullback
Auto_Plunger.Fire
end if
Else
Auto_Plunger.Pullback
end If
End Sub
Sub SolKnocker(Enabled)
If enabled Then
KnockerSolenoid
End If
End Sub
Sub SolTrough(Enabled)
If Enabled then
if not TestWall.isdropped Then
TestWall.isdropped = True
end If
bsTrough.ExitSol_On
vpmTimer.PulseSw 31
End If
End Sub
Sub BusDiverter(Enabled)
If Enabled then
playsound SoundFX("Solon",DOFContactors),0,1,0.1,0.25
Sol6.IsDropped = False
Else
playsound SoundFX("Soloff",DOFContactors),0,1,0.1,0.25
Sol6.IsDropped = True
End If
End Sub
Sub ScoopDown(Enabled)
If Enabled Then
playsound SoundFX("Solon",DOFContactors),0,0.7,0.08,0.25
Controller.Switch(72) = True
P_Fork1.RotX = 17
P_Fork2.RotX = 17
P_Fork1.collidable = False
P_Fork2.collidable = False
End If
End Sub
Sub ScoopUp(Enabled)
If Enabled Then
playsound SoundFX("Solon",DOFContactors),0,1,0.08,0.25
Controller.Switch(72) = False
P_Fork1.RotX = 0
P_Fork2.RotX = 0
P_Fork1.collidable = True
P_Fork2.collidable = True
End If
End Sub
dim spikeOut:spikeOut=1
Sub SpikeBark(Enabled)
SpikeTimer.Enabled=Enabled
if Enabled=0 then
spike.transy=0
spikeOut=1
end if
End Sub
Sub SpikeTimer_Timer()
playsound SoundFX("motor",DOFGear),0,1,0.18,0.25
if spikeOut=1 then
spike.transy=spike.transy-8
if spike.transy<-50 then
spike.transy=-50
spikeOut=0
end if
else
spike.transy=spike.transy+8
if spike.transy>0 then
spike.transy=0
spikeOut=1
end if
end if
end sub
Sub SolFlash17(Enabled)
if enabled then
setflash 4,1
else
setflash 4,0
end if
End Sub
' Bottom Left Red Flasher - Flupper Primitive #1
Sub SolModFlash20(lvl)
ObjTargetLevel(1) = lvl/255
FlasherFlash1_Timer
End Sub
Sub SolFlash22(Enabled)
if enabled then
CraneFlasherLight.state = Lightstateon
setflash 6,1
else
CraneFlasherLight.state = Lightstateoff
setflash 6,0
end if
End Sub
' Back Left White Flasher - Flupper Primitive #4
Sub SolModFlash23(lvl)
ObjTargetLevel(4) = lvl/255
FlasherFlash4_Timer
End Sub
' Back Right White Flasher - Flupper Primitive #2
Sub SolModFlash24(lvl)
ObjTargetLevel(2) = lvl/255
FlasherFlash2_Timer
End Sub
Sub SolFlash25(Enabled)
if enabled then
setflash 5,1
else
setflash 5,0
end if
End Sub
' Dog Scoop Flasher - Flupper Primitive #3
Sub SolModFlash26(lvl)
ObjTargetLevel(3) = lvl/255
FlasherFlash3_Timer
End Sub
Sub SolFlash27(Enabled)
if enabled then
setflash 7,1
else
setflash 7,0
end if
End Sub
Sub SolFlash28(Enabled)
if enabled then
setflash 8,1
else
setflash 8,0
end if
End Sub
'-----------------------------------
' Table Init
'-----------------------------------
Dim bsTrough,bsFridgePopper,RightDrain,WindowUp
Sub JunkYard_Init()
if JunkYard.ShowDT then
Flasher1.Rotx = -30
Flasher1.Roty = 50
Flasher1.height = 240
Flasher1a.Rotx = -40
Flasher1a.height = 220
Flasher1b.Rotx = -40
Flasher1b.height = 225
Flasher2.Rotx = -40
Flasher2.height = 225
Flasher2a.Rotx = -40
Flasher2a.height = 220
Flasher2b.Rotx = -40
Flasher2b.height = 250
Flasher3.Rotx = -20
Flasher3a.Rotx = -20
Flasher4.Rotx = -20
Flasher4a.Rotx = -20
Else
Ramp9.widthbottom = 0
Ramp9.widthtop = 0
Ramp15.widthbottom = 0
Ramp15.widthtop = 0
Ramp13.widthbottom = 0
Ramp13.widthtop = 0
Ramp16.widthbottom = 0
Ramp16.widthtop = 0
End If
if Apronshopping Then
WindowUp = True
P_Window.TransZ = 3
P_Window1.TransZ = 0
end If
select case OutLanePosts
case 2: 'Medium Position
P_RightRingHard.visible = False
P_RightPostHard.visible = False
RightPostHard.isdropped = True
P_RightRingMedium.visible = True
P_RightPostMedium.visible = True
RightPostMedium.isdropped = False
P_RightRingEasy.visible = False
P_RightPostEasy.visible = False
RightPostEasy.isdropped = True
P_LeftRingHard.visible = False
P_LeftPostHard.visible = False
LeftPostHard.isdropped = True
P_LeftRingMedium.visible = True
P_LeftPostMedium.visible = True
LeftPostMedium.isdropped = False
P_LeftRingEasy.visible = False
P_LeftPostEasy.visible = False
LeftPostEasy.isdropped = True
case 3: 'Hard Position
P_RightRingHard.visible = True
P_RightPostHard.visible = True
RightPostHard.isdropped = False
P_RightRingMedium.visible = False
P_RightPostMedium.visible = False
RightPostMedium.isdropped = True
P_RightRingEasy.visible = False
P_RightPostEasy.visible = False
RightPostEasy.isdropped = True
P_LeftRingHard.visible = True
P_LeftPostHard.visible = True
LeftPostHard.isdropped = False
P_LeftRingMedium.visible = False
P_LeftPostMedium.visible = False
LeftPostMedium.isdropped = True
P_LeftRingEasy.visible = False
P_LeftPostEasy.visible = False
LeftPostEasy.isdropped = True
case Else 'Easy Position
P_RightRingHard.visible = False
P_RightPostHard.visible = False
RightPostHard.isdropped = True
P_RightRingMedium.visible = False
P_RightPostMedium.visible = False
RightPostMedium.isdropped = True
P_RightRingEasy.visible = True
P_RightPostEasy.visible = True
RightPostEasy.isdropped = False
P_LeftRingHard.visible = False
P_LeftPostHard.visible = False
LeftPostHard.isdropped = True
P_LeftRingMedium.visible = False
P_LeftPostMedium.visible = False
LeftPostMedium.isdropped = True
P_LeftRingEasy.visible = True
P_LeftPostEasy.visible = True
LeftPostEasy.isdropped = False
end select
vpminit me
On Error Resume Next
Controller.GameName=cGameName
Controller.Games(cGameName).Settings.Value("samples")=0
Controller.SplashInfoLine = "Junk Yard, Williams 1996" & vbNewLine & "Created by mfuegemann"
Controller.ShowDMDOnly = True
Controller.HandleKeyboard = False
Controller.ShowTitle = False
Controller.ShowFrame = False
Controller.HandleMechanics = False
' DMD position for 3 Monitor Setup
'Controller.Games(cGameName).Settings.Value("dmd_pos_x")=3850
'Controller.Games(cGameName).Settings.Value("dmd_pos_y")=300
'Controller.Games(cGameName).Settings.Value("dmd_width")=505
'Controller.Games(cGameName).Settings.Value("dmd_height")=155
'Controller.Games(cGameName).Settings.Value("rol")=0
'Controller.Games(cGameName).Settings.Value("ddraw") = 1 'set to 0 if You have problems with DMD showing or table stutter
Controller.Run
If Err Then MsgBox Err.Description
On Error Goto 0
PinMAMETimer.Interval=PinMAMEInterval
vpmNudge.TiltSwitch = 14
vpmNudge.Sensitivity = 5
vpmMapLights AllLights
'Bus diverter starts down
Sol6.IsDropped = True
'Scoop Init (Up)
controller.switch(72) = False
P_Fork1.RotX = 0
P_Fork2.RotX = 0
P_Fork1.collidable = True
P_Fork2.collidable = True
'Crane Init (Down)
controller.switch(28) = True
'Fridge Popper
Set bsFridgePopper = New cvpmBallStack
bsFridgePopper.InitSw 0,37,36,43,0,0,0,0
bsFridgePopper.InitKick Sol2, 20, 6
bsFridgePopper.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solon",DOFContactors)
bsFridgePopper.Balls = 1
'Trough
Set bsTrough = New cvpmBallStack
bsTrough.InitSw 0,32,33,34,35,0,0,0
bsTrough.InitKick BallRelease, 95, 5
bsTrough.InitEntrySnd SoundFX("BallRelease",DOFContactors), "Solon"
'bsTrough.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solon",DOFContactors)
bsTrough.Balls = 3
Auto_Plunger.Pullback
VRRoom = 2
VRChangeRoom
End Sub
Sub JunkYard_Exit
SaveLUT
Controller.Stop
End Sub
'-----------------------------------
' Keyboard Handlers
'-----------------------------------
Dim BIPL:BIPL=0
Sub JunkYard_KeyDown(ByVal keycode)
' LUT-Changer for VR Room
If RenderingMode = 2 Then
If Keycode = LeftMagnaSave and BIPL = 0 Then
LUTSet = LUTSet + 1
If LutSet > 16 Then LUTSet = 0
lutsetsounddir = 1
If LutToggleSound Then
If lutsetsounddir = 1 And LutSet <> 16 Then
Playsound "click", 0, 1, 0.1, 0.25
End If
If lutsetsounddir = -1 And LutSet <> 16 Then
Playsound "click", 0, 1, 0.1, 0.25
End If
If LutSet = 16 Then
Playsound "gun", 0, 1, 0.1, 0.25
End If
LutSlctr.enabled = true
SetLUT
ShowLUT
End If
End If
' Change room with right magnasave
If keycode = rightmagnasave and BIPL = 0 then
VRRoom = VRRoom +1
If VRRoom > 2 then VRRoom = 1
VRChangeRoom
End If
' Animate flipperkeys, startgamekey and plunger
If keycode = LeftFlipperKey Then
VR_CabFlipperLeft.X = VR_CabFlipperLeft.X +10
End If
If keycode = RightFlipperKey Then
VR_CabFlipperRight.X = VR_CabFlipperRight.X - 10
End If
If keycode = PlungerKey Then
TimerPlunger.Enabled = True
TimerPlunger2.Enabled = False
End If
If keycode = StartGameKey Then
VR_CabStartbutton.y = VR_CabStartbutton.y -5
End If
Else ' Desktop/Cab mode for LUT
If KeyCode = LeftMagnaSave Then
bLutActive = True
End If
If KeyCode = RightMagnaSave Then
If bLutActive Then
If DisableLUTSelector = 0 Then
LUTSet = LUTSet - 1
If LutSet < 0 Then LUTSet = 16
lutsetsounddir = 1
If lutsetsounddir = 1 And LutSet <> 16 Then
Playsound "click", 0, 1, 0.1, 0.25
End If
If lutsetsounddir = -1 And LutSet <> 16 Then
Playsound "click", 0, 1, 0.1, 0.25
End If
If LutSet = 16 Then
Playsound "gun", 0, 1, 0.1, 0.25
End If
LutSlctr.enabled = true
SetLUT
ShowLUT
End If
End If
End If
End If
If KeyCode = PlungerKey Then Plunger.Pullback:SoundPlungerPull()
If keycode = LeftFlipperKey Then
FlipperActivate LeftFlipper, LFPress
End If
If keycode = RightFlipperKey Then
FlipperActivate RightFlipper, RFPress
End If
' 11/28/22 - Old nudge values.
'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 = LeftTiltKey Then
Nudge 90, 1
SoundNudgeLeft()
End If
If keycode = RightTiltKey Then
Nudge 270, 1
SoundNudgeRight()
End If
If keycode = CenterTiltKey Then
Nudge 0, 1
SoundNudgeCenter()
End If
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 vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub JunkYard_KeyUp(ByVal keycode)
' Left magna has to be held down with right magna to cycle through LUTs. (desktop/cab mode only)
If RenderingMode <> 2 Then
If keycode = LeftMagnaSave Then bLutActive = False
End If
If keycode = PlungerKey Then
TimerPlunger.Enabled = False
TimerPlunger2.Enabled = True
VR_Primary_plunger.Y = -165
end if
If keycode = LeftFlipperKey Then
VR_CabFlipperLeft.X = VR_CabFlipperLeft.X -10
End If
If keycode = RightFlipperKey Then
VR_CabFlipperRight.X = VR_CabFlipperRight.X +10
End If
If keycode = StartGameKey Then
VR_CabStartbutton.y = VR_CabStartbutton.y +5
End If
If KeyCode = PlungerKey Then
Plunger.Fire
If BIPL = 1 Then
SoundPlungerReleaseBall() ' Plunger release sound when there is a ball in shooter lane
Else
SoundPlungerReleaseNoBall() ' Plunger release sound when there is no ball in shooter lane
End If
End If
If keycode = LeftFlipperKey Then
FlipperDeActivate LeftFlipper, LFPress
End If
If keycode = RightFlipperKey Then
FlipperDeActivate RightFlipper, RFPress
End If
If vpmKeyUp(keycode) Then Exit Sub
End Sub
'-----------------------------------
'UnderTrough Handling
'-----------------------------------
' Trough Handler
Sub Drain_Hit()
RandomSoundDrain Drain
bsTrough.AddBall Me
End Sub
Sub BallRelease_UnHit: RandomSoundBallRelease BallRelease : End Sub
' Past Spinner
Sub LaunchHole_Hit
SoundSaucerKick 1, LaunchHole
Me.DestroyBall
LaunchEntry.createBall
LaunchEntry.kick 220,5
End Sub
' Sewer
Sub Sewer_Hit
SoundSaucerKick 1, Sewer
Me.DestroyBall
SewerEntry.createBall
SewerEntry.kick 260,5
End Sub
' Dog Entry
Sub DogHole_Hit
SoundSaucerKick 1, DogHole
Me.DestroyBall
DogEntry.createBall
DogEntry.kick 220,5
End Sub
' Crane Hole
Sub CraneHole_Hit
SoundSaucerKick 1, CraneHole
Me.DestroyBall
CraneEntry.createBall
CraneEntry.kick 180,5
End Sub
' Subway Handler
Sub FridgeEnter_Hit
bsFridgePopper.Addball me
End Sub
' Rolling Ramp Sounds
Sub PlasticBusRampStart_hit
WireRampOn True
End Sub
' The rolling ramp routine has issues with the ball dropping in the toilet and calculating velocity, etc.
Sub PlasticToiletRampStart_hit
Playsound "PlasticRamp1",0,1,0.15,0.25
' WireRampOn True
End Sub
'Sub PlasticToiletRampEnd_hit
' WireRampOff
'End Sub
Sub EnterWireRamp_Hit
WireRampOn False
End Sub
'-----------------------------------
' Switch Handling
'-----------------------------------
Sub Switch12_Hit:vpmTimer.PulseSw 12:End Sub
Sub Switch12a_Hit:vpmTimer.PulseSw 12:End Sub
Sub Switch115_Spin:vpmTimer.PulseSw 115:PlaySound "fx_spinner",0,0.25,0.18,0.25:End Sub
Sub Switch11_Hit:vpmTimer.PulseSw 11:End Sub
Sub switch15_Hit:vpmTimer.PulseSw 15:End Sub
Sub switch16_Hit:Controller.Switch(16) = true:End Sub
Sub switch16_UnHit:Controller.Switch(16) = false:End Sub
Sub switch17_Hit:Controller.Switch(17) = true:End Sub
Sub switch17_UnHit:Controller.Switch(17) = false:End Sub
Sub switch18_Hit:Controller.Switch(18) = True:BIPL=1:End Sub
Sub switch18_UnHit:Controller.Switch(18) = False:BIPL=0:End Sub
Sub switch26_Hit:Controller.Switch(26) = true:End Sub
Sub switch26_UnHit:Controller.Switch(26) = false:End Sub
Sub switch27_Hit:Controller.Switch(27) = True:End Sub
Sub switch27_UnHit:Controller.Switch(27) = False:End Sub
Sub switch38_Hit:vpmTimer.PulseSw 38:End Sub
Sub switch41_Hit:vpmTimer.PulseSw 41:End Sub
Sub switch42_Hit:vpmTimer.PulseSw 42:End Sub
Sub switch44_Hit:vpmTimer.PulseSw 44:End Sub
Sub switch45_Hit:Controller.Switch(45) = True:Primitive_SwitchArm.objrotx = 10:End Sub
Sub switch45_UnHit:Controller.Switch(45) = False:Switch45.timerenabled = True:End Sub
Sub switch56_Hit:vpmTimer.PulseSw 56:End Sub
Sub switch57_Hit:vpmTimer.PulseSw 57:End Sub
Sub switch58_Hit:vpmTimer.PulseSw 58:End Sub
Sub switch61_Hit:vpmTimer.PulseSw 61:End Sub
Sub switch62_Hit:vpmTimer.PulseSw 62:End Sub
Sub switch63_Hit:vpmTimer.PulseSw 63:End Sub
Sub switch64_Hit:vpmTimer.PulseSw 64:End Sub
Sub switch65_Hit:vpmTimer.PulseSw 65:End Sub
Sub switch66_Hit:vpmTimer.PulseSw 66:End Sub
Sub switch67_Hit:Controller.Switch(67) = true : End Sub
Sub switch67_UnHit:Controller.Switch(67) = false : End Sub
Sub switch68_Hit:Controller.Switch(68) = True :End Sub
Sub switch68_UnHit:Controller.Switch(68) = False : End Sub
Sub switch71_Hit:Controller.Switch(71) = True : End Sub
Sub switch71_UnHit:Controller.Switch(71) = False : End Sub
Sub switch73_Hit:vpmTimer.PulseSw 73:End Sub
Sub switch74_Hit:Controller.Switch(74) = True:End Sub
Sub switch74_UnHit:Controller.Switch(74) = False:End Sub
Sub switch76_Hit:vpmTimer.PulseSw 76:End Sub
Sub switch77_Hit:vpmTimer.PulseSw 77:End Sub
Sub switch78_Hit:vpmTimer.PulseSw 78:End Sub
Sub Switch45_Timer
Switch45.timerenabled = False
Primitive_SwitchArm.objrotx = -20
End Sub
Sub ScoopMade_Hit:playsound "WireRamp1",0,1,0.1,0.25:End Sub
Sub ToiletBowlSwitch_Hit:ActiveBall.VelY = ActiveBall.VelY * 0.6:End Sub
Sub BusRampEnd_UnHit:playsound "fx_collide",0,0.1,0,0.25:End Sub
Sub FridgeRampEnd_Hit
FridgeRampEnd.timerenabled = True
End Sub
Sub FridgeRampEnd1_Hit
if FridgeRampEnd.timerenabled Then
FridgeRampEnd.timerenabled = False
playsound "fx_collide",0,0.1,-0.15,0.25
end If
End Sub
Sub RightRampEnd_UnHit
RightRampEnd.timerenabled = True
End Sub
Sub RightRampEnd1_Hit
if RightRampEnd.timerenabled Then
RightRampEnd.timerenabled = False
playsound "fx_collide",0,0.1,0.15,0.25
end If
'debug.print "ramp speed: " & activeball.vely
' 11/28/22 - Code from Bride of Pinbot to randomize exit values to minimize repeated shots from ski jump.
'If activeball.vely > 6 Then
' activeball.vely = activeball.vely * 0.85
' If activeball.vely > 10 Then
' activeball.vely = activeball.vely * 0.7
' If activeball.vely > 12 Then
' 'activeball.vely = activeball.vely * 0.7
' activeball.vely = 2
' End If
' End If
'End If
'If activeball.vely > 14 Then
' activeball.vely = activeball.vely * 0.55
' activeball.velx = activeball.velx * 0.55
'End If
'debug.print "ramp speed >>>: " & activeball.vely
End Sub
'-----------------------------------
' Wrecking Ball Code
'-----------------------------------
Dim Wrecker,Wrecker2,bottomlimit,XBallX,YBallX,ScaleFactor,LowerBottomLimit,UpperBottomLimit,Wreckerballsize
Dim HoldCrane,WreckBallCenterX,WreckBallCenterY
LowerBottomLimit = 47
UpperBottomLimit = 120
bottomlimit = LowerBottomLimit
HoldCrane = False
WreckBallCenterX = WreckerCenterTrigger.X
WreckBallCenterY = WreckerCenterTrigger.Y
ScaleFactor = 0.65 'length of wrecker ball chain
Sub InitWreckerBall
WreckerBallSize = Ballsize
set Wrecker = WreckBallKicker1.createsizedball(Wreckerballsize / 2)
WreckBallKicker1.kick 0,0
WreckBallKicker1.enabled = false
set Wrecker2 = WreckBallKicker.createball
Wrecker2.visible = False
WreckBallKicker.kick 0,0
WreckBallKicker.timerEnabled = true
End Sub
Dim ORotX,ORotY,TransZValue
const P1Z=62
const P2Z=72
const P3Z=82
const P4Z=92
const P5Z=102
const P6Z=112
const P7Z=122
const P8Z=132
const P9Z=142
const P10Z=152
const ChainOrigin=162
const CraneUp=100
Sub WreckBallKicker_timer()
if Wrecker2.z > 350 Then
Wrecker2.z = 350
end If
Wrecker2.Velx = Wrecker2.Velx + Wrecker.velx * 1.7
Wrecker2.Vely = Wrecker2.Vely + Wrecker.vely * 1.7
Wrecker2.Velz = Wrecker2.Velz + Wrecker.velz * 1.3
Wrecker.velx = 0
Wrecker.vely = 0
Wrecker.velZ = 0
XBallX = (Wrecker2.X - WreckerCenterTrigger1.X)
YBallX = (Wrecker2.Y - WreckerCenterTrigger1.Y)
Wrecker.X = WreckBallCenterX + XBallX
Wrecker.Y = WreckBallCenterY + YBallX
Wrecker.Z = Wrecker2.Z + BottomLimit - 30
if abs(XballX) > 10 then
if abs(XballX) > 30 then
if XballX > 0 then
PCraneArm.RotZ = 2.7
end if
if XballX < 0 then
PCraneArm.RotZ = 3.3
end if
else
if abs(XballX) > 20 then
if XballX > 0 then
PCraneArm.RotZ = 2.8
end if
if XballX < 0 then
PCraneArm.RotZ = 3.2
end if
else
if XballX > 0 then
PCraneArm.RotZ = 2.9
end if
if XballX < 0 then
PCraneArm.RotZ = 3.1
end if
end if
end if
else
PCraneArm.RotZ = 3
end if
PWBallCylinder.X = Wrecker.X
PWBallCylinder.Y = Wrecker.Y
PWBallCylinder.Z = Wrecker.Z
PWBallCylinder.TransZ = 25
PChain1.X = WreckBallCenterX + (XBallX * ScaleFactor *.87)
PChain1.Y = WreckBallCenterY + (YBallX * ScaleFactor *.87)
PChain2.X = WreckBallCenterX + (XBallX * ScaleFactor *.79)
PChain2.Y = WreckBallCenterY + (YBallX * ScaleFactor *.79)
PChain3.X = WreckBallCenterX + (XBallX * ScaleFactor *.71)
PChain3.Y = WreckBallCenterY + (YBallX * ScaleFactor *.71)
PChain4.X = WreckBallCenterX + (XBallX * ScaleFactor *.63)
PChain4.Y = WreckBallCenterY + (YBallX * ScaleFactor *.63)
PChain5.X = WreckBallCenterX + (XBallX * ScaleFactor *.55)
PChain5.Y = WreckBallCenterY + (YBallX * ScaleFactor *.55)
PChain6.X = WreckBallCenterX + (XBallX * ScaleFactor *.47)
PChain6.Y = WreckBallCenterY + (YBallX * ScaleFactor *.47)
PChain7.X = WreckBallCenterX + (XBallX * ScaleFactor *.39)
PChain7.Y = WreckBallCenterY + (YBallX * ScaleFactor *.39)
PChain8.X = WreckBallCenterX + (XBallX * ScaleFactor *.31)
PChain8.Y = WreckBallCenterY + (YBallX * ScaleFactor *.31)
PChain9.X = WreckBallCenterX + (XBallX * ScaleFactor *.23)
PChain9.Y = WreckBallCenterY + (YBallX * ScaleFactor *.23)
PChain10.X = WreckBallCenterX + (XBallX * ScaleFactor *.15)
PChain10.Y = WreckBallCenterY + (YBallX * ScaleFactor *.15)
OrotX = YBallX * 0.85 'reduce MaxRotation to 55 degrees
OrotY = -XBallX * 0.85
PWBallCylinder.RotX = ORotX * 0.8
PWBallCylinder.RotY = ORotY * 0.8