From 6a75bc5a6bb5e024a1bb7d14dba6d39166365f36 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 15 Feb 2026 09:12:03 +0900 Subject: [PATCH] flash: reset playback state in PE_BackPartsFlashBeginFrame This fixes a bug in Pastel Chime 3 where message progression would hang because the Flash animation failed to resume playback after being reset. --- src/parts/flash.c | 10 ++++++---- src/parts/parts_internal.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/parts/flash.c b/src/parts/flash.c index b5752ad..1e5fb69 100644 --- a/src/parts/flash.c +++ b/src/parts/flash.c @@ -88,6 +88,7 @@ bool parts_flash_load(struct parts *parts, struct parts_flash *f, struct string f->name = string_dup(filename); f->tag = f->swf->tags; + f->has_ended = false; f->stopped = false; f->elapsed = 0; f->current_frame = 0; @@ -128,10 +129,10 @@ static int do_action(struct parts_flash *f, struct swf_tag_do_action *tag) for (struct swf_action *a = tag->actions; a->code != ACTION_END; a = a->next) { switch (a->code) { case ACTION_PLAY: - f->stopped = false; + f->has_ended = false; break; case ACTION_STOP: - f->stopped = true; + f->has_ended = true; break; case ACTION_GOTO_FRAME: seek_frame = ((struct swf_action_goto_frame*)a)->frame; @@ -328,7 +329,7 @@ bool parts_flash_seek(struct parts_flash *f, int frame) // Do nothing. break; case TAG_END: - f->stopped = true; + f->has_ended = true; break; case TAG_SHOW_FRAME: f->current_frame++; @@ -371,7 +372,7 @@ bool parts_flash_seek(struct parts_flash *f, int frame) bool parts_flash_update(struct parts_flash *f, int passed_time) { - if (!f->swf || f->stopped) + if (!f->swf || f->has_ended || f->stopped) return false; f->elapsed += passed_time; int delta_frame = muldiv(f->elapsed, f->swf->frame_rate, 256000); @@ -425,6 +426,7 @@ bool PE_BackPartsFlashBeginFrame(int parts_no, int state) struct parts_flash *f = parts_get_flash(parts, state); if (!f->swf) return false; + f->has_ended = false; if (parts_flash_seek(f, 1)) parts_dirty(parts); f->elapsed = 0; diff --git a/src/parts/parts_internal.h b/src/parts/parts_internal.h index 4e51b85..760f6a1 100644 --- a/src/parts/parts_internal.h +++ b/src/parts/parts_internal.h @@ -266,6 +266,7 @@ struct parts_flash { struct swf *swf; struct swf_tag *tag; + bool has_ended; bool stopped; unsigned elapsed; int current_frame;