From 50deb210f61350105f5643b2f2f7cd30db767a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 28 Nov 2021 17:27:10 +0100 Subject: [PATCH] Fixed AS1/2 - direct editation - gotoAndPlay/Stop with scenebias --- CHANGELOG.md | 1 + .../parser/script/ActionScript2Parser.java | 26 +++++++------------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e381e931f..e41269b28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ All notable changes to this project will be documented in this file. - AS1/2 - direct editation - allow call on numbers, boolean, etc. - AS1/2 - direct editation - try..finally without catch clause - AS1/2 - GotoFrame2 - scene bias is first +- AS1/2 - direct editation - gotoAndPlay/Stop with scenebias ## [14.6.0] - 2021-11-22 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java index 88fe7a5d8..d0c734c7c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java @@ -805,16 +805,24 @@ public class ActionScript2Parser { 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? - lex(); + 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, false, false, 0); + ret = new GotoFrame2ActionItem(null, null, gtsFrame, gtsSceneBias != -1, gtKind == SymbolType.GOTOANDPLAY, gtsSceneBias); expectedType(SymbolType.PARENT_CLOSE); break; case NEXTFRAME: @@ -948,20 +956,6 @@ public class ActionScript2Parser { break; } break; - case GOTOANDPLAY: - expectedType(SymbolType.PARENT_OPEN); - GraphTargetItem gtpFrame = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval); - s = lex(); - if (s.type == SymbolType.COMMA) { //Handle scene? - lex(); - gtpFrame = expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval); - } else { - lexer.pushback(s); - } - ret = new GotoFrame2ActionItem(null, null, gtpFrame, false, true, 0); - expectedType(SymbolType.PARENT_CLOSE); - break; - case REMOVEMOVIECLIP: expectedType(SymbolType.PARENT_OPEN); ret = new RemoveSpriteActionItem(null, null, (expression(inFunction, inMethod, inTellTarget, true, variables, functions, false, hasEval)));