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