DT/HF/Playback changes.
Can watch HalfTime on half speed. Reset pitch on leaving the game state. Load songInfo when entering select song menu. Playback button fades in on hover instead of expands. Reverted spinner changes. It should be fixed separately.
This commit is contained in:
parent
d8425197a7
commit
f810965921
|
@ -170,8 +170,6 @@ public enum GameMod {
|
|||
Collections.reverse(Arrays.asList(VALUES_REVERSED));
|
||||
}
|
||||
|
||||
private static boolean justChanged = false;
|
||||
|
||||
/** The last calculated score multiplier, or -1f if it must be recalculated. */
|
||||
private static float scoreMultiplier = -1f;
|
||||
|
||||
|
@ -236,17 +234,6 @@ public enum GameMod {
|
|||
return speedMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static boolean justChanged() {
|
||||
if (justChanged) {
|
||||
justChanged = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current game mod state (bitwise OR of active mods).
|
||||
*/
|
||||
|
@ -385,7 +372,6 @@ public enum GameMod {
|
|||
|
||||
active = !active;
|
||||
scoreMultiplier = speedMultiplier = -1f;
|
||||
justChanged = true;
|
||||
|
||||
if (checkInverse) {
|
||||
if (AUTO.isActive()) {
|
||||
|
|
|
@ -279,11 +279,6 @@ public class MenuButton {
|
|||
*/
|
||||
public void removeHoverEffects() { hoverEffect = 0; }
|
||||
|
||||
/**
|
||||
* Sets the image of the button.
|
||||
*/
|
||||
public void setImage(Image image) { img = image; }
|
||||
|
||||
/**
|
||||
* Sets the "expand" hover effect.
|
||||
*/
|
||||
|
|
|
@ -118,9 +118,10 @@ public class OsuGroupNode {
|
|||
return null;
|
||||
|
||||
OsuFile osu = osuFiles.get(osuFileIndex);
|
||||
long endTime = (long) (osu.endTime / GameMod.getSpeedMultiplier());
|
||||
int bpmMin = (int) (osu.bpmMin * GameMod.getSpeedMultiplier());
|
||||
int bpmMax = (int) (osu.bpmMax * GameMod.getSpeedMultiplier());
|
||||
float speedModifier = GameMod.getSpeedMultiplier();
|
||||
long endTime = (long) (osu.endTime / speedModifier);
|
||||
int bpmMin = (int) (osu.bpmMin * speedModifier);
|
||||
int bpmMax = (int) (osu.bpmMax * speedModifier);
|
||||
String[] info = new String[5];
|
||||
info[0] = osu.toString();
|
||||
info[1] = String.format("Mapped by %s",
|
||||
|
|
|
@ -49,6 +49,7 @@ import java.util.Scanner;
|
|||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import itdelatrisu.opsu.replay.PlaybackSpeed;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -180,6 +181,9 @@ public class Utils {
|
|||
// initialize game mods
|
||||
GameMod.init(width, height);
|
||||
|
||||
// initialize playback buttons
|
||||
PlaybackSpeed.init(width, height);
|
||||
|
||||
// initialize hit objects
|
||||
OsuHitObject.init(width, height);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class Spinner implements HitObject {
|
|||
Utils.COLOR_BLACK_ALPHA.a = oldAlpha;
|
||||
|
||||
// rpm
|
||||
int rpm = Math.abs(Math.round(sumVelocity * GameMod.getSpeedMultiplier() / storedVelocities.length * 60));
|
||||
int rpm = Math.abs(Math.round(sumVelocity / storedVelocities.length * 60));
|
||||
Image rpmImg = GameImage.SPINNER_RPM.getImage();
|
||||
rpmImg.setAlpha(alpha);
|
||||
rpmImg.drawCentered(width / 2f, height - rpmImg.getHeight() / 2f);
|
||||
|
|
|
@ -2,6 +2,7 @@ package itdelatrisu.opsu.replay;
|
|||
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import org.newdawn.slick.Image;
|
||||
|
||||
public enum PlaybackSpeed {
|
||||
|
@ -12,6 +13,9 @@ public enum PlaybackSpeed {
|
|||
/** The file name of the button image. */
|
||||
private GameImage gameImage;
|
||||
|
||||
/** The button of the playback. */
|
||||
private MenuButton button;
|
||||
|
||||
/** The speed modifier of the playback. */
|
||||
private float modifier;
|
||||
|
||||
|
@ -20,12 +24,20 @@ public enum PlaybackSpeed {
|
|||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public static void init(int width, int height) {
|
||||
// create buttons
|
||||
for (PlaybackSpeed playback : PlaybackSpeed.values()) {
|
||||
Image img = playback.gameImage.getImage();
|
||||
playback.button = new MenuButton(img, width * 0.98f - (img.getWidth() / 2f), height * 0.25f);
|
||||
playback.button.setHoverFade();
|
||||
}
|
||||
}
|
||||
|
||||
private static int index = 1;
|
||||
|
||||
public static PlaybackSpeed next() {
|
||||
PlaybackSpeed next = values()[index++ % values().length];
|
||||
if((GameMod.DOUBLE_TIME.isActive() && next == PlaybackSpeed.DOUBLE) ||
|
||||
(GameMod.HALF_TIME.isActive() && next == PlaybackSpeed.HALF))
|
||||
if((GameMod.DOUBLE_TIME.isActive() && next == PlaybackSpeed.DOUBLE))
|
||||
next = next();
|
||||
|
||||
return next;
|
||||
|
@ -36,10 +48,10 @@ public enum PlaybackSpeed {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the image.
|
||||
* @return the associated image
|
||||
* Returns the button.
|
||||
* @return the associated button
|
||||
*/
|
||||
public Image getImage() { return gameImage.getImage(); }
|
||||
public MenuButton getButton() { return button; }
|
||||
|
||||
/**
|
||||
* Returns the speed modifier.
|
||||
|
|
|
@ -889,7 +889,7 @@ public class Game extends BasicGameState {
|
|||
}
|
||||
if (button != Input.MOUSE_MIDDLE_BUTTON && playbackButton.contains(x, y)) {
|
||||
PlaybackSpeed playbackSpeed = PlaybackSpeed.next();
|
||||
playbackButton.setImage(playbackSpeed.getImage());
|
||||
playbackButton = playbackSpeed.getButton();
|
||||
MusicController.setPitch(GameMod.getSpeedMultiplier() * playbackSpeed.getModifier());
|
||||
return;
|
||||
}
|
||||
|
@ -1158,6 +1158,9 @@ public class Game extends BasicGameState {
|
|||
// replays
|
||||
if (isReplay)
|
||||
GameMod.loadModState(previousMods);
|
||||
|
||||
// reset playback speed
|
||||
MusicController.setPitch(1f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1340,11 +1343,8 @@ public class Game extends BasicGameState {
|
|||
}
|
||||
skipButton.setHoverExpand(1.1f, MenuButton.Expand.UP_LEFT);
|
||||
|
||||
if (isReplay || GameMod.AUTO.isActive()) {
|
||||
Image playback = GameImage.REPLAY_1XPLAYBACK.getImage();
|
||||
playbackButton = new MenuButton(playback, width * 0.98f - (playback.getWidth() / 2f), height * 0.25f);
|
||||
playbackButton.setHoverExpand(1.1f, MenuButton.Expand.CENTER);
|
||||
}
|
||||
if (isReplay || GameMod.AUTO.isActive())
|
||||
playbackButton = PlaybackSpeed.NORMAL.getButton();
|
||||
|
||||
// load other images...
|
||||
((GamePauseMenu) game.getState(Opsu.STATE_GAMEPAUSEMENU)).loadImages();
|
||||
|
|
|
@ -336,12 +336,8 @@ public class SongMenu extends BasicGameState {
|
|||
int iconWidth = musicNote.getWidth();
|
||||
|
||||
// song info text
|
||||
if (songInfo == null || GameMod.justChanged()) {
|
||||
songInfo = focusNode.getInfo();
|
||||
if (Options.useUnicodeMetadata()) { // load glyphs
|
||||
OsuFile osu = focusNode.osuFiles.get(0);
|
||||
Utils.loadGlyphs(Utils.FONT_LARGE, osu.titleUnicode, osu.artistUnicode);
|
||||
}
|
||||
if (songInfo == null) {
|
||||
songInfo = getSongInfo();
|
||||
}
|
||||
marginX += 5;
|
||||
float headerTextY = marginY;
|
||||
|
@ -983,6 +979,9 @@ public class SongMenu extends BasicGameState {
|
|||
resetGame = false;
|
||||
}
|
||||
|
||||
// load song info
|
||||
songInfo = getSongInfo();
|
||||
|
||||
// state-based action
|
||||
if (stateAction != null) {
|
||||
switch (stateAction) {
|
||||
|
@ -1303,6 +1302,20 @@ public class SongMenu extends BasicGameState {
|
|||
return null; // incorrect map
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of strings containing song information.
|
||||
* @return the String array
|
||||
*/
|
||||
private String[] getSongInfo () {
|
||||
songInfo = focusNode.getInfo();
|
||||
if (Options.useUnicodeMetadata()) { // load glyphs
|
||||
OsuFile osu = focusNode.osuFiles.get(0);
|
||||
Utils.loadGlyphs(Utils.FONT_LARGE, osu.titleUnicode, osu.artistUnicode);
|
||||
}
|
||||
return songInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts the game.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user