-
Notifications
You must be signed in to change notification settings - Fork 39
/
Galaxy (Stern 1980).vbs
4328 lines (3629 loc) · 147 KB
/
Galaxy (Stern 1980).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
'
' :::::::: ::: ::: ::: ::: ::: ::: :::
' :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:
' +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
' :#: +#++:++#++: +#+ +#++:++#++: +#++:+ +#++:
' +#+ +#+# +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
' #+# #+# #+# #+# #+# #+# #+# #+# #+# #+#
' ######## ### ### ########## ### ### ### ### ###
'
' Galaxy / IPD No. 980 / January, 1980 / 4 Players
' Created by Bord
Option Explicit
Randomize
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
'----- Volume Options -----
Const BallRollVolume = 0.9
Const Volumedial = 0.8
'----- 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
'Outlane adjustments (seriously, don't do this):
Dim Dullard: Dullard=0
Dim Coward: Coward=0
'*******************************************
' Constants and Global Variables
'*******************************************
Const BallSize = 50 'Ball size must be 50
Const BallMass = 1 'Ball mass must be 1
Const tnob = 5 'Total number of balls
Const lob = 0 'Locked balls
Dim tablewidth: tablewidth = Table1.width
Dim tableheight: tableheight = Table1.height
LoadVPM "01000100", "Stern.VBS", 3.26
' Standard definitions
'******************************************************
'Const cGameName="galaxy",UseSolenoids=2,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="fx_Flipperup",SFlipperOff="fx_Flipperdown"
'Const SCoin="coin"
Const cGameName = "galaxy"
Const UseSolenoids = 2 '1=Normal Flippers, 2 = Fastflips
Const UseLamps = 0
Const UseSync = 0
Const HandleMech = 0
Const SSolenoidOn = ""
Const SSolenoidOff = ""
Const SFlipperOn = ""
Const SFlipperOff = ""
Const SCoin = ""
Const UseGI=0
Dim DesktopMode: DesktopMode = Table1.ShowDT
Dim hiddenvalue, DTThings
If DesktopMode = True Then 'Show Desktop components
Ramp16.visible=1
Ramp15.visible=1
hiddenvalue=0
For each DTThings in DTStuff : DTThings.visible = 1 : Next
Else
Ramp16.visible=0
Ramp15.visible=0
hiddenvalue=1
For each DTThings in DTStuff : DTThings.visible = 0 : Next
End if
Dim VR_Obj
Dim VR_Room
' VR Auto-Detect
If RenderingMode = 2 Then
VR_Room = 1
Else
VR_Room = 0
End If
If VR_Room = 1 Then
For Each VR_Obj in VRCabinet : VR_Obj.Visible = 1 : Next
For Each VR_Obj in VRRoom : VR_Obj.Visible = 1 : Next
SetBackglass
Ramp15.Visible = 0
Ramp16.Visible = 0
For each DTThings in DTStuff : DTThings.visible = 0 : Next
End If
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
'BSize = 25
'BMass = 1.4
'Solenoid Call backs
'**********************************************************************************************************
'SolCallback(1) = rsling
'SolCallback(2) = lsling
'SolCallback(3) = topbump
SolCallback(4) = "ResetDropT" '"dtdrop"
SolCallback(5) = "solleftout"
SolCallback(6) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
'SolCallback(7) = rbump
SolCallback(8) = "SolTopSaucer"
SolCallback(9) = "drop1"
SolCallback(10) = "drop2"
SolCallback(11) = "solrelease" '"bstrough.solout"
'SolCallback(12) = lbump
SolCallback(13) = "drop3"
SolCallback(14) = "drop4"
SolCallback(15) = "BRelease"
SolCallback(17) = "PFGI"
SolCallback(19) = "vpmNudge.SolGameOn"
'SolCallback(sLLFlipper)="vpmSolFlipper LeftFlipper,nothing,"
'SolCallback(sLRFlipper)="vpmSolFlipper RightFlipper,nothing,"
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
'Solenoid Controlled toys
'**********************************************************************************************************
Sub Drop1(enabled) : If enabled Then: DTDrop 4 :sw4_s.visible=False: controller.switch(4) = 1 : End If : End Sub
Sub Drop2(enabled) : If enabled Then: DTDrop 11 :sw11_s.visible=False: controller.switch(11) = 1 : End If : End Sub
Sub Drop3(enabled) : If enabled Then: DTDrop 10 :sw10_s.visible=False: controller.switch(10) = 1 : End If : End Sub
Sub Drop4(enabled) : If enabled Then: DTDrop 9 :sw9_s.visible=False: controller.switch(9) = 1 : End If : End Sub
'Sub Drop1(enabled) : If enabled Then: DTHit 4: End If : End Sub
'Sub Drop2(enabled) : If enabled Then: DTHit 11: End If : End Sub
'Sub Drop3(enabled) : If enabled Then: DTHit 10: End If : End Sub
'Sub Drop4(enabled) : If enabled Then: DTHit 9: End If : End Sub
'Sub DTdrop(enabled)
' if enabled then
' dtL.SolDropUp enabled
' end if
'End Sub
'Playfield GI
Sub PFGI(Enabled)
If Enabled Then
' GiOFF
gilvl = 0
dim xx
For each xx in GI1:xx.State = 0: Next
If VR_Room = 1 Then For each xx in VRBGGI:xx.Visible = 0: Next
PlaySound "fx_relay"
If VR_Room = 0 Then
Table1.ColorGradeImage = "ColorGradeLUT256x16_shadowcrush"
End If
flasher1.visible=0
flasher2.visible=1
plungeguide_prim.blenddisablelighting = 0.05
bumpercap1_prim.blenddisablelighting = 0.05
bumpercap2_prim.blenddisablelighting = 0.05
bumpercap3_prim.blenddisablelighting = 0.05
bumpercap1_prim.image = "bump3off"
bumpercap2_prim.image = "bump3off"
bumpercap3_prim.image = "bump3off"
plasticedges_prim.blenddisablelighting = 0
plasticedgeslow_prim.blenddisablelighting = 0
flipperright_prim.blenddisablelighting = 0
flipperleft_prim.blenddisablelighting = 0
sw4p.blenddisablelighting = 0
sw4p.image = "drop1off"
sw11p.blenddisablelighting = 0
sw11p.image = "drop2off"
sw10p.blenddisablelighting = 0
sw10p.image = "drop3off"
sw9p.blenddisablelighting = 0
sw9p.image = "drop4off"
sw26p.blenddisablelighting = 0
sw29p.blenddisablelighting = 0
sw30p.blenddisablelighting = 0
outers_prim.blenddisablelighting = 0
innerwood_prim.blenddisablelighting = 0
sw4_s.visible=False
sw11_s.visible=False
sw10_s.visible=False
sw9_s.visible=False
Else
' GiON
gilvl = 1
For each xx in GI1:xx.State = 1: Next
If VR_Room = 1 Then For each xx in VRBGGI:xx.Visible = 1: Next
PlaySound "fx_relay"
If VR_Room = 0 Then
Table1.ColorGradeImage = "ColorGradeLUT256x16_1to1"
End IF
flasher1.visible=1
flasher2.visible=0
plungeguide_prim.blenddisablelighting = 0.4
bumpercap1_prim.blenddisablelighting = 0
bumpercap2_prim.blenddisablelighting = 0
bumpercap3_prim.blenddisablelighting = 0
bumpercap1_prim.image = "bump3on"
bumpercap2_prim.image = "bump3on"
bumpercap3_prim.image = "bump3on"
plasticedges_prim.blenddisablelighting = 0.7
plasticedgeslow_prim.blenddisablelighting = 0.7
flipperright_prim.blenddisablelighting = 0.25
flipperleft_prim.blenddisablelighting = 0.25
sw4p.blenddisablelighting = 0.9
sw4p.image = "drop1"
sw11p.blenddisablelighting = 0.9
sw11p.image = "drop2"
sw10p.blenddisablelighting = 0.9
sw10p.image = "drop3"
sw9p.blenddisablelighting = 0.9
sw9p.image = "drop4"
sw26p.blenddisablelighting = 0.3
sw29p.blenddisablelighting = 0.3
sw30p.blenddisablelighting = 0.3
outers_prim.blenddisablelighting = 0.8
innerwood_prim.blenddisablelighting = 0.8
sw4_s.visible=True
sw11_s.visible=True
sw10_s.visible=True
sw9_s.visible=True
end if
End Sub
' Timers
'******************************************************
Sub GameTimer_Timer()
Cor.Update 'update ball tracking
RollingUpdate 'update rolling sounds
DoSTAnim
DoDTAnim
If controller.switch(4)=-1 then sw4_s.visible=False
If controller.switch(11)=-1 then sw11_s.visible=False
If controller.switch(10)=-1 then sw10_s.visible=False
If controller.switch(9)=-1 then sw9_s.visible=False
End Sub
Dim FrameTime, InitFrameTime
InitFrameTime = 0
Sub FrameTimer_Timer() 'The frame timer interval should be -1, so executes at the display frame rate
FrameTime = gametime - InitFrameTime
InitFrameTime = gametime 'Count frametime
FlipperVisualUpdate 'update flipper shadows and primitives
If DynamicBallShadowsOn Or AmbientBallShadowOn Then DynamicBSUpdate 'update ball shadows
UpdateGatesSpinners
End Sub
'Initiate Table
'**********************************************************************************************************
Dim GBall1, BOT, bskicker, bssaucer, dtL
Sub Table1_Init
vpmInit Me
DTsOff
Set GBall1 = Drain.CreateSizedballWithMass(Ballsize/2,Ballmass)
With Controller
.GameName = cGameName
If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
.SplashInfoLine = "Galaxy (Stern 1980)"
.HandleMechanics=0
.HandleKeyboard=0
.ShowDMDOnly=1
.ShowFrame=0
.ShowTitle=0
.hidden = hiddenvalue
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
'Main Timer init
PinMAMETimer.Interval=PinMAMEInterval
PinMAMETimer.Enabled=1
'Nudging
vpmNudge.TiltSwitch = 7
vpmNudge.Sensitivity = 2
vpmNudge.TiltObj = Array(Bumper1,Bumper2,LeftSlingshot,RightSlingshot)
' Set bsTrough=New cvpmBallStack
' with bsTrough
' .InitSw 0,33,0,0,0,0,0,0
' .InitKick BallRelease,90,7
' .InitExitSnd Soundfx("popper",DOFContactors), Soundfx("solenoid",DOFContactors)
' .Balls=1
' end with
BOT = Array(GBall1)
' Set dtL=New cvpmDropTarget
' dtL.InitDrop Array(sw4,sw11,sw10,sw9),Array(4,11,10,9)
' dtL.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
sw4p.blenddisablelighting = 0.1
sw11p.blenddisablelighting = 0.1
sw10p.blenddisablelighting = 0.1
sw9p.blenddisablelighting = 0.1
dim xx
For each xx in Rubbers:xx.blenddisablelighting = 0: Next
End Sub
Sub Table1_Paused:Controller.Pause = 1:End Sub
Sub Table1_unPaused:Controller.Pause = 0:End Sub
Sub Table1_exit()
Controller.Pause = False
Controller.Stop
End Sub
' Key Press Handling
'******************************************************
Sub Table1_KeyDown(ByVal KeyCode)
' If KeyDownHandler(keycode) Then Exit Sub
If Keycode = LeftFlipperKey Then
FlipperActivate LeftFlipper, LFPress
VR_CabFlipperLeft.X = VR_CabFlipperLeft.X + 10
End If
If Keycode = RightFlipperKey Then
FlipperActivate RightFlipper, RFPress
VR_CabFlipperRight.X = VR_CabFlipperRight.X - 10
End If
If keycode = PlungerKey Then
Plunger.PullBack
SoundPlungerPull
TimerPlunger.Enabled = True
TimerPlunger2.Enabled = False
End If
If keycode = LeftTiltKey Then Nudge 90, 1 : SoundNudgeLeft
If keycode = RightTiltKey Then Nudge 270, 1 : SoundNudgeRight
If keycode = CenterTiltKey Then Nudge 0, 1 : SoundNudgeCenter
If keycode = StartGameKey Then
SoundStartButton
VR_Cab_StartButton.y = VR_Cab_StartButton.y - 5
End If
If keycode = AddCreditKey or keycode = AddCreditKey2 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
' 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
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Table1_KeyUp(ByVal KeyCode)
' If KeyUpHandler(keycode) Then Exit Sub
If Keycode = LeftFlipperKey Then
FlipperDeActivate LeftFlipper, LFPress
VR_CabFlipperLeft.X = VR_CabFlipperLeft.X - 10
End If
If Keycode = RightFlipperKey Then
FlipperDeActivate RightFlipper, RFPress
VR_CabFlipperRight.X = VR_CabFlipperRight.X + 10
End If
If keycode = PlungerKey Then
Plunger.Fire
SoundPlungerReleaseBall
TimerPlunger.Enabled = False
TimerPlunger2.Enabled = True
VR_Primary_plunger.Y = 2115
End If
If Keycode = StartGameKey Then
VR_Cab_StartButton.y = VR_Cab_StartButton.y + 5
End If
'Manual Ball Control
If EnableBallControl = 1 Then
If keycode = 203 Then BCleft = 0 ' Left Arrow
If keycode = 200 Then BCup = 0 ' Up Arrow
If keycode = 208 Then BCdown = 0 ' Down Arrow
If keycode = 205 Then BCright = 0 ' Right Arrow
End If
If vpmKeyUp(keycode) Then Exit Sub
End Sub
' switches
'**********************************************************************************************************
' Drain
'*******************************************
Sub Drain_Hit
RandomSoundDrain Drain
Controller.Switch(33) = 1
End Sub
Sub SolRelease(enabled)
If enabled Then
RandomSoundBallRelease Drain
Drain.kick 60, 15
Controller.Switch(33) = 0
End If
End Sub
'kicker
'Sub sw40_Hit
' playsound "kickerenter"
' Controller.Switch(40) = 1
' topsaucersafetytimer.enabled=1
'End Sub
'
'kicker safety in case kickout stalls
'Sub topsaucersafetytimer_timer
' sw40.Kick 100, 15 + 5 * Rnd
'testing playsound "bell"
' topsaucersafetytimer.enabled=0
'End Sub
'******************************************************
' Saucer
'******************************************************
dim k1step, k2step, k3step
Sub KickBall(kball, kangle, kvel, kvelz, kzlift)
dim rangle
rangle = PI * (kangle - 90) / 180
kball.z = kball.z + kzlift
kball.velz = kvelz
kball.velx = cos(rangle)*kvel
kball.vely = sin(rangle)*kvel
End Sub
Dim KickerBall
'
Sub sw40_Hit
set KickerBall = activeball
Controller.Switch(40) = 1
SoundSaucerLock
End Sub
Sub sw40_unHit
Controller.Switch(40) = 0
SoundSaucerKick 1, sw40
End Sub
dim kickstep1
Sub SolTopSaucer(enabled)
if enabled then
If sw40.ballcntover > 0 then
KickBall KickerBall, 110, 14, 5, 30
End If
' cupun2.rotx = -25
k3step=0
kicktoptimer.enabled=1
end if
End Sub
Sub kicktoptimer_Timer
Select Case K3Step
' Case 3:cupun2.rotx = -25
' Case 4:cupun2.rotx = -25
' Case 5:cupun2.rotx = -25
' Case 6:cupun2.rotx = -25
' Case 7:cupun2.rotx = -25
' Case 8:cupun2.rotx = -18
' Case 9:cupun2.rotx = -11
' Case 10:cupun2.rotx = 0
Case 11:Me.Enabled = 0: if sw40.ballcntover > 0 then SolTopSaucer -1'SolSaucer -1
End Select
k3Step = k3Step + 1
End Sub
'********************** Drop Targets ************************
Sub Sw4_Hit:DTHit 4: TargetBouncer Activeball, 1.5: End Sub
Sub Sw11_Hit:DTHit 11: TargetBouncer Activeball, 1.5 : End Sub
Sub Sw10_Hit:DTHit 10: TargetBouncer Activeball, 1.5 : End Sub
Sub Sw9_Hit:DTHit 9: TargetBouncer Activeball, 1.5 : End Sub
Sub ResetDropT(enabled)
if enabled then
PlaySoundAt SoundFX(DTResetSound,DOFContactors),sw4p
DTRaise 4
DTRaise 11
DTRaise 10
DTRaise 9
sw4_s.visible=True
sw11_s.visible=True
sw10_s.visible=True
sw9_s.visible=True
end if
End Sub
Sub DTsOff
sw4_s.visible=False
sw11_s.visible=False
sw10_s.visible=False
sw9_s.visible=False
End Sub
'********************** Stand Up Targets ************************
Sub sw26_hit :vpmTimer.PulseSW (26) :STHit 26:End Sub
Sub sw29_hit :vpmTimer.PulseSW (29) :STHit 29:End Sub
Sub sw30_hit :vpmTimer.PulseSW (30) :STHit 30:End Sub
'Spinner
'**************************************
Sub sw5_Spin : vpmTimer.PulseSw (5) : SoundSpinner sw5: End Sub
Sub UpdateGatesSpinners
SpinnerT1.RotX = -(sw5.currentangle)
'90 -> 6, 0 -> 0, 180 -> 0, 270 -> 6
SpinnerTShadow.size_y = abs(sin( (sw5.CurrentAngle+180) * (2*PI/360)) * 6)+2
' debug.print sw5.currentangle & " -> " & SpinnerTShadow.size_y
pSpinnerRod.TransX = sin( (sw5.CurrentAngle+180) * (2*PI/360)) * 6
pSpinnerRod.TransY = sin( (sw5.CurrentAngle- 90) * (2*PI/360)) * 6
End Sub
'Bumpers
Sub Bumper1_Hit:vpmTimer.PulseSw 12 : RandomSoundBumperTop Bumper1: End Sub
Sub Bumper2_Hit:vpmTimer.PulseSw 13 : RandomSoundBumperMiddle Bumper2: End Sub
Sub Bumper3_Hit:vpmTimer.PulseSw 14 : RandomSoundBumperBottom Bumper3: End Sub
'Star Rollovers
Sub sw18_Hit : Controller.Switch(18) = 1 : End Sub
Sub sw18_UnHit : Controller.Switch(18) = 0 : End Sub
Sub sw18a_Hit : Controller.Switch(18) = 1 : End Sub
Sub sw18a_UnHit: Controller.Switch(18) = 0 : End Sub
Sub sw23_Hit : Controller.Switch(23) = 1 : End Sub
Sub sw23_UnHit : Controller.Switch(23) = 0 : End Sub
Sub sw24_Hit : Controller.Switch(24) = 1 : End Sub
Sub sw24_UnHit : Controller.Switch(24) = 0 : End Sub
Sub sw39_Hit : Controller.Switch(39) = 1 : End Sub
Sub sw39_UnHit : Controller.Switch(39) = 0 : End Sub
'Wire Triggers
Sub sw19_Hit : Controller.Switch(19) = 1 : End Sub
Sub sw19_UnHit : Controller.Switch(19) = 0 : End Sub
Sub sw20_Hit : Controller.Switch(20) = 1 : End Sub
Sub sw20_UnHit : Controller.Switch(20) = 0 : End Sub
Sub sw21_Hit : Controller.Switch(21) = 1 : End Sub
Sub sw21_UnHit : Controller.Switch(21) = 0 : End Sub
Sub sw22_Hit : Controller.Switch(22) = 1 : End Sub
Sub sw22_UnHit: Controller.Switch(22) = 0 : End Sub
Sub sw35_Hit : Controller.Switch(35) = 1 : leftsaucersafetytimer.enabled = 1:End Sub
Sub sw35_UnHit: Controller.Switch(35) = 0 : End Sub
Sub sw36_Hit : Controller.Switch(36) = 1 : End Sub
Sub sw36_UnHit: Controller.Switch(36) = 0 : End Sub
Sub sw37_Hit : Controller.Switch(37) = 1 : End Sub
Sub sw37_UnHit: Controller.Switch(37) = 0 : End Sub
Sub sw38_Hit : Controller.Switch(38) = 1 : End Sub
Sub sw38_UnHit: Controller.Switch(38) = 0 : End Sub
' FLIPPERS
'******************************************************
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
If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper
Else
SoundFlipperUpAttackRight RightFlipper
RandomSoundFlipperUpRight RightFlipper
End If
Else
RightFlipper.RotateToStart
If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
'Flipper collide subs
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
Sub FlipperVisualUpdate 'This subroutine updates the flipper shadows and visual primitives
FlipperLSh.RotZ = LeftFlipper.CurrentAngle
FlipperRSh.RotZ = RightFlipper.CurrentAngle
flipperleft_prim.rotz = leftflipper.currentangle
flipperright_prim.rotz = rightflipper.currentangle
' LFLogo.RotZ = LeftFlipper.CurrentAngle
' RFlogo.RotZ = RightFlipper.CurrentAngle
End Sub
'******************************************************
' ZLMP: LAMPZ by nFozzy
'******************************************************
'
' Lampz is a utility designed to manage and fade the lights and light-related objects on a table that is being driven by a ROM.
' To set up Lampz, one must populate the Lampz.MassAssign array with VPX Light objects, where the index of the MassAssign array
' corrisponds to the ROM index of the associated light. More that one Light object can be associated with a single MassAssign index (not shown in this example)
' Optionally, callbacks can be assigned for each index using the Lampz.Callback array. This is very useful for allowing 3D Insert primitives
' to be controlled by the ROM. Note, the aLvl parameter (i.e. the fading level that ranges between 0 and 1) is appended to the callback call.
Dim NullFader
Set NullFader = New NullFadingObject
Dim Lampz
Set Lampz = New LampFader
InitLampsNF ' Setup lamp assignments
LampTimer.Interval = - 1
LampTimer.Enabled = 1
Sub LampTimer_Timer()
Dim x, chglamp
chglamp = Controller.ChangedLamps
If Not IsEmpty(chglamp) Then
For x = 0 To UBound(chglamp) 'nmbr = chglamp(x, 0), state = chglamp(x, 1)
Lampz.state(chglamp(x, 0)) = chglamp(x, 1)
Next
End If
Lampz.Update2 'update (fading logic only)
If VR_Room = 0 Then UpdateLeds
End Sub
Sub DisableLighting(pri, DLintensity, ByVal aLvl) 'cp's script DLintensity = disabled lighting intesity
If Lampz.UseFunc Then aLvl = Lampz.FilterOut(aLvl) 'Callbacks don't get this filter automatically
pri.blenddisablelighting = aLvl * DLintensity
End Sub
Sub SetModLamp(id, val)
Lampz.state(id) = val
End Sub
Sub InitLampsNF()
'Filtering (comment out to disable)
Lampz.Filter = "LampFilter" 'Puts all lamp intensityscale output (no callbacks) through this function before updating
'Adjust fading speeds (max level / full MS fading time). The Modulate property must be set to 1 / max level if lamp is modulated.
Dim x
For x = 0 To 150
Lampz.FadeSpeedUp(x) = 1 / 40
Lampz.FadeSpeedDown(x) = 1 / 120
Lampz.Modulate(x) = 1
Next
'One can assign some individual lamp fading speeds like this. This example is to make GI fading to appear slower
'Lampz.FadeSpeedUp(110) = 1 / 60 : Lampz.FadeSpeedDown(110) = 1 / 220 : Lampz.Modulate(110) = 1
'Lampz Assignments
' In a ROM based table, the lamp ID is used to set the state of the Lampz objects
'MassAssign is an optional way to do assignments. It'll create arrays automatically / append objects to existing arrays
Lampz.MassAssign(1) = l1
' Lampz.Callback(1) = "DisableLighting p1, 200,"
Lampz.MassAssign(1) = l1a
Lampz.MassAssign(1) = l1z
Lampz.MassAssign(2) = l2
' Lampz.Callback(2) = "DisableLighting p2, 200,"
Lampz.MassAssign(2) = l2a
Lampz.MassAssign(2) = l2z
Lampz.MassAssign(3) = l3
Lampz.MassAssign(3) = l3a
Lampz.MassAssign(3) = l3z
Lampz.MassAssign(4) = l4
' Lampz.Callback(4) = "DisableLighting p4, 200,"
Lampz.MassAssign(4) = l4a
Lampz.MassAssign(4) = l4z
Lampz.MassAssign(5) = l5
' Lampz.Callback(5) = "DisableLighting p5, 200,"
Lampz.MassAssign(5) = l5a
Lampz.MassAssign(5) = l5z
Lampz.MassAssign(6) = l6
Lampz.MassAssign(6) = l6a
' Lampz.Callback(6) = "DisableLighting p6, 200,"
Lampz.MassAssign(7) = l7
Lampz.MassAssign(7) = l7a
' Lampz.Callback(7) = "DisableLighting p7, 200,"
Lampz.MassAssign(8) = l8
Lampz.MassAssign(8) = l8a
' Lampz.Callback(8) = "DisableLighting p8, 200,"
Lampz.MassAssign(9) = l9
Lampz.MassAssign(9) = l9a
' Lampz.Callback(9) = "DisableLighting p9, 200,"
Lampz.MassAssign(10) = l10
Lampz.MassAssign(10) = l10a
' Lampz.Callback(10) = "DisableLighting p10, 200,"
Lampz.MassAssign(11) = l11
Lampz.MassAssign(11) = l11a
' Lampz.Callback(11) = "DisableLighting p11, 200,"
Lampz.MassAssign(12) = l12
Lampz.MassAssign(12) = l12a
' Lampz.Callback(12) = "DisableLighting p12, 130,"
' Lampz.MassAssign(13) = l13
' Lampz.Callback(13) = "DisableLighting p13, 250,"
' Lampz.MassAssign(14) = l14
' Lampz.Callback(14) = "DisableLighting p14, 200,"
' Lampz.MassAssign(15) = l15
' Lampz.Callback(15) = "DisableLighting p15, 200,"
' Lampz.MassAssign(16) = l16
' Lampz.Callback(16) = "DisableLighting p16, 200,"
Lampz.MassAssign(17) = l17
Lampz.MassAssign(17) = l17a
' Lampz.Callback(17) = "DisableLighting p17, 250,"
Lampz.MassAssign(18) = l18
Lampz.MassAssign(18) = l18a
'' Lampz.Callback(18) = "DisableLighting p18, 50,"
Lampz.MassAssign(19) = l19
Lampz.MassAssign(19) = l19a
' Lampz.Callback(19) = "DisableLighting p19, 200,"
Lampz.MassAssign(20) = l20
Lampz.MassAssign(20) = l20a
' Lampz.Callback(20) = "DisableLighting p20, 200,"
Lampz.MassAssign(21) = l21
Lampz.MassAssign(21) = l21a
' Lampz.Callback(21) = "DisableLighting p21, 200,"
Lampz.MassAssign(22) = l22
Lampz.MassAssign(22) = l22a
' Lampz.Callback(22) = "DisableLighting p22, 200,"
Lampz.MassAssign(23) = l23
Lampz.MassAssign(23) = l23a
' Lampz.Callback(23) = "DisableLighting p23, 200,"
Lampz.MassAssign(24) = l24
Lampz.MassAssign(24) = l24a
' Lampz.Callback(24) = "DisableLighting p24, 200,"
Lampz.MassAssign(25) = l25
Lampz.MassAssign(25) = l25a
' Lampz.Callback(25) = "DisableLighting p25, 200,"
Lampz.MassAssign(26) = l26
Lampz.MassAssign(26) = l26a
' Lampz.Callback(26) = "DisableLighting p26, 200,"
Lampz.MassAssign(27) = l27
Lampz.MassAssign(27) = l27a
Lampz.MassAssign(27) = l27b
Lampz.MassAssign(27) = l27c
' Lampz.Callback(27) = "DisableLighting p27, 200,"
Lampz.MassAssign(28) = l28
Lampz.MassAssign(28) = l28a
' Lampz.Callback(28) = "DisableLighting p28, 200,"
' Lampz.MassAssign(29) = l29
' Lampz.Callback(29) = "DisableLighting p29, 200,"
' Lampz.MassAssign(30) = l30
' Lampz.Callback(30) = "DisableLighting p30, 200,"
' Lampz.MassAssign(31) = l31
' Lampz.Callback(31) = "DisableLighting p31, 200,"
' Lampz.MassAssign(32) = l32
' Lampz.Callback(32) = "DisableLighting p32, 200,"
Lampz.MassAssign(33) = l33
Lampz.MassAssign(33) = l33a
' Lampz.Callback(33) = "DisableLighting p33, 200,"
Lampz.MassAssign(34) = l34
Lampz.MassAssign(34) = l34a
' Lampz.Callback(34) = "DisableLighting p34, 200,"
Lampz.MassAssign(35) = l35
Lampz.MassAssign(35) = l35a
' Lampz.Callback(35) = "DisableLighting p35, 200,"
Lampz.MassAssign(36) = l36
Lampz.MassAssign(36) = l36a
' Lampz.Callback(36) = "DisableLighting p36, 200,"
Lampz.MassAssign(37) = l37
Lampz.MassAssign(37) = l37a
' Lampz.Callback(37) = "DisableLighting p37, 200,"
Lampz.MassAssign(38) = l38
Lampz.MassAssign(38) = l38a
' Lampz.Callback(38) = "DisableLighting p38, 200,"
Lampz.MassAssign(39) = l39
Lampz.MassAssign(39) = l39a
' Lampz.Callback(39) = "DisableLighting p39, 200,"
Lampz.MassAssign(40) = l40
Lampz.MassAssign(40) = l40a
' Lampz.Callback(40) = "DisableLighting p40, 200,"
Lampz.MassAssign(41) = l41
Lampz.MassAssign(41) = l41a
' Lampz.Callback(41) = "DisableLighting p41, 200,"
Lampz.MassAssign(42) = l42
Lampz.MassAssign(42) = l42a
' Lampz.Callback(42) = "DisableLighting p42, 200,"
Lampz.MassAssign(43) = l43
Lampz.MassAssign(43) = l43a
' Lampz.Callback(43) = "DisableLighting p43, 200,"
Lampz.MassAssign(44) = l44
Lampz.MassAssign(44) = l44a
' Lampz.Callback(44) = "DisableLighting p44, 200,"
' Lampz.MassAssign(45) = l45
' Lampz.Callback(45) = "DisableLighting p45, 200,"
' Lampz.MassAssign(46) = l46
' Lampz.Callback(46) = "DisableLighting p46, 200,"
' Lampz.MassAssign(47) = l47
' Lampz.Callback(47) = "DisableLighting p47, 200,"
' Lampz.MassAssign(48) = l48
' Lampz.Callback(48) = "DisableLighting p48, 200,"
Lampz.MassAssign(49) = l49
Lampz.MassAssign(49) = l49a
' Lampz.Callback(49) = "DisableLighting p49, 200,"
Lampz.MassAssign(50) = l50
Lampz.MassAssign(50) = l50a
' Lampz.Callback(50) = "DisableLighting p50, 200,"
Lampz.MassAssign(51) = l51
Lampz.MassAssign(51) = l51a
' Lampz.Callback(51) = "DisableLighting p51, 200,"
Lampz.MassAssign(52) = l52
Lampz.MassAssign(52) = l52a
' Lampz.Callback(52) = "DisableLighting p52, 200,"
Lampz.MassAssign(53) = l53
Lampz.MassAssign(53) = l53a
' Lampz.Callback(53) = "DisableLighting p53, 200,"
Lampz.MassAssign(54) = l54
Lampz.MassAssign(54) = l54a
' Lampz.Callback(54) = "DisableLighting p54, 200,"
Lampz.MassAssign(55) = l55
Lampz.MassAssign(55) = l55a
' Lampz.Callback(55) = "DisableLighting p55, 200,"
Lampz.MassAssign(56) = l56
Lampz.MassAssign(56) = l56a
' Lampz.Callback(56) = "DisableLighting p56, 200,"
Lampz.MassAssign(57) = l57
Lampz.MassAssign(57) = l57a
' Lampz.Callback(57) = "DisableLighting p57, 200,"
Lampz.MassAssign(58) = l58
Lampz.MassAssign(58) = l58a
' Lampz.Callback(58) = "DisableLighting p58, 200,"
Lampz.MassAssign(59) = l59
Lampz.MassAssign(59) = l59a
' Lampz.Callback(59) = "DisableLighting p59, 200,"
Lampz.MassAssign(60) = l60
Lampz.MassAssign(60) = l60a
'Turn off all lamps on startup
Lampz.Init 'This just turns state of any lamps to 1
'Immediate update to turn on GI, turn off lamps
Lampz.Update
End Sub
'******************************************************
'**** ZGIU: GI Control
'******************************************************
'**** These are just debug commands. They emit same calls as what SolCallback will do. You may use these from debugger.
'Sub GIOn : SetRelayGI False: End Sub
'Sub GIOff : SetRelayGI True : End Sub
'**** SetRelayGI is called from SolCallback. We define lamp #110 to act as a control channel for GI events.
'**** #110 can be any free index number. This number is referred in Lampz MassAssignment section above.
'sub SetRelayGI(Enabled)
' msgbox Enabled
'some tables have this solenoid reversed. So False may mean GION,
'i.e. Sega and Data East GI lights are off when GI relay is on.
' if Enabled then
' Lampz.SetLamp 110, 0
' FlBumperFadeTarget(1) = 1 'Pop Bumper Light On when GI is off
' FlBumperFadeTarget(2) = 0 'Pop Bumper Light Off when GI is off
' FlBumperFadeTarget(3) = 0 'Pop Bumper commented out, is now always on.
' else
' Lampz.SetLamp 110, 1
' FlBumperFadeTarget(1) = 0 'Pop Bumper Light Off when GI is On
' FlBumperFadeTarget(2) = 1 'Pop Bumper Light On when GI is On
' FlBumperFadeTarget(3) = 1 'Pop Bumper commented out, is now always on.
' end if
'End Sub
'**** Use these for GI strings and stepped GI, and comment out the SetRelayGI
'**** This example table uses Relay for GI control, we don't need these at all
'Set GICallback = GetRef("SetGI") 'some tables provides GI strings via this reference
'Set GICallback2 = GetRef("SetModGI") 'use this for stepped/modulated GI
'Pinmame Controller -> core.vbs PinMameTimer Loop -> GIcallback2 -> ModLampz dynamiclamps object -> object updates / more callbacks
'Sub SetGI(aNr, aValue)
'' msgbox "nr: " & aNr & " value: " & aValue
' Lampz.SetLamp 110 + aNr, aValue
'End Sub
'
'Sub SetModGI(aNr, aValue)
'' msgbox "nr: " & aNr & " value: " & aValue
' ModLampz.SetGI aNr, aValue
'End Sub
'**** Global variable to hold current GI light intensity. Not Mandatory, but may help in other lighting subs and timers
'**** This value is updated always when GI state is being updated
dim gilvl
'**** GIupdates is called always when some event happens to GI channel. Not Mandatory, but left in use for example
Sub GIUpdates(aLvl)
'You may add any other GI related effects here. Like if you want to make some toy to appear more bright, set it like this:
'Primitive001.blenddisablelighting = 1.2 * aLvl + 0.2 'This will result to DL brightness between 0.2 - 1.4 for ON/OFF states
gilvl = aLvl 'Storing the latest GI fading state into global variable, so one can use it elsewhere too.
'debug.print alvl 'just a debug line so that you see that fading happens correctly
End Sub
'******************************************************
'**** END GI Control
'******************************************************
'====================
'Class jungle nf
'====================
'No-op object instead of adding more conditionals to the main loop
'It also prevents errors if empty lamp numbers are called, and it's only one object
'should be g2g?
Class NullFadingObject
Public Property Let IntensityScale(input)
End Property
End Class