Skip to content

core: Register character 0 with library in Loader #16426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Aaron1011
Copy link
Member

This allows ActionScript code to instantiate the AVM2 class for the root MovieClip of a loaded movie. This instance will have its frames run, including timeline-placed children.

We now store avm2_class in MovieClipStatic, so that processing a SymbolClass tag from a loaded MovieClip will update the class used by the MovieClip stored in the Library.

Fixes #14639

This allows ActionScript code to instantiate the AVM2 class
for the root MovieClip of a loaded movie. This instance will
have its frames run, including timeline-placed children.

We now store `avm2_class` in `MovieClipStatic`, so that processing
a `SymbolClass` tag from a loaded MovieClip will update the class
used by the MovieClip stored in the Library.
@Lord-McSweeney
Copy link
Collaborator

Lord-McSweeney commented May 22, 2024

This is technically wrong- the root MovieClip of a loaded movie doesn't always have to be registered under character id #0 (see #12823)- it only has to be registered under a character id that no other character claims. Can the registration logic in loader.rs not hard-code id #0 as the character id that the root MC is registered under?

@Aaron1011
Copy link
Member Author

Are you sure? SymbolClass only links the AVM2 class name with a sprite id. Registering the loaded clip as character 0 will only have an effect if there's an explicit SymbolClass referencing character 0.

@Lord-McSweeney
Copy link
Collaborator

The code is all correct, for our current implementation. However, FP allows linking the root MovieClip with a character id other than 0. If we fix that bug (like the PR I linked does), we'll also need to update this logic:

                    library.register_character(
                        0,
                        // Use 'instantiate' to clone movie clip data, so future instantiations
                        // don't reflect changes made to the loaded main timeline instance.
                        Character::MovieClip(mc.instantiate(gc_context).as_movie_clip().unwrap()),
                    );

to use the correct character id instead of always using character id 0.

@danielhjacobs danielhjacobs added A-core Area: Core player, where no other category fits T-fix Type: Bug fix (in something that's supposed to work already) labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core player, where no other category fits T-fix Type: Bug fix (in something that's supposed to work already)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

King's Island - White Screen after Play
3 participants