summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-11 14:58:14 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-11 14:58:14 +0300
commitc14086d6a08fb2ea644eec9fafa0374604c98991 (patch)
tree29a00277b215a32e019fd06cab4b9ac709ac775c /src/net
parent7e19d626711ecf70035b32ee99098fc7fc3419fe (diff)
downloadplus-c14086d6a08fb2ea644eec9fafa0374604c98991.tar.gz
plus-c14086d6a08fb2ea644eec9fafa0374604c98991.tar.bz2
plus-c14086d6a08fb2ea644eec9fafa0374604c98991.tar.xz
plus-c14086d6a08fb2ea644eec9fafa0374604c98991.zip
Add relative pixel based position to item drops (floor items).
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/itemhandler.cpp37
-rw-r--r--src/net/ea/itemhandler.h4
-rw-r--r--src/net/tmwa/itemhandler.cpp7
3 files changed, 32 insertions, 16 deletions
diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp
index e08fe2cd1..7a6ee2743 100644
--- a/src/net/ea/itemhandler.cpp
+++ b/src/net/ea/itemhandler.cpp
@@ -35,28 +35,39 @@ ItemHandler::ItemHandler()
{
}
-void ItemHandler::processItemVisible(Net::MessageIn &msg, bool isDrop)
+void ItemHandler::processItemVisible(Net::MessageIn &msg)
{
int id = msg.readInt32();
int itemId = msg.readInt16();
unsigned char identify = msg.readInt8(); // identify flag
int x = msg.readInt16();
int y = msg.readInt16();
- int amount1 = msg.readInt16();
- int amount2 = msg.readInt16();
+ int amount = msg.readInt16();
+ int subX = msg.readInt8() + 16 - 8;
+ int subY = msg.readInt8() + 32 - 8;
if (actorSpriteManager)
{
- if (!isDrop)
- {
- actorSpriteManager->createItem(id, itemId,
- x, y, amount1, identify);
- }
- else
- {
- actorSpriteManager->createItem(id, itemId,
- x, y, amount2, identify);
- }
+ actorSpriteManager->createItem(id, itemId,
+ x, y, amount, identify, subX, subY);
+ }
+}
+
+void ItemHandler::processItemDropped(Net::MessageIn &msg)
+{
+ int id = msg.readInt32();
+ int itemId = msg.readInt16();
+ unsigned char identify = msg.readInt8(); // identify flag
+ int x = msg.readInt16();
+ int y = msg.readInt16();
+ int subX = msg.readInt8() + 16 - 8;
+ int subY = msg.readInt8() + 32 - 8;
+ int amount = msg.readInt16();
+
+ if (actorSpriteManager)
+ {
+ actorSpriteManager->createItem(id, itemId,
+ x, y, amount, identify, subX, subY);
}
}
diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h
index 1d0747c61..d5c268d2e 100644
--- a/src/net/ea/itemhandler.h
+++ b/src/net/ea/itemhandler.h
@@ -34,9 +34,11 @@ class ItemHandler
public:
ItemHandler();
- void processItemVisible(Net::MessageIn &msg, bool isDrop);
+ void processItemVisible(Net::MessageIn &msg);
void processItemRemove(Net::MessageIn &msg);
+
+ void processItemDropped(Net::MessageIn &msg);
};
} // namespace Ea
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index ce03044c7..d84d2f38d 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -48,9 +48,12 @@ void ItemHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_ITEM_VISIBLE:
+ processItemVisible(msg);
+ break;
+
case SMSG_ITEM_DROPPED:
- processItemVisible(msg, msg.getId() == SMSG_ITEM_DROPPED);
- break;
+ processItemDropped(msg);
+ break;
case SMSG_ITEM_REMOVE:
processItemRemove(msg);