-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathAmazing Spider-man (Gottlieb 1980).vbs
990 lines (829 loc) · 31.6 KB
/
Amazing Spider-man (Gottlieb 1980).vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
' VPX Amazing Spider-Man
' BorgDog mod of gtxjoe table
' dof fixes by arngrim
'
' gtxjoe v1.0
'
' Thanks to all VP contributors present and past
' Inspiration from Bob5453 and Gaston for their previous Spider-man versions
' Thalamus 2018-07-18
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Changed UseSolenoids=1 to 2
' BorgDog did have a special collition routine on this table, but since it isn't a mb
' table I choose to replace it.
Option Explicit
Randomize
Const cGameName = "spidermn"
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "Can't open controller.vbs"
On Error Goto 0
LoadVPM "01000100", "sys80.vbs", 2.31
Const UseSolenoids = 2
Const UseLamps = 1
Const UseGI = 0
' Standard Sounds
Const SSolenoidOn = ""
Const SSolenoidOff = ""
Const SCoin = "fx_coin"
Dim xx, bsTrough, initContacts, dtRDrop, dtLDrop, bsLSaucer, bsMSaucer, bsRSaucer
Sub AmazingSpiderMan_Init()
' Thalamus : Was missing 'vpminit me'
vpminit me
On Error Resume Next
With Controller
.GameName = cGameName
.SplashInfoLine = "Amazing Spider-Man, Gottlieb 1980"
.HandleKeyboard = 0
.ShowTitle = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.ShowTitle = 0
.hidden = 1
.Games(cGameName).Settings.Value("rol") = 0
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
End With
On Error Goto 0
' basic pinmame timer
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
' Nudging
vpmNudge.TiltSwitch = 57
vpmNudge.Sensitivity = 3
vpmNudge.TiltObj = Array(Bumper1,Bumper2,LeftSlingshot,RightSlingShot)
' ball stack for trough: Gottlieb System 80
Set bsTrough = New cvpmBallStack
bsTrough.InitSw 0, 67, 0, 0, 0, 0, 0, 0
bsTrough.InitKick Drain, 60,25
bsTrough.InitExitSnd Soundfx("BallRelease",DOFContactors), Soundfx("SolOn",DOFContactors)
bsTrough.Balls = 1
Set dtLDrop = New cvpmDropTarget
dtLDrop.InitDrop Array(sw1,sw11,sw21),Array(1,11,21)
dtLDrop.InitSnd SoundFX("DropTarget",DOFTargets), Soundfx("DropTargetreset",DOFContactors)
Set dtRDrop = New cvpmDropTarget
dtRDrop.InitDrop Array(sw0,sw10,sw20,sw30,sw40),Array(0,10,20,30,40)
dtRDrop.InitSnd SoundFX("DropTarget",DOFTargets),Soundfx("DropTargetreset",DOFContactors)
if b2son then: for each xx in backdropstuff: xx.visible=0: next
startGame.enabled=true
NTMBox.visible=0 'turn off number to match box
FindDips 'find if match enabled, if so turn back on number to match box
End Sub
Sub AmazingSpiderMan_Paused:Controller.Pause = 1:End Sub
Sub AmazingSpiderMan_unPaused:Controller.Pause = 0:End Sub
Sub AmazingSpiderMan_Exit
If b2son then controller.stop
End Sub
sub startGame_timer
dim xx
playsound "poweron"
LampTimer.enabled=1
For each xx in GI:xx.State = 1: Next '*****GI Lights On
me.enabled=false
End sub
Sub AmazingSpiderMan_KeyDown(ByVal keycode)
If vpmKeyDown(keycode) Then Exit Sub
If keycode = PlungerKey Then
Plunger.PullBack
PlaySound "plungerpull",0,1,0.25,0.25
End If
If keycode=AddCreditKey then playsound "coin": vpmTimer.pulseSW (swCoin1): end if
End Sub
Sub AmazingSpiderMan_KeyUp(ByVal keycode)
If keycode = 61 then FindDips
If keycode = PlungerKey Then
Plunger.Fire
PlaySound "plunger",0,1,0.25,0.25
End If
If vpmKeyUp(keycode) Then Exit Sub
End Sub
Sub Drain_Hit()
PlaySoundAt "drain", Drain
bsTrough.AddBall Me
End Sub
'*****************************************
'Solenoids
'*****************************************
SolCallBack(1) = "SolSaucerMid"
SolCallBack(2) = "SolSaucerOuter"
SolCallback(5) = "Lraised" '"dtLDrop.SolDropUp"
SolCallback(6) = "Rraised" '"dtRDrop.SolDropUp"
SolCallback(8) = "SolKnocker"
SolCallback(9) = "SolTrough"
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Sub Rraised(enabled)
if enabled then Rreset.enabled=True
End Sub
Sub Rreset_timer
dtRDrop.DropSol_On
For each light in DTRightLights: light.state=0: Next
Rreset.enabled=false
End Sub
Sub Lraised(enabled)
if enabled then Lreset.enabled=True
End Sub
Sub Lreset_timer
dtLDrop.DropSol_On
For each light in DTLeftLights: light.state=0: Next
Lreset.enabled=false
End Sub
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, 1, -0.1, 0.25
LeftFlipper.RotateToEnd
LeftFlipper1.RotateToEnd
GIlflipper.state=1
Else
PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, -0.1, 0.25
LeftFlipper.RotateToStart
LeftFlipper1.RotateToStart
GIlflipper.state=0
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, 1, 0.1, 0.25
RightFlipper.RotateToEnd
RightFlipper1.RotateToEnd
Else
PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, 0.1, 0.25
RightFlipper.RotateToStart
RightFlipper1.RotateToStart
End If
End Sub
Sub SolTrough(Enabled)
If Enabled Then bsTrough.ExitSol_On
End Sub
Sub SolKnocker(Enabled)
If Enabled Then PlaySound SoundFX("Knocker",DOFKnocker)
End Sub
Sub SolSaucerMid(Enabled)
If Enabled Then
sw12.kick 173,6
Controller.Switch(12) = False
PlaySound SoundFX("popper_ball",DOFContactors)
sw12.uservalue=1
sw12.timerenabled=1
PkickarmSW12.rotz=15
End if
End Sub
Sub sw12_timer
select case sw12.uservalue
case 2:
PkickarmSW12.rotz=0
me.timerenabled=0
end Select
sw12.uservalue=sw12.uservalue+1
End Sub
Sub SolSaucerOuter(Enabled)
If Enabled Then
Sw2.kick 176,6
Controller.Switch(2) = False
PlaySound SoundFX("popper_ball",DOFContactors)
sw22.kick 170,6
Controller.Switch(22) = False
sw2.uservalue=1
sw2.timerenabled=1
PkickarmSW2.rotz=15
PkickarmSW22.rotz=15
end if
End Sub
Sub sw2_timer
select case sw2.uservalue
case 2:
PkickarmSW2.rotz=0
me.timerenabled=0
end Select
sw2.uservalue=sw2.uservalue+1
End Sub
'*****************************************
'Switches
'*****************************************
Sub sw0_Hit : dtRDrop.Hit 1 : GIsw0.state=1: End Sub
Sub sw10_Hit : dtRDrop.Hit 2 : GIsw10.state=1: End Sub
Sub sw20_Hit : dtRDrop.Hit 3 : GIsw20.state=1: End Sub
Sub sw30_Hit : dtRDrop.Hit 4 : GIsw30.state=1: End Sub
Sub sw40_Hit : dtRDrop.Hit 5 : GIsw40.state=1: End Sub
Sub sw1_Hit : dtLDrop.Hit 1 : GIsw1.state=1: End Sub
Sub sw11_Hit : dtLDrop.Hit 2 : GIsw11.state=1: End Sub
Sub sw21_Hit : dtLDrop.Hit 3 : GIsw21.state=1: End Sub
Sub sw31_Hit : debug.print "31":vpmTimer.PulseSw 31:DOF 111, DOFPulse:End Sub
Sub sw31a_Hit : vpmTimer.PulseSw 31:DOF 112, DOFPulse:End Sub
Sub sw32a_Hit : vpmTimer.PulseSw 32: End Sub
Sub sw32b_Hit : vpmTimer.PulseSw 32: End Sub
Sub sw32c_Hit : vpmTimer.PulseSw 32: End Sub
Sub sw32d_Hit : vpmTimer.PulseSw 32: End Sub
Sub sw41_Hit : debug.print "41": vpmTimer.PulseSw 41:DOF 112, DOFPulse:End Sub
Sub sw41a_Hit : vpmTimer.PulseSw 41:DOF 109, DOFPulse:End Sub
Sub DingwallA_hit()
vpmTimer.PulseSw 42
SlingA.visible=0
SlingA1.visible=1
me.uservalue=1
Me.timerenabled=1
End Sub
sub dingwalla_timer
select case dingwalla.uservalue
Case 1: SlingA1.visible=0: SlingA.visible=1
case 2: SlingA.visible=0: SlingA2.visible=1
Case 3: SlingA2.visible=0: SlingA.visible=1: Me.timerenabled=0
end Select
me.uservalue=me.uservalue+1
end sub
Sub DingwallB_hit()
vpmTimer.PulseSw 42
SlingB.visible=0
SlingB1.visible=1
me.uservalue=1
Me.timerenabled=1
End Sub
sub dingwallb_timer 'default 50 timer
select case DingwallB.uservalue
Case 1: Slingb1.visible=0: SlingB.visible=1
case 2: SlingB.visible=0: Slingb2.visible=1
Case 3: Slingb2.visible=0: SlingB.visible=1: Me.timerenabled=0
end Select
DingwallB.uservalue=DingwallB.uservalue+1
end sub
Sub sw42a_Hit : vpmTimer.PulseSw 42: End Sub
Sub sw42b_Hit : vpmTimer.PulseSw 42: End Sub
Sub sw42c_Hit : vpmTimer.PulseSw 42: End Sub
Sub sw42d_Hit : vpmTimer.PulseSw 42: End Sub
Sub sw50_Hit : vpmTimer.PulseSw 50: End Sub
Sub sw51_Hit : vpmTimer.PulseSw 51:DOF 105, DOFPulse:End Sub
Sub sw51a_Hit : vpmTimer.PulseSw 51:DOF 107, DOFPulse:End Sub
Sub sw61_Hit : vpmTimer.PulseSw 61:DOF 106, DOFPulse:End Sub
Sub sw61a_Hit : vpmTimer.PulseSw 61:DOF 108, DOFPulse:End Sub
Sub sw70_Hit : vpmTimer.PulseSw 70:playsound SoundFX("target",DOFTargets): End Sub
Sub sw71_Hit : vpmTimer.PulseSw 71:playsound SoundFX("target",DOFTargets): End Sub
Sub sw60_spin
vpmTimer.PulseSw 60
PlaySoundAt "fx_spinner", sw60
End Sub
Sub sw2_Hit
Controller.Switch(2) = True
PlaySoundAt "kicker_enter", sw2
End Sub
Sub sw12_Hit
Controller.Switch(12) = True
PlaySoundAt "kicker_enter", sw12
End Sub
Sub sw22_Hit
Controller.Switch(22) = True
PlaySoundAt "kicker_enter", sw22
End Sub
Sub Bumper1_Hit
vpmTimer.PulseSw 72
PlaySound SoundFX("fx_bumper2",DOFContactors)
DOF 104,DOFPulse
End Sub
Sub Bumper2_Hit
vpmTimer.PulseSw 72
PlaySound SoundFX("fx_bumper2",DOFContactors)
DOF 103,DOFPulse
End Sub
'****************************************************************
' Sling Shot Animations
' Rstep and Lstep are the variables that increment the animation
'****************************************************************
Dim RStep, Lstep
Sub RightSlingShot_Slingshot
vpmTimer.PulseSw 42
DOF 102,DOFPulse
PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
RSling.Visible = 0
RSling1.Visible = 1
sling1.objroty = -15
RStep = 0
RightSlingShot.TimerEnabled = 1
End Sub
Sub RightSlingShot_Timer
Select Case RStep
Case 2:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.objroty = -7
Case 3:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.objroty = 0:RightSlingShot.TimerEnabled = 0
End Select
RStep = RStep + 1
End Sub
Sub LeftSlingShot_Slingshot
vpmTimer.PulseSw 42
DOF 101,DOFPulse
PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
LSling.Visible = 0
LSling1.Visible = 1
sling2.objroty = 15
LStep = 0
LeftSlingShot.TimerEnabled = 1
End Sub
Sub LeftSlingShot_Timer
Select Case LStep
Case 2:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.objroty = 7
Case 3:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.objroty = 0:LeftSlingShot.TimerEnabled = 0
End Select
LStep = LStep + 1
End Sub
Sub FlipperTimer_Timer()
End Sub
'************************************
' What you need to add to your table
'************************************
' a timer called CollisionTimer. With a fast interval, like from 1 to 10
' one collision sound, in this script is called fx_collide
' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
'******************************************
' Explanation of the rolling sound routine
'******************************************
' sounds are played based on the ball speed and position
' the routine checks first for deleted balls and stops the rolling sound.
' The For loop goes through all the balls on the table and checks for the ball speed and
' if the ball is on the table (height lower than 30) then then it plays the sound
' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
' will change according to the ball speed, and the PAN function will change the stereo position according
' to the position of the ball on the table.
'**************************************
' Explanation of the collision routine
'**************************************
' The Double For loop: This is a double cycle used to check the collision between a ball and the other ones.
' If you look at the parameters of both cycles, you’ll notice they are designed to avoid checking
' collision twice. For example, I will never check collision between ball 2 and ball 1,
' because I already checked collision between ball 1 and 2. So, if we have 4 balls,
' the collision checks will be: ball 1 with 2, 1 with 3, 1 with 4, 2 with 3, 2 with 4 and 3 with 4.
' Sum first the radius of both balls, and if the height between them is higher then do not calculate anything more,
' since the balls are on different heights so they can't collide.
' The next 3 lines calculates distance between xth and yth balls with the Pytagorean theorem,
' The first "If": Checking if the distance between the two balls is less than the sum of the radius of both balls,
' and both balls are not already colliding.
' Why are we checking if balls are already in collision?
' Because we do not want the sound repeting when two balls are resting closed to each other.
' Set the collision property of both balls to True, and we assign the number of the ball colliding
' Play the collide sound of your choice using the VOL, PAN and PITCH functions
' Last lines: If the distance between 2 balls is more than the radius of a ball,
' then there is no collision and then set the collision property of the ball to False (-1).
Sub Rollovers_Hit (idx)
PlaySound "rollover", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Pins_Hit (idx)
PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Targets_Hit (idx)
PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub Metals_Thin_Hit (idx)
PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Metals_Medium_Hit (idx)
PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Metals2_Hit (idx)
PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Gates_Hit (idx)
PlaySound "fx_gate", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Spinner_Spin
PlaySoundAt "fx_spinner", Spinner
End Sub
Sub Rubbers_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 20 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall)*50, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
End if
If finalspeed >= 6 AND finalspeed <= 20 then
RandomSoundRubber()
End If
End Sub
Sub Posts_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 16 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
End if
If finalspeed >= 6 AND finalspeed <= 16 then
RandomSoundRubber()
End If
End Sub
Sub RandomSoundRubber()
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*25, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall)*25, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall)*25, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
Sub LeftFlipper_Collide(parm)
RandomSoundFlipper()
End Sub
Sub LeftFlipper1_Collide(parm)
RandomSoundFlipper()
End Sub
Sub RightFlipper_Collide(parm)
RandomSoundFlipper()
End Sub
Sub RightFlipper1_Collide(parm)
RandomSoundFlipper()
End Sub
Sub RandomSoundFlipper()
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall)*25, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall)*25, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall)*25, Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End sub
'Finding an individual dip state based on scapino's Strikes and spares dip code - from unclewillys pinball pool, added another section to get high score award to set replay cards
Dim TheDips(32)
Sub FindDips
Dim DipsNumber
DipsNumber = Controller.Dip(1)
TheDips(16) = Int(DipsNumber/128)
If TheDips(16) = 1 then DipsNumber = DipsNumber - 128 end if
TheDips(15) = Int(DipsNumber/64)
If TheDips(15) = 1 then DipsNumber = DipsNumber - 64 end if
TheDips(14) = Int(DipsNumber/32)
If TheDips(14) = 1 then DipsNumber = DipsNumber - 32 end if
TheDips(13) = Int(DipsNumber/16)
If TheDips(13) = 1 then DipsNumber = DipsNumber - 16 end if
TheDips(12) = Int(DipsNumber/8)
If TheDips(12) = 1 then DipsNumber = DipsNumber - 8 end if
TheDips(11) = Int(DipsNumber/4)
If TheDips(11) = 1 then DipsNumber = DipsNumber - 4 end if
TheDips(10) = Int(DipsNumber/2)
If TheDips(10) = 1 then DipsNumber = DipsNumber - 2 end if
TheDips(9) = Int(DipsNumber)
DipsNumber = Controller.Dip(2)
TheDips(24) = Int(DipsNumber/128)
If TheDips(24) = 1 then DipsNumber = DipsNumber - 128 end if
TheDips(23) = Int(DipsNumber/64)
If TheDips(23) = 1 then DipsNumber = DipsNumber - 64 end if
TheDips(22) = Int(DipsNumber/32)
If TheDips(22) = 1 then DipsNumber = DipsNumber - 32 end if
TheDips(21) = Int(DipsNumber/16)
If TheDips(21) = 1 then DipsNumber = DipsNumber - 16 end if
TheDips(20) = Int(DipsNumber/8)
If TheDips(20) = 1 then DipsNumber = DipsNumber - 8 end if
TheDips(19) = Int(DipsNumber/4)
If TheDips(19) = 1 then DipsNumber = DipsNumber - 4 end if
TheDips(18) = Int(DipsNumber/2)
If TheDips(18) = 1 then DipsNumber = DipsNumber - 2 end if
TheDips(17) = Int(DipsNumber)
DipsTimer.Enabled=1
End Sub
Sub DipsTimer_Timer()
dim match
match = TheDips(18)
if match = 1 and NOT b2son then
NTMBox.visible=1
else
NTMBox.visible=0
end if
' hsaward = TheDips(22)
' BPG = TheDips(17)
' If BPG = 1 then
' instcard.image="InstCard3Balls"
' Else
' instcard.image="InstCard5Balls"
' End if
' replaycard.image="replaycard"&hsaward
DipsTimer.enabled=0
End Sub
Sub editDips
Dim vpmDips : Set vpmDips = New cvpmDips
With vpmDips
.AddForm 700,400,"Spiderman - DIP switches"
.AddFrame 2,0,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"25 credits",49152)'dip 15&16
.AddFrame 2,76,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
.AddFrame 2,122,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
.AddFrame 2,168,190,"Game mode",&H00100000,Array("replay",0,"extra ball",&H00100000)'dip 21
.AddFrame 2,214,190,"3rd coin chute credits control",&H00001000,Array("no effect",0,"add 9",&H00001000)'dip 13
.AddFrame 2,260,190,"Tilt penalty",&H10000000,Array("game over",0,"ball in play",&H10000000)'dip 29
.AddChk 2,310,140,Array("Sound when scoring?",&H01000000)'dip 25
.AddChk 2,325,140,Array("Replay button tune?",&H02000000)'dip 26
.AddChk 2,340,140,Array("Coin switch tune?",&H04000000)'dip 27
.AddFrame 205,0,190,"High game to date awards",&H00C00000,Array("not displayed and no award",0,"displayed and no award",&H00800000,"displayed and 2 replays",&H00400000,"displayed and 3 replays",&H00C00000)'dip 23&24
.AddFrameExtra 205,76,190,"Attract tune",&H0200,Array("no attract tune",0,"attract tune played every 6 minutes",&H0200)'S-board dip 2
.AddFrame 205,122,190,"Balls per game",&H00010000,Array("5 balls",0,"3 balls",&H00010000)'dip 17
.AddFrame 205,168,190,"Replay limit",&H00040000,Array("no limit",0,"one per game",&H00040000)'dip 19
.AddFrame 205,214,190,"Novelty",&H00080000,Array("normal game mode",0,"50K for special/extra ball",&H0080000)'dip 20
.AddFrameExtra 205,260,190,"Sound option",&H0100,Array("sound mode",0,"tone mode",&H0100)'S-board dip 1
.AddChk 205,310,140,Array("Credits displayed?",&H08000000)'dip 28
.AddChk 205,325,140,Array("Match feature",&H00020000)'dip 18
.AddChk 205,340,140,Array("Attract features",&H20000000)'dip 30
.AddLabel 50,360,300,20,"After hitting OK, press F3 to reset game with new settings."
End With
Dim extra
extra = Controller.Dip(4) + Controller.Dip(5)*256
extra = vpmDips.ViewDipsExtra(extra)
Controller.Dip(4) = extra And 255
Controller.Dip(5) = (extra And 65280)\256 And 255
End Sub
Set vpmShowDips = GetRef("editDips")
Dim N1,O1, Light
N1=0:O1=0:
Set LampCallback=GetRef("UpdateMultipleLamps")
Sub UpdateMultipleLamps
if startGame.enabled=0 then
N1=Controller.Lamp(0) 'Game Over triggers match and BIP
If N1 Then
BIPBox.text="BALL IN PLAY"
NTMBox.text=""
GOBox.text=""
Else
BIPBox.text=""
NTMBox.text="NUMBER TO MATCH"
GOBox.text="GAME OVER"
End If
N1=Controller.Lamp(1) 'Tilt
If N1 Then
TILTBox.text="TILT"
Else
TILTBox.text=""
End If
N1=Controller.Lamp(3) 'Shoot Again
If N1 Then
ShootAgainBox.text="SHOOT AGAIN"
Else
ShootAgainBox.text=""
End If
N1=Controller.Lamp(10) 'HIGH SCORE TO DATE
If N1 Then
HStoDateBox.text="HIGH SCORE TO DATE"
Else
HStoDateBox.text=""
End If
end if
End Sub
'**********************************************************************************************************
'Map lights to an array
'**********************************************************************************************************
'Set Lights(0) = l0 ' Game Over Relay
'Set Lights(1) = l1 ' Tilt relay
'Set Lights(2) = l2 ' Coin Lockout Relay
Set Lights(3) = l3 ' Shoot Again Playfield and backglass
Set Lights(4) = l4 ' first player
Set Lights(5) = l5 ' second player
Set Lights(6) = l6 'third player
Set Lights(7) = l7 ' fourth player
'Set Lights(10) = l10 ' high game to date - backbox
'Set Lights(11) = l11 ' game over - backbox
Set Lights(12) = l12
Set Lights(13) = l13
Set Lights(14) = l14
Set Lights(15) = l15
Set Lights(16) = l16
Set Lights(17) = l17
Set Lights(18) = l18
Set Lights(19) = l19
Set Lights(20) = l20
Set Lights(21) = l21
Set Lights(22) = l22
Set Lights(23) = l23
Set Lights(24) = l24
Set Lights(25) = l25
Set Lights(26) = l26
Set Lights(27) = l27
Set Lights(28) = l28
Set Lights(29) = l29
Set Lights(30) = l30
Set Lights(31) = l31
Set Lights(32) = l32
Set Lights(33) = l33
Set Lights(34) = l34
Set Lights(35) = L35
Set Lights(36) = l36
Set Lights(37) = l37
Set Lights(38) = l38
Set Lights(39) = l39
Set Lights(40) = l40
Set Lights(41) = l41
Set Lights(42) = l42
Set Lights(43) = l43
Set Lights(44) = l44
Lights(45) = array(l45,l45b)
Lights(46) = array(l46,l46b)
Lights(47) = array(l47,l47b)
Lights(49) = array(l49,l49b)
Lights(50) = array(l50,l50b)
Set Lights(51) = l51
Dim Digits(32)
'Score displays
Digits(0)=Array(a1,a2,a3,a4,a5,a6,a7,n,a8)
Digits(1)=Array(a9,a10,a11,a12,a13,a14,a15,n,a16)
Digits(2)=Array(a17,a18,a19,a20,a21,a22,a23,n,a24)
Digits(3)=Array(a25,a26,a27,a28,a29,a30,a31,n,a32)
Digits(4)=Array(a33,a34,a35,a36,a37,a38,a39,n,a40)
Digits(5)=Array(a41,a42,a43,a44,a45,a46,a47,n,a48)
Digits(6)=Array(a49,a50,a51,a52,a53,a54,a55,n,a56)
Digits(7)=Array(a57,a58,a59,a60,a61,a62,a63,n,a64)
Digits(8)=Array(a65,a66,a67,a68,a69,a70,a71,n,a72)
Digits(9)=Array(a73,a74,a75,a76,a77,a78,a79,n,a80)
Digits(10)=Array(a81,a82,a83,a84,a85,a86,a87,n,a88)
Digits(11)=Array(a89,a90,a91,a92,a93,a94,a95,n,a96)
Digits(12)=Array(a97,a98,a99,a100,a101,a102,a103,n,a104)
Digits(13)=Array(a105,a106,a107,a108,a109,a110,a111,n,a112)
Digits(14)=Array(a113,a114,a115,a116,a117,a118,a119,n,a120)
Digits(15)=Array(a121,a122,a123,a124,a125,a126,a127,n,a128)
Digits(16)=Array(a129,a130,a131,a132,a133,a134,a135,n,a136)
Digits(17)=Array(a137,a138,a139,a140,a141,a142,a143,n,a144)
Digits(18)=Array(a145,a146,a147,a148,a149,a150,a151,n,a152)
Digits(19)=Array(a153,a154,a155,a156,a157,a158,a159,n,a160)
Digits(20)=Array(a161,a162,a163,a164,a165,a166,a167,n,a168)
Digits(21)=Array(a169,a170,a171,a172,a173,a174,a175,n,a176)
Digits(22)=Array(a177,a178,a179,a180,a181,a182,a183,n,a184)
Digits(23)=Array(a185,a186,a187,a188,a189,a190,a191,n,a192)
'Ball in Play and Credit displays
Digits(26)=Array(e00,e01,e02,e03,e04,e05,e06,n)
Digits(27)=Array(e10,e11,e12,e13,e14,e15,e16,n)
Digits(24)=Array(f00,f01,f02,f03,f04,f05,f06,n)
Digits(25)=Array(f10,f11,f12,f13,f14,f15,f16,n)
Sub DisplayTimer_Timer
Dim ChgLED,ii,num,chg,stat, obj
ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
If Not IsEmpty(ChgLED) Then
If not b2son Then
For ii = 0 To UBound(chgLED)
num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
if (num < 28 ) 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
Sub B2SCommand(nr, state)
If cController = 3 Then
Controller.B2SSetData nr, state
End If
End Sub
Sub DOF(dofevent, dofstate)
'*******Use DOF 1**, 1 to activate a ledwiz output*******************
'*******Use DOF 1**, 0 to deactivate a ledwiz output*****************
'*******Use DOF 1**, 2 to pulse a ledwiz output**********************
If cController > 2 Then
If dofstate = 2 Then
Controller.B2SSetData dofevent, 1
Controller.B2SSetData dofevent, 0
Else
Controller.B2SSetData dofevent, dofstate
End If
End If
End Sub
' *******************************************************************************************************
' Positional Sound Playback Functions by DJRobX
' PlaySound sound, 0, Vol(ActiveBall), Pan(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, Vol)
PlaySound sound, 1, Vol, Pan(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, Pan(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, Pan(tableobj), 0,0,1, 1, AudioFade(tableobj)
End Sub
'*********************************************************************
' Supporting Ball & Sound Functions
'*********************************************************************
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. "AmazingSpiderMan" is the name of the table
Dim tmp
tmp = tableobj.y * 2 / AmazingSpiderMan.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. "AmazingSpiderMan" is the name of the table
Dim tmp
tmp = tableobj.x * 2 / AmazingSpiderMan.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. "AmazingSpiderMan" is the name of the table
Dim tmp
tmp = ball.x * 2 / AmazingSpiderMan.width-1
If tmp > 0 Then
Pan = Csng(tmp ^10)
Else
Pan = Csng(-((- tmp) ^10) )
End If
End Function
Function AudioFade(ball) ' Can this be together with the above function ?
Dim tmp
tmp = ball.y * 2 / AmazingSpiderMan.height-1
If tmp > 0 Then
AudioFade = Csng(tmp ^10)
Else
AudioFade = 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 / 2000)
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
Function Vol2(ball1, ball2) ' Calculates the Volume of the sound based on the speed of two balls
Vol2 = (Vol(ball1) + Vol(ball2) ) / 2
End Function
'*****************************************
' JP's VP10 Collision & Rolling Sounds
'*****************************************
Const tnob = 16 ' total number of balls
ReDim rolling(tnob)
ReDim collision(tnob)
Initcollision
Sub Initcollision
Dim i
For i = 0 to tnob
collision(i) = -1
rolling(i) = False
Next
End Sub
Sub CollisionTimer_Timer()
'Added flipper and gate and spinner rotation here
dim PI:PI=3.1415926
LFLogo.RotY = LeftFlipper.CurrentAngle
LFLogo1.RotY = LeftFlipper1.CurrentAngle
RFLogo.RotY = RightFlipper.CurrentAngle
RFLogo1.RotY = RightFlipper1.CurrentAngle
PrimGate3.Rotz = Gate3.CurrentAngle * 70/90
PrimGate1.Rotz = Gate1.CurrentAngle * 70/90
PrimSw60.Rotz = sw60.CurrentAngle
SpinnerRod.TransZ = sin( (sw60.CurrentAngle+180) * (2*PI/360)) * 5
SpinnerRod.TransX = -1*(sin( (sw60.CurrentAngle- 90) * (2*PI/360)) * 5)
Dim BOT, B, B1, B2, dx, dy, dz, distance, radii
BOT = GetBalls
' rolling
For B = UBound(BOT) +1 to tnob
rolling(b) = False
StopSound("fx_ballrolling" & b)
Next
If UBound(BOT) = -1 Then Exit Sub
For B = 0 to UBound(BOT)
If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
rolling(b) = True
PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
Else
If rolling(b) = True Then
StopSound("fx_ballrolling" & b)
rolling(b) = False
End If
End If
Next
'collision
If UBound(BOT) < 1 Then Exit Sub
' play the rolling sound for each ball
For b = 0 to UBound(BOT)
If BallVel(BOT(b) ) > 1 Then
rolling(b) = True
if BOT(b).z < 30 Then ' Ball on playfield
PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0, AudioFade(BOT(b) )
Else ' Ball on raised ramp
PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) )*.5, Pan(BOT(b) ), 0, Pitch(BOT(b) )+50000, 1, 0, AudioFade(BOT(b) )
End If
Else
If rolling(b) = True Then
StopSound("fx_ballrolling" & b)
rolling(b) = False
End If
End If
Next
End Sub
'**********************
' Ball Collision Sound
'**********************
Sub OnBallBallCollision(ball1, ball2, velocity)
If AmazingSpiderMan.VersionMinor > 3 OR AmazingSpiderMan.VersionMajor > 10 Then
PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 200, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
Else
PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 200, Pan(ball1), 0, Pitch(ball1), 0, 0
End if
End Sub