diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 8bd34bd7d..5393ca4e9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -188,7 +188,10 @@ public class Heap implements Bundlable { } if (sprite != null) { - sprite.view( image(), glowing() ); + if (type == Type.HEAP || type == Type.FOR_SALE) + sprite.view( item ); + else + sprite.view( image(), glowing() ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java index e1d98f622..d1b72d536 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java @@ -160,6 +160,7 @@ public class ItemSprite extends MovieClip { } public ItemSprite view(Item item){ + view(item.image(), item.glowing()); if (this.emitter != null) this.emitter.on = false; Emitter emitter = item.emitter(); if (emitter != null && parent != null) { @@ -167,10 +168,12 @@ public class ItemSprite extends MovieClip { parent.add( emitter ); this.emitter = emitter; } - return view(item.image(), item.glowing()); + return this; } public ItemSprite view( int image, Glowing glowing ) { + if (this.emitter != null) this.emitter.on = false; + emitter = null; frame( film.get( image ) ); if ((this.glowing = glowing) == null) { resetColor(); @@ -178,6 +181,12 @@ public class ItemSprite extends MovieClip { return this; } + @Override + public void kill() { + super.kill(); + if (emitter != null) emitter.on = false; + } + @Override public void update() { super.update(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java index 950ac9bd8..03242748a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java @@ -44,10 +44,10 @@ public class IconTitle extends Component { } public IconTitle( Item item ) { - this( - new ItemSprite( item ), - Utils.capitalize( item.toString() ) ); - + ItemSprite icon = new ItemSprite(); + icon( icon ); + label( Utils.capitalize( item.toString() ) ); + icon.view( item ); } public IconTitle( Image icon, String label ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java index d471726e9..fd16aa7ac 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java @@ -40,9 +40,7 @@ public class WndItem extends Window { super(); - IconTitle titlebar = new IconTitle(); - titlebar.icon( new ItemSprite( item ) ); - titlebar.label( Utils.capitalize( item.toString() ) ); + IconTitle titlebar = new IconTitle( item ); titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar );