diff --git a/src/itdelatrisu/opsu/Utils.java b/src/itdelatrisu/opsu/Utils.java index 87c0749b..2c6efcfb 100644 --- a/src/itdelatrisu/opsu/Utils.java +++ b/src/itdelatrisu/opsu/Utils.java @@ -44,10 +44,8 @@ import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Arrays; import java.util.Date; -import java.util.List; import java.util.Scanner; import java.util.jar.JarFile; @@ -365,45 +363,6 @@ public class Utils { dir.delete(); } - /** - * Wraps the given string into a list of split lines based on the width. - * @param text the text to split - * @param font the font used to draw the string - * @param width the maximum width of a line - * @return the list of split strings - * @author davedes (http://slick.ninjacave.com/forum/viewtopic.php?t=3778) - */ - public static List wrap(String text, org.newdawn.slick.Font font, int width) { - List list = new ArrayList(); - String str = text; - String line = ""; - int i = 0; - int lastSpace = -1; - while (i < str.length()) { - char c = str.charAt(i); - if (Character.isWhitespace(c)) - lastSpace = i; - String append = line + c; - if (font.getWidth(append) > width) { - int split = (lastSpace != -1) ? lastSpace : i; - int splitTrimmed = split; - if (lastSpace != -1 && split < str.length() - 1) - splitTrimmed++; - list.add(str.substring(0, split)); - str = str.substring(splitTrimmed); - line = ""; - i = 0; - lastSpace = -1; - } else { - line = append; - i++; - } - } - if (str.length() != 0) - list.add(str); - return list; - } - /** * Returns a the contents of a URL as a string. * @param url the remote URL diff --git a/src/itdelatrisu/opsu/beatmap/Beatmap.java b/src/itdelatrisu/opsu/beatmap/Beatmap.java index 346072f3..922aedde 100644 --- a/src/itdelatrisu/opsu/beatmap/Beatmap.java +++ b/src/itdelatrisu/opsu/beatmap/Beatmap.java @@ -160,7 +160,7 @@ public class Beatmap implements Comparable { public float HPDrainRate = 5f; /** CS: Size of circles and sliders (0:large ~ 10:small). */ - public float circleSize = 4f; + public float circleSize = 5f; /** OD: Affects timing window, spinners, and approach speed (0:easy ~ 10:hard). */ public float overallDifficulty = 5f; @@ -169,7 +169,7 @@ public class Beatmap implements Comparable { public float approachRate = -1f; /** Slider movement speed multiplier. */ - public float sliderMultiplier = 1f; + public float sliderMultiplier = 1.4f; /** Rate at which slider ticks are placed (x per beat). */ public float sliderTickRate = 1f; diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapSet.java b/src/itdelatrisu/opsu/beatmap/BeatmapSet.java index df96187e..9152438b 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapSet.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSet.java @@ -69,7 +69,7 @@ public class BeatmapSet implements Iterable { *
  • 1: Mapped by {Creator} *
  • 2: Length: {} BPM: {} Objects: {} *
  • 3: Circles: {} Sliders: {} Spinners: {} - *
  • 4: CS:{} HP:{} AR:{} OD:{} + *
  • 4: CS:{} HP:{} AR:{} OD:{} Stars:{} * * @param index the beatmap index * @throws IndexOutOfBoundsException @@ -97,7 +97,7 @@ public class BeatmapSet implements Iterable { Math.min(beatmap.HPDrainRate * multiplier, 10f), Math.min(beatmap.approachRate * multiplier, 10f), Math.min(beatmap.overallDifficulty * multiplier, 10f), - (beatmap.starRating >= 0) ? String.format(" Stars: %.2f", beatmap.starRating) : ""); + (beatmap.starRating >= 0) ? String.format(" Stars:%.2f", beatmap.starRating) : ""); return info; } @@ -131,7 +131,7 @@ public class BeatmapSet implements Iterable { return true; // search: version, tags (remaining beatmaps) - for (int i = 1; i < beatmaps.size(); i++) { + for (int i = 1, n = beatmaps.size(); i < n; i++) { beatmap = beatmaps.get(i); if (beatmap.version.toLowerCase().contains(query) || beatmap.tags.contains(query)) diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java b/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java index 9fdd9fdb..3960856e 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java @@ -45,7 +45,7 @@ public class BeatmapSetList { /** Search pattern for conditional expressions. */ private static final Pattern SEARCH_CONDITION_PATTERN = Pattern.compile( - "(ar|cs|od|hp|bpm|length|stars?)(=|==|>|>=|<|<=)((\\d*\\.)?\\d+)" + "(ar|cs|od|hp|bpm|length|stars?)(==?|>=?|<=?)((\\d*\\.)?\\d+)" ); /** List containing all parsed nodes. */ diff --git a/src/itdelatrisu/opsu/beatmap/HitObject.java b/src/itdelatrisu/opsu/beatmap/HitObject.java index dcf3fa59..522cf296 100644 --- a/src/itdelatrisu/opsu/beatmap/HitObject.java +++ b/src/itdelatrisu/opsu/beatmap/HitObject.java @@ -39,13 +39,6 @@ public class HitObject { TYPE_NEWCOMBO = 4, // not an object TYPE_SPINNER = 8; - /** Hit object type names. */ - private static final String - CIRCLE = "circle", - SLIDER = "slider", - SPINNER = "spinner", - UNKNOWN = "unknown object"; - /** Hit sound types (bits). */ public static final byte SOUND_NORMAL = 0, @@ -320,13 +313,13 @@ public class HitObject { */ public String getTypeName() { if (isCircle()) - return CIRCLE; + return "circle"; else if (isSlider()) - return SLIDER; + return "slider"; else if (isSpinner()) - return SPINNER; + return "spinner"; else - return UNKNOWN; + return "unknown object type"; } /** diff --git a/src/itdelatrisu/opsu/states/ButtonMenu.java b/src/itdelatrisu/opsu/states/ButtonMenu.java index 23843f35..7f31b3cb 100644 --- a/src/itdelatrisu/opsu/states/ButtonMenu.java +++ b/src/itdelatrisu/opsu/states/ButtonMenu.java @@ -420,7 +420,7 @@ public class ButtonMenu extends BasicGameState { for (int i = 0; i < title.length; i++) { // wrap text if too long if (Fonts.LARGE.getWidth(title[i]) > maxLineWidth) { - List list = Utils.wrap(title[i], Fonts.LARGE, maxLineWidth); + List list = Fonts.wrap(Fonts.LARGE, title[i], maxLineWidth); actualTitle.addAll(list); } else actualTitle.add(title[i]); diff --git a/src/itdelatrisu/opsu/ui/Fonts.java b/src/itdelatrisu/opsu/ui/Fonts.java index 5513ae90..6de998c9 100644 --- a/src/itdelatrisu/opsu/ui/Fonts.java +++ b/src/itdelatrisu/opsu/ui/Fonts.java @@ -24,8 +24,10 @@ import itdelatrisu.opsu.Options; import java.awt.Font; import java.awt.FontFormatException; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import org.newdawn.slick.SlickException; import org.newdawn.slick.UnicodeFont; @@ -110,4 +112,43 @@ public class Fonts { Log.warn(String.format("Failed to load glyphs for string '%s'.", s), e); } } + + /** + * Wraps the given string into a list of split lines based on the width. + * @param font the font used to draw the string + * @param text the text to split + * @param width the maximum width of a line + * @return the list of split strings + * @author davedes (http://slick.ninjacave.com/forum/viewtopic.php?t=3778) + */ + public static List wrap(org.newdawn.slick.Font font, String text, int width) { + List list = new ArrayList(); + String str = text; + String line = ""; + int i = 0; + int lastSpace = -1; + while (i < str.length()) { + char c = str.charAt(i); + if (Character.isWhitespace(c)) + lastSpace = i; + String append = line + c; + if (font.getWidth(append) > width) { + int split = (lastSpace != -1) ? lastSpace : i; + int splitTrimmed = split; + if (lastSpace != -1 && split < str.length() - 1) + splitTrimmed++; + list.add(str.substring(0, split)); + str = str.substring(splitTrimmed); + line = ""; + i = 0; + lastSpace = -1; + } else { + line = append; + i++; + } + } + if (str.length() != 0) + list.add(str); + return list; + } }