Skip to content

Commit

Permalink
Add remaining gametext files under patch/gametext folder
Browse files Browse the repository at this point in the history
Create a dkong.zip fix/patch file for user "Wizz"
Add game option and settings to toggle gametext information on/off
Update pygame menu module to v3.5.8
  • Loading branch information
10yard committed Oct 19, 2022
1 parent dd2135f commit 3849644
Show file tree
Hide file tree
Showing 51 changed files with 364 additions and 130 deletions.
7 changes: 5 additions & 2 deletions dk_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
ENABLE_MENU = 1 # Allow selection from the quick access game list
INACTIVE_TIME = 15 # 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

Expand Down Expand Up @@ -173,6 +174,7 @@
WHITE = (254, 252, 255)
PINK = (255, 210, 190)
GREY = (128, 128, 128)
MIDGREY = (104, 104, 104)
DARKGREY = (40, 40, 40)
DARKBLUE = (4, 2, 220)

Expand Down Expand Up @@ -249,8 +251,9 @@

# 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', '']
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"], ["", "Push 'COIN' to hide this game information"]]

NO_ROMS_MESSAGE = [
"NO ROMS WERE FOUND!", "",
Expand Down
6 changes: 3 additions & 3 deletions dk_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
wall_bounce = 1 # Adjustment for bouncing off edges. -1 will flip direction of Jumpman's movement

# Toggle display options
showinfo = False # Press coin2 to show description above the icons
showslots = False # Press S to show the arcade machine slots (to assist with front end setup)
showinfo = False # Press coin button to show description above the icons
showslots = False # Press alt button to show the arcade machine slots (to assist with front end setup)
skip = False # Skip the animation
warning = False # Warning timer active
grab = False # DK grabbed a coin
Expand Down Expand Up @@ -65,7 +65,7 @@
screen, screen_map, screen_copy, last_image = (None,) * 4

# Menu
menu, exitmenu, settingmenu, launchmenu = (None,) * 4
menu, exitmenu, setmenu, launchmenu = (None,) * 4
selected = None

# Active Window
Expand Down
3 changes: 2 additions & 1 deletion dk_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@


FIX_ALTERNATIVE_MD5 = "f116efa820a7cedd64bcc66513be389d", "d57b26931fc953933ee2458a9552541e", \
"aa282b72ac409793b36780c99b26d07b", "e883b4225a76a79f38cf1db7c340aa8e"
"aa282b72ac409793b36780c99b26d07b", "e883b4225a76a79f38cf1db7c340aa8e", \
"eb6571036ff25e8e5db5289f5524ab76"


def validate_rom():
Expand Down
6 changes: 3 additions & 3 deletions dk_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def apply_skill(base_score):
def load_game_texts():
# load game texts
texts = []
for filename in glob(os.path.join(PATCH_DIR, "*kong*.txt")):
for filename in glob(os.path.join(PATCH_DIR, "gametext", "*.txt")):
with open(filename, 'r') as f_in:
texts.append([os.path.basename(filename).split(".")[0], f_in.readlines()])
return texts
Expand All @@ -65,6 +65,8 @@ def read_romlist():
data = row.replace('"', '')
if not data.startswith("#") and data.count(",") >= 10:
name, sub, des, alt, slot, emu, rec, unlock, st3, st2, st1, *_ = [x.strip() for x in data.split(",")]
if not alt:
alt = des
if (name and des and slot not in usedslots) or (slot == "99" and sub not in usedsubs):
des = des.replace("DK ","$ ").replace("DK", "$ ")
des = des.replace("1/2","{ ").replace("1/4","} ")
Expand All @@ -82,8 +84,6 @@ def read_romlist():
rec = "0"
if not unlock:
unlock = "0"
if not alt:
alt = des

if "-record" in get_emulator(int(emu)).lower():
# Score targets are not considered for recordings
Expand Down
114 changes: 68 additions & 46 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ def check_for_input(force_exit=False):
build_menus()
open_menu(_g.menu)
if event.key == CONTROL_COIN:
_g.showinfo = not _g.showinfo
if _g.ready:
globals()["SHOW_GAMETEXT"] = not SHOW_GAMETEXT
set_gametext(None, SHOW_GAMETEXT, external=True) # Fix pygamemenu issue
else:
_g.showinfo = not _g.showinfo
if event.key == CONTROL_ACTION:
_g.showslots = not _g.showslots
if event.key == CONTROL_SNAP:
Expand Down Expand Up @@ -260,7 +264,11 @@ def check_for_input(force_exit=False):
build_menus()
open_menu(_g.menu)
if button == BUTTON_COIN:
_g.showinfo = not _g.showinfo
if _g.ready:
globals()["SHOW_GAMETEXT"] = not SHOW_GAMETEXT
set_gametext(None, SHOW_GAMETEXT, external=True) # Fix pygamemenu issue
else:
_g.showinfo = not _g.showinfo
if button == BUTTON_ACTION:
_g.showslots = not _g.showslots
if event.type == pygame.QUIT:
Expand Down Expand Up @@ -502,23 +510,22 @@ def build_menus(initial=False):
_g.exitmenu.add_button('Shutdown', shutdown_system)

# Setting menu
_g.settingmenu = pymenu.Menu(GRAPHICS[1], GRAPHICS[0], " FRONTEND SETTINGS", mouse_visible=False,
mouse_enabled=False, theme=dkafe_theme, onclose=close_menu)
_g.settingmenu.add_selector(' Unlock Mode: ', [('Off', 0), ('On', 1)], default=UNLOCK_MODE, onchange=set_unlock)
_g.settingmenu.add_selector(' Free Play: ', [('Off', 0), ('On', 1)], default=FREE_PLAY, onchange=set_freeplay)
_g.settingmenu.add_selector(' Fullscreen: ', [('Off', 0), ('On', 1)], default=FULLSCREEN,
onchange=set_fullscreen)
_g.settingmenu.add_selector(' Confirm Exit: ', [('Off', 0), ('On', 1)], default=CONFIRM_EXIT, onchange=set_confirm)
_g.settingmenu.add_selector(' Show Splash: ', [('Off', 0), ('On', 1)], default=SHOW_SPLASHSCREEN,
onchange=set_splash)
_g.settingmenu.add_selector(' Speed Adjust: ',
[('0', 0), ('+1', 1), ('+2', 2), ('+3', 3), ('+4', 4), ('+5', 5), ('+6', 6), ('+7', 7),
_g.setmenu = pymenu.Menu(GRAPHICS[1], GRAPHICS[0], " FRONTEND SETTINGS", mouse_visible=False,
mouse_enabled=False, theme=dkafe_theme, onclose=close_menu)
_g.setmenu.add_selector(' Unlock Mode: ', [('Off', 0), ('On', 1)], default=UNLOCK_MODE, onchange=set_unlock)
_g.setmenu.add_selector(' Free Play: ', [('Off', 0), ('On', 1)], default=FREE_PLAY, onchange=set_freeplay)
_g.setmenu.add_selector(' Fullscreen: ', [('Off', 0), ('On', 1)], default=FULLSCREEN, onchange=set_fullscreen)
_g.setmenu.add_selector(' Confirm Exit: ', [('Off', 0), ('On', 1)], default=CONFIRM_EXIT, onchange=set_confirm)
_g.setmenu.add_selector('Show Game Text: ', [('Off', 0), ('On', 1)], default=SHOW_GAMETEXT, onchange=set_gametext)
_g.setmenu.add_selector(' Show Splash: ', [('Off', 0), ('On', 1)], default=SHOW_SPLASHSCREEN, onchange=set_splash)
_g.setmenu.add_selector(' Speed Adjust: ',
[('0', 0), ('+1', 1), ('+2', 2), ('+3', 3), ('+4', 4), ('+5', 5), ('+6', 6), ('+7', 7),
('+8', 8)], default=SPEED_ADJUST, onchange=set_speed)
_g.settingmenu.add_vertical_margin(15)
_g.settingmenu.add_selector('DKAFE Features: ', [('Full', 0), ('Basic', 1)], default=BASIC_MODE, onchange=set_basic)
_g.settingmenu.add_vertical_margin(15)
_g.settingmenu.add_button('Save Changes to File', save_menu_settings)
_g.settingmenu.add_button('Close Menu', close_menu)
_g.setmenu.add_vertical_margin(15)
_g.setmenu.add_selector('DKAFE Features: ', [('Full', 0), ('Basic', 1)], default=BASIC_MODE, onchange=set_basic)
_g.setmenu.add_vertical_margin(15)
_g.setmenu.add_button('Save Changes to File', save_menu_settings)
_g.setmenu.add_button('Close Menu', close_menu)


def build_launch_menu():
Expand Down Expand Up @@ -581,7 +588,7 @@ def build_launch_menu():


def open_settings_menu():
open_menu(_g.settingmenu)
open_menu(_g.setmenu)
reset_all_inputs()


Expand All @@ -605,6 +612,8 @@ def save_menu_settings():
f_out.write(f"BASIC_MODE = {BASIC_MODE}\n")
elif "SHOW_SPLASHSCREEN=" in line_packed:
f_out.write(f"SHOW_SPLASHSCREEN = {SHOW_SPLASHSCREEN}\n")
elif "SHOW_GAMETEXT=" in line_packed:
f_out.write(f"SHOW_GAMETEXT = {SHOW_GAMETEXT}\n")
elif "SPEED_ADJUST=" in line_packed:
f_out.write(f"SPEED_ADJUST = {SPEED_ADJUST}\n")
else:
Expand Down Expand Up @@ -633,6 +642,20 @@ def set_speed(_, setting_value):
globals()["SPEED_ADJUST"] = setting_value


def set_confirm(_, setting_value):
globals()["CONFIRM_EXIT"] = setting_value


def set_gametext(_, setting_value, external=False):
globals()["SHOW_GAMETEXT"] = setting_value
if external:
# Hack to fix pygamemenu when updating outside of the menu
for i, w in enumerate(_g.setmenu._widgets):
if w._title.startswith("Show Game Text"):
_g.setmenu._widgets[i]._index = int(SHOW_GAMETEXT)
break


def set_fullscreen(_, setting_value):
if FULLSCREEN != setting_value:
globals()["FULLSCREEN"] = setting_value
Expand All @@ -642,10 +665,6 @@ def set_fullscreen(_, setting_value):
pygame.display.set_icon(get_image("artwork/dkafe.ico"))


def set_confirm(_, setting_value):
globals()["CONFIRM_EXIT"] = setting_value


def open_menu(menu):
_g.timer.stop()
pygame.mouse.set_visible(False)
Expand All @@ -661,7 +680,7 @@ def close_menu():
intermission_channel.stop()
_g.menu.disable()
_g.exitmenu.disable()
_g.settingmenu.disable()
_g.setmenu.disable()
if _g.launchmenu:
_g.launchmenu.disable()
update_screen()
Expand Down Expand Up @@ -917,31 +936,34 @@ def process_interrupts():
if _g.ready:
# Pauline shouts out the launch options
if since_last_move() % 4 <= 2:
write_text("Push P1 START for options...", x=108, y=38, bg=MAGENTA, fg=PINK, bubble=True)
write_text("P1 START", x=128, y=38, bg=MAGENTA)
write_text("Push JUMP to play or..", x=108, y=38, bg=MAGENTA, fg=PINK, bubble=True)
write_text("JUMP", x=128, y=38, bg=MAGENTA)
else:
write_text("or push JUMP to play", x=108, y=38, bg=MAGENTA, fg=PINK, bubble=True)
write_text("JUMP", x=140, y=38, bg=MAGENTA)
write_text("P1 START for options", x=108, y=38, bg=MAGENTA, fg=PINK, bubble=True)
write_text("P1 START", x=108, y=38, bg=MAGENTA)

# Display game text
sub, name, *_ = display_icons(detect_only=True)
selected = sub if sub else name
for rom, text_lines in _g.gametext:
if rom == selected and text_lines:
# Text appears above or below Jumpman based on his Y position
text_y = _g.ypos - (len(text_lines)+2) * 6 if _g.ypos >= 138 else _g.ypos + 32
# Clear a space for text and draw border
pygame.draw.rect(_g.screen, DARKGREY, (0, text_y-5, 223, len(text_lines)*6+8))
pygame.draw.rect(_g.screen, GREY, (0, text_y - 5, 223, 14))
pygame.draw.rect(_g.screen, GREY, (0, text_y-5, 223, len(text_lines)*6+8), width=2)
# Display the game text
for i, line in enumerate(text_lines):
text = line.replace("\n","").replace("\r","")
if i == 0:
# Center align the title
text = " "*int((55 - len(text.strip())) / 2)+text.strip()
write_text(text[:55], x=4, y=text_y+(i*6))
break
if SHOW_GAMETEXT:
sub, name, *_ = display_icons(detect_only=True)
selected = sub if sub else name
for rom, text_lines in _g.gametext:
if rom == selected and text_lines:
# Text appears above or below Jumpman based on his Y position
text_y = _g.ypos - (len(text_lines)+5) * 6 if _g.ypos >= 138 else _g.ypos + 32
# Clear a space for text and draw borders
pygame.draw.rect(_g.screen, DARKGREY, (0, text_y-5, 224, len(text_lines)*6+8))
pygame.draw.rect(_g.screen, MIDGREY, (0, text_y - 5, 224, 14))
pygame.draw.rect(_g.screen, MIDGREY, (0, text_y-5, 223, len(text_lines)*6+8), width=2)
pygame.draw.rect(_g.screen, MIDGREY, (0, text_y+len(text_lines)*6+2, 224, 14))
# Display the game text
info_index = 0 if (_g.timer.duration - _g.lastmove) % 10 <= 6 else 1
for i, line in enumerate(text_lines + TEXT_INFO[info_index]):
text = line.replace("\n","").replace("\r","")
if i == 0:
# Center align the title
text = " "*int((55 - len(text.strip())) / 2)+text.strip()
write_text(text[:55], x=4, y=text_y+(i*6))
break


def get_prize_placing(awarded):
Expand Down
Binary file added patch/fix_eb6571036ff25e8e5db5289f5524ab76.ips
Binary file not shown.
5 changes: 3 additions & 2 deletions patch/ckongpt2.txt → patch/gametext/ckongpt2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ CRAZY KONG

This Donkey Kong clone retains all of the gameplay
elements of Donkey Kong, but has the graphics redrawn
and re-colorised. There are some quirks with the game.

and re-colorised.

There are some quirks with the game.
If something moves, don't touch it. If it doesn't
move, it's either a hammer for bashing barrels or a
bonus item for picking up umbrella, purse, etc..
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions patch/gametext/dkong2600.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Donkey Kong Atari 2600 Graphics

This hack is made to appear like the ATARI VCS version
of Donkey Kong.

Hack Developed by Vic 20 George
using 'Gingerbread Kong' plugin by Jon Wilson (10yard)
11 changes: 11 additions & 0 deletions patch/gametext/dkong2nut.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
2NUT KONG

Relentless barrel boards without breaks so you must
try to retain focus. All delays have been removed
from the game.

This game starts at level 17-1 and there are 3 barrel
boards per level.

Hack Developed by Jon Wilson (10yard)
Based on ideas from Luke (mr2nut123)
File renamed without changes.
14 changes: 14 additions & 0 deletions patch/gametext/dkong40.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Donkey Kong Annversary Edition

Celebrating 40 years of the Donkey Kong arcade game.

The original game was released on July 9th 1981.
Donkey Kong and Pauline decided to throw a party to
celebrate. They invited Jumpman and it is your job to
take him there. You should collect presents and
balloons on your way up.
The Boards are all variations of the original.

Have fun ... and celebrate !!!

Hack Developed by Paul Goes
14 changes: 14 additions & 0 deletions patch/gametext/dkongallen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Allen Kong

WARNING: THIS GAME CONTAINS STRONG LANGUAGE

A very screwed up version of Donkey Kong were you take
control of Allen and help him to reach his dream 1
Million points. Allen will vent his joy and
frustration via the hundreds of included sound samples.

Allen can select a start level (1, 5, 12 or 17) and be
right on pace for the 1 million points.

Hack Developed by Jon Wilson (10yard)
with the consent of Allen Staal (muscleandfitness)
11 changes: 11 additions & 0 deletions patch/gametext/dkongbarpal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Donkey Kong Barrel Palooza

A barrel boards only hack with twelve variations:
'Steering Bonus', 'Into The Dark', 'Crazy Kong',
'More Wilds', 'Pauline's Heart', 'Both Hammers',
'Reverse Run', 'Slow Barrels', 'Shifted Girders',
'Pauline's Items', 'Spring Time' and 'Anti-Gravity'.

The game has a randomized board selection.

Hack Developed by Paul Goes
File renamed without changes.
8 changes: 8 additions & 0 deletions patch/gametext/dkongce.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Donkey Kong Championship Edition

This romhack introduces the famous Kill Screen at an
earlier level resulting in a much shorter game.

This game defaults to a Kill Screen at level 11.

Hack Developed by Paul Goes
11 changes: 11 additions & 0 deletions patch/gametext/dkongd2k.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Donkey Kong 2: Jumpman Returns

This modded game offers a total of 8 levels. This
includes the original 4 levels, with a few clever
updates, and 4 new levels: Mixer, Foundry, Refinery,
and Incinerator.

The design and play make this game feel like a
Nintendo sequel. It's a hard game to master.

ROM Developed by Jeff Kulczycki
11 changes: 11 additions & 0 deletions patch/gametext/dkongfoundry.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Donkey Kong Foundry

Jump over flaming pits, ride moving steel beams, and
dodge shooting fireballs!

Advanced difficulty. Welcome to the Foundry!

Keep moving and hope that your timing is right on the
money.

ROM Developed by Jeff Kulczycki
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions patch/gametext/dkongitd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Donkey Kong Into The Dark

In this romhack Donkey Kong unplugs the power source.
This results in the lights to be switched off. So you
have to complete the boards in the dark. Once in a few
seconds the lights flash to allow the player to
orientate. The higher the level the longer the pause
between the flashes.

Hack Developed by Paul Goes
File renamed without changes.
Loading

0 comments on commit 3849644

Please sign in to comment.