summaryrefslogtreecommitdiff
path: root/src/net/tmwa/beinghandler.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-04 16:29:14 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-04 20:20:52 +0100
commit5c7f9d1d216fd1edca231ed274ac3077cb34909f (patch)
tree234405f8f9d0b422a02d8cc44854aaa6992cf2d9 /src/net/tmwa/beinghandler.cpp
parentd5ebad4e74da011777f9ba1a13fbb37d18c827b9 (diff)
downloadmana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.tar.gz
mana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.tar.bz2
mana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.tar.xz
mana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.zip
Fixed character display
This change fixes hair style to take into account "race", which makes the faces visible again. Hair colors should also be fixed now, with partial support for itemcolors.xml added. The Mana client now also supports per-character gender, and it now hides the hair style and color buttons on character creation, when there are none to choose from. Closes #43
Diffstat (limited to 'src/net/tmwa/beinghandler.cpp')
-rw-r--r--src/net/tmwa/beinghandler.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 50585970..33adb93b 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -242,8 +242,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
if (dstBeing->getType() == ActorSprite::PLAYER)
{
- dstBeing->setGender((gender == 0)
- ? GENDER_FEMALE : GENDER_MALE);
+ dstBeing->setGender(gender == 0 ? Gender::FEMALE
+ : Gender::MALE);
// Set these after the gender, as the sprites may be gender-specific
dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1,
hairDB.getHairColor(hairColor));
@@ -415,53 +415,60 @@ void BeingHandler::handleMessage(MessageIn &msg)
break;
}
- int type = msg.readInt8();
- int id = msg.readInt16();
- int id2 = msg.readInt16();
+ const LOOK type = static_cast<LOOK>(msg.readInt8());
+ const int id = msg.readInt16();
+ const int id2 = msg.readInt16();
switch (type)
{
- case 1: // eAthena LOOK_HAIR
- dstBeing->setSpriteID(SPRITE_HAIR, id *-1);
+ case LOOK::HAIR:
+ {
+ // const int look = id / 256;
+ const int hair = id % 256;
+ dstBeing->setSpriteID(SPRITE_HAIR, hair * -1);
break;
- case 2: // Weapon ID in id, Shield ID in id2
- dstBeing->setSprite(SPRITE_WEAPON, id, "", true);
+ }
+ case LOOK::WEAPON: // Weapon ID in id, Shield ID in id2
+ dstBeing->setSprite(SPRITE_WEAPON, id, std::string(), true);
dstBeing->setSprite(SPRITE_SHIELD, id2);
break;
- case 3: // Change lower headgear for eAthena, pants for us
+ case LOOK::HEAD_BOTTOM: // Change lower headgear for eAthena, pants for us
dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, id);
break;
- case 4: // Change upper headgear for eAthena, hat for us
+ case LOOK::HEAD_TOP: // Change upper headgear for eAthena, hat for us
dstBeing->setSprite(SPRITE_HAT, id);
break;
- case 5: // Change middle headgear for eathena, armor for us
+ case LOOK::HEAD_MID: // Change middle headgear for eathena, armor for us
dstBeing->setSprite(SPRITE_TOPCLOTHES, id);
break;
- case 6: // eAthena LOOK_HAIR_COLOR
+ case LOOK::HAIR_COLOR:
dstBeing->setSpriteColor(SPRITE_HAIR,
hairDB.getHairColor(id));
break;
- case 8: // eAthena LOOK_SHIELD
+ case LOOK::CLOTHES_COLOR:
+ // ignoring it
+ break;
+ case LOOK::SHIELD:
dstBeing->setSprite(SPRITE_SHIELD, id);
break;
- case 9: // eAthena LOOK_SHOES
+ case LOOK::SHOES:
dstBeing->setSprite(SPRITE_SHOE, id);
break;
- case 10: // LOOK_GLOVES
+ case LOOK::GLOVES:
dstBeing->setSprite(SPRITE_GLOVES, id);
break;
- case 11: // LOOK_CAPE
+ case LOOK::CAPE:
dstBeing->setSprite(SPRITE_CAPE, id);
break;
- case 12:
+ case LOOK::MISC1:
dstBeing->setSprite(SPRITE_MISC1, id);
break;
- case 13:
+ case LOOK::MISC2:
dstBeing->setSprite(SPRITE_MISC2, id);
break;
default:
logger->log("SMSG_BEING_CHANGE_LOOKS2: unsupported type: "
- "%d, id: %d", type, id);
+ "%d, id: %d", static_cast<int>(type), id);
break;
}
}
@@ -549,9 +556,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
msg.readInt16(); // manner
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
msg.readInt8(); // karma
- dstBeing->setGender((msg.readInt8() == 0)
- ? GENDER_FEMALE : GENDER_MALE);
-
+ dstBeing->setGender(msg.readInt8() == 0 ? Gender::FEMALE
+ : Gender::MALE);
// Set these after the gender, as the sprites may be gender-specific
dstBeing->setSprite(SPRITE_WEAPON, weapon, "", true);
dstBeing->setSprite(SPRITE_SHIELD, shield);
@@ -629,9 +635,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
dstBeing = actorSpriteManager->findBeing(id);
if (dstBeing)
{
- Uint16 x, y;
- x = msg.readInt16();
- y = msg.readInt16();
+ Uint16 x = msg.readInt16();
+ Uint16 y = msg.readInt16();
handlePosMessage(map, dstBeing, x, y);
}
}