ability to change map offset while playing (- and + keys)
This commit is contained in:
parent
7daafd612e
commit
da90c98fce
|
@ -22,6 +22,7 @@ import itdelatrisu.opsu.ErrorHandler;
|
||||||
import itdelatrisu.opsu.Options;
|
import itdelatrisu.opsu.Options;
|
||||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
import itdelatrisu.opsu.beatmap.Beatmap;
|
||||||
import itdelatrisu.opsu.beatmap.BeatmapParser;
|
import itdelatrisu.opsu.beatmap.BeatmapParser;
|
||||||
|
import itdelatrisu.opsu.states.Game;
|
||||||
import itdelatrisu.opsu.ui.UI;
|
import itdelatrisu.opsu.ui.UI;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -252,9 +253,9 @@ public class MusicController {
|
||||||
*/
|
*/
|
||||||
public static int getPosition() {
|
public static int getPosition() {
|
||||||
if (isPlaying())
|
if (isPlaying())
|
||||||
return (int) (player.getPosition() * 1000 + Options.getMusicOffset());
|
return (int) (player.getPosition() * 1000 + Options.getMusicOffset() + Game.currentMapMusicOffset);
|
||||||
else if (isPaused())
|
else if (isPaused())
|
||||||
return Math.max((int) (pauseTime * 1000 + Options.getMusicOffset()), 0);
|
return Math.max((int) (pauseTime * 1000 + Options.getMusicOffset() + Game.currentMapMusicOffset), 0);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,8 @@ public class Game extends BasicGameState {
|
||||||
/** Music position bar coordinates and dimensions (for replay seeking). */
|
/** Music position bar coordinates and dimensions (for replay seeking). */
|
||||||
private float musicBarX, musicBarY, musicBarWidth, musicBarHeight;
|
private float musicBarX, musicBarY, musicBarWidth, musicBarHeight;
|
||||||
|
|
||||||
|
public static int currentMapMusicOffset;
|
||||||
|
|
||||||
private int mirrorFrom;
|
private int mirrorFrom;
|
||||||
private int mirrorTo;
|
private int mirrorTo;
|
||||||
|
|
||||||
|
@ -1143,6 +1145,14 @@ public class Game extends BasicGameState {
|
||||||
Dancer.mirror = true;
|
Dancer.mirror = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Input.KEY_MINUS:
|
||||||
|
currentMapMusicOffset += 5;
|
||||||
|
UI.sendBarNotification("Current map offset: " + currentMapMusicOffset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (key == Input.KEY_ADD || c == '+') {
|
||||||
|
currentMapMusicOffset -= 5;
|
||||||
|
UI.sendBarNotification("Current map offset: " + currentMapMusicOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1654,6 +1664,9 @@ public class Game extends BasicGameState {
|
||||||
* @param beatmap the beatmap to load
|
* @param beatmap the beatmap to load
|
||||||
*/
|
*/
|
||||||
public void loadBeatmap(Beatmap beatmap) {
|
public void loadBeatmap(Beatmap beatmap) {
|
||||||
|
if (this.beatmap == null || this.beatmap.beatmapID != beatmap.beatmapID) {
|
||||||
|
currentMapMusicOffset = 0;
|
||||||
|
}
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
Display.setTitle(String.format("%s - %s", game.getTitle(), beatmap.toString()));
|
Display.setTitle(String.format("%s - %s", game.getTitle(), beatmap.toString()));
|
||||||
if (beatmap.timingPoints == null)
|
if (beatmap.timingPoints == null)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user