diff --git a/src/itdelatrisu/opsu/GameData.java b/src/itdelatrisu/opsu/GameData.java index 715eaf38..dccaa93c 100644 --- a/src/itdelatrisu/opsu/GameData.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -23,7 +23,7 @@ import itdelatrisu.opsu.audio.MusicController; import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.beatmap.Beatmap; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.downloads.Updater; import itdelatrisu.opsu.objects.curves.Curve; import itdelatrisu.opsu.replay.Replay; @@ -1156,7 +1156,7 @@ public class GameData { * @param hitObject the hit object * @param repeat the current repeat number */ - public void sliderTickResult(int time, int result, float x, float y, OsuHitObject hitObject, int repeat) { + public void sliderTickResult(int time, int result, float x, float y, HitObject hitObject, int repeat) { int hitValue = 0; switch (result) { case HIT_SLIDER30: @@ -1204,7 +1204,7 @@ public class GameData { * @return the actual hit result (HIT_* constants) */ private int handleHitResult(int time, int result, float x, float y, Color color, - boolean end, OsuHitObject hitObject, int repeat, HitObjectType hitResultType) { + boolean end, HitObject hitObject, int repeat, HitObjectType hitResultType) { int hitValue = 0; switch (result) { case HIT_300: @@ -1286,7 +1286,7 @@ public class GameData { * @param expand whether or not the hit result animation should expand (if applicable) */ public void hitResult(int time, int result, float x, float y, Color color, - boolean end, OsuHitObject hitObject, int repeat, + boolean end, HitObject hitObject, int repeat, HitObjectType hitResultType, Curve curve, boolean expand) { result = handleHitResult(time, result, x, y, color, end, hitObject, repeat, hitResultType); diff --git a/src/itdelatrisu/opsu/OsuParser.java b/src/itdelatrisu/opsu/OsuParser.java index 7eaeaa5e..dda69f61 100644 --- a/src/itdelatrisu/opsu/OsuParser.java +++ b/src/itdelatrisu/opsu/OsuParser.java @@ -21,7 +21,7 @@ package itdelatrisu.opsu; import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.beatmap.BeatmapSetList; import itdelatrisu.opsu.beatmap.BeatmapSetNode; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.db.BeatmapDB; @@ -544,11 +544,11 @@ public class OsuParser { tokens = line.split(","); try { type = Integer.parseInt(tokens[3]); - if ((type & OsuHitObject.TYPE_CIRCLE) > 0) + if ((type & HitObject.TYPE_CIRCLE) > 0) beatmap.hitObjectCircle++; - else if ((type & OsuHitObject.TYPE_SLIDER) > 0) + else if ((type & HitObject.TYPE_SLIDER) > 0) beatmap.hitObjectSlider++; - else //if ((type & OsuHitObject.TYPE_SPINNER) > 0) + else //if ((type & HitObject.TYPE_SPINNER) > 0) beatmap.hitObjectSpinner++; } catch (Exception e) { Log.warn(String.format("Failed to read hit object '%s' for file '%s'.", @@ -558,7 +558,7 @@ public class OsuParser { try { // map length = last object end time (TODO: end on slider?) - if ((type & OsuHitObject.TYPE_SPINNER) > 0) { + if ((type & HitObject.TYPE_SPINNER) > 0) { // some 'endTime' fields contain a ':' character (?) int index = tokens[5].indexOf(':'); if (index != -1) @@ -603,7 +603,7 @@ public class OsuParser { if (beatmap.objects != null) // already parsed return; - beatmap.objects = new OsuHitObject[(beatmap.hitObjectCircle + beatmap.hitObjectSlider + beatmap.hitObjectSpinner)]; + beatmap.objects = new HitObject[(beatmap.hitObjectCircle + beatmap.hitObjectSlider + beatmap.hitObjectSpinner)]; try (BufferedReader in = new BufferedReader(new FileReader(beatmap.getFile()))) { String line = in.readLine(); @@ -638,8 +638,8 @@ public class OsuParser { continue; try { - // create a new OsuHitObject for each line - OsuHitObject hitObject = new OsuHitObject(line); + // create a new HitObject for each line + HitObject hitObject = new HitObject(line); // set combo info // - new combo: get next combo index, reset combo number diff --git a/src/itdelatrisu/opsu/Utils.java b/src/itdelatrisu/opsu/Utils.java index 653a4594..070eb8d3 100644 --- a/src/itdelatrisu/opsu/Utils.java +++ b/src/itdelatrisu/opsu/Utils.java @@ -20,7 +20,7 @@ package itdelatrisu.opsu; import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundEffect; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.downloads.Download; import itdelatrisu.opsu.downloads.DownloadNode; import itdelatrisu.opsu.replay.PlaybackSpeed; @@ -191,7 +191,7 @@ public class Utils { PlaybackSpeed.init(width, height); // initialize hit objects - OsuHitObject.init(width, height); + HitObject.init(width, height); // initialize download nodes DownloadNode.init(width, height); diff --git a/src/itdelatrisu/opsu/audio/SoundController.java b/src/itdelatrisu/opsu/audio/SoundController.java index 04d1dada..c6022879 100644 --- a/src/itdelatrisu/opsu/audio/SoundController.java +++ b/src/itdelatrisu/opsu/audio/SoundController.java @@ -21,7 +21,7 @@ package itdelatrisu.opsu.audio; import itdelatrisu.opsu.ErrorHandler; import itdelatrisu.opsu.Options; import itdelatrisu.opsu.audio.HitSound.SampleSet; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import java.io.File; import java.io.IOException; @@ -262,7 +262,7 @@ public class SoundController { } /** - * Plays hit sound(s) using an OsuHitObject bitmask. + * Plays hit sound(s) using a HitObject bitmask. * @param hitSound the hit sound (bitmask) * @param sampleSet the sample set * @param additionSampleSet the 'addition' sample set @@ -280,11 +280,11 @@ public class SoundController { playClip(HitSound.NORMAL.getClip(), volume, null); HitSound.setSampleSet(additionSampleSet); - if ((hitSound & OsuHitObject.SOUND_WHISTLE) > 0) + if ((hitSound & HitObject.SOUND_WHISTLE) > 0) playClip(HitSound.WHISTLE.getClip(), volume, null); - if ((hitSound & OsuHitObject.SOUND_FINISH) > 0) + if ((hitSound & HitObject.SOUND_FINISH) > 0) playClip(HitSound.FINISH.getClip(), volume, null); - if ((hitSound & OsuHitObject.SOUND_CLAP) > 0) + if ((hitSound & HitObject.SOUND_CLAP) > 0) playClip(HitSound.CLAP.getClip(), volume, null); } diff --git a/src/itdelatrisu/opsu/beatmap/Beatmap.java b/src/itdelatrisu/opsu/beatmap/Beatmap.java index d5cc236d..4f04d5a7 100644 --- a/src/itdelatrisu/opsu/beatmap/Beatmap.java +++ b/src/itdelatrisu/opsu/beatmap/Beatmap.java @@ -188,7 +188,7 @@ public class Beatmap implements Comparable { */ /** All hit objects. */ - public OsuHitObject[] objects; + public HitObject[] objects; /** Number of individual objects. */ public int diff --git a/src/itdelatrisu/opsu/beatmap/OsuHitObject.java b/src/itdelatrisu/opsu/beatmap/HitObject.java similarity index 97% rename from src/itdelatrisu/opsu/beatmap/OsuHitObject.java rename to src/itdelatrisu/opsu/beatmap/HitObject.java index a05bd7ae..f32997ce 100644 --- a/src/itdelatrisu/opsu/beatmap/OsuHitObject.java +++ b/src/itdelatrisu/opsu/beatmap/HitObject.java @@ -26,7 +26,7 @@ import java.text.NumberFormat; /** * Data type representing a parsed hit object. */ -public class OsuHitObject { +public class HitObject { /** Hit object types (bits). */ public static final int TYPE_CIRCLE = 1, @@ -135,7 +135,7 @@ public class OsuHitObject { private int stack; /** - * Initializes the OsuHitObject data type with container dimensions. + * Initializes the HitObject data type with container dimensions. * @param width the container width * @param height the container height */ @@ -177,7 +177,7 @@ public class OsuHitObject { * Constructor. * @param line the line to be parsed */ - public OsuHitObject(String line) { + public HitObject(String line) { /** * [OBJECT FORMATS] * Circles: @@ -205,9 +205,9 @@ public class OsuHitObject { // type-specific fields int additionIndex; - if ((type & OsuHitObject.TYPE_CIRCLE) > 0) + if ((type & HitObject.TYPE_CIRCLE) > 0) additionIndex = 5; - else if ((type & OsuHitObject.TYPE_SLIDER) > 0) { + else if ((type & HitObject.TYPE_SLIDER) > 0) { additionIndex = 10; // slider curve type and coordinates @@ -237,7 +237,7 @@ public class OsuHitObject { edgeAddition[j][1] = Byte.parseByte(tedgeAddition[1]); } } - } else { //if ((type & OsuHitObject.TYPE_SPINNER) > 0) { + } else { //if ((type & HitObject.TYPE_SPINNER) > 0) { additionIndex = 6; // some 'endTime' fields contain a ':' character (?) diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index fb93f3d3..0f5b1d33 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -23,7 +23,7 @@ import itdelatrisu.opsu.GameData.HitObjectType; import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.Utils; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.states.Game; import org.newdawn.slick.Color; @@ -33,12 +33,12 @@ import org.newdawn.slick.Graphics; /** * Data type representing a circle object. */ -public class Circle implements HitObject { +public class Circle implements GameObject { /** The amount of time, in milliseconds, to fade in the circle. */ private static final int FADE_IN_TIME = 375; - /** The associated OsuHitObject. */ - private OsuHitObject hitObject; + /** The associated HitObject. */ + private HitObject hitObject; /** The scaled starting x, y coordinates. */ private float x, y; @@ -62,7 +62,7 @@ public class Circle implements HitObject { */ public static void init(GameContainer container, float circleSize) { int diameter = (int) (104 - (circleSize * 8)); - diameter = (int) (diameter * OsuHitObject.getXMultiplier()); // convert from Osupixels (640x480) + diameter = (int) (diameter * HitObject.getXMultiplier()); // convert from Osupixels (640x480) GameImage.HITCIRCLE.setImage(GameImage.HITCIRCLE.getImage().getScaledCopy(diameter, diameter)); GameImage.HITCIRCLE_OVERLAY.setImage(GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(diameter, diameter)); GameImage.APPROACHCIRCLE.setImage(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(diameter, diameter)); @@ -70,13 +70,13 @@ public class Circle implements HitObject { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param game the associated Game object * @param data the associated GameData object * @param color the color of this circle * @param comboEnd true if this is the last hit object in the combo */ - public Circle(OsuHitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) { + public Circle(HitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) { this.hitObject = hitObject; this.game = game; this.data = data; diff --git a/src/itdelatrisu/opsu/objects/DummyObject.java b/src/itdelatrisu/opsu/objects/DummyObject.java index 59e960f4..3f928c36 100644 --- a/src/itdelatrisu/opsu/objects/DummyObject.java +++ b/src/itdelatrisu/opsu/objects/DummyObject.java @@ -18,25 +18,25 @@ package itdelatrisu.opsu.objects; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import org.newdawn.slick.Graphics; /** - * Dummy hit object, used when another HitObject class cannot be created. + * Dummy hit object, used when another GameObject class cannot be created. */ -public class DummyObject implements HitObject { - /** The associated OsuHitObject. */ - private OsuHitObject hitObject; +public class DummyObject implements GameObject { + /** The associated HitObject. */ + private HitObject hitObject; /** The scaled starting x, y coordinates. */ private float x, y; /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject */ - public DummyObject(OsuHitObject hitObject) { + public DummyObject(HitObject hitObject) { this.hitObject = hitObject; updatePosition(); } diff --git a/src/itdelatrisu/opsu/objects/HitObject.java b/src/itdelatrisu/opsu/objects/GameObject.java similarity index 96% rename from src/itdelatrisu/opsu/objects/HitObject.java rename to src/itdelatrisu/opsu/objects/GameObject.java index b87247be..ca1ab8e5 100644 --- a/src/itdelatrisu/opsu/objects/HitObject.java +++ b/src/itdelatrisu/opsu/objects/GameObject.java @@ -21,9 +21,9 @@ package itdelatrisu.opsu.objects; import org.newdawn.slick.Graphics; /** - * Hit object interface. + * Interface for hit object types used during gameplay. */ -public interface HitObject { +public interface GameObject { /** * Draws the hit object to the graphics context. * @param g the graphics context diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 9b265c78..ee91b563 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -24,7 +24,7 @@ import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.beatmap.Beatmap; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.objects.curves.CatmullCurve; import itdelatrisu.opsu.objects.curves.CircumscribedCircle; import itdelatrisu.opsu.objects.curves.Curve; @@ -39,7 +39,7 @@ import org.newdawn.slick.Image; /** * Data type representing a slider object. */ -public class Slider implements HitObject { +public class Slider implements GameObject { /** Slider ball frames. */ private static Image[] sliderBallImages; @@ -52,8 +52,8 @@ public class Slider implements HitObject { /** The amount of time, in milliseconds, to fade in the slider. */ private static final int FADE_IN_TIME = 375; - /** The associated OsuHitObject. */ - private OsuHitObject hitObject; + /** The associated HitObject. */ + private HitObject hitObject; /** The scaled starting x, y coordinates. */ protected float x, y; @@ -111,7 +111,7 @@ public class Slider implements HitObject { containerHeight = container.getHeight(); int diameter = (int) (104 - (circleSize * 8)); - diameter = (int) (diameter * OsuHitObject.getXMultiplier()); // convert from Osupixels (640x480) + diameter = (int) (diameter * HitObject.getXMultiplier()); // convert from Osupixels (640x480) // slider ball if (GameImage.SLIDER_BALL.hasSkinImages() || @@ -132,13 +132,13 @@ public class Slider implements HitObject { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param game the associated Game object * @param data the associated GameData object * @param color the color of this slider * @param comboEnd true if this is the last hit object in the combo */ - public Slider(OsuHitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) { + public Slider(HitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) { this.hitObject = hitObject; this.game = game; this.data = data; @@ -238,7 +238,7 @@ public class Slider implements HitObject { float[] c2 = curve.pointAt(getT(trackPosition, false) + 0.01f); float t = getT(trackPosition, false); -// float dis = hitObject.getPixelLength() * OsuHitObject.getXMultiplier() * (t - (int) t); +// 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]; float angle = (float) (Math.atan2(c2[1] - c[1], c2[0] - c[0]) * 180 / Math.PI); @@ -458,12 +458,12 @@ public class Slider implements HitObject { this.x = hitObject.getScaledX(); this.y = hitObject.getScaledY(); - if (hitObject.getSliderType() == OsuHitObject.SLIDER_PASSTHROUGH && hitObject.getSliderX().length == 2) + if (hitObject.getSliderType() == HitObject.SLIDER_PASSTHROUGH && hitObject.getSliderX().length == 2) this.curve = new CircumscribedCircle(hitObject, color); - else if (hitObject.getSliderType() == OsuHitObject.SLIDER_CATMULL) + else if (hitObject.getSliderType() == HitObject.SLIDER_CATMULL) this.curve = new CatmullCurve(hitObject, color); else - this.curve = new LinearBezier(hitObject, color, hitObject.getSliderType() == OsuHitObject.SLIDER_LINEAR); + this.curve = new LinearBezier(hitObject, color, hitObject.getSliderType() == HitObject.SLIDER_LINEAR); } @Override diff --git a/src/itdelatrisu/opsu/objects/Spinner.java b/src/itdelatrisu/opsu/objects/Spinner.java index 7ea02ed9..4c138a47 100644 --- a/src/itdelatrisu/opsu/objects/Spinner.java +++ b/src/itdelatrisu/opsu/objects/Spinner.java @@ -25,7 +25,7 @@ import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundEffect; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.states.Game; import org.newdawn.slick.Color; @@ -36,7 +36,7 @@ import org.newdawn.slick.Image; /** * Data type representing a spinner object. */ -public class Spinner implements HitObject { +public class Spinner implements GameObject { /** Container dimensions. */ private static int width, height; @@ -60,8 +60,8 @@ public class Spinner implements HitObject { TWO_PI = (float) (Math.PI * 2), HALF_PI = (float) (Math.PI / 2); - /** The associated OsuHitObject. */ - private OsuHitObject hitObject; + /** The associated HitObject. */ + private HitObject hitObject; /** The associated GameData object. */ private GameData data; @@ -104,11 +104,11 @@ public class Spinner implements HitObject { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param game the associated Game object * @param data the associated GameData object */ - public Spinner(OsuHitObject hitObject, Game game, GameData data) { + public Spinner(HitObject hitObject, Game game, GameData data) { this.hitObject = hitObject; this.data = data; diff --git a/src/itdelatrisu/opsu/objects/curves/CatmullCurve.java b/src/itdelatrisu/opsu/objects/curves/CatmullCurve.java index 4487b562..95842e77 100644 --- a/src/itdelatrisu/opsu/objects/curves/CatmullCurve.java +++ b/src/itdelatrisu/opsu/objects/curves/CatmullCurve.java @@ -19,7 +19,7 @@ package itdelatrisu.opsu.objects.curves; import itdelatrisu.opsu.ErrorHandler; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import java.util.LinkedList; @@ -34,10 +34,10 @@ import org.newdawn.slick.SlickException; public class CatmullCurve extends EqualDistanceMultiCurve { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param color the color of this curve */ - public CatmullCurve(OsuHitObject hitObject, Color color) { + public CatmullCurve(HitObject hitObject, Color color) { super(hitObject, color); LinkedList catmulls = new LinkedList(); int ncontrolPoints = hitObject.getSliderX().length + 1; diff --git a/src/itdelatrisu/opsu/objects/curves/CircumscribedCircle.java b/src/itdelatrisu/opsu/objects/curves/CircumscribedCircle.java index 21cd7cef..b62c17af 100644 --- a/src/itdelatrisu/opsu/objects/curves/CircumscribedCircle.java +++ b/src/itdelatrisu/opsu/objects/curves/CircumscribedCircle.java @@ -19,7 +19,7 @@ package itdelatrisu.opsu.objects.curves; import itdelatrisu.opsu.ErrorHandler; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import org.newdawn.slick.Color; @@ -52,10 +52,10 @@ public class CircumscribedCircle extends Curve { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param color the color of this curve */ - public CircumscribedCircle(OsuHitObject hitObject, Color color) { + public CircumscribedCircle(HitObject hitObject, Color color) { super(hitObject, color); // construct the three points @@ -103,7 +103,7 @@ public class CircumscribedCircle extends Curve { // find an angle with an arc length of pixelLength along this circle this.radius = startAngPoint.len(); - float pixelLength = hitObject.getPixelLength() * OsuHitObject.getXMultiplier(); + float pixelLength = hitObject.getPixelLength() * HitObject.getXMultiplier(); float arcAng = pixelLength / radius; // len = theta * r / theta = len / r // now use it for our new end angle diff --git a/src/itdelatrisu/opsu/objects/curves/Curve.java b/src/itdelatrisu/opsu/objects/curves/Curve.java index 63e0226c..77a25829 100644 --- a/src/itdelatrisu/opsu/objects/curves/Curve.java +++ b/src/itdelatrisu/opsu/objects/curves/Curve.java @@ -20,7 +20,7 @@ package itdelatrisu.opsu.objects.curves; import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.Utils; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import org.newdawn.slick.Color; import org.newdawn.slick.Image; @@ -34,8 +34,8 @@ public abstract class Curve { /** Points generated along the curve should be spaced this far apart. */ protected static float CURVE_POINTS_SEPERATION = 5; - /** The associated OsuHitObject. */ - protected OsuHitObject hitObject; + /** The associated HitObject. */ + protected HitObject hitObject; /** The scaled starting x, y coordinates. */ protected float x, y; @@ -48,10 +48,10 @@ public abstract class Curve { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param color the color of this curve */ - protected Curve(OsuHitObject hitObject, Color color) { + protected Curve(HitObject hitObject, Color color) { this.hitObject = hitObject; this.x = hitObject.getScaledX(); this.y = hitObject.getScaledY(); diff --git a/src/itdelatrisu/opsu/objects/curves/EqualDistanceMultiCurve.java b/src/itdelatrisu/opsu/objects/curves/EqualDistanceMultiCurve.java index 9ca0a78e..a15a1657 100644 --- a/src/itdelatrisu/opsu/objects/curves/EqualDistanceMultiCurve.java +++ b/src/itdelatrisu/opsu/objects/curves/EqualDistanceMultiCurve.java @@ -18,7 +18,7 @@ package itdelatrisu.opsu.objects.curves; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import java.util.Iterator; import java.util.LinkedList; @@ -40,10 +40,10 @@ public abstract class EqualDistanceMultiCurve extends Curve { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param color the color of this curve */ - public EqualDistanceMultiCurve(OsuHitObject hitObject, Color color) { + public EqualDistanceMultiCurve(HitObject hitObject, Color color) { super(hitObject, color); } @@ -65,7 +65,7 @@ public abstract class EqualDistanceMultiCurve extends Curve { float lastDistanceAt = 0; // length of Curve should equal pixel length (in 640x480) - float pixelLength = hitObject.getPixelLength() * OsuHitObject.getXMultiplier(); + float pixelLength = hitObject.getPixelLength() * HitObject.getXMultiplier(); // for each distance, try to get in between the two points that are between it for (int i = 0; i < ncurve + 1; i++) { diff --git a/src/itdelatrisu/opsu/objects/curves/LinearBezier.java b/src/itdelatrisu/opsu/objects/curves/LinearBezier.java index 74ce9ef7..3ec6717a 100644 --- a/src/itdelatrisu/opsu/objects/curves/LinearBezier.java +++ b/src/itdelatrisu/opsu/objects/curves/LinearBezier.java @@ -18,7 +18,7 @@ package itdelatrisu.opsu.objects.curves; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import java.util.LinkedList; @@ -33,11 +33,11 @@ import org.newdawn.slick.Color; public class LinearBezier extends EqualDistanceMultiCurve { /** * Constructor. - * @param hitObject the associated OsuHitObject + * @param hitObject the associated HitObject * @param color the color of this curve * @param line whether a new curve should be generated for each sequential pair */ - public LinearBezier(OsuHitObject hitObject, Color color, boolean line) { + public LinearBezier(HitObject hitObject, Color color, boolean line) { super(hitObject, color); LinkedList beziers = new LinkedList(); diff --git a/src/itdelatrisu/opsu/replay/ReplayFrame.java b/src/itdelatrisu/opsu/replay/ReplayFrame.java index 1d42e3c3..9f8e9f98 100644 --- a/src/itdelatrisu/opsu/replay/ReplayFrame.java +++ b/src/itdelatrisu/opsu/replay/ReplayFrame.java @@ -18,7 +18,7 @@ package itdelatrisu.opsu.replay; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; /** * Captures a single replay frame. @@ -98,12 +98,12 @@ public class ReplayFrame { /** * Returns the scaled cursor x coordinate. */ - public int getScaledX() { return (int) (x * OsuHitObject.getXMultiplier() + OsuHitObject.getXOffset()); } + public int getScaledX() { return (int) (x * HitObject.getXMultiplier() + HitObject.getXOffset()); } /** * Returns the scaled cursor y coordinate. */ - public int getScaledY() { return (int) (y * OsuHitObject.getYMultiplier() + OsuHitObject.getYOffset()); } + public int getScaledY() { return (int) (y * HitObject.getYMultiplier() + HitObject.getYOffset()); } /** * Returns the keys pressed (KEY_* bitmask). diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index 70704e10..6a734b3d 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -34,13 +34,13 @@ import itdelatrisu.opsu.audio.MusicController; import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.beatmap.Beatmap; -import itdelatrisu.opsu.beatmap.OsuHitObject; +import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.db.BeatmapDB; import itdelatrisu.opsu.db.ScoreDB; import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.DummyObject; -import itdelatrisu.opsu.objects.HitObject; +import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.Slider; import itdelatrisu.opsu.objects.Spinner; import itdelatrisu.opsu.replay.PlaybackSpeed; @@ -102,11 +102,11 @@ public class Game extends BasicGameState { /** The associated GameData object. */ private GameData data; - /** Current hit object index in OsuHitObject[] array. */ + /** Current hit object index (in both hit object arrays). */ private int objectIndex = 0; - /** The map's HitObjects, indexed by objectIndex. */ - private HitObject[] hitObjects; + /** The map's game objects, indexed by objectIndex. */ + private GameObject[] gameObjects; /** Delay time, in milliseconds, before song starts. */ private int leadInTime; @@ -298,15 +298,15 @@ public class Game extends BasicGameState { // before first object timeDiff = firstObjectTime - trackPosition; if (timeDiff < approachTime) { - float[] xy = hitObjects[0].getPointAt(trackPosition); + float[] xy = gameObjects[0].getPointAt(trackPosition); autoXY = getPointAt(autoMouseX, autoMouseY, xy[0], xy[1], 1f - ((float) timeDiff / Math.min(approachTime, firstObjectTime))); } } else if (objectIndex < beatmap.objects.length) { // normal object int objectTime = beatmap.objects[objectIndex].getTime(); if (trackPosition < objectTime) { - float[] xyStart = hitObjects[objectIndex - 1].getPointAt(trackPosition); - int startTime = hitObjects[objectIndex - 1].getEndTime(); + float[] xyStart = gameObjects[objectIndex - 1].getPointAt(trackPosition); + int startTime = gameObjects[objectIndex - 1].getEndTime(); if (beatmap.breaks != null && breakIndex < beatmap.breaks.size()) { // starting a break: keep cursor at previous hit object position if (breakTime > 0 || objectTime > beatmap.breaks.get(breakIndex)) @@ -320,7 +320,7 @@ public class Game extends BasicGameState { } } if (autoXY == null) { - float[] xyEnd = hitObjects[objectIndex].getPointAt(trackPosition); + float[] xyEnd = gameObjects[objectIndex].getPointAt(trackPosition); int totalTime = objectTime - startTime; autoXY = getPointAt(xyStart[0], xyStart[1], xyEnd[0], xyEnd[1], (float) (trackPosition - startTime) / totalTime); @@ -331,12 +331,12 @@ public class Game extends BasicGameState { autoMousePressed = true; } } else { - autoXY = hitObjects[objectIndex].getPointAt(trackPosition); + autoXY = gameObjects[objectIndex].getPointAt(trackPosition); autoMousePressed = true; } } else { // last object - autoXY = hitObjects[objectIndex - 1].getPointAt(trackPosition); + autoXY = gameObjects[objectIndex - 1].getPointAt(trackPosition); } // set mouse coordinates @@ -646,10 +646,10 @@ public class Game extends BasicGameState { } // map complete! - if (objectIndex >= hitObjects.length || (MusicController.trackEnded() && objectIndex > 0)) { + if (objectIndex >= gameObjects.length || (MusicController.trackEnded() && objectIndex > 0)) { // track ended before last object was processed: force a hit result - if (MusicController.trackEnded() && objectIndex < hitObjects.length) - hitObjects[objectIndex].update(true, delta, mouseX, mouseY, false, trackPosition); + if (MusicController.trackEnded() && objectIndex < gameObjects.length) + gameObjects[objectIndex].update(true, delta, mouseX, mouseY, false, trackPosition); // if checkpoint used, skip ranking screen if (checkpointLoaded) @@ -749,13 +749,13 @@ public class Game extends BasicGameState { // update objects (loop in unlikely event of any skipped indexes) boolean keyPressed = keys != ReplayFrame.KEY_NONE; - while (objectIndex < hitObjects.length && trackPosition > beatmap.objects[objectIndex].getTime()) { + while (objectIndex < gameObjects.length && trackPosition > beatmap.objects[objectIndex].getTime()) { // check if we've already passed the next object's start time - boolean overlap = (objectIndex + 1 < hitObjects.length && + boolean overlap = (objectIndex + 1 < gameObjects.length && trackPosition > beatmap.objects[objectIndex + 1].getTime() - hitResultOffset[GameData.HIT_300]); // update hit object and check completion status - if (hitObjects[objectIndex].update(overlap, delta, mouseX, mouseY, keyPressed, trackPosition)) + if (gameObjects[objectIndex].update(overlap, delta, mouseX, mouseY, keyPressed, trackPosition)) objectIndex++; // done, so increment object index else break; @@ -851,7 +851,7 @@ public class Game extends BasicGameState { // skip to checkpoint MusicController.setPosition(checkpoint); MusicController.setPitch(GameMod.getSpeedMultiplier() * playbackSpeed.getModifier()); - while (objectIndex < hitObjects.length && + while (objectIndex < gameObjects.length && beatmap.objects[objectIndex++].getTime() <= checkpoint) ; objectIndex--; @@ -1054,7 +1054,7 @@ public class Game extends BasicGameState { // initialize object maps for (int i = 0; i < beatmap.objects.length; i++) { - OsuHitObject hitObject = beatmap.objects[i]; + HitObject hitObject = beatmap.objects[i]; // is this the last note in the combo? boolean comboEnd = false; @@ -1075,16 +1075,16 @@ public class Game extends BasicGameState { try { if (hitObject.isCircle()) - hitObjects[i] = new Circle(hitObject, this, data, color, comboEnd); + gameObjects[i] = new Circle(hitObject, this, data, color, comboEnd); else if (hitObject.isSlider()) - hitObjects[i] = new Slider(hitObject, this, data, color, comboEnd); + gameObjects[i] = new Slider(hitObject, this, data, color, comboEnd); else if (hitObject.isSpinner()) - hitObjects[i] = new Spinner(hitObject, this, data); + gameObjects[i] = new Spinner(hitObject, this, data); } catch (Exception e) { - // try to handle the error gracefully: substitute in a dummy HitObject + // try to handle the error gracefully: substitute in a dummy GameObject ErrorHandler.error(String.format("Failed to create %s at index %d:\n%s", hitObject.getTypeName(), i, hitObject.toString()), e, true); - hitObjects[i] = new DummyObject(hitObject); + gameObjects[i] = new DummyObject(hitObject); continue; } } @@ -1187,7 +1187,7 @@ public class Game extends BasicGameState { // draw hit objects in reverse order, or else overlapping objects are unreadable Stack stack = new Stack(); - for (int index = objectIndex; index < hitObjects.length && beatmap.objects[index].getTime() < trackPosition + approachTime; index++) { + for (int index = objectIndex; index < gameObjects.length && beatmap.objects[index].getTime() < trackPosition + approachTime; index++) { stack.add(index); // draw follow points @@ -1200,10 +1200,10 @@ public class Game extends BasicGameState { if (lastObjectIndex != -1 && !beatmap.objects[index].isNewCombo()) { // calculate points final int followPointInterval = container.getHeight() / 14; - int lastObjectEndTime = hitObjects[lastObjectIndex].getEndTime() + 1; + int lastObjectEndTime = gameObjects[lastObjectIndex].getEndTime() + 1; int objectStartTime = beatmap.objects[index].getTime(); - float[] startXY = hitObjects[lastObjectIndex].getPointAt(lastObjectEndTime); - float[] endXY = hitObjects[index].getPointAt(objectStartTime); + float[] startXY = gameObjects[lastObjectIndex].getPointAt(lastObjectEndTime); + float[] endXY = gameObjects[index].getPointAt(objectStartTime); float xDiff = endXY[0] - startXY[0]; float yDiff = endXY[1] - startXY[1]; float dist = (float) Math.hypot(xDiff, yDiff); @@ -1250,7 +1250,7 @@ public class Game extends BasicGameState { } while (!stack.isEmpty()) - hitObjects[stack.pop()].draw(g, trackPosition); + gameObjects[stack.pop()].draw(g, trackPosition); // draw OsuHitObjectResult objects data.drawHitResults(trackPosition); @@ -1273,7 +1273,7 @@ public class Game extends BasicGameState { * Resets all game data and structures. */ public void resetGameData() { - hitObjects = new HitObject[beatmap.objects.length]; + gameObjects = new GameObject[beatmap.objects.length]; data.clear(); objectIndex = 0; breakIndex = 0; @@ -1383,7 +1383,7 @@ public class Game extends BasicGameState { // Stack modifier scales with hit object size // StackOffset = HitObjectRadius / 10 int diameter = (int) (104 - (circleSize * 8)); - OsuHitObject.setStackOffset(diameter * STACK_OFFSET_MODIFIER); + HitObject.setStackOffset(diameter * STACK_OFFSET_MODIFIER); // initialize objects Circle.init(container, circleSize); @@ -1519,18 +1519,18 @@ public class Game extends BasicGameState { * @param keys the keys that are pressed */ private void sendGameKeyPress(int keys, int x, int y, int trackPosition) { - if (objectIndex >= hitObjects.length) // nothing to do here + if (objectIndex >= gameObjects.length) // nothing to do here return; - OsuHitObject hitObject = beatmap.objects[objectIndex]; + HitObject hitObject = beatmap.objects[objectIndex]; // circles - if (hitObject.isCircle() && hitObjects[objectIndex].mousePressed(x, y, trackPosition)) + if (hitObject.isCircle() && gameObjects[objectIndex].mousePressed(x, y, trackPosition)) objectIndex++; // circle hit // sliders else if (hitObject.isSlider()) - hitObjects[objectIndex].mousePressed(x, y, trackPosition); + gameObjects[objectIndex].mousePressed(x, y, trackPosition); } /** @@ -1544,8 +1544,8 @@ public class Game extends BasicGameState { private ReplayFrame addReplayFrame(int x, int y, int keys, int time) { int timeDiff = time - lastReplayTime; lastReplayTime = time; - int cx = (int) ((x - OsuHitObject.getXOffset()) / OsuHitObject.getXMultiplier()); - int cy = (int) ((y - OsuHitObject.getYOffset()) / OsuHitObject.getYMultiplier()); + int cx = (int) ((x - HitObject.getXOffset()) / HitObject.getXMultiplier()); + int cy = (int) ((y - HitObject.getYOffset()) / HitObject.getYMultiplier()); ReplayFrame frame = new ReplayFrame(timeDiff, time, cx, cy, keys); if (replayFrames != null) replayFrames.add(frame); @@ -1641,8 +1641,8 @@ public class Game extends BasicGameState { */ private void calculateStacks() { // reverse pass for stack calculation - for (int i = hitObjects.length - 1; i > 0; i--) { - OsuHitObject hitObjectI = beatmap.objects[i]; + for (int i = gameObjects.length - 1; i > 0; i--) { + HitObject hitObjectI = beatmap.objects[i]; // already calculated if (hitObjectI.getStack() != 0 || hitObjectI.isSpinner()) @@ -1650,33 +1650,33 @@ public class Game extends BasicGameState { // search for hit objects in stack for (int n = i - 1; n >= 0; n--) { - OsuHitObject hitObjectN = beatmap.objects[n]; + HitObject hitObjectN = beatmap.objects[n]; if (hitObjectN.isSpinner()) continue; // check if in range stack calculation float timeI = hitObjectI.getTime() - (STACK_TIMEOUT * beatmap.stackLeniency); - float timeN = hitObjectN.isSlider() ? hitObjects[n].getEndTime() : hitObjectN.getTime(); + float timeN = hitObjectN.isSlider() ? gameObjects[n].getEndTime() : hitObjectN.getTime(); if (timeI > timeN) break; // possible special case: if slider end in the stack, // all next hit objects in stack move right down if (hitObjectN.isSlider()) { - float[] p1 = hitObjects[i].getPointAt(hitObjectI.getTime()); - float[] p2 = hitObjects[n].getPointAt(hitObjects[n].getEndTime()); + float[] p1 = gameObjects[i].getPointAt(hitObjectI.getTime()); + float[] p2 = gameObjects[n].getPointAt(gameObjects[n].getEndTime()); float distance = Utils.distance(p1[0], p1[1], p2[0], p2[1]); // check if hit object part of this stack - if (distance < STACK_LENIENCE * OsuHitObject.getXMultiplier()) { + if (distance < STACK_LENIENCE * HitObject.getXMultiplier()) { int offset = hitObjectI.getStack() - hitObjectN.getStack() + 1; for (int j = n + 1; j <= i; j++) { - OsuHitObject hitObjectJ = beatmap.objects[j]; - p1 = hitObjects[j].getPointAt(hitObjectJ.getTime()); + HitObject hitObjectJ = beatmap.objects[j]; + p1 = gameObjects[j].getPointAt(hitObjectJ.getTime()); distance = Utils.distance(p1[0], p1[1], p2[0], p2[1]); // hit object below slider end - if (distance < STACK_LENIENCE * OsuHitObject.getXMultiplier()) + if (distance < STACK_LENIENCE * HitObject.getXMultiplier()) hitObjectJ.setStack(hitObjectJ.getStack() - offset); } break; // slider end always start of the stack: reset calculation @@ -1696,9 +1696,9 @@ public class Game extends BasicGameState { } // update hit object positions - for (int i = 0; i < hitObjects.length; i++) { + for (int i = 0; i < gameObjects.length; i++) { if (beatmap.objects[i].getStack() != 0) - hitObjects[i].updatePosition(); + gameObjects[i].updatePosition(); } } }