diff --git a/core/src/com/riiablo/engine/client/CursorMovementSystem.java b/core/src/com/riiablo/engine/client/CursorMovementSystem.java index 75d739ba..be7633df 100644 --- a/core/src/com/riiablo/engine/client/CursorMovementSystem.java +++ b/core/src/com/riiablo/engine/client/CursorMovementSystem.java @@ -102,7 +102,7 @@ public class CursorMovementSystem extends BaseSystem { Vector2 position = mPosition.get(src).position; iso.toTile(tmpVec2.set(position)); - Riiablo.cursor.setItem(null); + Riiablo.charData.dropCursor(); if (socket == null) { factory.createItem(cursor, tmpVec2); } else { diff --git a/core/src/com/riiablo/save/CharData.java b/core/src/com/riiablo/save/CharData.java index 32f36c23..7e0504c1 100644 --- a/core/src/com/riiablo/save/CharData.java +++ b/core/src/com/riiablo/save/CharData.java @@ -380,6 +380,10 @@ public class CharData implements ItemData.UpdateListener, Pool.Poolable { return itemData; } + public void dropCursor() { + itemData.drop(); + } + public void itemToCursor(int i) { itemData.pickup(i); } diff --git a/core/src/com/riiablo/save/ItemData.java b/core/src/com/riiablo/save/ItemData.java index 3f27166a..737b80d2 100644 --- a/core/src/com/riiablo/save/ItemData.java +++ b/core/src/com/riiablo/save/ItemData.java @@ -212,6 +212,14 @@ public class ItemData { setLocation(item, Location.CURSOR); } + // TODO: should item location change if the item is dropped? is this what UNK3 and UNK5 represent? + void drop() { + assert cursor != INVALID_ITEM; + Item item = itemData.get(cursor); + cursor = INVALID_ITEM; + setLocation(item, null); + } + void storeCursor(StoreLoc storeLoc, int x, int y) { assert cursor != INVALID_ITEM; store(storeLoc, cursor, x, y);