summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-06-29 13:56:36 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-06-29 13:56:36 +0000
commit83282c3948f7f2af1e8b0d22d5ab2264c107b268 (patch)
treeb8c17e12040d158849c962d9cec58b81e3ae910f /src
parent4cd69c6a9327108a07d282011c14562e57aa9e86 (diff)
downloadmana-client-83282c3948f7f2af1e8b0d22d5ab2264c107b268.tar.gz
mana-client-83282c3948f7f2af1e8b0d22d5ab2264c107b268.tar.bz2
mana-client-83282c3948f7f2af1e8b0d22d5ab2264c107b268.tar.xz
mana-client-83282c3948f7f2af1e8b0d22d5ab2264c107b268.zip
Clients get notified of equipping visible items.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp1
-rw-r--r--src/being.h1
-rw-r--r--src/net/beinghandler.cpp33
-rw-r--r--src/player.cpp15
4 files changed, 32 insertions, 18 deletions
diff --git a/src/being.cpp b/src/being.cpp
index f5d03563..a0db8208 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -61,6 +61,7 @@ Being::Being(Uint32 id, Uint16 job, Map *map):
mSpriteset(NULL), mSpriteFrame(0)
{
setMap(map);
+ memset(mVisibleEquipment, 0, 6 * sizeof(int));
}
Being::~Being()
diff --git a/src/being.h b/src/being.h
index 685f786b..9970b5d1 100644
--- a/src/being.h
+++ b/src/being.h
@@ -302,6 +302,7 @@ class Being : public Sprite
getYOffset() const { return getOffset(UP, DOWN); }
std::auto_ptr<Equipment> mEquipment;
+ int mVisibleEquipment[6]; /**< Visible equipments */
protected:
/**
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index f8e6baef..b4e60b4e 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -106,7 +106,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->mJob = job;
dstBeing->setHairStyle(msg->readInt16());
dstBeing->setWeapon(msg->readInt16());
- msg->readInt16(); // head option bottom
+ dstBeing->mVisibleEquipment[3] = msg->readInt16(); // head (bottom)
if (msg->getId() == SMSG_BEING_MOVE)
{
@@ -114,8 +114,8 @@ void BeingHandler::handleMessage(MessageIn *msg)
}
msg->readInt16(); // shield
- msg->readInt16(); // head option top
- msg->readInt16(); // head option mid
+ dstBeing->mVisibleEquipment[4] = msg->readInt16(); // head (top)
+ dstBeing->mVisibleEquipment[5] = msg->readInt16(); // head (mid)
dstBeing->setHairColor(msg->readInt16());
msg->readInt16(); // unknown
msg->readInt16(); // head dir
@@ -255,19 +255,29 @@ void BeingHandler::handleMessage(MessageIn *msg)
{
break;
}
+
+ int type = msg->readInt8();
- switch (msg->readInt8()) {
+ switch (type) {
case 1:
dstBeing->setHairStyle(msg->readInt8());
break;
case 2:
dstBeing->setWeapon(msg->readInt8());
break;
+ case 3:
+ case 4:
+ case 5:
+ // Equip/unequip head 3. Bottom 4. Top 5. Bottom
+ dstBeing->mVisibleEquipment[type] = msg->readInt8();
+ // First 3 slots of mVisibleEquipments are reserved for
+ // later use, probably accessories.
+ break;
case 6:
dstBeing->setHairColor(msg->readInt8());
break;
default:
- msg->readInt8(); // unsupported
+ printf("c3: %i\n", msg->readInt8()); // unsupported
break;
}
break;
@@ -302,20 +312,20 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setHairStyle(msg->readInt16());
dstBeing->setWeaponById(msg->readInt16()); // item id 1
msg->readInt16(); // item id 2
- msg->readInt16(); // head option bottom
+ dstBeing->mVisibleEquipment[3] = msg->readInt16(); // head (bottom)
if (msg->getId() == SMSG_PLAYER_MOVE)
{
msg->readInt32(); // server tick
}
- msg->readInt16(); // head option top
- msg->readInt16(); // head option mid
+ dstBeing->mVisibleEquipment[4] = msg->readInt16(); // head (top)
+ dstBeing->mVisibleEquipment[5] = msg->readInt16(); // head (mid)
dstBeing->setHairColor(msg->readInt16());
msg->readInt16(); // unknown
msg->readInt16(); // head dir
- msg->readInt32(); // guild
- msg->readInt32(); // emblem
+ msg->readInt32(); // guild
+ msg->readInt32(); // emblem
msg->readInt16(); // manner
msg->readInt8(); // karma
dstBeing->setSex(1 - msg->readInt8()); // sex
@@ -358,6 +368,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
case 0x0119:
// Change in players look
+ printf("0x0119 %i %i %i %x %i\n", msg->readInt32(),
+ msg->readInt16(), msg->readInt16(), msg->readInt16(),
+ msg->readInt8());
break;
}
}
diff --git a/src/player.cpp b/src/player.cpp
index 847137e0..b014a390 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -131,14 +131,6 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY)
graphics->drawImage(playerset[mSex]->get(frame + 18 * dir),
px - 16, py - 32);
- // Display a shirt if equipped
- Item *item = mEquipment->getEquipment(8);
- if (item)
- {
- graphics->drawImage(equipmentset->get(frame + 18 * dir),
- px - 16, py - 32);
- }
-
if (getWeapon() != 0 && mAction == ATTACK)
{
int frames = 4;
@@ -158,6 +150,13 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY)
px + 1 + hairtable[frame][dir][0],
py - 33 + hairtable[frame][dir][1]);
}
+
+ // Display middle equipment
+ if (mVisibleEquipment[5])
+ {
+ graphics->drawImage(equipmentset->get(frame + 18 * dir),
+ px - 16, py - 32);
+ }
}
void