ReplayTest
Seems to work but still buggy lots of flickering during replay
This commit is contained in:
@@ -132,11 +132,10 @@ public class Circle implements HitObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int x, int y) {
|
||||
public boolean mousePressed(int x, int y, int trackPosition) {
|
||||
double distance = Math.hypot(this.x - x, this.y - y);
|
||||
int circleRadius = GameImage.HITCIRCLE.getImage().getWidth() / 2;
|
||||
if (distance < circleRadius) {
|
||||
int trackPosition = MusicController.getPosition();
|
||||
int timeDiff = trackPosition - hitObject.getTime();
|
||||
int result = hitResult(timeDiff);
|
||||
|
||||
@@ -150,10 +149,9 @@ public class Circle implements HitObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed) {
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed, int trackPosition) {
|
||||
int time = hitObject.getTime();
|
||||
|
||||
int trackPosition = MusicController.getPosition();
|
||||
int[] hitResultOffset = game.getHitResultOffsets();
|
||||
boolean isAutoMod = GameMod.AUTO.isActive();
|
||||
|
||||
@@ -176,7 +174,7 @@ public class Circle implements HitObject {
|
||||
|
||||
// "relax" mod: click automatically
|
||||
else if (GameMod.RELAX.isActive() && trackPosition >= time)
|
||||
return mousePressed(mouseX, mouseY);
|
||||
return mousePressed(mouseX, mouseY, trackPosition);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,15 +38,17 @@ public interface HitObject {
|
||||
* @param mouseX the x coordinate of the mouse
|
||||
* @param mouseY the y coordinate of the mouse
|
||||
* @param keyPressed whether or not a game key is currently pressed
|
||||
* @param trackPosition TODO
|
||||
* @return true if object ended
|
||||
*/
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed);
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed, int trackPosition);
|
||||
|
||||
/**
|
||||
* Processes a mouse click.
|
||||
* @param x the x coordinate of the mouse
|
||||
* @param y the y coordinate of the mouse
|
||||
* @param trackPosition TODO
|
||||
* @return true if a hit result was processed
|
||||
*/
|
||||
public boolean mousePressed(int x, int y);
|
||||
public boolean mousePressed(int x, int y, int trackPosition);
|
||||
}
|
||||
|
||||
@@ -267,14 +267,13 @@ public class Slider implements HitObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int x, int y) {
|
||||
public boolean mousePressed(int x, int y, int trackPosition) {
|
||||
if (sliderClickedInitial) // first circle already processed
|
||||
return false;
|
||||
|
||||
double distance = Math.hypot(this.x - x, this.y - y);
|
||||
int circleRadius = GameImage.HITCIRCLE.getImage().getWidth() / 2;
|
||||
if (distance < circleRadius) {
|
||||
int trackPosition = MusicController.getPosition();
|
||||
int timeDiff = Math.abs(trackPosition - hitObject.getTime());
|
||||
int[] hitResultOffset = game.getHitResultOffsets();
|
||||
|
||||
@@ -297,7 +296,7 @@ public class Slider implements HitObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed) {
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed, int trackPosition) {
|
||||
int repeatCount = hitObject.getRepeatCount();
|
||||
|
||||
// slider time and tick calculations
|
||||
@@ -318,7 +317,6 @@ public class Slider implements HitObject {
|
||||
}
|
||||
}
|
||||
|
||||
int trackPosition = MusicController.getPosition();
|
||||
int[] hitResultOffset = game.getHitResultOffsets();
|
||||
boolean isAutoMod = GameMod.AUTO.isActive();
|
||||
|
||||
@@ -346,7 +344,7 @@ public class Slider implements HitObject {
|
||||
|
||||
// "relax" mod: click automatically
|
||||
else if (GameMod.RELAX.isActive() && trackPosition >= time)
|
||||
mousePressed(mouseX, mouseY);
|
||||
mousePressed(mouseX, mouseY, trackPosition);
|
||||
}
|
||||
|
||||
// end of slider
|
||||
|
||||
@@ -191,11 +191,10 @@ public class Spinner implements HitObject {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int x, int y) { return false; } // not used
|
||||
public boolean mousePressed(int x, int y, int trackPosition) { return false; } // not used
|
||||
|
||||
@Override
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed) {
|
||||
int trackPosition = MusicController.getPosition();
|
||||
public boolean update(boolean overlap, int delta, int mouseX, int mouseY, boolean keyPressed, int trackPosition) {
|
||||
|
||||
// end of spinner
|
||||
if (overlap || trackPosition > hitObject.getEndTime()) {
|
||||
|
||||
Reference in New Issue
Block a user