This commit is contained in:
+47
-2
@@ -4,15 +4,60 @@ label start:
|
||||
jump arrival
|
||||
|
||||
|
||||
# ── Rewind mechanic (shared across all scripts) ──────────────────────────────
|
||||
# Where the next rewind lands. Set this at every checkpoint you create.
|
||||
default checkpoint = None
|
||||
|
||||
# Optional: a list of $-statements to run when rewinding (reset flags, etc.).
|
||||
# Kept separate from `checkpoint` so the destination label stays a plain string.
|
||||
default rewind_reset = []
|
||||
|
||||
# Plays the shared rewind effect, then returns to `destination`.
|
||||
# Uses `call` (not `jump`) so it is re-entrant: rewinding to a label that is
|
||||
# already on the call stack (e.g. back to a choice mid-spar) returns cleanly
|
||||
# to the caller instead of corrupting the stack.
|
||||
# Call as: call rewind_to .some_label
|
||||
label rewind_to(destination):
|
||||
scene black
|
||||
with dissolve
|
||||
show screen teal_wash
|
||||
"The world pulls back."
|
||||
"Colour drains to teal. Sound slows to nothing."
|
||||
hide screen teal_wash
|
||||
scene black
|
||||
with dissolve
|
||||
# Run any per-checkpoint reset statements (e.g. $ rewind_used = False)
|
||||
for _stmt in rewind_reset:
|
||||
$ eval(_stmt)
|
||||
call destination
|
||||
|
||||
|
||||
# ── Screens ───────────────────────────────────────────────────────────────────
|
||||
|
||||
# Shared rewind prompt. "Rewind" jumps to .do_rewind, which reads the
|
||||
# current `checkpoint` and routes through the reusable rewind_to label.
|
||||
# "Continue" just hides the screen and lets the calling script resume.
|
||||
screen rewind_prompt():
|
||||
zorder 10
|
||||
text "Rewind available":
|
||||
textbutton "⟲ Rewind" action Jump(".do_rewind"):
|
||||
xalign 0.05
|
||||
yalign 0.95
|
||||
color "#4ab8b8"
|
||||
size 22
|
||||
color "#4ab8b8"
|
||||
textbutton "Continue" action Hide("rewind_prompt"):
|
||||
xalign 0.05
|
||||
xoffset 120
|
||||
yalign 0.95
|
||||
size 22
|
||||
color "#4ab8b8"
|
||||
|
||||
# Reads the stored checkpoint and rewinds to it.
|
||||
label .do_rewind:
|
||||
hide screen rewind_prompt
|
||||
if checkpoint is None:
|
||||
# No checkpoint set — just resume.
|
||||
return
|
||||
call rewind_to checkpoint
|
||||
|
||||
screen teal_wash():
|
||||
zorder 20
|
||||
|
||||
Reference in New Issue
Block a user