core: Ignore newer PlaceObject tag in same frame with duplicate depth

If we have two PlaceObject tags in the same frame with the same depth,
only the first one actually places an object. The second one is ignored
(Flash Player logs a warning).
This commit is contained in:
Aaron Hill 2023-06-06 08:56:35 -05:00
parent d037038170
commit 0d5ead4c02
7 changed files with 38 additions and 1 deletions

View File

@ -4439,7 +4439,12 @@ impl QueuedTagList {
fn queue_add(&mut self, add_tag: QueuedTag) {
let new = match self {
QueuedTagList::None => QueuedTagList::Add(add_tag),
QueuedTagList::Add(_) => QueuedTagList::Add(add_tag),
QueuedTagList::Add(existing) => {
// Flash player traces "Warning: Failed to place object at depth 1.",
// so let's log a warning too.
tracing::warn!("Ignoring queued tag {add_tag:?} at same depth as {existing:?}");
QueuedTagList::Add(*existing)
}
QueuedTagList::Remove(r) => QueuedTagList::RemoveThenAdd(*r, add_tag),
QueuedTagList::RemoveThenAdd(r, _) => QueuedTagList::RemoveThenAdd(*r, add_tag),
};

View File

@ -0,0 +1,14 @@
package {
import flash.display.MovieClip;
public class FirstChild extends MovieClip {
public function FirstChild() {
trace("Constructed FirstChild");
}
}
}

View File

@ -0,0 +1,14 @@
package {
import flash.display.MovieClip;
public class SecondChild extends MovieClip {
public function SecondChild() {
trace("Constructed SecondChild")
}
}
}

View File

@ -0,0 +1 @@
Constructed FirstChild

Binary file not shown.

View File

@ -0,0 +1,3 @@
# NOTE - test.swf is manually edited to have two PlaceObject tags
# in the same frame with the same depth
num_frames = 1