diff --git a/src/com/annimon/everlastingsummer/Parser.java b/src/com/annimon/everlastingsummer/Parser.java index 176bb9e..8973f1a 100644 --- a/src/com/annimon/everlastingsummer/Parser.java +++ b/src/com/annimon/everlastingsummer/Parser.java @@ -217,8 +217,14 @@ public final class Parser { if (match(token, TokenType.RENPY_PAUSE)) { consume(TokenType.LPAREN); final double pause = consumeDouble(); - ViewActivity.getInstance().pause((int)(1000 * pause)); + boolean hard = false; + if (!lookMatch(0, TokenType.RPAREN)) { + consume(TokenType.WORD); // hard + consume(TokenType.EQ); + hard = consumeBoolean(); + } consume(TokenType.RPAREN); + ViewActivity.getInstance().pause((int)(1000 * pause), hard); return true; } @@ -700,6 +706,10 @@ public final class Parser { return Double.parseDouble(consume(TokenType.NUMBER).getText()); } + private boolean consumeBoolean() { + return "true".equalsIgnoreCase(consume(TokenType.WORD).getText()); + } + private FadeInfo matchFade() { final FadeInfo result = new FadeInfo(); if (match(TokenType.FADEIN)) { diff --git a/src/com/annimon/everlastingsummer/ViewActivity.java b/src/com/annimon/everlastingsummer/ViewActivity.java index 99218eb..17bebea 100644 --- a/src/com/annimon/everlastingsummer/ViewActivity.java +++ b/src/com/annimon/everlastingsummer/ViewActivity.java @@ -57,6 +57,8 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch private Characters characters; private Map spriteInContainer; private DisplayMetrics displayMetrics; + + private boolean blockTap; @Override protected void onCreate(Bundle savedInstanceState) { @@ -147,7 +149,7 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch public void onTouchGesture(TouchGestureType type) { switch (type) { case SINGLE_TAP: - Parser.getInstance().next(); + if (!blockTap) Parser.getInstance().next(); break; case SWIPE: Dialogs.with(this).showMenu(R.array.menu_items, menu); @@ -194,6 +196,7 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch } public void background(String type, String name, String effect) { + text(""); spritesClear(); if (name.equalsIgnoreCase("black")) background.setImageResource(android.R.color.black); else if (name.equalsIgnoreCase("white")) background.setImageResource(android.R.color.white); @@ -280,8 +283,8 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch } } - public void pause(final long duration) { - text(""); + public void pause(final long duration, final boolean hard) { + blockTap = hard; new Thread(new Runnable() { @Override public void run() { @@ -489,6 +492,7 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch private final Runnable nextCommandRunnable = new Runnable() { @Override public void run() { + blockTap = false; Parser.getInstance().next(); } };