post merge stuff

This commit is contained in:
yugecin 2016-12-24 14:35:36 +01:00
parent a6540044b6
commit 20194d58b3
7 changed files with 77 additions and 43 deletions

View File

@ -43,6 +43,8 @@ public class Container extends AppGameContainer {
/** Exception causing game failure. */ /** Exception causing game failure. */
protected Exception e = null; protected Exception e = null;
public static Container instance;
/** /**
* Create a new container wrapping a game * Create a new container wrapping a game
* *
@ -51,6 +53,7 @@ public class Container extends AppGameContainer {
*/ */
public Container(Game game) throws SlickException { public Container(Game game) throws SlickException {
super(game); super(game);
instance = this;
} }
/** /**

View File

@ -152,7 +152,8 @@ public class GameData {
HIT_SLIDER30 = 8, HIT_SLIDER30 = 8,
HIT_MAX = 9, // not a hit result HIT_MAX = 9, // not a hit result
HIT_SLIDER_REPEAT = 10, // not a hit result HIT_SLIDER_REPEAT = 10, // not a hit result
HIT_ANIMATION_RESULT = 11; // not a hit result HIT_SLIDER_REPEAT_M = 11, // not a hit result
HIT_ANIMATION_RESULT = 12; // not a hit result
/** Hit result-related images (indexed by HIT_* constants to HIT_MAX). */ /** Hit result-related images (indexed by HIT_* constants to HIT_MAX). */
private Image[] hitResults; private Image[] hitResults;
@ -953,16 +954,21 @@ public class GameData {
*/ */
private void drawHitAnimations(HitObjectResult hitResult, int trackPosition) { private void drawHitAnimations(HitObjectResult hitResult, int trackPosition) {
// fade out slider curve // fade out slider curve
if (hitResult.result != HIT_SLIDER_REPEAT && hitResult.curve != null) { if (hitResult.result != HIT_SLIDER_REPEAT && hitResult.result != HIT_SLIDER_REPEAT_M && hitResult.curve != null) {
float progress = AnimationEquation.OUT_CUBIC.calc( if (!Options.isShrinkingSliders()) {
(float) Utils.clamp(trackPosition - hitResult.time, 0, HITCIRCLE_FADE_TIME) / HITCIRCLE_FADE_TIME); float progress = AnimationEquation.OUT_CUBIC.calc(
float alpha = 1f - progress; (float) Utils.clamp(trackPosition - hitResult.time, 0, HITCIRCLE_FADE_TIME) / HITCIRCLE_FADE_TIME);
float oldWhiteAlpha = Colors.WHITE_FADE.a; float alpha = 1f - progress;
float oldColorAlpha = hitResult.color.a; float oldWhiteAlpha = Colors.WHITE_FADE.a;
Colors.WHITE_FADE.a = hitResult.color.a = alpha; float oldColorAlpha = hitResult.color.a;
hitResult.curve.draw(hitResult.color); Colors.WHITE_FADE.a = hitResult.color.a = alpha;
Colors.WHITE_FADE.a = oldWhiteAlpha; hitResult.curve.draw(hitResult.color);
hitResult.color.a = oldColorAlpha; Colors.WHITE_FADE.a = oldWhiteAlpha;
hitResult.color.a = oldColorAlpha;
}
if (!Options.isDrawSliderEndCircles()) {
return;
}
} }
// miss, don't draw an animation // miss, don't draw an animation
@ -982,7 +988,7 @@ public class GameData {
(float) Utils.clamp(trackPosition - hitResult.time, 0, HITCIRCLE_FADE_TIME) / HITCIRCLE_FADE_TIME); (float) Utils.clamp(trackPosition - hitResult.time, 0, HITCIRCLE_FADE_TIME) / HITCIRCLE_FADE_TIME);
float scale = (!hitResult.expand) ? 1f : 1f + (HITCIRCLE_ANIM_SCALE - 1f) * progress; float scale = (!hitResult.expand) ? 1f : 1f + (HITCIRCLE_ANIM_SCALE - 1f) * progress;
float alpha = 1f - progress; float alpha = 1f - progress;
if (hitResult.result == HIT_SLIDER_REPEAT) { if (hitResult.result == HIT_SLIDER_REPEAT || hitResult.result == HIT_SLIDER_REPEAT_M) {
// repeats // repeats
Image scaledRepeat = GameImage.REVERSEARROW.getImage().getScaledCopy(scale); Image scaledRepeat = GameImage.REVERSEARROW.getImage().getScaledCopy(scale);
scaledRepeat.setAlpha(alpha); scaledRepeat.setAlpha(alpha);
@ -992,8 +998,14 @@ public class GameData {
} else { } else {
ang = hitResult.curve.getEndAngle(); ang = hitResult.curve.getEndAngle();
} }
if (hitResult.result == HIT_SLIDER_REPEAT_M) {
ang += 180f;
}
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()) {
return;
}
} }
Image scaledHitCircle = GameImage.HITCIRCLE.getImage().getScaledCopy(scale); Image scaledHitCircle = GameImage.HITCIRCLE.getImage().getScaledCopy(scale);
Image scaledHitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(scale); Image scaledHitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(scale);
@ -1246,7 +1258,7 @@ public class GameData {
return; return;
} }
float[] m = Utils.mirrorPoint(x, y); float[] m = Utils.mirrorPoint(x, y);
hitResultList.add(new HitObjectResult(time, HIT_SLIDER_REPEAT, m[0], m[1], color, type, curve, true, true)); hitResultList.add(new HitObjectResult(time, HIT_SLIDER_REPEAT_M, m[0], m[1], color, type, curve, true, true));
} }
/** /**
@ -1259,6 +1271,11 @@ public class GameData {
*/ */
public void sendSliderStartResult(int time, float x, float y, Color color, boolean expand) { public void sendSliderStartResult(int time, float x, float y, Color color, boolean expand) {
hitResultList.add(new HitObjectResult(time, HIT_ANIMATION_RESULT, x, y, color, HitObjectType.CIRCLE, null, expand, true)); hitResultList.add(new HitObjectResult(time, HIT_ANIMATION_RESULT, x, y, color, HitObjectType.CIRCLE, null, expand, true));
if (!Options.isMirror()) {
return;
}
float[] m = Utils.mirrorPoint(x, y);
hitResultList.add(new HitObjectResult(time, HIT_ANIMATION_RESULT, m[0], m[1], color, HitObjectType.CIRCLE, null, expand, true));
} }
/** /**
@ -1451,10 +1468,10 @@ public class GameData {
* @param curve the slider curve (or null if not applicable) * @param curve the slider curve (or null if not applicable)
* @param sliderHeldToEnd whether or not the slider was held to the end (if applicable) * @param sliderHeldToEnd whether or not the slider was held to the end (if applicable)
*/ */
public void hitResult(int time, int result, float x, float y, Color color, public void sendHitResult(int time, int result, float x, float y, Color color,
boolean end, HitObject hitObject, HitObjectType hitResultType, boolean end, HitObject hitObject, HitObjectType hitResultType,
boolean expand, int repeat, Curve curve, boolean sliderHeldToEnd) { boolean expand, int repeat, Curve curve, boolean sliderHeldToEnd) {
hitResult(time, result, x, y, color, end, hitObject, hitResultType, expand, repeat, curve, sliderHeldToEnd, true); sendHitResult(time, result, x, y, color, end, hitObject, hitResultType, expand, repeat, curve, sliderHeldToEnd, true);
} }
/** /**
@ -1473,7 +1490,7 @@ public class GameData {
* @param sliderHeldToEnd whether or not the slider was held to the end (if applicable) * @param sliderHeldToEnd whether or not the slider was held to the end (if applicable)
* @param handleResult whether or not to send a score result * @param handleResult whether or not to send a score result
*/ */
public void hitResult(int time, int result, float x, float y, Color color, public void sendHitResult(int time, int result, float x, float y, Color color,
boolean end, HitObject hitObject, HitObjectType hitResultType, boolean end, HitObject hitObject, HitObjectType hitResultType,
boolean expand, int repeat, Curve curve, boolean sliderHeldToEnd, boolean handleResult) { boolean expand, int repeat, Curve curve, boolean sliderHeldToEnd, boolean handleResult) {
int hitResult; int hitResult;

View File

@ -541,6 +541,7 @@ public class Options {
return !FALLBACK_SLIDERS.bool; return !FALLBACK_SLIDERS.bool;
} }
}, },
DRAW_SLIDER_ENDCIRCLES ("Draw slider endcircles", "DrawSliderEndCircles", "Old slider style", false),
SHOW_HIT_LIGHTING ("Show Hit Lighting", "HitLighting", "Adds an effect behind hit explosions.", true), SHOW_HIT_LIGHTING ("Show Hit Lighting", "HitLighting", "Adds an effect behind hit explosions.", true),
SHOW_HIT_ANIMATIONS ("Show Hit Animations", "HitAnimations", "Fade out circles and curves.", true), SHOW_HIT_ANIMATIONS ("Show Hit Animations", "HitAnimations", "Fade out circles and curves.", true),
SHOW_REVERSEARROW_ANIMATIONS ("Show reverse arrow animations", "ReverseArrowAnimations", "Fade out reverse arrows after passing.", true), SHOW_REVERSEARROW_ANIMATIONS ("Show reverse arrow animations", "ReverseArrowAnimations", "Fade out reverse arrows after passing.", true),
@ -1543,6 +1544,7 @@ public class Options {
public static boolean isShrinkingSliders() { return GameOption.SHRINKING_SLIDERS.getBooleanValue(); } public static boolean isShrinkingSliders() { return GameOption.SHRINKING_SLIDERS.getBooleanValue(); }
public static boolean isMergingSliders() { return !isFallbackSliders() && GameOption.MERGING_SLIDERS.getBooleanValue(); } public static boolean isMergingSliders() { return !isFallbackSliders() && GameOption.MERGING_SLIDERS.getBooleanValue(); }
public static boolean isDrawSliderEndCircles() { return GameOption.DRAW_SLIDER_ENDCIRCLES.getBooleanValue(); }
/** /**
* Returns the fixed circle size override, if any. * Returns the fixed circle size override, if any.

View File

@ -228,16 +228,12 @@ public class Slider extends GameObject {
Math.max(0f, 1f - ((float) (trackPosition - hitObject.getTime()) / (getEndTime() - hitObject.getTime())) * 1.05f); Math.max(0f, 1f - ((float) (trackPosition - hitObject.getTime()) / (getEndTime() - hitObject.getTime())) * 1.05f);
} }
curveColor.a = curveAlpha; curveColor.a = sliderAlpha;
boolean isCurveCompletelyDrawn = drawSliderTrack(trackPosition, Utils.clamp(1d - fadeinScale, 0d, 1d)); boolean isCurveCompletelyDrawn = drawSliderTrack(trackPosition, Utils.clamp(1d - fadeinScale, 0d, 1d));
color.a = alpha; color.a = alpha;
g.pushTransform();
if (mirror) {
g.rotate(x, y, -180f);
}
// end circle (only draw if ball still has to go there) // end circle (only draw if ball still has to go there)
if (curveInterval == 1f && currentRepeats < repeatCount - (repeatCount % 2 == 0 ? 1 : 0)) { if (Options.isDrawSliderEndCircles() && isCurveCompletelyDrawn && currentRepeats < repeatCount - (repeatCount % 2 == 0 ? 1 : 0)) {
Color circleColor = new Color(color); Color circleColor = new Color(color);
Color overlayColor = new Color(Colors.WHITE_FADE); Color overlayColor = new Color(Colors.WHITE_FADE);
if (currentRepeats == 0) { if (currentRepeats == 0) {
@ -249,11 +245,16 @@ public class Slider extends GameObject {
// fade in end circle after repeats // fade in end circle after repeats
circleColor.a = overlayColor.a = sliderAlpha * getCircleAlphaAfterRepeat(trackPosition, true); circleColor.a = overlayColor.a = sliderAlpha * getCircleAlphaAfterRepeat(trackPosition, true);
} }
Vec2f endCircPos = curve.pointAt(curveInterval); Vec2f endCircPos = curve.pointAt(1f);
hitCircle.drawCentered(endCircPos.x, endCircPos.y, circleColor); hitCircle.drawCentered(endCircPos.x, endCircPos.y, circleColor);
hitCircleOverlay.drawCentered(endCircPos.x, endCircPos.y, overlayColor); hitCircleOverlay.drawCentered(endCircPos.x, endCircPos.y, overlayColor);
} }
g.pushTransform();
if (mirror) {
g.rotate(x, y, -180f);
}
// set first circle colors to fade in after repeats // set first circle colors to fade in after repeats
Color firstCircleColor = new Color(color); Color firstCircleColor = new Color(color);
Color startCircleOverlayColor = new Color(Colors.WHITE_FADE); Color startCircleOverlayColor = new Color(Colors.WHITE_FADE);
@ -263,7 +264,7 @@ public class Slider extends GameObject {
} }
// start circle, only draw if ball still has to go there // start circle, only draw if ball still has to go there
if (!sliderClickedInitial || currentRepeats < repeatCount - (repeatCount % 2 == 1 ? 1 : 0)) { if (!sliderClickedInitial || (Options.isDrawSliderEndCircles() && currentRepeats < repeatCount - (repeatCount % 2 == 1 ? 1 : 0))) {
hitCircle.drawCentered(x, y, firstCircleColor); hitCircle.drawCentered(x, y, firstCircleColor);
if (!overlayAboveNumber || sliderClickedInitial) if (!overlayAboveNumber || sliderClickedInitial)
hitCircleOverlay.drawCentered(x, y, startCircleOverlayColor); hitCircleOverlay.drawCentered(x, y, startCircleOverlayColor);
@ -572,7 +573,7 @@ public class Slider extends GameObject {
currentRepeats + 1, curve, sliderHeldToEnd); currentRepeats + 1, curve, sliderHeldToEnd);
if (Options.isMirror() && GameMod.AUTO.isActive()) { if (Options.isMirror() && GameMod.AUTO.isActive()) {
float[] m = Utils.mirrorPoint(cx, cy); float[] m = Utils.mirrorPoint(cx, cy);
data.hitResult(hitObject.getTime() + (int) sliderTimeTotal, result, data.sendHitResult(hitObject.getTime() + (int) sliderTimeTotal, result,
m[0], m[1], mirrorColor, comboEnd, hitObject, type, sliderHeldToEnd, m[0], m[1], mirrorColor, comboEnd, hitObject, type, sliderHeldToEnd,
currentRepeats + 1, curve, sliderHeldToEnd, false); currentRepeats + 1, curve, sliderHeldToEnd, false);
} }
@ -602,7 +603,6 @@ public class Slider extends GameObject {
//else not a hit //else not a hit
if (result > -1) { if (result > -1) {
data.sendInitialSliderResult(trackPosition, this.x, this.y, color, mirrorColor);
data.addHitError(hitObject.getTime(), x,y,trackPosition - hitObject.getTime()); data.addHitError(hitObject.getTime(), x,y,trackPosition - hitObject.getTime());
sliderClickedInitial = true; sliderClickedInitial = true;
data.sendSliderTickResult(hitObject.getTime(), result, this.x, this.y, hitObject, currentRepeats); data.sendSliderTickResult(hitObject.getTime(), result, this.x, this.y, hitObject, currentRepeats);

View File

@ -462,8 +462,12 @@ public class Game extends BasicGameState {
autoMousePressed = true; autoMousePressed = true;
} }
} else { } else {
// last object if (objectIndex < beatmap.objects.length) {
autoPoint = gameObjects[objectIndex - 1].getPointAt(trackPosition); autoPoint = gameObjects[objectIndex].getPointAt(trackPosition);
} else {
// last object
autoPoint = gameObjects[objectIndex - 1].getPointAt(trackPosition);
}
} }
// set mouse coordinates // set mouse coordinates

View File

@ -32,12 +32,8 @@ import itdelatrisu.opsu.beatmap.BeatmapSetNode;
import itdelatrisu.opsu.beatmap.TimingPoint; import itdelatrisu.opsu.beatmap.TimingPoint;
import itdelatrisu.opsu.downloads.Updater; import itdelatrisu.opsu.downloads.Updater;
import itdelatrisu.opsu.states.ButtonMenu.MenuState; import itdelatrisu.opsu.states.ButtonMenu.MenuState;
import itdelatrisu.opsu.ui.Colors; import itdelatrisu.opsu.ui.*;
import itdelatrisu.opsu.ui.Fonts;
import itdelatrisu.opsu.ui.MenuButton;
import itdelatrisu.opsu.ui.MenuButton.Expand; import itdelatrisu.opsu.ui.MenuButton.Expand;
import itdelatrisu.opsu.ui.StarFountain;
import itdelatrisu.opsu.ui.UI;
import itdelatrisu.opsu.ui.animations.AnimatedValue; import itdelatrisu.opsu.ui.animations.AnimatedValue;
import itdelatrisu.opsu.ui.animations.AnimationEquation; import itdelatrisu.opsu.ui.animations.AnimationEquation;
@ -203,14 +199,15 @@ public class MainMenu extends BasicGameState {
// initialize repository button // initialize repository button
float startX = width * 0.997f, startY = height * 0.997f; float startX = width * 0.997f, startY = height * 0.997f;
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { // only if a webpage can be opened if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { // only if a webpage can be opened
Image repoImg = GameImage.REPOSITORY.getImage(); Image repoImg;
repoImg = GameImage.REPOSITORY.getImage();
repoButton = new MenuButton(repoImg, repoButton = new MenuButton(repoImg,
startX - repoImg.getWidth() * 2.5f, startY - repoImg.getHeight() startX - repoImg.getWidth() * 2.5f, startY - repoImg.getHeight()
); );
repoButton.setHoverAnimationDuration(350); repoButton.setHoverAnimationDuration(350);
repoButton.setHoverAnimationEquation(AnimationEquation.IN_OUT_BACK); repoButton.setHoverAnimationEquation(AnimationEquation.IN_OUT_BACK);
repoButton.setHoverExpand(); repoButton.setHoverExpand();
Image repoImg = GameImage.REPOSITORY.getImage(); repoImg = GameImage.REPOSITORY.getImage();
danceRepoButton = new MenuButton(repoImg, danceRepoButton = new MenuButton(repoImg,
startX - repoImg.getWidth(), startY - repoImg.getHeight() startX - repoImg.getWidth(), startY - repoImg.getHeight()
); );
@ -282,11 +279,19 @@ public class MainMenu extends BasicGameState {
} }
// draw logo (pulsing) // draw logo (pulsing)
Color color = Options.isColorMainMenuLogo() ? Cursor.lastCursorColor : Color.white;
Float position = MusicController.getBeatProgress(); Float position = MusicController.getBeatProgress();
if (position == null) // default to 60bpm boolean renderPiece = position != null;
if (position == null) {
position = System.currentTimeMillis() % 1000 / 1000f; position = System.currentTimeMillis() % 1000 / 1000f;
}
float scale = 1f + position * 0.05f; float scale = 1f + position * 0.05f;
logo.draw(Color.white, scale); logo.draw(color, scale);
if (renderPiece) {
Image piece = GameImage.MENU_LOGO_PIECE.getImage().getScaledCopy(logo.getLastScale());
piece.rotate(position * 360);
piece.drawCentered(logo.getX(), logo.getY(), color);
}
float ghostScale = logo.getLastScale() / scale * 1.05f; float ghostScale = logo.getLastScale() / scale * 1.05f;
Image ghostLogo = GameImage.MENU_LOGO.getImage().getScaledCopy(ghostScale); Image ghostLogo = GameImage.MENU_LOGO.getImage().getScaledCopy(ghostScale);
ghostLogo.drawCentered(logo.getX(), logo.getY(), Colors.GHOST_LOGO); ghostLogo.drawCentered(logo.getX(), logo.getY(), Colors.GHOST_LOGO);
@ -311,15 +316,17 @@ public class MainMenu extends BasicGameState {
// draw repository buttons // draw repository buttons
if (repoButton != null) { if (repoButton != null) {
String text;
int fheight, fwidth;
repoButton.draw(); repoButton.draw();
String text = "opsu!"; text = "opsu!";
int fheight = Fonts.SMALL.getLineHeight(); fheight = Fonts.SMALL.getLineHeight();
int fwidth = Fonts.SMALL.getWidth(text); fwidth = Fonts.SMALL.getWidth(text);
Fonts.SMALL.drawString(repoButton.getX() - fwidth / 2, repoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight, text, Color.white); Fonts.SMALL.drawString(repoButton.getX() - fwidth / 2, repoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight, text, Color.white);
danceRepoButton.draw(); danceRepoButton.draw();
String text = "opsu!dance"; text = "opsu!dance";
int fheight = Fonts.SMALL.getLineHeight(); fheight = Fonts.SMALL.getLineHeight();
int fwidth = Fonts.SMALL.getWidth(text); fwidth = Fonts.SMALL.getWidth(text);
Fonts.SMALL.drawString(danceRepoButton.getX() - fwidth / 2, repoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight, text, Color.white); Fonts.SMALL.drawString(danceRepoButton.getX() - fwidth / 2, repoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight, text, Color.white);
} }

View File

@ -79,6 +79,7 @@ public class OptionsMenu extends BasicGameState implements OptionsOverlay.Parent
GameOption.SHRINKING_SLIDERS, GameOption.SHRINKING_SLIDERS,
GameOption.FALLBACK_SLIDERS, GameOption.FALLBACK_SLIDERS,
GameOption.MERGING_SLIDERS, GameOption.MERGING_SLIDERS,
GameOption.DRAW_SLIDER_ENDCIRCLES,
GameOption.SHOW_HIT_LIGHTING, GameOption.SHOW_HIT_LIGHTING,
GameOption.SHOW_HIT_ANIMATIONS, GameOption.SHOW_HIT_ANIMATIONS,
GameOption.SHOW_COMBO_BURSTS, GameOption.SHOW_COMBO_BURSTS,