Compare commits

...

5 Commits

Author SHA1 Message Date
0fbff1b81b Code optimizations 2024-08-22 23:18:23 -03:00
84ccfc1b13 Add improved chapter_selection 2024-08-22 22:13:00 -03:00
b65ed32b14 Remove redundant 'initstats' label 2024-08-22 22:04:44 -03:00
c5ea9c9cb5 Move chapter related variables to new file 2024-08-22 22:03:50 -03:00
993824e152 Mode chapter_select into "src" folder 2024-08-22 19:27:44 -03:00
5 changed files with 92 additions and 67 deletions

View File

@ -0,0 +1,27 @@
# Store the general chapters inside an array for easy manipulation
default chapter_list = [
"chapter_1", "chapter_2", "chapter_3", "chapter_4", "chapter_5",
"chapter_6", "chapter_7", "chapter_8", "chapter_9", "chapter_10", "chapter_11"
]
define ending_routes = {
4: ["chapter_11D", "chapter_12D", "chapter_12_5D", "chapter_13D", "chapter_14D"],
3: ["chapter_11C", "chapter_12C", "chapter_12_5C", "chapter_13C", "chapter_14C"],
2: ["chapter_11B", "chapter_12B", "chapter_13B", "chapter_14B"],
1: ["chapter_11A", "chapter_12A", "chapter_12_5D", "chapter_13A", "chapter_14A"]
}
# Anon/Fang
default anonscore = 0
default fangscore = 0
default wingStory = False
default lock_scores = False # Allows points to be increased
# Chapter variables
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
default ending_route_number = None
default is_end_reached = False

View File

@ -323,7 +323,7 @@ transform scloserleft:
label start:
call initstats(anon = 0, fang = 0) from _call_initstats
$ toggle_debug()
pause 1.0

View File

@ -26,30 +26,50 @@ default selected_tuple = None
init python:
def select_chapter():
global selected_tuple, current_chapter
global selected_tuple, current_chapter, is_end_reached
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":
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":
continue
else:
break
set_stats()
toggle_debug()
renpy.call(current_chapter)
def display_tuple_menu(options):
return renpy.display_menu(options + [("Go Back", "go_back")])
def set_stats():
global chapter_list_length, chapter_list_index, ending_route_number, is_end_reached
global chapter_list_length, ending_route_number, is_end_reached, lock_scores
chapter_list_length = len(chapter_list) - 1
# chapter_list_length = get_chapter_list_length()
ending_route_number = get_ending()
lock_scores = True # Prevents scores from increasing when using the chapter selection tool
find_chapter_in_array()
if not is_end_reached:
add_ending_chapters() # From storyline
update_ending_variables() # From storyline
renpy.call(current_chapter)
def set_scores(anon_score, fang_score):
global anonscore, fangscore
anonscore = anon_score
fangscore = fang_score
def find_chapter_in_array():
@ -62,36 +82,41 @@ init python:
current_chapter = ""
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"
]
return
label chapter_select:
scene black
stop sound
stop music
stop music fadeout 2
scene black with dissolve
menu:
"Initialize scores:"
"Ending 1":
$ anon_score = 0
$ fang_score = 0
$ ending_route_number = 1
$ set_scores(0, 0)
"Ending 2":
$ anon_score = 0
$ fang_score = 4
$ ending_route_number = 2
$ set_scores(0, 4)
"Ending 3":
$ anon_score = 4
$ fang_score = 0
$ ending_route_number = 3
$ set_scores(4, 0)
"Ending 4":
$ anon_score = 4
$ fang_score = 4
$ ending_route_number = 4
$ set_scores(4, 4)
"Exit to main menu":
scene black with dissolve
return
$ lock_scores = True
call initstats(anon_score, fang_score) from _call_initstats_2
$ is_end_reached = False # Reset this for when the tool is used more than once
window hide
if not is_end_reached:
call reset_chapter_list from _call_reset_chapter_list
$ select_chapter()

View File

@ -1,26 +1,3 @@
# Store the general chapters inside an array for easy manipulation
default chapter_list = [
"chapter_1", "chapter_2", "chapter_3", "chapter_4", "chapter_5",
"chapter_6", "chapter_7", "chapter_8", "chapter_9", "chapter_10", "chapter_11"
]
define ending_routes = {
4: ["chapter_11D", "chapter_12D", "chapter_12_5D", "chapter_13D", "chapter_14D"],
3: ["chapter_11C", "chapter_12C", "chapter_12_5C", "chapter_13C", "chapter_14C"],
2: ["chapter_11B", "chapter_12B", "chapter_13B", "chapter_14B"],
1: ["chapter_11A", "chapter_12A", "chapter_12_5D", "chapter_13A", "chapter_14A"]
}
# Chapter related variables
default chapter_list_length = len(chapter_list) - 1
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 related variables
default ending_route_number = None
default is_end_reached = False # consider moving variables out of here
init -1 python:
def ending_image():
#0b0000, DCBA, flash the bits with |=, check with &
@ -35,7 +12,7 @@ init -1 python:
init python:
# test comment
def next_story_chapter():
global chapter_list_index, current_chapter, ending_route_number
@ -67,7 +44,7 @@ init python:
global chapter_list
if ending_route_number in ending_routes:
chapter_list.extend(ending_routes[ending_route_number])
chapter_list.extend(ending_routes[ending_route_number])
def update_ending_variables():
@ -75,10 +52,15 @@ init python:
global is_end_reached
# chapter_list_length is updated to reflect the addition to the chapter_list array
chapter_list_length = len(chapter_list) - 1
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()
renpy.call("lending")

View File

@ -1,21 +1,5 @@
## Utility functions for game setup, debugging etc.
label initstats(anon=0, fang=0):
# Sets various game-related global variables
# :param int anon: Anon's score
# :param int fang: Fang's score
# :param bool trad: Tradwife ending flag
$ anonscore = anon
$ fangscore = fang
$ wingStory = False
if persistent.enable_debug_scores:
$ debug_story_variables(False)
$ debug_story_variables(True)
return
init python:
def get_ending():
if anonscore >= 4 and fangscore >= 4 and wingStory:
@ -35,7 +19,8 @@ init python:
"current_chapter",
"chapter_list_length",
"chapter_list_index",
"ending_route_number"
"ending_route_number",
"is_end_reached"
]
for item in var_list:
@ -58,4 +43,10 @@ init python:
if not lock_scores:
fangscore += 1
def toggle_debug():
if persistent.enable_debug_scores:
debug_story_variables(False)
debug_story_variables(True)