Added support for dropping cursor item to ground

This commit is contained in:
Collin Smith 2020-05-30 16:30:02 -07:00
parent d910a6026a
commit 6280e89d8b
3 changed files with 13 additions and 1 deletions

View File

@ -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 {

View File

@ -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);
}

View File

@ -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);