Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions src/itdelatrisu/opsu/GameData.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,13 @@ public HitObjectResult(int time, int result, float x, float y, Color color,
/** Container dimensions. */
private int width, height;

/** Statistics for Hit Error Difference */
int totalDiff;
int totalAbsDiff; //Absolute
int totalPosDiff; //Positive only
int totalNegDiff; //Negative only
int totalDiffCnt, totalNegCnt, totalPosCnt; //Count

/**
* Constructor for gameplay.
* @param width container width
Expand Down Expand Up @@ -401,6 +408,15 @@ public void clear() {
comboEnd = 0;
comboBurstIndex = -1;
scoreData = null;

totalDiff = 0;
totalAbsDiff = 0;
totalDiffCnt = 0;

totalPosDiff = 0;
totalNegDiff = 0;
totalPosCnt = 0;
totalNegCnt = 0;
}

/**
Expand Down Expand Up @@ -697,6 +713,19 @@ public void drawGameElements(Graphics g, boolean breakPeriod, boolean firstObjec
g.fillRect((hitErrorX + info.timeDiff - 1) * uiScale, tickY, tickWidth, tickHeight);
}
}

//hit Diff data
Fonts.drawBorderedString(Fonts.MEDIUM,
width * 0.80f, height * 0.850f - Fonts.MEDIUM.getLineHeight() ,
String.format("Avg Diff %.3f.",
(totalDiff/(float)totalDiffCnt)
), Color.white, Color.black);
Fonts.drawBorderedString(Fonts.MEDIUM,
width * 0.80f, height * 0.850f ,
String.format("Avg AbsDiff %.3f.",
(totalAbsDiff/(float)totalDiffCnt)
), Color.white, Color.black);


if (!breakPeriod && !relaxAutoPilot) {
// scorebar
Expand Down Expand Up @@ -826,6 +855,22 @@ scoreTextScale, getScoreSymbolImage('0').getWidth() * scoreTextScale - 2, false
GameImage.RANKING_MAXCOMBO.getImage().draw(10 * uiScale, textY * uiScale);
GameImage.RANKING_ACCURACY.getImage().draw(accuracyX * uiScale, textY * uiScale);

//hit Diff data
Fonts.MEDIUM.drawString(
width * 0.20f, height * 0.850f - Fonts.MEDIUM.getLineHeight() ,
String.format("Avg Diff %.3f.",
(totalDiff/(float)totalDiffCnt)
), Color.white);
Fonts.MEDIUM.drawString(
width * 0.20f, height * 0.850f ,
String.format("Avg Abs Diff %.3f. [%d %.3f %d %.3f ]",
(totalAbsDiff/(float)totalDiffCnt),
totalPosCnt,
(totalPosDiff/(float)totalPosCnt),
totalNegCnt,
(totalNegDiff/(float)totalNegCnt)
), Color.white);

// full combo
if (comboMax == fullObjectCount) {
GameImage.RANKING_PERFECT.getImage().draw(
Expand Down Expand Up @@ -1487,6 +1532,31 @@ public Replay getReplay(ReplayFrame[] frames, Beatmap beatmap) {
* @param timeDiff the difference between the correct and actual hit times
*/
public void addHitError(int time, int x, int y, int timeDiff) {
if (Math.abs(timeDiff) <= hitResultOffset[GameData.HIT_50]){
totalDiff += timeDiff;
totalAbsDiff += Math.abs(timeDiff);
if(timeDiff>0){
totalPosDiff+=timeDiff;
totalPosCnt++;
}else if(timeDiff<0){
totalNegDiff+=timeDiff;
totalNegCnt++;
}
totalDiffCnt += 1;
}
hitErrorList.addFirst(new HitErrorInfo(time, x, y, timeDiff));
}
public String dataInfo(){
String t = "";
Beatmap osu= MusicController.getBeatmap();
t+=osu.audioFilename+"" +osu.audioLeadIn+" "+osu.file.getAbsolutePath()+"\n";
t+="GameData: avg offset :"+ (totalDiff/(float)totalDiffCnt)
+" abs:"+ (totalAbsDiff/(float)totalDiffCnt)
+" total:"+totalDiffCnt
+" pos:"+ (totalPosDiff/(float)totalPosCnt)+" "+totalPosCnt
+" neg:"+ (totalNegDiff/(float)totalNegCnt)+" "+totalNegCnt
+" musOff:"+Options.getMusicOffset()
+"\n";
return t;
}
}
2 changes: 1 addition & 1 deletion src/itdelatrisu/opsu/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public void drag(GameContainer container, int d) {
},
EFFECT_VOLUME ("Effect Volume", "VolumeEffect", "Volume of menu and game sounds.", 70, 0, 100),
HITSOUND_VOLUME ("Hit Sound Volume", "VolumeHitSound", "Volume of hit sounds.", 30, 0, 100),
MUSIC_OFFSET ("Music Offset", "Offset", "Adjust this value if hit objects are out of sync.", -75, -500, 500) {
MUSIC_OFFSET ("Music Offset", "Offset", "Adjust this value if hit objects are out of sync.", -100, -500, 500) {
@Override
public String getValueString() { return String.format("%dms", val); }
},
Expand Down
2 changes: 1 addition & 1 deletion src/itdelatrisu/opsu/beatmap/Beatmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void eldestRemoved(Map.Entry<File, ImageLoader> eldest) {
public static void clearBackgroundImageCache() { bgImageCache.clear(); }

/** The OSU File object associated with this beatmap. */
private File file;
public final File file;

/** MD5 hash of this file. */
public String md5Hash;
Expand Down
3 changes: 3 additions & 0 deletions src/itdelatrisu/opsu/states/GameRanking.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ public void enter(GameContainer container, StateBasedGame game)
SoundController.playSound(SoundEffect.APPLAUSE);
retryButton.resetHover();
replayButton.setY(!GameMod.AUTO.isActive() ? replayY : retryY);
Log.warn(data.dataInfo());
//System.out.println(data.dataInfo());
}
replayButton.resetHover();

}

@Override
Expand Down
20 changes: 20 additions & 0 deletions src/itdelatrisu/opsu/ui/Fonts.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.HashSet;
import java.util.List;

import org.newdawn.slick.Color;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.UnicodeFont;
import org.newdawn.slick.font.effects.ColorEffect;
Expand Down Expand Up @@ -153,4 +154,23 @@ public static List<String> wrap(org.newdawn.slick.Font font, String text, int wi
list.add(str);
return list;
}

/**
* Draws the string with a pixel border
* @param font the Font
* @param x x Location
* @param y y Location
* @param str string to display
* @param fg foreground Color
* @param bg background Color
*/
public static void drawBorderedString(org.newdawn.slick.Font font, float x, float y, String str, Color fg, Color bg) {
font.drawString(x+1, y+1 ,str, bg);
font.drawString(x+1, y-1 ,str, bg);
font.drawString(x-1, y+1 ,str, bg);
font.drawString(x-1, y-1 ,str, bg);

font.drawString(x, y ,str, fg);
font.drawString(x, y ,str, fg);
}
}
Loading