mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-02-02 06:46:34 +01:00
revise chapter select code again
This commit is contained in:
parent
267634783d
commit
f71b284e90
1 changed files with 48 additions and 44 deletions
|
@ -81,15 +81,51 @@ label chapter_select_go_back:
|
|||
scene black with Dissolve(0.25)
|
||||
return
|
||||
|
||||
window hide
|
||||
window auto hide
|
||||
|
||||
$ select_chapter()
|
||||
|
||||
|
||||
init python:
|
||||
|
||||
# Some of this would be much easier to do if we could just reorganize how the chapters are laid out, but breaking translations is way more of a hassle to fix
|
||||
|
||||
def select_chapter():
|
||||
global current_chapter, quick_menu, ending_route_number, chapter_list_index, chapter_list, ending_chapters_determined, chapter_list_length
|
||||
|
||||
selected_label = display_chapter_choices() # Returns a label of the chapter to jump to
|
||||
|
||||
setup_ending(ending_route_number) # Add ending chapters to chapter control list
|
||||
|
||||
# Find the index position of the selected chapter
|
||||
try:
|
||||
chapter_list_index = chapter_list.index(selected_label)
|
||||
except ValueError: # This crashes the game otherwise since it wouldn't find the correct chapter
|
||||
|
||||
# Make an exception for the 11A/B/C/D chapters, since we're technically supposed to start at the lPromAnnouncement label
|
||||
# Stank as fuck
|
||||
if selected_label == "lPromAnnouncement":
|
||||
chapter_list_index = 10
|
||||
current_chapter = "chapter_11"
|
||||
|
||||
toggle_debug()
|
||||
quick_menu = True
|
||||
|
||||
renpy.call("lPromAnnouncement")
|
||||
else:
|
||||
print("No such chapter exists!")
|
||||
MainMenu(confirm=False) () # Exits to the main menu
|
||||
|
||||
current_chapter = selected_label
|
||||
|
||||
# Start playing the game
|
||||
toggle_debug()
|
||||
quick_menu = True # Restores the bottom quick menu UI
|
||||
|
||||
renpy.call(current_chapter)
|
||||
|
||||
def display_chapter_choices():
|
||||
# Vars for displaying the choices
|
||||
ending_tuples = {
|
||||
1: ending_1_tuple,
|
||||
2: ending_2_tuple,
|
||||
|
@ -97,62 +133,30 @@ init python:
|
|||
4: ending_4_tuple
|
||||
}
|
||||
|
||||
# Chapter list to select from
|
||||
chapter_tuples = chapter_tuple + ending_tuples[ending_route_number]
|
||||
final_chapter_tuple = chapter_tuple + ending_tuples[ending_route_number] # Chapter list to select from
|
||||
|
||||
# Vars for displaying the choices
|
||||
chapters_per_page = 6
|
||||
current_page = 0
|
||||
chapters_per_page = 6
|
||||
|
||||
# The range of choices to display
|
||||
start_index = 0
|
||||
end_index = chapters_per_page
|
||||
|
||||
# The loop that displays the chapter choices
|
||||
while True:
|
||||
# Displays the choices
|
||||
selected_tuple = renpy.display_menu(chapter_tuples[start_index:end_index] + [("Next Page", "chapter_select_next_page"), ("Go Back", "chapter_select_go_back")])
|
||||
selected_label = renpy.display_menu(final_chapter_tuple[start_index:end_index] + [("Next Page", "chapter_select_next_page"), ("Go Back", "chapter_select_go_back")])
|
||||
|
||||
if selected_tuple == "chapter_select_next_page":
|
||||
if selected_label == "chapter_select_next_page":
|
||||
# If we're at the last page, wrap around to the first
|
||||
current_page = 0 if end_index == len(chapter_tuples) else (current_page + 1)
|
||||
current_page = 0 if end_index == len(final_chapter_tuple) else (current_page + 1)
|
||||
|
||||
start_index = chapters_per_page * current_page
|
||||
end_index = min(start_index + chapters_per_page, len(chapter_tuples))
|
||||
end_index = min(start_index + chapters_per_page, len(final_chapter_tuple))
|
||||
|
||||
elif selected_tuple == "chapter_select_go_back":
|
||||
# Exit to ending selection
|
||||
elif selected_label == "chapter_select_go_back":
|
||||
renpy.jump("chapter_select_go_back")
|
||||
|
||||
# We've selected a chapter
|
||||
else:
|
||||
break # We've selected a chapter
|
||||
|
||||
setup_ending(ending_route_number)
|
||||
|
||||
store._window_auto = True
|
||||
|
||||
# Find the index position of the selected chapter
|
||||
try:
|
||||
chapter_list_index = chapter_list.index(selected_tuple)
|
||||
except ValueError: # This crashes the game otherwise since it wouldn't find the correct chapter
|
||||
|
||||
# Make an exception for the 11A/B/C/D chapters, since we're technically supposed to start at the PromAnnouncement label
|
||||
# Stank as fuck
|
||||
if selected_tuple == "lPromAnnouncement":
|
||||
chapter_list_index = 10
|
||||
current_chapter = "chapter_11"
|
||||
|
||||
toggle_debug()
|
||||
quick_menu = True
|
||||
renpy._window_auto = True
|
||||
|
||||
renpy.jump("lPromAnnouncement")
|
||||
else:
|
||||
print("No such chapter exists!")
|
||||
MainMenu(confirm=False) () # Exits to the main menu
|
||||
|
||||
current_chapter = selected_tuple
|
||||
|
||||
# Start playing the game
|
||||
toggle_debug()
|
||||
quick_menu = True # Restores the bottom quick menu UI
|
||||
|
||||
renpy.call(current_chapter)
|
||||
return selected_label
|
Loading…
Reference in a new issue