diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/net/beinghandler.cpp | 22 | ||||
-rw-r--r-- | src/net/beinghandler.h | 1 | ||||
-rw-r--r-- | src/net/protocol.h | 3 |
4 files changed, 31 insertions, 2 deletions
@@ -1,4 +1,9 @@ -2007-07-11 Bjørn Lindeijer <bjorn@lindeijer.nl> +2007-07-12 Guillaume Melquiond <guillaume.melquiond@gmail.com> + + * src/net/beinghandler.cpp, src/net/beinghandler.h, src/net/protocol.h: + Added support for visible equipment. + +2007-07-11 Bjørn Lindeijer <bjorn@lindeijer.nl> * src/gui/window.cpp: Fixed resizing windows by their resize grip. diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index e88914ac..a6bc7fc3 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -60,6 +60,7 @@ BeingHandler::BeingHandler() GPMSG_BEINGS_MOVE, GPMSG_BEINGS_DAMAGE, GPMSG_BEING_ACTION_CHANGE, + GPMSG_BEING_LOOKS_CHANGE, 0 }; handledMessages = _messages; @@ -96,6 +97,9 @@ void BeingHandler::handleMessage(MessageIn &msg) case GPMSG_BEING_ACTION_CHANGE: handleBeingActionChangeMessage(msg); break; + case GPMSG_BEING_LOOKS_CHANGE: + handleBeingLooksChangeMessage(msg); + break; /* case SMSG_BEING_VISIBLE: @@ -411,6 +415,14 @@ void BeingHandler::handleMessage(MessageIn &msg) } } +static void handleLooks(Being *being, MessageIn &msg) +{ + being->setWeapon(msg.readShort()); + being->setVisibleEquipment(Being::HAT_SPRITE, msg.readShort()); + being->setVisibleEquipment(Being::TOPCLOTHES_SPRITE, msg.readShort()); + being->setVisibleEquipment(Being::BOTTOMCLOTHES_SPRITE, msg.readShort()); +} + void BeingHandler::handleBeingEnterMessage(MessageIn &msg) { @@ -443,7 +455,9 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg) being->mY = py; being->setDestination(px, py); being->setAction(action); + handleLooks(being, msg); } break; + case OBJECT_MONSTER: { int monsterId = msg.readShort(); @@ -546,3 +560,11 @@ void BeingHandler::handleBeingActionChangeMessage(MessageIn &msg) being->setAction((Being::Action) msg.readByte()); } + +void BeingHandler::handleBeingLooksChangeMessage(MessageIn &msg) +{ + Being *being = beingManager->findBeing(msg.readShort()); + if (!being) return; + handleLooks(being, msg); +} + diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index 7a018950..d2a332a8 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -40,6 +40,7 @@ class BeingHandler : public MessageHandler void handleBeingsMoveMessage(MessageIn &msg); void handleBeingsDamageMessage(MessageIn &msg); void handleBeingActionChangeMessage(MessageIn &msg); + void handleBeingLooksChangeMessage(MessageIn &msg); }; #endif diff --git a/src/net/protocol.h b/src/net/protocol.h index b5dc2996..ba16e99d 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -163,10 +163,11 @@ enum { GPMSG_INVENTORY_FULL = 0x0121, // { B slot, W item id [, B amount] }* GPMSG_PLAYER_ATTRIBUTE_UPDATE = 0x0130, // { W attribute, W value }* GPMSG_BEING_ENTER = 0x0200, // B type, W being id, B action, W*2 position - // player: S name, B hair style, B hair color, B gender + // player: S name, B hair style, B hair color, B gender, W weapon, W hat, W top clothes, W bottom clothes // monster: W type id GPMSG_BEING_LEAVE = 0x0201, // W being id GPMSG_ITEM_APPEAR = 0x0202, // W item id, W*2 position + GPMSG_BEING_LOOKS_CHANGE = 0x0210, // W weapon, W hat, W top clothes, W bottom clothes PGMSG_WALK = 0x0260, // W*2 destination PGMSG_ACTION_CHANGE = 0x0270, // B Action GPMSG_BEING_ACTION_CHANGE = 0x0271, // W being id, B action |