mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-01 02:14:32 +07:00
Defer item inv file finish loading to future frame
This commit is contained in:
parent
ff7a27d334
commit
a1bca12d62
@ -384,9 +384,7 @@ public class Item extends Actor implements Disposable {
|
||||
if (invFileDescriptor != null) return;
|
||||
invFileDescriptor = new AssetDescriptor<>("data\\global\\items\\" + getInvFileName() + '.' + DC6.EXT, DC6.class);
|
||||
Riiablo.assets.load(invFileDescriptor);
|
||||
Riiablo.assets.finishLoadingAsset(invFileDescriptor);
|
||||
invFile = Riiablo.assets.get(invFileDescriptor);
|
||||
resize();
|
||||
checkLoaded();
|
||||
|
||||
invColormap = Riiablo.colormaps.get(base.InvTrans);
|
||||
String invColor = getInvColor();
|
||||
@ -399,6 +397,16 @@ public class Item extends Actor implements Disposable {
|
||||
// TODO: load the images of socketed items
|
||||
}
|
||||
|
||||
public boolean checkLoaded() {
|
||||
boolean b = Riiablo.assets.isLoaded(invFileDescriptor);
|
||||
if (b && invFile == null) {
|
||||
invFile = Riiablo.assets.get(invFileDescriptor);
|
||||
resize();
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
Riiablo.assets.unload(invFileDescriptor.fileName);
|
||||
@ -806,6 +814,7 @@ public class Item extends Actor implements Disposable {
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float a) {
|
||||
if (invFile == null && !checkLoaded()) return;
|
||||
PaletteIndexedBatch b = (PaletteIndexedBatch) batch;
|
||||
boolean ethereal = (flags & ETHEREAL) == ETHEREAL;
|
||||
if (ethereal) b.setAlpha(ETHEREAL_ALPHA);
|
||||
|
@ -386,7 +386,7 @@ public class InventoryPanel extends WidgetGroup implements Disposable {
|
||||
}
|
||||
|
||||
// FIXME: Alt images on weapons are slightly off by maybe a pixel or so (rounding?) -- backgrounds fine
|
||||
if (item != null) {
|
||||
if (item != null && item.checkLoaded()) {
|
||||
BBox box = item.invFile.getBox();
|
||||
item.setPosition(
|
||||
getX() + getWidth() / 2 - box.width / 2f + x,
|
||||
|
Loading…
Reference in New Issue
Block a user