Clarified GameImage "skinnable" field as "beatmap-skinnable".
Renamed some methods and modified comments to avoid this confusion, as game skins were implemented much later than beatmap skins. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
949b2c215c
commit
b83d6be5fd
|
@ -132,7 +132,7 @@ public class GameData {
|
|||
return menuImage;
|
||||
|
||||
Image img = getSmallImage();
|
||||
if (!small.hasSkinImage()) // save default image only
|
||||
if (!small.hasBeatmapSkinImage()) // save default image only
|
||||
this.menuImage = img;
|
||||
return img;
|
||||
}
|
||||
|
@ -408,8 +408,8 @@ public class GameData {
|
|||
// gameplay-specific images
|
||||
if (isGameplay()) {
|
||||
// combo burst images
|
||||
if (GameImage.COMBO_BURST.hasSkinImages() ||
|
||||
(!GameImage.COMBO_BURST.hasSkinImage() && GameImage.COMBO_BURST.getImages() != null))
|
||||
if (GameImage.COMBO_BURST.hasBeatmapSkinImages() ||
|
||||
(!GameImage.COMBO_BURST.hasBeatmapSkinImage() && GameImage.COMBO_BURST.getImages() != null))
|
||||
comboBurstImages = GameImage.COMBO_BURST.getImages();
|
||||
else
|
||||
comboBurstImages = new Image[]{ GameImage.COMBO_BURST.getImage() };
|
||||
|
|
|
@ -37,8 +37,8 @@ public enum GameImage {
|
|||
CURSOR ("cursor", "png"),
|
||||
CURSOR_MIDDLE ("cursormiddle", "png"),
|
||||
CURSOR_TRAIL ("cursortrail", "png"),
|
||||
CURSOR_OLD ("cursor2", "png", false, false),
|
||||
CURSOR_TRAIL_OLD ("cursortrail2", "png", false, false),
|
||||
CURSOR_OLD ("cursor2", "png", false, false), // custom
|
||||
CURSOR_TRAIL_OLD ("cursortrail2", "png", false, false), // custom
|
||||
|
||||
// Game
|
||||
SECTION_PASS ("section-pass", "png"),
|
||||
|
@ -496,7 +496,7 @@ public enum GameImage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor for game-related images (skinnable and preloaded).
|
||||
* Constructor for game-related images (beatmap-skinnable and preloaded).
|
||||
* @param filename the image file name
|
||||
* @param type the file types (separated by '|')
|
||||
*/
|
||||
|
@ -505,7 +505,7 @@ public enum GameImage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor for an array of game-related images (skinnable and preloaded).
|
||||
* Constructor for an array of game-related images (beatmap-skinnable and preloaded).
|
||||
* @param filename the image file name
|
||||
* @param filenameFormat the formatted file name string (for loading multiple images)
|
||||
* @param type the file types (separated by '|')
|
||||
|
@ -519,7 +519,7 @@ public enum GameImage {
|
|||
* Constructor for general images.
|
||||
* @param filename the image file name
|
||||
* @param type the file types (separated by '|')
|
||||
* @param skinnable whether or not the image is skinnable
|
||||
* @param skinnable whether or not the image is beatmap-skinnable
|
||||
* @param preload whether or not to preload the image
|
||||
*/
|
||||
GameImage(String filename, String type, boolean skinnable, boolean preload) {
|
||||
|
@ -530,10 +530,10 @@ public enum GameImage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the image is skinnable.
|
||||
* Returns whether or not the image is beatmap-skinnable.
|
||||
* @return true if skinnable
|
||||
*/
|
||||
public boolean isSkinnable() { return skinnable; }
|
||||
public boolean isBeatmapSkinnable() { return skinnable; }
|
||||
|
||||
/**
|
||||
* Returns whether or not to preload the image when the program starts.
|
||||
|
@ -543,7 +543,7 @@ public enum GameImage {
|
|||
|
||||
/**
|
||||
* Returns the image associated with this resource.
|
||||
* The skin image takes priority over the default image.
|
||||
* The beatmap skin image takes priority over the default image.
|
||||
*/
|
||||
public Image getImage() {
|
||||
setDefaultImage();
|
||||
|
@ -564,7 +564,7 @@ public enum GameImage {
|
|||
|
||||
/**
|
||||
* Returns the image array associated with this resource.
|
||||
* The skin images takes priority over the default images.
|
||||
* The beatmap skin images takes priority over the default images.
|
||||
*/
|
||||
public Image[] getImages() {
|
||||
setDefaultImage();
|
||||
|
@ -573,7 +573,7 @@ public enum GameImage {
|
|||
|
||||
/**
|
||||
* Sets the image associated with this resource to another image.
|
||||
* The skin image takes priority over the default image.
|
||||
* The beatmap skin image takes priority over the default image.
|
||||
* @param img the image to set
|
||||
*/
|
||||
public void setImage(Image img) {
|
||||
|
@ -585,7 +585,7 @@ public enum GameImage {
|
|||
|
||||
/**
|
||||
* Sets an image associated with this resource to another image.
|
||||
* The skin image takes priority over the default image.
|
||||
* The beatmap skin image takes priority over the default image.
|
||||
* @param img the image to set
|
||||
* @param index the index in the image array
|
||||
*/
|
||||
|
@ -628,17 +628,17 @@ public enum GameImage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the associated skin image.
|
||||
* Sets the associated beatmap skin image.
|
||||
* If the path does not contain the image, the default image is used.
|
||||
* @param dir the image directory to search
|
||||
* @return true if a new skin image is loaded, false otherwise
|
||||
*/
|
||||
public boolean setSkinImage(File dir) {
|
||||
public boolean setBeatmapSkinImage(File dir) {
|
||||
if (dir == null)
|
||||
return false;
|
||||
|
||||
// destroy the existing images, if any
|
||||
destroySkinImage();
|
||||
destroyBeatmapSkinImage();
|
||||
|
||||
// beatmap skins disabled
|
||||
if (Options.isBeatmapSkinIgnored())
|
||||
|
@ -717,21 +717,21 @@ public enum GameImage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns whether a skin image is currently loaded.
|
||||
* @return true if skin image exists
|
||||
* Returns whether a beatmap skin image is currently loaded.
|
||||
* @return true if a beatmap skin image exists
|
||||
*/
|
||||
public boolean hasSkinImage() { return (skinImage != null && !skinImage.isDestroyed()); }
|
||||
public boolean hasBeatmapSkinImage() { return (skinImage != null && !skinImage.isDestroyed()); }
|
||||
|
||||
/**
|
||||
* Returns whether skin images are currently loaded.
|
||||
* @return true if any skin image exists
|
||||
* Returns whether beatmap skin images are currently loaded.
|
||||
* @return true if any beatmap skin image exists
|
||||
*/
|
||||
public boolean hasSkinImages() { return (skinImages != null); }
|
||||
public boolean hasBeatmapSkinImages() { return (skinImages != null); }
|
||||
|
||||
/**
|
||||
* Destroys the associated skin image(s), if any.
|
||||
* Destroys the associated beatmap skin image(s), if any.
|
||||
*/
|
||||
public void destroySkinImage() {
|
||||
public void destroyBeatmapSkinImage() {
|
||||
if (skinImage == null && skinImages == null)
|
||||
return;
|
||||
try {
|
||||
|
@ -748,7 +748,7 @@ public enum GameImage {
|
|||
skinImages = null;
|
||||
}
|
||||
} catch (SlickException e) {
|
||||
ErrorHandler.error(String.format("Failed to destroy skin images for '%s'.", this.name()), e, true);
|
||||
ErrorHandler.error(String.format("Failed to destroy beatmap skin images for '%s'.", this.name()), e, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ public class Opsu extends StateBasedGame {
|
|||
} else
|
||||
songMenu.resetTrackOnLoad();
|
||||
}
|
||||
if (UI.getCursor().isSkinned())
|
||||
if (UI.getCursor().isBeatmapSkinned())
|
||||
UI.getCursor().reset();
|
||||
songMenu.resetGameDataOnLoad();
|
||||
this.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
|
|
|
@ -128,8 +128,8 @@ public class Slider implements GameObject {
|
|||
followRadius = diameter / 2 * 3f;
|
||||
|
||||
// slider ball
|
||||
if (GameImage.SLIDER_BALL.hasSkinImages() ||
|
||||
(!GameImage.SLIDER_BALL.hasSkinImage() && GameImage.SLIDER_BALL.getImages() != null))
|
||||
if (GameImage.SLIDER_BALL.hasBeatmapSkinImages() ||
|
||||
(!GameImage.SLIDER_BALL.hasBeatmapSkinImage() && GameImage.SLIDER_BALL.getImages() != null))
|
||||
sliderBallImages = GameImage.SLIDER_BALL.getImages();
|
||||
else
|
||||
sliderBallImages = new Image[]{ GameImage.SLIDER_BALL.getImage() };
|
||||
|
|
|
@ -1424,9 +1424,9 @@ public class Game extends BasicGameState {
|
|||
// set images
|
||||
File parent = beatmap.getFile().getParentFile();
|
||||
for (GameImage img : GameImage.values()) {
|
||||
if (img.isSkinnable()) {
|
||||
if (img.isBeatmapSkinnable()) {
|
||||
img.setDefaultImage();
|
||||
img.setSkinImage(parent);
|
||||
img.setBeatmapSkinImage(parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,10 +87,10 @@ public class GamePauseMenu extends BasicGameState {
|
|||
|
||||
// don't draw default background if button skinned and background unskinned
|
||||
boolean buttonsSkinned =
|
||||
GameImage.PAUSE_CONTINUE.hasSkinImage() ||
|
||||
GameImage.PAUSE_RETRY.hasSkinImage() ||
|
||||
GameImage.PAUSE_BACK.hasSkinImage();
|
||||
if (!buttonsSkinned || bg.hasSkinImage())
|
||||
GameImage.PAUSE_CONTINUE.hasBeatmapSkinImage() ||
|
||||
GameImage.PAUSE_RETRY.hasBeatmapSkinImage() ||
|
||||
GameImage.PAUSE_BACK.hasBeatmapSkinImage();
|
||||
if (!buttonsSkinned || bg.hasBeatmapSkinImage())
|
||||
bg.getImage().draw();
|
||||
else
|
||||
g.setBackground(Color.black);
|
||||
|
@ -134,7 +134,7 @@ public class GamePauseMenu extends BasicGameState {
|
|||
SoundController.playSound(SoundEffect.MENUBACK);
|
||||
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
|
||||
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
|
||||
if (UI.getCursor().isSkinned())
|
||||
if (UI.getCursor().isBeatmapSkinned())
|
||||
UI.getCursor().reset();
|
||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
} else {
|
||||
|
@ -188,7 +188,7 @@ public class GamePauseMenu extends BasicGameState {
|
|||
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
|
||||
else
|
||||
MusicController.resume();
|
||||
if (UI.getCursor().isSkinned())
|
||||
if (UI.getCursor().isBeatmapSkinned())
|
||||
UI.getCursor().reset();
|
||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ public class GameRanking extends BasicGameState {
|
|||
if (data.isGameplay())
|
||||
songMenu.resetTrackOnLoad();
|
||||
songMenu.resetGameDataOnLoad();
|
||||
if (UI.getCursor().isSkinned())
|
||||
if (UI.getCursor().isBeatmapSkinned())
|
||||
UI.getCursor().reset();
|
||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
}
|
||||
|
|
|
@ -1006,8 +1006,8 @@ public class SongMenu extends BasicGameState {
|
|||
|
||||
// destroy skin images, if any
|
||||
for (GameImage img : GameImage.values()) {
|
||||
if (img.isSkinnable())
|
||||
img.destroySkinImage();
|
||||
if (img.isBeatmapSkinnable())
|
||||
img.destroyBeatmapSkinImage();
|
||||
}
|
||||
|
||||
// reload scores
|
||||
|
|
|
@ -107,11 +107,11 @@ public class Cursor {
|
|||
public void draw(int mouseX, int mouseY, boolean mousePressed) {
|
||||
// determine correct cursor image
|
||||
Image cursor = null, cursorMiddle = null, cursorTrail = null;
|
||||
boolean skinned = GameImage.CURSOR.hasSkinImage();
|
||||
boolean skinned = GameImage.CURSOR.hasBeatmapSkinImage();
|
||||
boolean newStyle, hasMiddle;
|
||||
if (skinned) {
|
||||
newStyle = true; // osu! currently treats all beatmap cursors as new-style cursors
|
||||
hasMiddle = GameImage.CURSOR_MIDDLE.hasSkinImage();
|
||||
hasMiddle = GameImage.CURSOR_MIDDLE.hasBeatmapSkinImage();
|
||||
} else
|
||||
newStyle = hasMiddle = Options.isNewCursorEnabled();
|
||||
if (skinned || newStyle) {
|
||||
|
@ -253,13 +253,13 @@ public class Cursor {
|
|||
}
|
||||
|
||||
/**
|
||||
* Resets all cursor data and skins.
|
||||
* Resets all cursor data and beatmap skins.
|
||||
*/
|
||||
public void reset() {
|
||||
// destroy skin images
|
||||
GameImage.CURSOR.destroySkinImage();
|
||||
GameImage.CURSOR_MIDDLE.destroySkinImage();
|
||||
GameImage.CURSOR_TRAIL.destroySkinImage();
|
||||
GameImage.CURSOR.destroyBeatmapSkinImage();
|
||||
GameImage.CURSOR_MIDDLE.destroyBeatmapSkinImage();
|
||||
GameImage.CURSOR_TRAIL.destroyBeatmapSkinImage();
|
||||
|
||||
// reset locations
|
||||
resetLocations();
|
||||
|
@ -282,10 +282,10 @@ public class Cursor {
|
|||
/**
|
||||
* Returns whether or not the cursor is skinned.
|
||||
*/
|
||||
public boolean isSkinned() {
|
||||
return (GameImage.CURSOR.hasSkinImage() ||
|
||||
GameImage.CURSOR_MIDDLE.hasSkinImage() ||
|
||||
GameImage.CURSOR_TRAIL.hasSkinImage());
|
||||
public boolean isBeatmapSkinned() {
|
||||
return (GameImage.CURSOR.hasBeatmapSkinImage() ||
|
||||
GameImage.CURSOR_MIDDLE.hasBeatmapSkinImage() ||
|
||||
GameImage.CURSOR_TRAIL.hasBeatmapSkinImage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user