Major refactoring - now using far more logical class names.
- Renamed "OsuFile" to "Beatmap". All related variables and methods with "osu" have also been renamed to "beatmap" (or variants of each). - Renamed "OsuGroupNode" to "BeatmapSetNode". Avoids confusion since groups are identified by a "set ID", not a "group ID". - Renamed "OsuGroupList" to "BeatmapSetList", for the same reason as above. - Renamed "OsuDB" to "BeatmapDB", for the same reason as above. - Moved classes directly related to parsed beatmaps (Beatmap, BeatmapSetList, BeatmapSetNode, OsuHitObject, and TimingPoint) into a new "beatmap" package. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -25,18 +25,18 @@ import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.OsuFile;
|
||||
import itdelatrisu.opsu.OsuHitObject;
|
||||
import itdelatrisu.opsu.OsuParser;
|
||||
import itdelatrisu.opsu.ScoreData;
|
||||
import itdelatrisu.opsu.TimingPoint;
|
||||
import itdelatrisu.opsu.UI;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.audio.HitSound;
|
||||
import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.audio.SoundController;
|
||||
import itdelatrisu.opsu.audio.SoundEffect;
|
||||
import itdelatrisu.opsu.db.OsuDB;
|
||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
||||
import itdelatrisu.opsu.beatmap.OsuHitObject;
|
||||
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;
|
||||
@@ -96,8 +96,8 @@ public class Game extends BasicGameState {
|
||||
/** Stack position offset modifier. */
|
||||
private static final float STACK_OFFSET_MODIFIER = 0.05f;
|
||||
|
||||
/** The associated OsuFile object. */
|
||||
private OsuFile osu;
|
||||
/** The associated beatmap. */
|
||||
private Beatmap beatmap;
|
||||
|
||||
/** The associated GameData object. */
|
||||
private GameData data;
|
||||
@@ -254,7 +254,7 @@ public class Game extends BasicGameState {
|
||||
trackPosition = pauseTime;
|
||||
else if (deathTime > -1) // "Easy" mod: health bar increasing
|
||||
trackPosition = deathTime;
|
||||
int firstObjectTime = osu.objects[0].getTime();
|
||||
int firstObjectTime = beatmap.objects[0].getTime();
|
||||
int timeDiff = firstObjectTime - trackPosition;
|
||||
|
||||
g.setBackground(Color.black);
|
||||
@@ -273,7 +273,7 @@ public class Game extends BasicGameState {
|
||||
else
|
||||
dimLevel = 1f;
|
||||
}
|
||||
if (Options.isDefaultPlayfieldForced() || !osu.drawBG(width, height, dimLevel, false)) {
|
||||
if (Options.isDefaultPlayfieldForced() || !beatmap.drawBG(width, height, dimLevel, false)) {
|
||||
Image playfield = GameImage.PLAYFIELD.getImage();
|
||||
playfield.setAlpha(dimLevel);
|
||||
playfield.draw();
|
||||
@@ -292,7 +292,7 @@ public class Game extends BasicGameState {
|
||||
float[] autoXY = null;
|
||||
if (isLeadIn()) {
|
||||
// lead-in
|
||||
float progress = Math.max((float) (leadInTime - osu.audioLeadIn) / approachTime, 0f);
|
||||
float progress = Math.max((float) (leadInTime - beatmap.audioLeadIn) / approachTime, 0f);
|
||||
autoMouseY = (int) (height / (2f - progress));
|
||||
} else if (objectIndex == 0 && trackPosition < firstObjectTime) {
|
||||
// before first object
|
||||
@@ -301,20 +301,20 @@ public class Game extends BasicGameState {
|
||||
float[] xy = hitObjects[0].getPointAt(trackPosition);
|
||||
autoXY = getPointAt(autoMouseX, autoMouseY, xy[0], xy[1], 1f - ((float) timeDiff / Math.min(approachTime, firstObjectTime)));
|
||||
}
|
||||
} else if (objectIndex < osu.objects.length) {
|
||||
} else if (objectIndex < beatmap.objects.length) {
|
||||
// normal object
|
||||
int objectTime = osu.objects[objectIndex].getTime();
|
||||
int objectTime = beatmap.objects[objectIndex].getTime();
|
||||
if (trackPosition < objectTime) {
|
||||
float[] xyStart = hitObjects[objectIndex - 1].getPointAt(trackPosition);
|
||||
int startTime = hitObjects[objectIndex - 1].getEndTime();
|
||||
if (osu.breaks != null && breakIndex < osu.breaks.size()) {
|
||||
if (beatmap.breaks != null && breakIndex < beatmap.breaks.size()) {
|
||||
// starting a break: keep cursor at previous hit object position
|
||||
if (breakTime > 0 || objectTime > osu.breaks.get(breakIndex))
|
||||
if (breakTime > 0 || objectTime > beatmap.breaks.get(breakIndex))
|
||||
autoXY = xyStart;
|
||||
|
||||
// after a break ends: move startTime to break end time
|
||||
else if (breakIndex > 1) {
|
||||
int lastBreakEndTime = osu.breaks.get(breakIndex - 1);
|
||||
int lastBreakEndTime = beatmap.breaks.get(breakIndex - 1);
|
||||
if (objectTime > lastBreakEndTime && startTime < lastBreakEndTime)
|
||||
startTime = lastBreakEndTime;
|
||||
}
|
||||
@@ -326,8 +326,8 @@ public class Game extends BasicGameState {
|
||||
|
||||
// hit circles: show a mouse press
|
||||
int offset300 = hitResultOffset[GameData.HIT_300];
|
||||
if ((osu.objects[objectIndex].isCircle() && objectTime - trackPosition < offset300) ||
|
||||
(osu.objects[objectIndex - 1].isCircle() && trackPosition - osu.objects[objectIndex - 1].getTime() < offset300))
|
||||
if ((beatmap.objects[objectIndex].isCircle() && objectTime - trackPosition < offset300) ||
|
||||
(beatmap.objects[objectIndex - 1].isCircle() && trackPosition - beatmap.objects[objectIndex - 1].getTime() < offset300))
|
||||
autoMousePressed = true;
|
||||
}
|
||||
} else {
|
||||
@@ -388,12 +388,12 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
|
||||
// break periods
|
||||
if (osu.breaks != null && breakIndex < osu.breaks.size() && breakTime > 0) {
|
||||
int endTime = osu.breaks.get(breakIndex);
|
||||
if (beatmap.breaks != null && breakIndex < beatmap.breaks.size() && breakTime > 0) {
|
||||
int endTime = beatmap.breaks.get(breakIndex);
|
||||
int breakLength = endTime - breakTime;
|
||||
|
||||
// letterbox effect (black bars on top/bottom)
|
||||
if (osu.letterboxInBreaks && breakLength >= 4000) {
|
||||
if (beatmap.letterboxInBreaks && breakLength >= 4000) {
|
||||
g.setColor(Color.black);
|
||||
g.fillRect(0, 0, width, height * 0.125f);
|
||||
g.fillRect(0, height * 0.875f, width, height * 0.125f);
|
||||
@@ -441,7 +441,7 @@ public class Game extends BasicGameState {
|
||||
|
||||
// skip beginning
|
||||
if (objectIndex == 0 &&
|
||||
trackPosition < osu.objects[0].getTime() - SKIP_OFFSET)
|
||||
trackPosition < beatmap.objects[0].getTime() - SKIP_OFFSET)
|
||||
skipButton.draw();
|
||||
|
||||
// show retries
|
||||
@@ -465,7 +465,7 @@ public class Game extends BasicGameState {
|
||||
trackPosition = (leadInTime - Options.getMusicOffset()) * -1; // render approach circles during song lead-in
|
||||
|
||||
// countdown
|
||||
if (osu.countdown > 0) {
|
||||
if (beatmap.countdown > 0) {
|
||||
float speedModifier = GameMod.getSpeedMultiplier() * playbackSpeed.getModifier();
|
||||
timeDiff = firstObjectTime - trackPosition;
|
||||
if (timeDiff >= 500 * speedModifier && timeDiff < 3000 * speedModifier) {
|
||||
@@ -667,11 +667,11 @@ public class Game extends BasicGameState {
|
||||
replayFrames.getFirst().setTimeDiff(replaySkipTime * -1);
|
||||
replayFrames.addFirst(ReplayFrame.getStartFrame(replaySkipTime));
|
||||
replayFrames.addFirst(ReplayFrame.getStartFrame(0));
|
||||
Replay r = data.getReplay(replayFrames.toArray(new ReplayFrame[replayFrames.size()]), osu);
|
||||
Replay r = data.getReplay(replayFrames.toArray(new ReplayFrame[replayFrames.size()]), beatmap);
|
||||
if (r != null && !unranked)
|
||||
r.save();
|
||||
}
|
||||
ScoreData score = data.getScoreData(osu);
|
||||
ScoreData score = data.getScoreData(beatmap);
|
||||
|
||||
// add score to database
|
||||
if (!unranked && !isReplay)
|
||||
@@ -683,8 +683,8 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
|
||||
// timing points
|
||||
if (timingPointIndex < osu.timingPoints.size()) {
|
||||
TimingPoint timingPoint = osu.timingPoints.get(timingPointIndex);
|
||||
if (timingPointIndex < beatmap.timingPoints.size()) {
|
||||
TimingPoint timingPoint = beatmap.timingPoints.get(timingPointIndex);
|
||||
if (trackPosition >= timingPoint.getTime()) {
|
||||
setBeatLength(timingPoint, true);
|
||||
timingPointIndex++;
|
||||
@@ -692,12 +692,12 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
|
||||
// song beginning
|
||||
if (objectIndex == 0 && trackPosition < osu.objects[0].getTime())
|
||||
if (objectIndex == 0 && trackPosition < beatmap.objects[0].getTime())
|
||||
return; // nothing to do here
|
||||
|
||||
// break periods
|
||||
if (osu.breaks != null && breakIndex < osu.breaks.size()) {
|
||||
int breakValue = osu.breaks.get(breakIndex);
|
||||
if (beatmap.breaks != null && breakIndex < beatmap.breaks.size()) {
|
||||
int breakValue = beatmap.breaks.get(breakIndex);
|
||||
if (breakTime > 0) { // in a break period
|
||||
if (trackPosition < breakValue)
|
||||
return;
|
||||
@@ -749,10 +749,10 @@ 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 > osu.objects[objectIndex].getTime()) {
|
||||
while (objectIndex < hitObjects.length && trackPosition > beatmap.objects[objectIndex].getTime()) {
|
||||
// check if we've already passed the next object's start time
|
||||
boolean overlap = (objectIndex + 1 < hitObjects.length &&
|
||||
trackPosition > osu.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
|
||||
if (hitObjects[objectIndex].update(overlap, delta, mouseX, mouseY, keyPressed, trackPosition))
|
||||
@@ -791,7 +791,7 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
|
||||
// pause game
|
||||
if (pauseTime < 0 && breakTime <= 0 && trackPosition >= osu.objects[0].getTime()) {
|
||||
if (pauseTime < 0 && breakTime <= 0 && trackPosition >= beatmap.objects[0].getTime()) {
|
||||
pausedMouseX = mouseX;
|
||||
pausedMouseY = mouseY;
|
||||
pausePulse = 0f;
|
||||
@@ -808,7 +808,7 @@ public class Game extends BasicGameState {
|
||||
// restart
|
||||
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
|
||||
try {
|
||||
if (trackPosition < osu.objects[0].getTime())
|
||||
if (trackPosition < beatmap.objects[0].getTime())
|
||||
retries--; // don't count this retry (cancel out later increment)
|
||||
restart = Restart.MANUAL;
|
||||
enter(container, game);
|
||||
@@ -835,7 +835,7 @@ public class Game extends BasicGameState {
|
||||
// load checkpoint
|
||||
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
|
||||
int checkpoint = Options.getCheckpoint();
|
||||
if (checkpoint == 0 || checkpoint > osu.endTime)
|
||||
if (checkpoint == 0 || checkpoint > beatmap.endTime)
|
||||
break; // invalid checkpoint
|
||||
try {
|
||||
restart = Restart.MANUAL;
|
||||
@@ -852,10 +852,10 @@ public class Game extends BasicGameState {
|
||||
MusicController.setPosition(checkpoint);
|
||||
MusicController.setPitch(GameMod.getSpeedMultiplier() * playbackSpeed.getModifier());
|
||||
while (objectIndex < hitObjects.length &&
|
||||
osu.objects[objectIndex++].getTime() <= checkpoint)
|
||||
beatmap.objects[objectIndex++].getTime() <= checkpoint)
|
||||
;
|
||||
objectIndex--;
|
||||
lastReplayTime = osu.objects[objectIndex].getTime();
|
||||
lastReplayTime = beatmap.objects[objectIndex].getTime();
|
||||
} catch (SlickException e) {
|
||||
ErrorHandler.error("Failed to load checkpoint.", e, false);
|
||||
}
|
||||
@@ -905,7 +905,7 @@ public class Game extends BasicGameState {
|
||||
// mouse wheel: pause the game
|
||||
if (button == Input.MOUSE_MIDDLE_BUTTON && !Options.isMouseWheelDisabled()) {
|
||||
int trackPosition = MusicController.getPosition();
|
||||
if (pauseTime < 0 && breakTime <= 0 && trackPosition >= osu.objects[0].getTime()) {
|
||||
if (pauseTime < 0 && breakTime <= 0 && trackPosition >= beatmap.objects[0].getTime()) {
|
||||
pausedMouseX = x;
|
||||
pausedMouseY = y;
|
||||
pausePulse = 0f;
|
||||
@@ -1021,8 +1021,8 @@ public class Game extends BasicGameState {
|
||||
throws SlickException {
|
||||
UI.enter();
|
||||
|
||||
if (osu == null || osu.objects == null)
|
||||
throw new RuntimeException("Running game with no OsuFile loaded.");
|
||||
if (beatmap == null || beatmap.objects == null)
|
||||
throw new RuntimeException("Running game with no beatmap loaded.");
|
||||
|
||||
// grab the mouse (not working for touchscreen)
|
||||
// container.setMouseGrabbed(true);
|
||||
@@ -1044,8 +1044,8 @@ public class Game extends BasicGameState {
|
||||
resetGameData();
|
||||
|
||||
// load the first timingPoint for stacking
|
||||
if (!osu.timingPoints.isEmpty()) {
|
||||
TimingPoint timingPoint = osu.timingPoints.get(0);
|
||||
if (!beatmap.timingPoints.isEmpty()) {
|
||||
TimingPoint timingPoint = beatmap.timingPoints.get(0);
|
||||
if (!timingPoint.isInherited()) {
|
||||
setBeatLength(timingPoint, true);
|
||||
timingPointIndex++;
|
||||
@@ -1053,20 +1053,20 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
|
||||
// initialize object maps
|
||||
for (int i = 0; i < osu.objects.length; i++) {
|
||||
OsuHitObject hitObject = osu.objects[i];
|
||||
for (int i = 0; i < beatmap.objects.length; i++) {
|
||||
OsuHitObject hitObject = beatmap.objects[i];
|
||||
|
||||
// is this the last note in the combo?
|
||||
boolean comboEnd = false;
|
||||
if (i + 1 < osu.objects.length && osu.objects[i + 1].isNewCombo())
|
||||
if (i + 1 < beatmap.objects.length && beatmap.objects[i + 1].isNewCombo())
|
||||
comboEnd = true;
|
||||
|
||||
Color color = osu.combo[hitObject.getComboIndex()];
|
||||
Color color = beatmap.combo[hitObject.getComboIndex()];
|
||||
|
||||
// pass beatLength to hit objects
|
||||
int hitObjectTime = hitObject.getTime();
|
||||
while (timingPointIndex < osu.timingPoints.size()) {
|
||||
TimingPoint timingPoint = osu.timingPoints.get(timingPointIndex);
|
||||
while (timingPointIndex < beatmap.timingPoints.size()) {
|
||||
TimingPoint timingPoint = beatmap.timingPoints.get(timingPointIndex);
|
||||
if (timingPoint.getTime() > hitObjectTime)
|
||||
break;
|
||||
setBeatLength(timingPoint, false);
|
||||
@@ -1095,8 +1095,8 @@ public class Game extends BasicGameState {
|
||||
// load the first timingPoint
|
||||
timingPointIndex = 0;
|
||||
beatLengthBase = beatLength = 1;
|
||||
if (!osu.timingPoints.isEmpty()) {
|
||||
TimingPoint timingPoint = osu.timingPoints.get(0);
|
||||
if (!beatmap.timingPoints.isEmpty()) {
|
||||
TimingPoint timingPoint = beatmap.timingPoints.get(0);
|
||||
if (!timingPoint.isInherited()) {
|
||||
setBeatLength(timingPoint, true);
|
||||
timingPointIndex++;
|
||||
@@ -1140,7 +1140,7 @@ public class Game extends BasicGameState {
|
||||
replayFrames.add(new ReplayFrame(0, 0, input.getMouseX(), input.getMouseY(), 0));
|
||||
}
|
||||
|
||||
leadInTime = osu.audioLeadIn + approachTime;
|
||||
leadInTime = beatmap.audioLeadIn + approachTime;
|
||||
restart = Restart.FALSE;
|
||||
|
||||
// needs to play before setting position to resume without lag later
|
||||
@@ -1181,27 +1181,27 @@ public class Game extends BasicGameState {
|
||||
private void drawHitObjects(Graphics g, int trackPosition) {
|
||||
// include previous object in follow points
|
||||
int lastObjectIndex = -1;
|
||||
if (objectIndex > 0 && objectIndex < osu.objects.length &&
|
||||
trackPosition < osu.objects[objectIndex].getTime() && !osu.objects[objectIndex - 1].isSpinner())
|
||||
if (objectIndex > 0 && objectIndex < beatmap.objects.length &&
|
||||
trackPosition < beatmap.objects[objectIndex].getTime() && !beatmap.objects[objectIndex - 1].isSpinner())
|
||||
lastObjectIndex = objectIndex - 1;
|
||||
|
||||
// draw hit objects in reverse order, or else overlapping objects are unreadable
|
||||
Stack<Integer> stack = new Stack<Integer>();
|
||||
for (int index = objectIndex; index < hitObjects.length && osu.objects[index].getTime() < trackPosition + approachTime; index++) {
|
||||
for (int index = objectIndex; index < hitObjects.length && beatmap.objects[index].getTime() < trackPosition + approachTime; index++) {
|
||||
stack.add(index);
|
||||
|
||||
// draw follow points
|
||||
if (!Options.isFollowPointEnabled())
|
||||
continue;
|
||||
if (osu.objects[index].isSpinner()) {
|
||||
if (beatmap.objects[index].isSpinner()) {
|
||||
lastObjectIndex = -1;
|
||||
continue;
|
||||
}
|
||||
if (lastObjectIndex != -1 && !osu.objects[index].isNewCombo()) {
|
||||
if (lastObjectIndex != -1 && !beatmap.objects[index].isNewCombo()) {
|
||||
// calculate points
|
||||
final int followPointInterval = container.getHeight() / 14;
|
||||
int lastObjectEndTime = hitObjects[lastObjectIndex].getEndTime() + 1;
|
||||
int objectStartTime = osu.objects[index].getTime();
|
||||
int objectStartTime = beatmap.objects[index].getTime();
|
||||
float[] startXY = hitObjects[lastObjectIndex].getPointAt(lastObjectEndTime);
|
||||
float[] endXY = hitObjects[index].getPointAt(objectStartTime);
|
||||
float xDiff = endXY[0] - startXY[0];
|
||||
@@ -1257,23 +1257,23 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all required data from an OsuFile.
|
||||
* @param osu the OsuFile to load
|
||||
* Loads all required data from a beatmap.
|
||||
* @param beatmap the beatmap to load
|
||||
*/
|
||||
public void loadOsuFile(OsuFile osu) {
|
||||
this.osu = osu;
|
||||
Display.setTitle(String.format("%s - %s", game.getTitle(), osu.toString()));
|
||||
if (osu.timingPoints == null || osu.combo == null)
|
||||
OsuDB.load(osu, OsuDB.LOAD_ARRAY);
|
||||
OsuParser.parseHitObjects(osu);
|
||||
HitSound.setDefaultSampleSet(osu.sampleSet);
|
||||
public void loadBeatmap(Beatmap beatmap) {
|
||||
this.beatmap = beatmap;
|
||||
Display.setTitle(String.format("%s - %s", game.getTitle(), beatmap.toString()));
|
||||
if (beatmap.timingPoints == null || beatmap.combo == null)
|
||||
BeatmapDB.load(beatmap, BeatmapDB.LOAD_ARRAY);
|
||||
OsuParser.parseHitObjects(beatmap);
|
||||
HitSound.setDefaultSampleSet(beatmap.sampleSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets all game data and structures.
|
||||
*/
|
||||
public void resetGameData() {
|
||||
hitObjects = new HitObject[osu.objects.length];
|
||||
hitObjects = new HitObject[beatmap.objects.length];
|
||||
data.clear();
|
||||
objectIndex = 0;
|
||||
breakIndex = 0;
|
||||
@@ -1308,7 +1308,7 @@ public class Game extends BasicGameState {
|
||||
* @return true if skipped, false otherwise
|
||||
*/
|
||||
private synchronized boolean skipIntro() {
|
||||
int firstObjectTime = osu.objects[0].getTime();
|
||||
int firstObjectTime = beatmap.objects[0].getTime();
|
||||
int trackPosition = MusicController.getPosition();
|
||||
if (objectIndex == 0 && trackPosition < firstObjectTime - SKIP_OFFSET) {
|
||||
if (isLeadIn()) {
|
||||
@@ -1336,7 +1336,7 @@ public class Game extends BasicGameState {
|
||||
int height = container.getHeight();
|
||||
|
||||
// set images
|
||||
File parent = osu.getFile().getParentFile();
|
||||
File parent = beatmap.getFile().getParentFile();
|
||||
for (GameImage img : GameImage.values()) {
|
||||
if (img.isSkinnable()) {
|
||||
img.setDefaultImage();
|
||||
@@ -1365,10 +1365,10 @@ public class Game extends BasicGameState {
|
||||
private void setMapModifiers() {
|
||||
// map-based properties, re-initialized each game
|
||||
float multiplier = GameMod.getDifficultyMultiplier();
|
||||
float circleSize = Math.min(osu.circleSize * multiplier, 10f);
|
||||
float approachRate = Math.min(osu.approachRate * multiplier, 10f);
|
||||
float overallDifficulty = Math.min(osu.overallDifficulty * multiplier, 10f);
|
||||
float HPDrainRate = Math.min(osu.HPDrainRate * multiplier, 10f);
|
||||
float circleSize = Math.min(beatmap.circleSize * multiplier, 10f);
|
||||
float approachRate = Math.min(beatmap.approachRate * multiplier, 10f);
|
||||
float overallDifficulty = Math.min(beatmap.overallDifficulty * multiplier, 10f);
|
||||
float HPDrainRate = Math.min(beatmap.HPDrainRate * multiplier, 10f);
|
||||
|
||||
// fixed difficulty overrides
|
||||
if (Options.getFixedCS() > 0f)
|
||||
@@ -1387,7 +1387,7 @@ public class Game extends BasicGameState {
|
||||
|
||||
// initialize objects
|
||||
Circle.init(container, circleSize);
|
||||
Slider.init(container, circleSize, osu);
|
||||
Slider.init(container, circleSize, beatmap);
|
||||
Spinner.init(container);
|
||||
|
||||
// approachRate (hit object approach time)
|
||||
@@ -1522,7 +1522,7 @@ public class Game extends BasicGameState {
|
||||
if (objectIndex >= hitObjects.length) // nothing to do here
|
||||
return;
|
||||
|
||||
OsuHitObject hitObject = osu.objects[objectIndex];
|
||||
OsuHitObject hitObject = beatmap.objects[objectIndex];
|
||||
|
||||
// circles
|
||||
if (hitObject.isCircle() && hitObjects[objectIndex].mousePressed(x, y, trackPosition))
|
||||
@@ -1582,14 +1582,14 @@ public class Game extends BasicGameState {
|
||||
return;
|
||||
|
||||
int width = container.getWidth(), height = container.getHeight();
|
||||
boolean firstObject = (objectIndex == 0 && trackPosition < osu.objects[0].getTime());
|
||||
boolean firstObject = (objectIndex == 0 && trackPosition < beatmap.objects[0].getTime());
|
||||
if (isLeadIn()) {
|
||||
// lead-in: expand area
|
||||
float progress = Math.max((float) (leadInTime - osu.audioLeadIn) / approachTime, 0f);
|
||||
float progress = Math.max((float) (leadInTime - beatmap.audioLeadIn) / approachTime, 0f);
|
||||
flashlightRadius = width - (int) ((width - (height * 2 / 3)) * progress);
|
||||
} else if (firstObject) {
|
||||
// before first object: shrink area
|
||||
int timeDiff = osu.objects[0].getTime() - trackPosition;
|
||||
int timeDiff = beatmap.objects[0].getTime() - trackPosition;
|
||||
flashlightRadius = width;
|
||||
if (timeDiff < approachTime) {
|
||||
float progress = (float) timeDiff / approachTime;
|
||||
@@ -1605,10 +1605,10 @@ public class Game extends BasicGameState {
|
||||
targetRadius = height / 2;
|
||||
else
|
||||
targetRadius = height / 3;
|
||||
if (osu.breaks != null && breakIndex < osu.breaks.size() && breakTime > 0) {
|
||||
if (beatmap.breaks != null && breakIndex < beatmap.breaks.size() && breakTime > 0) {
|
||||
// breaks: expand at beginning, shrink at end
|
||||
flashlightRadius = targetRadius;
|
||||
int endTime = osu.breaks.get(breakIndex);
|
||||
int endTime = beatmap.breaks.get(breakIndex);
|
||||
int breakLength = endTime - breakTime;
|
||||
if (breakLength > approachTime * 3) {
|
||||
float progress = 1f;
|
||||
@@ -1642,7 +1642,7 @@ public class Game extends BasicGameState {
|
||||
private void calculateStacks() {
|
||||
// reverse pass for stack calculation
|
||||
for (int i = hitObjects.length - 1; i > 0; i--) {
|
||||
OsuHitObject hitObjectI = osu.objects[i];
|
||||
OsuHitObject hitObjectI = beatmap.objects[i];
|
||||
|
||||
// already calculated
|
||||
if (hitObjectI.getStack() != 0 || hitObjectI.isSpinner())
|
||||
@@ -1650,12 +1650,12 @@ public class Game extends BasicGameState {
|
||||
|
||||
// search for hit objects in stack
|
||||
for (int n = i - 1; n >= 0; n--) {
|
||||
OsuHitObject hitObjectN = osu.objects[n];
|
||||
OsuHitObject hitObjectN = beatmap.objects[n];
|
||||
if (hitObjectN.isSpinner())
|
||||
continue;
|
||||
|
||||
// check if in range stack calculation
|
||||
float timeI = hitObjectI.getTime() - (STACK_TIMEOUT * osu.stackLeniency);
|
||||
float timeI = hitObjectI.getTime() - (STACK_TIMEOUT * beatmap.stackLeniency);
|
||||
float timeN = hitObjectN.isSlider() ? hitObjects[n].getEndTime() : hitObjectN.getTime();
|
||||
if (timeI > timeN)
|
||||
break;
|
||||
@@ -1671,7 +1671,7 @@ public class Game extends BasicGameState {
|
||||
if (distance < STACK_LENIENCE * OsuHitObject.getXMultiplier()) {
|
||||
int offset = hitObjectI.getStack() - hitObjectN.getStack() + 1;
|
||||
for (int j = n + 1; j <= i; j++) {
|
||||
OsuHitObject hitObjectJ = osu.objects[j];
|
||||
OsuHitObject hitObjectJ = beatmap.objects[j];
|
||||
p1 = hitObjects[j].getPointAt(hitObjectJ.getTime());
|
||||
distance = Utils.distance(p1[0], p1[1], p2[0], p2[1]);
|
||||
|
||||
@@ -1697,7 +1697,7 @@ public class Game extends BasicGameState {
|
||||
|
||||
// update hit object positions
|
||||
for (int i = 0; i < hitObjects.length; i++) {
|
||||
if (osu.objects[i].getStack() != 0)
|
||||
if (beatmap.objects[i].getStack() != 0)
|
||||
hitObjects[i].updatePosition();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user