summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-08-01 00:13:22 -0400
committerChuck Miller <shadowmil@gmail.com>2009-08-01 02:09:23 -0400
commitede286e65f1ccbf4ddfddba7be66467272440a13 (patch)
tree6c4bbe23e2e68a1bf1edc14beed4b064a8967d88
parent299f987469192b7c77b4b724875b481a8fa83ced (diff)
downloadmana-client-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.gz
mana-client-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.bz2
mana-client-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.xz
mana-client-ede286e65f1ccbf4ddfddba7be66467272440a13.zip
Simplifies movement to only move to the current pos
-rw-r--r--src/localplayer.cpp16
-rw-r--r--src/net/tmwserv/beinghandler.cpp46
-rw-r--r--src/net/tmwserv/protocol.h2
3 files changed, 8 insertions, 56 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 4e9257ca..ff3267ad 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -375,16 +375,6 @@ void LocalPlayer::walk(unsigned char dir)
}
int dx = 0, dy = 0;
-#ifdef TMWSERV_SUPPORT
- if (dir & UP)
- dy -= 32;
- if (dir & DOWN)
- dy += 32;
- if (dir & LEFT)
- dx -= 32;
- if (dir & RIGHT)
- dx += 32;
-#else
if (dir & UP)
dy--;
if (dir & DOWN)
@@ -393,7 +383,6 @@ void LocalPlayer::walk(unsigned char dir)
dx--;
if (dir & RIGHT)
dx++;
-#endif
// Prevent skipping corners over colliding tiles
#ifdef TMWSERV_SUPPORT
@@ -420,7 +409,7 @@ void LocalPlayer::walk(unsigned char dir)
// Checks our path up to 1 tiles, if a blocking tile is found
// We go to the last good tile, and break out of the loop
- for (dScaler = 1; dScaler <= 1; dScaler++)
+ for (dScaler = 1; dScaler <= 32; dScaler++)
{
if ( (dx || dy) &&
!mMap->getWalk( ((int) pos.x + (dx * dScaler)) / 32,
@@ -433,7 +422,8 @@ void LocalPlayer::walk(unsigned char dir)
if (dScaler >= 0)
{
- setDestination((int) pos.x + (dx * dScaler), (int) pos.y + (dy * dScaler));
+ effectManager->trigger(15, (int) pos.x + (dx * dScaler), (int) pos.y + (dy * dScaler));
+ setDestination((int) pos.x + (dx * dScaler), (int) pos.y + (dy * dScaler));
}
#else
if (dx && dy && !mMap->getWalk(getTileX() + dx, getTileY() + dy, getWalkMask()))
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