Skip to content

Commit

Permalink
Set Jumpman's status to "Not ready to play" when game is paused
Browse files Browse the repository at this point in the history
Fix some bugs with overwriting text because Pauline had too much to say.
  • Loading branch information
10yard committed Jul 22, 2021
1 parent b952a09 commit e6f7c6d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dk_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def build_launch_command(info, basic_mode):
if script:
# An interface script is available
competing = True
launch_command += f' -console -autoboot_script {os.path.join(ROOT_DIR, "interface", script)}'
launch_command += f' -noconsole -autoboot_script {os.path.join(ROOT_DIR, "interface", script)}'

return launch_command, launch_directory, competing

Expand Down
21 changes: 13 additions & 8 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ def display_icons(detect_only=False, with_background=False, below_y=None, above_
p_des = 'FOR PRACTICE!'
elif not int(FREE_PLAY or BASIC_MODE) and since_last_move() % 4 > 2:
p_des = f'${str(PLAY_COST)} TO PLAY'
write_text(p_des.upper(), x=108, y=37, fg=WHITE, bg=MAGENTA, bubble=True)
if not _g.awarded:
# don't announce if Pauline already informing of an award
write_text(p_des.upper(), x=108, y=37, fg=WHITE, bg=MAGENTA, bubble=True)
if unlocked:
nearby = (sub, name, emu, rec, unlock, st3, st2, st1)
_g.selected = p_des
Expand Down Expand Up @@ -629,7 +631,7 @@ def shutdown_system():

def launch_rom(info, override_emu=None):
# Launch the rom using provided info. Override is used to change emu number in case of recordings (to rec number).
if info:
if _g.active and info:
sub, name, emu, rec, unlock, st3, st2, st1 = info
if override_emu:
emu = override_emu
Expand All @@ -654,17 +656,17 @@ def launch_rom(info, override_emu=None):
reset_all_inputs()
if os.path.exists(launch_directory):
os.chdir(launch_directory)
clear_screen()
if EMU_ENTER:
# Optional command to issue before launching the emulator
Popen(EMU_ENTER, shell=False)
if EMU_EXIT:
# Optional command to issue when exiting emulator
launch_command += f"; {EMU_EXIT}"
os.system(launch_command)
pygame.time.delay(50) # debounce
_g.lastexit = _g.timer.duration
os.chdir(ROOT_DIR)

clear_screen(and_reset_display=True)
if competing:
# Check to see if Jumpman achieved 1st, 2nd or 3rd score target to earn coins
scored = get_award(name, st3, st2, st1)
Expand Down Expand Up @@ -700,10 +702,11 @@ def playback_rom(info, inpfile):
os.chdir(launch_directory)
playback_command += f" -playback {os.path.basename(inpfile)} -exit_after_playback"
intermission_channel.stop()

clear_screen()
if EMU_ENTER:
Popen(EMU_ENTER, shell=False)
if EMU_EXIT:
launch_command += f"; {EMU_EXIT}"
os.system(playback_command)
clear_screen(and_reset_display=True)
pygame.time.delay(50) # debounce
_g.lastexit = _g.timer.duration
os.chdir(ROOT_DIR)
Expand Down Expand Up @@ -858,7 +861,7 @@ def animate_rolling_coins(out_of_time=False):
_g.awarded = 0
for i, coin in enumerate(_g.coins):
co_x, co_y, co_rot, co_dir, co_ladder, co_type, co_awarded = coin
if co_awarded:
if co_awarded and _g.timer.duration < 6:
place, place_text = get_prize_placing(co_awarded)
write_text(f"YOU WON {place_text} PRIZE!", x=108, y=37, fg=WHITE, bg=MAGENTA, bubble=True)
_g.awarded = co_awarded
Expand Down Expand Up @@ -895,6 +898,8 @@ def animate_rolling_coins(out_of_time=False):

def inactivity_check():
if _g.timer.duration - _g.lastmove > INACTIVE_TIME:
_g.ready = False # Jumpman status is changed so he is not ready to play.
_g.facing = 1
pause_mod = (pygame.time.get_ticks() - _g.pause_ticks) % 21000
if pause_mod < 3000:
_g.screen.blit(get_image(f"artwork/intro/f{randint(0,1)}.png"), TOPLEFT)
Expand Down
4 changes: 2 additions & 2 deletions rpi4/w_enter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# Use this line in your settings.txt to enable it i.e.
# EMU_ENTER = <ROOT>/w_enter.sh

for i in {1..20}
for i in {1..10}
do
# Keep focus on DKAFE until MAME starts
wmctrl -Fa DKAFE
if wmctrl -l | grep -q MAME:; then
# Wait for MAME to start up then switch focus
sleep 0.6
sleep 0.5
wmctrl -a MAME: -b add,fullscreen
exit
fi
Expand Down

0 comments on commit e6f7c6d

Please sign in to comment.