diff --git a/res/cursor2.png b/res/cursor2.png deleted file mode 100644 index 5fef2fd7..00000000 Binary files a/res/cursor2.png and /dev/null differ diff --git a/res/cursortrail2.png b/res/cursortrail2.png deleted file mode 100644 index 9b644d0a..00000000 Binary files a/res/cursortrail2.png and /dev/null differ diff --git a/src/itdelatrisu/opsu/GameData.java b/src/itdelatrisu/opsu/GameData.java index d291429e..3d4f7449 100644 --- a/src/itdelatrisu/opsu/GameData.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -414,8 +414,9 @@ public void loadImages() { comboBurstImages = new Image[]{ GameImage.COMBO_BURST.getImage() }; // scorebar-colour animation - Image[] scorebar = GameImage.SCOREBAR_COLOUR.getImages(); - scorebarColour = (scorebar != null) ? new Animation(scorebar, 60) : null; + scorebarColour = null; + if (GameImage.SCOREBAR_COLOUR.getImages() != null) + scorebarColour = GameImage.SCOREBAR_COLOUR.getAnimation(); // default symbol images defaultSymbols = new Image[10]; diff --git a/src/itdelatrisu/opsu/GameImage.java b/src/itdelatrisu/opsu/GameImage.java index 2899824c..2a90eaa8 100644 --- a/src/itdelatrisu/opsu/GameImage.java +++ b/src/itdelatrisu/opsu/GameImage.java @@ -37,8 +37,6 @@ public enum GameImage { CURSOR ("cursor", "png"), CURSOR_MIDDLE ("cursormiddle", "png"), CURSOR_TRAIL ("cursortrail", "png"), - CURSOR_OLD ("cursor2", "png", false, false), // custom - CURSOR_TRAIL_OLD ("cursortrail2", "png", false, false), // custom // Game SECTION_PASS ("section-pass", "png"), @@ -565,6 +563,22 @@ public Image getImage() { return (skinImage != null) ? skinImage : defaultImage; } + /** + * Returns an Animation based on the image array. + * If no image array exists, returns the single image as an animation. + */ + public Animation getAnimation() { + Image[] images = getImages(); + if (images == null) + images = new Image[] { getImage() }; + + int fps = Options.getSkin().getAnimationFramerate(); + if (fps == -1) + fps = images.length; + + return new Animation(images, 1000 / fps); + } + /** * Returns an Animation based on the image array. * If no image array exists, returns the single image as an animation. @@ -574,6 +588,7 @@ public Animation getAnimation(int duration){ Image[] images = getImages(); if (images == null) images = new Image[] { getImage() }; + return new Animation(images, duration); } diff --git a/src/itdelatrisu/opsu/OptionGroup.java b/src/itdelatrisu/opsu/OptionGroup.java index 741d9590..3928b93c 100644 --- a/src/itdelatrisu/opsu/OptionGroup.java +++ b/src/itdelatrisu/opsu/OptionGroup.java @@ -65,7 +65,6 @@ public class OptionGroup { GameOption.DISABLE_MOUSE_WHEEL, GameOption.DISABLE_MOUSE_BUTTONS, GameOption.CURSOR_SIZE, - GameOption.NEW_CURSOR, GameOption.DISABLE_CURSOR }), new OptionGroup("Custom", new GameOption[] { diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 9fc303ec..0cb6db99 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -479,13 +479,6 @@ public void read(String s) { val = i; } }, - NEW_CURSOR ("Enable New Cursor", "NewCursor", "Use the new cursor style (may cause higher CPU usage).", true) { - @Override - public void toggle(GameContainer container) { - super.toggle(container); - UI.getCursor().reset(); - } - }, DYNAMIC_BACKGROUND ("Enable Dynamic Backgrounds", "DynamicBackground", "The song background will be used as the main menu background.", true), LOAD_VERBOSE ("Show Detailed Loading Progress", "LoadVerbose", "Display more specific loading information in the splash screen.", false), MASTER_VOLUME ("Master Volume", "VolumeUniversal", "Global volume level.", 35, 0, 100) { @@ -1039,12 +1032,6 @@ public static void setDisplayMode(Container app) { */ public static float getCursorScale() { return GameOption.CURSOR_SIZE.getIntegerValue() / 100f; } - /** - * Returns whether or not the new cursor type is enabled. - * @return true if enabled - */ - public static boolean isNewCursorEnabled() { return GameOption.NEW_CURSOR.getBooleanValue(); } - /** * Returns whether or not the main menu background should be the current track image. * @return true if enabled diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 0a08bd05..0968f92a 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -325,6 +325,8 @@ public void draw(Graphics g, int trackPosition) { // float dis = hitObject.getPixelLength() * HitObject.getXMultiplier() * (t - (int) t); // Image sliderBallFrame = sliderBallImages[(int) (dis / (diameter * Math.PI) * 30) % sliderBallImages.length]; Image sliderBallFrame = sliderBallImages[(int) (t * sliderTime * 60 / 1000) % sliderBallImages.length]; + if (currentRepeats % 2 == 1 && Options.getSkin().isSliderBallFlipped()) + sliderBallFrame = sliderBallFrame.getFlippedCopy(true, false); float angle = (float) (Math.atan2(c2.y - c.y, c2.x - c.x) * 180 / Math.PI); sliderBallFrame.setRotation(angle); sliderBallFrame.drawCentered(c.x, c.y); diff --git a/src/itdelatrisu/opsu/skins/Skin.java b/src/itdelatrisu/opsu/skins/Skin.java index 81f36955..3e9b4e21 100644 --- a/src/itdelatrisu/opsu/skins/Skin.java +++ b/src/itdelatrisu/opsu/skins/Skin.java @@ -273,7 +273,7 @@ public Skin(File dir) { /** * Returns the frame rate of animations. - * @return the FPS, or {@code -1} (TODO) + * @return the FPS, or {@code -1} if not set */ public int getAnimationFramerate() { return animationFramerate; } diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index 96631c28..3aed57de 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -1723,7 +1723,7 @@ private void loadImages() { // skip button if (GameImage.SKIP.getImages() != null) { - Animation skip = GameImage.SKIP.getAnimation(120); + Animation skip = GameImage.SKIP.getAnimation(); skipButton = new MenuButton(skip, width - skip.getWidth() / 2f, height - (skip.getHeight() / 2f)); } else { Image skip = GameImage.SKIP.getImage(); diff --git a/src/itdelatrisu/opsu/ui/Cursor.java b/src/itdelatrisu/opsu/ui/Cursor.java index 63304874..62346033 100644 --- a/src/itdelatrisu/opsu/ui/Cursor.java +++ b/src/itdelatrisu/opsu/ui/Cursor.java @@ -118,24 +118,19 @@ public void draw(int mouseX, int mouseY, boolean mousePressed) { if (Options.isCursorDisabled()) return; - // determine correct cursor image - Image cursor = null, cursorMiddle = null, cursorTrail = null; - boolean beatmapSkinned = GameImage.CURSOR.hasBeatmapSkinImage(); - boolean newStyle, hasMiddle; Skin skin = Options.getSkin(); - if (beatmapSkinned) { - newStyle = true; // osu! currently treats all beatmap cursors as new-style cursors - hasMiddle = GameImage.CURSOR_MIDDLE.hasBeatmapSkinImage(); + + // determine correct cursor image + Image cursor = GameImage.CURSOR.getImage(); + Image cursorTrail = GameImage.CURSOR_TRAIL.getImage(); + Image cursorMiddle = null; + if (GameImage.CURSOR.hasBeatmapSkinImage()) { + if (GameImage.CURSOR_MIDDLE.hasBeatmapSkinImage()) + cursorMiddle = GameImage.CURSOR_MIDDLE.getImage(); + } else if (GameImage.CURSOR.hasGameSkinImage()) { + if (GameImage.CURSOR_MIDDLE.hasGameSkinImage()) + cursorMiddle = GameImage.CURSOR_MIDDLE.getImage(); } else - newStyle = hasMiddle = Options.isNewCursorEnabled(); - if (newStyle || beatmapSkinned) { - cursor = GameImage.CURSOR.getImage(); - cursorTrail = GameImage.CURSOR_TRAIL.getImage(); - } else { - cursor = GameImage.CURSOR.hasGameSkinImage() ? GameImage.CURSOR.getImage() : GameImage.CURSOR_OLD.getImage(); - cursorTrail = GameImage.CURSOR_TRAIL.hasGameSkinImage() ? GameImage.CURSOR_TRAIL.getImage() : GameImage.CURSOR_TRAIL_OLD.getImage(); - } - if (hasMiddle) cursorMiddle = GameImage.CURSOR_MIDDLE.getImage(); // scale cursor @@ -159,7 +154,7 @@ public void draw(int mouseX, int mouseY, boolean mousePressed) { // TODO: use an image buffer int removeCount = 0; float FPSmod = Math.max(container.getFPS(), 1) / 60f; - if (newStyle) { + if (cursorMiddle != null) { // new style: add all points between cursor movements if (lastPosition == null) { lastPosition = new Point(mouseX, mouseY); @@ -187,25 +182,36 @@ public void draw(int mouseX, int mouseY, boolean mousePressed) { float t = 2f / trail.size(); int cursorTrailWidth = cursorTrail.getWidth(), cursorTrailHeight = cursorTrail.getHeight(); float cursorTrailRotation = (skin.isCursorTrailRotated()) ? cursorAngle : 0; + float offsetX = -cursorTrailWidth / 2f, offsetY = -cursorTrailHeight / 2f; + if (!skin.isCursorCentered()) + offsetX = offsetY = 0f; cursorTrail.startUse(); for (Point p : trail) { alpha += t; cursorTrail.setImageColor(1f, 1f, 1f, alpha); cursorTrail.drawEmbedded( - p.x - (cursorTrailWidth / 2f), p.y - (cursorTrailHeight / 2f), - cursorTrailWidth, cursorTrailHeight, cursorTrailRotation); + p.x + offsetX, p.y + offsetY, + cursorTrailWidth, cursorTrailHeight, cursorTrailRotation + ); } cursorTrail.drawEmbedded( - mouseX - (cursorTrailWidth / 2f), mouseY - (cursorTrailHeight / 2f), - cursorTrailWidth, cursorTrailHeight, cursorTrailRotation); + mouseX + offsetX, mouseY + offsetY, + cursorTrailWidth, cursorTrailHeight, cursorTrailRotation + ); cursorTrail.endUse(); // draw the other components - if (newStyle && skin.isCursorRotated()) + if (skin.isCursorRotated()) cursor.setRotation(cursorAngle); - cursor.drawCentered(mouseX, mouseY); - if (hasMiddle) - cursorMiddle.drawCentered(mouseX, mouseY); + if (skin.isCursorCentered()) { + cursor.drawCentered(mouseX, mouseY); + if (cursorMiddle != null) + cursorMiddle.drawCentered(mouseX, mouseY); + } else { + cursor.draw(mouseX, mouseY); + if (cursorMiddle != null) + cursorMiddle.drawCentered(mouseX + cursor.getWidth() / 2, mouseY + cursor.getHeight() / 2); + } } /** diff --git a/src/itdelatrisu/opsu/ui/UI.java b/src/itdelatrisu/opsu/ui/UI.java index 2aa3f62f..b750e07c 100644 --- a/src/itdelatrisu/opsu/ui/UI.java +++ b/src/itdelatrisu/opsu/ui/UI.java @@ -97,7 +97,7 @@ public static void init(GameContainer container, StateBasedGame game) { // back button if (GameImage.MENU_BACK.getImages() != null) { - Animation back = GameImage.MENU_BACK.getAnimation(120); + Animation back = GameImage.MENU_BACK.getAnimation(); backButton = new MenuButton(back, back.getWidth() / 2f, container.getHeight() - (back.getHeight() / 2f)); } else { Image back = GameImage.MENU_BACK.getImage();