Merge branch 'add-ending-ch-select'

This commit is contained in:
Iggy 2024-08-30 20:16:08 -03:00
commit 4ce0d1df31
3 changed files with 87 additions and 47 deletions

View file

@ -15,7 +15,38 @@ define chapter_tuple_2 = [
("11. School assignment and route lock.", "chapter_11")
]
define tuples_index = [
define ending_1_tuple = [
("11A. ", "chapter_11A"),
("12A. ", "chapter_12A"),
("12_5D. ", "chapter_12_5D"),
("13A. ", "chapter_13A"),
("14A. ", "chapter_14A")
]
define ending_2_tuple = [
("11B. ", "chapter_11B"),
("12B. ", "chapter_12B"),
("13B. ", "chapter_13B"),
("14B. ", "chapter_14B")
]
define ending_3_tuple = [
("11C. ", "chapter_11C"),
("12C. ", "chapter_12C"),
("12_5C. ", "chapter_12_5C"),
("13C. ", "chapter_13C"),
("14C. ", "chapter_14C")
]
define ending_4_tuple = [
("11D. ", "chapter_11D"),
("12D. ", "chapter_12D"),
("12_5D. ", "chapter_12_5D"),
("13D. ", "chapter_13D"),
("14D. ", "chapter_14D")
]
default tuples_index = [
("Chapters 1 to 6", chapter_tuple_1),
("Chapters 7 to 11", chapter_tuple_2)
]
@ -34,35 +65,38 @@ init python:
renpy.jump("chapter_select")
current_chapter = display_tuple_menu(selected_tuple)
if current_chapter == "go_back":
continue
else:
find_chapter_in_array(current_chapter)
break
set_stats()
toggle_debug()
quick_menu = True
quick_menu = True # Restores the bottom quick menu UI
renpy.call(current_chapter)
def add_ending_tuple(ending_number):
global tuples_index
ending_tuples = {
1: ending_1_tuple,
2: ending_2_tuple,
3: ending_3_tuple,
4: ending_4_tuple
}
if ending_number in ending_tuples:
description = f"Ending {ending_number} chapters"
tuples_index.append((description, ending_tuples[ending_number]))
def display_tuple_menu(options):
return renpy.display_menu(options + [("Go Back", "go_back")])
def set_stats():
global ending_route_number, is_end_reached
ending_route_number = get_ending()
find_chapter_in_array()
if not is_end_reached:
add_ending_chapters() # From storyline
update_ending_variables() # From storyline
def set_scores(anon_score, fang_score):
global anonscore, fangscore
@ -70,14 +104,14 @@ init python:
fangscore = fang_score
def find_chapter_in_array():
global chapter_list_index, current_chapter
def find_chapter_in_array(chapter):
global chapter_list_index
try:
chapter_list_index = chapter_list.index(current_chapter)
chapter_list_index = chapter_list.index(chapter)
except ValueError:
chapter_list_index = -1
current_chapter = ""
chapter = ""
label reset_chapter_list:
@ -85,11 +119,21 @@ label reset_chapter_list:
"chapter_1", "chapter_2", "chapter_3", "chapter_4", "chapter_5",
"chapter_6", "chapter_7", "chapter_8", "chapter_9", "chapter_10", "chapter_11"
]
$ tuples_index = [
("Chapters 1 to 6", chapter_tuple_1),
("Chapters 7 to 11", chapter_tuple_2)
]
return
label chapter_select:
$ quick_menu = False
$ quick_menu = False # Hides bottom quick menu UI
call reset_chapter_list from _call_reset_chapter_list # Reset every time the tool is called
$ anon_points = 0
$ fang_points = 0
stop sound
stop music fadeout 2
@ -99,25 +143,31 @@ label chapter_select:
"Initialize scores:"
"Ending 1":
$ set_scores(0, 0)
pass # Since points are already initialized at 0
"Ending 2":
$ set_scores(0, 4)
# anon 0
$ fang_points = 4
"Ending 3":
$ set_scores(4, 0)
$ anon_points = 4
# fang 0
"Ending 4":
$ set_scores(4, 4)
$ anon_points = 4
$ fang_points = 4
$ wingStory = True
"Exit to main menu":
scene black with dissolve
return
$ set_scores(anon_points, fang_points)
$ ending_route_number = get_ending()
$ is_end_reached = False # Reset this for when the tool is used more than once
$ add_ending_chapters(ending_route_number)
$ add_ending_tuple(ending_route_number)
$ update_ending_variables() # Updates variables for newly extended 'chapter_list' with ending chapters
window hide
if not is_end_reached:
call reset_chapter_list from _call_reset_chapter_list
$ select_chapter()

View file

@ -13,10 +13,10 @@ init -1 python:
init python:
def next_story_chapter():
global chapter_list_index, current_chapter, ending_route_number
global chapter_list_index, current_chapter
# Add check "is_end_reached" to have this if statement be executed only once when finishing the general chapters
if not is_end_reached and is_end_of_chapters():
if not is_end_reached and chapter_list_index >= chapter_list_length:
process_ending()
if chapter_list_index < chapter_list_length:
@ -25,25 +25,21 @@ init python:
renpy.call(current_chapter)
else:
end_story()
def is_end_of_chapters():
return chapter_list_index >= chapter_list_length
def process_ending():
global ending_route_number
ending_route_number = get_ending()
add_ending_chapters()
update_ending_variables()
add_ending_chapters(ending_route_number)
update_ending_variables() # Updates variables for newly extended 'chapter_list' with ending chapters
def add_ending_chapters():
def add_ending_chapters(route_number):
global chapter_list
if ending_route_number in ending_routes:
chapter_list.extend(ending_routes[ending_route_number])
if route_number in ending_routes:
chapter_list.extend(ending_routes[route_number])
def update_ending_variables():
@ -59,7 +55,6 @@ init python:
return len(chapter_list) - 1
def end_story():
ending_image()
renpy.call("lending")

View file

@ -1,8 +1,3 @@
[tasks.patch]
type = "custom"
enabled = true
ver = "8.3.0"
[tasks.keystore] # required if matching task is enabled
type="keystore"
enabled = true