forked from LegendsUnchained/vpx-standalone-alp4k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Meteor (Stern 1979).vbs
3117 lines (2607 loc) · 111 KB
/
Meteor (Stern 1979).vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Option Explicit
Randomize
' Thalamus 2018-07-20
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Changed UseSolenoids=1 to 2
' Thalamus 2018-09-01 : Improved directional sounds
'///////////////////////-----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 = 1
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "Can't open controller.vbs"
On Error Goto 0
Const cSingleLFlip = 0
Const cSingleRFlip = 0
Const cGameName="meteorb",UseSolenoids=2,UseLamps=0,UseGI=0,SSolenoidOn="Solenoid",SSolenoidOff="SolOff"
Const SCoin=""
LoadVPM "01000100", "Stern.VBS", 1.2
' using table width and height in script slows down the performance
dim tablewidth: tablewidth = Table1.width
dim tableheight: tableheight = Table1.height
' ****************************************************
' Desktop, Cab, and VR OPTIONS
' ****************************************************
const VR_Room = 0 ' 0 is desktop or cab mode, 1 is VR Room
const cab_mode = 1 ' 1 is set for cabinet mode to turn off the desktop version of the backglass score lights
' *** If using VR Room:
const CustomWalls = 0 'set to 0 for Modern Minimal Walls, floor, and roof, 1 for Sixtoe's original walls and floor
const WallClock = 1 '1 Shows the clock in the VR minimal rooms only
Dim BallShadows: Ballshadows=1 '******************set to 1 to turn on Ball shadows
Dim FlipperShadows: FlipperShadows=1 '***********set to 1 to turn on Flipper shadows
Dim EnableBallControl
EnableBallControl = false 'Change to true to enable manual ball control (or press C in-game) via the arrow keys and B (boost movement) keys
dim xxx
If VR_Room = 0 and cab_mode = 0 Then
displaytimer.enabled=1
For each xxx in BG:xxx.Visible = 1: Next ' Show DT service lights
Else
displaytimer.enabled=0
For each xxx in BG:xxx.Visible = 0: Next ' Hide DT service lights
End if
Dim VRThings
if VR_Room = 0 Then
for each VRThings in VRStuff:VRThings.visible = 0:Next
for each VRThings in VRClock:VRThings.visible = 0:Next
for each VRThings in VRBackglass:VRThings.visible = 0:Next
for each VRThings in DTPrims:VRThings.visible = 1: Next
Else
for each VRThings in VRStuff:VRThings.visible = 1:Next
for each VRThings in VRClock:VRThings.visible = WallClock:Next
for each VRThings in DTPrims:VRThings.visible = 0: Next
'Custom Walls, Floor, and Roof
if CustomWalls = 1 Then
VR_Room_Wall_Left.image = "VR_Wall_Left"
VR_Room_Wall_Right.image = "VR_Wall_Right"
VR_Room_Floor.image = "VR_Floor"
VR_Room_Roof.image = "VR_Roof"
end if
End If
'*****************************************************************************************************
' VR PLUNGER ANIMATION
'*****************************************************************************************************
Sub TimerPlunger_Timer
If VR_Primary_plunger.Y < 2200 then
VR_Primary_plunger.Y = VR_Primary_plunger.Y + 5
End If
End Sub
Sub TimerPlunger2_Timer
VR_Primary_plunger.Y = 2114 + (5* Plunger.Position) -20
End Sub
'***************************************************************************************
' CODE BELOW IS FOR THE VR CLOCK. This was originally taken from Rascal VP9 clock table
'***************************************************************************************
Dim CurrentMinute ' for VR clock
Sub ClockTimer_Timer()
'ClockHands Below *********************************************************
Pminutes.RotAndTra2 = (Minute(Now())+(Second(Now())/100))*6
Phours.RotAndTra2 = Hour(Now())*30+(Minute(Now())/2)
Pseconds.RotAndTra2 = (Second(Now()))*6
CurrentMinute=Minute(Now())
End Sub
'Solenoid Call backs
'**********************************************************************************************************
SolCallback(3) = "Sol2DropUp"
SolCallback(4) = "dtMdrop"
SolCallback(5) = "dtE1drop"
SolCallback(6) = "SolKnocker"
SolCallback(7) = "Sol1DropUp"
SolCallback(8) = "dtTdrop"
SolCallback(9) = "sol3DropUp"
SolCallback(11) = "dtE2drop"
SolCallback(12) = "dtOdrop"
SolCallback(13) = "SolMeteorDropUp"
SolCallback(14) = "dtRdrop"
SolCallback(15) = "bsTrough.SolOut"
SolCallback(16) = "vpmNudge.SolGameOn"
'******************************************************
' FLIPPERS
'******************************************************
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Const ReflipAngle = 20
Sub SolLFlipper(Enabled)
If Enabled Then
LF.Fire
If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper
Else
SoundFlipperUpAttackLeft LeftFlipper
RandomSoundFlipperUpLeft LeftFlipper
End If
Else
LeftFlipper.RotateToStart
If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
RandomSoundFlipperDownLeft LeftFlipper
End If
FlipperLeftHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
RF.Fire
RightFlipper001.rotatetoend
If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper
Else
SoundFlipperUpAttackRight RightFlipper
RandomSoundFlipperUpRight RightFlipper
End If
Else
RightFlipper.RotateToStart
rightflipper001.rotatetostart
If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
'******************************************************
' KNOCKER
'******************************************************
Sub SolKnocker(Enabled)
If enabled Then
KnockerSolenoid 'Add knocker position object
End If
End Sub
'******************************************************
' SOLENOID CONTROLLED TOYS
'******************************************************
Sub dtMdrop(enabled)
If enabled Then
DTDrop 32
End If
End Sub
Sub dtE1drop(enabled)
If enabled Then
DTDrop 31
End If
End Sub
Sub dtTdrop(enabled)
If enabled Then
DTDrop 30
End If
End Sub
Sub dtE2drop(enabled)
If enabled Then
DTDrop 29
End If
End Sub
Sub dtOdrop(enabled)
If enabled Then
DTDrop 28
End If
End Sub
Sub dtRdrop(enabled)
If enabled Then
DTDrop 27
End If
End Sub
Sub Sol1DropUp(enabled)
if enabled then
PlaySoundAt SoundFX(DTResetSound,DOFContactors), psw23
DTRaise 22
DTRaise 23
DTRaise 24
end if
End Sub
Sub Sol2DropUp(enabled)
if enabled then
PlaySoundAt SoundFX(DTResetSound,DOFContactors), psw20
DTRaise 19
DTRaise 20
DTRaise 21
end if
End Sub
Sub Sol3DropUp(enabled)
if enabled then
PlaySoundAt SoundFX(DTResetSound,DOFContactors), psw10
DTRaise 9
DTRaise 10
DTRaise 11
end if
End Sub
Sub SolMeteorDropUp(enabled)
if enabled then
PlaySoundAt SoundFX(DTResetSound,DOFContactors), psw30
DTRaise 27
DTRaise 28
DTRaise 29
DTRaise 30
DTRaise 31
DTRaise 32
end if
End Sub
'**********************************************************************************************************
'Initiate Table
'**********************************************************************************************************
Dim bsTrough
Sub Table1_Init
vpmInit Me
' On Error Resume Next
With Controller
.GameName = cGameName
If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
.SplashInfoLine = "Meteor (Stern 1978)"
.HandleMechanics=0
.HandleKeyboard=0
.ShowDMDOnly=1
.ShowFrame=0
.ShowTitle=0
.hidden = 1
If Err Then MsgBox Err.Description
End With
On Error Goto 0
Controller.SolMask(0)=0
vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
Controller.Run
If Err Then MsgBox Err.Description
On Error Goto 0
PinMAMETimer.Interval=PinMAMEInterval
PinMAMETimer.Enabled=1
vpmNudge.TiltSwitch = 7
vpmNudge.Sensitivity = 3
vpmNudge.TiltObj = Array(Bumper1,LeftSlingshot,RightSlingshot)
Set bsTrough = New cvpmBallStack
bsTrough.Initsw 0,33,0,0,0,0,0,0
bsTrough.Balls = 1
bsTrough.InitKick BallRelease, 90,5
randomsoundballrelease drain
bsTrough.InitExitSnd "",""
bsTrough.InitEntrySnd "",""
If VR_Room = 1 Then
setup_backglass
End If
End Sub
Sub Table1_exit()
Controller.Pause = False
Controller.Stop
End Sub
'**********************************************************************************************************
'Plunger code
'**********************************************************************************************************
Sub Table1_KeyDown(ByVal KeyCode)
If keycode = LeftFlipperKey Then
FlipperActivate LeftFlipper, LFPress
' Move VR Left flipper
VR_CabFlipperLeft.X = VR_CabFlipperLeft.X +10
End If
If keycode = RightFlipperKey Then
FlipperActivate RightFlipper, RFPress
' Move VR Right flipper
VR_CabFlipperRight.X = VR_CabFlipperRight.X - 10
End If
If Keycode = StartGameKey Then
' Move VR Startbutton
VR_Cab_StartButton.y = VR_Cab_StartButton.y -5
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 = PlungerKey Then
Plunger.Pullback:SoundPlungerPull()
TimerPlunger.Enabled = True
TimerPlunger2.Enabled = False
End If
If KeyDownHandler(keycode) Then Exit Sub
' Manual Ball Control
If keycode = 46 Then ' C Key
If EnableBallControl = 1 Then
EnableBallControl = 0
Else
EnableBallControl = 1
End If
End If
If EnableBallControl = 1 Then
If keycode = 48 Then ' B Key
If BCboost = 1 Then
BCboost = BCboostmulti
Else
BCboost = 1
End If
End If
If keycode = 203 Then BCleft = 1 ' Left Arrow
If keycode = 200 Then BCup = 1 ' Up Arrow
If keycode = 208 Then BCdown = 1 ' Down Arrow
If keycode = 205 Then BCright = 1 ' Right Arrow
End If
End Sub
Sub Table1_KeyUp(ByVal KeyCode)
If keycode = LeftFlipperKey Then
FlipperDeActivate LeftFlipper, LFPress
' Move VR Left flipper
VR_CabFlipperLeft.X = VR_CabFlipperLeft.X -10
End If
If keycode = RightFlipperKey Then
FlipperDeActivate RightFlipper, RFPress
' Move VR Right flipper
VR_CabFlipperRight.X = VR_CabFlipperRight.X +10
End If
If Keycode = StartGameKey Then
' Move VR Startbutton
VR_Cab_StartButton.y = VR_Cab_StartButton.y +5
End If
If KeyCode = PlungerKey Then
Plunger.Fire
If plungelane=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
TimerPlunger.Enabled = False
TimerPlunger2.Enabled = True
VR_Primary_plunger.Y = 2114
End If
If KeyUpHandler(keycode) Then Exit Sub
'Manual Ball Control
If EnableBallControl = 1 Then
If keycode = 203 Then BCleft = 0 ' Left Arrow
If keycode = 200 Then BCup = 0 ' Up Arrow
If keycode = 208 Then BCdown = 0 ' Down Arrow
If keycode = 205 Then BCright = 0 ' Right Arrow
End If
End Sub
dim plungelane
Sub ballatplunger_hit
plungelane=1
End Sub
Sub ballatplunger_unhit
plungelane=0
End Sub
'******************************************************
' FLIPPER TRICKS
'******************************************************
RightFlipper.timerinterval=1
Rightflipper.timerenabled=True
sub RightFlipper_timer()
FlipperTricks LeftFlipper, LFPress, LFCount, LFEndAngle, LFState
FlipperTricks RightFlipper, RFPress, RFCount, RFEndAngle, RFState
end sub
dim LFPress, RFPress, LFCount, RFCount
dim LFState, RFState
dim EOST, EOSA,Frampup, FElasticity,FReturn
dim RFEndAngle, LFEndAngle
EOST = leftflipper.eostorque
EOSA = leftflipper.eostorqueangle
Frampup = LeftFlipper.rampup
FElasticity = LeftFlipper.elasticity
FReturn = LeftFlipper.return
Const EOSTnew = 1
Const EOSAnew = 1
Const EOSRampup = 0
Dim SOSRampup
SOSRampup = 2.5
Const LiveCatch = 16
Const LiveElasticity = 0.45
Const SOSEM = 0.815
Const EOSReturn = 0.045
LFEndAngle = Leftflipper.endangle
RFEndAngle = RightFlipper.endangle
Sub FlipperActivate(Flipper, FlipperPress)
FlipperPress = 1
Flipper.Elasticity = FElasticity
Flipper.eostorque = EOST
Flipper.eostorqueangle = EOSA
End Sub
Sub FlipperDeactivate(Flipper, FlipperPress)
FlipperPress = 0
Flipper.eostorqueangle = EOSA
Flipper.eostorque = EOST*EOSReturn/FReturn
If Abs(Flipper.currentangle) <= Abs(Flipper.endangle) + 0.1 Then
Dim BOT, b
BOT = GetBalls
For b = 0 to UBound(BOT)
If Distance(BOT(b).x, BOT(b).y, Flipper.x, Flipper.y) < 55 Then 'check for cradle
If BOT(b).vely >= -0.4 Then BOT(b).vely = -0.4
End If
Next
End If
End Sub
Sub FlipperTricks (Flipper, FlipperPress, FCount, FEndAngle, FState)
Dim Dir
Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
If Abs(Flipper.currentangle) > Abs(Flipper.startangle) - 0.05 Then
If FState <> 1 Then
Flipper.rampup = SOSRampup
Flipper.endangle = FEndAngle - 3*Dir
Flipper.Elasticity = FElasticity * SOSEM
FCount = 0
FState = 1
End If
ElseIf Abs(Flipper.currentangle) <= Abs(Flipper.endangle) and FlipperPress = 1 then
if FCount = 0 Then FCount = GameTime
If FState <> 2 Then
Flipper.eostorqueangle = EOSAnew
Flipper.eostorque = EOSTnew
Flipper.rampup = EOSRampup
Flipper.endangle = FEndAngle
FState = 2
End If
Elseif Abs(Flipper.currentangle) > Abs(Flipper.endangle) + 0.01 and FlipperPress = 1 Then
If FState <> 3 Then
Flipper.eostorque = EOST
Flipper.eostorqueangle = EOSA
Flipper.rampup = Frampup
Flipper.Elasticity = FElasticity
FState = 3
End If
End If
End Sub
Const LiveDistanceMin = 30 'minimum distance in vp units from flipper base live catch dampening will occur
Const LiveDistanceMax = 114 'maximum distance in vp units from flipper base live catch dampening will occur (tip protection)
Sub CheckLiveCatch(ball, Flipper, FCount, parm) 'Experimental new live catch
Dim Dir
Dir = Flipper.startangle/Abs(Flipper.startangle) '-1 for Right Flipper
Dim LiveCatchBounce 'If live catch is not perfect, it won't freeze ball totally
Dim CatchTime : CatchTime = GameTime - FCount
if CatchTime <= LiveCatch and parm > 6 and ABS(Flipper.x - ball.x) > LiveDistanceMin and ABS(Flipper.x - ball.x) < LiveDistanceMax Then
if CatchTime <= LiveCatch*0.5 Then 'Perfect catch only when catch time happens in the beginning of the window
LiveCatchBounce = 0
else
LiveCatchBounce = Abs((LiveCatch/2) - CatchTime) 'Partial catch when catch happens a bit late
end If
If LiveCatchBounce = 0 and ball.velx * Dir > 0 Then ball.velx = 0
ball.vely = LiveCatchBounce * (32 / LiveCatch) ' Multiplier for inaccuracy bounce
ball.angmomx= 0
ball.angmomy= 0
ball.angmomz= 0
End If
End Sub
Sub LeftFlipper_Collide(parm)
CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
LeftFlipperCollide parm
End Sub
Sub RightFlipper_Collide(parm)
CheckLiveCatch Activeball, RightFlipper, RFCount, parm
RightFlipperCollide parm
End Sub
'**********************************************************************************************************
'**********************************************************************************************************
'switches
'**********************************************************************************************************
' Drain kickers
Sub Drain_Hit:RandomSoundDrain drain:bsTrough.AddBall me:End Sub
'Drop Targets
Sub Sw9_Hit:DTHit 9:End Sub
Sub Sw10_Hit:DTHit 10:End Sub
Sub Sw11_Hit:DTHit 11:End Sub
Sub Sw19_Hit:DTHit 19:End Sub
Sub Sw20_Hit:DTHit 20:End Sub
Sub Sw21_Hit:DTHit 21:End Sub
Sub Sw22_Hit:DTHit 22:End Sub
Sub Sw23_Hit:DTHit 23:End Sub
Sub Sw24_Hit:DTHit 24:End Sub
Sub Sw27_Hit:DTHit 27:End Sub
Sub Sw28_Hit:DTHit 28:End Sub
Sub Sw29_Hit:DTHit 29:End Sub
Sub Sw30_Hit:DTHit 30:End Sub
Sub Sw31_Hit:DTHit 31:End Sub
Sub Sw32_Hit:DTHit 32:End Sub
'Stand Up Targets
Sub Tsw4_Hit: PrimStandupTgtHit 12, Tsw4, PrimT4: vpmTimer.PulseSw 4 : End Sub
Sub Tsw4_Timer: PrimStandupTgtMove 12, Tsw4, PrimT4: End Sub
'Bumpers
Sub Bumper1_Hit
vpmTimer.PulseSw 14
RandomSoundBumperMiddle Bumper1
layer1skirt3.roty=skirtAY(me,Activeball)
layer1skirt3.rotx=skirtAX(me,Activeball)
me.timerinterval = 150
me.timerenabled=1
End Sub
sub bumper1_timer
layer1skirt3.rotx=0
layer1skirt3.roty=0
me.timerenabled=0
end sub
'Dead Bumpers
Sub Bumper2_Hit
vpmTimer.PulseSw 12
layer1skirt2.roty=skirtAY(me,Activeball)
layer1skirt2.rotx=skirtAX(me,Activeball)
bumper2timer.enabled=1
End Sub
sub bumper2timer_timer
layer1skirt2.rotx=0
layer1skirt2.roty=0
bumper2timer.enabled=0
end sub
Sub Bumper3_Hit
vpmTimer.PulseSw 13
layer1skirt1.roty=skirtAY(me,Activeball)
layer1skirt1.rotx=skirtAX(me,Activeball)
bumper3timer.enabled=1
End Sub
sub bumper3timer_timer
layer1skirt1.rotx=0
layer1skirt1.roty=0
bumper3timer.enabled=0
end sub
'******************************************************
' SKIRT ANIMATION FUNCTIONS
'******************************************************
' NOTE: set bumper object timer to around 150-175 in order to be able
' to actually see the animation, adjust to your liking
Const PI = 3.1415926
Const SkirtTilt=3 'angle of skirt tilting in degrees
Function SkirtAX(bumper, bumperball)
skirtAX=cos(skirtA(bumper,bumperball))*(SkirtTilt) 'x component of angle
if (bumper.y<bumperball.y) then skirtAX=skirtAX*-1 'adjust for ball hit bottom half
End Function
Function SkirtAY(bumper, bumperball)
skirtAY=sin(skirtA(bumper,bumperball))*(SkirtTilt) 'y component of angle
if (bumper.x>bumperball.x) then skirtAY=skirtAY*-1 'adjust for ball hit left half
End Function
Function SkirtA(bumper, bumperball)
dim hitx, hity, dx, dy
hitx=bumperball.x
hity=bumperball.y
dy=Abs(hity-bumper.y) 'y offset ball at hit to center of bumper
if dy=0 then dy=0.0000001
dx=Abs(hitx-bumper.x) 'x offset ball at hit to center of bumper
skirtA=(atn(dx/dy)) '/(PI/180) 'angle in radians to ball from center of Bumper1
End Function
'Star Rollovers
Sub sw38_Hit : Controller.Switch(38) = 1 : layer2star3.transz=-6:End Sub
Sub sw38_UnHit : Controller.Switch(38) = 0 : layer2star3.transz=0:End Sub
Sub sw39_Hit : Controller.Switch(39) = 1 : layer2star2.transz=-6:End Sub
Sub sw39_UnHit : Controller.Switch(39) = 0 : layer2star2.transz=0:End Sub
Sub sw40_Hit : Controller.Switch(40) = 1 : layer2star1.transz=-6:End Sub
Sub sw40_UnHit: Controller.Switch(40) = 0 : layer2star1.transz=0:End Sub
'Wire Triggers
Sub sw34_Hit : Controller.Switch(34) = 1 : wire4.transz=-6:End Sub
Sub sw34_UnHit: Controller.Switch(34) = 0 : wire4.transz=0:End Sub
Sub sw35_Hit : Controller.Switch(35) = 1 : wire1.transz=-6:End Sub
Sub sw35_UnHit: Controller.Switch(35) = 0 : wire1.transz=0:End Sub
Sub sw36_Hit : Controller.Switch(36) = 1 : wire3.transz=-6:End Sub
Sub sw36_UnHit: Controller.Switch(36) = 0 : wire3.transz=0:End Sub
Sub sw37_Hit : Controller.Switch(37) = 1 : wire2.transz=-6:End Sub
Sub sw37_UnHit: Controller.Switch(37) = 0 : wire2.transz=0:End Sub
'Spinner
Sub sw5_Spin : vpmTimer.PulseSw (5) :PlaySoundAtLevelStatic ("fx_spinner"), gatesoundlevel, spinnerrod: End Sub
'***********Rotate Spinner
Dim Angle
Sub SpinnerTimer_Timer
Spinmesh.Rotx = sw5.CurrentAngle
Angle = (sin (sw5.CurrentAngle-180))
SpinnerRod.TransX = sin( (sw5.CurrentAngle+180) * (2*PI/360)) * 12
SpinnerRod.TransZ = sin( (sw5.CurrentAngle- 90) * (2*PI/360)) * 3.5
Dim SpinnerRadius: SpinnerRadius=7
End Sub
'***************************************************
' JP's VP10 Fading Lamps & Flashers
' Based on PD's Fading Light System
' SetLamp 0 is Off
' SetLamp 1 is On
' fading for non opacity objects is 4 steps
'***************************************************
Dim LampState(200), FadingLevel(200)
Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
InitLamps() ' turn off the lights and flashers and reset them to the default parameters
LampTimer.Interval = 5 'lamp fading speed
LampTimer.Enabled = 1
' Lamp & Flasher Timers
Sub LampTimer_Timer()
Dim chgLamp, num, chg, ii
chgLamp = Controller.ChangedLamps
If Not IsEmpty(chgLamp) Then
For ii = 0 To UBound(chgLamp)
LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
Next
End If
UpdateLamps
If VR_Room = 1 Then
VRDisplayTimer
End If
End Sub
Sub UpdateLamps
NFadeLm 1, L1
NFadeLm 2, L2
NFadeLm 3, L3
NFadeLm 4, L4
NFadeLm 5, L5
NFadeLm 5, L5a
NFadeLm 6, L6
NFadeLm 7, L7
NFadeLm 8, L8
NFadeLm 9, L9
NFadeLm 9 ,L9a
NFadeLm 10, L10
NFadeLm 11, L11
NFadeLm 12, L12
NFadeLm 14, L14
NFadeLm 15, L15
NFadeLm 17, L17
NFadeLm 18, L18
NFadeLm 19, L19
NFadeLm 20, L20
NFadeLm 21, L21
NFadeLm 22, L22
NFadeLm 23, L23
NFadeLm 24, L24
NFadeLm 25, L25
NFadeLm 25, L25a
NFadeLm 26, L26
NFadeLm 27, L27
NFadeLm 27, L27a
NFadeLm 28, L28
NFadeLm 29, L29
NFadeLm 29, L29a
NFadeLm 30, L30
NFadeLm 31, L31
NFadeLm 33, L33
NFadeLm 34, L34
NFadeLm 35, L35
NFadeLm 36, L36
NFadeLm 37, L37
NFadeLm 38, L38
NFadeLm 39, L39
NFadeLm 40, L40
NFadeLm 41, L41
NFadeLm 42, L42
NFadeLm 43, L43
NFadeLm 44, L44
NFadeLm 46, L46
NFadeLm 47, L47
NFadeLm 49, L49
NFadeLm 50, L50
NFadeLm 51, L51
NFadeLm 52, L52
NFadeLm 53, L53
NFadeLm 54, L54
NFadeLm 55, L55
NFadeLm 56, L56
NFadeLm 57, L57
NFadeLm 58, L58
NFadeLm 59, L59
NFadeLm 60, L60
NFadeLm 62, L62
If VR_Room = 0 and cab_mode = 0 Then
FadeReel 13, L13 'High Score
FadeReel 63, L63 'Match
FadeReel 45, L45 'Game Over
FadeReel 61, L61 'Tilt
End If
End Sub
' div lamp subs
Sub InitLamps()
Dim x
For x = 0 to 200
LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
FadingLevel(x) = 4 ' used to track the fading state
FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
FlashMax(x) = 1 ' the maximum value when on, usually 1
FlashMin(x) = 0 ' the minimum value when off, usually 0
FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
Next
End Sub
Sub AllLampsOff
Dim x
For x = 0 to 200
SetLamp x, 0
Next
End Sub
Sub FadePrim(nr, pri, a, b, c, d)
Select Case FadingLevel(nr)
Case 2:pri.image = d:FadingLevel(nr) = 0
Case 3:pri.image = c:FadingLevel(nr) = 2
Case 4:pri.image = b:FadingLevel(nr) = 3
Case 5:pri.image = a:FadingLevel(nr) = 1
End Select
End Sub
Sub SetLamp(nr, value)
If value <> LampState(nr) Then
LampState(nr) = abs(value)
FadingLevel(nr) = abs(value) + 4
End If
End Sub
' Lights: used for VP10 standard lights, the fading is handled by VP itself
Sub NFadeL(nr, object)
Select Case FadingLevel(nr)
Case 4:object.state = 0:FadingLevel(nr) = 0
Case 5:object.state = 1:FadingLevel(nr) = 1
End Select
End Sub
Sub NFadeLm(nr, object) ' used for multiple lights
Select Case FadingLevel(nr)
Case 4:object.state = 0
Case 5:object.state = 1
End Select
End Sub
'Lights, Ramps & Primitives used as 4 step fading lights
'a,b,c,d are the images used from on to off
Sub FadeObj(nr, object, a, b, c, d)
Select Case FadingLevel(nr)
Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
Case 5:object.image = a:FadingLevel(nr) = 1 'ON
Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
Case 13:object.image = d:FadingLevel(nr) = 0 'Off
End Select
End Sub
Sub FadeObjm(nr, object, a, b, c, d)
Select Case FadingLevel(nr)
Case 4:object.image = b
Case 5:object.image = a
Case 9:object.image = c
Case 13:object.image = d
End Select
End Sub
Sub NFadeObj(nr, object, a, b)
Select Case FadingLevel(nr)
Case 4:object.image = b:FadingLevel(nr) = 0 'off
Case 5:object.image = a:FadingLevel(nr) = 1 'on
End Select
End Sub
Sub NFadeObjm(nr, object, a, b)
Select Case FadingLevel(nr)
Case 4:object.image = b
Case 5:object.image = a
End Select
End Sub
' Flasher objects
Sub Flash(nr, object)
Select Case FadingLevel(nr)
Case 4 'off
FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
If FlashLevel(nr) < FlashMin(nr) Then
FlashLevel(nr) = FlashMin(nr)
FadingLevel(nr) = 0 'completely off
End if
Object.IntensityScale = FlashLevel(nr)
Case 5 ' on
FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
If FlashLevel(nr) > FlashMax(nr) Then
FlashLevel(nr) = FlashMax(nr)
FadingLevel(nr) = 1 'completely on
End if
Object.IntensityScale = FlashLevel(nr)
End Select
End Sub
Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
Object.IntensityScale = FlashLevel(nr)
End Sub
'Reels
Sub FadeReel(nr, reel)
Select Case FadingLevel(nr)
Case 2:FadingLevel(nr) = 0
Case 3:FadingLevel(nr) = 2
Case 4:reel.Visible = 0:FadingLevel(nr) = 3
Case 5:reel.Visible = 1:FadingLevel(nr) = 1
End Select
End Sub
'Inverted Reels
Sub FadeIReel(nr, reel)
Select Case FadingLevel(nr)
Case 2:FadingLevel(nr) = 0
Case 3:FadingLevel(nr) = 2
Case 4:reel.Visible = 1:FadingLevel(nr) = 3
Case 5:reel.Visible = 0:FadingLevel(nr) = 1
End Select
End Sub
'**********************************************************************************************************
'Digital Display
'**********************************************************************************************************
Dim Digits(32)
' 1st Player
Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
Digits(6) = Array(LED70,LED71,LED72,LED73,LED74,LED75,LED76)
' 2nd Player
Digits(7) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
Digits(8) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
Digits(9) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
Digits(10) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
Digits(11) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
Digits(12) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
Digits(13) = Array(LED140,LED141,LED142,LED143,LED144,LED145,LED146)
' 3rd Player
Digits(14) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
Digits(15) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
Digits(16) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
Digits(17) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
Digits(18) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
Digits(19) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
Digits(20) = Array(LED210,LED211,LED212,LED213,LED214,LED215,LED216)
' 4th Player
Digits(21) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
Digits(22) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
Digits(23) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
Digits(24) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
Digits(25) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
Digits(26) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
Digits(27) = Array(LED280,LED281,LED282,LED283,LED284,LED285,LED286)
' Credits
Digits(28) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)