Skip to content

Commit

Permalink
Adjust behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 authored and adrian17 committed Sep 23, 2023
1 parent bb4410e commit c20b7b3
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions core/src/frame_lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c20b7b3

Please sign in to comment.