-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathAvatar (Stern 2012)_Bigus(MOD)1.3.vbs
1254 lines (1049 loc) · 42 KB
/
Avatar (Stern 2012)_Bigus(MOD)1.3.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-24
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Improved directional sounds.
' Added InitVpmFFlipsSAM
' Thalamus 2018-11-01 : Improved directional sounds
' !! NOTE : Table not verified yet !!
' Options
' Volume devided by - lower gets higher sound
Const VolDiv = 2000 ' Lower number, louder ballrolling/collition sound
Const VolCol = 10 ' Ball collition divider ( voldiv/volcol )
Const VolPla = .03 ' Plastic ramp rolling volume
' The rest of the values are multipliers
'
' .5 = lower volume
' 1.5 = higher volume
Const VolBump = 2 ' Bumpers volume.
Const VolAmp = 20 ' Ampsuit volume.
Const VolRol = 1 ' Rollovers volume.
Const VolRel = 1 ' Relay volume.
Const VolGates = 1 ' Gates volume.
Const VolMetal = 1 ' Metals volume.
Const VolRH = 1 ' Rubber hits volume.
Const VolPo = 1 ' Rubber posts volume.
Const VolPi = 1 ' Rubber pins volume.
Const VolTarg = 1 ' Targets volume.
Const VolSpin = 1.5 ' Spinners volume.
Const VolFlip = 1 ' Flipper volume.
Const VolMot = 1 ' Motor volume.
Const VolSli = 1 ' Slingshot volume.
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 BallMass = 1
Const cGameName="avr_200",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin", UseVPMModSol=1
LoadVPM "01560000", "sam.VBS", 3.10
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
'*************************************************************
'Solenoid Call backs
'**********************************************************************************************************
SolCallback(1) = "solTrough" ' Through up-kicker
SolCallback(2) = "solAutofire" ' Auto Launch
'SolCallback(3) = "solampmagnet" ' Amp Suit Magnet
'SolCallback(4) = "N/A" ' Not Used
SolCallback(5) = "sol3bankmotor" ' Up-Down 3-Bank relay
SolCallback(6) = "LinkLockupUp" ' Link Lockup Up
SolCallback(7) = "LinkLockUpLatch" ' Link Lockup Latch
'SolCallback(8) = "solShakerMotor" ' Shaker Motor (Optional)
SolModCallback(9) = "SetLampMod 109," ' Top Left Pop Bumber
SolModCallback(10) = "SetLampMod 110," ' Top Right Pop Bumber
SolModCallback(11) = "SetLampMod 111," ' Bottom Pop Bumper
'SolCallback(12) = "N/A" ' Not Used
SolCallback(13) = "ampsuitmotorRelay"
'SolCallback(14) = "N/A" ' Not Used
SolCallback(15) = "SolLFlipper" ' Left Flipper
SolCallback(16) = "SolRFlipper" ' Right Flipper
'SolCallback(17) = "SolLSlingShot" ' Left Slingshot
'SolCallback(18) = "SolRSlingShot" ' Right Slingshot
'SolCallback(19) = "SolampSuitMotor" ' Amp Suit Motor
SolModCallback(20) = "SetLampMod 120," ' Left ampsuit flasher | Doc as Link Flash
SolModCallback(21) = "SetLampMod 121," ' Link Flasher | Doc as Back Panel Flash (x2)
SolModCallback(22) = "SetLampMod 122," ' In front of Jake - fantacy placement | Doc as Link (L) Flash
SolModCallback(23) = "SetLampMod 123," ' Rigth ampsuit flasher | Doc as Link (R) Flash
SolModCallback(24) = "SetLampMod 124," ' Coin ? | Doc as Optional ( eg Coin Meter )
SolModCallback(25) = "SetLampMod 125," ' Bumper flasher
SolModCallback(26) = "SetLampMod 126," ' Ampsuit mb flasher
'SolCallback(27) = "N/A" ' Not Used
SolModCallback(28) = "SetLampMod 128," ' Amp Suit Flash | Doc as Amp Suit Flash (x2)
SolModCallback(29) = "SetLampMod 129," ' upper left blue dome | Doc as Left Side Flash
SolModCallback(30) = "SetLampMod 130," ' lower left blue dome | Doc as Left Side Blue (x2)
SolModCallback(31) = "SetLampMod 131," ' upper right blue dome | Doc as Right Side Blue (x2)
SolModCallback(32) = "SetLampMod 132," ' lower left blue dome | Doc as Right Side Flash
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySoundAtVol SoundFX("fx_Flipperup",DOFContactors), LeftFlipper, VolFlip:LeftFlipper.RotateToEnd
Else
PlaySoundAtVol SoundFX("fx_Flipperdown",DOFContactors), LeftFlipper, VolFlip:LeftFlipper.RotateToStart
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySoundAtVol SoundFX("fx_Flipperup",DOFContactors),RightFlipper, VolFlip:RightFlipper.RotateToEnd
Else
PlaySoundAtVol SoundFX("fx_Flipperdown",DOFContactors),RightFlipper, VolFlip:RightFlipper.RotateToStart
End If
End Sub
'**********************************************************************************************************
'Solenoid Controlled toys
'**********************************************************************************************************
'Stern-Sega GI
set GICallback = GetRef("UpdateGI")
Sub UpdateGI(no, Enabled)
If Enabled Then
DOF 101, DOFOn
dim xx, xxx
For each xx in GI:xx.State = 1: Next 'Light Objects
For each xxx in GI2:xxx.visible = 1: Next 'Flasher Objects
PlaySoundAtVol "fx_relay", sw35, VolRel
Else
DOF 101, DOFOff
For each xx in GI:xx.State = 0: Next
For each xxx in GI2:xxx.visible = 0: Next
PlaySoundAtVol "fx_relay", sw35, VolRel
End If
End Sub
Sub ampsuitmotorRelay(Enabled)
If Enabled Then
' Controller.Switch(57) = 1:Controller.Switch(58) = 0
ampf.rotatetoend
' debug.print "ampsuitmotorrelay enabled"
PlaySoundAtVol "Diverter", ampf, VolAmp
Else
' Controller.Switch(57) = 0:Controller.Switch(58) = 1
' debug.print "ampsuitmotorrelay disabled"
ampf.rotatetostart
PlaySoundAtVol "Diverter", ampf, VolAmp
End If
End Sub
Sub LinkLockupUp(Enabled)
If Enabled Then
lockPin1.Isdropped=0:lockPin2.Isdropped=0
DropJake
PlaySoundAt SoundFX("fx_Flipperup",DOFContactors), sw17
End If
End Sub
Sub LinkLockUpLatch(Enabled)
If Enabled Then
lockPin1.Isdropped=1:lockPin2.Isdropped=1
RiseJake':JakeTop.RotX=160:
PlaySoundAt SoundFX("fx_Flipperup",DOFContactors), sw17
End If
End Sub
Sub solTrough(Enabled)
If Enabled Then
bsTrough.ExitSol_On
vpmTimer.PulseSw 22
End If
End Sub
Sub solAutofire(Enabled)
If Enabled Then
PlungerIM.AutoFire
PlaySoundAt SoundFX("Autoplunger",DOFContactors), Plunger
End If
End Sub
Sub Sol3bankmotor(Enabled)
If Enabled then
RiseBank
DropBank
end if
End Sub
'Primitive animation code
'Sub RLS_Timer()
' sw52p.RotZ = -(sw52.currentangle)
' ampprim.objrotx = ampf.currentangle
' LFLogo.RotY = LeftFlipper.CurrentAngle
' RFlogo.RotY = RightFlipper.CurrentAngle
'End Sub
Sub RLS_Timer()
RampGate1.RotZ = -(sw52.currentangle)
' RampGate2.RotZ = -(Gate3.currentangle)
ampprim.objrotx = ampf.currentangle
LFLogo.RotY = LeftFlipper.CurrentAngle
RFlogo.RotY = RightFlipper.CurrentAngle
FlipperLSh.RotZ = LeftFlipper.currentangle
FlipperRSh.RotZ = RightFlipper.currentangle
End Sub
'**********************************************************************************************************
'Initiate Table
'**********************************************************************************************************
Dim bsTrough, Mag1
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 = "Avatar, Stern 2010"&chr(13)&"You Suck"
.HandleMechanics=0
.HandleKeyboard=0
.ShowDMDOnly=1
.ShowFrame=0
.ShowTitle=0
.hidden = 0
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
On Error Goto 0
InitVpmFFlipsSAM
PinMAMETimer.Interval=PinMAMEInterval
PinMAMETimer.Enabled=1
vpmNudge.TiltSwitch=-7
vpmNudge.Sensitivity=2
vpmNudge.TiltObj=Array(Bumper1b,Bumper2b,Bumper3b,LeftSlingshot,RightSlingshot)
Set bsTrough = New cvpmBallStack
bsTrough.InitSw 0, 21, 20, 19, 18, 0, 0, 0
bsTrough.InitKick BallRelease, 70, 8
bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
bsTrough.Balls = 4
Set mag1= New cvpmMagnet
mag1.InitMagnet Magnet1, 25
mag1.GrabCenter = False
mag1.solenoid=3
mag1.CreateEvents "mag1"
' Create Captive Ball
RCaptKicker1.CreateBall
RCaptKicker1.Kick 180,10
lockPin1.Isdropped = 1
lockPin2.Isdropped = 1
InitJakeAni
Init3Bank
End Sub
'**********************************************************************************************************
'Plunger code
'**********************************************************************************************************
Sub Table1_KeyDown(ByVal KeyCode)
If KeyDownHandler(keycode) Then Exit Sub
If keycode = PlungerKey Then Plunger.Pullback:playsoundAt "plungerpull", Plunger
if KeyCode = LeftTiltKey Then Nudge 90, 4
if KeyCode = RightTiltKey Then Nudge 270, 4
if KeyCode = CenterTiltKey Then Nudge 0, 4
End Sub
Sub Table1_KeyUp(ByVal KeyCode)
If KeyUpHandler(keycode) Then Exit Sub
If keycode = PlungerKey Then Plunger.Fire:PlaySoundAt "plunger", Plunger
If Keycode = StartGameKey Then Controller.Switch(16) = 0
End Sub
Dim PlungerIM
Const IMPowerSetting = 60 '90
Const IMTime = 0.6
Set plungerIM = New cvpmImpulseP
With plungerIM
.InitImpulseP swplunger, IMPowerSetting, IMTime
'.Random 0.3
.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
.CreateEvents "plungerIM"
End With
'**********************************************************************************************************
' Drain hole and kickers
Sub Drain_Hit:bsTrough.addball me : playsound "drain" : End Sub
'Wire Triggers
Sub sw1_Hit:Controller.Switch(1) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw1_UnHit:Controller.Switch(1) = 0:End Sub
Sub sw10_Hit:Controller.Switch(10) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw10_UnHit:Controller.Switch(10) = 0:End Sub
Sub sw11_Hit:Controller.Switch(11) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw11_UnHit:Controller.Switch(11) = 0:End Sub
Sub sw12_Hit:Controller.Switch(12) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
Sub sw13_Hit:Controller.Switch(13) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw13_UnHit:Controller.Switch(13) = 0:End Sub
Sub sw14_Hit:Controller.Switch(14) = 1:PlaySoundAtVol "metalping", ActiveBall, VolRol:End Sub
Sub sw14_UnHit:Controller.Switch(14) = 0: PlaySoundAt "fx2_popper", sw14:End Sub
Sub sw23_Hit:Controller.Switch(23) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw23_UnHit:Controller.Switch(23) = 0:End Sub
Sub sw24_Hit:Controller.Switch(24) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub
Sub sw25_Hit:Controller.Switch(25) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
Sub sw28_Hit:Controller.Switch(28) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
Sub sw29_Hit:Controller.Switch(29) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
Sub sw35_Hit:Controller.Switch(35) = 1:PlaySoundAtVol "rollover", ActiveBall, VolRol:End Sub
Sub sw35_UnHit:Controller.Switch(35) = 0:End Sub
'Captive Ball
Sub sw39_Hit:Controller.Switch(39) = 0:End Sub
Sub sw39_UnHit:Controller.Switch(39) = 1:PlaySoundAtVol "rollover", sw39, VolRol:End Sub
'Stand Up Targets
Sub sw2_Hit:vpmTimer.PulseSw 2:End Sub
Sub sw3_Hit:vpmTimer.PulseSw 3:End Sub
Sub sw4_Hit:vpmTimer.PulseSw 4:End Sub
Sub sw5_Hit:vpmTimer.PulseSw 5:End Sub
Sub sw7_Hit:vpmTimer.PulseSw 7:PlaySoundAtVol SoundFX("Target",DOFTargets), ActiveBall, VolTarg:End Sub
Sub sw8_Hit:vpmTimer.PulseSw 8:PlaySoundAtVol SoundFX("Target",DOFTargets), ActiveBall, VolTarg:End Sub
Sub sw17_Hit:vpmTimer.PulseSw 17:End Sub
Sub sw36_Hit:vpmTimer.PulseSw 36:End Sub
Sub sw37_Hit:vpmTimer.PulseSw 37:End Sub
Sub sw38_Hit:vpmTimer.PulseSw 38:End Sub
'3 Bank dropping targets
Sub sw42_Hit:vpmTimer.PulseSw 42:backbank.Y = 1:backbank.X = 1:Me.TimerEnabled = 1:PlaySoundAtVol SoundFX("Target",DOFTargets),ActiveBall, VolTarg:End Sub
Sub sw42_Timer:backbank.Y = 0.8888889:backbank.X = -0.8888889:Me.TimerEnabled = 0:End Sub
Sub sw43_Hit:vpmTimer.PulseSw 43:backbank.Y = 1:backbank.X = 1:Me.TimerEnabled = 1:PlaySoundAtVol SoundFX("Target",DOFTargets),ActiveBall, VolTarg:End Sub
Sub sw43_Timer:backbank.Y = 0.8888889:backbank.X = -0.8888889:Me.TimerEnabled = 0:End Sub
Sub sw44_Hit:vpmTimer.PulseSw 44:backbank.Y = 1:backbank.X = 1:Me.TimerEnabled = 1:PlaySoundAtVol SoundFX("Target",DOFTargets),ActiveBall, VolTarg:End Sub
Sub sw44_Timer:backbank.Y = 0.8888889:backbank.X = -0.8888889:Me.TimerEnabled = 0:End Sub
'Spinners
Sub sw9_Spin:vpmTimer.PulseSw 9 : playsoundAtVol "fx_spinner", sw9, VolSpin : End Sub
Sub sw40_Spin:vpmTimer.PulseSw 40 : playsoundAtVol "fx_spinner", sw40, VolSpin : End Sub
'Gate Triggers
Sub sw52_Hit:vpmTimer.PulseSw 52:End Sub
'Bumpers
Sub Bumper1b_Hit : vpmTimer.PulseSw(31) : playsoundAtVol SoundFX("fx_bumper2",DOFContactors),bumper1b, VolBump: End Sub
Sub Bumper2b_Hit : vpmTimer.PulseSw(30) : playsoundAtVol SoundFX("fx_bumper3",DOFContactors),bumper2b, VolBump: End Sub
Sub Bumper3b_Hit : vpmTimer.PulseSw(32) : playsoundAtVol SoundFX("fx_bumper4",DOFContactors),bumper3b, VolBump: End Sub
'Generic Ball Sounds
Sub Trigger1_Hit : playsoundAt "fx_ballrampdrop", trigger1 : End Sub
Sub Trigger2_Hit : playsoundAt "fx_ballrampdrop", trigger2 : End Sub
Sub Trigger3_Hit : playsoundAtVol "ramp_hit3", trigger3, .8 : End Sub
'***********************************************
'Motor Bank
'***********************************************
Dim DropADir
Dim DropAPos
DropADir = 1
Sub Init3Bank()
DropAPos = 0
Controller.Switch(46) = 1
End Sub
Sub RiseBank
If DropAPos <= 0 Then Exit Sub
DropADir = 1
DropAPos = 25
DropAa.TimerEnabled = 1
PlaySoundAtVol SoundFX("motor2",DOFGear), sw37, VolMot
End Sub
Sub DropBank
If DropAPos >= 25 Then Exit Sub
DropADir = -1
DropAPos = 0
DropAa.TimerEnabled = 1
PlaySoundAtVol SoundFX("motor2",DOFGear), sw37, VolMot
End Sub
'Animations
Sub DropAa_Timer()
Select Case DropAPos
Case 0: backbank.z=25:Controller.Switch(45) = 0:Controller.Switch(46) = 1:sw42.IsDropped = 0:sw43.IsDropped = 0:sw44.IsDropped = 0:banklsidehelp.IsDropped = 0
If DropADir = 1 then
DropAa.TimerEnabled = 0
else
end if
Case 1: backbank.z=23:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 2: backbank.z=21:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 3: backbank.z=19:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 4: backbank.z=17:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 5: backbank.z=15:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 6: backbank.z=13:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 7: backbank.z=11:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 8: backbank.z=9:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 9: backbank.z=7:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 10: backbank.z=5:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 11: backbank.z=3:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 12: backbank.z=1:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 13: backbank.z=-1:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 14: backbank.z=-3:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 15: backbank.z=-5:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 16: backbank.z=-7:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 17: backbank.z=-9:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 18: backbank.z=-11:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 19: backbank.z=-13:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 20: backbank.z=-15:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 21: backbank.z=-17:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 22: backbank.z=-19:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 23: backbank.z=-21:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 24: backbank.z=-23:Controller.Switch(45) = 0:Controller.Switch(46) = 0
Case 25: backbank.z=-24:Controller.Switch(45) = 1:Controller.Switch(46) = 0:sw42.IsDropped = 1:sw43.IsDropped = 1:sw44.IsDropped = 1:banklsidehelp.IsDropped = 1
If DropADir = 1 then
else
DropAa.TimerEnabled = 0
end if
End Select
If DropADir = 1 then
If DropApos>0 then DropApos=DropApos-1
else
If DropApos<25 then DropApos=DropApos+1
end if
End Sub
'***********************************************
'Jake Animation
'***********************************************
Dim DAD, DAP
DAD = 1
Sub InitJakeAni()
DAP = 0
End Sub
Sub RiseJake
If DAP <= 0 Then Exit Sub
DAD = 1
DAP = 23
jakeopen2.TimerEnabled = 1
PlaySoundAtVol SoundFX("motor2",DOFContactors), sw17, VolMot
End Sub
Sub DropJake
If DAP >= 18 Then Exit Sub
DAD = -1
DAP = 0
jakeopen2.TimerEnabled = 1
PlaySoundAtVol SoundFX("motor2",DOFContactors), sw17, VolMot
End Sub
Sub jakeopen2_Timer()
Select Case DAP
Case 0: JakeTop.ObjRotY=0:JakeTop.RotX=160:
If DAD = 1 then
jakeopen2.TimerEnabled = 0
else
end if
Case 1: JakeTop.ObjRotY=3:JakeTop.ObjRotX=1:
Case 2: JakeTop.ObjRotY=6:JakeTop.ObjRotX=2:JakeTop.ObjRotZ=-105:
Case 3: JakeTop.ObjRotY=9:JakeTop.ObjRotX=3:
Case 4: JakeTop.ObjRotY=12:JakeTop.ObjRotX=4:JakeTop.ObjRotZ=-106:
Case 5: JakeTop.ObjRotY=15:JakeTop.ObjRotX=5:
Case 6: JakeTop.ObjRotY=18:JakeTop.ObjRotX=6:JakeTop.ObjRotZ=-107:
Case 7: JakeTop.ObjRotY=21:JakeTop.ObjRotX=7:
Case 8: JakeTop.ObjRotY=24:JakeTop.ObjRotX=8:JakeTop.ObjRotZ=-108:
Case 9: JakeTop.ObjRotY=27:JakeTop.ObjRotX=9:
Case 10: JakeTop.ObjRotY=30:JakeTop.ObjRotX=10:JakeTop.ObjRotZ=-109:
Case 11: JakeTop.ObjRotY=33:JakeTop.ObjRotX=11:
Case 12: JakeTop.ObjRotY=36:JakeTop.ObjRotX=12:JakeTop.ObjRotZ=-110:
Case 13: JakeTop.ObjRotY=39:JakeTop.ObjRotX=13:
Case 14: JakeTop.ObjRotY=42:JakeTop.ObjRotX=14:JakeTop.ObjRotZ=-112:
Case 15: JakeTop.ObjRotY=45:
Case 16: JakeTop.ObjRotY=48:
Case 17: JakeTop.ObjRotY=50:
Case 18: JakeTop.RotX=140:
If DAD = 1 then
else
jakeopen2.TimerEnabled = 0
end if
End Select
If DAD = 1 then
If DAP>0 then DAP=DAP-1
else
If DAP<18 then DAP=DAP+1
end if
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
End Sub
Sub UpdateLamps
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
NFadeL 17, l17
NFadeL 18, l18
NFadeL 19, l19
NFadeL 21, l21
NFadeL 22, l22
NFadeL 23, l23
NFadeL 24, l24
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
NFadeL 41, l41
NFadeL 42, l42
NFadeL 43, l43
NFadeL 47, l47
NFadeL 48, l48
NFadeL 49, l49
NFadeL 50, l50
NFadeL 51, l51
NFadeL 52, l52
NFadeL 53, l53
NFadeL 54, l54
NFadeL 55, l55
NFadeL 56, l56
NFadeL 57, l57
NFadeL 58, l58
NFadeL 59, l59
NFadeObjm 60, P60, "lampbulbON", "lampbulb"
NFadeL 60, l60 'top left bumper
NFadeObjm 61, P61, "lampbulbON", "lampbulb"
NFadeL 61, l61 'right bumper
NFadeObjm 62, P62, "lampbulbON", "lampbulb"
NFadeL 62, l62 'lower left bumper
' From 32assassins 10.4 template.
' NFadeObjm 60, P60, "lampbulbON", "lampbulb"
' NFadeL 60, l60 'top left bumper
' NFadeObjm 61, P61, "lampbulbON", "lampbulb"
' NFadeL 61, l61 'right bumper
' NFadeObjm 62, P62, "lampbulbON", "lampbulb"
' NFadeL 62, l62 'lower left bumper
' NFadeL 63, l63
' NFadeL 64, l64
' NFadeL 60, l60 'Bumper 2
' NFadeL 61, l61 'Bumper 1
' NFadeL 62, l62 'Bumper 3
NFadeL 63, l63
NFadeL 64, l64
'Solenoid Controlled Lamps/Flashers
LampMod 109, f9 ' Top Left Pop Bumber
LampMod 110, f10 ' Top Right Pop Bumber
LampMod 111, f11 ' Bottom Pop Bumper
LampMod 120, f21 ' Link flasher
' LampMod 121, f20 ' ??
LampMod 121, F1b ' Rear Flash
LampMod 121, F2b
LampMod 121, Flasher2
LampMod 121, Flasher3
LampMod 122, f22 ' In front of Jake - fantacy placement
LampMod 123, f23 ' Right ampsuit flasher
LampMod 124, f24 ' Coin ? - lets just make a new fantacy one - I don't know where this would go
LampMod 125, f25 ' Bumper flasher
LampMod 126, f26 ' Ampsuit mb flasher
'LampMod 127, f27 ' active ?
LampMod 122, f22a ' More flashing please
LampMod 122, f22c ' For ballreflection
LampMod 121, f22b ' Yes, even more
LampMod 125, f25a ' Yes, even more
LampMod 126, f26a ' Wee - this looks better
LampMod 126, f26b ' Wee - this looks better
LampMod 128, f28a ' Right side ampsuit flasher
LampMod 128, f28b ' Left side ampsuit flasher
LampMod 129, f29c ' Left Side Flash
' LampMod 129, f29b ' Left Side Flash - for ballreflection
' Left Side Blue (x2)
LampMod 130, f29
LampMod 130, f29a
LampMod 130, f30
LampMod 130, f30a
LampMod 130, f2a
LampMod 130, Flasher6
LampMod 130, Flasher7
NFadeObjm 130, f29, "dome3_blueON", "dome3_blue" 'Dome
NFadeL 130, f29a
NFadeObjm 130, f30, "dome3_blueON", "dome3_blue" 'Dome
NFadeObjm 130, f2a, "dome3_blueON", "dome3_blue" 'Dome
NFadeL 130, f30a
' Right Side Blue (x2)
LampMod 131, f31
LampMod 131, f31a
LampMod 131, f32
LampMod 131, f32a
LampMod 131, f1a
LampMod 131, Flasher4
LampMod 131, Flasher5
NFadeObjm 131, f31, "dome3_blueON", "dome3_blue" 'Dome
NFadeL 131, f31a
NFadeObjm 131, f32, "dome3_blueON", "dome3_blue" 'Dome
NFadeObjm 131, f1a, "dome3_blueON", "dome3_blue" 'Dome
NFadeL 131, f32a
LampMod 132, f32b ' Right Side Flash
' LampMod 132, f32c ' Right Side Flash - for ballreflection
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
'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
'**********************************************************************************************************
'**********************************************************************************************************
' Start of VPX functions
'**********************************************************************************************************
'**********************************************************************************************************
'**********Sling Shot Animations
' Rstep and Lstep are the variables that increment the animation
'****************
Dim RStep, Lstep
Sub RightSlingShot_Slingshot
vpmTimer.PulseSw 27
PlaySoundAtVol SoundFX("right_slingshot",DOFContactors), Sling1, VolSli
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
End Sub
Sub RightSlingShot_Timer
Select Case RStep
Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
End Select
RStep = RStep + 1
End Sub
Sub LeftSlingShot_Slingshot
vpmTimer.PulseSw 26
PlaySoundAtVol SoundFX("left_slingshot",DOFContactors), Sling2, VolSli
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
End Sub
Sub LeftSlingShot_Timer
Select Case LStep
Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
End Select
LStep = LStep + 1
End Sub
'*********************************************************************
' Positional Sound Playback Functions
'*********************************************************************
' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
End Sub
' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
Sub PlaySoundAt(soundname, tableobj)
PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
End Sub
Sub PlaySoundAtBall(soundname)
PlaySoundAt soundname, ActiveBall
End Sub
' *******************************************************************************************************
' Positional Sound Playback Functions by DJRobX
' PlaySound sound, 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
' *******************************************************************************************************
' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
End Sub
' Set position as table object (Use object or light but NOT wall) and Vol to 1
Sub PlaySoundAt(soundname, tableobj)
PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
End Sub
'Set all as per ball position & speed.
Sub PlaySoundAtBall(soundname)
PlaySoundAt soundname, ActiveBall
End Sub
'Set position as table object and Vol manually.
Sub PlaySoundAtVol(sound, tableobj, Volume)
PlaySound sound, 1, Volume, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
End Sub
'Set all as per ball position & speed, but Vol Multiplier may be used eg; PlaySoundAtBallVol "sound",3
Sub PlaySoundAtBallVol(sound, VolMult)
PlaySound sound, 0, Vol(ActiveBall) * VolMult, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 1, AudioFade(ActiveBall)
End Sub
'Set position as bumperX and Vol manually.
Sub PlaySoundAtBumperVol(sound, tableobj, Vol)
PlaySound sound, 1, Vol, AudioPan(tableobj), 0,0,1, 1, AudioFade(tableobj)
End Sub
'*********************************************************************
' Supporting Ball & Sound Functions
'*********************************************************************
Function RndNum(min, max)
RndNum = Int(Rnd() * (max-min + 1) ) + min ' Sets a random number between min and max
End Function
Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
Dim tmp
tmp = tableobj.y * 2 / table1.height-1
If tmp > 0 Then
AudioFade = Csng(tmp ^10)
Else
AudioFade = Csng(-((- tmp) ^10) )
End If
End Function
Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
Dim tmp
tmp = tableobj.x * 2 / table1.width-1
If tmp > 0 Then
AudioPan = Csng(tmp ^10)
Else
AudioPan = Csng(-((- tmp) ^10) )
End If
End Function
Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
Dim tmp
tmp = ball.x * 2 / table1.width-1
If tmp > 0 Then
Pan = Csng(tmp ^10)
Else
Pan = Csng(-((- tmp) ^10) )
End If
End Function
Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
Vol = Csng(BallVel(ball) ^2 / VolDiv)
End Function
Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
Pitch = BallVel(ball) * 20
End Function
Function BallVel(ball) 'Calculates the ball speed
BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
End Function
'*****************************************
' JP's VP10 Rolling Sounds
'*****************************************
Const tnob = 5 ' total number of balls
ReDim rolling(tnob)
InitRolling
Sub InitRolling
Dim i
For i = 0 to tnob