mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-02-02 06:46:34 +01:00
redo chapter select and chapter processing
This commit is contained in:
parent
2a157e1362
commit
3059d469f2
3 changed files with 111 additions and 177 deletions
|
@ -1,138 +1,51 @@
|
|||
define chapter_tuple_1 = [
|
||||
("1. Anon meets Fang.", "chapter_1"),
|
||||
("2. Fourth day of school.", "chapter_2"),
|
||||
("3. Showing up at band practice.", "chapter_3"),
|
||||
("4. Anon needs help during music period.", "chapter_4"),
|
||||
("5. Fang and Anon cut class to talk on the roof.", "chapter_5"),
|
||||
("6. Anon helps Fang find a venue for the band.", "chapter_6")
|
||||
]
|
||||
|
||||
define chapter_tuple_2 = [
|
||||
("7. Concert day.", "chapter_7"),
|
||||
("8. Anon and Fang study together.", "chapter_8"),
|
||||
("9. Trish ridicules Anon in front of the school.", "chapter_9"),
|
||||
("10. Fang goes to Anon's apartment.", "chapter_10"),
|
||||
("11. School assignment and route lock.", "chapter_11")
|
||||
define chapter_tuple = [
|
||||
("1. First Day of School", "chapter_1"),
|
||||
("2. Meeting the Band", "chapter_2"),
|
||||
("3. Band Practice", "chapter_3"),
|
||||
("4. Music Class", "chapter_4"),
|
||||
("5. Gardening Club / Heart to Heart", "chapter_5"), # This is supposed to be split in 2 chapters, but maybe making tons of save files stop working would be too much to ask
|
||||
("6. Not a Date", "chapter_6"),
|
||||
("7. Concert Day", "chapter_7"),
|
||||
("8. Study Session", "chapter_8"),
|
||||
("9. VVURM DRAMA", "chapter_9"),
|
||||
("10. Confession", "chapter_10"),
|
||||
("11. Naser drama", "chapter_11")
|
||||
]
|
||||
|
||||
define ending_1_tuple = [
|
||||
("11A. ", "chapter_11A"),
|
||||
("12A. ", "chapter_12A"),
|
||||
("12_5D. ", "chapter_12_5D"),
|
||||
("13A. ", "chapter_13A"),
|
||||
("14A. ", "chapter_14A")
|
||||
("11.5. Announcing a Plan", "chapter_11A") # this is supposed to be ch 12 (13, accounting for ch 5), but it somehow got counted as part of 11 internally
|
||||
("12. Let's all go to the Museum", "chapter_12A"),
|
||||
("13. Prom is Complicated", "chapter_12_5D"),
|
||||
("14. Bowling for Volcano High", "chapter_14A")
|
||||
]
|
||||
|
||||
define ending_2_tuple = [
|
||||
("11B. ", "chapter_11B"),
|
||||
("12B. ", "chapter_12B"),
|
||||
("13B. ", "chapter_13B"),
|
||||
("14B. ", "chapter_14B")
|
||||
("11.5. Announcing Nothing Important", "chapter_11B")
|
||||
("12. Let's all go to a Concert", "chapter_12B"),
|
||||
("13. Prom is For Suckers", "chapter_13B"),
|
||||
("14. Anon and the Infinite Sadness", "chapter_14B")
|
||||
]
|
||||
|
||||
define ending_3_tuple = [
|
||||
("11C. ", "chapter_11C"),
|
||||
("12C. ", "chapter_12C"),
|
||||
("12_5C. ", "chapter_12_5C"),
|
||||
("13C. ", "chapter_13C"),
|
||||
("14C. ", "chapter_14C")
|
||||
("11.5. Announcing a Date", "chapter_11C")
|
||||
("12. Let's all go Camping", "chapter_12C"),
|
||||
("13. Prom is Suprising", "chapter_12_5C"),
|
||||
("14. Volcano Highschool Musical", "chapter_14C")
|
||||
]
|
||||
|
||||
define ending_4_tuple = [
|
||||
("11D. ", "chapter_11D"),
|
||||
("12D. ", "chapter_12D"),
|
||||
("12_5D. ", "chapter_12_5D"),
|
||||
("13D. ", "chapter_13D"),
|
||||
("14D. ", "chapter_14D")
|
||||
("11.5. Announcing a Show.", "chapter_11D")
|
||||
("12. Let's all go to the Aquarium", "chapter_12D"),
|
||||
("13. Prom is Memorable", "chapter_12_5D"),
|
||||
("14. Fast Times at Volcano High", "chapter_14D")
|
||||
]
|
||||
|
||||
default tuples_index = [
|
||||
("Chapters 1 to 6", chapter_tuple_1),
|
||||
("Chapters 7 to 11", chapter_tuple_2)
|
||||
]
|
||||
|
||||
|
||||
init python:
|
||||
|
||||
def select_chapter():
|
||||
global current_chapter, quick_menu
|
||||
|
||||
selected_tuple = ()
|
||||
|
||||
while True:
|
||||
selected_tuple = display_tuple_menu(tuples_index)
|
||||
if selected_tuple == "go_back":
|
||||
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
|
||||
|
||||
toggle_debug()
|
||||
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_scores(anon_score, fang_score):
|
||||
global anonscore, fangscore
|
||||
|
||||
anonscore = anon_score
|
||||
fangscore = fang_score
|
||||
|
||||
|
||||
def find_chapter_in_array(chapter):
|
||||
global chapter_list_index
|
||||
|
||||
try:
|
||||
chapter_list_index = chapter_list.index(chapter)
|
||||
except ValueError: # This crashes the game otherwise since it wouldn't find the correct chapter
|
||||
MainMenu(confirm=False) () # Exits to the main menu
|
||||
|
||||
|
||||
label reset_chapter_list:
|
||||
$ 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 # 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
|
||||
$ anonscore = 0
|
||||
$ fangscore = 0
|
||||
|
||||
camera:
|
||||
yanchor 0.0 xanchor 0.0 rotate None zoom 1.0
|
||||
|
@ -149,35 +62,81 @@ label chapter_select:
|
|||
scene black
|
||||
with dissolve
|
||||
|
||||
jump chapter_select_go_back # Technically we don't need to explicitly jump to the label just below here, but doing so anyway for clarity
|
||||
|
||||
label chapter_select_go_back:
|
||||
|
||||
menu:
|
||||
"What ending do you want to lock to?"
|
||||
|
||||
"Ending 1":
|
||||
pass # Since points are already initialized at 0
|
||||
$ ending_route_number = 1
|
||||
"Ending 2":
|
||||
# anon 0
|
||||
$ fang_points = 4
|
||||
$ ending_route_number = 2
|
||||
"Ending 3":
|
||||
$ anon_points = 4
|
||||
# fang 0
|
||||
$ ending_route_number = 3
|
||||
"Ending 4":
|
||||
$ anon_points = 4
|
||||
$ fang_points = 4
|
||||
$ wingStory = True
|
||||
$ ending_route_number = 4
|
||||
"Exit to main menu":
|
||||
scene black with dissolve
|
||||
return
|
||||
|
||||
$ set_scores(anon_points, fang_points)
|
||||
$ ending_route_number = get_ending()
|
||||
|
||||
$ 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
|
||||
|
||||
$ select_chapter()
|
||||
|
||||
|
||||
init python:
|
||||
def select_chapter():
|
||||
global current_chapter, quick_menu, ending_route_number, chapter_list_index
|
||||
|
||||
ending_tuples = {
|
||||
1: ending_1_tuple,
|
||||
2: ending_2_tuple,
|
||||
3: ending_3_tuple,
|
||||
4: ending_4_tuple
|
||||
}
|
||||
|
||||
# Chapter list to select from
|
||||
chapter_tuples = chapter_tuple + ending_tuples{ending_route_number}
|
||||
|
||||
# Vars for displaying the choices
|
||||
chapters_per_page = 6
|
||||
current_page = 0
|
||||
|
||||
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_tupless[start_index:end_index] + [("Next Page", "next_page"), ("Go Back", "chapter_select_go_back")])
|
||||
|
||||
if selected_tuple == "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)
|
||||
|
||||
start_index = chapters_per_page * current_page
|
||||
end_index = min(start_index + chapters_per_page, len(chapter_tuples))
|
||||
|
||||
elif selected_tuple == "chapter_select_go_back":
|
||||
renpy.jump(chapter_select_go_back)
|
||||
|
||||
else:
|
||||
break # We've selected a chapter
|
||||
|
||||
chapter_list += ending_routes{ending_route_number} # Actual chapter list for the game to run
|
||||
current_chapter = selected_tuple
|
||||
|
||||
# Find the index position of the selected chapter
|
||||
try:
|
||||
chapter_list_index = chapter_list.index(current_chapter)
|
||||
except ValueError: # This crashes the game otherwise since it wouldn't find the correct chapter
|
||||
MainMenu(confirm=False) () # Exits to the main menu
|
||||
|
||||
|
||||
# Start playing the game
|
||||
toggle_debug()
|
||||
quick_menu = True # Restores the bottom quick menu UI
|
||||
|
||||
renpy.call(current_chapter)
|
|
@ -23,6 +23,5 @@ default chapter_list_length = get_chapter_list_length()
|
|||
default chapter_list_index = 0 # Index number for the current position of the chapter_list array
|
||||
default current_chapter = chapter_list[chapter_list_index] # Store the name of the label as a string
|
||||
|
||||
# Ending variables
|
||||
# What ending we're on
|
||||
default ending_route_number = None # A value of None signals to get_ending() to determine the value based off anon/fang scores when it is called
|
||||
default is_end_reached = False
|
||||
|
|
|
@ -13,54 +13,30 @@ init -1 python:
|
|||
|
||||
init python:
|
||||
def next_story_chapter():
|
||||
global chapter_list_index, current_chapter
|
||||
global chapter_list_index, current_chapter, chapter_list, ending_route_number, is_end_reached, chapter_list_length
|
||||
|
||||
# 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 chapter_list_index >= chapter_list_length:
|
||||
process_ending()
|
||||
# Add ending chapters
|
||||
ending_route_number = get_ending()
|
||||
if route_number in ending_routes:
|
||||
chapter_list.extend(ending_routes[ending_route_number])
|
||||
|
||||
# Updates variables for newly extended 'chapter_list' with ending chapters
|
||||
chapter_list_length = len(chapter_list) - 1 # chapter_list_length is updated to reflect the addition to the chapter_list array
|
||||
is_end_reached = True
|
||||
|
||||
|
||||
if chapter_list_index < chapter_list_length:
|
||||
chapter_list_index += 1
|
||||
current_chapter = chapter_list[chapter_list_index]
|
||||
renpy.call(current_chapter)
|
||||
|
||||
# We're at an ending
|
||||
else:
|
||||
end_story()
|
||||
|
||||
|
||||
def process_ending():
|
||||
global ending_route_number
|
||||
|
||||
ending_route_number = get_ending()
|
||||
add_ending_chapters(ending_route_number)
|
||||
update_ending_variables() # Updates variables for newly extended 'chapter_list' with ending chapters
|
||||
|
||||
|
||||
def add_ending_chapters(route_number):
|
||||
global chapter_list
|
||||
|
||||
if route_number in ending_routes:
|
||||
chapter_list.extend(ending_routes[route_number])
|
||||
|
||||
|
||||
def update_ending_variables():
|
||||
global chapter_list_length
|
||||
global is_end_reached
|
||||
|
||||
# chapter_list_length is updated to reflect the addition to the chapter_list array
|
||||
chapter_list_length = get_chapter_list_length()
|
||||
is_end_reached = True
|
||||
|
||||
|
||||
def get_chapter_list_length():
|
||||
return len(chapter_list) - 1
|
||||
|
||||
|
||||
def end_story():
|
||||
ending_image()
|
||||
|
||||
if ending_route_number == 1:
|
||||
renpy.quit()
|
||||
else:
|
||||
renpy.call("lending")
|
||||
|
||||
ending_image()
|
||||
|
||||
if ending_route_number == 1:
|
||||
renpy.quit()
|
||||
else:
|
||||
renpy.call("lending")
|
||||
|
|
Loading…
Reference in a new issue