From 44bdf70c983c15d834cc72bb015493813d08be65 Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Tue, 27 Jan 2015 03:19:39 -0500 Subject: [PATCH] Renamed GameScore class to GameData. Makes more sense, since the class is responsible for more than just the score. Signed-off-by: Jeffrey Han --- .../opsu/{GameScore.java => GameData.java} | 6 +- src/itdelatrisu/opsu/objects/Circle.java | 46 +++++++------- src/itdelatrisu/opsu/objects/Slider.java | 62 +++++++++---------- src/itdelatrisu/opsu/objects/Spinner.java | 38 ++++++------ src/itdelatrisu/opsu/states/Game.java | 58 ++++++++--------- src/itdelatrisu/opsu/states/GameRanking.java | 16 ++--- 6 files changed, 113 insertions(+), 113 deletions(-) rename src/itdelatrisu/opsu/{GameScore.java => GameData.java} (99%) diff --git a/src/itdelatrisu/opsu/GameScore.java b/src/itdelatrisu/opsu/GameData.java similarity index 99% rename from src/itdelatrisu/opsu/GameScore.java rename to src/itdelatrisu/opsu/GameData.java index b18c385b..8c628e41 100644 --- a/src/itdelatrisu/opsu/GameScore.java +++ b/src/itdelatrisu/opsu/GameData.java @@ -34,9 +34,9 @@ import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; /** - * Holds score data and renders all score-related elements. + * Holds game data and renders all related elements. */ -public class GameScore { +public class GameData { /** Delta multiplier for steady HP drain. */ public static final float HP_DRAIN_MULTIPLIER = 1 / 200f; @@ -202,7 +202,7 @@ public class GameScore { * @param width container width * @param height container height */ - public GameScore(int width, int height) { + public GameData(int width, int height) { this.width = width; this.height = height; diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index 031333ec..060c71fb 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -20,7 +20,7 @@ package itdelatrisu.opsu.objects; import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameMod; -import itdelatrisu.opsu.GameScore; +import itdelatrisu.opsu.GameData; import itdelatrisu.opsu.OsuHitObject; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.MusicController; @@ -40,8 +40,8 @@ public class Circle implements HitObject { /** The associated Game object. */ private Game game; - /** The associated GameScore object. */ - private GameScore score; + /** The associated GameData object. */ + private GameData data; /** The color of this circle. */ private Color color; @@ -66,14 +66,14 @@ public class Circle implements HitObject { * Constructor. * @param hitObject the associated OsuHitObject * @param game the associated Game object - * @param score the associated GameScore 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, GameScore score, Color color, boolean comboEnd) { + public Circle(OsuHitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) { this.hitObject = hitObject; this.game = game; - this.score = score; + this.data = data; this.color = color; this.comboEnd = comboEnd; } @@ -94,15 +94,15 @@ public class Circle implements HitObject { Utils.drawCentered(GameImage.HITCIRCLE.getImage(), x, y, color); color.a = oldAlpha; Utils.COLOR_WHITE_FADE.a = 1f; - score.drawSymbolNumber(hitObject.getComboNumber(), x, y, - GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / score.getDefaultSymbolImage(0).getHeight()); + data.drawSymbolNumber(hitObject.getComboNumber(), x, y, + GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight()); } } /** * Calculates the circle hit result. * @param time the hit object time (difference between track time) - * @return the hit result (GameScore.HIT_* constants) + * @return the hit result (GameData.HIT_* constants) */ private int hitResult(int time) { int trackPosition = MusicController.getPosition(); @@ -110,14 +110,14 @@ public class Circle implements HitObject { int[] hitResultOffset = game.getHitResultOffsets(); int result = -1; - if (timeDiff < hitResultOffset[GameScore.HIT_300]) - result = GameScore.HIT_300; - else if (timeDiff < hitResultOffset[GameScore.HIT_100]) - result = GameScore.HIT_100; - else if (timeDiff < hitResultOffset[GameScore.HIT_50]) - result = GameScore.HIT_50; - else if (timeDiff < hitResultOffset[GameScore.HIT_MISS]) - result = GameScore.HIT_MISS; + if (timeDiff < hitResultOffset[GameData.HIT_300]) + result = GameData.HIT_300; + else if (timeDiff < hitResultOffset[GameData.HIT_100]) + result = GameData.HIT_100; + else if (timeDiff < hitResultOffset[GameData.HIT_50]) + result = GameData.HIT_50; + else if (timeDiff < hitResultOffset[GameData.HIT_MISS]) + result = GameData.HIT_MISS; //else not a hit return result; @@ -130,7 +130,7 @@ public class Circle implements HitObject { if (distance < circleRadius) { int result = hitResult(hitObject.getTime()); if (result > -1) { - score.hitResult( + data.hitResult( hitObject.getTime(), result, hitObject.getX(), hitObject.getY(), color, comboEnd, hitObject.getHitSoundType() @@ -151,19 +151,19 @@ public class Circle implements HitObject { int[] hitResultOffset = game.getHitResultOffsets(); boolean isAutoMod = GameMod.AUTO.isActive(); - if (overlap || trackPosition > time + hitResultOffset[GameScore.HIT_50]) { + if (overlap || trackPosition > time + hitResultOffset[GameData.HIT_50]) { if (isAutoMod) // "auto" mod: catch any missed notes due to lag - score.hitResult(time, GameScore.HIT_300, x, y, color, comboEnd, hitSound); + data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitSound); else // no more points can be scored, so send a miss - score.hitResult(time, GameScore.HIT_MISS, x, y, null, comboEnd, hitSound); + data.hitResult(time, GameData.HIT_MISS, x, y, null, comboEnd, hitSound); return true; } // "auto" mod: send a perfect hit result else if (isAutoMod) { - if (Math.abs(trackPosition - time) < hitResultOffset[GameScore.HIT_300]) { - score.hitResult(time, GameScore.HIT_300, x, y, color, comboEnd, hitSound); + if (Math.abs(trackPosition - time) < hitResultOffset[GameData.HIT_300]) { + data.hitResult(time, GameData.HIT_300, x, y, color, comboEnd, hitSound); return true; } } diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index 4ff69083..e373105f 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -20,7 +20,7 @@ package itdelatrisu.opsu.objects; import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameMod; -import itdelatrisu.opsu.GameScore; +import itdelatrisu.opsu.GameData; import itdelatrisu.opsu.OsuFile; import itdelatrisu.opsu.OsuHitObject; import itdelatrisu.opsu.Utils; @@ -52,8 +52,8 @@ public class Slider implements HitObject { /** The associated Game object. */ private Game game; - /** The associated GameScore object. */ - private GameScore score; + /** The associated GameData object. */ + private GameData data; /** The color of this slider. */ private Color color; @@ -258,14 +258,14 @@ public class Slider implements HitObject { * Constructor. * @param hitObject the associated OsuHitObject * @param game the associated Game object - * @param score the associated GameScore 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 Slider(OsuHitObject hitObject, Game game, GameScore score, Color color, boolean comboEnd) { + public Slider(OsuHitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) { this.hitObject = hitObject; this.game = game; - this.score = score; + this.data = data; this.color = color; this.comboEnd = comboEnd; @@ -311,8 +311,8 @@ public class Slider implements HitObject { if (sliderClicked) ; // don't draw current combo number if already clicked else - score.drawSymbolNumber(hitObject.getComboNumber(), x, y, - hitCircle.getWidth() * 0.40f / score.getDefaultSymbolImage(0).getHeight()); + data.drawSymbolNumber(hitObject.getComboNumber(), x, y, + hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight()); color.a = oldAlpha; Utils.COLOR_WHITE_FADE.a = oldAlphaFade; @@ -350,7 +350,7 @@ public class Slider implements HitObject { * Calculates the slider hit result. * @param time the hit object time (difference between track time) * @param lastCircleHit true if the cursor was held within the last circle - * @return the hit result (GameScore.HIT_* constants) + * @return the hit result (GameData.HIT_* constants) */ private int hitResult() { int lastIndex = hitObject.getSliderX().length - 1; @@ -358,20 +358,20 @@ public class Slider implements HitObject { int result; if (tickRatio >= 1.0f) - result = GameScore.HIT_300; + result = GameData.HIT_300; else if (tickRatio >= 0.5f) - result = GameScore.HIT_100; + result = GameData.HIT_100; else if (tickRatio > 0f) - result = GameScore.HIT_50; + result = GameData.HIT_50; else - result = GameScore.HIT_MISS; + result = GameData.HIT_MISS; if (currentRepeats % 2 == 0) // last circle - score.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result, + data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result, hitObject.getSliderX()[lastIndex], hitObject.getSliderY()[lastIndex], color, comboEnd, hitObject.getHitSoundType()); else // first circle - score.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result, + data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result, hitObject.getX(), hitObject.getY(), color, comboEnd, hitObject.getHitSoundType()); return result; @@ -390,16 +390,16 @@ public class Slider implements HitObject { int[] hitResultOffset = game.getHitResultOffsets(); int result = -1; - if (timeDiff < hitResultOffset[GameScore.HIT_50]) { - result = GameScore.HIT_SLIDER30; + if (timeDiff < hitResultOffset[GameData.HIT_50]) { + result = GameData.HIT_SLIDER30; ticksHit++; - } else if (timeDiff < hitResultOffset[GameScore.HIT_MISS]) - result = GameScore.HIT_MISS; + } else if (timeDiff < hitResultOffset[GameData.HIT_MISS]) + result = GameData.HIT_MISS; //else not a hit if (result > -1) { sliderClicked = true; - score.sliderTickResult(hitObject.getTime(), result, + data.sliderTickResult(hitObject.getTime(), result, hitObject.getX(), hitObject.getY(), hitObject.getHitSoundType()); return true; } @@ -439,23 +439,23 @@ public class Slider implements HitObject { int time = hitObject.getTime(); // start circle time passed - if (trackPosition > time + hitResultOffset[GameScore.HIT_50]) { + if (trackPosition > time + hitResultOffset[GameData.HIT_50]) { sliderClicked = true; if (isAutoMod) { // "auto" mod: catch any missed notes due to lag ticksHit++; - score.sliderTickResult(time, GameScore.HIT_SLIDER30, + data.sliderTickResult(time, GameData.HIT_SLIDER30, hitObject.getX(), hitObject.getY(), hitSound); } else - score.sliderTickResult(time, GameScore.HIT_MISS, + data.sliderTickResult(time, GameData.HIT_MISS, hitObject.getX(), hitObject.getY(), hitSound); } // "auto" mod: send a perfect hit result else if (isAutoMod) { - if (Math.abs(trackPosition - time) < hitResultOffset[GameScore.HIT_300]) { + if (Math.abs(trackPosition - time) < hitResultOffset[GameData.HIT_300]) { ticksHit++; sliderClicked = true; - score.sliderTickResult(time, GameScore.HIT_SLIDER30, + data.sliderTickResult(time, GameData.HIT_SLIDER30, hitObject.getX(), hitObject.getY(), hitSound); } } @@ -514,32 +514,32 @@ public class Slider implements HitObject { if ((Utils.isGameKeyPressed() && distance < followCircleRadius) || isAutoMod) { // mouse pressed and within follow circle followCircleActive = true; - score.changeHealth(delta * GameScore.HP_DRAIN_MULTIPLIER); + data.changeHealth(delta * GameData.HP_DRAIN_MULTIPLIER); // held during new repeat if (isNewRepeat) { ticksHit++; if (currentRepeats % 2 > 0) // last circle - score.sliderTickResult(trackPosition, GameScore.HIT_SLIDER30, + data.sliderTickResult(trackPosition, GameData.HIT_SLIDER30, hitObject.getSliderX()[lastIndex], hitObject.getSliderY()[lastIndex], hitSound); else // first circle - score.sliderTickResult(trackPosition, GameScore.HIT_SLIDER30, + data.sliderTickResult(trackPosition, GameData.HIT_SLIDER30, c[0], c[1], hitSound); } // held during new tick if (isNewTick) { ticksHit++; - score.sliderTickResult(trackPosition, GameScore.HIT_SLIDER10, + data.sliderTickResult(trackPosition, GameData.HIT_SLIDER10, c[0], c[1], (byte) -1); } } else { followCircleActive = false; if (isNewRepeat) - score.sliderTickResult(trackPosition, GameScore.HIT_MISS, 0, 0, (byte) -1); + data.sliderTickResult(trackPosition, GameData.HIT_MISS, 0, 0, (byte) -1); if (isNewTick) - score.sliderTickResult(trackPosition, GameScore.HIT_MISS, 0, 0, (byte) -1); + data.sliderTickResult(trackPosition, GameData.HIT_MISS, 0, 0, (byte) -1); } return false; diff --git a/src/itdelatrisu/opsu/objects/Spinner.java b/src/itdelatrisu/opsu/objects/Spinner.java index 6f47d7d5..810f1dcf 100644 --- a/src/itdelatrisu/opsu/objects/Spinner.java +++ b/src/itdelatrisu/opsu/objects/Spinner.java @@ -20,7 +20,7 @@ package itdelatrisu.opsu.objects; import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameMod; -import itdelatrisu.opsu.GameScore; +import itdelatrisu.opsu.GameData; import itdelatrisu.opsu.OsuHitObject; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.MusicController; @@ -43,8 +43,8 @@ public class Spinner implements HitObject { /** The associated OsuHitObject. */ private OsuHitObject hitObject; - /** The associated GameScore object. */ - private GameScore score; + /** The associated GameData object. */ + private GameData data; /** The last rotation angle. */ private float lastAngle = -1f; @@ -68,14 +68,14 @@ public class Spinner implements HitObject { * Constructor. * @param hitObject the associated OsuHitObject * @param game the associated Game object - * @param score the associated GameScore object + * @param data the associated GameData object */ - public Spinner(OsuHitObject hitObject, Game game, GameScore score) { + public Spinner(OsuHitObject hitObject, Game game, GameData data) { this.hitObject = hitObject; - this.score = score; + this.data = data; // calculate rotations needed - float spinsPerMinute = 100 + (score.getDifficulty() * 15); + float spinsPerMinute = 100 + (data.getDifficulty() * 15); rotationsNeeded = spinsPerMinute * (hitObject.getEndTime() - hitObject.getTime()) / 60000f; } @@ -117,13 +117,13 @@ public class Spinner implements HitObject { GameImage.SPINNER_CLEAR.getImage().drawCentered(width / 2, height / 4); int extraRotations = (int) (rotations - rotationsNeeded); if (extraRotations > 0) - score.drawSymbolNumber(extraRotations * 1000, width / 2, height * 2 / 3, 1.0f); + data.drawSymbolNumber(extraRotations * 1000, width / 2, height * 2 / 3, 1.0f); } } /** * Calculates and sends the spinner hit result. - * @return the hit result (GameScore.HIT_* constants) + * @return the hit result (GameData.HIT_* constants) */ private int hitResult() { // TODO: verify ratios @@ -132,16 +132,16 @@ public class Spinner implements HitObject { float ratio = rotations / rotationsNeeded; if (ratio >= 1.0f || GameMod.AUTO.isActive() || GameMod.SPUN_OUT.isActive()) { - result = GameScore.HIT_300; + result = GameData.HIT_300; SoundController.playSound(SoundEffect.SPINNEROSU); } else if (ratio >= 0.8f) - result = GameScore.HIT_100; + result = GameData.HIT_100; else if (ratio >= 0.5f) - result = GameScore.HIT_50; + result = GameData.HIT_50; else - result = GameScore.HIT_MISS; + result = GameData.HIT_MISS; - score.hitResult(hitObject.getEndTime(), result, width / 2, height / 2, + data.hitResult(hitObject.getEndTime(), result, width / 2, height / 2, Color.transparent, true, (byte) -1); return result; } @@ -164,12 +164,12 @@ public class Spinner implements HitObject { // spin automatically (TODO: correct rotation angles) if (GameMod.AUTO.isActive()) { // "auto" mod (fast) - score.changeHealth(delta * GameScore.HP_DRAIN_MULTIPLIER); + data.changeHealth(delta * GameData.HP_DRAIN_MULTIPLIER); rotate(delta / 20f); return false; } else if (GameMod.SPUN_OUT.isActive()) { // "spun out" mod (slow) - score.changeHealth(delta * GameScore.HP_DRAIN_MULTIPLIER); + data.changeHealth(delta * GameData.HP_DRAIN_MULTIPLIER); rotate(delta / 32f); return false; } @@ -188,7 +188,7 @@ public class Spinner implements HitObject { if (lastAngle >= 0f) { // skip initial clicks float angleDiff = Math.abs(lastAngle - angle); if (angleDiff < Math.PI / 2) { // skip huge angle changes... - score.changeHealth(delta * GameScore.HP_DRAIN_MULTIPLIER); + data.changeHealth(delta * GameData.HP_DRAIN_MULTIPLIER); rotate(angleDiff); } } @@ -207,10 +207,10 @@ public class Spinner implements HitObject { // added one whole rotation... if (Math.floor(newRotations) > rotations) { if (newRotations > rotationsNeeded) { // extra rotations - score.changeScore(1000); + data.changeScore(1000); SoundController.playSound(SoundEffect.SPINNERBONUS); } else { - score.changeScore(100); + data.changeScore(100); SoundController.playSound(SoundEffect.SPINNERSPIN); } } diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index a3c48af6..6011946c 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -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; } diff --git a/src/itdelatrisu/opsu/states/GameRanking.java b/src/itdelatrisu/opsu/states/GameRanking.java index d39b42ea..752949b0 100644 --- a/src/itdelatrisu/opsu/states/GameRanking.java +++ b/src/itdelatrisu/opsu/states/GameRanking.java @@ -20,7 +20,7 @@ package itdelatrisu.opsu.states; 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.OsuFile; @@ -50,8 +50,8 @@ import org.newdawn.slick.state.transition.FadeOutTransition; * */ public class GameRanking extends BasicGameState { - /** Associated GameScore object. */ - private GameScore score; + /** Associated GameData object. */ + private GameData data; /** "Retry" and "Exit" buttons. */ private MenuButton retryButton, exitButton; @@ -100,7 +100,7 @@ public class GameRanking extends BasicGameState { g.setBackground(Utils.COLOR_BLACK_ALPHA); // ranking screen elements - score.drawRankingElements(g, width, height); + data.drawRankingElements(g, width, height); // game mods for (GameMod mod : GameMod.VALUES_REVERSED) { @@ -196,10 +196,10 @@ public class GameRanking extends BasicGameState { } /** - * Sets the associated GameScore object. - * @param score the GameScore + * Sets the associated GameData object. + * @param data the GameData */ - public void setGameScore(GameScore score) { - this.score = score; + public void setGameData(GameData data) { + this.data = data; } }