summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog21
-rw-r--r--src/being.h1
-rw-r--r--src/net/beinghandler.cpp80
-rw-r--r--src/net/equipmenthandler.cpp20
-rw-r--r--src/net/protocol.h1
5 files changed, 68 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 2bd44078..0b3f1119 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,17 @@
+2008-05-30 Lloyd Bryant <lloyd_bryant@netzero.net>
+
+ * src/net/equipmenthandler.cpp, src/net/beinghandler.cpp,
+ src/net/protocol.h, src/being.h: Merged handling for eAthena packets
+ 0x00c3 and 0x01d7 and added support for displaying a shield sprite.
+
2008-05-28 Philipp Sehmisch <tmw@crushnet.org>
- * src/particle.cpp: Changed the way particle emitter skip is handled to
- make linear and circular emitters work with particleEmitterSkip enabled.
- * src/gui/setup.cpp, src/gui/setup_video.cpp, src/gui/setup_video.h: Added
- slider for controlling particleEmitterSkip (overall quality of particle
- effects) to video setup menu.
+ * src/particle.cpp: Changed the way particle emitter skip is handled
+ to make linear and circular emitters work with particleEmitterSkip
+ enabled.
+ * src/gui/setup.cpp, src/gui/setup_video.cpp, src/gui/setup_video.h:
+ Added slider for controlling particleEmitterSkip (overall quality of
+ particle effects) to video setup menu.
2008-05-28 Dennis Friis <peavey@placid.dk>
@@ -14,8 +21,8 @@
2008-05-27 David Athay <ko2fan@gmail.com>
- * src/main.cpp, src/player_relations.cpp: Changed OSX tmw directory to a
- more suitable location, and fixed compile error.
+ * src/main.cpp, src/player_relations.cpp: Changed OSX tmw directory to
+ a more suitable location, and fixed compile error.
2008-05-22 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/being.h b/src/being.h
index 277c673e..5ea8c0be 100644
--- a/src/being.h
+++ b/src/being.h
@@ -96,6 +96,7 @@ class Being : public Sprite
HAIR_SPRITE,
HAT_SPRITE,
WEAPON_SPRITE,
+ SHIELD_SPRITE,
VECTOREND_SPRITE
};
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 959a4972..be8412d9 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -50,6 +50,7 @@ BeingHandler::BeingHandler()
SMSG_BEING_LEVELUP,
SMSG_BEING_EMOTION,
SMSG_BEING_CHANGE_LOOKS,
+ SMSG_BEING_CHANGE_LOOKS2,
SMSG_BEING_NAME_RESPONSE,
SMSG_PLAYER_UPDATE_1,
SMSG_PLAYER_UPDATE_2,
@@ -64,7 +65,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
{
Uint32 id;
Uint16 job, speed;
- Uint16 headBottom, headTop, headMid;
+ Uint16 headTop, headMid, headBottom;
Sint16 param1;
Sint8 type;
Being *srcBeing, *dstBeing;
@@ -109,23 +110,19 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setWalkSpeed(speed);
dstBeing->mJob = job;
hairStyle = msg->readInt16();
- dstBeing->setSprite(
- Being::WEAPON_SPRITE, msg->readInt16());
- dstBeing->setSprite(
- Being::BOTTOMCLOTHES_SPRITE, msg->readInt16());
+ dstBeing->setSprite(Being::WEAPON_SPRITE, msg->readInt16());
+ headBottom = msg->readInt16();
if (msg->getId() == SMSG_BEING_MOVE)
{
msg->readInt32(); // server tick
}
- msg->readInt16(); // shield
+ dstBeing->setSprite(Being::SHIELD_SPRITE, msg->readInt16());
headTop = msg->readInt16();
headMid = msg->readInt16();
- dstBeing->setSprite(Being::HAT_SPRITE, headTop);
- dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
hairColor = msg->readInt16();
- msg->readInt16(); // unknown
+ msg->readInt16(); // clothes color -not used
msg->readInt16(); // head dir
msg->readInt16(); // guild
msg->readInt16(); // unknown
@@ -134,6 +131,11 @@ void BeingHandler::handleMessage(MessageIn *msg)
msg->readInt16(); // karma
msg->readInt8(); // unknown
dstBeing->setGender(1 - msg->readInt8()); // gender
+
+ // Set these after the gender, as the sprites may be gender-specific
+ dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
+ dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
+ dstBeing->setSprite(Being::HAT_SPRITE, headTop);
dstBeing->setHairStyle(hairStyle, hairColor);
if (msg->getId() == SMSG_BEING_MOVE)
@@ -252,37 +254,59 @@ void BeingHandler::handleMessage(MessageIn *msg)
break;
case SMSG_BEING_CHANGE_LOOKS:
+ case SMSG_BEING_CHANGE_LOOKS2:
{
+ /*
+ * SMSG_BEING_CHANGE_LOOKS (0x00c3) and
+ * SMSG_BEING_CHANGE_LOOKS2 (0x01d7) do basically the same
+ * thing. The difference is that ...LOOKS carries a single
+ * 8 bit value, where ...LOOKS2 carries two 16 bit values.
+ *
+ * If type = 2, then the first 16 bit value is the weapon ID,
+ * and the second 16 bit value is the shield ID. If no
+ * shield is equipped, or type is not 2, then the second
+ * 16 bit value will be 0.
+ */
+
if (!(dstBeing = beingManager->findBeing(msg->readInt32())))
{
break;
}
int type = msg->readInt8();
- int id = msg->readInt8();
+ int id = 0;
+ int id2 = 0;
+
+ if (msg->getId() == SMSG_BEING_CHANGE_LOOKS) {
+ id = msg->readInt8();
+ } else { // SMSG_BEING_CHANGE_LOOKS2
+ id = msg->readInt16();
+ id2 = msg->readInt16();
+ }
switch (type) {
- case 1:
+ case 1: // eAthena LOOK_HAIR
dstBeing->setHairStyle(id, -1);
break;
- case 2:
+ case 2: // Weapon ID in id, Shield ID in id2
dstBeing->setSprite(Being::WEAPON_SPRITE, id);
+ dstBeing->setSprite(Being::SHIELD_SPRITE, id2);
break;
case 3: // Change lower headgear for eAthena, pants for us
- dstBeing->setSprite(
- Being::BOTTOMCLOTHES_SPRITE, id);
+ dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, id);
break;
case 4: // Change upper headgear for eAthena, hat for us
- dstBeing->setSprite(
- Being::HAT_SPRITE, id);
+ dstBeing->setSprite(Being::HAT_SPRITE, id);
break;
case 5: // Change middle headgear for eathena, armor for us
- dstBeing->setSprite(
- Being::TOPCLOTHES_SPRITE, id);
+ dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, id);
break;
- case 6:
+ case 6: // eAthena LOOK_HAIR_COLOR
dstBeing->setHairStyle(-1, id);
break;
+ case 9: // eAthena LOOK_SHOES
+ dstBeing->setSprite(Being::SHOE_SPRITE, id);
+ break;
default:
logger->log("SMSG_BEING_CHANGE_LOOKS: unsupported type: "
"%d, id: %d", type, id);
@@ -319,10 +343,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setWalkSpeed(speed);
dstBeing->mJob = job;
hairStyle = msg->readInt16();
- dstBeing->setSprite(
- Being::WEAPON_SPRITE, msg->readInt16());
- msg->readInt16(); // item id 2
- headBottom = msg->readInt16();
+ dstBeing->setSprite(Being::WEAPON_SPRITE, msg->readInt16());
+ dstBeing->setSprite(Being::SHIELD_SPRITE, msg->readInt16());
+ headBottom = msg->readInt16();
if (msg->getId() == SMSG_PLAYER_MOVE)
{
@@ -332,18 +355,19 @@ void BeingHandler::handleMessage(MessageIn *msg)
headTop = msg->readInt16();
headMid = msg->readInt16();
hairColor = msg->readInt16();
- msg->readInt16(); // unknown
+ msg->readInt16(); // clothes color - not used
msg->readInt16(); // head dir
msg->readInt32(); // guild
msg->readInt32(); // emblem
msg->readInt16(); // manner
msg->readInt8(); // karma
dstBeing->setGender(1 - msg->readInt8()); // gender
- dstBeing->setHairStyle(hairStyle, hairColor);
- dstBeing->setSprite(
- Being::BOTTOMCLOTHES_SPRITE, headBottom);
- dstBeing->setSprite(Being::HAT_SPRITE, headTop);
+
+ // Set these after the gender, as the sprites may be gender-specific
+ dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
+ dstBeing->setSprite(Being::HAT_SPRITE, headTop);
+ dstBeing->setHairStyle(hairStyle, hairColor);
if (msg->getId() == SMSG_PLAYER_MOVE)
{
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index 84da9365..69f24d80 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -26,7 +26,6 @@
#include "messagein.h"
#include "protocol.h"
-#include "../being.h"
#include "../beingmanager.h"
#include "../equipment.h"
#include "../item.h"
@@ -40,7 +39,6 @@ EquipmentHandler::EquipmentHandler()
static const Uint16 _messages[] = {
SMSG_PLAYER_EQUIPMENT,
SMSG_PLAYER_EQUIP,
- 0x01d7,
SMSG_PLAYER_UNEQUIP,
SMSG_PLAYER_ARROW_EQUIP,
SMSG_PLAYER_ATTACK_RANGE,
@@ -55,7 +53,6 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
Sint16 index, equipPoint, itemId;
Sint8 type;
int mask, position;
- Being *being;
Item *item;
switch (msg->getId())
@@ -127,23 +124,6 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
player_node->mEquipment->setEquipment(position, item);
break;
- case 0x01d7:
- // Equipment related. At least confirmed to be required for weapon
- // changes to appear on the local player.
- being = beingManager->findBeing(msg->readInt32());
- msg->readInt8(); // equip point
- itemId = msg->readInt16();
- msg->readInt16(); // item id 2
- logger->log("0x01d7 (%s, itemId = %d)",
- (being == player_node) ? "player" : "somebody else",
- itemId);
-
- if (!being)
- break;
-
- being->setSprite(Being::WEAPON_SPRITE, itemId);
- break;
-
case SMSG_PLAYER_UNEQUIP:
index = msg->readInt16();
equipPoint = msg->readInt16();
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 1e76ce1c..811d5481 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -57,6 +57,7 @@
#define SMSG_BEING_MOVE 0x007b /**< A nearby monster moves */
#define SMSG_BEING_REMOVE 0x0080
#define SMSG_BEING_CHANGE_LOOKS 0x00c3
+#define SMSG_BEING_CHANGE_LOOKS2 0x01d7 /**< Same as 0x00c3, but 16 bit ID */
#define SMSG_BEING_LEVELUP 0x019b
#define SMSG_BEING_EMOTION 0x00c0
#define SMSG_BEING_ACTION 0x008a /**< Attack, sit, stand up, ... */