Add new (key)frame.

Button add to stage fix.
getCharacters sync fix
This commit is contained in:
Jindra Petřík
2024-10-29 16:55:43 +01:00
parent 875b9c17d3
commit c43769410c
11 changed files with 604 additions and 113 deletions
@@ -952,8 +952,10 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
* @return Character id to character map
*/
public Map<Integer, CharacterTag> getCharacters(boolean withImported) {
Map<Integer, CharacterTag> newCharacters = characters;
Map<Integer, CharacterTag> newCharactersWithImported = charactersWithImported;
synchronized (charactersLock) {
if (characters == null || charactersWithImported == null) {
if (newCharacters == null || newCharactersWithImported == null) {
if (destroyed) {
return new HashMap<>();
}
@@ -988,14 +990,16 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
}
}
characters = Collections.unmodifiableMap(chars);
charactersWithImported = Collections.unmodifiableMap(charsWithImported);
newCharacters = Collections.unmodifiableMap(chars);
newCharactersWithImported = Collections.unmodifiableMap(charsWithImported);
characters = newCharacters;
charactersWithImported = newCharactersWithImported;
characterToId = Collections.unmodifiableMap(charToId);
characterIdTags = Collections.unmodifiableMap(charIdtags);
externalImages2 = Collections.unmodifiableMap(eimages);
}
return withImported ? charactersWithImported : characters;
return withImported ? newCharactersWithImported : newCharacters;
}
}
@@ -64,7 +64,7 @@ public abstract class ButtonTag extends DrawableTag implements Timelined {
*/
public static int FRAME_HITTEST = 3;
private Timeline timeline;
private transient Timeline timeline;
private boolean isSingleFrameInitialized;
@@ -28,12 +28,13 @@ import java.util.List;
public class TweenDetector {
public static List<TweenRange> detectRanges(List<DepthState> depthStates) {
return new ArrayList<>();
//TODO: make this working :-(
if (depthStates.size() < 2 || depthStates.get(0).placeObjectTag == depthStates.get(1).placeObjectTag) {
/*if (depthStates.size() < 2 || depthStates.get(0).placeObjectTag == depthStates.get(1).placeObjectTag) {
return new ArrayList<>();
}
return new ArrayList<>(Arrays.asList(new TweenRange(0, depthStates.size() - 1)));
return new ArrayList<>(Arrays.asList(new TweenRange(0, depthStates.size() - 1)));*/
/*
List<TweenRange> ret = new ArrayList<>();