Store raw hit object coordinates instead of scaled ones.

Fixes a bug where a resolution change (by restarting through the app) wouldn't re-scale hit object coordinates.  Scaled coordinates are now stored in HitObject fields.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-03-12 20:12:43 -04:00
parent 3bd9bbdafd
commit 49c85b3b08
7 changed files with 104 additions and 64 deletions

View File

@@ -275,8 +275,8 @@ public class Replay {
for (int i = 0; i < frames.length; i++) {
ReplayFrame frame = frames[i];
sb.append(String.format("%d|%s|%s|%d,",
frame.getTimeDiff(), nf.format(frame.getRawX()),
nf.format(frame.getRawY()), frame.getKeys()));
frame.getTimeDiff(), nf.format(frame.getX()),
nf.format(frame.getY()), frame.getKeys()));
}
sb.append(String.format("%s|0|0|%d", SEED_STRING, seed));

View File

@@ -85,25 +85,25 @@ public class ReplayFrame {
*/
public void setTimeDiff(int diff) { this.timeDiff = diff; }
/**
* Returns the scaled cursor x coordinate.
*/
public int getX() { return (int) (x * OsuHitObject.getXMultiplier() + OsuHitObject.getXOffset()); }
/**
* Returns the scaled cursor y coordinate.
*/
public int getY() { return (int) (y * OsuHitObject.getYMultiplier() + OsuHitObject.getYOffset()); }
/**
* Returns the raw cursor x coordinate.
*/
public float getRawX() { return x; }
public float getX() { return x; }
/**
* Returns the raw cursor y coordinate.
*/
public float getRawY() { return y; }
public float getY() { return y; }
/**
* Returns the scaled cursor x coordinate.
*/
public int getScaledX() { return (int) (x * OsuHitObject.getXMultiplier() + OsuHitObject.getXOffset()); }
/**
* Returns the scaled cursor y coordinate.
*/
public int getScaledY() { return (int) (y * OsuHitObject.getYMultiplier() + OsuHitObject.getYOffset()); }
/**
* Returns the keys pressed (KEY_* bitmask).