2021-09-23 01:06:37 +02:00
|
|
|
init -1 python:
|
2021-09-23 00:39:56 +02:00
|
|
|
def ending_image():
|
2021-10-14 21:17:08 +02:00
|
|
|
#0b0000, DCBA, flash the bits with |=, check with &
|
2021-09-23 00:39:56 +02:00
|
|
|
endings = 0b0000
|
|
|
|
_e = 0b1
|
|
|
|
for i in range(1, 5):
|
2021-10-14 21:17:08 +02:00
|
|
|
fn = "e"+str(i)+"of4"
|
2021-09-23 00:39:56 +02:00
|
|
|
endings |= (_e * renpy.seen_image(fn))
|
|
|
|
_e = _e << 0b1
|
2021-10-16 19:25:12 +02:00
|
|
|
persistent.old_endings = persistent.endings
|
2021-09-23 00:39:56 +02:00
|
|
|
persistent.endings = endings
|
|
|
|
|
2024-08-09 00:19:48 +02:00
|
|
|
|
|
|
|
init python:
|
|
|
|
def next_story_chapter():
|
2024-08-19 03:25:53 +02:00
|
|
|
global chapter_list_index, current_chapter, ending_route_number
|
2024-08-09 00:19:48 +02:00
|
|
|
|
2024-08-19 03:25:53 +02:00
|
|
|
# Add check "is_end_reached" to have this if statement be executed only once when finishing the general chapters
|
2024-08-30 19:40:28 +02:00
|
|
|
if not is_end_reached and chapter_list_index >= chapter_list_length:
|
2024-08-19 03:25:53 +02:00
|
|
|
process_ending()
|
2024-08-19 02:06:13 +02:00
|
|
|
|
2024-08-19 03:25:53 +02:00
|
|
|
if chapter_list_index < chapter_list_length:
|
|
|
|
chapter_list_index += 1
|
|
|
|
current_chapter = chapter_list[chapter_list_index]
|
|
|
|
renpy.call(current_chapter)
|
2024-08-19 02:06:13 +02:00
|
|
|
else:
|
2024-08-19 03:25:53 +02:00
|
|
|
end_story()
|
|
|
|
|
|
|
|
|
|
|
|
def process_ending():
|
|
|
|
global ending_route_number
|
|
|
|
|
|
|
|
ending_route_number = get_ending()
|
|
|
|
add_ending_chapters()
|
|
|
|
update_ending_variables()
|
2024-08-09 00:19:48 +02:00
|
|
|
|
|
|
|
|
2024-08-19 02:06:13 +02:00
|
|
|
def add_ending_chapters():
|
2024-08-19 03:25:53 +02:00
|
|
|
global chapter_list
|
2024-08-19 02:06:13 +02:00
|
|
|
|
|
|
|
if ending_route_number in ending_routes:
|
2024-08-23 03:13:00 +02:00
|
|
|
chapter_list.extend(ending_routes[ending_route_number])
|
2024-08-19 03:25:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2024-08-23 03:13:00 +02:00
|
|
|
chapter_list_length = get_chapter_list_length()
|
2024-08-19 03:25:53 +02:00
|
|
|
is_end_reached = True
|
2024-08-19 02:06:13 +02:00
|
|
|
|
2024-08-19 03:25:53 +02:00
|
|
|
|
2024-08-23 03:13:00 +02:00
|
|
|
def get_chapter_list_length():
|
|
|
|
return len(chapter_list) - 1
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-19 03:25:53 +02:00
|
|
|
def end_story():
|
|
|
|
ending_image()
|
|
|
|
renpy.call("lending")
|
2024-08-19 02:06:13 +02:00
|
|
|
|
2024-08-09 00:19:48 +02:00
|
|
|
|