diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-07-25 20:22:41 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-07-25 20:22:41 +0000 |
commit | 88b3f92061c703fdf6cf0f970684fb77de6d8795 (patch) | |
tree | 881b72c8d80857787938b128ab5449109953c248 /src/net | |
parent | 25db7453b0027863ae4b966a91fb3653d73d324c (diff) | |
download | mana-client-88b3f92061c703fdf6cf0f970684fb77de6d8795.tar.gz mana-client-88b3f92061c703fdf6cf0f970684fb77de6d8795.tar.bz2 mana-client-88b3f92061c703fdf6cf0f970684fb77de6d8795.tar.xz mana-client-88b3f92061c703fdf6cf0f970684fb77de6d8795.zip |
Added being speed to protocol.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/beinghandler.cpp | 12 | ||||
-rw-r--r-- | src/net/protocol.h | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index bce2c3b8..44b1a7af 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -487,7 +487,6 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg) int monsterId = msg.readShort(); Being *being; being = beingManager->createBeing(id, monsterId); - being->setWalkSpeed(150); // TODO being->mX = px; being->mY = py; being->setDestination(px, py); @@ -519,16 +518,17 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) { while (msg.getUnreadLength()) { - Uint16 id = msg.readShort(); - Uint8 flags = msg.readByte(); + int id = msg.readShort(); + int flags = msg.readByte(); Being *being = beingManager->findBeing(id); - int sx = 0, sy = 0, dx = 0, dy = 0; + int sx = 0, sy = 0, dx = 0, dy = 0, speed = 0; if (flags & MOVING_POSITION) { Uint16 sx2, sy2; msg.readCoordinates(sx2, sy2); sx = sx2 * 32 + 16; sy = sy2 * 32 + 16; + speed = msg.readByte(); } if (flags & MOVING_DESTINATION) { @@ -544,6 +544,10 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) { continue; } + if (speed) + { + being->setWalkSpeed(speed * 10); + } if (abs(being->mX - sx) + abs(being->mY - sy) > 4 * 32) { // Too large a desynchronization. diff --git a/src/net/protocol.h b/src/net/protocol.h index 8fe7e1b6..1a20b0a4 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -172,7 +172,7 @@ enum { PGMSG_WALK = 0x0260, // W*2 destination PGMSG_ACTION_CHANGE = 0x0270, // B Action GPMSG_BEING_ACTION_CHANGE = 0x0271, // W being id, B action - GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position] [, W*2 destination] }* + GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* PGMSG_ATTACK = 0x0290, // B direction GPMSG_BEING_ATTACK = 0x0291, // W being id |