summaryrefslogtreecommitdiff
path: root/src/net/tmwa/beinghandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-04 23:44:48 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-04 23:44:48 +0300
commit0eafefa3d40cf730749cd7fdfb94f73313e1a159 (patch)
treee3ed31b60d4adf148c15355a1827f4275e709724 /src/net/tmwa/beinghandler.cpp
parent9d4f90750bb47f918881790edf4c60c15aa37019 (diff)
downloadmv-0eafefa3d40cf730749cd7fdfb94f73313e1a159.tar.gz
mv-0eafefa3d40cf730749cd7fdfb94f73313e1a159.tar.bz2
mv-0eafefa3d40cf730749cd7fdfb94f73313e1a159.tar.xz
mv-0eafefa3d40cf730749cd7fdfb94f73313e1a159.zip
add support for getting full move path from server (evol only).
Also change netcode version to 10. Some times still movement bit wrong.
Diffstat (limited to 'src/net/tmwa/beinghandler.cpp')
-rw-r--r--src/net/tmwa/beinghandler.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 678be6cc4..6bbdac2e9 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -29,6 +29,7 @@
#include "guild.h"
#include "guildmanager.h"
#include "party.h"
+#include "position.h"
#include "being/localplayer.h"
#include "being/playerrelations.h"
@@ -95,6 +96,7 @@ BeingHandler::BeingHandler(const bool enableSync) :
SMSG_BEING_IP_RESPONSE,
SMSG_PVP_MAP_MODE,
SMSG_PVP_SET,
+ SMSG_BEING_MOVE3,
0
};
handledMessages = _messages;
@@ -121,6 +123,10 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
processBeingMove2(msg);
break;
+ case SMSG_BEING_MOVE3:
+ processBeingMove3(msg);
+ break;
+
case SMSG_BEING_SPAWN:
processBeingSpawn(msg);
break;
@@ -658,4 +664,40 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
dstBeing->setMoveTime();
}
+void BeingHandler::processBeingMove3(Net::MessageIn &msg) const
+{
+ if (serverVersion < 10)
+ return;
+
+ const static int dirx[8] = {0, -1, -1, -1, 0, 1, 1, 1};
+ const static int diry[8] = {1, 1, 0, -1, -1, -1, 0, 1};
+
+ const int len = msg.readInt16() - 14;
+ Being *const dstBeing = actorSpriteManager->findBeing(msg.readInt32());
+ if (!dstBeing)
+ return;
+ const int16_t speed = msg.readInt16();
+ dstBeing->setWalkSpeed(Vector(speed, speed, 0));
+ int16_t x = msg.readInt16();
+ int16_t y = msg.readInt16();
+ const unsigned char *moves = msg.readBytes(len);
+ Path path;
+ for (int f = 0; f < len; f ++)
+ {
+ const unsigned char dir = moves[f];
+ if (dir <= 7)
+ {
+ x += dirx[dir];
+ y += diry[dir];
+ path.push_back(Position(x, y));
+ }
+ else
+ {
+ logger->log("bad move packet: %d", dir);
+ }
+ }
+
+ dstBeing->setPath(path);
+}
+
} // namespace TmwAthena