From 64309d7a7dc6380d62fa11363073d4243cbfa665 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 18 Jan 2015 14:06:44 +0300 Subject: Convert player look variable format from 8 bit to 16 bit. --- src/being/being.cpp | 4 ++-- src/being/being.h | 8 ++++---- src/net/charserverhandler.h | 2 +- src/net/eathena/charserverhandler.cpp | 4 ++-- src/net/eathena/charserverhandler.h | 2 +- src/net/tmwa/beinghandler.cpp | 14 +++++++------- src/net/tmwa/charserverhandler.cpp | 6 +++--- src/net/tmwa/charserverhandler.h | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 838892119..03e13156c 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -301,7 +301,7 @@ void Being::createSpeechBubble() mSpeechBubble->postInit(); } -void Being::setSubtype(const uint16_t subtype, const uint8_t look) +void Being::setSubtype(const uint16_t subtype, const uint16_t look) { if (!mInfo) return; @@ -3409,7 +3409,7 @@ void Being::playSfx(const SoundInfo &sound, Being *const being, BLOCK_END("Being::playSfx") } -void Being::setLook(const uint8_t look) +void Being::setLook(const uint16_t look) { if (mType == ActorType::Player) setSubtype(mSubType, look); diff --git a/src/being/being.h b/src/being/being.h index fab70ff8f..e11f36003 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -379,7 +379,7 @@ class Being notfinal : public ActorSprite, /** * Set Being's subtype (mostly for view for monsters and NPCs) */ - void setSubtype(const uint16_t subtype, const uint8_t look); + void setSubtype(const uint16_t subtype, const uint16_t look); const BeingInfo *getInfo() const A_WARN_UNUSED { return mInfo; } @@ -849,10 +849,10 @@ class Being notfinal : public ActorSprite, void playSfx(const SoundInfo &sound, Being *const being, const bool main, const int x, const int y) const; - uint8_t getLook() const + uint16_t getLook() const { return mLook; } - void setLook(const uint8_t look); + void setLook(const uint16_t look); static uint8_t genderToInt(const Gender::Type sex) A_WARN_UNUSED; @@ -1076,7 +1076,7 @@ class Being notfinal : public ActorSprite, int mUsageCounter; int mKarma; int mManner; - uint8_t mLook; + uint16_t mLook; unsigned char mHairColor; bool mErased; bool mEnemy; diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index aec583df2..31077d851 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -62,7 +62,7 @@ class CharServerHandler notfinal const int hairstyle, const int hairColor, const unsigned char race, - const unsigned char look, + const uint16_t look, const std::vector &stats) const = 0; virtual void deleteCharacter(Net::Character *const character, diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 21306b659..8decf9eef 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -219,7 +219,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, ItemDB::get(-hairStyle).getDyeColorsString( msg.readInt16("hair color"))); - const uint8_t look = msg.readInt16("clothes color"); + const uint16_t look = msg.readInt16("clothes color"); tempPlayer->setSubtype(race, look); tempPlayer->setName(msg.readString(24, "name")); @@ -273,7 +273,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, const Gender::Type gender, const int hairstyle, const int hairColor, const unsigned char race, - const unsigned char look, + const uint16_t look, const std::vector &stats A_UNUSED) const { diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index a6384cbaa..0b424024a 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -51,7 +51,7 @@ class CharServerHandler final : public MessageHandler, const int hairstyle, const int hairColor, const unsigned char race, - const unsigned char look, + const uint16_t look, const std::vector &stats) const override final; void renameCharacter(const int id, diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 94580279c..05e60b43f 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -333,7 +333,7 @@ void BeingHandler::processBeingChangeLookContinue(Being *const dstBeing, break; case 1: // eAthena LOOK_HAIR { - const uint8_t look = static_cast(id / 256); + const uint16_t look = static_cast(id / 256); const int hair = id % 256; dstBeing->setHairStyle(SPRITE_HAIR_COLOR, hair * -1); dstBeing->setLook(look); @@ -410,7 +410,7 @@ void BeingHandler::processBeingChangeLookContinue(Being *const dstBeing, localPlayer->imitateOutfit(dstBeing, SPRITE_EVOL2); break; case 16: - dstBeing->setLook(static_cast(id)); + dstBeing->setLook(static_cast(id)); break; default: logger->log("QQQ3 CHANGE_LOOKS: unsupported type: " @@ -482,7 +482,7 @@ void BeingHandler::processPlayerUpdate1(Net::MessageIn &msg) dstBeing->setWalkSpeed(Vector(speed, speed, 0)); const uint8_t hairStyle = msg.readUInt8("hair style"); - const uint8_t look = msg.readUInt8("look"); + const uint16_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t shield = msg.readInt16("shield"); @@ -635,7 +635,7 @@ void BeingHandler::processPlayerUpdate2(Net::MessageIn &msg) dstBeing->setWalkSpeed(Vector(speed, speed, 0)); const uint8_t hairStyle = msg.readUInt8("hair style"); - const uint8_t look = msg.readUInt8("look"); + const uint16_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t shield = msg.readInt16("shield"); @@ -784,7 +784,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) dstBeing->setWalkSpeed(Vector(speed, speed, 0)); const uint8_t hairStyle = msg.readUInt8("hair style"); - const uint8_t look = msg.readUInt8("look"); + const uint16_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t shield = msg.readInt16("shield"); @@ -995,7 +995,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) speed = 150; const uint8_t hairStyle = msg.readUInt8("hair style"); - const uint8_t look = msg.readUInt8("look"); + const uint16_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); @@ -1198,7 +1198,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) speed = 150; const uint8_t hairStyle = msg.readUInt8("hair style"); - const uint8_t look = msg.readUInt8("look"); + const uint16_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index a8815da5b..1b77b950d 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -173,7 +173,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, msg.readInt16("speed"); const uint16_t race = msg.readInt16("class"); const uint8_t hairStyle = msg.readUInt8("hair style"); - const uint8_t look = msg.readUInt8("look"); + const uint16_t look = msg.readUInt8("look"); tempPlayer->setSubtype(race, look); const uint16_t weapon = msg.readInt16("weapon"); tempPlayer->setSprite(SPRITE_BODY, weapon, "", 1, true); @@ -272,7 +272,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, const int hairstyle, const int hairColor, const unsigned char race, - const unsigned char look, + const uint16_t look, const std::vector &stats) const { createOutPacket(CMSG_CHAR_CREATE); @@ -285,7 +285,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, outMsg.writeInt8(0, "unused"); outMsg.writeInt8(static_cast(hairstyle), "hair style"); if (serverFeatures->haveLookSelection()) - outMsg.writeInt8(look, "look"); + outMsg.writeInt8(static_cast(look), "look"); else outMsg.writeInt8(0, "unused"); if (serverFeatures->haveRaceSelection()) diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 0e4803b6c..509d82c0c 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -51,7 +51,7 @@ class CharServerHandler final : public MessageHandler, const int hairstyle, const int hairColor, const unsigned char race, - const unsigned char look, + const uint16_t look, const std::vector &stats) const override final; void deleteCharacter(Net::Character *const character, -- cgit v1.2.3-70-g09d2