Adjust behavior

This commit is contained in:
Aaron Hill 2023-08-14 19:19:32 -04:00 committed by Adrian Wielgosik
parent bb4410e387
commit c20b7b37fe
1 changed files with 12 additions and 10 deletions

View File

@ -121,22 +121,24 @@ pub fn run_inner_goto_frame<'gc>(
initial_clip: MovieClip<'gc>,
) {
if initial_clip.swf_version() <= 9 {
// This is a hack to make sure that we we run `construct_frame`
// and `frame_constructed` for the frame targeted by our goto.
// It's good enough to get several SWFs working, but we need to
// do a deeper refactor of framescript execution in order for this
// to be correct.
if initial_clip.playing() {
initial_clip
.base_mut(context.gc_context)
.set_skip_next_enter_frame(true);
}
avm2_stub_method_context!(
context,
"flash.display.MovieClip",
"goto",
"with SWF 9 movie"
);
// Note - this runs `construct_frame` at the wrong time - testing shows that
// clips in the target frame get constructed at some point *after* the
// call to `gotoAndStop/gotoAndPlay` returns. However, I suspect that this is related
// to the very odd framescript behavior in SWF 9 gotos (the *same* framescript can run twice
// in a row). For now, this is enough to get several games working.
initial_clip.construct_frame(context);
// We skip the next `enter_frame` call, so that we will still run the framescripts
// queued for our target frame.
initial_clip
.base_mut(context.gc_context)
.set_skip_next_enter_frame(true);
return;
}