Renamed GameScore class to GameData.

Makes more sense, since the class is responsible for more than just the score.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-01-27 03:19:39 -05:00
parent ef9e38bf2d
commit 44bdf70c98
6 changed files with 113 additions and 113 deletions

View File

@@ -21,7 +21,7 @@ package itdelatrisu.opsu.states;
import itdelatrisu.opsu.ErrorHandler;
import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.GameMod;
import itdelatrisu.opsu.GameScore;
import itdelatrisu.opsu.GameData;
import itdelatrisu.opsu.MenuButton;
import itdelatrisu.opsu.Opsu;
import itdelatrisu.opsu.Options;
@@ -73,8 +73,8 @@ public class Game extends BasicGameState {
/** The associated OsuFile object. */
private OsuFile osu;
/** The associated GameScore object (holds all score data). */
private GameScore score;
/** The associated GameData object. */
private GameData data;
/** Current hit object index in OsuHitObject[] array. */
private int objectIndex = 0;
@@ -158,9 +158,9 @@ public class Game extends BasicGameState {
int width = container.getWidth();
int height = container.getHeight();
// create the associated GameScore object
score = new GameScore(width, height);
((GameRanking) game.getState(Opsu.STATE_GAMERANKING)).setGameScore(score);
// create the associated GameData object
data = new GameData(width, height);
((GameRanking) game.getState(Opsu.STATE_GAMERANKING)).setGameData(data);
}
@Override
@@ -215,13 +215,13 @@ public class Game extends BasicGameState {
g.fillRect(0, height * 0.875f, width, height * 0.125f);
}
score.drawGameElements(g, true, objectIndex == 0);
data.drawGameElements(g, true, objectIndex == 0);
if (breakLength >= 8000 &&
trackPosition - breakTime > 2000 &&
trackPosition - breakTime < 5000) {
// show break start
if (score.getHealth() >= 50) {
if (data.getHealth() >= 50) {
GameImage.SECTION_PASS.getImage().drawCentered(width / 2f, height / 2f);
if (!breakSound) {
SoundController.playSound(SoundEffect.SECTIONPASS);
@@ -258,7 +258,7 @@ public class Game extends BasicGameState {
}
// game elements
score.drawGameElements(g, false, objectIndex == 0);
data.drawGameElements(g, false, objectIndex == 0);
// skip beginning
if (objectIndex == 0 &&
@@ -338,7 +338,7 @@ public class Game extends BasicGameState {
hitObjects[stack.pop()].draw(trackPosition, stack.isEmpty(), g);
// draw OsuHitObjectResult objects
score.drawHitResults(trackPosition);
data.drawHitResults(trackPosition);
if (GameMod.AUTO.isActive())
GameImage.UNRANKED.getImage().drawCentered(width / 2, height * 0.077f);
@@ -405,15 +405,15 @@ public class Game extends BasicGameState {
// "Easy" mod: multiple "lives"
if (GameMod.EASY.isActive() && deathTime > -1) {
if (score.getHealth() < 99f)
score.changeHealth(delta / 10f);
if (data.getHealth() < 99f)
data.changeHealth(delta / 10f);
else {
MusicController.resume();
deathTime = -1;
}
}
score.updateDisplays(delta);
data.updateDisplays(delta);
// map complete!
if (objectIndex >= osu.objects.length) {
@@ -477,8 +477,8 @@ public class Game extends BasicGameState {
}
// drain health
score.changeHealth(delta * -1 * GameScore.HP_DRAIN_MULTIPLIER);
if (!score.isAlive()) {
data.changeHealth(delta * -1 * GameData.HP_DRAIN_MULTIPLIER);
if (!data.isAlive()) {
// "Easy" mod
if (GameMod.EASY.isActive()) {
deaths++;
@@ -498,7 +498,7 @@ public class Game extends BasicGameState {
while (objectIndex < osu.objects.length && trackPosition > osu.objects[objectIndex].getTime()) {
// check if we've already passed the next object's start time
boolean overlap = (objectIndex + 1 < osu.objects.length &&
trackPosition > osu.objects[objectIndex + 1].getTime() - hitResultOffset[GameScore.HIT_300]);
trackPosition > osu.objects[objectIndex + 1].getTime() - hitResultOffset[GameData.HIT_300]);
// update hit object and check completion status
if (hitObjects[objectIndex].update(overlap, delta, mouseX, mouseY))
@@ -698,11 +698,11 @@ public class Game extends BasicGameState {
Color color = osu.combo[hitObject.getComboIndex()];
if (hitObject.isCircle())
hitObjects[i] = new Circle(hitObject, this, score, color, comboEnd);
hitObjects[i] = new Circle(hitObject, this, data, color, comboEnd);
else if (hitObject.isSlider())
hitObjects[i] = new Slider(hitObject, this, score, color, comboEnd);
hitObjects[i] = new Slider(hitObject, this, data, color, comboEnd);
else if (hitObject.isSpinner())
hitObjects[i] = new Spinner(hitObject, this, score);
hitObjects[i] = new Spinner(hitObject, this, data);
}
// load the first timingPoint
@@ -734,7 +734,7 @@ public class Game extends BasicGameState {
*/
public void resetGameData() {
hitObjects = new HitObject[osu.objects.length];
score.clear();
data.clear();
objectIndex = 0;
breakIndex = 0;
breakTime = 0;
@@ -800,7 +800,7 @@ public class Game extends BasicGameState {
// load other images...
((GamePauseMenu) game.getState(Opsu.STATE_GAMEPAUSEMENU)).loadImages();
score.loadImages(osu.getFile().getParentFile());
data.loadImages(osu.getFile().getParentFile());
}
/**
@@ -851,15 +851,15 @@ public class Game extends BasicGameState {
approachTime = (int) (1200 - ((approachRate - 5) * 150));
// overallDifficulty (hit result time offsets)
hitResultOffset = new int[GameScore.HIT_MAX];
hitResultOffset[GameScore.HIT_300] = (int) (78 - (overallDifficulty * 6));
hitResultOffset[GameScore.HIT_100] = (int) (138 - (overallDifficulty * 8));
hitResultOffset[GameScore.HIT_50] = (int) (198 - (overallDifficulty * 10));
hitResultOffset[GameScore.HIT_MISS] = (int) (500 - (overallDifficulty * 10));
hitResultOffset = new int[GameData.HIT_MAX];
hitResultOffset[GameData.HIT_300] = (int) (78 - (overallDifficulty * 6));
hitResultOffset[GameData.HIT_100] = (int) (138 - (overallDifficulty * 8));
hitResultOffset[GameData.HIT_50] = (int) (198 - (overallDifficulty * 10));
hitResultOffset[GameData.HIT_MISS] = (int) (500 - (overallDifficulty * 10));
// HPDrainRate (health change), overallDifficulty (scoring)
score.setDrainRate(HPDrainRate);
score.setDifficulty(overallDifficulty);
data.setDrainRate(HPDrainRate);
data.setDifficulty(overallDifficulty);
}
/**
@@ -879,7 +879,7 @@ public class Game extends BasicGameState {
public int getApproachTime() { return approachTime; }
/**
* Returns an array of hit result offset times, in milliseconds (indexed by GameScore.HIT_* constants).
* Returns an array of hit result offset times, in milliseconds (indexed by GameData.HIT_* constants).
*/
public int[] getHitResultOffsets() { return hitResultOffset; }