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:
Jeffrey Han 2015-05-16 21:42:03 -04:00
parent 53c79c5d85
commit 250f7acc93
18 changed files with 130 additions and 130 deletions

View File

@ -23,7 +23,7 @@ import itdelatrisu.opsu.audio.MusicController;
import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.audio.SoundEffect;
import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.beatmap.Beatmap;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.downloads.Updater; import itdelatrisu.opsu.downloads.Updater;
import itdelatrisu.opsu.objects.curves.Curve; import itdelatrisu.opsu.objects.curves.Curve;
import itdelatrisu.opsu.replay.Replay; import itdelatrisu.opsu.replay.Replay;
@ -1156,7 +1156,7 @@ public class GameData {
* @param hitObject the hit object * @param hitObject the hit object
* @param repeat the current repeat number * @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; int hitValue = 0;
switch (result) { switch (result) {
case HIT_SLIDER30: case HIT_SLIDER30:
@ -1204,7 +1204,7 @@ public class GameData {
* @return the actual hit result (HIT_* constants) * @return the actual hit result (HIT_* constants)
*/ */
private int handleHitResult(int time, int result, float x, float y, Color color, 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; int hitValue = 0;
switch (result) { switch (result) {
case HIT_300: case HIT_300:
@ -1286,7 +1286,7 @@ public class GameData {
* @param expand whether or not the hit result animation should expand (if applicable) * @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, 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) { HitObjectType hitResultType, Curve curve, boolean expand) {
result = handleHitResult(time, result, x, y, color, end, hitObject, repeat, hitResultType); result = handleHitResult(time, result, x, y, color, end, hitObject, repeat, hitResultType);

View File

@ -21,7 +21,7 @@ package itdelatrisu.opsu;
import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.beatmap.Beatmap;
import itdelatrisu.opsu.beatmap.BeatmapSetList; import itdelatrisu.opsu.beatmap.BeatmapSetList;
import itdelatrisu.opsu.beatmap.BeatmapSetNode; import itdelatrisu.opsu.beatmap.BeatmapSetNode;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.beatmap.TimingPoint;
import itdelatrisu.opsu.db.BeatmapDB; import itdelatrisu.opsu.db.BeatmapDB;
@ -544,11 +544,11 @@ public class OsuParser {
tokens = line.split(","); tokens = line.split(",");
try { try {
type = Integer.parseInt(tokens[3]); type = Integer.parseInt(tokens[3]);
if ((type & OsuHitObject.TYPE_CIRCLE) > 0) if ((type & HitObject.TYPE_CIRCLE) > 0)
beatmap.hitObjectCircle++; beatmap.hitObjectCircle++;
else if ((type & OsuHitObject.TYPE_SLIDER) > 0) else if ((type & HitObject.TYPE_SLIDER) > 0)
beatmap.hitObjectSlider++; beatmap.hitObjectSlider++;
else //if ((type & OsuHitObject.TYPE_SPINNER) > 0) else //if ((type & HitObject.TYPE_SPINNER) > 0)
beatmap.hitObjectSpinner++; beatmap.hitObjectSpinner++;
} catch (Exception e) { } catch (Exception e) {
Log.warn(String.format("Failed to read hit object '%s' for file '%s'.", Log.warn(String.format("Failed to read hit object '%s' for file '%s'.",
@ -558,7 +558,7 @@ public class OsuParser {
try { try {
// map length = last object end time (TODO: end on slider?) // 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 (?) // some 'endTime' fields contain a ':' character (?)
int index = tokens[5].indexOf(':'); int index = tokens[5].indexOf(':');
if (index != -1) if (index != -1)
@ -603,7 +603,7 @@ public class OsuParser {
if (beatmap.objects != null) // already parsed if (beatmap.objects != null) // already parsed
return; 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()))) { try (BufferedReader in = new BufferedReader(new FileReader(beatmap.getFile()))) {
String line = in.readLine(); String line = in.readLine();
@ -638,8 +638,8 @@ public class OsuParser {
continue; continue;
try { try {
// create a new OsuHitObject for each line // create a new HitObject for each line
OsuHitObject hitObject = new OsuHitObject(line); HitObject hitObject = new HitObject(line);
// set combo info // set combo info
// - new combo: get next combo index, reset combo number // - new combo: get next combo index, reset combo number

View File

@ -20,7 +20,7 @@ package itdelatrisu.opsu;
import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.audio.SoundEffect;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.downloads.Download; import itdelatrisu.opsu.downloads.Download;
import itdelatrisu.opsu.downloads.DownloadNode; import itdelatrisu.opsu.downloads.DownloadNode;
import itdelatrisu.opsu.replay.PlaybackSpeed; import itdelatrisu.opsu.replay.PlaybackSpeed;
@ -191,7 +191,7 @@ public class Utils {
PlaybackSpeed.init(width, height); PlaybackSpeed.init(width, height);
// initialize hit objects // initialize hit objects
OsuHitObject.init(width, height); HitObject.init(width, height);
// initialize download nodes // initialize download nodes
DownloadNode.init(width, height); DownloadNode.init(width, height);

View File

@ -21,7 +21,7 @@ package itdelatrisu.opsu.audio;
import itdelatrisu.opsu.ErrorHandler; import itdelatrisu.opsu.ErrorHandler;
import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Options;
import itdelatrisu.opsu.audio.HitSound.SampleSet; import itdelatrisu.opsu.audio.HitSound.SampleSet;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import java.io.File; import java.io.File;
import java.io.IOException; 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 hitSound the hit sound (bitmask)
* @param sampleSet the sample set * @param sampleSet the sample set
* @param additionSampleSet the 'addition' sample set * @param additionSampleSet the 'addition' sample set
@ -280,11 +280,11 @@ public class SoundController {
playClip(HitSound.NORMAL.getClip(), volume, null); playClip(HitSound.NORMAL.getClip(), volume, null);
HitSound.setSampleSet(additionSampleSet); HitSound.setSampleSet(additionSampleSet);
if ((hitSound & OsuHitObject.SOUND_WHISTLE) > 0) if ((hitSound & HitObject.SOUND_WHISTLE) > 0)
playClip(HitSound.WHISTLE.getClip(), volume, null); playClip(HitSound.WHISTLE.getClip(), volume, null);
if ((hitSound & OsuHitObject.SOUND_FINISH) > 0) if ((hitSound & HitObject.SOUND_FINISH) > 0)
playClip(HitSound.FINISH.getClip(), volume, null); playClip(HitSound.FINISH.getClip(), volume, null);
if ((hitSound & OsuHitObject.SOUND_CLAP) > 0) if ((hitSound & HitObject.SOUND_CLAP) > 0)
playClip(HitSound.CLAP.getClip(), volume, null); playClip(HitSound.CLAP.getClip(), volume, null);
} }

View File

@ -188,7 +188,7 @@ public class Beatmap implements Comparable<Beatmap> {
*/ */
/** All hit objects. */ /** All hit objects. */
public OsuHitObject[] objects; public HitObject[] objects;
/** Number of individual objects. */ /** Number of individual objects. */
public int public int

View File

@ -26,7 +26,7 @@ import java.text.NumberFormat;
/** /**
* Data type representing a parsed hit object. * Data type representing a parsed hit object.
*/ */
public class OsuHitObject { public class HitObject {
/** Hit object types (bits). */ /** Hit object types (bits). */
public static final int public static final int
TYPE_CIRCLE = 1, TYPE_CIRCLE = 1,
@ -135,7 +135,7 @@ public class OsuHitObject {
private int stack; 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 width the container width
* @param height the container height * @param height the container height
*/ */
@ -177,7 +177,7 @@ public class OsuHitObject {
* Constructor. * Constructor.
* @param line the line to be parsed * @param line the line to be parsed
*/ */
public OsuHitObject(String line) { public HitObject(String line) {
/** /**
* [OBJECT FORMATS] * [OBJECT FORMATS]
* Circles: * Circles:
@ -205,9 +205,9 @@ public class OsuHitObject {
// type-specific fields // type-specific fields
int additionIndex; int additionIndex;
if ((type & OsuHitObject.TYPE_CIRCLE) > 0) if ((type & HitObject.TYPE_CIRCLE) > 0)
additionIndex = 5; additionIndex = 5;
else if ((type & OsuHitObject.TYPE_SLIDER) > 0) { else if ((type & HitObject.TYPE_SLIDER) > 0) {
additionIndex = 10; additionIndex = 10;
// slider curve type and coordinates // slider curve type and coordinates
@ -237,7 +237,7 @@ public class OsuHitObject {
edgeAddition[j][1] = Byte.parseByte(tedgeAddition[1]); edgeAddition[j][1] = Byte.parseByte(tedgeAddition[1]);
} }
} }
} else { //if ((type & OsuHitObject.TYPE_SPINNER) > 0) { } else { //if ((type & HitObject.TYPE_SPINNER) > 0) {
additionIndex = 6; additionIndex = 6;
// some 'endTime' fields contain a ':' character (?) // some 'endTime' fields contain a ':' character (?)

View File

@ -23,7 +23,7 @@ import itdelatrisu.opsu.GameData.HitObjectType;
import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.GameMod;
import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.states.Game; import itdelatrisu.opsu.states.Game;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
@ -33,12 +33,12 @@ import org.newdawn.slick.Graphics;
/** /**
* Data type representing a circle object. * 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. */ /** The amount of time, in milliseconds, to fade in the circle. */
private static final int FADE_IN_TIME = 375; private static final int FADE_IN_TIME = 375;
/** The associated OsuHitObject. */ /** The associated HitObject. */
private OsuHitObject hitObject; private HitObject hitObject;
/** The scaled starting x, y coordinates. */ /** The scaled starting x, y coordinates. */
private float x, y; private float x, y;
@ -62,7 +62,7 @@ public class Circle implements HitObject {
*/ */
public static void init(GameContainer container, float circleSize) { public static void init(GameContainer container, float circleSize) {
int diameter = (int) (104 - (circleSize * 8)); 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.setImage(GameImage.HITCIRCLE.getImage().getScaledCopy(diameter, diameter));
GameImage.HITCIRCLE_OVERLAY.setImage(GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(diameter, diameter)); GameImage.HITCIRCLE_OVERLAY.setImage(GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(diameter, diameter));
GameImage.APPROACHCIRCLE.setImage(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(diameter, diameter)); GameImage.APPROACHCIRCLE.setImage(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(diameter, diameter));
@ -70,13 +70,13 @@ public class Circle implements HitObject {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param game the associated Game object * @param game the associated Game object
* @param data the associated GameData object * @param data the associated GameData object
* @param color the color of this circle * @param color the color of this circle
* @param comboEnd true if this is the last hit object in the combo * @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.hitObject = hitObject;
this.game = game; this.game = game;
this.data = data; this.data = data;

View File

@ -18,25 +18,25 @@
package itdelatrisu.opsu.objects; package itdelatrisu.opsu.objects;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import org.newdawn.slick.Graphics; 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 { public class DummyObject implements GameObject {
/** The associated OsuHitObject. */ /** The associated HitObject. */
private OsuHitObject hitObject; private HitObject hitObject;
/** The scaled starting x, y coordinates. */ /** The scaled starting x, y coordinates. */
private float x, y; private float x, y;
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
*/ */
public DummyObject(OsuHitObject hitObject) { public DummyObject(HitObject hitObject) {
this.hitObject = hitObject; this.hitObject = hitObject;
updatePosition(); updatePosition();
} }

View File

@ -21,9 +21,9 @@ package itdelatrisu.opsu.objects;
import org.newdawn.slick.Graphics; 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. * Draws the hit object to the graphics context.
* @param g the graphics context * @param g the graphics context

View File

@ -24,7 +24,7 @@ import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.GameMod;
import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.beatmap.Beatmap; 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.CatmullCurve;
import itdelatrisu.opsu.objects.curves.CircumscribedCircle; import itdelatrisu.opsu.objects.curves.CircumscribedCircle;
import itdelatrisu.opsu.objects.curves.Curve; import itdelatrisu.opsu.objects.curves.Curve;
@ -39,7 +39,7 @@ import org.newdawn.slick.Image;
/** /**
* Data type representing a slider object. * Data type representing a slider object.
*/ */
public class Slider implements HitObject { public class Slider implements GameObject {
/** Slider ball frames. */ /** Slider ball frames. */
private static Image[] sliderBallImages; private static Image[] sliderBallImages;
@ -52,8 +52,8 @@ public class Slider implements HitObject {
/** The amount of time, in milliseconds, to fade in the slider. */ /** The amount of time, in milliseconds, to fade in the slider. */
private static final int FADE_IN_TIME = 375; private static final int FADE_IN_TIME = 375;
/** The associated OsuHitObject. */ /** The associated HitObject. */
private OsuHitObject hitObject; private HitObject hitObject;
/** The scaled starting x, y coordinates. */ /** The scaled starting x, y coordinates. */
protected float x, y; protected float x, y;
@ -111,7 +111,7 @@ public class Slider implements HitObject {
containerHeight = container.getHeight(); containerHeight = container.getHeight();
int diameter = (int) (104 - (circleSize * 8)); 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 // slider ball
if (GameImage.SLIDER_BALL.hasSkinImages() || if (GameImage.SLIDER_BALL.hasSkinImages() ||
@ -132,13 +132,13 @@ public class Slider implements HitObject {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param game the associated Game object * @param game the associated Game object
* @param data the associated GameData object * @param data the associated GameData object
* @param color the color of this slider * @param color the color of this slider
* @param comboEnd true if this is the last hit object in the combo * @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.hitObject = hitObject;
this.game = game; this.game = game;
this.data = data; this.data = data;
@ -238,7 +238,7 @@ public class Slider implements HitObject {
float[] c2 = curve.pointAt(getT(trackPosition, false) + 0.01f); float[] c2 = curve.pointAt(getT(trackPosition, false) + 0.01f);
float t = getT(trackPosition, false); 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) (dis / (diameter * Math.PI) * 30) % sliderBallImages.length];
Image sliderBallFrame = sliderBallImages[(int) (t * sliderTime * 60 / 1000) % 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); 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.x = hitObject.getScaledX();
this.y = hitObject.getScaledY(); 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); 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); this.curve = new CatmullCurve(hitObject, color);
else else
this.curve = new LinearBezier(hitObject, color, hitObject.getSliderType() == OsuHitObject.SLIDER_LINEAR); this.curve = new LinearBezier(hitObject, color, hitObject.getSliderType() == HitObject.SLIDER_LINEAR);
} }
@Override @Override

View File

@ -25,7 +25,7 @@ import itdelatrisu.opsu.GameMod;
import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.audio.SoundEffect;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.states.Game; import itdelatrisu.opsu.states.Game;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
@ -36,7 +36,7 @@ import org.newdawn.slick.Image;
/** /**
* Data type representing a spinner object. * Data type representing a spinner object.
*/ */
public class Spinner implements HitObject { public class Spinner implements GameObject {
/** Container dimensions. */ /** Container dimensions. */
private static int width, height; private static int width, height;
@ -60,8 +60,8 @@ public class Spinner implements HitObject {
TWO_PI = (float) (Math.PI * 2), TWO_PI = (float) (Math.PI * 2),
HALF_PI = (float) (Math.PI / 2); HALF_PI = (float) (Math.PI / 2);
/** The associated OsuHitObject. */ /** The associated HitObject. */
private OsuHitObject hitObject; private HitObject hitObject;
/** The associated GameData object. */ /** The associated GameData object. */
private GameData data; private GameData data;
@ -104,11 +104,11 @@ public class Spinner implements HitObject {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param game the associated Game object * @param game the associated Game object
* @param data the associated GameData 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.hitObject = hitObject;
this.data = data; this.data = data;

View File

@ -19,7 +19,7 @@
package itdelatrisu.opsu.objects.curves; package itdelatrisu.opsu.objects.curves;
import itdelatrisu.opsu.ErrorHandler; import itdelatrisu.opsu.ErrorHandler;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import java.util.LinkedList; import java.util.LinkedList;
@ -34,10 +34,10 @@ import org.newdawn.slick.SlickException;
public class CatmullCurve extends EqualDistanceMultiCurve { public class CatmullCurve extends EqualDistanceMultiCurve {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param color the color of this curve * @param color the color of this curve
*/ */
public CatmullCurve(OsuHitObject hitObject, Color color) { public CatmullCurve(HitObject hitObject, Color color) {
super(hitObject, color); super(hitObject, color);
LinkedList<CurveType> catmulls = new LinkedList<CurveType>(); LinkedList<CurveType> catmulls = new LinkedList<CurveType>();
int ncontrolPoints = hitObject.getSliderX().length + 1; int ncontrolPoints = hitObject.getSliderX().length + 1;

View File

@ -19,7 +19,7 @@
package itdelatrisu.opsu.objects.curves; package itdelatrisu.opsu.objects.curves;
import itdelatrisu.opsu.ErrorHandler; import itdelatrisu.opsu.ErrorHandler;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
@ -52,10 +52,10 @@ public class CircumscribedCircle extends Curve {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param color the color of this curve * @param color the color of this curve
*/ */
public CircumscribedCircle(OsuHitObject hitObject, Color color) { public CircumscribedCircle(HitObject hitObject, Color color) {
super(hitObject, color); super(hitObject, color);
// construct the three points // 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 // find an angle with an arc length of pixelLength along this circle
this.radius = startAngPoint.len(); 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 float arcAng = pixelLength / radius; // len = theta * r / theta = len / r
// now use it for our new end angle // now use it for our new end angle

View File

@ -20,7 +20,7 @@ package itdelatrisu.opsu.objects.curves;
import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import org.newdawn.slick.Image; import org.newdawn.slick.Image;
@ -34,8 +34,8 @@ public abstract class Curve {
/** Points generated along the curve should be spaced this far apart. */ /** Points generated along the curve should be spaced this far apart. */
protected static float CURVE_POINTS_SEPERATION = 5; protected static float CURVE_POINTS_SEPERATION = 5;
/** The associated OsuHitObject. */ /** The associated HitObject. */
protected OsuHitObject hitObject; protected HitObject hitObject;
/** The scaled starting x, y coordinates. */ /** The scaled starting x, y coordinates. */
protected float x, y; protected float x, y;
@ -48,10 +48,10 @@ public abstract class Curve {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param color the color of this curve * @param color the color of this curve
*/ */
protected Curve(OsuHitObject hitObject, Color color) { protected Curve(HitObject hitObject, Color color) {
this.hitObject = hitObject; this.hitObject = hitObject;
this.x = hitObject.getScaledX(); this.x = hitObject.getScaledX();
this.y = hitObject.getScaledY(); this.y = hitObject.getScaledY();

View File

@ -18,7 +18,7 @@
package itdelatrisu.opsu.objects.curves; package itdelatrisu.opsu.objects.curves;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
@ -40,10 +40,10 @@ public abstract class EqualDistanceMultiCurve extends Curve {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param color the color of this curve * @param color the color of this curve
*/ */
public EqualDistanceMultiCurve(OsuHitObject hitObject, Color color) { public EqualDistanceMultiCurve(HitObject hitObject, Color color) {
super(hitObject, color); super(hitObject, color);
} }
@ -65,7 +65,7 @@ public abstract class EqualDistanceMultiCurve extends Curve {
float lastDistanceAt = 0; float lastDistanceAt = 0;
// length of Curve should equal pixel length (in 640x480) // 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 each distance, try to get in between the two points that are between it
for (int i = 0; i < ncurve + 1; i++) { for (int i = 0; i < ncurve + 1; i++) {

View File

@ -18,7 +18,7 @@
package itdelatrisu.opsu.objects.curves; package itdelatrisu.opsu.objects.curves;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import java.util.LinkedList; import java.util.LinkedList;
@ -33,11 +33,11 @@ import org.newdawn.slick.Color;
public class LinearBezier extends EqualDistanceMultiCurve { public class LinearBezier extends EqualDistanceMultiCurve {
/** /**
* Constructor. * Constructor.
* @param hitObject the associated OsuHitObject * @param hitObject the associated HitObject
* @param color the color of this curve * @param color the color of this curve
* @param line whether a new curve should be generated for each sequential pair * @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); super(hitObject, color);
LinkedList<CurveType> beziers = new LinkedList<CurveType>(); LinkedList<CurveType> beziers = new LinkedList<CurveType>();

View File

@ -18,7 +18,7 @@
package itdelatrisu.opsu.replay; package itdelatrisu.opsu.replay;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
/** /**
* Captures a single replay frame. * Captures a single replay frame.
@ -98,12 +98,12 @@ public class ReplayFrame {
/** /**
* Returns the scaled cursor x coordinate. * 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. * 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). * Returns the keys pressed (KEY_* bitmask).

View File

@ -34,13 +34,13 @@ import itdelatrisu.opsu.audio.MusicController;
import itdelatrisu.opsu.audio.SoundController; import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.audio.SoundEffect;
import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.beatmap.Beatmap;
import itdelatrisu.opsu.beatmap.OsuHitObject; import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.beatmap.TimingPoint;
import itdelatrisu.opsu.db.BeatmapDB; import itdelatrisu.opsu.db.BeatmapDB;
import itdelatrisu.opsu.db.ScoreDB; import itdelatrisu.opsu.db.ScoreDB;
import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.Circle;
import itdelatrisu.opsu.objects.DummyObject; import itdelatrisu.opsu.objects.DummyObject;
import itdelatrisu.opsu.objects.HitObject; import itdelatrisu.opsu.objects.GameObject;
import itdelatrisu.opsu.objects.Slider; import itdelatrisu.opsu.objects.Slider;
import itdelatrisu.opsu.objects.Spinner; import itdelatrisu.opsu.objects.Spinner;
import itdelatrisu.opsu.replay.PlaybackSpeed; import itdelatrisu.opsu.replay.PlaybackSpeed;
@ -102,11 +102,11 @@ public class Game extends BasicGameState {
/** The associated GameData object. */ /** The associated GameData object. */
private GameData data; private GameData data;
/** Current hit object index in OsuHitObject[] array. */ /** Current hit object index (in both hit object arrays). */
private int objectIndex = 0; private int objectIndex = 0;
/** The map's HitObjects, indexed by objectIndex. */ /** The map's game objects, indexed by objectIndex. */
private HitObject[] hitObjects; private GameObject[] gameObjects;
/** Delay time, in milliseconds, before song starts. */ /** Delay time, in milliseconds, before song starts. */
private int leadInTime; private int leadInTime;
@ -298,15 +298,15 @@ public class Game extends BasicGameState {
// before first object // before first object
timeDiff = firstObjectTime - trackPosition; timeDiff = firstObjectTime - trackPosition;
if (timeDiff < approachTime) { 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))); autoXY = getPointAt(autoMouseX, autoMouseY, xy[0], xy[1], 1f - ((float) timeDiff / Math.min(approachTime, firstObjectTime)));
} }
} else if (objectIndex < beatmap.objects.length) { } else if (objectIndex < beatmap.objects.length) {
// normal object // normal object
int objectTime = beatmap.objects[objectIndex].getTime(); int objectTime = beatmap.objects[objectIndex].getTime();
if (trackPosition < objectTime) { if (trackPosition < objectTime) {
float[] xyStart = hitObjects[objectIndex - 1].getPointAt(trackPosition); float[] xyStart = gameObjects[objectIndex - 1].getPointAt(trackPosition);
int startTime = hitObjects[objectIndex - 1].getEndTime(); int startTime = gameObjects[objectIndex - 1].getEndTime();
if (beatmap.breaks != null && breakIndex < beatmap.breaks.size()) { if (beatmap.breaks != null && breakIndex < beatmap.breaks.size()) {
// starting a break: keep cursor at previous hit object position // starting a break: keep cursor at previous hit object position
if (breakTime > 0 || objectTime > beatmap.breaks.get(breakIndex)) if (breakTime > 0 || objectTime > beatmap.breaks.get(breakIndex))
@ -320,7 +320,7 @@ public class Game extends BasicGameState {
} }
} }
if (autoXY == null) { if (autoXY == null) {
float[] xyEnd = hitObjects[objectIndex].getPointAt(trackPosition); float[] xyEnd = gameObjects[objectIndex].getPointAt(trackPosition);
int totalTime = objectTime - startTime; int totalTime = objectTime - startTime;
autoXY = getPointAt(xyStart[0], xyStart[1], xyEnd[0], xyEnd[1], (float) (trackPosition - startTime) / totalTime); 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; autoMousePressed = true;
} }
} else { } else {
autoXY = hitObjects[objectIndex].getPointAt(trackPosition); autoXY = gameObjects[objectIndex].getPointAt(trackPosition);
autoMousePressed = true; autoMousePressed = true;
} }
} else { } else {
// last object // last object
autoXY = hitObjects[objectIndex - 1].getPointAt(trackPosition); autoXY = gameObjects[objectIndex - 1].getPointAt(trackPosition);
} }
// set mouse coordinates // set mouse coordinates
@ -646,10 +646,10 @@ public class Game extends BasicGameState {
} }
// map complete! // 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 // track ended before last object was processed: force a hit result
if (MusicController.trackEnded() && objectIndex < hitObjects.length) if (MusicController.trackEnded() && objectIndex < gameObjects.length)
hitObjects[objectIndex].update(true, delta, mouseX, mouseY, false, trackPosition); gameObjects[objectIndex].update(true, delta, mouseX, mouseY, false, trackPosition);
// if checkpoint used, skip ranking screen // if checkpoint used, skip ranking screen
if (checkpointLoaded) if (checkpointLoaded)
@ -749,13 +749,13 @@ public class Game extends BasicGameState {
// update objects (loop in unlikely event of any skipped indexes) // update objects (loop in unlikely event of any skipped indexes)
boolean keyPressed = keys != ReplayFrame.KEY_NONE; 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 // 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]); trackPosition > beatmap.objects[objectIndex + 1].getTime() - hitResultOffset[GameData.HIT_300]);
// update hit object and check completion status // 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 objectIndex++; // done, so increment object index
else else
break; break;
@ -851,7 +851,7 @@ public class Game extends BasicGameState {
// skip to checkpoint // skip to checkpoint
MusicController.setPosition(checkpoint); MusicController.setPosition(checkpoint);
MusicController.setPitch(GameMod.getSpeedMultiplier() * playbackSpeed.getModifier()); MusicController.setPitch(GameMod.getSpeedMultiplier() * playbackSpeed.getModifier());
while (objectIndex < hitObjects.length && while (objectIndex < gameObjects.length &&
beatmap.objects[objectIndex++].getTime() <= checkpoint) beatmap.objects[objectIndex++].getTime() <= checkpoint)
; ;
objectIndex--; objectIndex--;
@ -1054,7 +1054,7 @@ public class Game extends BasicGameState {
// initialize object maps // initialize object maps
for (int i = 0; i < beatmap.objects.length; i++) { 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? // is this the last note in the combo?
boolean comboEnd = false; boolean comboEnd = false;
@ -1075,16 +1075,16 @@ public class Game extends BasicGameState {
try { try {
if (hitObject.isCircle()) 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()) 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()) else if (hitObject.isSpinner())
hitObjects[i] = new Spinner(hitObject, this, data); gameObjects[i] = new Spinner(hitObject, this, data);
} catch (Exception e) { } 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", ErrorHandler.error(String.format("Failed to create %s at index %d:\n%s",
hitObject.getTypeName(), i, hitObject.toString()), e, true); hitObject.getTypeName(), i, hitObject.toString()), e, true);
hitObjects[i] = new DummyObject(hitObject); gameObjects[i] = new DummyObject(hitObject);
continue; continue;
} }
} }
@ -1187,7 +1187,7 @@ public class Game extends BasicGameState {
// draw hit objects in reverse order, or else overlapping objects are unreadable // draw hit objects in reverse order, or else overlapping objects are unreadable
Stack<Integer> stack = new Stack<Integer>(); Stack<Integer> stack = new Stack<Integer>();
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); stack.add(index);
// draw follow points // draw follow points
@ -1200,10 +1200,10 @@ public class Game extends BasicGameState {
if (lastObjectIndex != -1 && !beatmap.objects[index].isNewCombo()) { if (lastObjectIndex != -1 && !beatmap.objects[index].isNewCombo()) {
// calculate points // calculate points
final int followPointInterval = container.getHeight() / 14; final int followPointInterval = container.getHeight() / 14;
int lastObjectEndTime = hitObjects[lastObjectIndex].getEndTime() + 1; int lastObjectEndTime = gameObjects[lastObjectIndex].getEndTime() + 1;
int objectStartTime = beatmap.objects[index].getTime(); int objectStartTime = beatmap.objects[index].getTime();
float[] startXY = hitObjects[lastObjectIndex].getPointAt(lastObjectEndTime); float[] startXY = gameObjects[lastObjectIndex].getPointAt(lastObjectEndTime);
float[] endXY = hitObjects[index].getPointAt(objectStartTime); float[] endXY = gameObjects[index].getPointAt(objectStartTime);
float xDiff = endXY[0] - startXY[0]; float xDiff = endXY[0] - startXY[0];
float yDiff = endXY[1] - startXY[1]; float yDiff = endXY[1] - startXY[1];
float dist = (float) Math.hypot(xDiff, yDiff); float dist = (float) Math.hypot(xDiff, yDiff);
@ -1250,7 +1250,7 @@ public class Game extends BasicGameState {
} }
while (!stack.isEmpty()) while (!stack.isEmpty())
hitObjects[stack.pop()].draw(g, trackPosition); gameObjects[stack.pop()].draw(g, trackPosition);
// draw OsuHitObjectResult objects // draw OsuHitObjectResult objects
data.drawHitResults(trackPosition); data.drawHitResults(trackPosition);
@ -1273,7 +1273,7 @@ public class Game extends BasicGameState {
* Resets all game data and structures. * Resets all game data and structures.
*/ */
public void resetGameData() { public void resetGameData() {
hitObjects = new HitObject[beatmap.objects.length]; gameObjects = new GameObject[beatmap.objects.length];
data.clear(); data.clear();
objectIndex = 0; objectIndex = 0;
breakIndex = 0; breakIndex = 0;
@ -1383,7 +1383,7 @@ public class Game extends BasicGameState {
// Stack modifier scales with hit object size // Stack modifier scales with hit object size
// StackOffset = HitObjectRadius / 10 // StackOffset = HitObjectRadius / 10
int diameter = (int) (104 - (circleSize * 8)); int diameter = (int) (104 - (circleSize * 8));
OsuHitObject.setStackOffset(diameter * STACK_OFFSET_MODIFIER); HitObject.setStackOffset(diameter * STACK_OFFSET_MODIFIER);
// initialize objects // initialize objects
Circle.init(container, circleSize); Circle.init(container, circleSize);
@ -1519,18 +1519,18 @@ public class Game extends BasicGameState {
* @param keys the keys that are pressed * @param keys the keys that are pressed
*/ */
private void sendGameKeyPress(int keys, int x, int y, int trackPosition) { 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; return;
OsuHitObject hitObject = beatmap.objects[objectIndex]; HitObject hitObject = beatmap.objects[objectIndex];
// circles // circles
if (hitObject.isCircle() && hitObjects[objectIndex].mousePressed(x, y, trackPosition)) if (hitObject.isCircle() && gameObjects[objectIndex].mousePressed(x, y, trackPosition))
objectIndex++; // circle hit objectIndex++; // circle hit
// sliders // sliders
else if (hitObject.isSlider()) 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) { private ReplayFrame addReplayFrame(int x, int y, int keys, int time) {
int timeDiff = time - lastReplayTime; int timeDiff = time - lastReplayTime;
lastReplayTime = time; lastReplayTime = time;
int cx = (int) ((x - OsuHitObject.getXOffset()) / OsuHitObject.getXMultiplier()); int cx = (int) ((x - HitObject.getXOffset()) / HitObject.getXMultiplier());
int cy = (int) ((y - OsuHitObject.getYOffset()) / OsuHitObject.getYMultiplier()); int cy = (int) ((y - HitObject.getYOffset()) / HitObject.getYMultiplier());
ReplayFrame frame = new ReplayFrame(timeDiff, time, cx, cy, keys); ReplayFrame frame = new ReplayFrame(timeDiff, time, cx, cy, keys);
if (replayFrames != null) if (replayFrames != null)
replayFrames.add(frame); replayFrames.add(frame);
@ -1641,8 +1641,8 @@ public class Game extends BasicGameState {
*/ */
private void calculateStacks() { private void calculateStacks() {
// reverse pass for stack calculation // reverse pass for stack calculation
for (int i = hitObjects.length - 1; i > 0; i--) { for (int i = gameObjects.length - 1; i > 0; i--) {
OsuHitObject hitObjectI = beatmap.objects[i]; HitObject hitObjectI = beatmap.objects[i];
// already calculated // already calculated
if (hitObjectI.getStack() != 0 || hitObjectI.isSpinner()) if (hitObjectI.getStack() != 0 || hitObjectI.isSpinner())
@ -1650,33 +1650,33 @@ public class Game extends BasicGameState {
// search for hit objects in stack // search for hit objects in stack
for (int n = i - 1; n >= 0; n--) { for (int n = i - 1; n >= 0; n--) {
OsuHitObject hitObjectN = beatmap.objects[n]; HitObject hitObjectN = beatmap.objects[n];
if (hitObjectN.isSpinner()) if (hitObjectN.isSpinner())
continue; continue;
// check if in range stack calculation // check if in range stack calculation
float timeI = hitObjectI.getTime() - (STACK_TIMEOUT * beatmap.stackLeniency); 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) if (timeI > timeN)
break; break;
// possible special case: if slider end in the stack, // possible special case: if slider end in the stack,
// all next hit objects in stack move right down // all next hit objects in stack move right down
if (hitObjectN.isSlider()) { if (hitObjectN.isSlider()) {
float[] p1 = hitObjects[i].getPointAt(hitObjectI.getTime()); float[] p1 = gameObjects[i].getPointAt(hitObjectI.getTime());
float[] p2 = hitObjects[n].getPointAt(hitObjects[n].getEndTime()); float[] p2 = gameObjects[n].getPointAt(gameObjects[n].getEndTime());
float distance = Utils.distance(p1[0], p1[1], p2[0], p2[1]); float distance = Utils.distance(p1[0], p1[1], p2[0], p2[1]);
// check if hit object part of this stack // 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; int offset = hitObjectI.getStack() - hitObjectN.getStack() + 1;
for (int j = n + 1; j <= i; j++) { for (int j = n + 1; j <= i; j++) {
OsuHitObject hitObjectJ = beatmap.objects[j]; HitObject hitObjectJ = beatmap.objects[j];
p1 = hitObjects[j].getPointAt(hitObjectJ.getTime()); p1 = gameObjects[j].getPointAt(hitObjectJ.getTime());
distance = Utils.distance(p1[0], p1[1], p2[0], p2[1]); distance = Utils.distance(p1[0], p1[1], p2[0], p2[1]);
// hit object below slider end // hit object below slider end
if (distance < STACK_LENIENCE * OsuHitObject.getXMultiplier()) if (distance < STACK_LENIENCE * HitObject.getXMultiplier())
hitObjectJ.setStack(hitObjectJ.getStack() - offset); hitObjectJ.setStack(hitObjectJ.getStack() - offset);
} }
break; // slider end always start of the stack: reset calculation break; // slider end always start of the stack: reset calculation
@ -1696,9 +1696,9 @@ public class Game extends BasicGameState {
} }
// update hit object positions // 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) if (beatmap.objects[i].getStack() != 0)
hitObjects[i].updatePosition(); gameObjects[i].updatePosition();
} }
} }
} }