Code optimizations

This commit is contained in:
2024-08-22 23:18:23 -03:00
parent 84ccfc1b13
commit 0fbff1b81b

View File

@ -29,24 +29,26 @@ init python:
global selected_tuple, current_chapter, is_end_reached global selected_tuple, current_chapter, is_end_reached
while True: while True:
selected_tuple = renpy.display_menu(tuples_index + [("Go Back", "go_back")]) selected_tuple = display_tuple_menu(tuples_index)
if selected_tuple == "go_back": if selected_tuple == "go_back":
renpy.jump("chapter_select") renpy.jump("chapter_select")
current_chapter = renpy.display_menu(selected_tuple + [("Go Back", "go_back")]) current_chapter = display_tuple_menu(selected_tuple)
if current_chapter == "go_back": if current_chapter == "go_back":
continue continue
else: else:
break break
is_end_reached = False # Reset this for when the tool is used more than once
set_stats() set_stats()
toggle_debug() toggle_debug()
renpy.call(current_chapter) renpy.call(current_chapter)
def display_tuple_menu(options):
return renpy.display_menu(options + [("Go Back", "go_back")])
def set_stats(): def set_stats():
global chapter_list_length, ending_route_number, is_end_reached, lock_scores global chapter_list_length, ending_route_number, is_end_reached, lock_scores
@ -89,9 +91,9 @@ label reset_chapter_list:
label chapter_select: label chapter_select:
scene black
stop sound stop sound
stop music stop music fadeout 2
scene black with dissolve
menu: menu:
"Initialize scores:" "Initialize scores:"
@ -105,8 +107,13 @@ label chapter_select:
"Ending 4": "Ending 4":
$ set_scores(4, 4) $ set_scores(4, 4)
"Exit to main menu": "Exit to main menu":
scene black with dissolve
return return
$ is_end_reached = False # Reset this for when the tool is used more than once
window hide
if not is_end_reached: if not is_end_reached:
call reset_chapter_list from _call_reset_chapter_list call reset_chapter_list from _call_reset_chapter_list