diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-17 02:21:53 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-17 03:55:25 +0200 |
commit | abeb003b88cc49ba70cdadd2e3adec6eca1751ec (patch) | |
tree | c0f93a83772ef372f3d610948b6f995acd5bf6ce /src/net | |
parent | 59dc0bffc0f754de8daed29bce3a48e90ea6b4fb (diff) | |
download | manaplus-abeb003b88cc49ba70cdadd2e3adec6eca1751ec.tar.gz manaplus-abeb003b88cc49ba70cdadd2e3adec6eca1751ec.tar.bz2 manaplus-abeb003b88cc49ba70cdadd2e3adec6eca1751ec.tar.xz manaplus-abeb003b88cc49ba70cdadd2e3adec6eca1751ec.zip |
Fix other players move animation.
As dirty hack added delayed direction.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 2d0ae3c70..fb3ac44be 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -168,6 +168,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) int hairStyle, hairColor, flag; int hp, maxHP, oldHP; unsigned char colors[9]; + Uint8 dir; switch (msg.getId()) { @@ -859,6 +860,13 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) break; } + dir = dstBeing->getDirectionDelayed(); + if (dir) + { + if (dir != dstBeing->getDirection()) + dstBeing->setDirection(dir); + } + if (Party *party = player_node->getParty()) { if (party->isMember(id)) @@ -941,18 +949,26 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) // because server dont send direction in move packet, // we fixing it - int dir = 0; - if (dstX > srcX) - dir |= Being::RIGHT; - else if (dstX < srcX) - dir |= Being::LEFT; - if (dstY > srcY) - dir |= Being::DOWN; - else if (dstY < srcY) - dir |= Being::UP; - - if (dir) - dstBeing->setDirection(dir); + if (srcX != dstX || srcY != dstY) + { + int dir = 0; + if (dstX > srcX) + dir |= Being::RIGHT; + else if (dstX < srcX) + dir |= Being::LEFT; + if (dstY > srcY) + dir |= Being::DOWN; + else if (dstY < srcY) + dir |= Being::UP; + + if (dir && dstBeing->getDirection() != dir) + { + dstBeing->setDirectionDelayed(dir); +// dstBeing->clearPath(); +// dstBeing->reset(); + } + } + if (player_node->getCurrentAction() != Being::STAND) player_node->imitateAction(dstBeing, Being::STAND); @@ -1023,8 +1039,12 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) msg.readInt8(); // unknown - dstBeing->setActionTime(tick_time); - dstBeing->reset(); + if (dstBeing->getType() != Being::PLAYER + || msg.getId() != SMSG_PLAYER_MOVE) + { + dstBeing->setActionTime(tick_time); +// dstBeing->reset(); + } dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, (statusEffects >> 16) & 0xffff); |