revert 39b24b5 (attempt to load normal image if there's no array (load sliderb if there's no sliderb0, sliderb1 etc)) and fix it by loading the skin image before checking if default skin has multiple images (animation)

This commit is contained in:
yugecin 2017-02-02 01:15:10 +01:00
parent aff2ce9eee
commit a7813e1ffe

View File

@ -678,7 +678,7 @@ public enum GameImage {
if (defaultImage != null || defaultImages != null || Options.getSkin() == null) if (defaultImage != null || defaultImages != null || Options.getSkin() == null)
return; return;
// try to load multiple images // try to load skin images
File skinDir = Options.getSkin().getDirectory(); File skinDir = Options.getSkin().getDirectory();
if (filenameFormat != null) { if (filenameFormat != null) {
if (skinDir != null && ((defaultImages = loadImageArray(skinDir)) != null)) { if (skinDir != null && ((defaultImages = loadImageArray(skinDir)) != null)) {
@ -686,19 +686,21 @@ public enum GameImage {
process(); process();
return; return;
} }
}
if (skinDir != null && ((defaultImage = loadImageSingle(skinDir)) != null)) {
isSkinned = true;
process();
return;
}
// default images
if (filenameFormat != null) {
if ((defaultImages = loadImageArray(null)) != null) { if ((defaultImages = loadImageArray(null)) != null) {
isSkinned = false; isSkinned = false;
process(); process();
return; return;
} }
} }
// try to load a single image
if (skinDir != null && ((defaultImage = loadImageSingle(skinDir)) != null)) {
isSkinned = true;
process();
return;
}
if ((defaultImage = loadImageSingle(null)) != null) { if ((defaultImage = loadImageSingle(null)) != null) {
isSkinned = false; isSkinned = false;
process(); process();
@ -778,21 +780,6 @@ public enum GameImage {
break; break;
} }
} }
if (list.isEmpty()) {
// look for image without 0-1 etc
String name = getImageFileName(filename, dir, type, true);
if (name != null) {
try {
Image img = new Image(name);
if (suffix.equals(HD_SUFFIX))
img = img.getScaledCopy(0.5f);
list.add(img);
} catch (SlickException e) {
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to set image '%s'.", name), BubbleNotificationEvent.COMMONCOLOR_RED));
break;
}
}
}
if (!list.isEmpty()) if (!list.isEmpty())
return list.toArray(new Image[list.size()]); return list.toArray(new Image[list.size()]);
} }