Merge branch 'master' into replaystuff

This commit is contained in:
yugecin 2017-02-25 23:53:05 +01:00
commit a84786987a
3 changed files with 43 additions and 5 deletions

View File

@ -60,6 +60,8 @@ public class GameData {
/** Time, in milliseconds, for a hit circle to fade. */ /** Time, in milliseconds, for a hit circle to fade. */
public static final int HITCIRCLE_FADE_TIME = 300; public static final int HITCIRCLE_FADE_TIME = 300;
public static final int FOLLOWCIRCLE_FADE_TIME = HITCIRCLE_FADE_TIME / 2;
/** Duration, in milliseconds, of a combo pop effect. */ /** Duration, in milliseconds, of a combo pop effect. */
private static final int COMBO_POP_TIME = 250; private static final int COMBO_POP_TIME = 250;
@ -974,6 +976,17 @@ public class GameData {
Colors.WHITE_FADE.a = oldWhiteAlpha; Colors.WHITE_FADE.a = oldWhiteAlpha;
hitResult.color.a = oldColorAlpha; hitResult.color.a = oldColorAlpha;
} }
// slider follow circle
if (hitResult.expand) {
float progress = AnimationEquation.OUT_CUBIC.calc((float) Utils.clamp(trackPosition - hitResult.time, 0, FOLLOWCIRCLE_FADE_TIME) / FOLLOWCIRCLE_FADE_TIME);
float scale = 1f - 0.2f * progress;
float alpha = 1f - progress;
Image fc = GameImage.SLIDER_FOLLOWCIRCLE.getImage().getScaledCopy(scale);
fc.setAlpha(alpha);
fc.drawCentered(hitResult.x, hitResult.y);
}
if (!Options.isDrawSliderEndCircles()) { if (!Options.isDrawSliderEndCircles()) {
return; return;
} }
@ -1012,6 +1025,8 @@ public class GameData {
scaledRepeat.rotate(ang); scaledRepeat.rotate(ang);
scaledRepeat.drawCentered(hitResult.x, hitResult.y, hitResult.color); scaledRepeat.drawCentered(hitResult.x, hitResult.y, hitResult.color);
if (!Options.isDrawSliderEndCircles()) { if (!Options.isDrawSliderEndCircles()) {
GameImage.HITCIRCLE.getImage().draw(-1000, -1000); // TODO this 'fixes' #114. Why? Get a better solution!
GameImage.HITCIRCLE_OVERLAY.getImage().draw(-1000, -1000);
return; return;
} }
} }

View File

@ -33,7 +33,6 @@ import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.animations.AnimationEquation; import itdelatrisu.opsu.ui.animations.AnimationEquation;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics; import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image; import org.newdawn.slick.Image;
import yugecin.opsudance.Dancer; import yugecin.opsudance.Dancer;
@ -110,8 +109,12 @@ public class Slider extends GameObject {
/** The current tick time for the follow circle expanding animation. */ /** The current tick time for the follow circle expanding animation. */
private int tickExpandTime = 0; private int tickExpandTime = 0;
private int followExpandTime = 0;
/** The duration of the follow circle expanding animation on ticks. */ /** The duration of the follow circle expanding animation on ticks. */
private static final int TICK_EXPAND_TIME = 200; private static final int TICK_EXPAND_TIME = 200;
private static final int FOLLOW_EXPAND_TIME = 150;
private static final int FOLLOW_SHRINK_TIME = 100;
/** Container dimensions. */ /** Container dimensions. */
private static int containerWidth, containerHeight; private static int containerWidth, containerHeight;
@ -366,9 +369,25 @@ public class Slider extends GameObject {
} }
// follow circle // follow circle
if (followCircleActive) { if (followCircleActive || followExpandTime > 0) {
float followCircleScale = 1f + (tickExpandTime / (float) TICK_EXPAND_TIME) * 0.1f; float followCircleScale = 1f + (tickExpandTime / (float) TICK_EXPAND_TIME) * 0.1f;
GameImage.SLIDER_FOLLOWCIRCLE.getImage().getScaledCopy(followCircleScale).drawCentered(c.x, c.y); float followAlpha = 1f;
if (followCircleActive && followExpandTime < FOLLOW_EXPAND_TIME) {
followExpandTime += DisplayContainer.instance.renderDelta;
followCircleScale *= 0.5f;
float progress = AnimationEquation.OUT_QUAD.calc((float) followExpandTime / FOLLOW_EXPAND_TIME);
followCircleScale = followCircleScale + followCircleScale * progress;
followAlpha = progress;
} else if (!followCircleActive) {
followExpandTime -= DisplayContainer.instance.renderDelta;
if (followExpandTime > FOLLOW_SHRINK_TIME) {
followExpandTime = FOLLOW_SHRINK_TIME;
}
float progress = 1f - AnimationEquation.IN_QUAD.calc((float) followExpandTime / FOLLOW_EXPAND_TIME);
followCircleScale *= progress;
followAlpha = progress;
}
GameImage.SLIDER_FOLLOWCIRCLE.getImage().getScaledCopy(followCircleScale).setAlpha(followAlpha).drawCentered(c.x, c.y);
// "flashlight" mod: dim the screen // "flashlight" mod: dim the screen
if (GameMod.FLASHLIGHT.isActive()) { if (GameMod.FLASHLIGHT.isActive()) {
@ -716,7 +735,10 @@ public class Slider extends GameObject {
double distance = Math.hypot(c.x - mouseX, c.y - mouseY); double distance = Math.hypot(c.x - mouseX, c.y - mouseY);
if (((keyPressed || GameMod.RELAX.isActive()) && distance < followRadius) || isAutoMod) { if (((keyPressed || GameMod.RELAX.isActive()) && distance < followRadius) || isAutoMod) {
// mouse pressed and within follow circle // mouse pressed and within follow circle
if (!followCircleActive) {
followCircleActive = true; followCircleActive = true;
followExpandTime = 0;
}
// held during new repeat // held during new repeat
if (isNewRepeat) { if (isNewRepeat) {

View File

@ -981,8 +981,9 @@ public class Image implements Renderable {
* *
* @param alpha The alpha value to use when rendering this image * @param alpha The alpha value to use when rendering this image
*/ */
public void setAlpha(float alpha) { public Image setAlpha(float alpha) {
this.alpha = alpha; this.alpha = alpha;
return this;
} }
/** /**