attempt to keep track of scoring for each player

This commit is contained in:
yugecin
2017-12-21 22:43:42 +01:00
parent 5704ebb0c1
commit 35769b31c7
9 changed files with 167 additions and 6 deletions

View File

@@ -170,7 +170,7 @@ public class GameData {
HIT_ANIMATION_RESULT = 12; // not a hit result
/** Hit result-related images (indexed by HIT_* constants to HIT_MAX). */
private Image[] hitResults;
protected Image[] hitResults;
/** Counts of each hit result so far (indexed by HIT_* constants to HIT_MAX). */
private int[] hitResultCount;
@@ -1409,7 +1409,7 @@ public class GameData {
* @param noIncrementCombo if the combo should not be incremented by this result
* @return the actual hit result (HIT_* constants)
*/
private int handleHitResult(int time, int result, float x, float y, Color color, boolean end,
protected int handleHitResult(int time, int result, float x, float y, Color color, boolean end,
HitObject hitObject, HitObjectType hitResultType, int repeat, boolean noIncrementCombo) {
// update health, score, and combo streak based on hit result
int hitValue = 0;

View File

@@ -83,6 +83,11 @@ public class Circle extends GameObject {
super.updateStartEndPositions(time);
}
@Override
public GameObject clone(GameData data) {
return new Circle(hitObject, game, data, comboColorIndex, comboEnd);
}
@Override
public void draw(Graphics g, int trackPosition, boolean mirror) {
Color orig = color;

View File

@@ -18,6 +18,7 @@
package itdelatrisu.opsu.objects;
import itdelatrisu.opsu.GameData;
import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.objects.curves.Vec2f;
@@ -29,7 +30,7 @@ import org.newdawn.slick.Graphics;
*/
public class DummyObject extends GameObject {
/** The associated HitObject. */
private HitObject hitObject;
public final HitObject hitObject;
/** The scaled starting x, y coordinates. */
private float x, y;
@@ -49,6 +50,11 @@ public class DummyObject extends GameObject {
updateStartEndPositions(0);
}
@Override
public GameObject clone(GameData a) {
return new DummyObject(this.hitObject);
}
@Override
public void draw(Graphics g, int trackPosition, boolean mirror) {}

View File

@@ -18,6 +18,7 @@
package itdelatrisu.opsu.objects;
import itdelatrisu.opsu.GameData;
import itdelatrisu.opsu.objects.curves.Vec2f;
import org.newdawn.slick.Color;
@@ -114,4 +115,6 @@ public abstract class GameObject {
return hue;
}
public abstract GameObject clone(GameData data);
}

View File

@@ -189,6 +189,11 @@ public class Slider extends GameObject {
repeats = hitObject.getRepeatCount();
}
@Override
public GameObject clone(GameData data) {
return new Slider(hitObject, game, data, comboColorIndex, comboEnd);
}
@Override
public void draw(Graphics g, int trackPosition, boolean mirror) {
if (trackPosition > getEndTime()) {

View File

@@ -173,6 +173,11 @@ public class Spinner extends GameObject {
rotationsNeeded = spinsPerMinute * (hitObject.getEndTime() - hitObject.getTime()) / 60000f;
}
@Override
public GameObject clone(GameData data) {
return new Spinner(hitObject, game, data);
}
@Override
public void draw(Graphics g, int trackPosition, boolean mirror) {
if (mirror) {

View File

@@ -726,7 +726,7 @@ public class Game extends ComplexOpsuState {
g.setColor(Color.black);
g.fillRect(ReplayPlayback.SQSIZE * 2, 0, ReplayPlayback.SQSIZE * 2, displayContainer.height);
for (ReplayPlayback replayPlayback : replays) {
replayPlayback.render(displayContainer.renderDelta, g, i++, trackPosition);
replayPlayback.render(beatmap, hitResultOffset, displayContainer.renderDelta, g, i++, trackPosition);
}
super.render(g);
@@ -1718,6 +1718,14 @@ public class Game extends ComplexOpsuState {
}
}
for (ReplayPlayback replayPlayback : replays) {
GameObject[] objs = new GameObject[gameObjects.length];
for (int i = 0; i < objs.length; i++) {
objs[i] = gameObjects[i].clone(replayPlayback.new GData());
}
replayPlayback.setGameObjects(objs);
}
Dancer.instance.setGameObjects(gameObjects);
storyboardOverlay.setGameObjects(gameObjects);
if (!skippedToCheckpoint) {