summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/net/beinghandler.cpp12
-rw-r--r--src/net/protocol.h2
3 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c33ff8e..b27becc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-25 Guillaume Melquiond <guillaume.melquiond@gmail.com>
+
+ * src/net/beinghandler.cpp, src/net/protocol.h: Added being speed to
+ protocol.
+
2007-07-23 Eugenio Favalli <elvenprogrammer@gmail.com>
* data/maps/new_1-1.tar.gz, data/maps/new_3-1.tar.gz: Fixed warp
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