Follow-up to #99.

- Many code style changes.
- Don't increment combo if missing the last slider circle.
- Added player name in ranking screen.
- Don't show null/default player names.
- Only import replays with .osr extension.
- Display loading status for importing replays.
- Moved MD5InputStreamWrapper to package "opsu.io".

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-06-29 19:22:38 -05:00
parent 7d08a7d391
commit d860a30aed
29 changed files with 513 additions and 426 deletions

View File

@@ -41,7 +41,6 @@ import org.lwjgl.openal.OpenALException;
import org.newdawn.slick.util.Log;
import org.newdawn.slick.util.ResourceLoader;
/**
* A generic tool to work on a supplied stream, pulling out PCM data and buffered it to OpenAL
* as required.
@@ -356,7 +355,7 @@ public class OpenALStreamPlayer {
}
playedPos = streamPos;
syncStartTime = (long) (getTime() - (playedPos * 1000 / sampleSize / sampleRate)/pitch);
syncStartTime = (long) (getTime() - (playedPos * 1000 / sampleSize / sampleRate) / pitch);
startPlayback();
@@ -409,28 +408,30 @@ public class OpenALStreamPlayer {
// hard reset
if (Math.abs(thisPosition - dxTime / 1000f) > 1 / 2f) {
//System.out.println("Time HARD Reset"+" "+thisPosition+" "+(dxTime / 1000f));
syncPosition();
dxTime = (thisTime - syncStartTime) * pitch;
avgDiff = 0;
}
if ((int) (dxPosition * 1000) != 0) { // lastPosition != thisPosition
float diff = thisPosition * 1000 - (dxTime);
avgDiff = (diff + avgDiff * 9) / 10;
if(Math.abs(avgDiff) >= 1){
syncStartTime -= (int)(avgDiff);
avgDiff -= (int)(avgDiff);
if (Math.abs(avgDiff) >= 1) {
syncStartTime -= (int) (avgDiff);
avgDiff -= (int) (avgDiff);
dxTime = (thisTime - syncStartTime) * pitch;
}
lastUpdatePosition = thisPosition;
}
return dxTime / 1000f;
}
private void syncPosition(){
syncStartTime = getTime() - (long) ( getALPosition() * 1000 / pitch);
/**
* Synchronizes the track position.
*/
private void syncPosition() {
syncStartTime = getTime() - (long) (getALPosition() * 1000 / pitch);
avgDiff = 0;
}