Fixed: #2266 StartSound/2 and VideoFrame tags, classNames not taken as dependencies (needed chars)

This commit is contained in:
Jindra Petřík
2024-08-12 22:20:30 +02:00
parent 9ef2778411
commit 777716f1b9
6 changed files with 37 additions and 7 deletions

View File

@@ -373,13 +373,15 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
@Override
public void getNeededCharacters(Set<Integer> needed, SWF swf) {
for (Tag t : getTags()) {
if (t instanceof PlaceObjectTypeTag) {
int chId = ((PlaceObjectTypeTag) t).getCharacterId();
if (chId != -1) {
needed.add(chId);
}
}
for (Tag t : getTags()) {
if (
(t instanceof PlaceObjectTypeTag)
|| (t instanceof StartSoundTag)
|| (t instanceof StartSound2Tag)
|| (t instanceof VideoFrameTag)
) {
t.getNeededCharacters(needed, swf);
}
}
}

View File

@@ -482,6 +482,12 @@ public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceCont
if (placeFlagHasCharacter) {
needed.add(characterId);
}
if (placeFlagHasClassName) {
int chId = swf.getCharacterId(swf.getCharacterByClass(className));
if (chId != -1) {
needed.add(chId);
}
}
}
@Override

View File

@@ -503,6 +503,12 @@ public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceCont
if (placeFlagHasCharacter) {
needed.add(characterId);
}
if (placeFlagHasClassName) {
int chId = swf.getCharacterId(swf.getCharacterByClass(className));
if (chId != -1) {
needed.add(chId);
}
}
}
@Override

View File

@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
import com.jpexs.helpers.ByteArrayRange;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
/**
* StartSound2 tag - starts a sound playing. Extends functionality of StartSound
@@ -89,4 +90,10 @@ public class StartSound2Tag extends Tag {
ret.put("cls", "" + soundClassName);
return ret;
}
@Override
public void getNeededCharacters(Set<Integer> needed, SWF swf) {
int characterId = swf.getCharacterId(swf.getCharacterByClass(soundClassName));
needed.add(characterId);
}
}

View File

@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
import com.jpexs.helpers.ByteArrayRange;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
/**
* StartSound tag - starts a sound playing.
@@ -101,4 +102,9 @@ public class StartSoundTag extends Tag implements CharacterIdTag {
ret.put("cid", "" + soundId);
return ret;
}
@Override
public void getNeededCharacters(Set<Integer> needed, SWF swf) {
needed.add(soundId);
}
}