Moved ItemData#drop and added ItemManager#dropCursor

This commit is contained in:
Collin Smith 2020-05-30 16:35:37 -07:00
parent 6280e89d8b
commit 7336c2a3b0
2 changed files with 12 additions and 8 deletions

View File

@ -14,6 +14,10 @@ public class ItemManager extends PassiveSystem {
protected ComponentMapper<Player> mPlayer;
public void dropCursor(int entityId) {
mPlayer.get(entityId).data.dropCursor();
}
public void storeToCursor(int entityId, int i) {
mPlayer.get(entityId).data.storeToCursor(i);
}

View File

@ -204,14 +204,6 @@ public class ItemData {
return copy;
}
void pickup(int i) {
assert cursor == INVALID_ITEM;
Item item = itemData.get(i);
if (item.location == Location.STORED) notifyStoreRemoved(item);
cursor = i;
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;
@ -220,6 +212,14 @@ public class ItemData {
setLocation(item, null);
}
void pickup(int i) {
assert cursor == INVALID_ITEM;
Item item = itemData.get(i);
if (item.location == Location.STORED) notifyStoreRemoved(item);
cursor = i;
setLocation(item, Location.CURSOR);
}
void storeCursor(StoreLoc storeLoc, int x, int y) {
assert cursor != INVALID_ITEM;
store(storeLoc, cursor, x, y);