Renamed "OsuTimingPoint" class to "TimingPoint".
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
436aa2bed9
commit
0a80590505
|
@ -168,7 +168,7 @@ public class OsuFile implements Comparable<OsuFile> {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** All timing points. */
|
/** All timing points. */
|
||||||
public ArrayList<OsuTimingPoint> timingPoints;
|
public ArrayList<TimingPoint> timingPoints;
|
||||||
|
|
||||||
/** Song BPM range. */
|
/** Song BPM range. */
|
||||||
public int bpmMin = 0, bpmMax = 0;
|
public int bpmMin = 0, bpmMax = 0;
|
||||||
|
@ -363,7 +363,7 @@ public class OsuFile implements Comparable<OsuFile> {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (OsuTimingPoint p : timingPoints) {
|
for (TimingPoint p : timingPoints) {
|
||||||
sb.append(p.toString());
|
sb.append(p.toString());
|
||||||
sb.append('|');
|
sb.append('|');
|
||||||
}
|
}
|
||||||
|
@ -377,14 +377,14 @@ public class OsuFile implements Comparable<OsuFile> {
|
||||||
* @param s the string
|
* @param s the string
|
||||||
*/
|
*/
|
||||||
public void timingPointsFromString(String s) {
|
public void timingPointsFromString(String s) {
|
||||||
this.timingPoints = new ArrayList<OsuTimingPoint>();
|
this.timingPoints = new ArrayList<TimingPoint>();
|
||||||
if (s == null)
|
if (s == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String[] tokens = s.split("\\|");
|
String[] tokens = s.split("\\|");
|
||||||
for (int i = 0; i < tokens.length; i++) {
|
for (int i = 0; i < tokens.length; i++) {
|
||||||
try {
|
try {
|
||||||
timingPoints.add(new OsuTimingPoint(tokens[i]));
|
timingPoints.add(new TimingPoint(tokens[i]));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warn(String.format("Failed to read timing point '%s'.", tokens[i]), e);
|
Log.warn(String.format("Failed to read timing point '%s'.", tokens[i]), e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class OsuParser {
|
||||||
*/
|
*/
|
||||||
private static OsuFile parseFile(File file, File dir, ArrayList<OsuFile> osuFiles, boolean parseObjects) {
|
private static OsuFile parseFile(File file, File dir, ArrayList<OsuFile> osuFiles, boolean parseObjects) {
|
||||||
OsuFile osu = new OsuFile(file);
|
OsuFile osu = new OsuFile(file);
|
||||||
osu.timingPoints = new ArrayList<OsuTimingPoint>();
|
osu.timingPoints = new ArrayList<TimingPoint>();
|
||||||
|
|
||||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"))) {
|
try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"))) {
|
||||||
String line = in.readLine();
|
String line = in.readLine();
|
||||||
|
@ -469,7 +469,7 @@ public class OsuParser {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// parse timing point
|
// parse timing point
|
||||||
OsuTimingPoint timingPoint = new OsuTimingPoint(line);
|
TimingPoint timingPoint = new TimingPoint(line);
|
||||||
|
|
||||||
// calculate BPM
|
// calculate BPM
|
||||||
if (!timingPoint.isInherited()) {
|
if (!timingPoint.isInherited()) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.newdawn.slick.util.Log;
|
||||||
/**
|
/**
|
||||||
* Data type representing a timing point.
|
* Data type representing a timing point.
|
||||||
*/
|
*/
|
||||||
public class OsuTimingPoint {
|
public class TimingPoint {
|
||||||
/** Timing point start time/offset (in ms). */
|
/** Timing point start time/offset (in ms). */
|
||||||
private int time = 0;
|
private int time = 0;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class OsuTimingPoint {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param line the line to be parsed
|
* @param line the line to be parsed
|
||||||
*/
|
*/
|
||||||
public OsuTimingPoint(String line) {
|
public TimingPoint(String line) {
|
||||||
// TODO: better support for old formats
|
// TODO: better support for old formats
|
||||||
String[] tokens = line.split(",");
|
String[] tokens = line.split(",");
|
||||||
try {
|
try {
|
|
@ -61,7 +61,7 @@ public class CatmullCurve extends EqualDistanceMultiCurve {
|
||||||
points.removeFirst();
|
points.removeFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getX(ncontrolPoints - 1) != getX(ncontrolPoints - 2)
|
if (getX(ncontrolPoints - 1) != getX(ncontrolPoints - 2)
|
||||||
||getY(ncontrolPoints - 1) != getY(ncontrolPoints - 2))
|
||getY(ncontrolPoints - 1) != getY(ncontrolPoints - 2))
|
||||||
points.addLast(new Vec2f(getX(ncontrolPoints - 1), getY(ncontrolPoints - 1)));
|
points.addLast(new Vec2f(getX(ncontrolPoints - 1), getY(ncontrolPoints - 1)));
|
||||||
if (points.size() >= 4) {
|
if (points.size() >= 4) {
|
||||||
|
|
|
@ -28,8 +28,8 @@ import itdelatrisu.opsu.Options;
|
||||||
import itdelatrisu.opsu.OsuFile;
|
import itdelatrisu.opsu.OsuFile;
|
||||||
import itdelatrisu.opsu.OsuHitObject;
|
import itdelatrisu.opsu.OsuHitObject;
|
||||||
import itdelatrisu.opsu.OsuParser;
|
import itdelatrisu.opsu.OsuParser;
|
||||||
import itdelatrisu.opsu.OsuTimingPoint;
|
|
||||||
import itdelatrisu.opsu.ScoreData;
|
import itdelatrisu.opsu.ScoreData;
|
||||||
|
import itdelatrisu.opsu.TimingPoint;
|
||||||
import itdelatrisu.opsu.UI;
|
import itdelatrisu.opsu.UI;
|
||||||
import itdelatrisu.opsu.Utils;
|
import itdelatrisu.opsu.Utils;
|
||||||
import itdelatrisu.opsu.audio.HitSound;
|
import itdelatrisu.opsu.audio.HitSound;
|
||||||
|
@ -684,7 +684,7 @@ public class Game extends BasicGameState {
|
||||||
|
|
||||||
// timing points
|
// timing points
|
||||||
if (timingPointIndex < osu.timingPoints.size()) {
|
if (timingPointIndex < osu.timingPoints.size()) {
|
||||||
OsuTimingPoint timingPoint = osu.timingPoints.get(timingPointIndex);
|
TimingPoint timingPoint = osu.timingPoints.get(timingPointIndex);
|
||||||
if (trackPosition >= timingPoint.getTime()) {
|
if (trackPosition >= timingPoint.getTime()) {
|
||||||
setBeatLength(timingPoint, true);
|
setBeatLength(timingPoint, true);
|
||||||
timingPointIndex++;
|
timingPointIndex++;
|
||||||
|
@ -1045,7 +1045,7 @@ public class Game extends BasicGameState {
|
||||||
|
|
||||||
// load the first timingPoint for stacking
|
// load the first timingPoint for stacking
|
||||||
if (!osu.timingPoints.isEmpty()) {
|
if (!osu.timingPoints.isEmpty()) {
|
||||||
OsuTimingPoint timingPoint = osu.timingPoints.get(0);
|
TimingPoint timingPoint = osu.timingPoints.get(0);
|
||||||
if (!timingPoint.isInherited()) {
|
if (!timingPoint.isInherited()) {
|
||||||
setBeatLength(timingPoint, true);
|
setBeatLength(timingPoint, true);
|
||||||
timingPointIndex++;
|
timingPointIndex++;
|
||||||
|
@ -1066,7 +1066,7 @@ public class Game extends BasicGameState {
|
||||||
// pass beatLength to hit objects
|
// pass beatLength to hit objects
|
||||||
int hitObjectTime = hitObject.getTime();
|
int hitObjectTime = hitObject.getTime();
|
||||||
while (timingPointIndex < osu.timingPoints.size()) {
|
while (timingPointIndex < osu.timingPoints.size()) {
|
||||||
OsuTimingPoint timingPoint = osu.timingPoints.get(timingPointIndex);
|
TimingPoint timingPoint = osu.timingPoints.get(timingPointIndex);
|
||||||
if (timingPoint.getTime() > hitObjectTime)
|
if (timingPoint.getTime() > hitObjectTime)
|
||||||
break;
|
break;
|
||||||
setBeatLength(timingPoint, false);
|
setBeatLength(timingPoint, false);
|
||||||
|
@ -1096,7 +1096,7 @@ public class Game extends BasicGameState {
|
||||||
timingPointIndex = 0;
|
timingPointIndex = 0;
|
||||||
beatLengthBase = beatLength = 1;
|
beatLengthBase = beatLength = 1;
|
||||||
if (!osu.timingPoints.isEmpty()) {
|
if (!osu.timingPoints.isEmpty()) {
|
||||||
OsuTimingPoint timingPoint = osu.timingPoints.get(0);
|
TimingPoint timingPoint = osu.timingPoints.get(0);
|
||||||
if (!timingPoint.isInherited()) {
|
if (!timingPoint.isInherited()) {
|
||||||
setBeatLength(timingPoint, true);
|
setBeatLength(timingPoint, true);
|
||||||
timingPointIndex++;
|
timingPointIndex++;
|
||||||
|
@ -1440,7 +1440,7 @@ public class Game extends BasicGameState {
|
||||||
* @param timingPoint the timing point
|
* @param timingPoint the timing point
|
||||||
* @param setSampleSet whether to set the hit sample set based on the timing point
|
* @param setSampleSet whether to set the hit sample set based on the timing point
|
||||||
*/
|
*/
|
||||||
private void setBeatLength(OsuTimingPoint timingPoint, boolean setSampleSet) {
|
private void setBeatLength(TimingPoint timingPoint, boolean setSampleSet) {
|
||||||
if (!timingPoint.isInherited())
|
if (!timingPoint.isInherited())
|
||||||
beatLengthBase = beatLength = timingPoint.getBeatLength();
|
beatLengthBase = beatLength = timingPoint.getBeatLength();
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user