diff options
author | Chuck Miller <shadowmil@gmail.com> | 2009-08-01 00:13:22 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2009-08-01 02:09:23 -0400 |
commit | ede286e65f1ccbf4ddfddba7be66467272440a13 (patch) | |
tree | 6c4bbe23e2e68a1bf1edc14beed4b064a8967d88 /src/net | |
parent | 299f987469192b7c77b4b724875b481a8fa83ced (diff) | |
download | mana-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.gz mana-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.bz2 mana-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.xz mana-ede286e65f1ccbf4ddfddba7be66467272440a13.zip |
Simplifies movement to only move to the current pos
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tmwserv/beinghandler.cpp | 46 | ||||
-rw-r--r-- | src/net/tmwserv/protocol.h | 2 |
2 files changed, 5 insertions, 43 deletions
diff --git a/src/net/tmwserv/beinghandler.cpp b/src/net/tmwserv/beinghandler.cpp index 2eed1dc3..93f76ce7 100644 --- a/src/net/tmwserv/beinghandler.cpp +++ b/src/net/tmwserv/beinghandler.cpp @@ -187,28 +187,14 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) Being *being = beingManager->findBeing(id); int sx = 0; int sy = 0; - int dx = 0; - int dy = 0; int speed = 0; if (flags & MOVING_POSITION) { - Uint16 sx2, sy2; - msg.readCoordinates(sx2, sy2); - sx = sx2 * 32 + 16; - sy = sy2 * 32 + 16; + sx = msg.readInt16(); + sy = msg.readInt16(); speed = msg.readInt8(); } - if (flags & MOVING_DESTINATION) - { - dx = msg.readInt16(); - dy = msg.readInt16(); - if (!(flags & MOVING_POSITION)) - { - sx = dx; - sy = dy; - } - } if (!being || !(flags & (MOVING_POSITION | MOVING_DESTINATION))) { continue; @@ -228,33 +214,9 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) if (being == player_node) continue; - // If being is a player, and he only moves a little, its ok to be a little out of sync - if (being->getType() == Being::PLAYER && abs(being->getPixelX() - dx) + - abs(being->getPixelY() - dy) < 16 && - (dx != being->getDestination().x && - dy != being->getDestination().y)) - { - being->setDestination(being->getPixelX(),being->getPixelY()); - continue; - } - if (abs(being->getPixelX() - sx) + - abs(being->getPixelY() - sy) > 10 * 32) - { - // Too large a desynchronization. - being->setPosition(sx, sy); - being->setDestination(dx, dy); - } - else if (!(flags & MOVING_POSITION)) - { - being->setDestination(dx, dy); - } - else if (!(flags & MOVING_DESTINATION)) - { - being->adjustCourse(sx, sy); - } - else + if (flags & MOVING_POSITION) { - being->setDestination(sx, sy, dx, dy); + being->setDestination(sx, sy); } } } diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h index 13a15256..90ff2437 100644 --- a/src/net/tmwserv/protocol.h +++ b/src/net/tmwserv/protocol.h @@ -104,7 +104,7 @@ enum { GPMSG_BEING_ACTION_CHANGE = 0x0271, // W being id, B action PGMSG_DIRECTION_CHANGE = 0x0272, // B Direction GPMSG_BEING_DIR_CHANGE = 0x0273, // W being id, B direction - GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* + GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, W*2 position, B speed] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* PGMSG_ATTACK = 0x0290, // W being id PGMSG_USE_SPECIAL = 0x0292, // B specialID |