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;
|
return menuImage;
|
||||||
|
|
||||||
Image img = getSmallImage();
|
Image img = getSmallImage();
|
||||||
if (!small.hasSkinImage()) // save default image only
|
if (!small.hasBeatmapSkinImage()) // save default image only
|
||||||
this.menuImage = img;
|
this.menuImage = img;
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
@ -408,8 +408,8 @@ public class GameData {
|
||||||
// gameplay-specific images
|
// gameplay-specific images
|
||||||
if (isGameplay()) {
|
if (isGameplay()) {
|
||||||
// combo burst images
|
// combo burst images
|
||||||
if (GameImage.COMBO_BURST.hasSkinImages() ||
|
if (GameImage.COMBO_BURST.hasBeatmapSkinImages() ||
|
||||||
(!GameImage.COMBO_BURST.hasSkinImage() && GameImage.COMBO_BURST.getImages() != null))
|
(!GameImage.COMBO_BURST.hasBeatmapSkinImage() && GameImage.COMBO_BURST.getImages() != null))
|
||||||
comboBurstImages = GameImage.COMBO_BURST.getImages();
|
comboBurstImages = GameImage.COMBO_BURST.getImages();
|
||||||
else
|
else
|
||||||
comboBurstImages = new Image[]{ GameImage.COMBO_BURST.getImage() };
|
comboBurstImages = new Image[]{ GameImage.COMBO_BURST.getImage() };
|
||||||
|
|
|
@ -37,8 +37,8 @@ public enum GameImage {
|
||||||
CURSOR ("cursor", "png"),
|
CURSOR ("cursor", "png"),
|
||||||
CURSOR_MIDDLE ("cursormiddle", "png"),
|
CURSOR_MIDDLE ("cursormiddle", "png"),
|
||||||
CURSOR_TRAIL ("cursortrail", "png"),
|
CURSOR_TRAIL ("cursortrail", "png"),
|
||||||
CURSOR_OLD ("cursor2", "png", false, false),
|
CURSOR_OLD ("cursor2", "png", false, false), // custom
|
||||||
CURSOR_TRAIL_OLD ("cursortrail2", "png", false, false),
|
CURSOR_TRAIL_OLD ("cursortrail2", "png", false, false), // custom
|
||||||
|
|
||||||
// Game
|
// Game
|
||||||
SECTION_PASS ("section-pass", "png"),
|
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 filename the image file name
|
||||||
* @param type the file types (separated by '|')
|
* @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 filename the image file name
|
||||||
* @param filenameFormat the formatted file name string (for loading multiple images)
|
* @param filenameFormat the formatted file name string (for loading multiple images)
|
||||||
* @param type the file types (separated by '|')
|
* @param type the file types (separated by '|')
|
||||||
|
@ -519,7 +519,7 @@ public enum GameImage {
|
||||||
* Constructor for general images.
|
* Constructor for general images.
|
||||||
* @param filename the image file name
|
* @param filename the image file name
|
||||||
* @param type the file types (separated by '|')
|
* @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
|
* @param preload whether or not to preload the image
|
||||||
*/
|
*/
|
||||||
GameImage(String filename, String type, boolean skinnable, boolean preload) {
|
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
|
* @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.
|
* 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.
|
* 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() {
|
public Image getImage() {
|
||||||
setDefaultImage();
|
setDefaultImage();
|
||||||
|
@ -564,7 +564,7 @@ public enum GameImage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the image array associated with this resource.
|
* 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() {
|
public Image[] getImages() {
|
||||||
setDefaultImage();
|
setDefaultImage();
|
||||||
|
@ -573,7 +573,7 @@ public enum GameImage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the image associated with this resource to another image.
|
* 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
|
* @param img the image to set
|
||||||
*/
|
*/
|
||||||
public void setImage(Image img) {
|
public void setImage(Image img) {
|
||||||
|
@ -585,7 +585,7 @@ public enum GameImage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an image associated with this resource to another image.
|
* 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 img the image to set
|
||||||
* @param index the index in the image array
|
* @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.
|
* If the path does not contain the image, the default image is used.
|
||||||
* @param dir the image directory to search
|
* @param dir the image directory to search
|
||||||
* @return true if a new skin image is loaded, false otherwise
|
* @return true if a new skin image is loaded, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean setSkinImage(File dir) {
|
public boolean setBeatmapSkinImage(File dir) {
|
||||||
if (dir == null)
|
if (dir == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// destroy the existing images, if any
|
// destroy the existing images, if any
|
||||||
destroySkinImage();
|
destroyBeatmapSkinImage();
|
||||||
|
|
||||||
// beatmap skins disabled
|
// beatmap skins disabled
|
||||||
if (Options.isBeatmapSkinIgnored())
|
if (Options.isBeatmapSkinIgnored())
|
||||||
|
@ -717,21 +717,21 @@ public enum GameImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether a skin image is currently loaded.
|
* Returns whether a beatmap skin image is currently loaded.
|
||||||
* @return true if skin image exists
|
* @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.
|
* Returns whether beatmap skin images are currently loaded.
|
||||||
* @return true if any skin image exists
|
* @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)
|
if (skinImage == null && skinImages == null)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
|
@ -748,7 +748,7 @@ public enum GameImage {
|
||||||
skinImages = null;
|
skinImages = null;
|
||||||
}
|
}
|
||||||
} catch (SlickException e) {
|
} 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
|
} else
|
||||||
songMenu.resetTrackOnLoad();
|
songMenu.resetTrackOnLoad();
|
||||||
}
|
}
|
||||||
if (UI.getCursor().isSkinned())
|
if (UI.getCursor().isBeatmapSkinned())
|
||||||
UI.getCursor().reset();
|
UI.getCursor().reset();
|
||||||
songMenu.resetGameDataOnLoad();
|
songMenu.resetGameDataOnLoad();
|
||||||
this.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
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;
|
followRadius = diameter / 2 * 3f;
|
||||||
|
|
||||||
// slider ball
|
// slider ball
|
||||||
if (GameImage.SLIDER_BALL.hasSkinImages() ||
|
if (GameImage.SLIDER_BALL.hasBeatmapSkinImages() ||
|
||||||
(!GameImage.SLIDER_BALL.hasSkinImage() && GameImage.SLIDER_BALL.getImages() != null))
|
(!GameImage.SLIDER_BALL.hasBeatmapSkinImage() && GameImage.SLIDER_BALL.getImages() != null))
|
||||||
sliderBallImages = GameImage.SLIDER_BALL.getImages();
|
sliderBallImages = GameImage.SLIDER_BALL.getImages();
|
||||||
else
|
else
|
||||||
sliderBallImages = new Image[]{ GameImage.SLIDER_BALL.getImage() };
|
sliderBallImages = new Image[]{ GameImage.SLIDER_BALL.getImage() };
|
||||||
|
|
|
@ -1424,9 +1424,9 @@ public class Game extends BasicGameState {
|
||||||
// set images
|
// set images
|
||||||
File parent = beatmap.getFile().getParentFile();
|
File parent = beatmap.getFile().getParentFile();
|
||||||
for (GameImage img : GameImage.values()) {
|
for (GameImage img : GameImage.values()) {
|
||||||
if (img.isSkinnable()) {
|
if (img.isBeatmapSkinnable()) {
|
||||||
img.setDefaultImage();
|
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
|
// don't draw default background if button skinned and background unskinned
|
||||||
boolean buttonsSkinned =
|
boolean buttonsSkinned =
|
||||||
GameImage.PAUSE_CONTINUE.hasSkinImage() ||
|
GameImage.PAUSE_CONTINUE.hasBeatmapSkinImage() ||
|
||||||
GameImage.PAUSE_RETRY.hasSkinImage() ||
|
GameImage.PAUSE_RETRY.hasBeatmapSkinImage() ||
|
||||||
GameImage.PAUSE_BACK.hasSkinImage();
|
GameImage.PAUSE_BACK.hasBeatmapSkinImage();
|
||||||
if (!buttonsSkinned || bg.hasSkinImage())
|
if (!buttonsSkinned || bg.hasBeatmapSkinImage())
|
||||||
bg.getImage().draw();
|
bg.getImage().draw();
|
||||||
else
|
else
|
||||||
g.setBackground(Color.black);
|
g.setBackground(Color.black);
|
||||||
|
@ -134,7 +134,7 @@ public class GamePauseMenu extends BasicGameState {
|
||||||
SoundController.playSound(SoundEffect.MENUBACK);
|
SoundController.playSound(SoundEffect.MENUBACK);
|
||||||
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
|
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
|
||||||
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
|
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
|
||||||
if (UI.getCursor().isSkinned())
|
if (UI.getCursor().isBeatmapSkinned())
|
||||||
UI.getCursor().reset();
|
UI.getCursor().reset();
|
||||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||||
} else {
|
} else {
|
||||||
|
@ -188,7 +188,7 @@ public class GamePauseMenu extends BasicGameState {
|
||||||
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
|
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
|
||||||
else
|
else
|
||||||
MusicController.resume();
|
MusicController.resume();
|
||||||
if (UI.getCursor().isSkinned())
|
if (UI.getCursor().isBeatmapSkinned())
|
||||||
UI.getCursor().reset();
|
UI.getCursor().reset();
|
||||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
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())
|
if (data.isGameplay())
|
||||||
songMenu.resetTrackOnLoad();
|
songMenu.resetTrackOnLoad();
|
||||||
songMenu.resetGameDataOnLoad();
|
songMenu.resetGameDataOnLoad();
|
||||||
if (UI.getCursor().isSkinned())
|
if (UI.getCursor().isBeatmapSkinned())
|
||||||
UI.getCursor().reset();
|
UI.getCursor().reset();
|
||||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
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
|
// destroy skin images, if any
|
||||||
for (GameImage img : GameImage.values()) {
|
for (GameImage img : GameImage.values()) {
|
||||||
if (img.isSkinnable())
|
if (img.isBeatmapSkinnable())
|
||||||
img.destroySkinImage();
|
img.destroyBeatmapSkinImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload scores
|
// reload scores
|
||||||
|
|
|
@ -107,11 +107,11 @@ public class Cursor {
|
||||||
public void draw(int mouseX, int mouseY, boolean mousePressed) {
|
public void draw(int mouseX, int mouseY, boolean mousePressed) {
|
||||||
// determine correct cursor image
|
// determine correct cursor image
|
||||||
Image cursor = null, cursorMiddle = null, cursorTrail = null;
|
Image cursor = null, cursorMiddle = null, cursorTrail = null;
|
||||||
boolean skinned = GameImage.CURSOR.hasSkinImage();
|
boolean skinned = GameImage.CURSOR.hasBeatmapSkinImage();
|
||||||
boolean newStyle, hasMiddle;
|
boolean newStyle, hasMiddle;
|
||||||
if (skinned) {
|
if (skinned) {
|
||||||
newStyle = true; // osu! currently treats all beatmap cursors as new-style cursors
|
newStyle = true; // osu! currently treats all beatmap cursors as new-style cursors
|
||||||
hasMiddle = GameImage.CURSOR_MIDDLE.hasSkinImage();
|
hasMiddle = GameImage.CURSOR_MIDDLE.hasBeatmapSkinImage();
|
||||||
} else
|
} else
|
||||||
newStyle = hasMiddle = Options.isNewCursorEnabled();
|
newStyle = hasMiddle = Options.isNewCursorEnabled();
|
||||||
if (skinned || newStyle) {
|
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() {
|
public void reset() {
|
||||||
// destroy skin images
|
// destroy skin images
|
||||||
GameImage.CURSOR.destroySkinImage();
|
GameImage.CURSOR.destroyBeatmapSkinImage();
|
||||||
GameImage.CURSOR_MIDDLE.destroySkinImage();
|
GameImage.CURSOR_MIDDLE.destroyBeatmapSkinImage();
|
||||||
GameImage.CURSOR_TRAIL.destroySkinImage();
|
GameImage.CURSOR_TRAIL.destroyBeatmapSkinImage();
|
||||||
|
|
||||||
// reset locations
|
// reset locations
|
||||||
resetLocations();
|
resetLocations();
|
||||||
|
@ -282,10 +282,10 @@ public class Cursor {
|
||||||
/**
|
/**
|
||||||
* Returns whether or not the cursor is skinned.
|
* Returns whether or not the cursor is skinned.
|
||||||
*/
|
*/
|
||||||
public boolean isSkinned() {
|
public boolean isBeatmapSkinned() {
|
||||||
return (GameImage.CURSOR.hasSkinImage() ||
|
return (GameImage.CURSOR.hasBeatmapSkinImage() ||
|
||||||
GameImage.CURSOR_MIDDLE.hasSkinImage() ||
|
GameImage.CURSOR_MIDDLE.hasBeatmapSkinImage() ||
|
||||||
GameImage.CURSOR_TRAIL.hasSkinImage());
|
GameImage.CURSOR_TRAIL.hasBeatmapSkinImage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user