Continuation of 53c79c5 - HitObject name changes.
Attempts to eliminate any confusion between OsuHitObject (raw, parsed hit objects) and HitObject (interface for game object types). - Renamed "HitObject" interface to "GameObject", since these objects are specific to gameplay. - Renamed "OsuHitObject" to "HitObject", since these objects are primarily containers for parsed data. Sorry if the name-swapping is confusing; these should be better names in the long run. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<CurveType> catmulls = new LinkedList<CurveType>();
|
||||
int ncontrolPoints = hitObject.getSliderX().length + 1;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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<CurveType> beziers = new LinkedList<CurveType>();
|
||||
|
||||
Reference in New Issue
Block a user