Bug fixes, Engine, Hotkeys

* Implement JumpWith action
* Fix hide windows hotkey
* Fix surface tree capture by implementing inter pauses for interface elements
* Implement achievements 'O' hotkey
* Fixed call stack depth issues
This commit is contained in:
LoafyLemon 2024-09-24 21:16:55 +01:00
parent d6cc3265ec
commit a06df58240
8 changed files with 40 additions and 7 deletions

View File

@ -105,7 +105,7 @@ screen quickbox():
hbox: hbox:
xalign 1.0 xalign 1.0
if states.settings.quickbox_expanded: if states.settings.quickbox_expanded:
textbutton "󰈉" action ToggleVariable("states.settings.interface_hidden", True, False) tooltip _("Hide Interface") keysym "K_h" # Hide Interface (\F0209) textbutton "󰈉" action ToggleVariable("states.settings.interface_hidden", True, False) tooltip _("Hide Interface") keysym "hide_windows" # Hide Interface (\F0209)
textbutton "󰇚" action QuickSave() tooltip _("Quick Save") # File Save (\F01DA) textbutton "󰇚" action QuickSave() tooltip _("Quick Save") # File Save (\F01DA)
textbutton "󰕒" action QuickLoad() tooltip _("Quick Load") # File Load (\F0552) textbutton "󰕒" action QuickLoad() tooltip _("Quick Load") # File Load (\F0552)
textbutton "󰁪" action Preference("auto-forward", "toggle") tooltip _("Auto-Forward Dialogue") # Autoplay (\F18F2) textbutton "󰁪" action Preference("auto-forward", "toggle") tooltip _("Auto-Forward Dialogue") # Autoplay (\F18F2)

View File

@ -179,8 +179,11 @@ init python in achievements:
unlocked_achievements = sum(1 for x in items if renpy.store.achievement.has(x)) unlocked_achievements = sum(1 for x in items if renpy.store.achievement.has(x))
return round((unlocked_achievements / total_achievements) * 100) return round((unlocked_achievements / total_achievements) * 100)
label achievements: label achievements(inter_pause=True):
$ disable_game_menu() $ disable_game_menu()
if inter_pause:
# Ensures all irrelevant screens are hidden before capturing the surface tree
with Pause(0.2)
call screen achievements call screen achievements
$ enable_game_menu() $ enable_game_menu()
jump main_room_menu jump main_room_menu
@ -220,7 +223,7 @@ screen achievements():
for i in menu_categories: for i in menu_categories:
textbutton "[i.capitalize()]" action [SetScreenVariable("category", i), SetScreenVariable("menu_items", achievements.get_list(i))] selected (category==i) at navigation_tabs textbutton "[i.capitalize()]" action [SetScreenVariable("category", i), SetScreenVariable("menu_items", achievements.get_list(i))] selected (category==i) at navigation_tabs
null height 35 null height 35
textbutton _("Return") action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym ["game_menu"] at navigation_tabs textbutton _("Return") action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym ["game_menu", "achievements"] at navigation_tabs
frame: frame:
label _("Achievements") label _("Achievements")

View File

@ -1,6 +1,9 @@
label gift_menu: label gift_menu(inter_pause=True):
$ disable_game_menu() $ disable_game_menu()
$ inventory_mode = 1 $ inventory_mode = 1
if inter_pause:
# Ensures all irrelevant screens are hidden before capturing the surface tree
with Pause(0.2)
call screen inventory call screen inventory
if not _return == True: if not _return == True:

View File

@ -13,6 +13,7 @@ init 1 python:
sleep = ["K_s"], sleep = ["K_s"],
fap = ["K_f"], fap = ["K_f"],
summon = ["K_d"], summon = ["K_d"],
achievements = ["K_o"],
# Bindings present almost everywhere, unless explicitly disabled. # Bindings present almost everywhere, unless explicitly disabled.
rollback = ["K_PAGEUP", "repeat_K_PAGEUP", "K_AC_BACK", "mousedown_4"], rollback = ["K_PAGEUP", "repeat_K_PAGEUP", "K_AC_BACK", "mousedown_4"],
@ -169,7 +170,8 @@ screen hotkeys_main():
key "work" action Jump("paperwork") key "work" action Jump("paperwork")
key "stats" action Jump("stats") key "stats" action Jump("stats")
key "inventory" action Jump("inventory") key "inventory" action JumpWith("inventory", inter_pause=False)
key "achievements" action JumpWith("achievements", inter_pause=False)
key "fap" action Jump("jerk_off") key "fap" action Jump("jerk_off")
key "summon" action Jump("door") key "summon" action Jump("door")
key "sleep" action If(states.env.daytime, Jump("night_start"), Jump("day_start")) key "sleep" action If(states.env.daytime, Jump("night_start"), Jump("day_start"))

View File

@ -1,7 +1,10 @@
default inventory_mode = 0 # 0 - Inventory, 1 - gifts default inventory_mode = 0 # 0 - Inventory, 1 - gifts
label inventory: label inventory(inter_pause=True):
$ disable_game_menu() $ disable_game_menu()
if inter_pause:
# Ensures all irrelevant screens are hidden before capturing the surface tree
with Pause(0.2)
call screen inventory call screen inventory
$ enable_game_menu() $ enable_game_menu()
jump main_room_menu jump main_room_menu

View File

@ -131,6 +131,7 @@ label main_room:
# Return to main_room at menu point (after quests and events) # Return to main_room at menu point (after quests and events)
# Used to return from main room interactions # Used to return from main room interactions
label main_room_menu: label main_room_menu:
$ renpy.set_return_stack([])
hide screen bld1 hide screen bld1
with d3 with d3

View File

@ -362,3 +362,24 @@ init -100 python:
renpy.config.after_replay_callback() renpy.config.after_replay_callback()
renpy.call_replay = _call_replay renpy.call_replay = _call_replay
# Implement pseudo jump with arguments required to simplify code,
@renpy.pure
class JumpWith(Action, DictEquality):
"""
:doc: control_action
Causes control to transfer to `label`, given as a string.
"""
args = tuple()
kwargs = dict()
def __init__(self, label, *args, **kwargs):
self.label = label
self.args = args
self.kwargs = kwargs
def __call__(self):
renpy.set_return_stack([])
renpy.call(self.label, *self.args, **self.kwargs)