init python: def unlock_all_gallery_scenes(): all_seen_images = [] for gallery in [BTWGallery, ReplayGallery, StoryGallery]: for chapter in gallery["chapters"]: for scene in chapter["scenes"]: if scene.get("seen"): if isinstance(scene["seen"], list): all_seen_images.extend(scene["seen"]) else: all_seen_images.append(scene["seen"]) for image_name in all_seen_images: renpy.mark_image_seen(image_name) config.start_callbacks.append(unlock_all_gallery_scenes) def toggle_scene_unlock(gallery_name, chapter_index, scene_index): gallery = None if gallery_name == "image": gallery = BTWGallery elif gallery_name == "replay": gallery = ReplayGallery elif gallery_name == "story": gallery = StoryGallery if gallery and chapter_index < len(gallery["chapters"]) and scene_index < len(gallery["chapters"][chapter_index]["scenes"]): scene = gallery["chapters"][chapter_index]["scenes"][scene_index] if scene.get("seen"): if isinstance(scene["seen"], list): for image_name in scene["seen"]: if renpy.seen_image(image_name): renpy.mark_image_unseen(image_name) else: renpy.mark_image_seen(image_name) else: if renpy.seen_image(scene["seen"]): renpy.mark_image_unseen(scene["seen"]) else: renpy.mark_image_seen(scene["seen"]) def is_scene_unlocked(gallery_name, chapter_index, scene_index): gallery = None if gallery_name == "image": gallery = BTWGallery elif gallery_name == "replay": gallery = ReplayGallery elif gallery_name == "story": gallery = StoryGallery if gallery and chapter_index < len(gallery["chapters"]) and scene_index < len(gallery["chapters"][chapter_index]["scenes"]): scene = gallery["chapters"][chapter_index]["scenes"][scene_index] if scene.get("seen"): if isinstance(scene["seen"], list): return any(renpy.seen_image(i) for i in scene["seen"]) else: return renpy.seen_image(scene["seen"]) return False def are_all_scenes_unlocked(): for gallery in [BTWGallery, ReplayGallery, StoryGallery]: for chapter in gallery["chapters"]: for scene in chapter["scenes"]: if scene.get("seen"): if isinstance(scene["seen"], list): if not any(renpy.seen_image(i) for i in scene["seen"]): return False else: if not renpy.seen_image(scene["seen"]): return False return True def toggle_all_scenes_unlock(): all_unlocked = are_all_scenes_unlocked() for gallery in [BTWGallery, ReplayGallery, StoryGallery]: for chapter in gallery["chapters"]: for scene in chapter["scenes"]: if scene.get("seen"): if isinstance(scene["seen"], list): for image_name in scene["seen"]: if all_unlocked: renpy.mark_image_unseen(image_name) else: renpy.mark_image_seen(image_name) else: if all_unlocked: renpy.mark_image_unseen(scene["seen"]) else: renpy.mark_image_seen(scene["seen"]) init: $ config.keymap["gallery_unlocker"] = ["K_g"] $ config.underlay.append(renpy.Keymap(gallery_unlocker=ShowMenu("gallery_unlocker"))) screen gallery_unlocker(): tag menu use game_menu(_("Gallery Unlocker"), scroll=None): vbox: spacing 20 hbox: xfill True spacing 20 text _("{size=+6}Image Gallery{/size}") text _("{size=+6}Replay Gallery{/size}") text _("{size=+6}Story Gallery{/size}") grid 3 1: xfill True ysize 600 spacing 20 viewport: scrollbars "vertical" mousewheel True xfill True vbox: style_prefix "check" xfill True for i, chapter in enumerate(BTWGallery["chapters"]): if chapter["label"] and chapter["scenes"]: null height 10 label _("{size=+6}" + chapter["label"] + "{/size}") for j, scene in enumerate(chapter["scenes"]): if scene.get("seen"): textbutton _("{size=-25}{font=gui/fonts/text.ttf}" + scene["label"] + "{/font}{/size}") action Function(toggle_scene_unlock, "image", i, j) selected is_scene_unlocked("image", i, j) text_xalign 0.0 viewport: scrollbars "vertical" mousewheel True vbox: style_prefix "check" for i, chapter in enumerate(ReplayGallery["chapters"]): if chapter["label"] and chapter["scenes"]: null height 10 label _("{size=+6}" + chapter["label"] + "{/size}") for j, scene in enumerate(chapter["scenes"]): if scene.get("seen"): textbutton _("{size=-25}{font=gui/fonts/text.ttf}" + scene["label"] + "{/font}{/size}") action Function(toggle_scene_unlock, "replay", i, j) selected is_scene_unlocked("replay", i, j) text_xalign 0.0 viewport: scrollbars "vertical" mousewheel True vbox: style_prefix "check" for i, chapter in enumerate(StoryGallery["chapters"]): if chapter["label"] and chapter["scenes"]: null height 10 label _("{size=+6}" + chapter["label"] + "{/size}") for j, scene in enumerate(chapter["scenes"]): if scene.get("seen"): textbutton _("{size=-25}{font=gui/fonts/text.ttf}" + scene["label"] + "{/font}{/size}") action Function(toggle_scene_unlock, "story", i, j) selected is_scene_unlocked("story", i, j) text_xalign 0.0 hbox: xalign 1.0 yalign 1.0 textbutton _("{size=-18}Unlock All{/size}") action Function(toggle_all_scenes_unlock) selected are_all_scenes_unlocked() style_prefix "check"