Fixed "Hidden" mod timing issues. (fixes #121)

This introduces more accurate timing formulas associated with the "Hidden" mod (previously, in #115, these values were hardcoded).  The values seem somewhat close to the values in osu!, but were not extensively tested.

Also set an upper bound on the fade in time for hit objects proportional to the approach time, or else the timing values in the "Hidden" mod would be too inconsistent.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-08-28 21:12:47 -05:00
parent c4f54ecc05
commit 34c7942f4b
4 changed files with 80 additions and 50 deletions

View File

@@ -36,9 +36,6 @@ import org.newdawn.slick.Graphics;
* Data type representing a circle object.
*/
public class Circle implements GameObject {
/** The amount of time, in milliseconds, to fade in the circle. */
private static final int FADE_IN_TIME = 375;
/** The diameter of hit circles. */
private static float diameter;
@@ -94,15 +91,20 @@ public class Circle implements GameObject {
@Override
public void draw(Graphics g, int trackPosition) {
int timeDiff = hitObject.getTime() - trackPosition;
float scale = timeDiff / (float) game.getApproachTime();
float fadeinScale = (timeDiff - game.getApproachTime() + FADE_IN_TIME) / (float) FADE_IN_TIME;
final int approachTime = game.getApproachTime();
final int fadeInTime = game.getFadeInTime();
float scale = timeDiff / (float) approachTime;
float approachScale = 1 + scale * 3;
float fadeinScale = (timeDiff - approachTime + fadeInTime) / (float) fadeInTime;
float alpha = Utils.clamp(1 - fadeinScale, 0, 1);
if (GameMod.HIDDEN.isActive()) {
float fadeOutScale = -(float)(timeDiff-game.getApproachTime())/game.getDecayTime();
float fadeOutAlpha = Utils.clamp(1-fadeOutScale, 0, 1);
alpha = Math.min(alpha, fadeOutAlpha);
final int hiddenDecayTime = game.getHiddenDecayTime();
final int hiddenTimeDiff = game.getHiddenTimeDiff();
if (fadeinScale <= 0f && timeDiff < hiddenTimeDiff + hiddenDecayTime) {
float hiddenAlpha = (timeDiff < hiddenTimeDiff) ? 0f : (timeDiff - hiddenTimeDiff) / (float) hiddenDecayTime;
alpha = Math.min(alpha, hiddenAlpha);
}
}
float oldAlpha = Colors.WHITE_FADE.a;

View File

@@ -57,9 +57,6 @@ public class Slider implements GameObject {
/** The diameter of hit circles. */
private static float diameter;
/** The amount of time, in milliseconds, to fade in the slider. */
private static final int FADE_IN_TIME = 375;
/** The associated HitObject. */
private HitObject hitObject;
@@ -179,9 +176,11 @@ public class Slider implements GameObject {
@Override
public void draw(Graphics g, int trackPosition) {
int timeDiff = hitObject.getTime() - trackPosition;
float scale = timeDiff / (float) game.getApproachTime();
float fadeinScale = (timeDiff - game.getApproachTime() + FADE_IN_TIME) / (float) FADE_IN_TIME;
final int approachTime = game.getApproachTime();
final int fadeInTime = game.getFadeInTime();
float scale = timeDiff / (float) approachTime;
float approachScale = 1 + scale * 3;
float fadeinScale = (timeDiff - approachTime + fadeInTime) / (float) fadeInTime;
float alpha = Utils.clamp(1 - fadeinScale, 0, 1);
boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber();
@@ -212,9 +211,12 @@ public class Slider implements GameObject {
}
}
if (GameMod.HIDDEN.isActive()) {
float fadeOutScale = -(float) (timeDiff - game.getApproachTime()) / game.getDecayTime();
float fadeOutAlpha = Utils.clamp(1 - fadeOutScale, 0, 1);
alpha = Math.min(alpha, fadeOutAlpha);
final int hiddenDecayTime = game.getHiddenDecayTime();
final int hiddenTimeDiff = game.getHiddenTimeDiff();
if (fadeinScale <= 0f && timeDiff < hiddenTimeDiff + hiddenDecayTime) {
float hiddenAlpha = (timeDiff < hiddenTimeDiff) ? 0f : (timeDiff - hiddenTimeDiff) / (float) hiddenDecayTime;
alpha = Math.min(alpha, hiddenAlpha);
}
}
if (sliderClickedInitial)
; // don't draw current combo number if already clicked

View File

@@ -51,9 +51,6 @@ public class Spinner implements GameObject {
/** The amount of time, in milliseconds, before another velocity is stored. */
private static final float DELTA_UPDATE_TIME = 1000 / 60f;
/** The amount of time, in milliseconds, to fade in the spinner. */
private static final int FADE_IN_TIME = 500;
/** Angle mod multipliers: "auto" (477rpm), "spun out" (287rpm) */
private static final float
AUTO_MULTIPLIER = 1 / 20f, // angle = 477/60f * delta/1000f * TWO_PI;
@@ -70,6 +67,9 @@ public class Spinner implements GameObject {
/** The associated HitObject. */
private HitObject hitObject;
/** The associated Game object. */
private Game game;
/** The associated GameData object. */
private GameData data;
@@ -125,6 +125,7 @@ public class Spinner implements GameObject {
*/
public Spinner(HitObject hitObject, Game game, GameData data) {
this.hitObject = hitObject;
this.game = game;
this.data = data;
/*
@@ -176,11 +177,12 @@ public class Spinner implements GameObject {
public void draw(Graphics g, int trackPosition) {
// only draw spinners shortly before start time
int timeDiff = hitObject.getTime() - trackPosition;
if (timeDiff - FADE_IN_TIME > 0)
final int fadeInTime = game.getFadeInTime();
if (timeDiff - fadeInTime > 0)
return;
boolean spinnerComplete = (rotations >= rotationsNeeded);
float alpha = Utils.clamp(1 - (float) timeDiff / FADE_IN_TIME, 0f, 1f);
float alpha = Utils.clamp(1 - (float) timeDiff / fadeInTime, 0f, 1f);
// darken screen
if (Options.getSkin().isSpinnerFadePlayfield()) {