diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-04 23:44:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-04 23:44:48 +0300 |
commit | 0eafefa3d40cf730749cd7fdfb94f73313e1a159 (patch) | |
tree | e3ed31b60d4adf148c15355a1827f4275e709724 | |
parent | 9d4f90750bb47f918881790edf4c60c15aa37019 (diff) | |
download | mv-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.
-rw-r--r-- | src/being/being.h | 2 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 42 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/protocol.h | 1 |
7 files changed, 50 insertions, 4 deletions
diff --git a/src/being/being.h b/src/being/being.h index 29b735956..b08cba443 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -900,12 +900,12 @@ class Being : public ActorSprite, public ConfigListener NextSoundInfo mNextSound; - protected: /** * Sets the new path for this being. */ void setPath(const Path &path); + protected: /** * Updates name's location. */ diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 7c5c2598c..20b7b23f6 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -306,7 +306,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, { dstBeing->setAction(Being::STAND); dstBeing->setTileCoords(srcX, srcY); - dstBeing->setDestination(dstX, dstY); + if (serverVersion < 10) + dstBeing->setDestination(dstX, dstY); } } else 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 diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index c008d12be..eea967168 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/beinghandler.h @@ -54,6 +54,8 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler virtual void processPlayerMoveUpdate(Net::MessageIn &msg, const int type) const; + + virtual void processBeingMove3(Net::MessageIn &msg) const; }; } // namespace TmwAthena diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 417a3633e..a77fbbf7c 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -83,7 +83,7 @@ int16_t packet_lengths[] = // #0x0200 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0, 2, -1, 16, 0, 8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 122, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -1, 122, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static const int packet_lengths_size diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 62104592b..29b9de002 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -32,7 +32,7 @@ * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 9 +#define CLIENT_PROTOCOL_VERSION 10 #define CLIENT_TMW_PROTOCOL_VERSION 1 namespace TmwAthena diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index a2d68da7d..9a4e39b85 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -349,6 +349,7 @@ enum #define CMSG_SET_STATUS 0x0213 #define SMSG_QUEST_SET_VAR 0x0214 #define SMSG_QUEST_PLAYER_VARS 0x0215 +#define SMSG_BEING_MOVE3 0x0225 #define CMSG_SEND_CLIENT_INFO 0x7533 #define SMSG_UPDATE_HOST2 0x7534 |