-
Notifications
You must be signed in to change notification settings - Fork 28
/
Futurama (Original 2024) v1.2.1.vbs
15563 lines (14042 loc) · 531 KB
/
Futurama (Original 2024) v1.2.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
Option Explicit
Randomize
'DMD Hack to include FlexDMD inside the table
Sub ImplicitDMD_Init
Me.x = 30
Me.y = 30
'Me.fontColor = RGB(255, 255, 255)
Me.intensityScale = 2
Me.width = 128 * 2
Me.height = 32 * 2
Me.visible = true
Me.timerenabled = true
End Sub
Sub ImplicitDMD_Timer
If Not FlexDMD Is Nothing Then
Dim DMDp: DMDp = FlexDMD.DmdColoredPixels
If Not IsEmpty(DMDp) Then
DMDWidth = FlexDMD.Width
DMDHeight = FlexDMD.Height
DMDColoredPixels = DMDp
End If
End If
End Sub
'End of DMD Hack to include FlexDMD inside the table
'*******************************************
' User Options
'*******************************************
'----- DMD Options -----
Dim UseFlexDMD : UseFlexDMD = 1 '0 = no FlexDMD, 1 = enable FlexDMD. FlexDMD cannot be used with VR.
'----- Staged flippers options -----
Const stagedFlipperStyle = 0 ' 0 = MagnaSaves, 1 = A and apostrophe
'----- Action button options -----
Const BlastWithPlunger = True ' Set to True to use the plunger key as the action button.
' Only recommended if you have an analog plunger.
Const HideBlastButton = False ' Set to True to hide the button on the lockbar.
'----- Outlane difficulty -----
Const LeftOutlaneDifficulty = 1 ' 0 = easy, 1 = medium (default), 2 = hard, 3 = extra hard (no post)
Const RightOutlaneDifficulty = 2 ' 0 = easy, 1 = medium, 2 = hard (default), 3 = extra hard (no post)
'----- Shadow Options -----
Const DynamicBallShadowsOn = 1 '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
'----- Music Options -----
Const fMusicVolume = 0.5 'Music volume. 0 = no music, 1 = full volume
COnst fAttractVolume = 0.3 'Attract mode music volume. 0 = no music, 1 = full volume
Const fDuckfactor = 0.1 'Duck music to 10% (multiplicative with fMusicVolume) during videos
'----- 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 = 0.5 'Level of ramp rolling volume. Value between 0 and 1
'----- VR Room Options -----
Dim VRRoomChoice : VRRoomChoice = 1
'1 - Deluxe Room
'2 - Minimal room
Dim VR_Obj
Dim DesktopMode: DesktopMode = Table1.ShowDT
If RenderingMode = 2 Then
Table1.PlayfieldReflectionStrength = 5 ' Sets VR Playfield reflection strength
UseFlexDMD = 0
For Each VR_Obj in VRCabinet : VR_Obj.Visible = 1 : Next
If VRRoomChoice = 1 Then
For Each VR_Obj in VRDeluxeRoom : VR_Obj.Visible = 1 : Next
Else
For Each VR_Obj in VRMinimalRoom : VR_Obj.Visible = 1 : Next
End If
Else
For Each VR_Obj in VRDeluxeRoom : VR_Obj.Visible = 0 : Next
For Each VR_Obj in VRMinimalRoom : VR_Obj.Visible = 0 : Next
If DesktopMode=True Then PinCab_Rails.visible = 1
End if
' Based on the VPW Example Table
'
' CONTENT CONTRIBUTION CREDITS
' Dynamic Ball Shadows: iaakki, apophis, Wylte
' Rubberizer: iaakki
' Target Bouncer: iaakki, wrd1972, apophis
' Flipper and physics corrections: nFozzy, Rothbauerw
' Sound effects package: Fleep
' Ramp rolling sounds: nFozzy
' Lampz: nFozzy
' Bumpers: Flupper
' Flasher domes: Flupper
' 3D inserts: Flupper, Benji
' Drop targets: Rothbauerw
' VR Cabinet & Room: Sixtoe, Flupper, 3rdaxis
' FlexDMD: oqqsan
'
' Futurama change log:
' 010 (wizball) : Fix playfield mesh with corrected upper hole
' Bender multiball fixes
' Change hit threshold on metal walls to make less rattling sounds
' Fix crash in DMDTimedText
' Increase lower flipper strength to 3250
' 016 (Wizball) : Add animation to slugs
' Add insert blinks to drop targets
' Add blasting with action button
' Add blast count to DMD
' 018 (Wizball) : Add a kicker to the right ramp to make the shot faster
' Add a skill shot
' Add animation to the suicide booth
' Add a Hypnotoad image to spinning disk
' When slowing down the spinning disk from full speed, end at 0 degrees
' 019 (Wizball) : Make the transition out of the loop of the right ramp smoother
' Reduce the strength of the kicker on the right ramp
' 022 (Wizball) : Use a trigger instead of a kicker for the right ramp speedup, for better sound
' Add grace period for multiballs
' Add skill shot
' Add combo awards
' Add combo awards to DMD
' 025 (Wizball) : Fix bug in extra ball handling
' Fix bug where a multiball didn't end if a ball ended during the multiball's grace period
' Add lights to signpost
' Add Omicron Persei 8, Amazonia, and Decapod 10 modes (no select for now)
' 028 (Wizball) : Added light to blast button
' Hide flipper shadows in desktop mode
' Added mode Select
' Added Mars, Daily Planet, Moon, Chapek 9, Earth, and Osiris 4 modes
' 029 (Wizball) : Fix script crash on winning a mode
' 030 (Wizball) : Add High scores
' Show previous game’s score in attract mode
' When selecting modes, show if a mode has previous progress
' In Moon mode, hitting a shot with both white and grays arrows now gives double progress
' Fixed all arrow lights being momentarily off when shots move in e.g. Mars mode
' 031 (Wizball) : Added bonus
' Blast light is now always off when all blasts are used
' Added mystery award
' Added queue system
' Added framework for PuP events
' 032 (Wizball) : Add light shows
' 033 (Wizball) : Add suicide booth
' Reduce size of lower scoop to prevent jams in multiball
' 034 (Wizball) : Add instant info
' Add Mini wizard mode 1
' Add kickout alert for lower scoop
' 035 (Wizball) : Add mini wizard mode 2, event queue fixes
' 036 (Wizball) : Add adjustable outlane posts
' 037 (Wizball) : Add staged flippers
' add Slurm wizard mode
' Remove shot debugger
' 040 (Wizball) : Wire beer bottle animation to an invisible drop target
' Add black walls to hide the desktop background from the drop target holes
' 041 (Wizball) : Fix bug that could cause mini-wizard modes to be available twice in a row
' 042 (jsm174) : Standalone fixes
' 043 (Wizball) : PuP integration
' 044 (Wizball) : Fix blast light, add PuP suicide booth, add PuP mode select
' Update playfield art and playfield multiplier LED color
' 046 (Wizball) : Fix zCol_Rubber_Sleeve008 collections
' Fix bug where slugs could become intangible in 10.8
' Add Slug Invasion PuP, Add slug sound effects
' Update apron and rule card images
' Update VR backbox, update lockbar, rails, and side blades
' Game should now work with FlexDMD disabled
' Added multiple videos for ball save
' Display now updates mode progress text if it changes while displayed
' 048 (Wizball) : Fix mode progress display for Naturama
' Change how cutscene skipping is handled if the ball is in the lower scoop
' Fix cutscene skip for suicide booth loss
' Work around PuP font size issue for scores (size used to vary with UI scale)
' Add music and music ducking
' Add hypnotoad mechanical sound
' Add inlane slowdown code
' 049 (Rawd) VR Room Overhaul
' 050 (tomate) New tube ramp texture added.
' 051 (apophis) DOF commands added. Pincab rails visible in desktop mode. Minor physics script updates.
' RC1 (wizball) : Add Option to blast with plunger button
' Add depth bias to drop targets and insert labels so they don't appear on top of the tube
' Increased volume of Chapek 9 music
' Add bottle sound to Bender jackpots
' Mute other music during Bender multiball
' Adjusted Multibaseball value to 25M jackpot / 60M super jackpot
' Add credits image to PuP
' Changed apron image so that a ball at the plunger is visible in destop view
' RC2 (Joe) : New Tube texture
' RC3 (Wizball) : Blasts can no longer be used if a mode or multiball is not running
' Removed cheats and debug prints
' RC4 (apophis) : Updated DOF calls
' RC5, RC6(Joe) : Fix floating gate, scoop visuals, and flipper decals
' RC7 (Wizball) : Change GI around slingshots
' Fix gap around shoot again insert
' Clean up debug table objects
' New playfield textures
' RC8 (joe/wiz) : Darken desktop background behind the table (fixes blue artifacts in DT)
' Fix gap between side wall and back wall
' Hide side rails in cabinet mode
' Add attract mode music (can be disabled in script options)
' 1.0 (wizball) : Fix attract mode music playing during high score entry
' Add blocker walls over and behind the lower scoop
' New visual for lower scoop
' 1.1 (joe/wiz) : Fix DOF flipper solenoids staying on after a drain
' Fix modes not stopping after a tilt
' Add option to hide blast button
' Move side loop inserts for better visibility
' Fix Morbo not appearing in the TV in 10.8
' 1.2 (wizball) : Fix bug where the game rarely would not feed a ball after a Bender lock
' Add sound cue when reverse flippers expire
' Attract music now has the proper volume after a game over
' Prevent selecting a mode from using a blast with some button configs
'***********************************
' DOF IDs
'***********************************
'E101 0/1 LeftFlipper
'E102 0/1 RightFlipper
'E103 2 Leftslingshot
'E104 2 Rightslingshot
'E105 2 Bumper 1
'E106 2 Bumper 2
'E107 2 Bumper 3
'E108 2 right drop targets
'E109 2 center standup/drop targets
'E110 2 leftkicker and kicker001 kick
'E111 2 ball release and autoplunge kicker
'E118 0/1 Launch/Fire button pulse
'E119 0/1 Fire button ready
'E120 0/1 Start game button ready
'E121 0/1 Launch ball ready
'E122 2 ball fired from plunger
'E123 2 Spinner (top center) spinner
'E124 2 Spinner2 (middle center) spinner
'E125 2 Spinner3 (bottom left) spinner
'E126 2 drain hit (ball not saved)
'E127 2 drain hit (ball saved)
'E130 2 Blast used
'E131 2 Combo added/awarded
'E132 2 Extra ball awarded
'E133 2 Mystery awarded
'E141 2 Flasher 1 (lower left, green)
'E142 2 Flasher 2 (lower right, red)
'E143 2 Flasher 3 (upper right, blue)
'E144 2 Flasher 4 (upper left, white)
'E150 0/1 undercab red fades in and out slowly
'E151 0/1 undercab blue fades in and holds
'E153 2 tilt warning
'E154 2 tilt
'E155 0/1 attract mode
'E160 0/1 Multiball 1 active
'E161 0/1 Multiball 2 active
'E180 2 CHAPEK 9 progress (PURPLE)
'E181 2 DECAPOD 10 progress (ORANGE)
'E182 2 DAILY PLANET progress (TEAL)
'E183 2 OMICRON PERSEI 8 progress (YELLOW)
'E184 2 AMAZONIA progress (PINK)
'E185 2 EARTH progress (BLUE)
'E186 2 MOON progress (GRAY)
'E187 2 SLUG INVASION progress (BROWN)
'E188 2 MARS progress (RED)
'E189 2 MINI WIZARD 1 progress (GREEN)
'E190 2 MINI WIZARD 2 progress (LIME)
'E191 2 SLURM jackpot
'E192 2 SLURM super jackpot
'E193 2 Basemultiball jackpot
'E194 2 Basemultiball super jackpot
'E195 2 Bender jackpot
'E196 2 Bender super jackpot
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
'*******************************************
' Constants and Global Variables
'*******************************************
Const UsingROM = False 'The UsingROM flag is to indicate code that requires ROM usage. Mostly for instructional purposes only.
Const BallSize = 50 'Ball size must be 50
Const BallMass = 1 'Ball mass must be 1
Const tnob = 6 'Total number of balls
Const lob = 0 'Locked balls
Const cGameName = "futurama"
Const bEnablePuP = True 'Disabling PuP is not supported
Dim nAutoPlungeBalls ' Count of balls to autoplunge
Dim nBallsToFeed ' Count of balls to feed from the trough
Dim nReleaseDelay ' Time in ms before the trough can release a new ball
Dim tablewidth: tablewidth = Table1.width
Dim tableheight: tableheight = Table1.height
Dim BIPL : BIPL = False 'Ball in plunger lane
Dim bResetInlines
Dim oLastBallInInlines ' The most recent ball object that hit the end of the inline drop lane
' Lock sequence for the third multiball and afterward
' 0. Hit the bottom drop target to clear a path to the end
' 1. Hit the middle drop target to clear a path to the end
' 2. Hit the top drop target to clear a path to the end
' 3. Hit the end of the lane to capture a ball in the middle slot
' 4. Hit the middle drop to move the captured ball to the top slot
' 5. Hit the middle drop to open the middle slot
' 6. Shoot a ball into the middle slot
' 7. Hit the bottom drop to open the bottom slot
' 8. Shoot a ball into the bottom slot
' The first mutiball only has steps 3, 4, and 6.
' The second mutiball skips steps 0, 1, and 2.
Dim anInlineStateGoals
' Array of numbers indicating what targets should be raised before each lock state
anInlineStateGoals = Array(7, 6, 4, 0, 2, 6, 4, 7, 6, 7)
' State 0 : all raised (4 + 2 + 1)
' State 1 : middle and top raised (4 + 2 + 0)
' State 2 : top raised (4 + 0 + 0)
' State 3 : none raised (0 + 0 + 0)
' State 4 : middle raised (0 + 2 + 0)
' State 5 : middle and top raised (4 + 2 + 0)
' State 6 : top raised (4 + 0 + 0)
' State 7 : all raised (4 + 2 + 1)
' State 8 : middle and top raised (4 + 2 + 0)
' State 9 : preparing to release, all raised (4 + 2 + 1)
Dim aoBenderLockedBalls(2) ' Array of balls locked in the inline drops
Dim nTimeReleaseLock ' Time in ms remaining until a lock is released
Dim anScore(4)
Dim nPlayer ' 0 based index of the current player (0 = player 1)
Dim nPlayersInGame ' Count of the number of players currently in the game
Dim nPlayersLastGame ' Count of players last game
Dim bPlayerChanged ' Boolean, true if the player has changed
Dim nTimeLowerLeftFlip ' The time when the lower left flipper was last raised
Dim nTimeLowerRightFlip ' The time when the lower right flipper was last raised
Dim nTimeUpperLeftFlip ' The time when the lower left flipper was last raised
Dim nTimeUpperRightFlip ' The time when the lower right flipper was last raised
Dim nTimeBlastUsed ' The time when a player last pressed the blast button
Dim bDrainingBalls ' Is the table draining balls after a tilt or timed out multiball?
Dim nTimeStartPressed ' timestamp when the start button was pressed
Dim nTimeVUKFired ' timestamp when the kickout from the upper scoop was last fired
Dim bBallHeld ' Is the ball grabbed by something (pausing timers)?
Dim bBallinLowerScoop ' Is there at least one ball in the lower scoop?
Dim bFirstSwitchHit ' True if the ball has hit a switch since the start of the ball
Dim bMball2Ended ' True if the inline drops should be raised after Bender multiball
Dim oEventQueue ' Global event queue
Dim oCurrentEvent ' The event currently being handled
Dim nTimeLastPuP ' GameTime when the last PuP event was handled
Dim oHypnotoad
Dim bHypnoToadSpin ' True if hypnotoad should spin, false if hypnotoad should stand still
Dim dHypnotoadSpeed ' Current hypnotoad RPM
Dim nTimeHypnotoadUpdate ' Time in ms when hypnotoad was last animated
Const nHypnotoadMaxSpeed = 160 ' rpm
Const nHypnotoadSpinUpDown = 1000 ' ms between standstill and full speed
Const dRpmToDegPerMs = 0.006 ' revolutions per minute to degrees per millisecond
Dim fBoothTargetAngle ' Angle in degrees to animate the sucicide booth rotating to
Const nBoothRotateSpeed = 40 ' rpm
Dim LRRRraisedLeft
Dim LRRRRaisedRight
Const LRRRMoveTime = 300 ' Time in milliseconds between raised and lowered LRRR states
Const LRRRMoveHeight = 125 ' Distance in VP Units between raised and lowered LRRR states
Dim anColorCycleLight ' Array of colors of lights turned on in the color cycle
Dim anColorCycleDark ' Array of colors of lights turned off in the color cycle
Dim nColorCycleIndex ' Index of which color the lights are during attract mode
Dim aoShotLights ' Array of control lights for shots
Dim aoComboLights ' Array of control lights for combos
Dim aoModeLights ' Array of control lights for modes
Dim aoLaneLights ' Array of control lights for inlanes and outlanes
Dim ao5BankLights ' Array of control light for the 5 drop target bank
Dim aoMball1LockLights ' Array of lock lights for multiball 1
Const eColorNone = -1
Const eColorRed = 0
Const eColorOrange = 1
Const eColorYellow = 2
Const eColorLime = 3
Const eColorGreen = 4
Const eColorCyan = 5
Const eColorBlue = 6
Const eColorPurple = 7
Const eColorPink = 8
Const eColorWhite = 9
Const eColorGray = 10
Const eColorRainbow = 11
Const nColorsInCycle = 11
anColorCycleLight = Array(RGB(185,0,20), RGB(255,85,20), RGB(255,200,0), _
RGB(171, 255, 0), RGB(25,205,25), RGB(0,255,200), RGB(15,85,255), _
RGB(128,0,255), RGB(163,102,255), RGB(255,245,235), RGB(48, 48, 48))
aoShotLights = Array(cLightLeftLane, cLightLowerScoop, cLightLeftLoop, _
cLightSideLoop, cLightUpperScoop, cLightLeftRamp, cLightCenterLane, _
cLightRightRamp, cLightInlineDrops, cLightRightLoop)
aoComboLights = Array(cLightComboLLane, cLightComboLowScoop, cLightComboLLoop, _
cLightComboSideLoop, cLightComboTopScoop, cLightComboLRamp, cLightComboCLane, _
cLightComboRRamp, cLightComboInlines, cLightComboRLoop)
aoModeLights = Array(cLightModeOmicron, cLightModeMars, cLightModeDaily, _
cLightModeMoon, cLightModeChapek, cLightModeEarth, cLightModeAmazonia, _
cLightModeOsiris, cLightModeDecapod)
aoMball1LockLights = Array(cLightMball1Lock1, cLightMball1Lock2, cLightMball1Lock3)
ao5BankLights = Array(cLightDrop1, cLightDrop2, cLightDrop3, cLightDrop4, cLightDrop5)
aoLaneLights = Array(cLightLeftOutlane, cLightLeftInlane, _
cLightRightInlane, cLightRightOutlane)
Dim aoDigit1Lights, aoDigit2Lights
Dim anDigitSegments
anDigitSegments = Array(63, 6, 91, 79, 102, 109, 125, 7, 127, 111)
Dim aPowersOfTwo
aPowersOfTwo = Array(1, 2, 4, 8, &h10, &h20, &h40, &h80,_
&h100, &h200, &h400, &h800, &h1000, &h2000, &h4000, 32768,_
&h10000, &h20000, &h40000, &h80000, &h100000, &h200000, &h400000, &h800000,_
&h1000000, &h2000000, &h4000000, &h8000000, &h10000000, &h20000000, &h40000000)
aoDigit1Lights = Array(LightD1S1, LightD1S3, LightD1S6, LightD1S7,_
LightD1S5, LightD1S2, LightD1S4)
aoDigit2Lights = Array(LightD2S1, LightD2S3, LightD2S6, LightD2S7,_
LightD2S5, LightD2S2, LightD2S4)
Dim nAttractModePage ' 0 based index of attract mode page to display
Const nAttractModePageCount = 8
Const nAttractModePageTime = 2500 ' Time in ms between switching attract mode pages
Dim nTextPriority ' a low number is a high priority, 1 means top priority
' 99 means "only display if otherwise idle"
Dim nTextDuration ' Time in ms of long to display the current message
Dim nModeOnScores ' The mode currently displayed on the scoreboard
const eModeNone = -1 : const eModeOmicron = 7 : const eModeMars = 8 : const eModeDaily = 2
const eModeMoon = 6 : const eModeChapek = 0 : Const eModeEarth = 5 : Const eModeAmazonia = 4
Const eModeOsiris = 3 : Const eModeDecapod = 1 : Const eModeMultiball1 = 9
Const eModeMultiball2 = 10 : Const eModeSuperBumpers = 11 : Const eModeSuperSpinners = 12
Const eModeSuperLoops = 13 : Const eModeSuperRamps = 14 : Const eModeFrenzy = 15
Const eModeImmolation = 16 : Const eModeCherryBomb = 17 : const eModeSlurm = 18
Const eModeReverseFlips = 19 : Const eModeHypnotoad = 20
Dim asModeNames
asModeNames = Array("CHAPEK 9", "DECAPOD 10", "NATURAMA", "OMICRON PERSEI 8", _
"AMAZONIA", "EARTH", "THE MOON", "SLUG INVASION", "MARS", "BASEMULTIBALL", "BENDER MULTIBALL", _
"SUPER BUMPERS", "SUPER SPINNER", "SUPER LOOPS", "SUPER RAMPS", "FRENZY", "FEMINISTA", _
"POKER CHAMPIONSHIP", "SLURM", "REVERSE FLIPPERS", "HYPNOTOAD SPINS")
Dim asModeGoals
asModeGoals = Array("HIT PURPLE ARROWS", "HIT ORANGE ARROWS", "HIT TEAL ARROWS", _
"HIT YELLOW ARROWS", "HIT PINK ARROWS", "HIT BLUE ARROWS", _
"HIT WHITE AND GRAY ARROWS", "HIT THE SLUGS", "HIT RED ARROWS", "HIT GREEN ARROWS", _
"HIT LIME ARROWS", "HIT THE BUMPERS", "HIT THE SPINNERS", _
"HIT LOOPS", "HIT RAMPS", "HIT ANY SWITCH", "HIT RIGHT RAMP", _
"HIT BLINKING ARROWS", "RED - YELLOW - GREEN", "SURVIVE", "SURVIVE")
Dim anShotsToWin
anShotsToWin = Array(9, 10, 10, 7, 10, 8, 6, 6, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Dim aoLightForMode
aoLightForMode = Array(cLightModeChapek, cLightModeDecapod, cLightModeDaily, _
cLightModeOsiris, cLightModeAmazonia, cLightModeEarth, _
cLightModeMoon, cLightModeOmicron, cLightModeMars)
Dim anModeStartTime
anModeStartTime = Array(93499, 78499, 78499, 88499, 63499, _
63499, 48499, 33499, 78499, 0, 0, 62499, 62499, 62499, _
62499, 62499, 0, 0, 0, 30000, 60000)
Dim anModeStartTriggers, anModeProgressTriggers, anModeEndTriggers
anModeStartTriggers = Array(721, 724, 727, 730, 734, 737, _
740, 743, 746, 763, 773, 0, 0, 0, 0, 0, 749, 752, 755)
anModeProgressTriggers = Array(722, 725, 728, 731, 735, 738, _
741, 744, 747, 764, 774, 0, 0, 0, 0, 0, 750, 753, 756)
anModeEndTriggers = Array(723, 726, 729, 732, 736, 739, _
742, 745, 748, 766, 776, 0, 0, 0, 0, 0, 751, 754, 758)
Dim afModeXCoordinates, afShipYCoordinates, afCompletionYCoords
afModeXCoordinates = Array(9.1, 8.6, 23.2, 35.4, 45.9, _
59.2, 73.1, 86.7, 74.4)
afShipYCoordinates = Array(62.0, 10.5, 34.6, 12.3, 56.2, _
29.2, 7.31, 31.6, 65.5)
afCompletionYCoords = Array(74.1, 22.6, 46.7, 24.4, 68.2, _
41.2, 19.4, 43.6, 77.5)
Dim anTimedModes
anTimedModes = Array(eModeOmicron, eModeMars, eModeDaily, eModeMoon, eModeChapek, _
eModeEarth, eModeAmazonia, eModeOsiris, eModeDecapod, eModeSuperBumpers, _
eModeSuperSpinners, eModeSuperLoops, eModeSuperRamps, eModeFrenzy, _
eModeReverseFlips, eModeHypnotoad)
Dim anAddTimeModes
anAddTimeModes = Array(eModeOmicron, eModeMars, eModeDaily, eModeMoon, eModeChapek, _
eModeEarth, eModeAmazonia, eModeOsiris, eModeDecapod, eModeSuperBumpers, _
eModeSuperSpinners, eModeSuperLoops, eModeSuperRamps, eModeFrenzy)
Const eComboAwardNone = -1 : Const eComboAwardBumpers = 0 : Const eComboAwardSpinners = 1
Const eComboAwardLoops = 2 : Const eComboAwardRamps = 3 : Const eComboAwardFrenzy = 4
Const eComboAwardLightEB = 5 : Const eComboAwardPoints = 6
Dim asComboAwardText
asComboAwardText = Array("SUPER BUMPERS", "SUPER SPINNER", "SUPER LOOPS", "SUPER RAMPS", _
"FRENZY", "EXTRA BALL", "BIG POINTS")
Const eShotNone = -1 : Const eShotLeftLane = 0 : Const eShotLowerScoop = 1
Const eShotLeftLoop = 2 : Const eShotSideLoop = 3 : Const eShotUpperScoop = 4
Const eShotLeftRamp = 5 : Const eShotCenterLane = 6 : Const eShotRightRamp = 7
Const eShotInlineDrops = 8 : Const eShotRightLoop = 9 : Const eShotLRRRLeft = 10
Const eShotLRRRRight = 11
Dim asShotNames
asShotNames = Array("LEFT LANE", "LOWER SCOOP", "LEFT LOOP", "SIDE LOOP", "UPPER SCOOP", _
"LEFT RAMP", "CENTER LANE", "RIGHT RAMP", "BENDER LANE", "RIGHT LOOP", _
"LEFT SLIME", "RIGHT SLIME")
Const eMysteryNone = 0 : Const eMysteryPoints = 1 : Const eMysteryMBall1 = 2
Const eMysteryMBall2 = 3 : Const eMysteryPlayfieldX = 4 : Const eMysteryBonusX = 5
Const eMysteryBallSave = 6 : Const eMysteryBlast = 7 : Const eMysterySuperShot = 8
Const eMysteryAddTime = 9 : Const eMysteryAddABall = 10 : Const eMysteryJoke = 11
Dim asJokeAwards
asJokeAwards = Array("3 KILOS OF PURE DIRT", "LEGALIZE DEATH SAVES", _
"EAT PLAYER'S QUARTER", "5 FREE GAMES", "TAKE LOWEST SCORE", _
"MINUS 50 DKP", "PROMOTE A PAWN", "GO TO JAIL", "TROUGH MALFUNCTION", _
"WARP FACTOR 9", "TOUR THE MANSION", "REVERSE GRAVITY", _
"FORCE VPX UPDATE")
Dim asBonusLabels
asBonusLabels = Array("BonusCaption", "SwitchCaption", "SwitchValue", _
"ComboCaption", "ComboValue", "DeliverCaption", "DeliverValue", _
"BonusX", "BonusTotal", "BonusScoreCaption", "BonusScoreValue")
Dim anBenderJackpotShots
anBenderJackpotShots = Array(eShotLeftLane, eShotLowerScoop, eShotSideLoop, _
eShotUpperScoop, eShotLeftRamp, eShotCenterLane, eShotRightRamp, eShotRightLoop)
Dim anSwitchLastHit(33)
Dim nTimeAnySwitch
Const nDebounceTime = 150 ' Time in ms to ignore a switch after its last Hit
Const eSwitchNone = -1 : Const eSwitchLeftInlane = 0 : Const eSwitchLeftOutlane = 1
Const eSwitchLeftSpinner = 2 : Const eSwitchLowerScoop = 3 : Const eSwitchLeftSlingShot = 4
Const eSwitchTargetPurple = 5 : Const eSwitchLeftBumper = 6 : Const eSwitchMiddleBumper = 7
Const eSwitchRightBumper = 8 : Const eSwitchSideSpinner = 9 : Const eSwitchLeftLoop = 10
Const eSwitchSideLoop = 11 : Const eSwitchUpperScoop = 12 : Const eSwitchLeftRamp = 13
Const eSwitchUpperSpinner = 14 : Const eSwitchUpperLoop = 15 : Const eSwitchCenterLane = 16
Const eSwitchRightRamp = 17 : Const eSwitchInlineLower = 18 : Const eSwitchInlineMiddle = 19
Const eSwitchInlineUpper = 20 : Const eSwitchInlineEnd = 21 : Const eSwitchRightLoop = 22
Const eSwitchRightLoopEnter = 23 : Const eSwitchDropB = 24 : Const eSwitchDropL = 25
Const eSwitchDropA = 26 : Const eSwitchDropS = 27 : Const eSwitchDropT = 28
Const eSwitchPlungerLane = 29 : Const eSwitchRightOutlane = 30 : Const eSwitchSuicideBooth = 31
Const eSwitchRightinlane = 32 : Const eSwitchRightSlingshot = 33
Dim anSkillShotSwitches
anSkillShotSwitches = Array(eSwitchDropB, eSwitchDropL, eSwitchDropA, eSwitchDropS, _
eSwitchDropT, eSwitchSideSpinner, eSwitchSideLoop, eSwitchUpperScoop, eSwitchLeftRamp, _
eSwitchUpperSpinner, eSwitchUpperLoop, eSwitchCenterLane, eSwitchRightLoop, eSwitchRightLoopEnter)
Const eSkillSideSpinner = 0 : Const eSkillSideLoop = 1 : Const eSkillScoopFromRight = 2
Const eSkillScoopFromLeft = 3 : Const eSkillLeftRamp = 4 : Const eSkillLaneFromPlunge = 5
Const eSkillLaneFromLeft = 6 : Const eSkillDrops = 7
' Signpost light numbers
Const eLightExtraBall = 52 : Const eLightMystery = 53
Const eLightSelectMode = 54 : Const eLightCollectCombo = 55
' Blast button light
Const eLightBlastButton = 56
Dim nPostLightStates
' Display priorities
Const ePrioTilt = 1 : Const ePrioNewPlayer = 2 : Const ePrioBallSave = 3
Const ePrioBlast = 4 : Const ePrioSuperJackpot = 5
Const ePrioTiltWarning = 6 : Const ePrioExtraBall = 7 : Const ePrioModeEnd = 8
Const ePrioModeStart = 9 : Const ePrioMystery = 10 : Const ePrioMballStart = 11
Const ePrioComboCollect = 12 : Const ePrioMballReady = 13 : Const ePrioMballLock = 14
Const ePrioModeProgress = 15 : Const ePrioJackpot = 16 : Const ePrioCombo = 17
Const ePrioModeSelect = 18 : Const ePrioSkillShot = 19 : Const ePiroShotLit = 20
Const ePrioBonusX = 21 : Const ePrioBlastAdded = 22 : Const ePrioMysteryLit = 23
Const ePrioIdle = 99
' Light shows
Const eLightShowHatchLong = 1 : Const eLightShowHatchShort = 2 : Const eLightShowRadarLong = 3
Const eLightShowRadarShort = 4 : Const eLightShowRiseLong = 5 : Const eLightShowRiseShort = 6
Const eLightShowSinkLong = 7 : Const eLightShowSinkShort = 8 : Const eLightShowDiagLong = 9
Const eLightShowDiagShort = 10 : Const eLightShowCircleLong = 11 : Const eLightShowCircleShort = 12
Const eLightShowMball1Long = 13 : Const eLightShowMball1Short = 14 : Const eLightShowMystery = 15
Const eLightShowStrobeLong = 16 : Const eLightShowStrobeShort = 17 : Const eLightShowModeComplete = 18
Const eLightShowNone = 0
'high scores
Const cHighScoreAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ. <"
Const nHighScoreSlots = 5
Dim HighScore(4)
Dim HighScoreName(4)
Dim SortedHighscores()
Dim SortedHighscoreNames()
Dim aScoreRanks
Dim nHighScoreIter
Dim nTimePressedLeft ' For entering highscores: when L button was pressed
Dim nTimePressedRight ' For entering highscores: when R button was pressed
Dim HighscoreLetter ' The index of the current letter in the cHighScoreAlphabet
Dim InitialsEntered ' The initials being entered in the highscore
Dim bEnteringHighScore ' Are we currently entering a high score?
Const nBallSaveNewBall = 14500
Const nBallSaveMball2 = 12500
Const nBallSaveMiniWizard1 = 22500
Const nBallSaveMiniWizard2 = 32500
Const nBallSaveSlurm = 32500
Const nBallSaveAddBall = 10500
Const nTimeMBallGrace = 4000
'*******************************************
' Per player variables
'*******************************************
Dim fPlayfieldX ' Playfield multiplier for the current player
Dim nTimeXPause ' Time in ms that the playfield multiplier countdown is paused
Dim nTimeXCountdown ' Time in ms until the playfield multiplier counts down
Const nXPauseStart = 5000 ' How long to pause the X countdown after increasing X
Const nXPauseAdd = 2000 ' How long the "add time" spinner pauses the X countdown
Const nXCountdownInterval = 2000 ' Time in ms between decreases of the playfield multiplier
Const nModeAdd = 2000 ' How much time the "add time" spinner adds to modes per spin
Dim nBonusX ' Bonus multiplier for the current player
Dim nBonusTotal ' Total bonus earned this ball
Dim bCountingBonus ' Is the game currently displaying the bonus count?
Dim nBonusScreen ' What screen of the bonus is being displayed
Dim avBeerLanes(3) ' BitSet per player of bottom lanes
Dim BIP ' Count of the number of balls
Dim nBall ' Ball 1, 2, 3, etc for the current player
Dim nExtraBalls ' Number of extra balls the current player has
Dim anExtraBallsLit ' Count per player of extra balls lit
Dim nTimeBallStart ' Timestamp of when the current ball started
Dim avSkillShotsHit(3) ' Bitset per player of unique skill shots hit
Dim bSkillShotActive ' Boolean, True if a skill shot is active
Dim avDrops5bankHit(3) ' Bitset per player of which drop targets are hit in the right bank
Dim bSettingDrops ' Boolean, true if lowering drops (so they aren't hits)
Dim anComboTimer(11) ' Array per shot of time remaining on combos
Dim anCombos(3) ' Array of counts per player of combos made
Dim anNextComboAward(3) ' Array per player of what the next combo award will be
Dim anComboLastCollect(3) ' Array per player of what combo count was when it was collected
Dim abComboEBCollected(3) ' Boolean per player of if the player collected the extra ball from combos
Dim anBlasts ' Array per player of blast button uses
Dim anMysteryLevelLit ' Which mystery level is lit if any, per player
Dim nTimeMBallGraceLeft ' Time in ms remaining on the multiball grace period
Dim anLiteLockShots ' Count per player of shots towards lighting a lock
Dim abMball1LoopLeft ' Boolean, true if hitting the left loop lights a lock
Dim abMball1LoopRight ' Boolean, true if hitting the right loop lights a lock
Dim anMBall1Locks ' Count per player of virtual lock state for multiball 1
Dim anMball1Played ' Count per player of times multiball 1 has been played
Dim anMball1Jackpots(1) ' Array of what shots are the jackpots during multiball 1
Dim anMBall2Locks ' Count per player of virtual lock state
Dim anMball2Played ' Count per player of times Bender multiball has been played
Dim nTimeDelayMultiball ' Time in ms to delay multiball for a light show
Dim nTimeDelayVUK ' Time in ms to delay kickout on the VUK
Dim nTimeDelayLowerScoop' Time in ms to delay kickout on lower scoop
Dim nTimeDelayBooth ' Time in ms to delay kickout on the suicide booth
Dim nTimeBallSave ' Time in ms left on the ball save
Dim bOutlaneSave ' Boolean of if a ball has been saved after an outlane drain
Dim abBoothReady(3) ' Boolean per player for if the suicide booth can save the ball
Dim nTimeBooth ' Time in ms left to pick a suicide booth option
Dim nTimeBoothChange ' Time in ms until the suicide booth option changes
Dim avBoothOptionsUsed(3) ' BitSet per player of non-drain suicide booth options used
Dim nBoothOption ' The current suicide booth option
Dim bBlinkBoothOption ' Boolean, On / Off state for blinking suicide booth option
Dim bBoothSaved ' True if the suicide booth kicks to the shooter lane, false = drain
Dim nBoothWheel ' Wheel image number on the booth PuP
Dim aanShotLastHit(3, 11)' Time a certain shot was last hit, per player
Dim nModeSelected ' Current choice in mode selection
Dim bSelectingMode ' True if the player is currently selecting a mode
Dim bInMode ' Boolean, true if a one ball mode is currently running
Dim avModesRunning(3) ' Array of bitsets per player of modes currently running
Dim nModePending ' Mode pending on bottom scoop kickout
Dim bMusicAfterKick ' Boolean, True if mode music should play after the scoop kickout
Dim bMovingShip ' boolean, true if the ship is animating on the mode select PuP
Dim nShipMoves ' count of times the ship has moved on the mode select PuP
Dim aanModeTime(3,20) ' Time left per player and mode
Dim aanModeShots(3,20) ' Count of mode shots made per player and mode
Dim aavShotsLit(3,20) ' BitSet per player and mode of shots lit
Dim avModesStarted(3) ' Array of bitsets per player of modes started
Dim avModesCompleted(3) ' Array of bitsets per player of modes completed
Dim aanModeAttempts(3,20) ' Count per player and mode of times the mode is attempted
Dim anModeScore(20) ' Count of points earned during the currect mode attempt
Dim avShotColors(9) ' Array of bitsets for which colors to blink per upper arrow
Dim anMarsShot(3) ' Leftmost shot lit in Mars mode
Dim asModeMessage ' Message to display for mode progress
Dim nTimeModeTextUpdate ' Timestamp of when the mode message was last changed
Dim nTimeModeTextDisplay' Timestamp of when the mode message was last changed on the display
Dim nTimeMarsMove ' Time in ms before shots move in Mars mode
Dim bMarsMoveLeft ' Boolean, true if shots in Mars mode move left
Dim anMoonShotWhite(3) ' Array per player of the white shot in moon mode
Dim anMoonShotGray(3) ' Array per player of the gray shot in moon mode
Dim anAmazoniaLastShot(3) ' Last shot hit in Amazonia mode
Dim anOsirisSpins(3) ' Array per player of top spinner spins in Omicron Persei mode
Dim anOsirisShotsAdded(3)' Array per player of number of shots added in Omicron Persei mode
Dim anOrisisVideos(3) ' Count per player of videos played in Omicron Persei mode
Dim anMiniWizard1JPs(9) ' Array of jackpot shots in Mini-wizard mode 1
Dim nMiniWizard1Videos ' Count of videos played in Mini-wizard mode 1
Dim anSlurmShots(9) ' Count of jackpots made per shot in Slurm
Dim anMysteryShotsMade(3)' Array per player of times the Light Mystery target has been hit
Dim bAddTimeAwarded ' Boolean, True if "add time" has been a mystery award this mode attempt
Dim bAddBallAwarded ' Boolean, True if "add a ball" has been a mystery award this multiball
Dim aanRecentMysteries(3,3)' Array per player of most recent mysteries, most recent first
Dim anPossibleAwards() ' Array of eligible mystery awards
Dim nPossibleAwardCount ' Count of eligible mystery awards
Dim nMysteryAnimStep ' Step of the mystery award display animation
Dim nLightShowPriority ' The priority of the light show currently playing
Dim nLightShowCurrent ' The number of the light show currently running, 0 = none
Dim nLightShowTime ' Time in ms remaining of the light show currently playing
Dim bLightShowBlinkOdd ' Boolean: If odd or even lights should be on when strobing all lights
Dim anFlashOrder ' Array of what flasher to fire during a light show
Dim nMaxFlashes ' Maximum number of flashers to fire during a light show
Dim nTiltWarnings ' Number of tilt warnings used this ball
Dim nTiltLevel ' How much has the game been nudged?
Dim bShowingInstantInfo ' Is the display currently showing instant info?
Dim nInstantInfoPage ' Count of which page instant info is currently showing
Dim nTimeInfoChange ' Timestamp of when instant info was last updated
Const cLastInfoPage = 25
'*******************************************
' ZDMD : FlexDMD
'*******************************************
'
' DMDTimer @17ms
' StartFlex with the intro @ Table1_Init
' Startgame ( KeyDown : PlungerKey ) calls the Game DMD to start if intro is on
' Make a copy of VPWExampleTableDMD folder, rename and paste into Visual Pinball\Tables\"InsertTableNameDMD"
' Update .ProjectFolder = ".\VPWExampleTableDMD\" to DMD folder name from previous step
' Update DMDTimer_Timer Sub to allow DMD to update remaining balls and credit: find ("Ball") and ("Credit")
' For another demo, see the following from the FlexDMD developer:
' https://github.com/vbousquet/flexdmd/tree/master/FlexDemo
Dim FlexDMD 'This is the FlexDMD object
Dim FlexFrame 'This is the current Frame count. It increments every time DMDTimer_Timer is run
Dim sDMDScene 'Name of the DMD scene intended to be playing
Dim sDMDCurrentScene 'Name of the DMD scene currently playing
Dim nDMDMode 'What mode is shown on the mode info screen
Dim sDMDModeName 'What mode name is shown on the mode info screen
Dim sDMDModeGoal 'What mode goal is shown on the mode info screen
Dim sDMDModeInfo 'What is shown for time and shots left on the mode info screen
Dim sDMDModeScore 'What is shown as the score on the mode info screen
Dim sDMDModeBlasts 'What is shown as the blast count the mode info screen
Const FlexDMD_RenderMode_DMD_GRAY = 0, _
FlexDMD_RenderMode_DMD_GRAY_4 = 1, _
FlexDMD_RenderMode_DMD_RGB = 2, _
FlexDMD_RenderMode_SEG_2x16Alpha = 3, _
FlexDMD_RenderMode_SEG_2x20Alpha = 4, _
FlexDMD_RenderMode_SEG_2x7Alpha_2x7Num = 5, _
FlexDMD_RenderMode_SEG_2x7Alpha_2x7Num_4x1Num = 6, _
FlexDMD_RenderMode_SEG_2x7Num_2x7Num_4x1Num = 7, _
FlexDMD_RenderMode_SEG_2x7Num_2x7Num_10x1Num = 8, _
FlexDMD_RenderMode_SEG_2x7Num_2x7Num_4x1Num_gen7 = 9, _
FlexDMD_RenderMode_SEG_2x7Num10_2x7Num10_4x1Num = 10, _
FlexDMD_RenderMode_SEG_2x6Num_2x6Num_4x1Num = 11, _
FlexDMD_RenderMode_SEG_2x6Num10_2x6Num10_4x1Num = 12, _
FlexDMD_RenderMode_SEG_4x7Num10 = 13, _
FlexDMD_RenderMode_SEG_6x4Num_4x1Num = 14, _
FlexDMD_RenderMode_SEG_2x7Num_4x1Num_1x16Alpha = 15, _
FlexDMD_RenderMode_SEG_1x16Alpha_1x16Num_1x7Num = 16
Const FlexDMD_Align_TopLeft = 0
Const FlexDMD_Align_Top = 1
Const FlexDMD_Align_TopRight = 2
Const FlexDMD_Align_Left = 3
Const FlexDMD_Align_Center = 4
Const FlexDMD_Align_Right = 5
Const FlexDMD_Align_BottomLeft = 6
Const FlexDMD_Align_Bottom = 7
Const FlexDMD_Align_BottomRight = 8
Const cColorGray66 = &ha9a9a9
Const cColorGray33 = &h555555
Dim oDMDFontTiny, oDMDFontSmall, oDMDFontSmallThin, oDMDFontThinScore
Dim oDMDFontMedium, oDMDFontBig, oDMDFontHuge, oDMDFontAttract, oDMDFontColossal
Dim oDMDFontTinyDark, oDMDFontSmallDark
Dim oDMDFontTinyFaded, oDMDFontScoreFaded, oDMDFontSmallFaded ' FlexDMD fonts
Dim oDMDScoreboard ' FlexDMD Scene object for the scoreboard
Dim oDMDModeName ' FlexDMD Label object for the mode name
Dim oDMDModeInfoSB ' FlexDMD Label object for the mode info on the scoreboard
Dim oDMDScoreP1 ' FlexDMD Label object for player 1 score
Dim oDMDScoreP2 ' FlexDMD Label object for player 2 score
Dim oDMDScoreP3 ' FlexDMD Label object for player 3 score
Dim oDMDScoreP4 ' FlexDMD Label object for player 4 score
Dim oDMDCredits ' FlexDMD Label object for credits text (will always say FREE PLAY)
Dim oDMDBlasts ' FlexDMD Label object for Number of hadron enforcers
Dim oDMDBallNr ' FlexDMD Label object for ball number
Dim oDMD1Line ' FlexDMD Scene object for showing 1 text line
Dim oDMD1LineText ' FlexDMD Label object for the text in a 1 line text scene
Dim oDMDAttract ' FlexDMD Scene object for attract mode
Dim oDMDAttractLine1 ' FlexDMD Scene object for line 1 of attract mode text
Dim oDMDAttractLine2 ' FlexDMD Scene object for line 2 of attract mode text
Dim oDMD2Line ' FlexDMD Scene object for showing 2 text lines
Dim oDMD2LineText1 ' FlexDMD Label object for the text in line 1 of a 2 line text scene
Dim oDMD2LineText2 ' FlexDMD Label object for the text in line 2 of a 2 line text scene
Dim oDMD3Line ' FlexDMD Scene object for showing 3 text lines
Dim oDMD3LineText1 ' FlexDMD Label object for the text in line 1 of a 3 line text scene
Dim oDMD3LineText2 ' FlexDMD Label object for the text in line 2 of a 3 line text scene
Dim oDMD3LineText3 ' FlexDMD Label object for the text in line 3 of a 3 line text scene
Dim oDMDModeInfo ' FlexDMD Scene object for showing mode info
Dim oDMDModeInfoName ' FlexDMD Label object for the name of a mode
Dim oDMDModeInfoGoal ' FlexDMD Label object for the goal of a mode
Dim oDMDModeInfoStatus ' FlexDMD Label object for the status of a mode
Dim oDMDModeInfoBlasts ' FlexDMD Label object for ball and player number when in a mode
Dim oDMDModeInfoScore ' FlexDMD Label object for current player's score when in a mode
Dim oDMDBooth ' FlexDMD scene for the suicide booth
Dim aoDMDBoothOptions(5) ' Array of FlexDMD Label objects for the suicide booth options
Dim oDMDBoothTimer ' FlexDMD Label object for the suicide booth timer
Dim oDMDBoothInfo ' FlexDMD Label object for the suicide booth instructions
Dim oDMDInstantInfo ' FlexDMD Scene object for showing instant info
Dim oDMDInstantInfoHeader ' FlexDMD Label object for the instant info header
Dim oDMDInstantInfoLine1 ' FlexDMD Label object for line 1 of instant info
Dim oDMDInstantInfoLine2 ' FlexDMD Label object for line 2 of instant info
Dim DMDTextOnScore
Dim nDMDTextDisplayTime ' Time in ms the current text has been displayed
Dim nTimePupStartPlay ' Timestamp of when the current video started playing. 0 = no video
Dim bDMD4PlayerScores ' true = show score, false = show ball number
Dim nDMD4PlayerTime ' Timestamp of changing between score and ball number
Dim DMDTextEffect
Sub Flex_Init
If UseFlexDMD = 0 Then Exit Sub
Set FlexDMD = CreateObject("FlexDMD.FlexDMD")
If FlexDMD is Nothing Then
MsgBox "No FlexDMD found. This table will NOT run without it."
Exit Sub
End If
With FlexDMD
.GameName = cGameName
.TableFile = Table1.Filename & ".vpx"
.Color = RGB(255, 88, 32)
.RenderMode = FlexDMD_RenderMode_DMD_GRAY_4
.Width = 128
.Height = 32
.ProjectFolder = "./Futurama.flexDMD/"
.Clear = True
.Run = True
End With
Set oDMDFontTiny = FlexDMD.NewFont("FlexDMD.Resources.teeny_tiny_pixls-5.fnt", vbWhite, vbWhite, 0)
Set oDMDFontSmall = FlexDMD.NewFont("FlexDMD.Resources.udmd-f4by5.fnt", vbWhite, vbWhite, 0)
Set oDMDFontSmallThin = FlexDMD.NewFont("4x8px.fnt", vbWhite, vbWhite, 0)
Set oDMDFontThinScore = FlexDMD.NewFont("5x10digits.fnt", vbWhite, vbWhite, 0)
Set oDMDFontMedium = FlexDMD.NewFont("FlexDMD.Resources.udmd-f5by7.fnt", vbWhite, vbWhite, 0)
Set oDMDFontBig = FlexDMD.NewFont("6x12bold.fnt", vbWhite, vbWhite, 0)
Set oDMDFontHuge = FlexDMD.NewFont("FlexDMD.Resources.udmd-f6by12.fnt", vbWhite, vbWhite, 0)
Set oDMDFontAttract = FlexDMD.NewFont("FlexDMD.Resources.udmd-f7by13.fnt", vbWhite, vbWhite, 0)
Set oDMDFontColossal = FlexDMD.NewFont("FlexDMD.Resources.udmd-f12by24.fnt", vbWhite, vbWhite, 0)
Set oDMDFontTinyFaded = FlexDMD.NewFont("4x8px.fnt", cColorGray66, cColorGray66, 0)
Set oDMDFontSmallFaded = FlexDMD.NewFont("FlexDMD.Resources.udmd-f4by5.fnt", cColorGray66, cColorGray66, 0)
Set oDMDFontScoreFaded = FlexDMD.NewFont("5x8digits.fnt", cColorGray66, cColorGray66, 0)
Set oDMDFontTinyDark = FlexDMD.NewFont("FlexDMD.Resources.teeny_tiny_pixls-5.fnt", cColorGray33, cColorGray33, 0)
Set oDMDFontSmallDark = FlexDMD.NewFont("FlexDMD.Resources.udmd-f4by5.fnt", cColorGray33, cColorGray33, 0)
CreateDMDScoreboard
CreateDMDScenes
End Sub
Sub CreateDMDScenes
FlexDMD.LockRenderThread
' One big line of Text
Set oDMD1Line = FlexDMD.NewGroup("oneline")
oDMD1Line.AddActor FlexDMD.NewImage("Back", "FlexDMD.Resources.dmds.black.png")
Set oDMD1LineText = FlexDMD.NewLabel("onelinetext", oDMDFontAttract, " ")
oDMD1LineText.SetAlignedPosition 64, 16, FlexDMD_Align_Center
oDMD1Line.AddActor oDMD1LineText
' Attract mode (Two lines, one big, and one bigger)
Set oDMDAttract = FlexDMD.NewGroup("attract")
oDMDAttract.AddActor FlexDMD.NewImage("Back", "FlexDMD.Resources.dmds.black.png")
Set oDMDAttractLine1 = FlexDMD.NewLabel("linea1", oDMDFontHuge, " ")
oDMDAttractLine1.SetAlignedPosition 64, 8, FlexDMD_Align_Center
oDMDAttract.AddActor oDMDAttractLine1
Set oDMDAttractLine2 = FlexDMD.NewLabel("linea2", oDMDFontAttract, " ")
oDMDAttractLine2.SetAlignedPosition 64, 24, FlexDMD_Align_Center
oDMDAttract.AddActor oDMDAttractLine2
' 2 text lines (one big header, smaller text on bottom)
Set oDMD2Line = FlexDMD.NewGroup("twoline")
oDMD2Line.AddActor FlexDMD.NewImage("Back", "FlexDMD.Resources.dmds.black.png")
Set oDMD2LineText1 = FlexDMD.NewLabel("line2a", oDMDFontBig, " ")
oDMD2LineText1.SetAlignedPosition 64, 8, FlexDMD_Align_Center
oDMD2Line.AddActor oDMD2LineText1
Set oDMD2LineText2 = FlexDMD.NewLabel("line2b", oDMDFontMedium, " ")
oDMD2LineText2.SetAlignedPosition 64, 24, FlexDMD_Align_Center
oDMD2Line.AddActor oDMD2LineText2
' 3 text lines (one big header, 2 lines of smaller text on bottom)
Set oDMD3Line = FlexDMD.NewGroup("threeline")
oDMD3Line.AddActor FlexDMD.NewImage("Back", "FlexDMD.Resources.dmds.black.png")
Set oDMD3LineText1 = FlexDMD.NewLabel("line3a", oDMDFontBig, " ")
oDMD3Line.AddActor oDMD3LineText1
Set oDMD3LineText2 = FlexDMD.NewLabel("line3b", oDMDFontMedium, " ")
oDMD3Line.AddActor oDMD3LineText2
Set oDMD3LineText3 = FlexDMD.NewLabel("line3c", oDMDFontMedium, " ")
oDMD3LineText1.SetAlignedPosition 64, 2, FlexDMD_Align_Top
oDMD3LineText2.SetAlignedPosition 64, 15, FlexDMD_Align_Top
oDMD3LineText3.SetAlignedPosition 64, 24, FlexDMD_Align_Top
oDMD3Line.AddActor oDMD3LineText3
' 4 text lines (one big header, 3 lines of smaller text on bottom)
Set oDMDModeInfo = FlexDMD.NewGroup("modeinfo")
oDMDModeInfo.AddActor FlexDMD.NewImage("Back", "FlexDMD.Resources.dmds.black.png")
Set oDMDModeInfoName = FlexDMD.NewLabel("modename", oDMDFontBig, " ")
oDMDModeInfo.AddActor oDMDModeInfoName
Set oDMDModeInfoGoal = FlexDMD.NewLabel("modegoal", oDMDFontSmall, " ")
oDMDModeInfo.AddActor oDMDModeInfoGoal
Set oDMDModeInfoStatus = FlexDMD.NewLabel("modestatus", oDMDFontMedium, " ")
oDMDModeInfo.AddActor oDMDModeInfoStatus
Set oDMDModeInfoScore = FlexDMD.NewLabel("modeplayer", oDMDFontSmall, " ")
oDMDModeInfo.AddActor oDMDModeInfoScore
Set oDMDModeInfoBlasts = FlexDMD.NewLabel("modescore", oDMDFontSmall, " ")
oDMDModeInfo.AddActor oDMDModeInfoBlasts
oDMDModeInfoName.SetAlignedPosition 64, 0, FlexDMD_Align_Top
oDMDModeInfoGoal.SetAlignedPosition 64, 12, FlexDMD_Align_Top
oDMDModeInfoStatus.SetAlignedPosition 64, 18, FlexDMD_Align_Top
oDMDModeInfoScore.SetAlignedPosition 0, 27, FlexDMD_Align_TopLeft
oDMDModeInfoBlasts.SetAlignedPosition 128, 27, FlexDMD_Align_TopRight
' Suicide booth wheel of misfortune
Set oDMDBooth = FlexDMD.NewGroup("booth")
oDMDBooth.AddActor FlexDMD.NewImage("Back", "FlexDMD.Resources.dmds.black.png")
Set aoDMDBoothOptions(0) = FlexDMD.NewLabel("opt1", oDMDFontSmallDark , "LOSE BALL")
oDMDBooth.AddActor aoDMDBoothOptions(0)
Set aoDMDBoothOptions(1) = FlexDMD.NewLabel("opt2", oDMDFontSmallDark, "HYPNOTOAD")
oDMDBooth.AddActor aoDMDBoothOptions(1)
Set aoDMDBoothOptions(2) = FlexDMD.NewLabel("opt3", oDMDFontSmallDark, "LOSE BALL")
oDMDBooth.AddActor aoDMDBoothOptions(2)
Set aoDMDBoothOptions(3) = FlexDMD.NewLabel("opt4", oDMDFontSmallDark, "0.5 X PLAYFIELD")
oDMDBooth.AddActor aoDMDBoothOptions(3)
Set aoDMDBoothOptions(4) = FlexDMD.NewLabel("opt5", oDMDFontSmallDark, "LOSE BALL")
oDMDBooth.AddActor aoDMDBoothOptions(4)
Set aoDMDBoothOptions(5) = FlexDMD.NewLabel("opt6", oDMDFontTinyDark, "REVERSE FLIP")
oDMDBooth.AddActor aoDMDBoothOptions(5)
Set oDMDBoothInfo = FlexDMD.NewLabel("instructions", oDMDFontSmallThin, "PRESS ACTION BUTTON TO CHOOSE")
oDMDBooth.AddActor oDMDBoothInfo
Set oDMDBoothTimer = FlexDMD.NewLabel("timer", oDMDfontColossal, "5")
oDMDBooth.AddActor oDMDBoothTimer
aoDMDBoothOptions(0).SetAlignedPosition 70, 8, FlexDMD_Align_Top
aoDMDBoothOptions(1).SetAlignedPosition 74, 14, FlexDMD_Align_TopLeft
aoDMDBoothOptions(2).SetAlignedPosition 74, 20, FlexDMD_Align_TopLeft
aoDMDBoothOptions(3).SetAlignedPosition 70, 26, FlexDMD_Align_Top
aoDMDBoothOptions(4).SetAlignedPosition 66, 20, FlexDMD_Align_TopRight
aoDMDBoothOptions(5).SetAlignedPosition 66, 14, FlexDMD_Align_TopRight
oDMDBoothInfo.SetAlignedPosition 64, 0, FlexDMD_Align_Top
oDMDBoothTimer.SetAlignedPosition 0, 8, FlexDMD_Align_TopLeft
' Instant info
Set oDMDInstantInfo = FlexDMD.NewGroup("instantinfo")
oDMDInstantInfo.AddActor FlexDMD.NewImage("Back", "FlexDMD.Resources.dmds.black.png")
Set oDMDInstantInfoHeader = FlexDMD.NewLabel("infohead", oDMDFontMedium , "INSTANT INFO")
oDMDInstantInfo.AddActor oDMDInstantInfoHeader
Set oDMDInstantInfoLine1 = FlexDMD.NewLabel("infoline1", oDMDFontBig , "")
oDMDInstantInfo.AddActor oDMDInstantInfoLine1
Set oDMDInstantInfoLine2 = FlexDMD.NewLabel("infoline2", oDMDFontBig , "")
oDMDInstantInfo.AddActor oDMDInstantInfoLine2
oDMDInstantInfoHeader.SetAlignedPosition 64, 0, FlexDMD_Align_Top
oDMDInstantInfoLine1.SetAlignedPosition 64, 8, FlexDMD_Align_Top
oDMDInstantInfoLine2.SetAlignedPosition 64, 20, FlexDMD_Align_Top
FlexDMD.UnlockRenderThread
End Sub
Dim nScoreLastFrame, bScoreUpdatedThisFrame ' The score last frame (only change font once when score >= 1B)
Dim aoDMDScores
Sub CreateDMDScoreboard
If UseFlexDMD = 0 Then Exit Sub
Set oDMDScoreboard = FlexDMD.NewGroup("scoreboard")
With oDMDScoreboard
.AddActor FlexDMD.NewImage("bg","FlexDMD.Resources.dmds.black.png")
.Getimage("bg").visible = True ' False
End With
Set oDMDModeName = FlexDMD.NewLabel("scoremode", oDMDFontTiny, " ")
oDMDModeName.SetAlignedPosition 0, 21, FlexDMD_Align_TopLeft
Set oDMDModeInfoSB = FlexDMD.NewLabel("scoretime", oDMDFontTiny, " ")
oDMDModeInfoSB.SetAlignedPosition 128, 21, FlexDMD_Align_TopRight
Set oDMDScoreP1 = FlexDMD.NewLabel("scorep1", oDMDFontBig, " ")
oDMDScoreP1.SetAlignedPosition 0, 0, FlexDMD_Align_TopLeft
Set oDMDScoreP2 = FlexDMD.NewLabel("scorep2", oDMDFontSmall, " ")
oDMDScoreP2.SetAlignedPosition 128, 0, FlexDMD_Align_TopRight
Set oDMDScoreP3 = FlexDMD.NewLabel("scorep3", oDMDFontSmall, " ")
oDMDScoreP3.SetAlignedPosition 0, 13, FlexDMD_Align_TopLeft
Set oDMDScoreP4 = FlexDMD.NewLabel("scorep4", oDMDFontSmall, " ")
oDMDScoreP4.SetAlignedPosition 128, 6, FlexDMD_Align_TopRight
Set oDMDCredits = FlexDMD.NewLabel("credits", oDMDFontSmallFaded, "FREE PLAY")
oDMDCredits.SetAlignedPosition 128, 27, FlexDMD_Align_TopRight
Set oDMDBlasts = FlexDMD.NewLabel("blasts", oDMDFontTiny, " ")
oDMDBlasts.SetAlignedPosition 58, 27, FlexDMD_Align_Top
Set oDMDBallNr = FlexDMD.NewLabel("ballnr", oDMDFontSmall, "GAME OVER")
oDMDBallNr.SetAlignedPosition 0, 27, FlexDMD_Align_TopLeft
FlexDMD.LockRenderThread
With oDMDScoreboard
.AddActor oDMDScoreP1
.AddActor oDMDScoreP2
.AddActor oDMDScoreP3
.AddActor oDMDScoreP4
.AddActor oDMDCredits
.AddActor oDMDBallNr
.AddActor oDMDBlasts
.AddActor oDMDModeName
.AddActor oDMDModeInfoSB
End With
aoDMDScores = Array(oDMDScoreP1, oDMDScoreP2, oDMDScoreP3, oDMDScoreP4)
FlexDMD.UnlockRenderThread
End Sub
Sub DMDUpdateModeInfo
Dim sNewName, sNewGoal, nTimeDisplayed, nShots, sNewInfo, sNewScore, sNewBlasts, i
Dim nSuperValue, nShotsComplete, bTimedModeRunning