From ba3a246f27c32f8e9e987bab37fa67585b2a6bb1 Mon Sep 17 00:00:00 2001 From: Badvision Date: Sun, 18 Aug 2024 22:48:38 -0500 Subject: [PATCH] Make a better attempt to cancel the twinkle animation properly --- src/main/java/jace/apple2e/Apple2e.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/jace/apple2e/Apple2e.java b/src/main/java/jace/apple2e/Apple2e.java index aeafa8c..d7a3cf4 100644 --- a/src/main/java/jace/apple2e/Apple2e.java +++ b/src/main/java/jace/apple2e/Apple2e.java @@ -413,8 +413,8 @@ public class Apple2e extends Computer { animCycleNumber++; } else { getMemory().write(animAddr, animOldValue, true, true); - animationSchedule.cancel(false); animAddr = 0; + animationSchedule.cancel(true); } }; @@ -422,6 +422,9 @@ public class Apple2e extends Computer { if (hints.isEmpty()) { hints.add(getMemory().observe("Helpful hints", RAMEvent.TYPE.EXECUTE, 0x0FB63, (e)->{ animationTimer.schedule(drawHints, 1, TimeUnit.SECONDS); + if (animationSchedule != null) { + animationSchedule.cancel(true); + } animationSchedule = animationTimer.scheduleAtFixedRate(doAnimation, 1250, 100, TimeUnit.MILLISECONDS); }));