mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-06 07:27:15 +00:00
small improvements
This commit is contained in:
@@ -440,6 +440,21 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return characterIdTags.get(characterId);
|
||||
}
|
||||
|
||||
public CharacterIdTag getCharacterIdTag(int characterId, int tagId) {
|
||||
List<CharacterIdTag> characterIdTags = getCharacterIdTags(characterId);
|
||||
if (characterIdTags != null) {
|
||||
for (CharacterIdTag t : characterIdTags) {
|
||||
if (((Tag) t).getId() == tagId) {
|
||||
if (t.getCharacterId() == characterId) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<Integer, Set<Integer>> getDependentCharacters() {
|
||||
if (dependentCharacters == null) {
|
||||
synchronized (this) {
|
||||
|
||||
@@ -233,13 +233,8 @@ public class DefineButtonTag extends ButtonTag implements ASMSourceContainer {
|
||||
|
||||
@Override
|
||||
protected void initTimeline(Timeline timeline) {
|
||||
ColorTransform clrTrans = null;
|
||||
for (Tag t : swf.getTags()) {
|
||||
if (t instanceof DefineButtonCxformTag) {
|
||||
DefineButtonCxformTag cx = (DefineButtonCxformTag) t;
|
||||
clrTrans = cx.buttonColorTransform;
|
||||
}
|
||||
}
|
||||
DefineButtonCxformTag cxformTag = (DefineButtonCxformTag) swf.getCharacterIdTag(buttonId, DefineButtonCxformTag.ID);
|
||||
ColorTransform clrTrans = cxformTag == null ? null : cxformTag.buttonColorTransform;
|
||||
int maxDepth = 0;
|
||||
Frame frameUp = new Frame(timeline, 0);
|
||||
Frame frameDown = new Frame(timeline, 0);
|
||||
|
||||
@@ -102,19 +102,7 @@ public abstract class ButtonTag extends CharacterTag implements DrawableTag, Tim
|
||||
}
|
||||
|
||||
public DefineButtonSoundTag getSounds() {
|
||||
List<CharacterIdTag> characterIdTags = swf.getCharacterIdTags(getCharacterId());
|
||||
if (characterIdTags != null) {
|
||||
for (CharacterIdTag t : characterIdTags) {
|
||||
if (t instanceof DefineButtonSoundTag) {
|
||||
DefineButtonSoundTag st = (DefineButtonSoundTag) t;
|
||||
if (st.buttonId == getCharacterId()) {
|
||||
return st;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return (DefineButtonSoundTag) swf.getCharacterIdTag(getCharacterId(), DefineButtonSoundTag.ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.tags.DefineScalingGridTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -78,12 +77,6 @@ public abstract class CharacterTag extends Tag implements CharacterIdTag {
|
||||
}
|
||||
|
||||
public DefineScalingGridTag getScalingGridTag() {
|
||||
List<CharacterIdTag> mtags = swf.getCharacterIdTags(getCharacterId());
|
||||
for (CharacterIdTag ct : mtags) {
|
||||
if (ct instanceof DefineScalingGridTag) {
|
||||
return (DefineScalingGridTag) ct;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return (DefineScalingGridTag) swf.getCharacterIdTag(getCharacterId(), DefineScalingGridTag.ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1064,13 +1064,9 @@ public class XFLConverter {
|
||||
}
|
||||
if (tag instanceof DefineButtonTag) {
|
||||
DefineButtonTag bt = (DefineButtonTag) tag;
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof DefineButtonCxformTag) {
|
||||
DefineButtonCxformTag bcx = (DefineButtonCxformTag) t;
|
||||
if (bcx.buttonId == bt.buttonId) {
|
||||
colorTransform = bcx.buttonColorTransform;
|
||||
}
|
||||
}
|
||||
DefineButtonCxformTag bcx = (DefineButtonCxformTag) bt.getSwf().getCharacterIdTag(bt.buttonId, DefineButtonCxformTag.ID);
|
||||
if (bcx != null) {
|
||||
colorTransform = bcx.buttonColorTransform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2098,16 +2094,11 @@ public class XFLConverter {
|
||||
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof FontTag) {
|
||||
SWF swf = t.getSwf();
|
||||
FontTag font = (FontTag) t;
|
||||
int fontId = font.getFontId();
|
||||
String fontName = null;
|
||||
for (Tag t2 : tags) {
|
||||
if (t2 instanceof DefineFontNameTag) {
|
||||
if (((DefineFontNameTag) t2).fontId == fontId) {
|
||||
fontName = ((DefineFontNameTag) t2).fontName;
|
||||
}
|
||||
}
|
||||
}
|
||||
DefineFontNameTag fontNameTag = (DefineFontNameTag) swf.getCharacterIdTag(fontId, DefineFontNameTag.ID);
|
||||
String fontName = fontNameTag == null ? null : fontNameTag.fontName;
|
||||
if (fontName == null) {
|
||||
fontName = font.getFontNameIntag();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user