Use the depth to indicate which layer a particular root clip is, and then use that to calculate it's `_leveln` path.
This commit is contained in:
parent
8ef759d377
commit
00f88f9e87
|
@ -951,6 +951,7 @@ impl<'gc> Avm1<'gc> {
|
|||
MovieClip::new(NEWEST_PLAYER_VERSION, context.gc_context).into();
|
||||
|
||||
layer.post_instantiation(context.gc_context, layer, self.prototypes.movie_clip);
|
||||
layer.set_depth(context.gc_context, level_id as i32);
|
||||
context.layers.insert(level_id, layer);
|
||||
|
||||
layer
|
||||
|
|
|
@ -588,6 +588,7 @@ mod tests {
|
|||
let swf = Arc::new(SwfMovie::empty(swf_version));
|
||||
let mut root: DisplayObject<'_> = MovieClip::new(swf_version, gc_context).into();
|
||||
root.post_instantiation(gc_context, root, avm.prototypes().movie_clip);
|
||||
root.set_depth(gc_context, 0);
|
||||
let mut layers = BTreeMap::new();
|
||||
layers.insert(0, root);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ where
|
|||
let swf = Arc::new(SwfMovie::empty(swf_version));
|
||||
let mut root: DisplayObject<'_> = MovieClip::new(swf_version, gc_context).into();
|
||||
root.post_instantiation(gc_context, root, avm.prototypes().movie_clip);
|
||||
root.set_depth(gc_context, 0);
|
||||
let mut layers = BTreeMap::new();
|
||||
layers.insert(0, root);
|
||||
|
||||
|
|
|
@ -581,8 +581,7 @@ pub trait TDisplayObject<'gc>: 'gc + Collect + Debug + Into<DisplayObject<'gc>>
|
|||
path.push_str(&*self.name());
|
||||
path
|
||||
} else {
|
||||
// TODO: Get the actual level # from somewhere.
|
||||
"_level0".to_string()
|
||||
format!("_level{}", self.depth())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -235,6 +235,7 @@ impl Player {
|
|||
|
||||
for (_i, layer) in root_data.layers.iter_mut() {
|
||||
layer.post_instantiation(gc_context, *layer, mc_proto);
|
||||
layer.set_depth(gc_context, 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue