move all non-default renpy scripts into src

This commit is contained in:
2024-10-01 17:17:59 -05:00
parent cebabce278
commit 99997a4204
3 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
# 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
# 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

66
game/src/storyline.rpy Normal file
View File

@@ -0,0 +1,66 @@
init -1 python:
def ending_image():
#0b0000, DCBA, flash the bits with |=, check with &
endings = 0b0000
_e = 0b1
for i in range(1, 5):
fn = "e"+str(i)+"of4"
endings |= (_e * renpy.seen_image(fn))
_e = _e << 0b1
persistent.old_endings = persistent.endings
persistent.endings = endings
init python:
def next_story_chapter():
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 chapter_list_index >= chapter_list_length:
process_ending()
if chapter_list_index < chapter_list_length:
chapter_list_index += 1
current_chapter = chapter_list[chapter_list_index]
renpy.call(current_chapter)
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")

38
game/src/utility.rpy Normal file
View File

@@ -0,0 +1,38 @@
## Utility functions for game setup, debugging etc.
init python:
def get_ending():
if anonscore >= 4 and fangscore >= 4 and wingStory:
return 4 # Golden
elif anonscore >= 3 and fangscore <= 4:
return 3 # Tradwife
elif anonscore <= 3 and fangscore >= 3:
return 2 # Doomer
else:
return 1 # Shooter
def debug_story_variables(toggle=True):
var_list = [
"anonscore",
"fangscore",
"current_chapter",
"chapter_list_length",
"chapter_list_index",
"ending_route_number",
"is_end_reached"
]
for item in var_list:
if toggle:
renpy.watch(item)
else:
renpy.unwatch(item)
def toggle_debug():
if persistent.enable_debug_scores:
debug_story_variables(False)
debug_story_variables(True)