-
Notifications
You must be signed in to change notification settings - Fork 37
/
Bram Stoker's Dracula (Williams 1993)1.1.vbs
1424 lines (1172 loc) · 38.8 KB
/
Bram Stoker's Dracula (Williams 1993)1.1.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
' Bram Stoker's Dracula / IPD No. 3072 / April, 1993 / 4 Players
' VP91x 1.03 by JPSalas 2011
' Magnet script by Dorsolas/Lander's script, with just a small modification
'
'01010111 01101001 01101110 01101110 01100101 01110010 01110011 00100000
'01100100 01101111 01101110 00100111 01110100 00100000 01110011 01100101
'01101100 01101100 00100000 01010110 01010000 01011000 00100000 01110100
'01100001 01100010 01101100 01100101 01110011 00101110
'
' Thalamus 2018-07-19
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Changed UseSolenoids=1 to 2
' Thalamus 2018-08-10 : Improved directional sounds
' Missing outlane sound in table
' !! NOTE : Table not verified yet !!
Option Explicit
Randomize
' Options
' Volume devided by - lower gets higher sound
Const VolDiv = 400
Dim dtxx
Dim DesktopMode:DesktopMode = Table1.ShowDT
' Const cSingleLFlip = 0
' Const cSingleRFlip = 0
If DesktopMode = True Then
Ramp15.visible = 1
Ramp16.visible = 1
SideWood.visible = 1
For each dtxx in Dflasher:dtxx.Visible = 1:next
l58.Intensity = 0
l58a.Intensity = 0
l21.Intensity = 0
l22.Intensity = 0
else
For each dtxx in Dflasher:dtxx.Visible = 0:next
l58.Intensity = 50
l58a.Intensity = 25
l21.Intensity = 20
l22.Intensity = 20
Ramp15.visible = 0
Ramp16.visible = 0
SideWood.visible = 0
End If
Dim VarHidden, UseVPMDMD
If Table1.ShowDT = true then
UseVPMDMD = true
VarHidden = 1
else
UseVPMDMD = False
VarHidden = 0
end if
LoadVPM "01560000", "WPC.VBS", 3.26
' Thalamus - for Fast Flip v2
NoUpperRightFlipper
NoUpperLeftFlipper
Sub LoadVPM(VPMver, VBSfile, VBSver)
On Error Resume Next
If ScriptEngineMajorVersion <5 Then MsgBox "VB Script Engine 5.0 or higher required"
ExecuteGlobal GetTextFile(VBSfile)
If Err Then MsgBox "Unable to open " & VBSfile & ". Ensure that it is in the same folder as this table. " & vbNewLine & Err.Description
'Set Controller = CreateObject("VPinMAME.Controller")
Set Controller = CreateObject("B2S.Server")
If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description
If VPMver> "" Then If Controller.Version <VPMver Or Err Then MsgBox "VPinMAME ver " & VPMver & " required."
If VPinMAMEDriverVer <VBSver Or Err Then MsgBox VBSFile & " ver " & VBSver & " or higher required."
On Error Goto 0
End Sub
'********************
'Standard definitions
'********************
Const UseSolenoids = 2
Const UseLamps = 1
Const UseSync = 0
Const HandleMech = 0
' Standard Sounds
Const SSolenoidOn = "Solenoid"
Const SSolenoidOff = ""
Const SFlipperOn = "FlipperUp"
Const SFlipperOff = "FlipperDown"
Const SCoin = "Coin"
Set GiCallback2 = GetRef("UpdateGI2")
Dim bsTrough, bsCryptPopper, bsBLPopper, bsCastlePopper, bsCoffinPopper
Dim mMagnet, dtLDrop, bsCastleLock, x, bumper1, bumper2, bumper3, plungerIM
On Error Resume Next
Dim i
For i=0 To 127
Execute "Set Lights(" & i & ") = L" & i
Next
Lights(58)=Array(L58,L58A)
'************
' Table init.
'************
Const cGameName = "drac_l1"
Sub Table1_Init
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
.SplashInfoLine = "Bram Stoker's Dracula, Williams, 1993" & vbNewLine & "VP91x table by JPSalas v1.03"
.Games(cGameName).Settings.Value("rol") = 0 'rotated left
.HandleKeyboard = 0
.ShowTitle = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.HandleMechanics = 0
.Hidden = Desktopmode
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
.Switch(22) = 1 'close coin door
.Switch(24) = 1 'and keep it close
End With
' Nudging
vpmNudge.TiltSwitch = 14
vpmNudge.Sensitivity = 1
vpmNudge.TiltObj = Array(bumper1, bumper2, bumper3, LeftSlingshot, RightSlingshot)
' Trough
Set bsTrough = New cvpmBallStack
With bsTrough
.InitSw 48, 41, 42, 43, 44, 0, 0, 0
.InitKick BallRelease, 90, 4
.InitEntrySnd "Solenoid", "Solenoid"
.InitExitSnd "ballrel", "Solenoid"
.Balls = 4
End With
' Crypt Popper
set bsCryptPopper = new cvpmBallStack
With bsCryptPopper
.InitSw 0, 56, 0, 0, 0, 0, 0, 0
.InitKick sw56, 80, 10
.KickForceVar = 1
.KickAngleVar = 5
.KickBalls = 2
.InitExitSnd "Popper", "Solenoid"
.Balls = 0
End With
' Wire Ramp Popper
set bsBLPopper = new cvpmBallStack
With bsBLPopper
.InitSw 0, 55, 0, 0, 0, 0, 0, 0
.InitKick sw55, 180, 1
.InitExitSnd "Popper", "Solenoid"
.Balls = 0
End With
' Castle Popper
set bsCastlePopper = new cvpmBallStack
With bsCastlePopper
.InitSw 0, 71, 0, 0, 0, 0, 0, 0
.InitKick sw71, 210, 10
.KickForceVar = 1
.KickAngleVar = 5
.KickBalls = 2
.InitExitSnd "Popper", "Solenoid"
End With
' Coffin Popper
set bsCoffinPopper = new cvpmBallStack
With bsCoffinPopper
.InitSw 0, 72, 0, 0, 0, 0, 0, 0
.InitKick sw72, 180, 1
.InitExitSnd "Popper", "Solenoid"
End With
' Mist Magnet
Set mMagnet = New cMagnet
mMagnet.InitMagnet Magnet, 5
mMagnet.Size = 60
MagnetPos = 0:SetMagnetPosition
' Drop target
Set dtLDrop = New cvpmDropTarget
With dtLDrop
.InitDrop sw15, 15
.InitSnd "droptarget_l", "Solenoid"
.CreateEvents "dtLDrop"
End With
' Castle Lock
Set bsCastleLock = new cvpmBallStack
With bsCastleLock
.initsw 0, 53, 54, 57, 0, 0, 0, 0
.InitKick CastleLock, 135, 1
End With
' Main Timer init
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
Plunger.Pullback
Wdivert.Isdropped = 1
End Sub
Sub table1_Paused:Controller.Pause = 1:End Sub
Sub table1_unPaused:Controller.Pause = 0:End Sub
'**********
' Keys
'**********
Sub table1_KeyDown(ByVal Keycode)
'If keycode = 3 Then SetFlash 131,1
If keycode = PlungerKey Then Controller.Switch(34) = 1
If keycode = LeftTiltKey Then
Nudge 90, 2
End If
If keycode = RightTiltKey Then
Nudge 270, 2
End If
If keycode = CenterTiltKey Then
Nudge 0, 2
End If
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub table1_KeyUp(ByVal Keycode)
'If keycode = 3 Then SetFlash 131,0
If keycode = PlungerKey Then Controller.Switch(34) = 0
If vpmKeyUp(keycode) Then Exit Sub
End Sub
'*********
' Switches
'*********
' Slings & div switches
Dim LStep, RStep
Sub LeftSlingShot_Slingshot
PlaySound "slingshot", 0, 0.3, -0.1, 0.25, 0, 1, AudioFade(sling2)
vpmTimer.PulseSw 64
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
LeftSlingShot.TimerInterval = 10
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
Sub RightSlingShot_Slingshot
PlaySound "slingshot", 0, 0.3, 0.1, 0.25, 0, 1, AudioFade(sling1)
vpmTimer.PulseSw 65
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
RightSlingShot.TimerInterval = 10
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
' Bumpers
Sub Bumper1_Hit:vpmTimer.PulseSw 61:PlaySoundAtVol "bumper", ActiveBall, 1:End Sub
' Sub Bumper1_Hit:vpmTimer.PulseSw 61:PlaySound "bumper", 0, 0.1, 0, 0.25, 0, 1, AudioFade(ActiveBall):End Sub
Sub Bumper1_Timer()
Select Case bump1
Case 1:Ring1a.IsDropped = 0:bump1 = 2
Case 2:Ring1b.IsDropped = 0:Ring1a.IsDropped = 1:bump1 = 3
Case 3:Ring1c.IsDropped = 0:Ring1b.IsDropped = 1:bump1 = 4
Case 4:Ring1c.IsDropped = 1:Me.TimerEnabled = 0
End Select
End Sub
Sub Bumper2_Hit:vpmTimer.PulseSw 62:PlaySoundAtVol "bumper", ActiveBall, 1:End Sub
' Sub Bumper2_Hit:vpmTimer.PulseSw 62:PlaySound "bumper", 0, 0.1, -0.1, 0.25, 0, 1, AudioFade(ActiveBall):End Sub
Sub Bumper2_Timer()
Select Case bump2
Case 1:Ring2a.IsDropped = 0:bump2 = 2
Case 2:Ring2b.IsDropped = 0:Ring2a.IsDropped = 1:bump2 = 3
Case 3:Ring2c.IsDropped = 0:Ring2b.IsDropped = 1:bump2 = 4
Case 4:Ring2c.IsDropped = 1:Me.TimerEnabled = 0
End Select
End Sub
Sub Bumper3_Hit:vpmTimer.PulseSw 63:PlaySoundAtVol "bumper", ActiveBall, 1:End Sub
' Sub Bumper3_Hit:vpmTimer.PulseSw 63:PlaySound "bumper", 0, 0.1, 0.1, 0.25, 0, 1, AudioFade(ActiveBall):End Sub
Sub Bumper3_Timer()
Select Case bump3
Case 1:Ring3a.IsDropped = 0:bump3 = 2
Case 2:Ring3b.IsDropped = 0:Ring3a.IsDropped = 1:bump3 = 3
Case 3:Ring3c.IsDropped = 0:Ring3b.IsDropped = 1:bump3 = 4
Case 4:Ring3c.IsDropped = 1:Me.TimerEnabled = 0
End Select
End Sub
' Drain holes, vuks & saucers
Sub Drain_Hit:PlaysoundAt "drain",Drain:bsTrough.AddBall Me:End Sub
Sub Drain1_Hit:PlaysoundAt "drain",Drain1:ClearBallID:bsTrough.AddBall Me:End Sub
Sub Drain2_Hit:PlaysoundAt "drain",Drain2:ClearBallID:bsTrough.AddBall Me:End Sub
Sub Drain3_Hit:PlaysoundAt "drain",Drain3:ClearBallID:bsTrough.AddBall Me:End Sub
Sub Drain4_Hit:PlaysoundAt "drain",Drain4:ClearBallID:bsTrough.AddBall Me:End Sub
'Sub sw72a_Hit:PlaySound "hole_enter", 0, 0.3, 0.1, 0.25:bsCoffinPopper.addball Me:End Sub
Dim rball
Sub sw72a_Hit:PlaySound "hole_enter", 0, 0.3, 0.1, 0.25, 0, 1, AudioFade(sw72a):me.destroyball:set rball = me.createball:drop.enabled = 1:End Sub
Sub drop_timer()
If rball.Z <= -50 Then
me.enabled = 0
drop2.enabled = 1
End If
rball.Z = rball.Z - 1
End Sub
Sub drop2_timer()
sw72a.destroyball
bsCoffinPopper.addball rball
me.enabled = 0
End Sub
Sub sw71_Hit
PlaySound "hole_enter", 0, 0.3, 0.1, 0.25, 0, 1, AudioFade(sw71)
'ClearBallID
vpmTimer.PulseSwitch 71, 0, 0
mMagnet.RemoveBall ActiveBall
Me.destroyball
bsCastlePopper.AddBall Me
End Sub
Sub sw58_Hit
PlaySound "hole_enter", 0, 0.3, -0.1, 0.25, 0, 1, AudioFade(sw58)
'ClearBallID
Me.DestroyBall
PlaySoundAt "subway2", sw58
vpmTimer.PulseSwitch 58, 1250, "bsBLPopper.AddBall 0 '"
End Sub
Sub sw56_Hit
PlaySound "hole_enter", 0, 0.3, -0.1, 0.25, 0, 1, AudioFade(sw56)
'ClearBallID
vpmTimer.PulseSwitch 56, 100, 0
mMagnet.RemoveBall ActiveBall
bsCryptPopper.AddBall Me
End Sub
Sub sw56a_Hit
PlaySound "hole_enter", 0, 0.3, -0.1, 0.25, 0, 1, AudioFade(sw56a)
'ClearBallID
mMagnet.RemoveBall ActiveBall
bsCryptPopper.AddBall Me
End Sub
Sub CastleLock_Hit()
PlaysoundAt "metalhit2", CastleLock
'ClearBallID
bsCastleLock.AddBall Me
End Sub
' Rollovers & Ramp Switches
Sub sw35_Hit:Controller.Switch(35) = 1:PlaySoundAt "sensor",sw35:End Sub
Sub sw35_UnHit:Controller.Switch(35) = 0:PlaySoundAt "outlane",sw35:End Sub
Sub sw36_Hit:Controller.Switch(36) = 1:PlaySoundAt "sensor",sw36:End Sub
Sub sw36_UnHit:Controller.Switch(36) = 0:End Sub
Sub sw37_Hit:Controller.Switch(37) = 1:PlaySoundAt "sensor",sw37:End Sub
Sub sw37_UnHit:Controller.Switch(37) = 0:End Sub
Sub sw38_Hit:Controller.Switch(38) = 1:PlaySoundAt "sensor",sw38:End Sub
Sub sw38_UnHit:Controller.Switch(38) = 0:PlaySoundAt "outlane",sw38:End Sub
Sub sw25_Hit:Controller.Switch(25) = 1:PlaySoundAt "sensor",sw25:End Sub
Sub sw25_UnHit:Controller.Switch(25) = 0:End Sub
Sub sw26_Hit:Controller.Switch(26) = 1:PlaySoundAt "sensor",sw26:End Sub
Sub sw26_Unhit:Controller.Switch(26) = 0:End Sub
Sub sw27_Hit:Controller.Switch(27) = 1:PlaySoundAt "sensor",sw27:End Sub
Sub sw27_Unhit:Controller.Switch(27) = 0:End Sub
Sub sw16_Hit:Controller.Switch(16) = 1:PlaySoundAt "sensor",sw16:End Sub
Sub sw16_Unhit:Controller.Switch(16) = 0:End Sub
Sub sw28_Hit:Controller.Switch(28) = 1:PlaySoundAt "gate",sw28:End Sub
Sub sw28_Unhit:Controller.Switch(28) = 0:PlaySound "metalrolling", 0, 0.3, -0.1, 0.25, 0, 1, AudioFade(sw28):End Sub
Sub sw84_Hit:Controller.Switch(84) = 1:PlaySoundAt "gate",sw84:End Sub
Sub sw84_Unhit:Controller.Switch(84) = 0:PlaySoundAt "metalrolling",sw84:End Sub
Sub sw85_Hit:Controller.Switch(85) = 1:PlaySoundAt "gate",sw85:End Sub
Sub sw85_Unhit:Controller.Switch(85) = 0:PlaySoundAt "metalrolling",sw85:End Sub
Sub sw31_Hit:Controller.Switch(31) = 1:PlaySoundAt "sensor",sw31:End Sub
Sub sw31_Unhit:Controller.Switch(31) = 0:End Sub
Sub sw51_Hit:Controller.Switch(51) = 1:PlaySoundAt "sensor",sw51:End Sub
Sub sw51_Unhit:Controller.Switch(51) = 0:End Sub
Sub sw52_Hit:Controller.Switch(52) = 1:PlaySoundAt "sensor",sw52:End Sub
Sub sw52_Unhit:Controller.Switch(52) = 0:End Sub
Sub sw73_Hit
Controller.Switch(73) = 1
If ActiveBall.VelY < -25 Then
PlaySoundAt "Subway2",sw73
End If
End Sub
Sub sw73_Unhit:Controller.Switch(73) = 0:End Sub
Sub sw17_Hit:Controller.Switch(17) = 1:End Sub
Sub sw17_Unhit:Controller.Switch(17) = 0:End Sub
' Targets
Sub sw66_Hit:vpmTimer.PulseSw 66:PlaySoundAt "target",sw66:End Sub
Sub sw66_Timer:sw66.IsDropped = 0:End Sub
Sub sw67_Hit:vpmTimer.PulseSw 67:PlaySoundAt "target",sw67:End Sub
Sub sw67_Timer:sw67.IsDropped = 0:End Sub
Sub sw68_Hit:vpmTimer.PulseSw 68:PlaySoundAt "target",sw68:End Sub
Sub sw68_Timer:sw68.IsDropped = 0:End Sub
Sub sw86_Hit:vpmTimer.PulseSw 86:PlaySoundAt "target",sw86:End Sub
Sub sw86_Timer:sw86.IsDropped = 0:End Sub
Sub sw87_Hit:vpmTimer.PulseSw 87:PlaySoundAt "target",sw87:End Sub
Sub sw87_Timer:sw87.IsDropped = 0:End Sub
Sub sw88_Hit:vpmTimer.PulseSw 88:PlaySoundAt "target",sw88:End Sub
Sub sw88_Timer:sw88.IsDropped = 0:Me.TimerEnabled = 0:End Sub
' Gates
Sub Gate2_Hit():PlaySoundAt "gate",Gate2:End Sub
Sub Gate4_Hit():PlaySoundAt "gate",Gate4:End Sub
Sub Gate6_Hit():PlaySoundAt "gate",Gate6:End Sub
' Ramps helpers
Sub RHelp1_Hit()
StopSound "metalrolling"
PlaySound "ballhit"
End Sub
Sub RHelp2_Hit()
StopSound "metalrolling"
PlaySound "ballhit"
End Sub
Sub RHelp3_Hit()
StopSound "metalrolling"
PlaySound "ballhit"
End Sub
'*********
'Solenoids
'*********
SolCallback(1) = "Auto_Plunger"
SolCallback(2) = "bsCoffinPopper.SolOut"
SolCallback(3) = "bsCastlePopper.SolOut"
SolCallback(4) = "SolRRampDown"
SolCallback(5) = "bsCryptPopper.SolOut"
SolCallback(6) = "bsBLPopper.SolOut"
SolCallback(7) = "vpmSolSound ""Knocker"","
SolCallback(8) = "SolShooterRamp"
SolCallback(14) = "SolRRampUp"
SolCallback(15) = "bsTrough.SolIn"
SolCallback(16) = "bsTrough.SolOut"
SolCallback(17) = "Sol117"
SolCallback(18) = "Sol118"
SolCallback(19) = "Sol119"
SolCallback(20) = "Sol120"
SolCallback(21) = "Sol121"
SolCallback(22) = "Sol122"
SolCallback(23) = "Sol123"
SolCallback(24) = "Sol124"
SolCallback(25) = "dtLDrop.SolDropUp"
SolCallback(27) = "SolMistMagnet"
SolCallback(33) = "solTopDiverter"
SolCallback(34) = "SolRGate"
SolCallback(35) = "bsCastleLock.SolOut"
SolCallback(36) = "SolLGate"
Sub Auto_Plunger(Enabled)
If Enabled Then
Plunger.Fire
PlaySound "solenoid", 0, 0.3, 0.1, 0.25
Else
Plunger.PullBack
End If
End Sub
'*************
' Moving Ramp
'*************
Dim RRampDir, RRAmpCurrPos, RRamp
RRampCurrPos = 0 ' down
RRampDir = 1 '1 is up -1 is down dir
Controller.Switch(77) = False
'RightRamp.Collidable = True
Sub SolRRampUp(Enabled)
If Enabled Then
RRampDir = 1
Controller.Switch(77) = True
RightRamp.Collidable = False
UpdateRamp.Enabled = True
''SetLamp 116, 1
playsound "diverter", 0, 0.3, 0.1, 0.25
End If
End Sub
Sub SolRRampDown(Enabled)
If Enabled Then
RRampDir = -1
Controller.Switch(77) = False
RightRamp.Collidable = True
UpdateRamp.Enabled = True
''SetLamp 116, 0
playsound "diverter", 0, 0.3, 0.1, 0.25
End If
End sub
Sub UpdateRamp_Timer
RRampCurrPos = RRampCurrPos + RRampDir
If RRampCurrPos> 10 Then
RRampCurrPos = 10
UpdateRamp.Enabled = 0
End If
If RRampCurrPos <0 Then
RRampCurrPos = 0
UpdateRamp.Enabled = 0
End If
RightRamp2.HeightBottom = RRampCurrPos *5
CoffinLiftRampOpaque.RotX = RRampCurrPos -11
CoffinLiftRamp.RotX = RRampCurrPos -11
Refresh.State = 1
Refresh.State = 0
End Sub
' Shooter Ramp
Sub SolShooterRamp(Enabled)
If Enabled Then
sramp2.Collidable = 0
dirsrt = 1:shootramp.enabled = 1
Playsound "solenoid", 0, 0.3, 0.1, 0.25
Else
sramp2.Collidable = 1
dirsrt = 2:shootramp.enabled = 1
Playsound "solenoid", 0, 0.3, 0.1, 0.25
End If
End Sub
' Top Ramp Diverter
Sub SolTopDiverter(Enabled)
Playsound "Diverter"
If Enabled Then
'diverter1.isdropped = False
'Controller.Switch(78) = True
wDivert.isdropped = 0
ddir = 1:Divert.enabled = 1
Else
'diverter1.isdropped = True
'Controller.Switch(78) = False
WDivert.isdropped = 1
ddir = 2:Divert.enabled = 1
End If
End sub
Dim FlashState(200), FlashLevel(200)
Dim FlashSpeedUp, FlashSpeedDown
'Dim x
FlashInit()
FlasherTimer.Interval = 10 'flash fading speed
FlasherTimer.Enabled = 1
Sub FlashInit
Dim i
For i = 0 to 200
FlashState(i) = 0
FlashLevel(i) = 0
Next
FlashSpeedUp = 500 ' fast speed when turning on the flasher
FlashSpeedDown = 100 ' slow speed when turning off the flasher, gives a smooth fading
AllFlashOff()
End Sub
Sub AllFlashOff
Dim i
For i = 0 to 200
FlashState(i) = 0
Next
End Sub
Sub Flash(nr, object)
Select Case FlashState(nr)
Case 0 'off
FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
If FlashLevel(nr) < 0 Then
FlashLevel(nr) = 0
FlashState(nr) = -1 'completely off
End if
Object.opacity = FlashLevel(nr)
Case 1 ' on
FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
If FlashLevel(nr) > 1000 Then
FlashLevel(nr) = 1000
FlashState(nr) = -2 'completely on
End if
Object.opacity = FlashLevel(nr)
End Select
End Sub
Sub Flashm(nr, object) 'multiple flashers, it doesn't change the flashstate
Select Case FlashState(nr)
Case 0 'off
Object.opacity = FlashLevel(nr)
Case 1 ' on
Object.opacity = FlashLevel(nr)
End Select
End Sub
Sub SetFlash(nr, stat)
FlashState(nr) = ABS(stat)
End Sub
Sub FlasherTimer_Timer()
Flash 161, f61
Flash 162, f62
Flash 163, f63
Flashm 158, f58
Flash 158, f58a
Flashm 121, F121
Flash 121, F121a
Flashm 122, F122
Flash 122, F122a
End Sub
Dim ddir
Sub Divert_Timer()
Select Case ddir
Case 1:
If Diverter.Z = -315 Then
me.enabled = 0
Controller.Switch(78) = True
Diverter.Z = -315
End If
Diverter.Z = Diverter.Z - 1
Case 2:
If Diverter.Z = -280 Then
me.enabled = 0
Controller.Switch(78) = False
Diverter.Z = -280
End If
Diverter.Z = Diverter.Z + 1
End Select
End Sub
' Mist Gates
Sub SolLGate(Enabled)
If Enabled then
LGate.open = 1
Wall_LO.isdropped = 1
else
LGate.open = 0
Wall_LO.isdropped = 0
End If
End Sub
Sub SolRGate(Enabled)
If Enabled then
RGate.open = 1
'Light51.state = 1
'RGate.Move 1, 1, 90
RGateWall.IsDropped = True
else
RGate.open = 0
'Light51.state = 0
'RGate.Move 0, 1, 0
RGateWall.IsDropped = False
End If
End Sub
Sub Sol117(Enabled)
F17.State=(Enabled)
F17a.State=(Enabled)
F17b.State=(enabled)
End Sub
Sub Sol118(Enabled)
F18.State=(Enabled)
F18a.State=(Enabled)
End Sub
Sub Sol119(Enabled)
F19.State=(Enabled)
F19a.State=(Enabled)
End Sub
Sub Sol120(Enabled)
F20.State=(Enabled)
F20a.State=(Enabled)
End Sub
Sub Sol121(enabled)
F21.State=(Enabled)
F21a.State=(Enabled)
End Sub
Sub Sol122(enabled)
F22.State=(Enabled)
F22a.State=(Enabled)
End Sub
Sub Sol123(enabled)
F23.State=(Enabled)
F23a.State=(Enabled)
End Sub
Sub Sol124(enabled)
F24.State=(Enabled)
End Sub
'**************
' Flipper Subs
'**************
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySoundAt "flipperup",LeftFlipper:LeftFlipper.RotateToEnd
Else
PlaySoundAt "flipperdown",LeftFlipper:LeftFlipper.RotateToStart
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySoundAt "flipperup",RightFlipper:RightFlipper.RotateToEnd
Else
PlaySoundAt "flipperdown",RightFlipper:RightFlipper.RotateToStart
End If
End Sub
'***********
' Update GI
'***********
Dim gistep, xxx
gistep = 1 / 8
Sub UpdateGI2(no, step)
Select Case no
Case 0
For each xxx in GIBOT:xxx.IntensityScale = gistep * step:next
Case 1
For each xxx in GITOP:xxx.IntensityScale = gistep * step:next
Case 2
For each xxx in GIMID:xxx.IntensityScale = gistep * step:next
Case 4
Light80.IntensityScale = gistep * step
End Select
End Sub
'*******************************
' Mist Magnet
' taken from Lander's table
' with only a small modification
'*******************************
'-------------------------------
' Magnet Simulator Class
' (07/10/2001 Dorsola)
' Modified for Dracula (08/16/2001) by Dorsola
'-------------------------------
class cMagnet
Private cX, cY, cStrength, cRange
private cBalls, cClaimed
private cTempX, cTempY
Private Sub Class_Initialize()
set cBalls = CreateObject("Scripting.Dictionary")
cRange = 1
cStrength = 0
End Sub
Public Sub InitMagnet(aTrigger, inStrength)
cX = aTrigger.X
cY = aTrigger.Y
cRange = aTrigger.Radius
cStrength = inStrength
End Sub
Public Sub MoveTo(inX, inY)
cX = inX
cY = inY
End Sub
Public Property Get X:X = cX:End Property
Public Property Get Y:Y = cY:End Property
Public Property Get Strength:Strength = cStrength:End Property
Public Property Get Size:Size = cRange:End Property
Public Property Get Range:Range = cRange:End Property
Public Property Get Balls:Balls = cBalls.Keys:End Property
Public Property Let X(inX):cX = inX:End Property
Public Property Let Y(inY):cY = inY:End Property
Public Property Let Strength(inStrength):cStrength = inStrength:End Property
Public Property Let Size(inSize):cRange = inSize:End Property
Public Property Let Range(inSize):cRange = inSize:End Property
Public Sub AddBall(aBall)
cBalls.Item(aBall) = 0
End Sub
Public Sub RemoveBall(aBall)
' This function tags balls for removal, but does not remove them.
' Another sub will be called to remove tagged objects from the dictionary.
If cBalls.Exists(aBall) then
if cClaimed then
cBalls.Item(aBall) = 1
else
cBalls.Remove(aBall)
end if
end if
End Sub
Public Sub Claim():cClaimed = True:End Sub
Public Sub Release()
cClaimed = False
Dim tempobj
for each tempobj in cBalls.Keys
if cBalls.Item(tempobj) = 1 then cBalls.Remove(tempobj)
next
End Sub
Public Sub ProcessBalls()
Dim tempObj
for each tempObj in cBalls.Keys:AttractBall tempObj:next
End Sub
Public Function GetDist(aBall)
on error resume next
if aBall is Nothing then
GetDist = 100000
else
cTempX = aBall.X - cX
cTempY = aBall.Y - cY
GetDist = Sqr(cTempX * cTempX + cTempY * cTempY)
if Err then GetDist = 100000
end if
End Function
Public Sub AttractBall(aBall)
if aBall is Nothing then Exit Sub
Dim Dist
Dist = GetDist(aBall)
if Dist> cRange then Exit Sub
' Attract ball toward magnet center (cX,cY).
' Attraction force is determined by distance from center, and strength of magnet.
Dim Force, Ratio
Ratio = Dist / (1.5 * cRange)
' TODO: Figure out how to dampen the force when ball is near center and
' at low velocity, so that balls don't jitter on the magnets.
' Also shore up instability on moving magnet.
Force = cStrength * exp(-0.2 / Ratio) / (Ratio * Ratio * 56)
aBall.VelX = (aBall.VelX - cTempX * Force / Dist) * 0.985
aBall.VelY = (aBall.VelY - cTempY * Force / Dist) * 0.985
End Sub
End Class
'-----------------------------------------------
' Mist Multiball - courtesy of Dorsola
'-----------------------------------------------
' Method: Since any ball that can block the Mist opto is necessarily in the Mist Magnet's trigger area,
' we automatically have access to all balls in this range. We can therefore check each ball's position
' against a line equation and see if it happens to be blocking the opto, and set the switch accordingly.
' This requires a timer loop.
Dim MagnetOn
MagnetOn = false
Sub MistTimer_Timer()
' Endpoints of the line are (108,1247) and (908,895)
' Slope: m = (y2-y1)/(x2-x1) = -0.44
' Y-intercept: b = y1 - m*x1 = 1294.52
mMagnet.Claim
Dim obj, CheckState, x, TargetY
CheckState = 0
on error resume next
for each obj in mMagnet.Balls
' y = mx+b (m=slope, b=yint)
TargetY = (-0.44) * obj.X + 1250.52
if(obj.Y> TargetY - 25) and(obj.Y <TargetY + 25) then CheckState = 1
next
on error goto 0
Controller.Switch(82) = CheckState
if MagnetOn then mMagnet.ProcessBalls
mMagnet.Release
End Sub
Sub SolMistMagnet(enabled)
MagnetOn = enabled
End Sub
Sub Magnet_Hit()
mMagnet.AddBall ActiveBall
End Sub
Sub Magnet_UnHit()
mMagnet.RemoveBall ActiveBall
End Sub
'------------------------
' Handle the Mist Motor
'------------------------
' Method: Treat motor's position as a number from right to left (0-500)
' and compute its position based on the line equation given above.
const motorx1 = 880
const motorx2 = 108
const motorxrange = 800
const motory1 = 850
const motory2 = 1200