forked from LegendsUnchained/vpx-standalone-alp4k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wackyraces.vbs
13061 lines (11605 loc) · 358 KB
/
wackyraces.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
' ****************************************************************
' VISUAL PINBALL X
' Wacky races by joe picasso and remdwaas1986
' Version 1.0.0
' started 26/01/2022
' ****************************************************************
'DOF Config by Outhere
'101 Left Flipper
'102 Right Flipper
'103 Left Slingshot
'104
'105 Right Slingshot
'106
'107 Bumper Left
'108 Bumper Center
'109 Bumper Right
'110 Ball Release
'111 AutoPlunger
'112 VUKGH Kicker
'113 VUKGH006 Kicker
'114 VUKGH007 Kicker
'115 VUKGH005 Kicker
'116 Target011_hit = Shaker
'117 VUKGH001_Hit = Shaker
'118 VUKGH004 Kicker
Option Explicit
Randomize
Const BallSize = 50 ' 50 is the normal size used in the core.vbs, VP kicker routines uses this value divided by 2
Const BallMass = 1
Const SongVolume = 0.1 ' 1 is full volume. Value is from 0 to 1
'----- General Sound Options -----
Const VolumeDial = 0.8 'Overall Mechanical sound effect volume. Recommended values should be no greater than 1.
Const BallRollVolume = 0.5 'Level of ball rolling volume. Value between 0 and 1
Const RampRollVolume = 1 'Level of ramp rolling volume. Value between 0 and 1
' Load the core.vbs for supporting Subs and functions
On Error Resume Next
ExecuteGlobal GetTextFile("core.vbs")
If Err Then MsgBox "Can't open core.vbs"
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "Can't open controller.vbs"
On Error Goto 0
'----- Shadow Options -----
Const DynamicBallShadowsOn = 0 '0 = no dynamic ball shadow ("triangles" near slings and such), 1 = enable dynamic ball shadow
Const AmbientBallShadowOn = 1 '0 = Static shadow under ball ("flasher" image, like JP's)
'1 = Moving ball shadow ("primitive" object, like ninuzzu's) - This is the only one that shows up on the pf when in ramps and fades when close to lights!
'2 = flasher image shadow, but it moves like ninuzzu's
' Define any Constants
Const cGameName = "wackyraces"
Const TableName = "wackyraces"
Const myVersion = "1.0.0"
Const MaxPlayers = 4 ' from 1 to 4
Const BallSaverTime = 20 ' in seconds
Const MaxMultiplier = 3 ' limit to 3x in this game, both bonus multiplier and playfield multiplier
Const BallsPerGame = 5 ' usually 3 or 5
Const MaxMultiballs = 11 ' max number of balls during multiballs
Const Special1 = 5000000 ' High score to obtain an extra ball/game
Const Special2 = 10000000
Const Special3 = 15000000
Const tnob = 11 ' total number of balls
Const lob = 0 'number of locked balls
'*****************
'ROM ID's b2s
'*****************
'p1 - ID 1
'p2 - ID 2
'p3 - ID 3
'p4 - ID 4
'p5 - ID 5
'p6 - ID 6
'p7 - ID 7
'p8 - ID 8
'p9 - ID 9
'p10 - ID 10
'p11 - ID 11
'wacky challange - ID 12
'trophee mania - ID 13
'smoke challange - ID 14
'road closure challange - ID 15
'oil challange - ID 16
'mud challange - ID 17
'gas challange - ID 18
'pidgeon challange - ID 19
'cone challange - ID 20
'burnout multiball - ID 21
'bomb multiball - ID 22
'game over - ID 23
'balllost - ID 24
'start1 - ID 25
'start2 - ID 26
'startscreen - ID 27
'passyby - ID 28
'1e - ID 29
'2e - ID 30
'3e - ID 31
'4e - ID 32
'5e - ID 33
'6e - ID 34
'7e - ID 35
'8e - ID 36
'9e - ID 37
'10e - ID 38
'11e - ID 39
Sub startB2S(aB2S)
If B2SOn Then
Controller.B2SSetData 1,0
Controller.B2SSetData 2,0
Controller.B2SSetData 3,0
Controller.B2SSetData 4,0
Controller.B2SSetData 5,0
Controller.B2SSetData 6,0
Controller.B2SSetData 7,0
Controller.B2SSetData 8,0
Controller.B2SSetData 9,0
Controller.B2SSetData 10,0
Controller.B2SSetData 11,0
Controller.B2SSetData 12,0
Controller.B2SSetData 13,0
Controller.B2SSetData 14,0
Controller.B2SSetData 15,0
Controller.B2SSetData 16,0
Controller.B2SSetData 17,0
Controller.B2SSetData 18,0
Controller.B2SSetData 19,0
Controller.B2SSetData 20,0
Controller.B2SSetData 21,0
Controller.B2SSetData 22,0
Controller.B2SSetData 23,0
Controller.B2SSetData 24,0
Controller.B2SSetData 25,0
Controller.B2SSetData 26,0
Controller.B2SSetData 27,0
Controller.B2SSetData 28,0
Controller.B2SSetData 29,0
Controller.B2SSetData 30,0
Controller.B2SSetData 31,0
Controller.B2SSetData 32,0
Controller.B2SSetData 33,0
Controller.B2SSetData 34,0
Controller.B2SSetData 35,0
Controller.B2SSetData 36,0
Controller.B2SSetData 37,0
Controller.B2SSetData 38,0
Controller.B2SSetData 39,0
Controller.B2SSetData 40,0
Controller.B2SSetData aB2S,1
End If
End Sub
' Use FlexDMD if in FS mode
Dim UseFlexDMD
If Table1.ShowDT = True then
' Tbackground.enabled = 1
UseFlexDMD = False
Else
UseFlexDMD = True
' Tbackground.enabled = 1
End If
' Define Global Variables
Dim PlayersPlayingGame
Dim CurrentPlayer
Dim Credits
Dim BonusPoints(4)
Dim BonusMultiplier(4)
Dim bBonusHeld
Dim BallsRemaining(4)
Dim ExtraBallsAwards(4)
Dim Special1Awarded(4)
Dim Special2Awarded(4)
Dim Special3Awarded(4)
Dim Score(4)
Dim HighScore(4)
Dim HighScoreName(4)
Dim Tilt
Dim TiltSensitivity
Dim Tilted
Dim TotalGamesPlayed
Dim bAttractMode
Dim mBalls2Eject
Dim bAutoPlunger
' Define Game Control Variables
Dim BallsOnPlayfield
Dim BallsInLock
Dim BallsInHole
' Define Game Flags
Dim bFreePlay
Dim bGameInPlay
Dim bOnTheFirstBall
Dim bBallInPlungerLane
Dim bBallSaverActive
Dim bBallSaverReady
Dim bMultiBallMode
'Dim Multiball
Dim bMusicOn
Dim bJustStarted
Dim bJackpot
Dim plungerIM
Dim LastSwitchHit
Dim PlayerSelectActive
Dim Ssoundz
Dim Ssoundz2
dim PFMultiplier
dim WKlights
dim WKMultiplier
dim P0slot
dim P1slot
dim P2slot
dim P3slot
dim P4slot
dim P5slot
dim P6slot
dim P7slot
dim P8slot
dim P9slot
dim P10slot
dim b00
dim b01
dim b02
dim b03
dim b04
dim b05
dim b06
dim b07
dim b08
dim b09
dim b10
dim ChallangeSlot
dim CHcompleted
dim PlayerSelectActive2
dim wackychallanges
dim p20
dim p21
dim p22
dim p23
dim p24
dim p25
dim p26
dim p27
dim p28
dim p29
dim p30
dim p31
dim p32
dim p33
dim mode1TimerCount
dim countr30
dim jackpotmulti
dim DRATMaultiplier
dim LowerFlippersActive
dim bhit
dim bvul
dim bhurt
dim Sboss01
dim Sboss02
dim Sboss03
dim Sboss04
dim Sboss05
dim Sboss06
dim Sboss07
dim Sboss08
dim Sboss09
dim Sboss10
dim Sboss11
dim Bcomplete
dim BSmode
dim Bdone
dim glock
dim mlock
dim rloop
dim lloop
dim wloop
dim wsteal
Dim raceplace
' core.vbs variables
' *********************************************************************
' Visual Pinball Defined Script Events
' *********************************************************************
Sub Table1_Init()
LoadEM
Dim i
'Randomize
'reset HighScore
'Reseths
rbwall001.IsDropped = True
rbwall002.IsDropped = True
roablock1a.visible = false
roablock1b.visible = false
roablock2a.visible = false
roablock2b.visible = false
rbwall004.IsDropped = True
rbwall003.IsDropped = True
rbwall005.IsDropped = True
rbwall006.IsDropped = True
roablock3a.visible = false
roablock3b.visible = false
Ramp050.Image = "track"
GiOff
'Impulse Plunger as autoplunger
Const IMPowerSetting = 36 ' Plunger Power
Const IMTime = 1.1 ' Time in seconds for Full Plunge
Set plungerIM = New cvpmImpulseP
With plungerIM
.InitImpulseP swplunger, IMPowerSetting, IMTime
.Random 1.5
.InitExitSnd SoundFXDOF("fx_kicker", 141, DOFPulse, DOFContactors), SoundFXDOF("fx_solenoid", 141, DOFPulse, DOFContactors)
.CreateEvents "plungerIM"
End With
' Misc. VP table objects Initialisation, droptargets, animations...
VPObjects_Init
' load saved values, highscore, names, jackpot
Loadhs
'Init main variables
For i = 1 To MaxPlayers
Score(i) = 0
BonusPoints(i) = 0
BonusMultiplier(i) = 1
BallsRemaining(i) = BallsPerGame
ExtraBallsAwards(i) = 0
Next
' Initalise the DMD display
DMD_Init
' freeplay or coins
bFreePlay = False 'we want coins
'if bFreePlay = false Then DOF 125, DOFOn
' Init main variables and any other flags
bAttractMode = False
bOnTheFirstBall = False
bBallInPlungerLane = False
bBallSaverActive = False
bBallSaverReady = False
bGameInPlay = False
bMusicOn = True
BallsOnPlayfield = 0
bMultiBallMode = False
'Multiball=false
bAutoPlunger = False
BallsInLock = 0
BallsInHole = 0
LastSwitchHit = ""
Tilt = 0
TiltSensitivity = 6
Tilted = False
bJustStarted = True
' set any lights for the attract mode
GiOff
StartAttractMode
'EndOfGame()
End Sub
'****************************************
' Real Time updatess using the GameTimer
'****************************************
'used for all the real time updates
Sub GameTimer_Timer
'RollingUpdate 'Doing this in RDampen with 10ms timer
' add any other real time update subs, like gates or diverters
FlipperLSh.Rotz = LeftFlipper.CurrentAngle
FlipperRSh.Rotz = RightFlipper.CurrentAngle
End Sub
'******
' Keys
'******
Sub Table1_KeyDown(ByVal Keycode)
If Keycode = AddCreditKey Then
'Select Case Int(rnd*3)
' Case 0: PlaySound ("Coin_In_1"), 0, CoinSoundLevel, 0, 0.25
' Case 1: PlaySound ("Coin_In_2"), 0, CoinSoundLevel, 0, 0.25
' Case 2: PlaySound ("Coin_In_3"), 0, CoinSoundLevel, 0, 0.25
'End Select
Credits = Credits + 1
if bFreePlay = False Then
DOF 125, DOFOn
If(Tilted = False) Then
DMDFlush
DMD "_", CL(1, "CREDITS: " & Credits), "", eNone, eNone, eNone, 500, True, "fx_coin2"
End If
End If
End If
If keycode = PlungerKey Then
Plunger.Pullback
'PlaySoundAt "fx_plungerpull", plunger
'PlaySoundAt "fx_reload", plunger
SoundPlungerPull
End If
If tilted then exit sub
If hsbModeActive Then
EnterHighScoreKey(keycode)
Exit Sub
End If
If PlayerSelectActive Then
SelectPlayerStart(Keycode)
Exit Sub
End If
If PlayerSelectActive2 Then
SelectPlayerStart2(Keycode)
Exit Sub
End If
' Normal flipper action
If bGameInPlay AND NOT Tilted Then
'If keycode = LeftTiltKey Then Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25:CheckTilt
'If keycode = RightTiltKey Then Nudge 270, 8:PlaySound "fx_nudge", 0, 1, 0.1, 0.25:CheckTilt
'If keycode = CenterTiltKey Then Nudge 0, 9:PlaySound "fx_nudge", 0, 1, 1, 0.25:CheckTilt
If keycode = LeftTiltKey Then Nudge 90, 8:SoundNudgeLeft:CheckTilt
If keycode = RightTiltKey Then Nudge 270, 8:SoundNudgeRight:CheckTilt
If keycode = CenterTiltKey Then Nudge 0, 9:SoundNudgeCenter:CheckTilt
If keycode = MechanicalTilt Then SoundNudgeCenter() : CheckTilt
If keycode = StartGameKey Then
soundStartButton
If((PlayersPlayingGame <MaxPlayers) AND(bOnTheFirstBall = True) ) Then
If(bFreePlay = True) Then
PlayersPlayingGame = PlayersPlayingGame + 1
TotalGamesPlayed = TotalGamesPlayed + 1
DMD "_", CL(1, PlayersPlayingGame & " PLAYERS"), "", eNone, eBlink, eNone, 500, True, "so_fanfare1"
Else
If(Credits> 0) then
PlayersPlayingGame = PlayersPlayingGame + 1
TotalGamesPlayed = TotalGamesPlayed + 1
Credits = Credits - 1
DMD "_", CL(1, PlayersPlayingGame & " PLAYERS"), "", eNone, eBlink, eNone, 500, True, "so_fanfare1"
If Credits <1 And bFreePlay = False Then DOF 125, DOFOff
Else
' Not Enough Credits to start a game.
DMD CL(0, "CREDITS " & Credits), CL(1, "INSERT COIN"), "", eNone, eBlink, eNone, 500, True, "so_nocredits"
PlaySound "NOCOIN"
End If
End If
End If
End If
Else ' If (GameInPlay)
If keycode = StartGameKey Then
soundStartButton
If(bFreePlay = True) Then
If(BallsOnPlayfield = 0) Then
ResetForNewGame()
UpperFlippersActive=True
DisableTable False
UpdateMusicNow
End If
Else
If(Credits> 0) Then
If(BallsOnPlayfield = 0) Then
Credits = Credits - 1
If Credits <1 And bFreePlay = False Then DOF 125, DOFOff
ResetForNewGame()
UpperFlippersActive=True
DisableTable False
UpdateMusicNow
End If
Else
' Not Enough Credits to start a game.
DMD CL(0, "CREDITS " & Credits), CL(1, "INSERT COIN"), "", eNone, eBlink, eNone, 500, True, "so_nocredits"
PlaySound "NOCOIN"
End If
End If
End If
End If ' If (GameInPlay)
If LowerFlippersActive Then
If keycode = RightFlipperkey then
'PlaySound "fx_flipperup", 0, 1, 0, 0.25
'RightFlipper001.RotateToEnd
SolRFlipper1 True
end If
If keycode = LeftFlipperkey then
'PlaySound "fx_flipperup", 0, 1, 0, 0.25
'LeftFlipper001.RotateToEnd
SolLFlipper1 True
end If
elseif UpperFlippersActive Then
If keycode = LeftFlipperKey Then
FlipperActivate LeftFlipper, LFPress
SolLFlipper True
End If
If keycode = RightFlipperKey Then
FlipperActivate RightFlipper, RFPress
SolRFlipper True
End If
End If
'table keys
'If keycode = RightMagnaSave or keycode = LeftMagnasave Then ShowPost
End Sub
Sub Table1_KeyUp(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Fire
'PlaySound "fx_fire"
' PlaySoundAt "fx_fire", Trigger1
If bBallInPlungerLane = 1 Then
SoundPlungerReleaseBall() 'Plunger release sound when there is a ball in shooter lane
Else
SoundPlungerReleaseNoBall() 'Plunger release sound when there is no ball in shooter lane
End If
'PlaySoundAt "fx_plunger", plunger
'If bBallInPlungerLane Then PlaySoundAt "fx_fire", plunger
End If
If hsbModeActive Then
Exit Sub
End If
' Table specific
If bGameInPLay AND NOT Tilted Then
If keycode = LeftFlipperKey Then
SolLFlipper 0
End If
If keycode = RightFlipperKey Then
SolRFlipper 0
End If
End If
SolRFlipper1 False
If LowerFlippersActive And Not Tilted Then
If keycode = RightFlipperkey then
'PlaySound "fx_flipperup", 0, 1, 0, 0.25
'RightFlipper001.RotatetoStart
SolRFlipper1 False
end If
If keycode = LeftFlipperkey then
'PlaySound "fx_flipperup", 0, 1, 0, 0.25
'LeftFlipper001.RotatetoStart
SolLFlipper1 False
Else
If keycode = LeftFlipperKey Then
FlipperDeActivate LeftFlipper, LFPress
SolLFlipper False 'This would be called by the solenoid callbacks if using a ROM
End If
If keycode = RightFlipperKey Then
FlipperDeActivate RightFlipper, RFPress
SolRFlipper False 'This would be called by the solenoid callbacks if using a ROM
End If
end If
End If
End Sub
'*************
' Pause Table
'*************
Sub table1_Paused
End Sub
Sub table1_unPaused
End Sub
Sub Table1_Exit
Savehs
If B2SOn = true Then Controller.Stop
End Sub
'********************
' Flippers
'********************
Const ReflipAngle = 20
Sub SolLFlipper(Enabled)
If Enabled Then
'PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper
DOF 101, DOFOn
LF.Fire' LeftFlipper.RotateToEnd
If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper
Else
SoundFlipperUpAttackLeft LeftFlipper
RandomSoundFlipperUpLeft LeftFlipper
End If
RotateLaneLightsLeft
RotateLaneLightsLeft2
Else
'PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper
DOF 101, DOFOff
LeftFlipper.RotateToStart
If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
RandomSoundFlipperDownLeft LeftFlipper
End If
FlipperLeftHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
'PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper
DOF 102, DOFOn
RF.Fire 'rightflipper.rotatetoend
If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper
Else
SoundFlipperUpAttackRight RightFlipper
RandomSoundFlipperUpRight RightFlipper
End If
RotateLaneLightsRight
RotateLaneLightsRight2
Else
'PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper
DOF 102, DOFOff
RightFlipper.RotateToStart
If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolLFlipper1(Enabled)
If Enabled Then
'PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper001
DOF 101, DOFOn
LeftFlipper001.RotateToEnd
If LeftFlipper001.currentangle > LeftFlipper001.endangle - ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper001
Else
SoundFlipperUpAttackLeft LeftFlipper001
RandomSoundFlipperUpLeft LeftFlipper001
End If
Else
'PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper001
DOF 101, DOFOff
LeftFlipper001.RotateToStart
If LeftFlipper001.currentangle < LeftFlipper001.startAngle - 5 Then
RandomSoundFlipperDownLeft LeftFlipper001
End If
FlipperLeftHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolRFlipper1(Enabled)
If Enabled Then
'PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper001
DOF 102, DOFOn
RightFlipper001.RotateToEnd
If RightFlipper001.currentangle > RightFlipper001.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper001
Else
SoundFlipperUpAttackRight RightFlipper001
RandomSoundFlipperUpRight RightFlipper001
End If
Else
'PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper001
DOF 102, DOFOff
RightFlipper001.RotateToStart
If RightFlipper001.currentangle > RightFlipper001.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper001
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
' flippers hit Sound
Sub LeftFlipper_Collide(parm)
'PlaySound "fx_rubber_flipper", 0, parm / 10, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
LeftFlipperCollide parm
End Sub
Sub RightFlipper_Collide(parm)
'PlaySound "fx_rubber_flipper", 0, parm / 10, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
CheckLiveCatch Activeball, RightFlipper, RFCount, parm
RightFlipperCollide parm
End Sub
Sub RotateLaneLightsLeft
Dim TempState
TempState = LeftOutlane.State
LeftOutlane.State = LeftInlane.State
LeftInlane.State = RightInlane.State
RightInlane.State = RightOutlane.State
RightOutlane.State = TempState
End Sub
Sub RotateLaneLightsRight
Dim TempState
TempState = RightOutlane.State
RightOutlane.State = RightInlane.State
RightInlane.State = LeftInlane.State
LeftInlane.State = LeftOutlane.State
LeftOutlane.State = TempState
End Sub
Sub RotateLaneLightsLeft2
Dim TempState
TempState = li056.State
li056.State = li057.State
li057.state = TempState
End Sub
Sub RotateLaneLightsRight2
Dim TempState
TempState = li057.State
li057.State = li056.State
li056.state = TempState
End Sub
'*********
' TILT
'*********
'NOTE: The TiltDecreaseTimer Subtracts .01 from the "Tilt" variable every round
Sub CheckTilt 'Called when table is nudged
Tilt = Tilt + TiltSensitivity 'Add to tilt count
TiltDecreaseTimer.Enabled = True
If(Tilt> TiltSensitivity) AND(Tilt <15) Then 'show a warning
DMD "", "", "carefuldmd", eNone, eNone, eNone, 500, False, "v_watchout"
End if
If Tilt> 15 Then 'If more that 15 then TILT the table
Tilted = True
'display Tilt
DMDFlush
playsound "youareinmypower"
DMD "", "", "TILT", eNone, eNone, eNone, 200, False, ""
DisableTable True
LowerFlippersActive=False
TiltRecoveryTimer.Enabled = True 'start the Tilt delay to check for all the balls to be drained
End If
End Sub
Sub TiltDecreaseTimer_Timer
' DecreaseTilt
If Tilt> 0 Then
Tilt = Tilt - 0.1
Else
TiltDecreaseTimer.Enabled = False
End If
End Sub
Dim UpperFlippersActive
Sub DisableTable(Enabled)
If Enabled Then
'turn off GI and turn off all the lights
GiOff
LightSeqTilt.Play SeqAllOff
'Disable slings, bumpers etc
LeftFlipper.RotateToStart
RightFlipper.RotateToStart
' Bumper1.Force = 0
' Bumper2.Force = 0
' Bumper3.Force = 0
LeftSlingshot.Disabled = 1
RightSlingshot.Disabled = 1
UpperFlippersActive=False
Else
UpperFlippersActive=True
'turn back on GI and the lights
GiOn
LightSeqTilt.StopPlay
' Bumper1.Force = 8
' Bumper2.Force = 8
' Bumper3.Force = 8
LeftSlingshot.Disabled = 0
RightSlingshot.Disabled = 0
'clean up the buffer display
DMDFlush
End If
End Sub
Sub TiltRecoveryTimer_Timer()
' if all the balls have been drained then..
If(BallsOnPlayfield = 0) Then
' do the normal end of ball thing (this doesn't give a bonus if the table is tilted)
EndOfBall()
TiltRecoveryTimer.Enabled = False
End If
' else retry (checks again in another second or so)
End Sub
'********************
' Music as wav sounds
'********************
Dim Song, UpdateMusic
Song = ""
Sub PlaySong(name)
If bMusicOn Then
If Song <> name Then
StopSound Song
Song = name
PlaySound Song, -1, SongVolume
End If
End If
End Sub
Sub StopSong
If bMusicOn Then
StopSound Song
Song = ""
End If
End Sub
Sub ChangeSong
If(BallsOnPlayfield = 0)Then
PlaySong "M_end"
Exit Sub
End If
If bAttractMode Then
PlaySong "M_end"
Exit Sub
End If
If bMultiBallMode Then
PlaySong "MULTI"
Else
UpdateMusicNow
end if
End Sub
'if you add more balls to the game use changesong then if bMultiBallMode = true, your multiball song will be played.
Sub UpdateMusicNow
Select Case UpdateMusic
Case 0:PlaySong "1"
Case 1:PlaySong "2"
Case 2:PlaySong "3"
Case 3:PlaySong "4"
Case 4:PlaySong "5"
Case 5:PlaySong "M_end"
Case 6:PlaySong "62"
End Select
end sub
Sub Pin001_hit()
Playsound "Rubber_4"
end sub
Sub Pin002_hit()
Playsound "Rubber_4"
end sub
Sub Pin3_hit()
Playsound "Rubber_4"
end sub
Sub Pin4_hit()
Playsound "Rubber_4"
end sub
'********************
' Play random quotes
'********************
Sub PlayQuoteB
Dim tmp
tmp = INT(RND * 10) + 1
PlaySound "burn_" &tmp
End Sub
'**********************
' GI effects
' independent routine
' it turns on the gi
' when there is a ball
' in play
'**********************
Dim OldGiState
OldGiState = -1 'start witht the Gi off
'Sub ChangeGi(col) 'changes the gi color
' Dim bulb
' For each bulb in aGILights
' SetLightColor bulb, col, -1
' Next
'End Sub
'Sub GIUpdateTimer_Timer
' Dim tmp, obj
' tmp = Getballs
' If UBound(tmp) <> OldGiState Then
' OldGiState = Ubound(tmp)
' If UBound(tmp) = 1 Then 'we have 2 captive balls on the table (-1 means no balls, 0 is the first ball, 1 is the second..)
' GiOff ' turn off the gi if no active balls on the table, we could also have used the variable ballsonplayfield.
' Else
' Gion
' End If
' End If
'End Sub
Sub BlinkGI(nr,Time)
dim x
for x = 1 to nr
vpmtimer.addtimer x*2*time-time, "Gioff '"
vpmtimer.addtimer x*2*time, "Gion '"
Next
End Sub
Sub GiOn
ShadowGI.visible=1
DOF 127, DOFOn
Dim bulb
For each bulb in aGiLights
bulb.State = 1
Next
For each bulb in aBumperLights
bulb.State = 1
Next
Table1.ColorGradeImage = "ColorGradeLUT256x16_1to1"
gilut3
vpmtimer.addtimer 20,"gilut2 '"
vpmtimer.addtimer 40,"gilut1 '"
End Sub
Sub gilut1 : Table1.ColorGradeImage = "ColorGradeLUT256x16_1to1" : End Sub
Sub gilut2 : Table1.ColorGradeImage = "ColorGradeLUT256x162" : End Sub
Sub gilut3 : Table1.ColorGradeImage = "ColorGradeLUT256x163" : End Sub
Sub gilut4 : Table1.ColorGradeImage = "-30" : End Sub
Sub GiOff
ShadowGI.visible=0
DOF 127, DOFOff
Dim bulb
For each bulb in aGiLights
bulb.State = 0
Next
For each bulb in aBumperLights
bulb.State = 0
Next
gilut2
vpmtimer.addtimer 20,"gilut3 '"
vpmtimer.addtimer 40,"gilut4 '"