From 474b40750ea4ed7e69f12aa7eb650f762e18382c Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:29:49 +0100 Subject: [PATCH 01/12] allow custom scale overrides on menubuttons --- src/itdelatrisu/opsu/ui/MenuButton.java | 32 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/itdelatrisu/opsu/ui/MenuButton.java b/src/itdelatrisu/opsu/ui/MenuButton.java index 1aa524dc..c6675b46 100644 --- a/src/itdelatrisu/opsu/ui/MenuButton.java +++ b/src/itdelatrisu/opsu/ui/MenuButton.java @@ -98,6 +98,9 @@ public class MenuButton { /** The default max rotation angle of the button. */ private static final float DEFAULT_ANGLE_MAX = 30f; + /** The current scale of the drawn button */ + private float currentScale = 1f; + /** * Creates a new button from an Image. * @param img the image @@ -166,6 +169,11 @@ public class MenuButton { */ public float getY() { return y; } + /** + * Returns the current scale. + */ + public float getCurrentScale() { return currentScale; } + /** * Sets text to draw in the middle of the button. * @param text the text to draw @@ -191,14 +199,21 @@ public class MenuButton { /** * Draws the button. */ - public void draw() { draw(Color.white); } + public void draw() { draw(Color.white, 1f); } + + /** + * Draws the button with a color filter. + * @param filter the color to filter with when drawing + */ + public void draw(Color filter) { draw(filter, 1f); } /** * Draw the button with a color filter. * @param filter the color to filter with when drawing + * @param scaleOverride the scale to use when drawing, works only for normal images */ @SuppressWarnings("deprecation") - public void draw(Color filter) { + public void draw(Color filter, float scaleOverride) { // animations: get current frame Image image = this.img; if (image == null) { @@ -208,6 +223,14 @@ public class MenuButton { // normal images if (imgL == null) { + float scalePosModX = 0; + float scalePosModY = 0; + if (scaleOverride != 1f) { + image = image.getScaledCopy(scaleOverride); + scalePosModX = image.getWidth() / 2 - xRadius; + scalePosModY = image.getHeight() / 2 - yRadius; + } + currentScale = scaleOverride; if (hoverEffect == 0) image.draw(x - xRadius, y - yRadius, filter); else { @@ -217,13 +240,16 @@ public class MenuButton { if (scale.getValue() != 1f) { image = image.getScaledCopy(scale.getValue()); image.setAlpha(oldAlpha); + scalePosModX = image.getWidth() / 2 - xRadius; + scalePosModY = image.getHeight() / 2 - yRadius; + currentScale *= scale.getValue(); } } if ((hoverEffect & EFFECT_FADE) > 0) image.setAlpha(alpha.getValue()); if ((hoverEffect & EFFECT_ROTATE) > 0) image.setRotation(angle.getValue()); - image.draw(x - xRadius, y - yRadius, filter); + image.draw(x - xRadius - scalePosModX, y - yRadius - scalePosModY, filter); if (image == this.img) { image.setAlpha(oldAlpha); image.setRotation(oldAngle); From 77c6dfd65aa9d177021a516d96d2fdaccf8ede93 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:31:17 +0100 Subject: [PATCH 02/12] added MusicController#getBeatProgress --- .../opsu/audio/MusicController.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/itdelatrisu/opsu/audio/MusicController.java b/src/itdelatrisu/opsu/audio/MusicController.java index 5ecfa76d..636e94be 100644 --- a/src/itdelatrisu/opsu/audio/MusicController.java +++ b/src/itdelatrisu/opsu/audio/MusicController.java @@ -22,6 +22,7 @@ import itdelatrisu.opsu.ErrorHandler; import itdelatrisu.opsu.Options; import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.beatmap.BeatmapParser; +import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.ui.UI; import java.io.File; @@ -183,6 +184,39 @@ public class MusicController { */ public static Beatmap getBeatmap() { return lastBeatmap; } + /** + * Gets the progress of the current beat. + * @return progress as a value in [0, 1], where 0 means a beat just happened and 1 means the next beat is coming right now. + */ + public static Float getBeatProgress() { + if (!isPlaying() || getBeatmap() == null) { + return null; + } + Beatmap map = getBeatmap(); + if (map.timingPoints == null) { + return null; + } + int trackposition = getPosition(); + TimingPoint p = null; + double beatlen = 0d; + int time = 0; + for (TimingPoint pts : map.timingPoints) { + if (pts.getTime() > getPosition()) { + break; + } + p = pts; + if (!p.isInherited() && p.getBeatLength() > 0) { + beatlen = p.getBeatLength(); + time = p.getTime(); + } + } + if (p == null) { + return null; + } + double beatLength = beatlen * 100d; + return (float) ((((trackposition - time) * 100) % beatLength) / beatLength); + } + /** * Returns true if the current track is playing. */ From ff68145ba3b13135aac15655ca2bd2ea18035bdd Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:39:39 +0100 Subject: [PATCH 03/12] added BeatmapParser#parseOnlyTimingPoints --- .../opsu/beatmap/BeatmapParser.java | 82 +++++++++++++++---- 1 file changed, 67 insertions(+), 15 deletions(-) diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapParser.java b/src/itdelatrisu/opsu/beatmap/BeatmapParser.java index c7004703..59d20639 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapParser.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapParser.java @@ -212,6 +212,52 @@ public class BeatmapParser { return lastNode; } + /** + * Parses the timingpoints for a beatmap. + * @param map the map to parse timingpoints for + */ + public static void parseOnlyTimingPoints(Beatmap map) { + if (map == null || map.getFile() == null || !map.getFile().exists()) { + return; + } + if (map.timingPoints == null) { + map.timingPoints = new ArrayList(); + } + try ( + InputStream bis = new BufferedInputStream(new FileInputStream(map.getFile())); + MD5InputStreamWrapper md5stream = (!hasNoMD5Algorithm) ? new MD5InputStreamWrapper(bis) : null; + BufferedReader in = new BufferedReader(new InputStreamReader((md5stream != null) ? md5stream : bis, "UTF-8")); + ) { + String line; + boolean found = false; + while((line = in.readLine()) != null) { + line = line.trim(); + if(!isValidLine(line)) { + continue; + } + if ("[TimingPoints]".equals(line)) { + found = true; + continue; + } + if (found) { + if (line.startsWith("[")) { + break; + } + parseSectionTimingPoints(map, line); + } + } + map.timingPoints.trimToSize(); + } catch (IOException e) { + ErrorHandler.error(String.format("Failed to read file '%s'.", map.getFile().getAbsolutePath()), e, false); + } catch (NoSuchAlgorithmException e) { + ErrorHandler.error("Failed to get MD5 hash stream.", e, true); + + // retry without MD5 + hasNoMD5Algorithm = true; + parseOnlyTimingPoints(map); + } + } + /** * Parses a beatmap. * @param file the file to parse @@ -493,21 +539,7 @@ public class BeatmapParser { break; try { - // parse timing point - TimingPoint timingPoint = new TimingPoint(line); - - // calculate BPM - if (!timingPoint.isInherited()) { - int bpm = Math.round(60000 / timingPoint.getBeatLength()); - if (beatmap.bpmMin == 0) - beatmap.bpmMin = beatmap.bpmMax = bpm; - else if (bpm < beatmap.bpmMin) - beatmap.bpmMin = bpm; - else if (bpm > beatmap.bpmMax) - beatmap.bpmMax = bpm; - } - - beatmap.timingPoints.add(timingPoint); + parseSectionTimingPoints(beatmap, line); } catch (Exception e) { Log.warn(String.format("Failed to read timing point '%s' for file '%s'.", line, file.getAbsolutePath()), e); @@ -624,6 +656,26 @@ public class BeatmapParser { return beatmap; } + /** + * Parses a timing point in the timingpoints section of a beatmap file + * @param beatmap the beatmap to add the timingpoint to + * @param line the line with timingpoint to parse + */ + private static void parseSectionTimingPoints(Beatmap beatmap, String line) { + TimingPoint timingPoint = new TimingPoint(line); + if(!timingPoint.isInherited()) { + int bpm = Math.round(60000 / timingPoint.getBeatLength()); + if( beatmap.bpmMin == 0 ) { + beatmap.bpmMin = beatmap.bpmMax = bpm; + } else if( bpm < beatmap.bpmMin ) { + beatmap.bpmMin = bpm; + } else if( bpm > beatmap.bpmMax ) { + beatmap.bpmMax = bpm; + } + } + beatmap.timingPoints.add(timingPoint); + } + /** * Parses all hit objects in a beatmap. * @param beatmap the beatmap to parse From 13e1fb5193e117c095d15f84223c172fea50fcf3 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:40:58 +0100 Subject: [PATCH 04/12] parse timingpoints of a map when playing the song, to allow logo pulsing --- src/itdelatrisu/opsu/states/SongMenu.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index 6a91880f..ad86cc49 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -1391,6 +1391,10 @@ public class SongMenu extends BasicGameState { focusNode = BeatmapSetList.get().getNode(node, beatmapIndex); Beatmap beatmap = focusNode.getSelectedBeatmap(); + if (beatmap.timingPoints == null) { + // parse the timingpoints so we can pulse the main menu logo and bottom right logo in songmenu + BeatmapParser.parseOnlyTimingPoints(beatmap); + } MusicController.play(beatmap, false, preview); // load scores From f7e42c271f8d0103994c873205457b8f73892570 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:41:36 +0100 Subject: [PATCH 05/12] make the main menu logo pulse --- src/itdelatrisu/opsu/states/MainMenu.java | 13 ++++++++++++- src/itdelatrisu/opsu/ui/Colors.java | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/itdelatrisu/opsu/states/MainMenu.java b/src/itdelatrisu/opsu/states/MainMenu.java index 8eb78819..40fbe44c 100644 --- a/src/itdelatrisu/opsu/states/MainMenu.java +++ b/src/itdelatrisu/opsu/states/MainMenu.java @@ -256,7 +256,18 @@ public class MainMenu extends BasicGameState { playButton.draw(); exitButton.draw(); } - logo.draw(); + + // logo + Float position = MusicController.getBeatProgress(); + if (position == null) { + position = System.currentTimeMillis() % 1000 / 1000f; + } + float scale = 1f - (0f - position) * 0.05f; + logo.draw(Color.white, scale); + Image ghostLogo = GameImage.MENU_LOGO.getImage().getScaledCopy(logo.getCurrentScale() / scale * 1.05f); + float scaleposmodx = ghostLogo.getWidth() / 2; + float scaleposmody = ghostLogo.getHeight() / 2; + ghostLogo.draw(logo.getX() - scaleposmodx, logo.getY() - scaleposmody, Colors.GHOST_LOGO); // draw music buttons if (MusicController.isPlaying()) diff --git a/src/itdelatrisu/opsu/ui/Colors.java b/src/itdelatrisu/opsu/ui/Colors.java index 7f00603a..eff7ba57 100644 --- a/src/itdelatrisu/opsu/ui/Colors.java +++ b/src/itdelatrisu/opsu/ui/Colors.java @@ -45,7 +45,8 @@ public class Colors { BLUE_SCOREBOARD = new Color(133, 208, 212), BLACK_BG_NORMAL = new Color(0, 0, 0, 0.25f), BLACK_BG_HOVER = new Color(0, 0, 0, 0.5f), - BLACK_BG_FOCUS = new Color(0, 0, 0, 0.75f); + BLACK_BG_FOCUS = new Color(0, 0, 0, 0.75f), + GHOST_LOGO = new Color(1.0f, 1.0f, 1.0f, 0.25f); // This class should not be instantiated. private Colors() {} From f47d54c4d05ea404d1926e5c46f3fe17a175860c Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:45:33 +0100 Subject: [PATCH 06/12] added pulsing logo at the bottom right of the song menu --- src/itdelatrisu/opsu/states/SongMenu.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index ad86cc49..aae39269 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -498,6 +498,27 @@ public class SongMenu extends BasicGameState { g.drawLine(0, footerY, width, footerY); g.resetLineWidth(); + // opsu logo in bottom bar + float footerHeight = height - footerY; + Image logo = GameImage.MENU_LOGO.getImage(); + float logoSize = footerHeight * 3.25f; + logo = logo.getScaledCopy(logoSize / logo.getWidth()); + Float position = MusicController.getBeatProgress(); + if (position == null) { + position = System.currentTimeMillis() % 1000 / 1000f; + } + float x = width - footerHeight * 0.8f; + float y = height - footerHeight * 0.65f; + Image ghostLogo = logo.getScaledCopy((float) (1 - (0 - position) * 0.15)); + logo = logo.getScaledCopy((float) (1 - (position) * 0.15)); + logoSize = logo.getWidth(); + logo.draw(x - logoSize / 2, y - logoSize / 2); + logoSize = ghostLogo.getWidth(); + float a = Colors.GHOST_LOGO.a; + Colors.GHOST_LOGO.a *= (1f - position); + ghostLogo.draw(x - logoSize / 2, y - logoSize / 2, Colors.GHOST_LOGO); + Colors.GHOST_LOGO.a = a; + // header if (focusNode != null) { // music/loader icon From 0ee16f2cb26346fce544ece5ec413340e1582b23 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:48:55 +0100 Subject: [PATCH 07/12] javadoc adjustment --- src/itdelatrisu/opsu/audio/MusicController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/itdelatrisu/opsu/audio/MusicController.java b/src/itdelatrisu/opsu/audio/MusicController.java index 636e94be..56bc9de3 100644 --- a/src/itdelatrisu/opsu/audio/MusicController.java +++ b/src/itdelatrisu/opsu/audio/MusicController.java @@ -186,7 +186,8 @@ public class MusicController { /** * Gets the progress of the current beat. - * @return progress as a value in [0, 1], where 0 means a beat just happened and 1 means the next beat is coming right now. + * @return null if music is paused or no timingpoints are available, or progress as a value in + * [0, 1], where 0 means a beat just happened and 1 means the next beat is coming right now. */ public static Float getBeatProgress() { if (!isPlaying() || getBeatmap() == null) { From 624296deea5be456ab63ad6f1f192f395afd238e Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 18 Dec 2016 23:51:30 +0100 Subject: [PATCH 08/12] add a timingpoint for the themesong so the logo can be pulsed --- src/itdelatrisu/opsu/Options.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 1ec253c4..c1487003 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -20,6 +20,7 @@ package itdelatrisu.opsu; import itdelatrisu.opsu.audio.MusicController; import itdelatrisu.opsu.beatmap.Beatmap; +import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.skins.Skin; import itdelatrisu.opsu.skins.SkinLoader; import itdelatrisu.opsu.ui.Fonts; @@ -34,6 +35,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.net.URI; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Locale; @@ -1340,6 +1342,9 @@ public class Options { beatmap.audioFilename = new File(tokens[0]); beatmap.title = tokens[1]; beatmap.artist = tokens[2]; + // add a timingpoint so the logo can be pulsed in the mainmenu + beatmap.timingPoints = new ArrayList<>(1); + beatmap.timingPoints.add(new TimingPoint("-44,631.578947368421,4,1,0,100,1,0")); try { beatmap.endTime = Integer.parseInt(tokens[3]); } catch (NumberFormatException e) { From e648a553ea109de77fdba0928a6cdbad4d52af04 Mon Sep 17 00:00:00 2001 From: yugecin Date: Tue, 20 Dec 2016 00:31:15 +0100 Subject: [PATCH 09/12] make the footer logo a button, start game when clicking & expand on hover --- src/itdelatrisu/opsu/states/SongMenu.java | 62 +++++++++++++++++------ 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index aae39269..51bf534b 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -259,6 +259,12 @@ public class SongMenu extends BasicGameState { /** Header and footer end and start y coordinates, respectively. */ private float headerY, footerY; + /** Footer pulsing logo button. */ + private MenuButton footerLogoButton; + + /** Whether the cursor hovers over the footer logo. */ + private boolean bottomLogoHovered; + /** Time, in milliseconds, for fading the search bar. */ private int searchTransitionTimer = SEARCH_TRANSITION_TIME; @@ -335,6 +341,14 @@ public class SongMenu extends BasicGameState { Fonts.SMALL.getLineHeight(); footerY = height - GameImage.SELECTION_MODS.getImage().getHeight(); + // logo coordinates + float footerHeight = height - footerY; + Image logo = GameImage.MENU_LOGO.getImage(); + logo = logo.getScaledCopy(footerHeight * 3.25f / logo.getWidth()); + footerLogoButton = new MenuButton(logo, width - footerHeight * 0.8f, height - footerHeight * 0.65f); + footerLogoButton.setHoverAnimationDuration(1); + footerLogoButton.setHoverExpand(1.4f); + // initialize sorts for (BeatmapSortOrder sort : BeatmapSortOrder.values()) sort.init(width, headerY - SongMenu.DIVIDER_LINE_WIDTH / 2); @@ -499,25 +513,25 @@ public class SongMenu extends BasicGameState { g.resetLineWidth(); // opsu logo in bottom bar - float footerHeight = height - footerY; - Image logo = GameImage.MENU_LOGO.getImage(); - float logoSize = footerHeight * 3.25f; - logo = logo.getScaledCopy(logoSize / logo.getWidth()); Float position = MusicController.getBeatProgress(); if (position == null) { position = System.currentTimeMillis() % 1000 / 1000f; } - float x = width - footerHeight * 0.8f; - float y = height - footerHeight * 0.65f; - Image ghostLogo = logo.getScaledCopy((float) (1 - (0 - position) * 0.15)); - logo = logo.getScaledCopy((float) (1 - (position) * 0.15)); - logoSize = logo.getWidth(); - logo.draw(x - logoSize / 2, y - logoSize / 2); - logoSize = ghostLogo.getWidth(); - float a = Colors.GHOST_LOGO.a; - Colors.GHOST_LOGO.a *= (1f - position); - ghostLogo.draw(x - logoSize / 2, y - logoSize / 2, Colors.GHOST_LOGO); - Colors.GHOST_LOGO.a = a; + if (bottomLogoHovered) { + footerLogoButton.draw(); + } else { + float expand = position * 0.15f; + footerLogoButton.draw(Color.white, 1f - expand); + Image ghostLogo = GameImage.MENU_LOGO.getImage(); + ghostLogo = ghostLogo.getScaledCopy((height - footerY) * 3.25f / ghostLogo.getWidth()); + ghostLogo = ghostLogo.getScaledCopy(1f + expand); + float scaleposmodx = ghostLogo.getWidth() / 2; + float scaleposmody = ghostLogo.getHeight() / 2; + float a = Colors.GHOST_LOGO.a; + Colors.GHOST_LOGO.a *= (1f - position); + ghostLogo.draw(footerLogoButton.getX() - scaleposmodx, footerLogoButton.getY() - scaleposmody, Colors.GHOST_LOGO); + Colors.GHOST_LOGO.a = a; + } // header if (focusNode != null) { @@ -774,7 +788,18 @@ public class SongMenu extends BasicGameState { } updateDrawnSongPosition(); - // mouse hover + // mouse hover (logo) + if (footerLogoButton.contains(mouseX, mouseY, 0.25f)) { + footerLogoButton.hoverUpdate(delta, true); + bottomLogoHovered = true; + // reset beatmap node hover + hoverIndex = null; + return; + } + footerLogoButton.hoverUpdate(delta, false); + bottomLogoHovered = false; + + // mouse hover (beatmap nodes) BeatmapSetNode node = getNodeAtPosition(mouseX, mouseY); if (node != null) { if (node == hoverIndex) @@ -817,6 +842,11 @@ public class SongMenu extends BasicGameState { if (isScrollingToFocusNode) return; + if (bottomLogoHovered) { + startGame(); + return; + } + songScrolling.pressed(); startScorePos.pressed(); } From 82e2d2100dc83e85438b5ee76225fd919c269ef1 Mon Sep 17 00:00:00 2001 From: yugecin Date: Tue, 20 Dec 2016 00:32:14 +0100 Subject: [PATCH 10/12] simplify expand scale calc --- src/itdelatrisu/opsu/states/MainMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/itdelatrisu/opsu/states/MainMenu.java b/src/itdelatrisu/opsu/states/MainMenu.java index 40fbe44c..cd0ea0c0 100644 --- a/src/itdelatrisu/opsu/states/MainMenu.java +++ b/src/itdelatrisu/opsu/states/MainMenu.java @@ -262,7 +262,7 @@ public class MainMenu extends BasicGameState { if (position == null) { position = System.currentTimeMillis() % 1000 / 1000f; } - float scale = 1f - (0f - position) * 0.05f; + float scale = 1f + position * 0.05f; logo.draw(Color.white, scale); Image ghostLogo = GameImage.MENU_LOGO.getImage().getScaledCopy(logo.getCurrentScale() / scale * 1.05f); float scaleposmodx = ghostLogo.getWidth() / 2; From 156d52f8c83a54d5814f721fe6cdc6d5631204f7 Mon Sep 17 00:00:00 2001 From: yugecin Date: Tue, 20 Dec 2016 00:40:51 +0100 Subject: [PATCH 11/12] cleanup --- src/itdelatrisu/opsu/beatmap/BeatmapParser.java | 9 +-------- src/itdelatrisu/opsu/states/SongMenu.java | 9 ++++++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapParser.java b/src/itdelatrisu/opsu/beatmap/BeatmapParser.java index 59d20639..37bbb60e 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapParser.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapParser.java @@ -225,8 +225,7 @@ public class BeatmapParser { } try ( InputStream bis = new BufferedInputStream(new FileInputStream(map.getFile())); - MD5InputStreamWrapper md5stream = (!hasNoMD5Algorithm) ? new MD5InputStreamWrapper(bis) : null; - BufferedReader in = new BufferedReader(new InputStreamReader((md5stream != null) ? md5stream : bis, "UTF-8")); + BufferedReader in = new BufferedReader(new InputStreamReader(bis, "UTF-8")); ) { String line; boolean found = false; @@ -249,12 +248,6 @@ public class BeatmapParser { map.timingPoints.trimToSize(); } catch (IOException e) { ErrorHandler.error(String.format("Failed to read file '%s'.", map.getFile().getAbsolutePath()), e, false); - } catch (NoSuchAlgorithmException e) { - ErrorHandler.error("Failed to get MD5 hash stream.", e, true); - - // retry without MD5 - hasNoMD5Algorithm = true; - parseOnlyTimingPoints(map); } } diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index 51bf534b..df46742b 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -262,6 +262,9 @@ public class SongMenu extends BasicGameState { /** Footer pulsing logo button. */ private MenuButton footerLogoButton; + /** Size of the footer pulsing logo. */ + private float footerLogoSize; + /** Whether the cursor hovers over the footer logo. */ private boolean bottomLogoHovered; @@ -343,8 +346,9 @@ public class SongMenu extends BasicGameState { // logo coordinates float footerHeight = height - footerY; + footerLogoSize = footerHeight * 3.25f; Image logo = GameImage.MENU_LOGO.getImage(); - logo = logo.getScaledCopy(footerHeight * 3.25f / logo.getWidth()); + logo = logo.getScaledCopy(footerLogoSize / logo.getWidth()); footerLogoButton = new MenuButton(logo, width - footerHeight * 0.8f, height - footerHeight * 0.65f); footerLogoButton.setHoverAnimationDuration(1); footerLogoButton.setHoverExpand(1.4f); @@ -523,8 +527,7 @@ public class SongMenu extends BasicGameState { float expand = position * 0.15f; footerLogoButton.draw(Color.white, 1f - expand); Image ghostLogo = GameImage.MENU_LOGO.getImage(); - ghostLogo = ghostLogo.getScaledCopy((height - footerY) * 3.25f / ghostLogo.getWidth()); - ghostLogo = ghostLogo.getScaledCopy(1f + expand); + ghostLogo = ghostLogo.getScaledCopy((1f + expand) * footerLogoSize / ghostLogo.getWidth()); float scaleposmodx = ghostLogo.getWidth() / 2; float scaleposmody = ghostLogo.getHeight() / 2; float a = Colors.GHOST_LOGO.a; From 22f6259092f17d878ca72a6c7ff673e88b3bc4b5 Mon Sep 17 00:00:00 2001 From: yugecin Date: Tue, 20 Dec 2016 00:51:38 +0100 Subject: [PATCH 12/12] fix hover scale --- src/itdelatrisu/opsu/states/SongMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index df46742b..1f651d1e 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -351,7 +351,7 @@ public class SongMenu extends BasicGameState { logo = logo.getScaledCopy(footerLogoSize / logo.getWidth()); footerLogoButton = new MenuButton(logo, width - footerHeight * 0.8f, height - footerHeight * 0.65f); footerLogoButton.setHoverAnimationDuration(1); - footerLogoButton.setHoverExpand(1.4f); + footerLogoButton.setHoverExpand(1.2f); // initialize sorts for (BeatmapSortOrder sort : BeatmapSortOrder.values())