mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-08-02 15:22:44 +00:00
Fixed AS1/2 - stop/play/etc. can be used in expressions, pushing undefined
This commit is contained in:
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionCloneSprite;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -79,9 +81,15 @@ public class CloneSpriteActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, source, target, depth, new ActionCloneSprite(), new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, source, target, depth, new ActionCloneSprite());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasReturnValue() {
|
||||
return false;
|
||||
|
||||
@@ -21,6 +21,8 @@ import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionGetURL;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -54,11 +56,21 @@ public class FSCommandActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asg = (ActionSourceGenerator) generator;
|
||||
if ((command instanceof DirectValueActionItem) && ((DirectValueActionItem) command).isString()) {
|
||||
return toSourceMerge(localData, generator, new ActionGetURL("FSCommand:" + ((DirectValueActionItem) command).getAsString(), ""));
|
||||
}
|
||||
return toSourceMerge(localData, generator, new AddActionItem(null, null, asg.pushConstTargetItem("FSCommand:"), command, true), asg.pushConstTargetItem(""), new ActionGetURL2(1/*GET*/, false, false));
|
||||
return toSourceMerge(localData, generator, new AddActionItem(null, null, asg.pushConstTargetItem("FSCommand:"), command, true), asg.pushConstTargetItem(""), new ActionGetURL2(1/*GET*/, false, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -83,7 +85,16 @@ public class GetURL2ActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(sendVarsMethod, false, false));
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(sendVarsMethod, false, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionGotoFrame;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionPlay;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGotoFrame2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -84,10 +86,19 @@ public class GotoFrame2ActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
if (!sceneBiasFlag && (frame instanceof DirectValueActionItem) && (((DirectValueActionItem) frame).value instanceof Long)) {
|
||||
return toSourceMerge(localData, generator, new ActionGotoFrame((int) ((long) (Long) ((DirectValueActionItem) frame).value) - 1), playFlag ? new ActionPlay() : null);
|
||||
return toSourceMerge(localData, generator, new ActionGotoFrame((int) ((long) (Long) ((DirectValueActionItem) frame).value) - 1), playFlag ? new ActionPlay() : null, needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
} else {
|
||||
return toSourceMerge(localData, generator, frame, new ActionGotoFrame2(playFlag, sceneBiasFlag, sceneBias));
|
||||
return toSourceMerge(localData, generator, frame, new ActionGotoFrame2(playFlag, sceneBiasFlag, sceneBias), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -73,7 +75,16 @@ public class LoadMovieActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(method, false, true));
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(method, false, true), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -75,6 +77,15 @@ public class LoadMovieNumActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
Object lev;
|
||||
if ((num instanceof DirectValueActionItem) && (((DirectValueActionItem) num).value instanceof Long)) {
|
||||
@@ -82,7 +93,7 @@ public class LoadMovieNumActionItem extends ActionItem {
|
||||
} else {
|
||||
lev = new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num, true);
|
||||
}
|
||||
return toSourceMerge(localData, generator, urlString, lev, new ActionGetURL2(method, false, false));
|
||||
return toSourceMerge(localData, generator, urlString, lev, new ActionGetURL2(method, false, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -73,7 +75,16 @@ public class LoadVariablesActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(method, true, true));
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, urlString, targetString, new ActionGetURL2(method, true, true), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -75,6 +77,15 @@ public class LoadVariablesNumActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
Object lev;
|
||||
if ((num instanceof DirectValueActionItem) && (((DirectValueActionItem) num).value instanceof Long)) {
|
||||
@@ -82,7 +93,7 @@ public class LoadVariablesNumActionItem extends ActionItem {
|
||||
} else {
|
||||
lev = new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num, true);
|
||||
}
|
||||
return toSourceMerge(localData, generator, urlString, lev, new ActionGetURL2(method, true, false));
|
||||
return toSourceMerge(localData, generator, urlString, lev, new ActionGetURL2(method, true, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionNextFrame;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -44,7 +46,16 @@ public class NextFrameActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionNextFrame());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionNextFrame(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionPlay;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -44,7 +46,16 @@ public class PlayActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionPlay());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionPlay(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionPrevFrame;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -44,7 +46,16 @@ public class PrevFrameActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionPrevFrame());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionPrevFrame(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -65,8 +67,17 @@ public class PrintActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), target, new ActionGetURL2(0, false, false));
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), target, new ActionGetURL2(0, false, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -65,8 +67,17 @@ public class PrintAsBitmapActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), target, new ActionGetURL2(0, false, false));
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), target, new ActionGetURL2(0, false, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -65,6 +67,15 @@ public class PrintAsBitmapNumActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
Object lev;
|
||||
if ((num instanceof DirectValueActionItem) && (((DirectValueActionItem) num).value instanceof Long)) {
|
||||
@@ -72,7 +83,7 @@ public class PrintAsBitmapNumActionItem extends ActionItem {
|
||||
} else {
|
||||
lev = new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num, true);
|
||||
}
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false));
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("printasbitmap:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.model.operations.AddActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -65,6 +67,15 @@ public class PrintNumActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
Object lev;
|
||||
if ((num instanceof DirectValueActionItem) && (((DirectValueActionItem) num).value instanceof Long)) {
|
||||
@@ -72,7 +83,7 @@ public class PrintNumActionItem extends ActionItem {
|
||||
} else {
|
||||
lev = new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num, true);
|
||||
}
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false));
|
||||
return toSourceMerge(localData, generator, new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("print:#"), boundingBox, true), lev, new ActionGetURL2(0, false, false), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionRemoveSprite;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -56,7 +58,16 @@ public class RemoveSpriteActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, value, new ActionRemoveSprite());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, value, new ActionRemoveSprite(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionSetVariable;
|
||||
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightData;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
@@ -50,6 +51,8 @@ public class SetVariableActionItem extends ActionItem implements SetTypeActionIt
|
||||
|
||||
public String compoundOperator;
|
||||
|
||||
public boolean forceUseSet = false;
|
||||
|
||||
@Override
|
||||
public GraphPart getFirstPart() {
|
||||
return value.getFirstPart();
|
||||
@@ -153,6 +156,10 @@ public class SetVariableActionItem extends ActionItem implements SetTypeActionIt
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
|
||||
if (forceUseSet) {
|
||||
return toSourceMerge(localData, generator, name, value, new ActionSetVariable(), new ActionPush(Undefined.INSTANCE));
|
||||
}
|
||||
int tmpReg = asGenerator.getTempRegister(localData);
|
||||
try {
|
||||
return toSourceMerge(localData, generator, name, value, new ActionStoreRegister(tmpReg), new ActionSetVariable(), new ActionPush(new RegisterNumber(tmpReg)));
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionStartDrag;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -100,6 +102,15 @@ public class StartDragActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
boolean hasConstrains = true;
|
||||
if (constrain instanceof DirectValueActionItem) {
|
||||
if (Double.compare(constrain.getResultAsNumber(), 0) == 0) {
|
||||
@@ -107,9 +118,9 @@ public class StartDragActionItem extends ActionItem {
|
||||
}
|
||||
}
|
||||
if (hasConstrains) {
|
||||
return toSourceMerge(localData, generator, x1, y1, x2, y2, constrain, lockCenter, target, new ActionStartDrag());
|
||||
return toSourceMerge(localData, generator, x1, y1, x2, y2, constrain, lockCenter, target, new ActionStartDrag(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
} else {
|
||||
return toSourceMerge(localData, generator, constrain, lockCenter, target, new ActionStartDrag());
|
||||
return toSourceMerge(localData, generator, constrain, lockCenter, target, new ActionStartDrag(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionStop;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -44,7 +46,16 @@ public class StopActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionStop());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionStop(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionStopSounds;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -44,7 +46,16 @@ public class StopAllSoundsActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionStopSounds());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionStopSounds(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionEndDrag;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -44,7 +46,16 @@ public class StopDragActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionEndDrag());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionEndDrag(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionToggleQuality;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -49,7 +51,16 @@ public class ToggleHighQualityActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionToggleQuality());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionToggleQuality(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionTrace;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -56,7 +58,16 @@ public class TraceActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, value, new ActionTrace());
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, value, new ActionTrace(), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -58,7 +59,16 @@ public class UnLoadMovieActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionPush(""), targetString, new ActionGetURL2(0, false, true));
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
return toSourceMerge(localData, generator, new ActionPush(""), targetString, new ActionGetURL2(0, false, true), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionGetURL;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionGetURL2;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
@@ -61,11 +62,20 @@ public class UnLoadMovieNumActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
return toSource(localData, generator, false);
|
||||
}
|
||||
|
||||
private List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn) throws CompilationException {
|
||||
ActionSourceGenerator asGenerator = (ActionSourceGenerator) generator;
|
||||
if ((num instanceof DirectValueActionItem) && (((DirectValueActionItem) num).value instanceof Long)) {
|
||||
return toSourceMerge(localData, generator, new ActionGetURL("", "_level" + ((DirectValueActionItem) num).value));
|
||||
return toSourceMerge(localData, generator, new ActionGetURL("", "_level" + ((DirectValueActionItem) num).value), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
} else {
|
||||
return toSourceMerge(localData, generator, new ActionPush(""), new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(0, false, true));
|
||||
return toSourceMerge(localData, generator, new ActionPush(""), new AddActionItem(getSrc(), getLineStartItem(), asGenerator.pushConstTargetItem("_level"), num, true), new ActionGetURL2(0, false, true), needsReturn ? new ActionPush(new Object[]{Undefined.INSTANCE, Undefined.INSTANCE}) : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -546,8 +546,267 @@ public class ActionScript2Parser {
|
||||
if (debugMode) {
|
||||
System.out.println("expressionCommands:");
|
||||
}
|
||||
GraphTargetItem ret;
|
||||
GraphTargetItem ret = null;
|
||||
switch (s.type) {
|
||||
case DUPLICATEMOVIECLIP:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem src3 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem tar3 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem dep3 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new CloneSpriteActionItem(null, null, src3, tar3, dep3);
|
||||
break;
|
||||
case FSCOMMAND:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new FSCommandActionItem(null, null, expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
case SET:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem name1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem value1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new SetVariableActionItem(null, null, name1, value1);
|
||||
((SetVariableActionItem) ret).forceUseSet = true;
|
||||
hasEval.setVal(true); //FlashPro does this (using definelocal for funcs) only for eval func, but we will also use set since it is generated by obfuscated identifiers
|
||||
break;
|
||||
case TRACE:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new TraceActionItem(null, null, (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
|
||||
case GETURL:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem url = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.PARENT_CLOSE, SymbolType.COMMA);
|
||||
int getuMethod = 0;
|
||||
GraphTargetItem target;
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
target = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.STRING);
|
||||
if (s.value.equals("GET")) {
|
||||
getuMethod = 1;
|
||||
} else if (s.value.equals("POST")) {
|
||||
getuMethod = 2;
|
||||
} else {
|
||||
throw new ActionParseException("Invalid method, \"GET\" or \"POST\" expected.", lexer.yyline());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
target = new DirectValueActionItem(null, null, 0, "", new ArrayList<>());
|
||||
}
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new GetURL2ActionItem(null, null, url, target, getuMethod);
|
||||
break;
|
||||
case GOTOANDSTOP:
|
||||
case GOTOANDPLAY:
|
||||
SymbolType gtKind = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem gtsFrame = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
int gtsSceneBias = -1;
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) { //Handle scene?
|
||||
if ((gtsFrame instanceof DirectValueActionItem) && (((DirectValueActionItem) gtsFrame).value instanceof Long)) {
|
||||
gtsSceneBias = (int) (long) (Long) ((DirectValueActionItem) gtsFrame).value;
|
||||
} else {
|
||||
throw new ActionParseException("Scene bias must be number", lexer.yyline());
|
||||
}
|
||||
|
||||
gtsFrame = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
ret = new GotoFrame2ActionItem(null, null, gtsFrame, gtsSceneBias != -1, gtKind == SymbolType.GOTOANDPLAY, gtsSceneBias);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
case NEXTFRAME:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new NextFrameActionItem(null, null);
|
||||
break;
|
||||
case PLAY:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new PlayActionItem(null, null);
|
||||
break;
|
||||
case PREVFRAME:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new PrevFrameActionItem(null, null);
|
||||
break;
|
||||
case STOP:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StopActionItem(null, null);
|
||||
break;
|
||||
case STOPALLSOUNDS:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StopAllSoundsActionItem(null, null);
|
||||
break;
|
||||
case TOGGLEHIGHQUALITY:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new ToggleHighQualityActionItem(null, null);
|
||||
break;
|
||||
|
||||
case STOPDRAG:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StopDragActionItem(null, null);
|
||||
break;
|
||||
|
||||
case UNLOADMOVIE:
|
||||
case UNLOADMOVIENUM:
|
||||
SymbolType unloadType = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem unTargetOrNum = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
if (unloadType == SymbolType.UNLOADMOVIE) {
|
||||
ret = new UnLoadMovieActionItem(null, null, unTargetOrNum);
|
||||
}
|
||||
if (unloadType == SymbolType.UNLOADMOVIENUM) {
|
||||
ret = new UnLoadMovieNumActionItem(null, null, unTargetOrNum);
|
||||
}
|
||||
break;
|
||||
case PRINT:
|
||||
case PRINTASBITMAP:
|
||||
case PRINTASBITMAPNUM:
|
||||
case PRINTNUM:
|
||||
SymbolType printType = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem printTarget = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem printBBox = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
|
||||
switch (printType) {
|
||||
case PRINT:
|
||||
ret = new PrintActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
case PRINTNUM:
|
||||
ret = new PrintNumActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
case PRINTASBITMAP:
|
||||
ret = new PrintAsBitmapActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
case PRINTASBITMAPNUM:
|
||||
ret = new PrintAsBitmapNumActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LOADVARIABLES:
|
||||
case LOADMOVIE:
|
||||
case LOADVARIABLESNUM:
|
||||
case LOADMOVIENUM:
|
||||
SymbolType loadType = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem url2 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem targetOrNum = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.PARENT_CLOSE, SymbolType.COMMA);
|
||||
int lvmethod = 1;
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.STRING);
|
||||
if (s.value.equals("POST")) {
|
||||
lvmethod = 2;
|
||||
} else if (s.value.equals("GET")) {
|
||||
lvmethod = 1;
|
||||
} else {
|
||||
throw new ActionParseException("Invalid method, \"GET\" or \"POST\" expected.", lexer.yyline());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
switch (loadType) {
|
||||
case LOADVARIABLES:
|
||||
ret = new LoadVariablesActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
case LOADMOVIE:
|
||||
ret = new LoadMovieActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
case LOADVARIABLESNUM:
|
||||
ret = new LoadVariablesNumActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
case LOADMOVIENUM:
|
||||
ret = new LoadMovieNumActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case REMOVEMOVIECLIP:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new RemoveSpriteActionItem(null, null, (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
case STARTDRAG:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem dragTarget = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
GraphTargetItem lockCenter;
|
||||
GraphTargetItem constrain;
|
||||
GraphTargetItem x1 = null;
|
||||
GraphTargetItem y1 = null;
|
||||
GraphTargetItem x2 = null;
|
||||
GraphTargetItem y2 = null;
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
lockCenter = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
constrain = new DirectValueActionItem(null, null, 0, 1L, new ArrayList<>());
|
||||
x1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
y1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
x2 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
y2 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
y2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
x2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
y2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
x2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
y2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
y1 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
constrain = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
//ret.add(new ActionPush(Boolean.FALSE));
|
||||
}
|
||||
} else {
|
||||
lockCenter = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
constrain = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
lexer.pushback(s);
|
||||
}
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StartDragActionItem(null, null, dragTarget, lockCenter, constrain, x1, y1, x2, y2);
|
||||
break;
|
||||
case CALL:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new CallActionItem(null, null, (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)));
|
||||
@@ -719,30 +978,6 @@ public class ActionScript2Parser {
|
||||
}
|
||||
|
||||
switch (s.type) {
|
||||
case DUPLICATEMOVIECLIP:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem src3 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem tar3 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem dep3 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new CloneSpriteActionItem(null, null, src3, tar3, dep3);
|
||||
break;
|
||||
case FSCOMMAND:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new FSCommandActionItem(null, null, expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
case SET:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem name1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem value1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new SetVariableActionItem(null, null, name1, value1);
|
||||
hasEval.setVal(true); //FlashPro does this (using definelocal for funcs) only for eval func, but we will also use set since it is generated by obfuscated identifiers
|
||||
break;
|
||||
case WITH:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem wvar = expression(inFunction, inMethod, inTellTarget, false, variables, functions, false, hasEval);//(variable(inFunction, inMethod, variables, functions));
|
||||
@@ -768,78 +1003,6 @@ public class ActionScript2Parser {
|
||||
ret = new DeleteActionItem(null, null, null, varDel);
|
||||
}
|
||||
break;
|
||||
case TRACE:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new TraceActionItem(null, null, (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
|
||||
case GETURL:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem url = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.PARENT_CLOSE, SymbolType.COMMA);
|
||||
int getuMethod = 0;
|
||||
GraphTargetItem target;
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
target = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.STRING);
|
||||
if (s.value.equals("GET")) {
|
||||
getuMethod = 1;
|
||||
} else if (s.value.equals("POST")) {
|
||||
getuMethod = 2;
|
||||
} else {
|
||||
throw new ActionParseException("Invalid method, \"GET\" or \"POST\" expected.", lexer.yyline());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
target = new DirectValueActionItem(null, null, 0, "", new ArrayList<>());
|
||||
}
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new GetURL2ActionItem(null, null, url, target, getuMethod);
|
||||
break;
|
||||
case GOTOANDSTOP:
|
||||
case GOTOANDPLAY:
|
||||
SymbolType gtKind = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem gtsFrame = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
int gtsSceneBias = -1;
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) { //Handle scene?
|
||||
if ((gtsFrame instanceof DirectValueActionItem) && (((DirectValueActionItem) gtsFrame).value instanceof Long)) {
|
||||
gtsSceneBias = (int) (long) (Long) ((DirectValueActionItem) gtsFrame).value;
|
||||
} else {
|
||||
throw new ActionParseException("Scene bias must be number", lexer.yyline());
|
||||
}
|
||||
|
||||
gtsFrame = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
ret = new GotoFrame2ActionItem(null, null, gtsFrame, gtsSceneBias != -1, gtKind == SymbolType.GOTOANDPLAY, gtsSceneBias);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
case NEXTFRAME:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new NextFrameActionItem(null, null);
|
||||
break;
|
||||
case PLAY:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new PlayActionItem(null, null);
|
||||
break;
|
||||
case PREVFRAME:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new PrevFrameActionItem(null, null);
|
||||
break;
|
||||
case TELLTARGET:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem tellTarget = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
@@ -853,168 +1016,7 @@ public class ActionScript2Parser {
|
||||
}
|
||||
ret = tt;
|
||||
break;
|
||||
case STOP:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StopActionItem(null, null);
|
||||
break;
|
||||
case STOPALLSOUNDS:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StopAllSoundsActionItem(null, null);
|
||||
break;
|
||||
case TOGGLEHIGHQUALITY:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new ToggleHighQualityActionItem(null, null);
|
||||
break;
|
||||
|
||||
case STOPDRAG:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StopDragActionItem(null, null);
|
||||
break;
|
||||
|
||||
case UNLOADMOVIE:
|
||||
case UNLOADMOVIENUM:
|
||||
SymbolType unloadType = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem unTargetOrNum = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval);
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
if (unloadType == SymbolType.UNLOADMOVIE) {
|
||||
ret = new UnLoadMovieActionItem(null, null, unTargetOrNum);
|
||||
}
|
||||
if (unloadType == SymbolType.UNLOADMOVIENUM) {
|
||||
ret = new UnLoadMovieNumActionItem(null, null, unTargetOrNum);
|
||||
}
|
||||
break;
|
||||
case PRINT:
|
||||
case PRINTASBITMAP:
|
||||
case PRINTASBITMAPNUM:
|
||||
case PRINTNUM:
|
||||
SymbolType printType = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem printTarget = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem printBBox = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
|
||||
switch (printType) {
|
||||
case PRINT:
|
||||
ret = new PrintActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
case PRINTNUM:
|
||||
ret = new PrintNumActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
case PRINTASBITMAP:
|
||||
ret = new PrintAsBitmapActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
case PRINTASBITMAPNUM:
|
||||
ret = new PrintAsBitmapNumActionItem(null, null, printTarget, printBBox);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LOADVARIABLES:
|
||||
case LOADMOVIE:
|
||||
case LOADVARIABLESNUM:
|
||||
case LOADMOVIENUM:
|
||||
SymbolType loadType = s.type;
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem url2 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
expectedType(SymbolType.COMMA);
|
||||
GraphTargetItem targetOrNum = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.PARENT_CLOSE, SymbolType.COMMA);
|
||||
int lvmethod = 1;
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
s = lex();
|
||||
expected(s, lexer.yyline(), SymbolType.STRING);
|
||||
if (s.value.equals("POST")) {
|
||||
lvmethod = 2;
|
||||
} else if (s.value.equals("GET")) {
|
||||
lvmethod = 1;
|
||||
} else {
|
||||
throw new ActionParseException("Invalid method, \"GET\" or \"POST\" expected.", lexer.yyline());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
switch (loadType) {
|
||||
case LOADVARIABLES:
|
||||
ret = new LoadVariablesActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
case LOADMOVIE:
|
||||
ret = new LoadMovieActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
case LOADVARIABLESNUM:
|
||||
ret = new LoadVariablesNumActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
case LOADMOVIENUM:
|
||||
ret = new LoadMovieNumActionItem(null, null, url2, targetOrNum, lvmethod);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case REMOVEMOVIECLIP:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new RemoveSpriteActionItem(null, null, (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)));
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
break;
|
||||
case STARTDRAG:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
GraphTargetItem dragTarget = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
GraphTargetItem lockCenter;
|
||||
GraphTargetItem constrain;
|
||||
GraphTargetItem x1 = null;
|
||||
GraphTargetItem y1 = null;
|
||||
GraphTargetItem x2 = null;
|
||||
GraphTargetItem y2 = null;
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
lockCenter = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
constrain = new DirectValueActionItem(null, null, 0, 1L, new ArrayList<>());
|
||||
x1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
y1 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
x2 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
s = lex();
|
||||
if (s.type == SymbolType.COMMA) {
|
||||
y2 = (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval));
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
y2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
x2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
y2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
x2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
y2 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
y1 = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
|
||||
}
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
constrain = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
//ret.add(new ActionPush(Boolean.FALSE));
|
||||
}
|
||||
} else {
|
||||
lockCenter = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
constrain = new DirectValueActionItem(null, null, 0, 0L, new ArrayList<>());
|
||||
lexer.pushback(s);
|
||||
}
|
||||
expectedType(SymbolType.PARENT_CLOSE);
|
||||
ret = new StartDragActionItem(null, null, dragTarget, lockCenter, constrain, x1, y1, x2, y2);
|
||||
break;
|
||||
|
||||
case IFFRAMELOADED:
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
|
||||
Reference in New Issue
Block a user