summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-09 12:14:21 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-09 12:14:21 +0100
commit59a01fcf92ce43caf6b385659deddfa49c086ee8 (patch)
tree96060e18caf57f146fd38176f49d0e456ad06944 /src/net/manaserv
parentf704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d (diff)
downloadmana-client-59a01fcf92ce43caf6b385659deddfa49c086ee8.tar.gz
mana-client-59a01fcf92ce43caf6b385659deddfa49c086ee8.tar.bz2
mana-client-59a01fcf92ce43caf6b385659deddfa49c086ee8.tar.xz
mana-client-59a01fcf92ce43caf6b385659deddfa49c086ee8.zip
Fix other direction discrepancies on the client.
This fix the change dir (with alt key), attacks directions, and the direction of a being standing when you come in its range. Reviewed-by: Jaxad. Resolves: Mana-mantis #257
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/beinghandler.cpp23
-rw-r--r--src/net/manaserv/manaserv_protocol.h10
2 files changed, 10 insertions, 23 deletions
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp
index 12a044ee..6e9b3645 100644
--- a/src/net/manaserv/beinghandler.cpp
+++ b/src/net/manaserv/beinghandler.cpp
@@ -155,6 +155,7 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg)
Being::Action action = (Being::Action)msg.readInt8();
int px = msg.readInt16();
int py = msg.readInt16();
+ BeingDirection direction = (BeingDirection)msg.readInt8();
Being *being;
switch (type)
@@ -196,6 +197,7 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg)
being->setPosition(px, py);
being->setDestination(px, py);
+ being->setDirection(direction);
being->setAction(action);
}
@@ -257,19 +259,13 @@ void BeingHandler::handleBeingsMoveMessage(Net::MessageIn &msg)
void BeingHandler::handleBeingAttackMessage(Net::MessageIn &msg)
{
Being *being = actorSpriteManager->findBeing(msg.readInt16());
- const int direction = msg.readInt8();
+ const BeingDirection direction = (BeingDirection) msg.readInt8();
const int attackType = msg.readInt8();
if (!being)
return;
- switch (direction)
- {
- case DIRECTION_UP: being->setDirection(Being::UP); break;
- case DIRECTION_DOWN: being->setDirection(Being::DOWN); break;
- case DIRECTION_LEFT: being->setDirection(Being::LEFT); break;
- case DIRECTION_RIGHT: being->setDirection(Being::RIGHT); break;
- }
+ being->setDirection(direction);
being->setAction(Being::ATTACK, attackType);
}
@@ -349,16 +345,7 @@ void BeingHandler::handleBeingDirChangeMessage(Net::MessageIn &msg)
// The direction for the player's character is handled on client side.
if (being != player_node)
- {
- switch (data)
- {
- case DIRECTION_UP: being->setDirection(Being::UP); break;
- case DIRECTION_DOWN: being->setDirection(Being::DOWN); break;
- case DIRECTION_LEFT: being->setDirection(Being::LEFT); break;
- case DIRECTION_RIGHT: being->setDirection(Being::RIGHT); break;
- default: break;
- }
- }
+ being->setDirection((BeingDirection) data);
}
} // namespace ManaServ
diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h
index 1dbe38f8..577320b6 100644
--- a/src/net/manaserv/manaserv_protocol.h
+++ b/src/net/manaserv/manaserv_protocol.h
@@ -103,7 +103,7 @@ enum {
PGMSG_LOWER_ATTRIBUTE = 0x0170, // W attribute
GPMSG_LOWER_ATTRIBUTE_RESPONSE = 0x0171, // B error, W attribute
PGMSG_RESPAWN = 0x0180, // -
- GPMSG_BEING_ENTER = 0x0200, // B type, W being id, B action, W*2 position
+ GPMSG_BEING_ENTER = 0x0200, // B type, W being id, B action, W*2 position, B direction
// character: S name, B hair style, B hair color, B gender, B item bitmask, { W item id }*
// monster: W type id
// npc: W type id
@@ -415,10 +415,10 @@ enum AttackType
*/
enum BeingDirection
{
- DIRECTION_UP = 1,
- DIRECTION_DOWN,
- DIRECTION_LEFT,
- DIRECTION_RIGHT
+ DOWN = 1,
+ LEFT = 2,
+ UP = 4,
+ RIGHT = 8
};
/**