-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathPink FloydNOPP.vbs
2265 lines (1948 loc) · 75.8 KB
/
Pink FloydNOPP.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
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
Const cGameName="esha_l4c",UseSolenoids=2,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
Const BallSize = 50
Const Ballmass = 1.7
LoadVPM "01120100", "S11.VBS", 3.22
NoUpperLeftFlipper
NoUpperRightFlipper
Dim DesktopMode: DesktopMode = Table1.ShowDT
If DesktopMode = True Then 'Show Desktop components
Ramp16.visible=1
Ramp15.visible=1
Primitive13.visible=1
Else
Ramp16.visible=0
Ramp15.visible=0
Primitive13.visible=0
End if
Dim SideWalls,Speakers,Spinner,Scream,SpeakerLights,Lightning,flames
'************************************************************************
'OPTIONS ANIMATIONS
'*************************************************************************
SideWalls = 1 'sidewall and backwall animation 1=on 0=off
Speakers = 1 'amp and speaker PINK FLOYD animation 1=on 0=off
Spinner = 1 'spinner animation 1=on 0=off
Scream = 1 'scream animation 1=on 0=off
SpeakerLights = 1 'speaker lights colour change animation 1=on 0=off
Lightning = 1 'sling shot lightning animation 1=on 0=off
flames = 1 'flame animation 1=on 0 =off
'*************************************************************
'Solenoid Call backs
'**********************************************************************************************************
SolCallback(01) = "bsTrough.SolIn"
SolCallback(02) = "bsTrough.SolOut"
SolCallback(03) = "SolDropReset"
SolCallback(04) = "SolFault"
SolCallback(05) = "bsLSaucer.SolOut"
SolCallback(06) = "BotPop"
SolCallback(07) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
SolCallback(09) = "InstituteDrop"
SolCallback(10) = "PFGI2"
'SolCallBack(11) = ""
SolCallback(13) = "VukTopPop"
SolCallBack(14) = "Setlamp 114,"
SolCallBack(15) = "PFGI"
SolCallBack(16) = "Setlamp 116,"
SolCallback(22) = "ShakerMotor"
SolCallBack(25) = "Setlamp 125,"
SolCallBack(26) = "Setlamp 126,"
SolCallBack(27) = "Setlamp 127,"
SolCallBack(28) = "Setlamp 128,"
SolCallBack(29) = "Setlamp 129,"
SolCallBack(30) = "Setlamp 130,"
SolCallBack(31) = "Setlamp 131,"
SolCallBack(32) = "Setlamp 132,"
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySoundAt SoundFX("fx_FlipL",DOFContactors), LeftFlipper:LeftFlipper.RotateToEnd:LeftFlipper1.RotateToEnd
Else
PlaySoundAt SoundFX("Flipperdown",DOFContactors), LeftFlipper:LeftFlipper.RotateToStart:LeftFlipper1.RotateToStart
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySoundAt SoundFX("fx_FlipR",DOFContactors), RightFlipper:RightFlipper.RotateToEnd
Else
PlaySoundAt SoundFX("Flipperdown",DOFContactors), RightFlipper:RightFlipper.RotateToStart
End If
End Sub
'**********************************************************************************************************
'Solenoid Controlled toys
'**********************************************************************************************************
Sub SolDropReset(Enabled)
dtL.SolDropUp Enabled
UpdateTargetShadows
end sub
Sub ShakerMotor(enabled)
If enabled Then
ShakeTimer.Enabled = 1
playsound SoundFX("Motor",DOFContactors)
Else
ShakeTimer.Enabled = 0
End If
End Sub
Sub ShakeTimer_Timer()
Nudge 0,1
Nudge 90,1
Nudge 180,1
Nudge 270,1
End Sub
'Playfield GI
Sub PFGI(Enabled)
If Enabled Then
dim xx
For each xx in GI:xx.State = 0: Next
SetLamp 101, 0
PlaySound "RelayOff"
Else
For each xx in GI:xx.State = 1: Next
SetLamp 101, 1
PlaySound "RelayOn"
End If
End Sub
' Upper Playfield GI
Sub PFGI2(Enabled)
If Enabled Then
dim xxxx
For each xxxx in GIU:xxxx.State = 0: Next
SetLamp 102, 0
PlaySound "RelayOff"
Else
For each xxxx in GIU:xxxx.State = 1: Next
SetLamp 102, 1
PlaySound "RelayOn"
End If
UpdateTargetShadows
End Sub
'**********************************************************************************************************
'Initiate Table
'**********************************************************************************************************
Dim bsTrough, bsLSaucer, dtL
Sub Table1_Init
PFGI False: PFGI2 False
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 = "EARTHSHAKER - WILLIAMS 1989"&chr(13)&"SHAKE N BAKE"
.HandleMechanics=0
.HandleKeyboard=0
.ShowDMDOnly=1
.ShowFrame=0
.ShowTitle=0
.hidden = 0
.Games(cGameName).Settings.Value("sound")=0
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
On Error Goto 0
PinMAMETimer.Interval=PinMAMEInterval
PinMAMETimer.Enabled=1
vpmNudge.TiltSwitch = 9
vpmNudge.Sensitivity = 2
vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot)
Set bsTrough = New cvpmBallStack
bsTrough.Initsw 10,11,12,13,0,0,0,0
bsTrough.InitKick BallRelease,150,7
bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("SolOn",DOFContactors)
bsTrough.Balls = 3
Set bsLSaucer = New cvpmBallStack
bsLSaucer.InitSaucer sw20, 20, 250, 18
bsLSaucer.InitExitSnd SoundFX("",DOFContactors), SoundFX("SolOn",DOFContactors)
Set dtL=New cvpmDropTarget
dtL.InitDrop Array(sw27,sw28,sw29),Array(27,28,29)
dtL.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
HRampDX.Collidable=0
' Create Captive Ball
CapKicker.CreateSizedBallWithMass BSize,BMass
CapKicker.Kick 0,5
End Sub
'**********************************************************************************************************
'Plunger code
'**********************************************************************************************************
Sub Table1_KeyDown(ByVal KeyCode)
If keycode = PlungerKey Then Plunger.Pullback::PlaySoundAt "plungerpull", Plunger
If keycode = LeftFlipperKey Then Controller.Switch(58) = 1
If keycode = RightFlipperKey Then Controller.Switch(57) = 1
If KeyDownHandler(keycode) Then Exit Sub
End Sub
Sub Table1_KeyUp(ByVal KeyCode)
If keycode = PlungerKey Then Plunger.Fire:PlaySoundAt "plunger", Plunger
If keycode = LeftFlipperKey Then Controller.Switch(58) = 0
If keycode = RightFlipperKey Then Controller.Switch(57) = 0
If keycode = LeftTiltKey Then Nudge 90, 1 : SoundNudgeLeft
If keycode = RightTiltKey Then Nudge 270, 1 : SoundNudgeRight
If KeyUpHandler(keycode) Then Exit Sub
End Sub
Sub UpdateTargetShadows
' If the upper GI is off, shadows should be off.
if LampState(102) = 0 then
SetLamp 105, 0
SetLamp 106, 0
SetLamp 107, 0
Else
SetLamp 105, 1+Controller.Switch(27)
SetLamp 106, 1+Controller.Switch(28)
SetLamp 107, 1+Controller.Switch(29)
end if
end sub
'**********************************************************************************************************
' Drain hole and kickers
Sub Drain_Hit:bsTrough.addball me
playSound("Drain_" & Int(Rnd*11)+1)
playsound "bonusmult"
playsound "fx_Crowd3"
End Sub
Sub sw20_Hit:bsLSaucer.addball 0 : PlaySoundAtVol "KickerEnter", sw20, 0.25 :PlaySound"fx_BikeStart": End Sub
'Stand Up Targets
Sub sw19_hit:vpmTimer.pulseSw 19 : PlaySound"targget":End Sub
Sub sw21_hit:vpmTimer.pulseSw 21 : PlaySound"targget":End Sub
Sub sw22_hit:vpmTimer.pulseSw 22 : PlaySound"targget":End Sub
Sub sw23_hit:vpmTimer.pulseSw 23 : Playsound"q_lockislit":End Sub
Sub sw24_hit:vpmTimer.pulseSw 24 : PlaySound"targget":End Sub
Sub sw30_hit:vpmTimer.pulseSw 30 : PlaySound"targget":End Sub
'Drop Targets
Sub Sw27_Dropped:dtL.Hit 1 :UpdateTargetShadows:End Sub
Sub Sw28_Dropped:dtL.Hit 2 :UpdateTargetShadows:End Sub
Sub Sw29_Dropped:dtL.Hit 3 :UpdateTargetShadows:End Sub
'Wire Triggers
Sub sw14_Hit:Controller.Switch(14)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover:PlaySound "fx_BikeStart":WireRampOff: End Sub
Sub sw14_UnHit:Controller.Switch(14)=0:End Sub
Sub sw15_Hit:Controller.Switch(15)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover:PlaySound"rightin2": End Sub
Sub sw15_UnHit:Controller.Switch(15)=0:End Sub
Sub sw16_Hit:Controller.Switch(16)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover:PlaySound"outlanes": End Sub
Sub sw16_UnHit:Controller.Switch(16)=0:End Sub
Sub sw17_Hit:Controller.Switch(17)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover:PlaySound"outlanes": End Sub
Sub sw17_UnHit:Controller.Switch(17)=0:End Sub
Sub sw18_Hit:Controller.Switch(18)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover:PlaySound "fx_BikeStart":WireRampOff: End Sub
Sub sw18_UnHit:Controller.Switch(18)=0:End Sub
Sub sw33_Hit:controller.switch (33)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover:WireRampOff: End Sub
Sub sw33_unHit:controller.switch (33)=0:End Sub
Sub sw34_Hit:controller.switch (34)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover: End Sub
Sub sw34_unHit:controller.switch (34)=0:End Sub
Sub sw35_Hit:controller.switch (35)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover: End Sub
Sub sw35_unHit:controller.switch (35)=0:End Sub
Sub sw36_Hit:controller.switch (36)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover:WireRampOff: End Sub
Sub sw36_unHit:controller.switch (36)=0:End Sub
'Gate Trigger
Sub sw31_hit:vpmTimer.pulseSw 31 : End Sub
Sub sw32_hit:vpmTimer.pulseSw 32 : End Sub
Sub sw43_hit:vpmTimer.pulseSw 43 :WireRampOn True: End Sub
Sub sw44_hit:vpmTimer.pulseSw 44 :WireRampOn True: End Sub
'Subway
Sub sw38_Hit:Controller.Switch(38)=1 : playsound"Subway" : End Sub
Sub sw38_UnHit:Controller.Switch(38)=0:End Sub
Sub sw39_Hit:Controller.Switch(39)=1 : End Sub
Sub sw39_unHit:Controller.Switch(39)=0:End Sub
'Spinners
Sub sw41_Spin:vpmTimer.PulseSw 41 : playsound"fx_spinner" :PlaySound"spinner" End Sub
'Left Ramp Wire Triggers
Sub sw45_Hit: controller.switch (45)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover: End Sub
Sub sw45_unHit: controller.switch (45)=0:End Sub
Sub sw46_Hit: controller.switch (46)=1 : PlaySoundAtBall "Sensor" :RandomSoundRollover: End Sub
Sub sw46_unHit: controller.switch (46)=0:End Sub
' Shooter lane
Sub sw50_Hit: controller.switch (50)=1 :RandomSoundRollover:End Sub
Sub sw50_unHit: controller.switch (50)=0:End Sub
'Bumpers
Sub Bumper1_Hit : vpmTimer.PulseSw(52) : PlaySoundAt SoundFX("",DOFContactors), Bumper1:RandomSoundBumper1:End Sub
Sub Bumper2_Hit : vpmTimer.PulseSw(53) : PlaySoundAt SoundFX("",DOFContactors), Bumper2:RandomSoundBumper2:End Sub
Sub Bumper3_Hit : vpmTimer.PulseSw(54) : PlaySoundAt SoundFX("",DOFContactors), Bumper3:RandomSoundBumper3:End Sub
'Generic Sounds
Sub Trigger1_Hit : PlaySound "fx_ballrampdrop": End Sub
Sub Trigger2_Hit : StopSound "Wire Ramp" : PlaySound "fx_ballrampdrop"
End Sub
Sub Trigger3_Hit : StopSound "Wire Ramp" :WireRampOff: End Sub
Sub Trigger4_Hit : PlaySound "Wire Ramp": End Sub
Sub Trigger5_Hit : StopSound "Wire Ramp" : PlaySound "popper_ball":End Sub
Sub Trigger6_Hit : PlaySound "popper_ball":PlaySound "kfaultrel":PlaySound "earthsk3000":PlaySound "matchstart" End Sub
Sub PlungerCradle_Hit
'Reset ball spin parameters, they don't "dissipate" at rest and they causes inconsistent shooting behavior
ActiveBall.AngMomX = 0
ActiveBall.AngMomY = 0
ActiveBall.AngMomZ = 0
ActiveBall.AngVelX = 0
ActiveBall.AngVelY = 0
ActiveBall.AngVelZ = 0
end sub
'***********************************
'Top Raising VUK
'***********************************
'Variables used for VUK
Dim raiseballsw, raiseball
Sub TopVUK_Hit()
PlaySound"lockedbacksd"
PlaySound"terremoto"
WireRampOff
TopVUK.Enabled=FALSE
Controller.switch (37) = True
PlaySoundAtVol "popper_ball", TopVUK, 0.25
End Sub
Sub VukTopPop(enabled)
if(enabled and Controller.switch (37)) then
PlaySoundAt SoundFX("Popper_ball",DOFContactors), TopVUK
TopVUK.DestroyBall
Set raiseball = TopVUK.CreateBall
raiseballsw = True
TopVukraiseballtimer.Enabled = True 'Added by Rascal
TopVUK.Enabled=TRUE
Controller.switch (37) = False
else
'PlaySound "Popper"
end if
End Sub
Sub TopVukraiseballtimer_Timer()
If raiseballsw = True then
raiseball.z = raiseball.z + 10
If raiseball.z > 190 then
'msgbox ("Over")
TopVUK.Kick 270, 10
Set raiseball = Nothing
TopVukraiseballtimer.Enabled = False
raiseballsw = False
PlaySound "Wire Ramp"
If InstZone = 0 Then
StopMusic
PlaySound"multiball"
End If
PlaySound"kfaultrel"
End If
End If
End Sub
'********************
' Bottom raising VUK
'********************
Dim braiseballsw, braiseball
Sub BottomVuk_Hit()
playsound"popper_ball"
BottomVUK.Enabled=FALSE
Controller.switch (40) = True
End Sub
Sub BotPop(enabled)
if(enabled and Controller.switch (40)) then
playsound SoundFX("Popper",DOFContactors)
BottomVUK.DestroyBall
Set braiseball = BottomVUK.CreateBall
braiseballsw = True
BottomVukraiseballtimer.Enabled = True 'Added by Rascal
BottomVUK.Enabled=TRUE
Controller.switch (40) = False
else
'PlaySound "Popper"
end if
End Sub
Sub BottomVukraiseballtimer_Timer()
If braiseballsw = True then
braiseball.z = braiseball.z + 10
If braiseball.z > 90 then
'msgbox ("Over")
BottomVUK.Kick 210, 9
Set braiseball = Nothing
BottomVukraiseballtimer.Enabled = False
braiseballsw = False
PlaySound "Wire Ramp"
End If
End If
End Sub
'*************************************************
' California Nevada DIVERTER
'*************************************************
dim FaultOpen, FaultChange : FaultOpen = False : FaultChange = False
Sub SolFault(enabled)
If enabled Then
FaultOpen = Not FaultOpen
If FaultOpen Then
OpenFaultTimer.enabled=1
HRampSX.Collidable= 0
HRampDX.Collidable= 1
FaultChange = 1
Else
CloseFaultTimer.enabled=1
HRampSX.Collidable= 1
HRampDX.Collidable= 0
FaultChange = 1
End If
End If
End Sub
Dim BridgeStep: BridgeStep = 0
Sub OpenFaultTimer_Timer
Select Case BridgeStep
Case 0: CalPrim.TransX =0 : NevadaPrim.TransX =0 : BridgeStep =1
Case 1: CalPrim.TransX =-3: NevadaPrim.TransX =3 : BridgeStep =2
Case 2: CalPrim.TransX =-6: NevadaPrim.TransX =6 : BridgeStep =3
Case 3: CalPrim.TransX =-11: NevadaPrim.TransX =11 : BridgeStep =4
Case 4: CalPrim.TransX =-16: NevadaPrim.TransX =16 : BridgeStep =5
Case 5: CalPrim.TransX =-23: NevadaPrim.TransX =26 : BridgeStep =0 : controller.switch(42) = 1 : OpenFaultTimer.enabled = 0
End Select
End Sub
Sub CloseFaultTimer_Timer
Select Case BridgeStep
Case 0: CalPrim.TransX =-23: NevadaPrim.TransX =26 : BridgeStep =1
Case 1: CalPrim.TransX =-17: NevadaPrim.TransX =17 : BridgeStep =2
Case 2: CalPrim.TransX =-11: NevadaPrim.TransX =11 : BridgeStep =3
Case 3: CalPrim.TransX =-6: NevadaPrim.TransX =6 : BridgeStep =4
Case 4: CalPrim.TransX =-3: NevadaPrim.TransX =3 : BridgeStep =5
Case 5: CalPrim.TransX =0: NevadaPrim.TransX =-0 : BridgeStep =0 : controller.switch(42) = 0 : CloseFaultTimer.enabled = 0
End Select
End Sub
'**************************************
'
' Earthquake Institute Animation
'
'**************************************
' In the real production Earthshakers, the Institute building is just a
' static toy. All it does is flash its lights. But in the pre-production
' prototypes, the building had a sliding mechanism and a motor that made it
' sink into the playfield and rise back up on certain game events. The
' ROM code that controls the building movement is still present in the
' production ROMs, so some Earthshaker owners have modded their tables to
' restore the moving building. This code implements the building animation
' in our simulated version.
'
' The Institute building is implemented using a bunch of little primitive
' objects: one for each light window, and one for the outer frame with the
' back wall and top sign. This array is a list of all of these primitve
' components. To animate the building, we simply move all of the
' primitives in unison. The animation is extremely simple in that all the
' building does is move straight up and down.
'
' Windows are at the start of the array to make it easy to find the object
' for a given window number. Note that array indices start' at 0, but window
' numbers start at 1 - so InstPrim(0) is window 1, etc.
Dim InstPrim : InstPrim = Array( _
InstituteWindow1, _
InstituteWindow2, _
InstituteWindow3, _
InstituteWindow4, _
InstituteWindow5, _
InstituteWindow6, _
InstituteWindow7, _
InstituteWindow8, _
InstituteWindow9, _
Primitive034, _
InstituteBackWall)
' Building travel parameters. The range of motion is about 3/4 of the building
' height, and it takes about 3 seconds to cover that distance.
dim InstZ, InstDZ, InstDZUp, InstDZDown, InstZMin, InstZMax, InstZRange, InstTravelTime, InstMotorOn, InstZone
InstZMin = -190 : InstZMax = 0 ' travel limits, as Z Translations for the building primitives
InstTravelTime = 3000 ' one-way travel time in milliseconds
InstMotorOn = 1 ' start with motor turned off
' figure the distance per timer events (total distance divided by total time,
' multiplied by the time interval per event)
InstZRange = InstZMax - InstZMin
InstDZUp = InstZRange / InstTravelTime * InstituteTimer.Interval
InstDZDown = -InstDZUp ' use the same speed up and down
' start fully up (set Z to max, zone to top (zone 0=bottom, 1=between top and bottom, 2=top))
InstZ = InstZMax
InstZone = 2
' Institute light states. Each array entry corresponds to the window
' primitive at the same index in InstPrim().
'
' InstLamp(i) is the ROM lamp number for the nth building light
' InstLampBri is the current brightness: 0=off, 1=33%, 2=66%, 3=100%.
' On each timer event, we increase or decrease the brightness of a light
' according to its current on/off state.
Dim InstLamp : InstLamp = Array(23, 24, 25, 20, 21, 22, 17, 18, 19)
Dim InstLampBri : InstLampBri = Array(0, 0, 0, 0, 0, 0, 0, 0, 0)
Sub InstituteTimer_Timer
' Handle the motor
if InstMotorOn then
' move up or down in the current direction
InstZ = InstZ + InstDZ
' check for limits
if InstZ >= InstZMax then
' all the the way up - stop here and reverse directions
InstZ = InstZMax
InstDZ = InstDZDown
' trip switches to tell the ROM we're in the UP position
controller.switch(25) = false
controller.switch(26) = true
InstZone = 3
elseif InstZ <= InstZMin then
' all the way down - stop here and reverse directions
InstZ = InstZMin
InstDZ = InstDZUp
' trip switches to tell the ROM we're in the DOWN position
controller.switch(25) = true
controller.switch(26) = true
InstZone = 0
elseif InstZone = 3 and InstZ < InstZMax - InstZRange/3 then
' we were at the top, and now we're 1/3 of the way down - the
' original script set both switches off at this position
controller.switch(25) = false
controller.switch(26) = false
InstZone = 2
elseif InstZone = 2 and InstZ < InstZMin + InstZRange/3 then
' crossing 2/3 of the way down - the original script set 25 ON
' and 26 OFF at this position
controller.switch(25) = true
controller.switch(26) = false
end if
For i = 0 to UBound(InstPrim)
InstPrim(i).TransZ = InstZ
next
end if
' Handle the lights
Dim i, b
for i = 0 to UBound(InstLamp)
b = InstLampBri(i)
if LampState(InstLamp(i)) = 5 then ' controller turned lamp ON
if b < 3 then
b = b + 1
InstLampBri(i) = b
InstPrim(i).Image = "Institute Map Brightness " & b
end if
else
if b > 0 then
b = b - 1
InstLampBri(i) = b
InstPrim(i).Image = "Institute Map Brightness " & b
end if
end if
next
End Sub
' ROM motor control interface
sub InstituteDrop(enabled)
InstMotorOn = enabled
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 = 17 '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
End Sub
Sub UpdateLamps()
NFadeL 1, l1
NFadeL 2, l2
NFadeL 3, l3
NFadeL 4, l4
NFadeL 5, l5
NFadeL 6, l6
NFadeL 7, l7
NFadeL 8, l8
NFadeL 9, l9
NFadeL 10, l10
NFadeL 11, l11
NFadeL 12, l12
NFadeL 13, l13
NFadeL 14, l14
NFadeL 15, l15
NFadeL 16, l16
FadeDisableLighting 17, InstituteWindow7, 1.2
FadeDisableLighting 18, InstituteWindow8, 1.2
FadeDisableLighting 19, InstituteWindow9, 1.2
FadeDisableLighting 20, InstituteWindow4, 1.2
FadeDisableLighting 21, InstituteWindow5, 1.2
FadeDisableLighting 22, InstituteWindow6, 1.2
FadeDisableLighting 23, InstituteWindow1, 1.2
FadeDisableLighting 24, InstituteWindow2, 1.2
FadeDisableLighting 25, InstituteWindow3, 1.2
NFadeL 26, l26
NFadeL 27, l27
NFadeL 28, l28
NFadeL 29, l29
NFadeL 30, l30
NFadeL 31, l31
NFadeL 32, l32
NFadeL 33, l33
NFadeL 34, l34
NFadeL 35, l35
NFadeL 36, l36
NFadeL 37, l37
NFadeL 38, l38
NFadeL 39, l39
NFadeL 40, l40
NFadeLm 41, l41 'Bumper 1
NFadeL 41, l41a
NFadeLm 42, l42 'Bumper 2
NFadeL 42, l42a
NFadeLm 43, l43 'Bumper 3
NFadeL 43, l43a
NFadeL 44, l44
NFadeL 45, l45
NFadeL 46, l46
NFadeL 47, l47
NFadeL 48, l48
NFadeObjm 49, l49, "bulbcover1_redOn", "bulbcover1_red" 'Ramp Entrence Red LED
NFadeL 49, l49a
NFadeL 50, l50
NFadeL 51, l51
NFadeL 52, l52
NFadeL 53, l53
NFadeL 54, l54
NFadeL 55, l55
NFadeL 56, l56
NFadeObjm 57, l57, "bulbcover1_redOn", "bulbcover1_red" 'Ramp Entrence Red LED
NFadeL 57, l57a
If DesktopMode = True Then 'Show Desktop components
NFadeL 58, l58 'Backglass
NFadeL 59, l59 'Backglass
NFadeL 60, l60 'Backglass
NFadeL 61, l61 'Backglass
NFadeL 62, l62 'Backglass
NFadeL 63, l63 'Backglass
NFadeL 64, l64 'Backglass
End if
' GI
Flash 101, gion_flash1
Flash 102, gion_flash2
' Drop target shadows
Flash 105, drop1
Flash 106, drop2
Flash 107, drop3
'Solenoid Controlled Flashers
NFadeLm 114, f114
NFadeL 114, f114a
NFadeLm 131, f131
FlupperFlash 129, Flasherflash1, Flasherlit1, Flasherbase1, Flasherlight1
FlupperFlash 128, Flasherflash2, Flasherlit2, Flasherbase2, Flasherlight2
FlupperFlash 127, Flasherflash3, Flasherlit3, Flasherbase3, Flasherlight3
FlupperFlash 126, Flasherflash4, Flasherlit4, Flasherbase4, Flasherlight4
FlupperFlash 132, Flasherflash5, Flasherlit5, Flasherbase5, Flasherlight5
FlupperFlashm 132, Flasherflash9, Flasherlit9, Flasherbase9, Flasherlight9
FlupperFlash 125, Flasherflash6, Flasherlit6, Flasherbase6, Flasherlight6
FlupperFlash 130, Flasherflash7, Flasherlit7, Flasherbase7, Flasherlight7
FlupperFlash 131, Flasherflash8, Flasherlit8, Flasherbase8, Flasherlight8
FlupperFlash 116, Flasherflash10, Flasherlit10, Flasherbase10, Flasherlight10
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 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
Sub FadeDisableLighting(nr, a, alvl)
Select Case FadingLevel(nr)
Case 4
a.UserValue = a.UserValue - 0.1
If a.UserValue < 0 Then
a.UserValue = 0
FadingLevel(nr) = 0
end If
a.BlendDisableLighting = alvl * a.UserValue 'brightness
Case 5
a.UserValue = a.UserValue + 0.50
If a.UserValue > 1 Then
a.UserValue = 1
FadingLevel(nr) = 1
end If
a.BlendDisableLighting = alvl * a.UserValue 'brightness
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
Object.visible = false
End if
Object.IntensityScale = FlashLevel(nr)
Case 5 ' on
Object.visible = true
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
'*****************FLUPPER FLASH****************************
Dim FlashLevel1, FlashLevel2, FlashLevel3, FlashLevel4, FlashLevel5, FlashLevel6, FlasherLevel7, FlasherLevel8, FlasherLevel9, FlasherLevel10
FlasherLight1.IntensityScale = 0
Flasherlight2.IntensityScale = 0
Flasherlight3.IntensityScale = 0
Flasherlight4.IntensityScale = 0
Flasherlight5.IntensityScale = 0
Flasherlight6.IntensityScale = 0
Flasherlight7.IntensityScale = 0
Flasherlight8.IntensityScale = 0
Flasherlight9.IntensityScale = 0
Flasherlight10.IntensityScale = 0
Sub FlupperFlash(nr, FlashObject, LitObject, BaseObject, LightObject)
FadeEmpty nr
FlupperFlashm nr, FlashObject, LitObject, BaseObject, LightObject
End Sub
Sub FlupperFlashm(nr, FlashObject, LitObject, BaseObject, LightObject)
'exit sub
dim flashx3
Select Case FadingLevel(nr)
Case 4, 5
' This section adapted from Flupper's script
flashx3 = FlashLevel(nr) * FlashLevel(nr) * FlashLevel(nr)
FlashObject.IntensityScale = flashx3
LitObject.BlendDisableLighting = 10 * flashx3
BaseObject.BlendDisableLighting = (flashx3 * .6) + .4
LightObject.IntensityScale = flashx3
LitObject.material = "domelit" & Round(9 * FlashLevel(nr))
LitObject.visible = 1
FlashObject.visible = 1
case 3:
LitObject.visible = 0
FlashObject.visible = 0
end select
End Sub
Sub FadeEmpty(nr) 'Fade a lamp number, no object updates
Select Case FadingLevel(nr)
Case 3
FadingLevel(nr) = 0
Case 4 'off
FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
If FlashLevel(nr) < FlashMin(nr) Then
FlashLevel(nr) = FlashMin(nr)
FadingLevel(nr) = 3 '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) = 6 'completely on
End if
'Object.IntensityScale = FlashLevel(nr)
Case 6
FadingLevel(nr) = 1
End Select
End Sub
'**********************************************************************************************************
'Digital Display
'**********************************************************************************************************
Dim Digits(32)
Digits(0)=Array(a00, a05, a0c, a0d, a08, a01, a06, a0f, a02, a03, a04, a07, a0b, a0a, a09, a0e)
Digits(1)=Array(a10, a15, a1c, a1d, a18, a11, a16, a1f, a12, a13, a14, a17, a1b, a1a, a19, a1e)
Digits(2)=Array(a20, a25, a2c, a2d, a28, a21, a26, a2f, a22, a23, a24, a27, a2b, a2a, a29, a2e)
Digits(3)=Array(a30, a35, a3c, a3d, a38, a31, a36, a3f, a32, a33, a34, a37, a3b, a3a, a39, a3e)
Digits(4)=Array(a40, a45, a4c, a4d, a48, a41, a46, a4f, a42, a43, a44, a47, a4b, a4a, a49, a4e)
Digits(5)=Array(a50, a55, a5c, a5d, a58, a51, a56, a5f, a52, a53, a54, a57, a5b, a5a, a59, a5e)
Digits(6)=Array(a60, a65, a6c, a6d, a68, a61, a66, a6f, a62, a63, a64, a67, a6b, a6a, a69, a6e)
Digits(7)=Array(a70, a75, a7c, a7d, a78, a71, a76, a7f, a72, a73, a74, a77, a7b, a7a, a79, a7e)
Digits(8)=Array(a80, a85, a8c, a8d, a88, a81, a86, a8f, a82, a83, a84, a87, a8b, a8a, a89, a8e)
Digits(9)=Array(a90, a95, a9c, a9d, a98, a91, a96, a9f, a92, a93, a94, a97, a9b, a9a, a99, a9e)
Digits(10)=Array(aa0, aa5, aac, aad, aa8, aa1, aa6, aaf, aa2, aa3, aa4, aa7, aab, aaa, aa9, aae)
Digits(11)=Array(ab0, ab5, abc, abd, ab8, ab1, ab6, abf, ab2, ab3, ab4, ab7, abb, aba, ab9, abe)
Digits(12)=Array(ac0, ac5, acc, acd, ac8, ac1, ac6, acf, ac2, ac3, ac4, ac7, acb, aca, ac9, ace)
Digits(13)=Array(ad0, ad5, adc, add, ad8, ad1, ad6, adf, ad2, ad3, ad4, ad7, adb, ada, ad9, ade)
Digits(14)=Array(ae0, ae5, aec, aed, ae8, ae1, ae6, aef, ae2, ae3, ae4, ae7, aeb, aea, ae9, aee)
Digits(15)=Array(af0, af5, afc, afd, af8, af1, af6, aff, af2, af3, af4, af7, afb, afa, af9, afe)
Digits(16)=Array(b00, b05, b0c, b0d, b08, b01, b06, b0f, b02, b03, b04, b07, b0b, b0a, b09, b0e)
Digits(17)=Array(b10, b15, b1c, b1d, b18, b11, b16, b1f, b12, b13, b14, b17, b1b, b1a, b19, b1e)
Digits(18)=Array(b20, b25, b2c, b2d, b28, b21, b26, b2f, b22, b23, b24, b27, b2b, b2a, b29, b2e)
Digits(19)=Array(b30, b35, b3c, b3d, b38, b31, b36, b3f, b32, b33, b34, b37, b3b, b3a, b39, b3e)
Digits(20)=Array(b40, b45, b4c, b4d, b48, b41, b46, b4f, b42, b43, b44, b47, b4b, b4a, b49, b4e)
Digits(21)=Array(b50, b55, b5c, b5d, b58, b51, b56, b5f, b52, b53, b54, b57, b5b, b5a, b59, b5e)
Digits(22)=Array(b60, b65, b6c, b6d, b68, b61, b66, b6f, b62, b63, b64, b67, b6b, b6a, b69, b6e)
Digits(23)=Array(b70, b75, b7c, b7d, b78, b71, b76, b7f, b72, b73, b74, b77, b7b, b7a, b79, b7e)
Digits(24)=Array(b80, b85, b8c, b8d, b88, b81, b86, b8f, b82, b83, b84, b87, b8b, b8a, b89, b8e)
Digits(25)=Array(b90, b95, b9c, b9d, b98, b91, b96, b9f, b92, b93, b94, b97, b9b, b9a, b99, b9e)
Digits(26)=Array(ba0, ba5, bac, bad, ba8, ba1, ba6, baf, ba2, ba3, ba4, ba7, bab, baa, ba9, bae)
Digits(27)=Array(bb0, bb5, bbc, bbd, bb8, bb1, bb6, bbf, bb2, bb3, bb4, bb7, bbb, bba, bb9, bbe)
Digits(28)=Array(bc0, bc5, bcc, bcd, bc8, bc1, bc6, bcf, bc2, bc3, bc4, bc7, bcb, bca, bc9, bce)
Digits(29)=Array(bd0, bd5, bdc, bdd, bd8, bd1, bd6, bdf, bd2, bd3, bd4, bd7, bdb, bda, bd9, bde)
Digits(30)=Array(be0, be5, bec, bed, be8, be1, be6, bef, be2, be3, be4, be7, beb, bea, be9, bee)
Digits(31)=Array(bf0, bf5, bfc, bfd, bf8, bf1, bf6, bff, bf2, bf3, bf4, bf7, bfb, bfa, bf9, bfe)
Sub DisplayTimer_Timer
Dim ChgLED, ii, jj, num, chg, stat, obj, b, x
ChgLED=Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
If Not IsEmpty(ChgLED)Then
If DesktopMode = True Then
For ii=0 To UBound(chgLED)
num=chgLED(ii, 0) : chg=chgLED(ii, 1) : stat=chgLED(ii, 2)
if (num < 32) then
For Each obj In Digits(num)
If chg And 1 Then obj.State=stat And 1
chg=chg\2 : stat=stat\2
Next
Else
end if
Next
end if
End If
End Sub
'**********************************************************************************************************
'**********************************************************************************************************
' Start of VPX functions
'**********************************************************************************************************
'**********************************************************************************************************
'**********Sling Shot Animations