Fixed crashes when importing beatmaps (due to more async issues).
Don't call MusicController.loopTrackIfEnded() if a beatmap reloading thread is running. Other changes: - Fixed issue where long download result text would be drawn outside the result area by adding a clip. - Changed default music offset from -150ms to -75ms. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
fc5f56f75a
commit
daad5940f0
|
@ -179,7 +179,7 @@ public class Options {
|
||||||
},
|
},
|
||||||
EFFECT_VOLUME ("Effect Volume", "Volume of menu and game sounds.", 70, 0, 100),
|
EFFECT_VOLUME ("Effect Volume", "Volume of menu and game sounds.", 70, 0, 100),
|
||||||
HITSOUND_VOLUME ("Hit Sound Volume", "Volume of hit sounds.", 30, 0, 100),
|
HITSOUND_VOLUME ("Hit Sound Volume", "Volume of hit sounds.", 30, 0, 100),
|
||||||
MUSIC_OFFSET ("Music Offset", "Adjust this value if hit objects are out of sync.", -150, -500, 500) {
|
MUSIC_OFFSET ("Music Offset", "Adjust this value if hit objects are out of sync.", -75, -500, 500) {
|
||||||
@Override
|
@Override
|
||||||
public String getValueString() { return String.format("%dms", val); }
|
public String getValueString() { return String.format("%dms", val); }
|
||||||
},
|
},
|
||||||
|
|
|
@ -149,6 +149,14 @@ public class DownloadNode {
|
||||||
(cy > buttonBaseY && cy < buttonBaseY + buttonOffset * maxResultsShown));
|
(cy > buttonBaseY && cy < buttonBaseY + buttonOffset * maxResultsShown));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a clip to the download result button area.
|
||||||
|
* @param g the graphics context
|
||||||
|
*/
|
||||||
|
public static void clipToResultArea(Graphics g) {
|
||||||
|
g.setClip((int) buttonBaseX, (int) buttonBaseY, (int) buttonWidth, (int) (buttonOffset * maxResultsShown));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the coordinates are within the bounds of the
|
* Returns true if the coordinates are within the bounds of the
|
||||||
* download information button at the given index.
|
* download information button at the given index.
|
||||||
|
@ -332,6 +340,7 @@ public class DownloadNode {
|
||||||
textX += img.getWidth() + buttonWidth * 0.001f;
|
textX += img.getWidth() + buttonWidth * 0.001f;
|
||||||
|
|
||||||
// text
|
// text
|
||||||
|
// TODO: if the title/artist line is too long, shorten it (e.g. add "...")
|
||||||
if (Options.useUnicodeMetadata()) // load glyphs
|
if (Options.useUnicodeMetadata()) // load glyphs
|
||||||
Utils.loadGlyphs(Utils.FONT_BOLD, getTitle(), getArtist());
|
Utils.loadGlyphs(Utils.FONT_BOLD, getTitle(), getArtist());
|
||||||
Utils.FONT_BOLD.drawString(
|
Utils.FONT_BOLD.drawString(
|
||||||
|
|
|
@ -255,6 +255,7 @@ public class DownloadsMenu extends BasicGameState {
|
||||||
// search results
|
// search results
|
||||||
DownloadNode[] nodes = resultList;
|
DownloadNode[] nodes = resultList;
|
||||||
if (nodes != null) {
|
if (nodes != null) {
|
||||||
|
DownloadNode.clipToResultArea(g);
|
||||||
int maxResultsShown = DownloadNode.maxResultsShown();
|
int maxResultsShown = DownloadNode.maxResultsShown();
|
||||||
for (int i = 0; i < maxResultsShown; i++) {
|
for (int i = 0; i < maxResultsShown; i++) {
|
||||||
int index = startResult + i;
|
int index = startResult + i;
|
||||||
|
@ -263,6 +264,7 @@ public class DownloadsMenu extends BasicGameState {
|
||||||
nodes[index].drawResult(g, i, DownloadNode.resultContains(mouseX, mouseY, i),
|
nodes[index].drawResult(g, i, DownloadNode.resultContains(mouseX, mouseY, i),
|
||||||
(index == focusResult), (previewID == nodes[index].getID()));
|
(index == focusResult), (previewID == nodes[index].getID()));
|
||||||
}
|
}
|
||||||
|
g.clearClip();
|
||||||
|
|
||||||
// scroll bar
|
// scroll bar
|
||||||
if (nodes.length > maxResultsShown)
|
if (nodes.length > maxResultsShown)
|
||||||
|
@ -333,6 +335,7 @@ public class DownloadsMenu extends BasicGameState {
|
||||||
public void update(GameContainer container, StateBasedGame game, int delta)
|
public void update(GameContainer container, StateBasedGame game, int delta)
|
||||||
throws SlickException {
|
throws SlickException {
|
||||||
UI.update(delta);
|
UI.update(delta);
|
||||||
|
if (importThread == null)
|
||||||
MusicController.loopTrackIfEnded(false);
|
MusicController.loopTrackIfEnded(false);
|
||||||
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
||||||
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
|
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
|
||||||
|
|
|
@ -465,6 +465,7 @@ public class SongMenu extends BasicGameState {
|
||||||
public void update(GameContainer container, StateBasedGame game, int delta)
|
public void update(GameContainer container, StateBasedGame game, int delta)
|
||||||
throws SlickException {
|
throws SlickException {
|
||||||
UI.update(delta);
|
UI.update(delta);
|
||||||
|
if (reloadThread == null)
|
||||||
MusicController.loopTrackIfEnded(true);
|
MusicController.loopTrackIfEnded(true);
|
||||||
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
||||||
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
|
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user