-
Notifications
You must be signed in to change notification settings - Fork 1
/
dk_config.py
851 lines (750 loc) · 33.7 KB
/
dk_config.py
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
"""
ooooooooo oooo oooo o ooooooooooo ooooooooooo
888 88o 888 o88 888 888 888
888 888 888888 8 88 888ooo8 888ooo8
888 888 888 88o 8oooo88 888 888
o888ooo88 o888o o888o o88o o888o o888o o888ooo8888
by Jon Wilson (10yard)
Configuration options
---------------------
"""
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import sys
import pygame
import pygame_menu as pymenu
from glob import glob
# Determine system
def get_system(return_video=False):
if "uname" in dir(os) and os.uname().machine.startswith("arm"):
return ("pi", "accel")[int(return_video)]
else:
windows_version = sys.getwindowsversion()
if windows_version[0] > 5:
return ("win", "opengl")[int(return_video)]
else:
return ("win (old)", "gdi")[int(return_video)]
def is_pi():
return get_system() == "pi"
pygame.init()
# Graphic Config
TITLE = 'DKAFE'
DISPLAY = (224, 256) # Internal x, y resolution of game graphics
TOPLEFT = (0, 0) # Position of top left corner
ROTATION = 0 # Frontend rotation (0, 90, 180, 270). Rotates the primary display only.
CLOCK_RATE = 45 # Clock rate
SPEED_ADJUST = 0 # Adjustment to above clock rate (e.g. 0=45, 1=50, +2=55, +3=60, +4=65, +5=70, +6=75)
# Default Keyboard Controls - they match MAME
CONTROL_LEFT = pygame.K_LEFT
CONTROL_RIGHT = pygame.K_RIGHT
CONTROL_UP = pygame.K_UP
CONTROL_DOWN = pygame.K_DOWN
CONTROL_JUMP = pygame.K_LCTRL
CONTROL_ACTION = pygame.K_LALT
CONTROL_P1 = pygame.K_1
CONTROL_P2 = pygame.K_2
CONTROL_COIN = pygame.K_5
CONTROL_EXIT = pygame.K_ESCAPE
CONTROL_TAB = pygame.K_TAB
CONTROL_SNAP = pygame.K_F12
CONTROL_PLAYLIST = pygame.K_p
CONTROL_SKIP = pygame.K_s
CONTROL_PAGEUP = pygame.K_PAGEUP
CONTROL_PAGEDOWN = pygame.K_PAGEDOWN
# Joystick Options and Button Assignments
USE_JOYSTICK = 0
# Note: DPAD and first analog axis are automatically mapped to directions
# Device 1 buttons start from 0, Device 2 buttons start from 20
BUTTON_JUMP = 0
BUTTON_ACTION = 1
BUTTON_P1 = 9
BUTTON_P2 = 29
BUTTON_EXIT = 3
BUTTON_COIN = 7
# Options
CONFIRM_EXIT = 1
FULLSCREEN = 1
FREE_PLAY = 1 # Jumpman does not have to pay to play
UNLOCK_MODE = 1 # Arcade machines are unlocked as Jumpman's score increases
SKILL_LEVEL = 1 # How difficult are the target scores. 1 (Beginner) to 10 (Expert).
START_STAGE = 0 # Stage to start the frontend on. 0 (Barrels), 1 (Rivets), 2 (Pies)
ENABLE_MENU = 1 # Allow selection from the quick access game list
ENABLE_ADDONS = 1 # Enable add-on packs. Set to 0 to disable previously installed add-ons.
INACTIVE_TIME = 20 # Screensaver with game instructions after period in seconds of inactivity. Integer
SHOW_SPLASHSCREEN = 1 # Show the DKAFE splash screen and animation on startup
SHOW_GAMETEXT = 1 # Show the game text description when Jumpman faces an arcade machine
ENABLE_HAMMERS = 1 # Show hammers and enable teleport between hammers in the frontend
ENABLE_SHUTDOWN = 0 # Allow system shutdown from menu
ENABLE_PLAYLIST = 1 # Play background music from playlist folder
PLAYLIST_VOLUME = 5 # Volume of playlist music from 0 to 10
# DKWolf/Interface options
HIGH_SCORE_SAVE = 1 # Retain high scores (they are specific to each hack)
CREDITS = 1 # Automatically set credits in MAME at start of game - when using interface
AUTOSTART = 1 # Automatically start the game in MAME (by simulating P1 start) when using interface
ALLOW_SKIP_INTRO = 1 # Allow the DK climb scene to be quickly skipped in game by pressing Jump button
SHOW_AWARD_PROGRESS = 1 # Show award progress when playing game (appears top of screen replacing high score)
SHOW_AWARD_TARGETS = 1 # Show award targets when playing game (appears during the DK intro/climb scene)
SHOW_HUD = 1 # Show in game HUD by default (in top right corner) and use P2 to toggle data
REFOCUS_WINDOW = 0 # Attempt to refocus DKAFE window after exiting LUA interface (Windows Only)
# Basic mode switch overrides some settings
BASIC_MODE = 0 # Equivalent to FREE_PLAY = 1, UNLOCK_MODE = 0 and all interface options disabled
# Additional options
AWARDS = 500, 1500, 2500 # Coins awarded for reaching score target for 3rd, 2nd, 1st when competing
PLAY_COST = 100 # How much it costs to play an arcade machine
LIFE_COST = 150 # How many coins Jumpman drops when time runs out
SCORE_START = 500 # How many coins Jumpman starts with
TIMER_START = 8000 # Timer starts countdown from this number
COIN_VALUES = 0, 50, 100 # How many points awarded for collecting a coin. Integer
COIN_FREQUENCY = 2 # How frequently DK will grab a coin (1 = always, 2 = 1/2, 3 = 1/3 etc.)
COIN_HIGH = 4 # Frequency of coin being higher value (1 = always, 2 = 1/2, 3 = 1/3 etc.)
COIN_SPEED = 1.6 # Number of pixels to move coin per display update. Decimal
COIN_CYCLE = 0.15 # How often the coin sprite is updated. Decimal
INP_FAVOURITE = 10 # Flag .inp recordings of this duration or greater (in minutes) by prefixing with ♥
# Root directory of frontend
ROOT_DIR = os.getcwd()
# Emulator and rom path defaults
ROM_DIR = '<ROOT>/roms'
OPTIONS = '-rompath "<ROM_DIR>" -view "Pixel Aspect (7:8)"'
EMU_1 = '<ROOT>/dkwolf/dkwolf <OPTIONS>'
EMU_2 = '<ROOT>/dkwolf/dkwolf <OPTIONS> -nvram_directory NUL -record <RECORD_ID>'
EMU_3, EMU_4, EMU_5, EMU_6, EMU_7, EMU_8 = (None,) * 6
# External command to issue when emulator starts up
EMU_ENTER = ""
# External command to issue after exiting emulator e.g. return focus to frontend
EMU_EXIT = ""
# Allow roms in ROM_DIR to be overwritten. Set to 1 when using an emulator that doesn't support -rompath argument.
ALLOW_ROM_OVERWRITE = 0
# Patch directory (for provided patch files)
PATCH_DIR = os.path.join(ROOT_DIR, "patch")
# Above defaults can be overridden in the settings.txt file
if os.path.exists("settings.txt"):
with open("settings.txt") as sf:
for setting in sf.readlines():
if setting.count("=") == 1 and not setting.startswith("#"):
key, value = setting.split("=")
key = key.strip()
value = value.strip()
try:
if key.startswith("CONTROL_"):
globals()[key] = pygame.key.key_code(value)
elif value.isnumeric():
globals()[key] = int(value)
elif value.lower() == "true":
globals()[key] = 1
elif value.lower() == "false":
globals()[key] = 0
else:
globals()[key] = value.replace("<ROOT>", ROOT_DIR).replace("<OPTIONS>", OPTIONS)
except KeyError:
print(f'Unknown setting "{key.strip()}" in settings.txt file')
pygame.quit()
exit()
# Override settings when debugging
if sys.gettrace():
globals()["FULLSCREEN"] = 0
globals()["TITLE"] = "DKAFE (Debugging Mode)"
globals()["FREE_PLAY"] = 1
# Frontend version
VERSION = ''
if os.path.exists("VERSION"):
with open("VERSION") as vf:
VERSION = vf.readline().strip()
# Target system architecture
ARCH = 'win64' # default
if os.path.exists("ARCH"):
with open("ARCH") as af:
ARCH = af.readline().strip()
elif is_pi():
ARCH = "pi"
# Validate some settings
ADDONS_CONSIDERED = ENABLE_ADDONS
if not os.path.exists("romlist_addon.csv") and not glob("dkafe_*_addon_*.zip"):
globals()["ENABLE_ADDONS"] = 0
if ENABLE_ADDONS:
STAGES = 5 if ARCH == "win64" else 4
else:
STAGES = 3
if PLAYLIST_VOLUME > 10: globals()["PLAYLIST_VOLUME"] = 10
if PLAYLIST_VOLUME < 0: globals()["PLAYLIST_VOLUME"] = 0
if SPEED_ADJUST > 8: globals()["SPEED_ADJUST"] = 8
if SPEED_ADJUST < 0: globals()["SPEED_ADJUST"] = 0
if START_STAGE > STAGES: START_STAGE = 0
# Expected location of original DK zips (not provided with software)
DKONG_ZIP = os.path.join(ROM_DIR, "dkong.zip")
DKONGJR_ZIP = os.path.join(ROM_DIR, "dkongjr.zip")
DKONG3_ZIP = os.path.join(ROM_DIR, "dkong3.zip")
# Optional rom names
OPTIONAL_NAMES = "dkong", "dkongjr", "dkong3"
if ARCH != "winxp":
OPTIONAL_NAMES += "logger", "congo"
# Plugins add functionality to certain roms
PLUGINS = (
("dkonglava", "dklavapanic"),
("dkonglava1", "dklavapanic"),
("dkonglava1", "dkstart5:1"),
("dkonglava2", "dklavapanic"),
("dkonglava2", "dkstart5:2"),
("dkonglava3", "dklavapanic"),
("dkonglava3", "dkstart5:3"),
("dkonglava4", "dklavapanic"),
("dkonglava4", "dkstart5:4"),
("dkonggalakong", "galakong"),
("dkonggalakong1", "galakong"),
("dkonggalakong1", "dkstart5:1"),
("dkonggalakong2", "galakong"),
("dkonggalakong2", "dkstart5:2"),
("dkonggalakong3", "galakong"),
("dkonggalakong3", "dkstart5:3"),
("dkonggalakong4", "galakong"),
("dkonggalakong4", "dkstart5:4"),
("dkongxgalakong", "galakong"),
("dkongjrgala", "galakong"),
("dkongwho", "dkwho"),
("dkongwho1", "dkwho"),
("dkongwho1", "dkstart5:1"),
("dkongwho2", "dkwho"),
("dkongwho2", "dkstart5:2"),
("dkongwho3", "dkwho"),
("dkongwho3", "dkstart5:3"),
("dkongwho4", "dkwho"),
("dkongwho4", "dkstart5:4"),
("dkongend1", "dkend:1"),
("dkongend2", "dkend:2"),
("dkongend3", "dkend:3"),
("dkongend4", "dkend:4"),
("dkongkonkey", "konkeydong"),
("dkong2600", "gingerbreadkong"),
("dkongvector", "vectorkong"),
("dkongallen", "allenkong"),
("dkongchorus", "dkchorus"),
("dkongcontinue", "continue"),
("dkongjrcontinue", "continue"),
("ckongpt2_continue", "continue"),
("dkongl22", "dklevel22"),
("ckongpt2_l22", "dklevel22")
)
# Above plugin is launched with parameters and can compete (unlike a menu launch plugin).
PARAMETER_PLUGINS = "dkongend1", "dkongend3", "dkonglava1", "dkonglava2", "dkonglava3", "dkonglava4"
# Roms that are compatible with my plugins
COACH_FRIENDLY = ("dkongspringy", "dkongbarrels", "dkongcb", "dkonghrd", "dkong")
COACH_L5_FRIENDLY = ("dkongspringy", "dkongbarrels")
CHORUS_FRIENDLY = ("dkong", "dkongspringy", "dkongbarrels", "dkongcb", "dkonghrd", "dkongrivets", "dkongrnd",
"dkongwbh", "dkongpies", "dkongjapan", "dkongpauline", "dkongfr", "dkongl05", "dkongce", "dkongrev",
"dkong2nut", "dkongoctomonkey", "dkonghalf", "dkongquarter", "dkongksfix")
CONTINUE_FRIENDLY = ("dkong", "dkongjr", "dkongd2k", "dkongjapan", "dkongpauline", "ckong", "ckongpt2", "ckongpt2b",
"ckongpt2_117", "dkongspooky", "dkongxmas", "dkongrdemo", "dkongrev", "dkongcb", "dkong40",
"dkongitd", "dkong2600", "dkongtj", "dkongfoundry", "dkongotr", "dkonghrthnt", "dkongkana",
"dkongnoluck", "dkongwbh", "dkongjapan", "dkongpac", "dkonghrd", "dkongrainbow", "dkongksfix",
"dkongl05", "dkongbarrels", "dkongspringy", "dkongpies", "dkongrivets", "ckongs", "dkongwizardry",
"dkongoctomonkey", "dkongaccelerate", "dkonghalf", "dkongquarter", "dkongwho", "dkonglava",
"dkong2600", "dkongchorus", "dkonggalakong", "dkongjrgala", "dkongxgalakong", "dkongpacmancross",
"ckongpt2a_2023", "ckongpt2_dk")
SHOOT_FRIENDLY = ("dkongspringy", "dkongbarrels", "dkongpies", "dkongrivets", "dkongpacmancross")
START5_FRIENDLY = ("dkong", "dkongjr", "dkongpies", "dkonggalakong", "dkongspooky", "dkongwizardry", "dkong40",
"dkongspringy", "dkonglava", "dkongwho", "ckongpt2", "dkongitd", "dkongxmas", "dkongvector",
"dkongjrgala", "dkong2600", "dkongtj", "dkongfr", "dkongrivets", "dkongfoundry", "dkongotr",
"dkonghrthnt", "bigkong", "dkongd2k", "dkongrev", "dkongrdemo", "dkongcb", "dkongkana",
"dkongrndmzr", "dkongnoluck", "dkongwbh", "dkongpauline", "dkongjapan", "dkongpac", "dkongbarrels",
"dkonghrd", "ckong", "ckongpt2b", "dkongchorus", "dkongkonkey", "dkongrainbow", "dkongcontinue",
"dkongjrcontinue", "ckongs", "ckongg", "ckongmc", "dkongksfix", "dkongbcc", "dkongbarrelboss",
"dkongsprfin", "bigkonggx", "ckongdks", "ckongpt2_117", "ckongpt2b", "dkongpacmancross",
"ckongpt2a_2023", "ckongpt2_dk")
STAGE_FRIENDLY = ("dkong", "dkongjr", "dkonggalakong", "dkongwizardry", "dkong40", "dkonglava", "dkongwho", "dkongfr",
"dkongaccelerate", "ckongpt2", "dkongitd", "dkongjrgala", "dkong2600", "dkongtj", "dkongfoundry",
"dkongotr", "dkonghrthnt", "dkongxgalakong", "bigkong", "dkongd2k", "dkongrev", "dkongkana",
"dkongrndmzr", "dkongnoluck", "dkongwbh", "dkongpauline", "dkongjapan", "dkongpac", "dkonghrd",
"ckong", "ckongpt2b", "dkong2600", "dkongchorus", "dkongkonkey", "dkongrainbow", "ckongs", "ckongg",
"ckongmc", "dkongksfix", "bigkonggx", "ckongdks", "ckongpt2_117", "dkongpacmancross",
"ckongpt2a_2023", "ckongpt2_dk")
# Roms that are not fully compatible
HUD_UNFRIENDLY = ["dkongduel", "dkongkonkey"]
HISCORE_UNFRIENDLY = ["dkongd2k"]
AUTOSTART_UNFRIENDLY = ["dkongduel", "dkongchorus"]
SKIPINTRO_UNFRIENDLY = ["dkongchorus"]
ADDITIONAL_CREDIT = ["dkongduel"]
# Colours
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (232, 7, 10)
PINK = (255, 210, 190)
MAGENTA = (236, 49, 148)
CYAN = (20, 243, 255)
BLUE = (4, 3, 255)
DARKBLUE = (4, 2, 220)
MIDBLUE = (4, 3, 255)
YELLOW = (244, 186, 21)
BROWN = (172, 5, 7)
LIGHTBROWN = (238, 117, 17)
GREY = (128, 128, 128)
MIDGREY = (104, 104, 104)
DARKGREY = (40, 40, 40)
BRIGHTRED = (238, 75, 43)
# Alpha channel value for faded/locked arcade machines
FADE_LEVEL = 75
# Sequential list of arcade machine slot locations (x, y) starting with location 1.
SLOTS = (
(2, 226), (34, 226), (50, 226), (94, 226), (114, 225), (130, 224), (146, 223), (162, 222), (210, 219),
(194, 198), (146, 195), (130, 194), (114, 193), (82, 191), (66, 190), (50, 189), (2, 186),
(18, 165), (50, 163), (82, 161), (130, 158), (146, 157), (162, 156), (210, 153),
(194, 132), (146, 129), (130, 128), (98, 126), (82, 125), (50, 123), (18, 121), (2, 120),
(50, 97), (98, 94), (114, 93), (130, 92), (146, 91), (162, 90), (210, 87),
(194, 66), (162, 64), (146, 63), (114, 62), (90, 62), (2, 62),
(90, 34),
(18, 226), (34, 226), (50, 226), (90, 226), (114, 226), (130, 226), (146, 226), (162, 226), (178, 226), (194, 226),
(26, 186), (42, 186), (58, 186), (82, 186), (114, 186), (130, 186), (154, 186), (170, 186), (186, 186),
(34, 146), (50, 146), (82, 146), (114, 146), (130, 146), (154, 146),
(42, 106), (74, 106), (90, 106), (122, 106), (138, 106), (170, 106),
(42, 66), (82, 66), (170, 66),
(106, 26),
(2, 226), (34, 226), (50,226), (90, 226), (106, 226), (122, 226), (146, 226), (162, 226), (178, 226), (209, 226),
(8, 186), (34, 186), (50, 186), (90, 186), (122, 186), (154, 186), (174, 186), (202, 186),
(2, 146), (34, 146), (50, 146), (90, 146), (106, 146), (122, 146), (154, 146), (174, 146), (202, 146),
(33, 106), (52, 106), (67, 106), (90, 106), (122,106), (154, 106), (174, 106), (210, 106),
(2, 66), (90, 66), (106, 66), (138, 66), (154, 66), (170, 66), (186, 66), (208, 66),
(90, 34),
(2, 226), (18, 226), (50, 226), (116, 226), (134, 226), (152, 226), (178, 226), (194, 226),
(18, 195), (34, 191), (50, 195), (66, 195), (98, 191), (116, 195), (134, 195), (152, 195), (178, 195), (194, 195),
(34, 162), (50, 166), (98, 162), (134, 166), (152, 166), (178, 166), (194, 166),
(130, 136), (149, 136), (164, 136), (194, 136), (210, 136),
(34, 102), (50, 106), (98, 102), (116, 106), (132, 106), (148, 106), (194, 106),
(194, 76),
(154, 66), (138, 66), (110, 66), (90, 66), (2, 66),
(90, 34),
(2, 226), (34, 226), (50, 226), (94, 226), (114, 225), (130, 224), (146, 223), (162, 222), (194, 220), (210, 219),
(146, 195), (130, 194), (114, 193), (82, 191), (66, 190), (50, 189), (20, 187), (1, 186),
(50, 163), (82, 161), (130, 158), (146, 157), (162, 156), (194, 154), (210, 153),
(146, 129), (130, 128), (98, 126), (82, 125), (50, 123), (20, 121), (1, 120),
(50, 97), (98, 94), (114, 93), (130, 92), (146, 91), (162, 90), (194, 88), (210, 87),
(162, 64), (146, 63), (114, 62), (90, 62), (2, 62),
(98, 34)
)
# Range of slots that appear on each stage
SLOTS_PER_STAGE = (0, 46), (46, 81), (81, 125), (125, 169), (169, 215)
# Control assignments. Links global variables to event data. These shouldn't be changed.
CONTROL_ASSIGNMENTS = (
("left", CONTROL_LEFT),
("right", CONTROL_RIGHT),
("up", CONTROL_UP),
("down", CONTROL_DOWN),
("jump", CONTROL_JUMP),
("start", CONTROL_P1))
# Text description of prize placing
PRIZE_PLACINGS = {1: "1ST", 2: "2ND", 3: "3RD"}
# Sounds that are played during walk sequence. Not all steps will trigger a sound.
WALK_SOUNDS = {1: "walk0.wav", 5: "walk1.wav", 9: "walk2.wav"}
# Defines scene numbers in the intro when sounds should be played
SCENE_SOUNDS = {
160: "climb.wav",
481: "stomp.wav",
712: "roar.wav",
856: "howhigh.wav"}
# Defines when icons should be displayed on the climb intro. The entries relate to the various platforms.
# data is: appear from scene, appear to scene, below y, above y, smash animation to scene
SCENE_ICONS = (
(481, 856, 68, 40, 502),
(544, 856, 101, 68, 565),
(580, 856, 134, 101, 601),
(613, 856, 167, 134, 634),
(646, 856, 200, 167, 667),
(679, 856, 999, 200, 700),
(700, 856, 999, 0, 0))
# Ladder zone detection. The R read from screen map determines were jumpman is relative to a ladder
LADDER_ZONES = (
("LADDER_DETECTED", (20, 30, 60, 90, 240)),
("END_OF_LADDER", (60, 90)),
("TOP_OF_LADDER", (60,)),
("NEARING_END_OF_LADDER", (30,)),
("APPROACHING_END_OF_LADDER", (240,)),
("CLIMBING_LADDER", (20,)),
("BROKEN_LADDER", (160, 170, 180)),
("TOP_OF_BROKEN_LADDER", (170, 180)),
("TOP_OF_VIRTUAL_LADDER", (180,)),
("VIRTUAL_LADDER", (180, 190)),
("APPROACHING_LADDER", (200,)),
("ANY_LADDER", (20, 30, 60, 90, 160, 170, 180, 190, 240)),
("TOP_OF_ANY_LADDER", (60, 170, 180)))
# Jumpman's x position when centre of ladder
LADDER_CENTRES = (4, 12, 20, 28, 36, 60, 68, 76, 84, 92, 100, 108, 116, 124, 132, 140, 148, 164, 180, 188, 196, 204)
# Stage specific positions, colours etc
BONUS_COLORS = (CYAN, MAGENTA), (YELLOW, MIDBLUE), (WHITE, LIGHTBROWN), (CYAN, MAGENTA), (WHITE, WHITE)
HAMMER_POSXY = ((16, 98), (167, 190)), ((8, 140), (104, 100)), ((12, 140), (104, 178)), ((3, 159), (206, 70)), ((32, 96), (167, 190))
TELEPORT_TO_POSXY = ((164, 193), (20, 92)), ((101, 98), (11, 138)), ((104, 180), (16, 140)), ((206, 72), (3, 161)), ((164, 193), (32, 92))
OILCAN_POSXY = (16, 232), (172, 152), (104, 128), (68, 112), (16, 232)
WARP_ARROW_POSXY = (20, 246), (176, 166), (108, 142), (72, 126), (20, 246)
PAULINE_POSXY = (0, 0), (16, -8), (0, 0), (0, 0), (8, 0)
KONG_POSXY = (0, 0), (80, 4), (0, 4), (0, 4), (0, 0)
COIN_GRAB_POSXY = (67, 73), (147, 77), (67, 77), (67, 77), (67, 73)
COIN_AWARD_POSX = 0, 112, 28, 0, 0
LADDER_CHANCE = 3, 2, 3, 3,3 # Chance of coin rolling down a ladder (1 = always, 2 = 1/2, 3 = 1/3 etc.) by stage
# Pies specific. Location of the 2 moving ladder sections
MOVING_LADDER_POSXY = (15, 96), (199, 96)
MOVING_LADDER_OFFSETS = list((0,)*48) + list(range(1,16)) + list((16,)*8) + list(range(15,0,-1))
# Sprite helpers
SPRITE_FULL = 15
SPRITE_HALF = 8
JUMP_PIXELS = [-1, ] * 15 + [1, ] * 13
JUMP_SHORTEN = 1.25
# In game messages and instructions
QUESTION = "WHAT GAME WILL YOU PLAY ?"
COIN_INFO = ["Hey Jumpman!", '', "You must collect coins..", "to unlock more games", "", "Push COIN for game info", ""]
FREE_INFO = ["Hey Jumpman!", '', "All arcades are free to play", "", "Push COIN to for game info", ""]
TEXT_INFO = ["", "Push 'JUMP' to play or 'P1 START' for game options"]
NO_ROMS_MESSAGE = [
"NO ROMS WERE FOUND!", "",
"FOR THE DEFAULT FRONTEND",
"PUT DKONG.ZIP INTO THE",
"DKAFE\\ROMS DIRECTORY",
"THEN RESTART.", "",
"DKONG.ZIP IS REQUIRED",
"DKONGJR.ZIP IS OPTIONAL",
"DKONG3.ZIP IS OPTIONAL"]
# Expected content of the original DK rom
ROM_CONTENTS = ["c_5at_g.bin", "c_5bt_g.bin", "c_5ct_g.bin", "c_5et_g.bin", "c-2j.bpr", "c-2k.bpr", "l_4m_b.bin",
"l_4n_b.bin", "l_4r_b.bin", "l_4s_b.bin", "s_3i_b.bin", "s_3j_b.bin", "v_3pt.bin", "v_5h_b.bin",
"v-5e.bpr"]
# MD5 checksum of expected DK base rom and various fixes/patches to align the provided rom with the expected rom.
DKONG_MD5 = "a13e81d6ef342d763dc897fe03893392"
FIX_MD5 = ("f116efa820a7cedd64bcc66513be389d", "d57b26931fc953933ee2458a9552541e", "aa282b72ac409793b36780c99b26d07b",
"e883b4225a76a79f38cf1db7c340aa8e", "eb6571036ff25e8e5db5289f5524ab76", "5897e79286e19c91eb3eca657a8c574c",
"480d0f113e8c7069b50ba807cf4b2a24", "394a7d367c9926c1d151dd87814c77f4")
INVALID_ROM_MESSAGE = [
"ERROR WITH DONKEY KONG ROM", "",
"Your DKONG.ZIP file is not",
"valid. Please replace it.", "",
"The zip should contain only",
"the following files:", ""]
INSTRUCTION = """
Donkey Kong has captured
Pauline and carried her to
the top of an abandoned
construction site.
The shock of shaking up the
building during his ascent
has uncovered many hidden
arcade machines from the
1980's era and they are
scattered around the site.
The coins thrown by Donkey
Kong must be collected by
Jumpman so he has money to
play the arcades.
Jumpman must play well to
win prizes and unlock arcade
machines as he works his way
through all the challenging
stages and rescues Pauline
from the top of the building.
Pauline will ♥ it when you
beat all of the machines.
"""
MORE_INSTRUCTION = """
If you are not up for the
challenge then it is
possible to adjust things
and have all machines
unlocked and set to free
play.
Helpful hints:
• Pauline shouts out game
information, score targets
and unlock requirements as
you walk towards a machine.
• Navigate between stages by
climbing an exit ladder or
by warping down an oilcan.
• Use hammers to teleport
over short distances.
• Use practice modes to get
better at each stage.
Can you reach the infamous
killscreen at level 22-1?
Good luck!
"""
CONTROLS = """
The Controls are as follows:
Left/ — Move Jumpman along
Right the platforms
Up/ - Move Jumpman up and
Down down ladders.
Up faces a machine.
Jump - Launch machine that
Jumpman is facing.
P1 - Show launch options
for a machine that
Jumpman is facing
P2 - Call up a quick
access game list
Coin - Show game info
above machines
Action - Show slot numbers
Exit - Exit DKAFE
"""
THANKS_TO = """
Thanks to these folks!
Donkey Kong rom hacks:
Paul Goes
Sockmaster
Jeff Kulczycki,
Mike Mika & Clay Cowgill
Don Hodges
Tim Appleton
Vic20 George
Kirai Shouen & 125scratch
Donkey Kong hack resource:
furrykef
Feedback and feature ideas:
Superjustinbros
Playlist music:
LeviR.star's Music
Nintega Dario
MyNameIsBanks
SanHolo
MotionRide Music
Buckner & Garcia
Sascha Zeidler
Mitchel Gatzke
Chiptunema
"""
# Console Addon Specific
if ARCH == "win64":
ADDON_URL = "https://www.dropbox.com/scl/fi/yqcwe91z5oe9sppvi7igm/dkafe_console_addon_pack_v5.zip?rlkey=n21o3w3tcrmnm6mi55yjvppk2&dl=0"
else:
ADDON_URL = "https://www.dropbox.com/scl/fi/48ac45t2yq30rrk0k65yz/dkafe_console_addon_pack_v5_reduced.zip?rlkey=vdnu6jlevctwueu17x5kbmnrh&dl=0"
if ENABLE_ADDONS:
VERSION += "+"
ROMLIST_FILES = ["romlist.csv", "romlist_addon.csv" if ENABLE_ADDONS else ""]
RECOGNISED_SYSTEMS = {
"a2600": "Atari 2600",
"a5200": "Atari 5200",
"a7800": "Atari 7800",
"a800xl": "Atari 8 Bit Computer (A800)",
"atarist": "Atari ST",
"adam": "Coleco Adam",
"amiga": "Commodore Amiga",
"apple2e": "Apple ][",
"arduboy": "Arduino Arduboy Handheld",
"atom":"Acorn Atom",
"bbcb": "BBC Micro",
"c64": "Commodore 64",
"c64p": "Commodore 64",
"cgenie": "EACA Colour Genie EG2000",
"coco3": "Tandy Colour Computer 3",
"coleco": "Colecovision",
"cpm": "CP/M",
"cpc6128":"Amstrad CPC",
"crvision":"VTech Creativision",
"dos":"MS-DOS",
"dragon32":"Dragon 32",
"fds":"Famicom Disk System",
"gameboy":"Nintendo Gameboy",
"gbcolor":"Nintendo Gameboy Color",
"genesis":"SEGA Genesis/Megadrive",
"gnw":"Game and Watch",
"hbf900a":"MSX",
"intv":"Intellivision",
"jupace":"Jupiter ACE",
"lcd":"LCD and Handheld Games",
"lowresnx":"LowRes NX Fantasy Console",
"mc10":"Tandy MC10",
"mo5":"Thomson MO5",
"mz700":"Sharp MZ-700",
"nes":"Nintendo Entertainment System",
"oric1":"Tangerine ORIC",
"orica":"Tangerine ORIC",
"pc":"PC",
"pc88":"NEC PC-88",
"pcw10":"Amstrad PCW",
"pet4032":"Commodore PET",
"pico8":"Pico-8 Fantasy Console",
"pinball":"Pinball",
"pokitto":"Pokitto DIY Handheld",
"plus4":"Commodore C16/Plus4",
"sg1000":"Sega SG-1000",
"snes":"Super Nintendo Entertainment System",
"spectrum":"Sinclair ZX Spectrum 48K",
"spec128":"Sinclair ZX Spectrum 128K",
"supervision":"Watara Supervision",
"ti99_4a":"Texas Instruments TI-99",
"tic80":"TIC-80 Fantasy Console",
"trs80":"Tandy TRS-80",
"vic20":"Commodore VIC-20",
"vic20_se":"Commodore VIC-20",
"x1":"Sharp X1",
"zx81":"Sinclair ZX80/81"}
# System specific media switches when not simply "-cart"
SYSTEM_MEDIA = {
"adam": "-cart1",
"apple2e": "-gameio joy -flop1",
"bbcb": "-flop1",
"c64": "-joy1 joy -quik",
"c64p": "-joy1 joy -quik",
"cgenie": "-ram 32k -cass",
"coco3": "-flop1",
"cpc6128": "-flop1",
"dragon32": "-cass",
"fds": "-flop1",
"hbf900a": "-flop1",
"jupace": "-ram 32k -dump",
"mo5": "-cass",
"mz700": "-cass",
"oric1": "-cass",
"orica": "-cass",
"pcw10": "-flop",
"pet4032": "-quik",
"plus4": "-quik",
"spectrum": "-nokeepaspect -dump",
"spec128": "-nokeepaspect -dump",
"vic20": "-quik",
"vic20_se": "-quik",
"x1": "-floppydisk1",
"zx81": "-cass"}
# Game specific media to override the system media
GAME_MEDIA = {
"adam_dk_junior":"-flop1",
"adam_dk_super":"-flop1",
"c64_bonkeykong":"-flop",
"c64_monkeykong":"-flop",
"c64_logger":"-speed 1.5 -quik",
"gbcolor_dk_arcade":"-plugin gbstage -cart",
"hbf900a_apeman":"-cart1",
"hbf900a_congo":"-cass",
"plus4_crazyjump":"-joy1 joy -quik",
"plus4_dkplus":"-joy1 joy -quik",
"spectrum_ape_escape":"-cass",
"spectrum_dk3_micro_vs":"-cass",
"spectrum_dk_reloaded":"-cass",
"spectrum_kongs_revenge":"-cass",
"spectrum_crazykongcity":"-cass",
"spectrum_spec_kong":"-speed 1.1 -cass",
"spectrum_wrathofkong":"-speed 1.1 -cass",
"vic20-se_logger": "-cass",
"vic20-se_mickybricky": "-cass",
"vic20_fast_eddie":"-cart",
"vic20-se_dkjr_gnw":"-exp 16k -quik",
"vic20-se_dk_ackenhausen":"-exp 16k -quik"}
WIN64_ONLY_SYSTEMS = "pc", "dos", "cpm"
PI_UNSUPPORTED_SYSTEMS = "bbcb",
# use scan code or see keycodes at: https://github.com/boppreh/keyboard/blob/master/keyboard/_canonical_names.py
KEYBOARD_REMAP = {
"cpm_ladder": "down>z|up>a|1>p|2>l|5>i|right>.|left>,|ctrl>space|alt>b|esc>forcequit:dosbox-x.exe",
"dos_aldo": "ctrl>space",
"dos_aldo2": "ctrl>space",
"dos_aldo3": "ctrl>space",
"dos_davikong": "ctrl>f1|num 2>n,enter|num 1>1,enter|esc>forcequit:dosbox-x.exe",
"dos_heroman": "ctrl>enter,space|alt>space|esc>forcequit:dosbox-x.exe",
"dos_dk": "y>n|ctrl>space|esc>forcequit:dosbox-x.exe|esc>forcequit:dosbox-x.exe",
"dos_dkpc": "ctrl>space,f1|1>f1|2>f2|3>f3|esc>forcequit:dosbox-x.exe",
"dos_kong": "num 1>enter|tab>esc|esc>forcequit:dosbox-x.exe", # TAB to access and save in-game settings
"dos_mamedk": "num 5>num 3|num 2>enter",
"dos_willy": "num 1>enter|ctrl>space",
"pc_arduboy_kong":"ctrl>a|alt>b|p>s|1>a|2>b|esc>forcequit:projectabe.exe",
"pc_arduboy_kong2":"ctrl>a|alt>b|p>s|1>a|2>b|esc>forcequit:projectabe.exe",
"pc_arduboy_dkjr":"ctrl>a|alt>b|p>s|1>a|2>b|esc>forcequit:projectabe.exe",
"pc_atarist_mb":"ctrl>space",
"pc_atarist_kidkong": "delayspace>22",
"pc_atarist_junior":"ctrl>ctrl,space|num 1>a|num 2>b|delayspace>5.25",
"pc_atom_kong":"left>z|right>c|up>s|down>x|ctrl>shift,space|esc>forcequit:atomulator.exe",
"pc_dk_aa": "1>enter|2>enter|ctrl>x",
"pc_dk_craze": "esc>forcequit:stdrt.exe",
"pc_dk_jr_remake": "num 1>enter|ctrl>space|esc>forcequit",
"pc_dk_plus": "left>a|right>d|up>w|down>s|1>enter|ctrl>space,enter",
"pc_dk_remake":"num 1>enter|ctrl>space|esc>forcequit",
"pc_jumpman_rtx":"num 1>enter|num 5>enter|ctrl>space|esc>forcequit|delayenter>8.25",
"pc_hbf900a_congo":"1>space|ctrl>space|esc>forcequit:zesarux.exe",
"pc_lowresnx_denis_kogne":"ctrl>z",
"pc_mc10_kong":"ctrl>space|left>a|right>s|up>w|down>z",
"pc_nes_dk_hdpack":"alt>ctrl",
"pc_nes_dkjr_hdpack":"alt>ctrl",
"pc_pico8_ape":"ctrl>z|esc>forcequit:zepto8.exe",
"pc_pico8_denis_kogne": "ctrl>x|esc>forcequit:zepto8.exe",
"pc_pico8_dinkyking": "ctrl>x|esc>forcequit:zepto8.exe",
"pc_pinball_dkpin":"1>5,1|esc>forcequit:vpinball990.exe",
"pc_pinball_dkong":"1>5,s||esc>forcequit:vpinball990.exe",
"pc_pokitto_dkjr":"ctrl>a|alt>b",
"pc_pokitto_kong2":"ctrl>a|alt>b",
"pc_dkme_alien":"ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_bigtrouble": "ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_conan": "ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_exorcist": "ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_firstblood": "ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_flashgordon": "ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_gremlins": "ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_raiders":"ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_starwars": "ctrl>space|esc>forcequit:dkme.exe",
"pc_dkme_totalrecall": "ctrl>space|esc>forcequit:dkme.exe",
"pc_tic80_denis_kogne":"tab>esc|ctrl>z|alt>x|esc>forcequit:tic80.exe",
"pc_kong_jr_gnw":"ctrl>x|esc>forcequit",
"pc_pc88_dk3":"ctrl>space|esc>forcequit:quasi88.exe",
"pc_supervision_superkong":"ctrl>a|alt>b|esc>forcequit:wataroo.exe",
"pc_tic80_kongremake":"tab>esc|ctrl>z|esc>forcequit:tic80.exe",
"pc_trs80_ape":"ctrl>space|p>enter,1|num 2>home|num 1>enter,1",
"pc_trs80_kong":"ctrl>space|num 1>home",
"pc_trs80_dk":"ctrl>space|num 1>enter,1",
"pc_trs80_killergorilla":"ctrl>space",
"pc_trs80_skyscraper":"ctrl>space|1>1,n,\\,enter",
"pc_spectrum_dkjr2":"left>o|right>p|up>q|down>a|ctrl>m|num 2>num 1|num 3>num 1|alt>n|esc>forcequit:zesarux.exe"}
# Sound setup
pygame.mixer.init(frequency=48000)
background_channel = pygame.mixer.Channel(1)
intermission_channel = pygame.mixer.Channel(2)
award_channel = pygame.mixer.Channel(3)
playlist = pygame.mixer.music
# Initialisation
clock = pygame.time.Clock()
# Font setup (pygame)
dk_font = pygame.font.Font('fonts/PressStart2P-vaV7.ttf', 8)
pl_font = pygame.font.Font('fonts/tom-thumb.bdf', 5)
pl_font7 = pygame.font.Font('fonts/tom-thumb.bdf', 7)
# Menu theme setup
dkafe_theme = pymenu.themes.THEME_DEFAULT.copy()
dkafe_theme.widget_font = 'fonts/PressStart2P-vaV7.ttf'
dkafe_theme.title_font = 'fonts/PressStart2P-vaV7.ttf'
dkafe_theme.title_font_size = 8
dkafe_theme.widget_font_size = 8
dkafe_theme.background_color = BLACK
dkafe_theme.title_background_color = BLACK
dkafe_theme.title_font_color = RED
dkafe_theme.title_bar_style = pymenu.widgets.MENUBAR_STYLE_SIMPLE
dkafe_theme.title_offset = (12, 0)
dkafe_theme.widget_alignment = pymenu.locals.ALIGN_CENTER
dkafe_theme.scrollbar_color = BLACK
dkafe_theme.scrollbar_slider_color = BLACK
dkafe_theme.scrollbar_slider_pad = 0
dkafe_theme.scrollbar_thick = 2
dkafe_theme.selection_color = RED
dkafe_theme.widget_font_color = PINK
dkafe_theme.widget_margin = (0, 2)
dkafe_theme.widget_selection_effect = pymenu.widgets.HighlightSelection(margin_x=10, margin_y=1)
dkafe_theme_left = dkafe_theme.copy()
dkafe_theme_left.widget_alignment = pymenu.locals.ALIGN_LEFT
# Override default pygame-menu keys
pymenu.controls.KEY_APPLY = CONTROL_JUMP
pymenu.controls.KEY_CLOSE_MENU = CONTROL_EXIT
if ARCH == "win32" or ARCH == "win64":
# Optimise append of menu items by monkey patching the pymenu function
def _new_append_widget(self, widget):
if self._columns > 1:
max_elements = self._columns * self._rows
assert len(self._widgets) + 1 <= max_elements, \
'total widgets cannot be greater than columns*rows ({0} elements)'.format(max_elements)
try:
# 10yard - Use additional temporary list to optimise append --------------------------------------------------
if len(self._widgets) == 0:
self._widgets_tmp = []
if len(self._widgets) <= 80:
self._widgets.append(widget)
else:
self._widgets_tmp.append(widget)
if widget._title == "Close Menu":
self._widgets += self._widgets_tmp
# ------------------------------------------------------------------------------------------------------------
except:
self._widgets.append(widget)
if self._index < 0 and widget.is_selectable:
widget.set_selected()
self._index = len(self._widgets) - 1
if self._center_content:
self.center_content()
self._widgets_surface = None # If added on execution time forces the update of the surface
self._render()
pymenu.Menu._append_widget = _new_append_widget