From b969946fc41387bd43068dbc525d145d0d7d1a80 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 13 Nov 2016 03:07:46 +0100 Subject: [PATCH 1/2] fix array index out of bounds --- src/yugecin/opsudance/ui/OptionsOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yugecin/opsudance/ui/OptionsOverlay.java b/src/yugecin/opsudance/ui/OptionsOverlay.java index 7a2bd82c..f1db2c11 100644 --- a/src/yugecin/opsudance/ui/OptionsOverlay.java +++ b/src/yugecin/opsudance/ui/OptionsOverlay.java @@ -134,7 +134,7 @@ public class OptionsOverlay { return true; } int idx = getOptionIdxAt(y); - if (idx < options.length) { + if (idx >= 0 && idx < options.length) { final Options.GameOption option = options[idx]; selectedOption = option; Object[] listItems = option.getListItems(); From 6f083d47da6cdd975a28fdf18d811a8254a53ee3 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 13 Nov 2016 03:12:26 +0100 Subject: [PATCH 2/2] add visual indicator for map progress --- src/yugecin/opsudance/ui/SBOverlay.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/yugecin/opsudance/ui/SBOverlay.java b/src/yugecin/opsudance/ui/SBOverlay.java index 65dfa8e6..8f241205 100644 --- a/src/yugecin/opsudance/ui/SBOverlay.java +++ b/src/yugecin/opsudance/ui/SBOverlay.java @@ -83,6 +83,13 @@ public class SBOverlay { Fonts.SMALL.drawString(10, 50 + i++ * lh, option.getKey().getDisplayName(), Color.cyan); } } + if (gameObjects.length > 0) { + int start = gameObjects[0].getTime(); + int end = gameObjects[gameObjects.length - 1].getEndTime(); + float curtime = (float) (MusicController.getPosition() - start) / (end - start); + g.setColor(Color.red); + g.fillRect(curtime * width, height - 10f, 10f, 10f); + } if (menu) { options.render(container, game, g); }