replace with enums

This commit is contained in:
san7890 2023-05-06 15:37:44 -06:00
parent 9f7377a3eb
commit cc1d90d2a9
4 changed files with 24 additions and 21 deletions

View File

@ -449,7 +449,7 @@ label chapter_11:
# Doomer ending skips this segment
call get_ending from _call_get_ending
if _return == ENDING_DOOMER:
if _return == Endings.Doomer:
stop music fadeout 3
pause 2
jump lPromAnnouncement
@ -586,9 +586,9 @@ label chapter_11:
pause .5
call get_ending from _call_get_ending_1
if _return == ENDING_GOLDEN:
if _return == Endings.Golden:
jump lSortingThings
elif _return == ENDING_TRADWIFE:
elif _return == Endings.Tradwife:
jump lMendingThings
else:
jump lBreakingThings # All else fails, go to shooter.
@ -5212,7 +5212,7 @@ label chapter_11:
pause .5
call get_ending from _call_get_ending_2
if _return == ENDING_TRADWIFE:
if _return == Endings.Tradwife:
"Things are going pretty well. When we discount Trishs weekly attempt to talk with Fang."
@ -5467,7 +5467,7 @@ label chapter_11:
"{cps=*.1}...{/cps}"
call get_ending from _call_get_ending_3
if _return == ENDING_SHOOTER:
if _return == Endings.Shooter:
jump chapter_11A
return

View File

@ -219,7 +219,7 @@ image d_credits_text = Composite(
label lending:
call get_ending from _call_get_ending_4
$ cached_ending = _return # un-necessary to call this so many times
if cached_ending == ENDING_GOLDEN:
if cached_ending == Endings.Golden:
pause 0.5
show snootgame_big with dissolve: # Renpy not allowing you to grab images from the gui folder is serious bullshit
subpixel True
@ -249,7 +249,7 @@ label lending:
pause 50
queue music 'audio/OST/amberlight brillance live end.ogg'
queue music "<silence 1.0>" loop
elif cached_ending == ENDING_TRADWIFE:
elif cached_ending == Endings.Tradwife:
play music "audio/OST/Dino Destiny Reader.ogg"
pause 0.5
show c_credits_text:
@ -281,12 +281,12 @@ label lending:
stop music fadeout 5
scene black with Dissolve(3)
pause 2
if cached_ending == ENDING_TRADWIFE:
if cached_ending == Endings.Tradwife:
scene c10 with Dissolve(1.5)
pause 20
scene black with Dissolve(2)
pause 1
elif cached_ending == ENDING_GOLDEN:
elif cached_ending == Endings.Golden:
scene golden ending with Dissolve(1.5)
pause 20
scene black with Dissolve(2)

View File

@ -23,26 +23,26 @@ label storyline:
call chapter_10 from _call_chapter_10
call chapter_11 from _call_chapter_11
call get_ending from _call_get_ending_5
if _return == ENDING_GOLDEN:
if _return == Endings.Golden:
call chapter_11D from _call_chapter_11D
call chapter_12D from _call_chapter_12D
call chapter_12_5D from _call_chapter_12_5D
call chapter_13D from _call_chapter_13D
call chapter_14D from _call_chapter_14D
elif _return == ENDING_TRADWIFE:
elif _return == Endings.Tradwife:
$ tradwife = True
call chapter_11C from _call_chapter_11C
call chapter_12C from _call_chapter_12C
call chapter_12_5C from _call_chapter_12_5C
call chapter_13C from _call_chapter_13C
call chapter_14C from _call_chapter_14C
elif _return == ENDING_DOOMER:
elif _return == Endings.Doomer:
call chapter_11B from _call_chapter_11B
call chapter_12B from _call_chapter_12B
# no chapter_13 here since the scene is different enough to the other routes for everything to go into 13C
call chapter_13B from _call_chapter_13B
call chapter_14B from _call_chapter_14B
else: # ENDING_SHOOTER
else: # Endings.Shooter
call chapter_11A from _call_chapter_11A
call chapter_12A from _call_chapter_12A
call chapter_12_5D from _call_chapter_12_5D_1

View File

@ -1,11 +1,14 @@
## Utility functions for game setup, debugging etc.
init python:
from enum import Enum
# Create compile-time macros to more easily track what ending goes to what without the need for magic numbers or strings that can be mistyped
ENDING_GOLDEN = "golden"
ENDING_TRADWIFE = "tradwife"
ENDING_DOOMER = "doomer"
ENDING_SHOOTER = "shooter"
class Endings(Enum):
Shooter = 0
Doomer = 1
Tradwife = 2
Golden = 3
label initstats(anon=0, fang=0, trad=False):
# Sets various game-related global variables
@ -21,10 +24,10 @@ label get_ending:
# To check what ending we're getting, call this label and then check the value of _return
# Sensible to have this logic defined in only one place for consistency
if anonscore >= 4 and fangscore >= 4 and wingStory:
return(ENDING_GOLDEN)
return(Endings.Golden)
elif anonscore >= 3 and fangscore <=4:
return(ENDING_TRADWIFE)
return(Endings.Tradwife)
elif anonscore <= 3 and fangscore >=3:
return(ENDING_DOOMER)
return(Endings.Doomer)
else:
return(ENDING_SHOOTER)
return(Endings.Shooter)