diff options
-rw-r--r-- | src/being/actorsprite.cpp | 38 | ||||
-rw-r--r-- | src/being/actorsprite.h | 11 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 76 | ||||
-rw-r--r-- | src/net/tmwa/beingrecv.cpp | 102 |
4 files changed, 127 insertions, 100 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index e73397145..f444bdd71 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -212,6 +212,44 @@ void ActorSprite::setStatusEffectBlock(const int offset, } } +void ActorSprite::setStatusEffectOpitons(const uint32_t option, + const uint32_t opt1, + const uint32_t opt2, + const uint32_t opt3) +{ + uint32_t statusEffects = opt2; + statusEffects |= option << 16; + + setStunMode(opt1); + setStatusEffectBlock(0, + CAST_U16((statusEffects >> 16) & 0xffffU)); + setStatusEffectBlock(16, + CAST_U16(statusEffects & 0xffffU)); + setStatusEffectBlock(32, + opt3); +} + +void ActorSprite::setStatusEffectOpitons(const uint32_t option, + const uint32_t opt1, + const uint32_t opt2) +{ + uint32_t statusEffects = opt2; + statusEffects |= option << 16; + + setStunMode(opt1); + setStatusEffectBlock(0, + CAST_U16((statusEffects >> 16) & 0xffffU)); + setStatusEffectBlock(16, + CAST_U16(statusEffects & 0xffffU)); +} + +void ActorSprite::setStatusEffectOpiton0(const uint32_t option) +{ + const uint32_t statusEffects = option << 16; + setStatusEffectBlock(0, + CAST_U16((statusEffects >> 16) & 0xffff)); +} + void ActorSprite::updateStunMode(const int oldMode, const int newMode) { handleStatusEffect(StatusEffect::getStatusEffect( diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index 68964d04d..5c5f5a80d 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -120,6 +120,17 @@ class ActorSprite notfinal : public CompoundSprite, public Actor void setStatusEffect(const int index, const Enable active); + void setStatusEffectOpitons(const uint32_t option, + const uint32_t opt1, + const uint32_t opt2, + const uint32_t opt3); + + void setStatusEffectOpitons(const uint32_t option, + const uint32_t opt1, + const uint32_t opt2); + + void setStatusEffectOpiton0(const uint32_t option); + /** * A status effect block is a 16 bit mask of status effects. We assign * each such flag a block ID of offset + bitnr. diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index ae4cd1e74..a3758e718 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -279,10 +279,10 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) Ea::BeingRecv::mSpawnId = BeingId_zero; int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); + const uint32_t opt1 = msg.readInt16("opt1"); // probably wrong effect usage - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt32("option"))) << 16; + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt32("option"); const int16_t job = msg.readInt16("class"); Being *dstBeing = actorManager->findBeing(id); @@ -350,8 +350,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) msg.readInt32("guild id"); msg.readInt16("guild emblem"); dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, CAST_U16( - msg.readInt32("opt3"))); + const uint32_t opt3 = msg.readInt32("opt3"); dstBeing->setKarma(msg.readUInt8("karma")); const uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); @@ -418,11 +417,10 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) msg.readString(24, "name"); } - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffffU)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffffU)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); } void BeingRecv::processBeingMove(Net::MessageIn &msg) @@ -445,10 +443,10 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) spawnId = BeingId_zero; Ea::BeingRecv::mSpawnId = BeingId_zero; int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); + const uint32_t opt1 = msg.readInt16("opt1"); // probably wrong effect usage - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt32("option"))) << 16; + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt32("option"); const int16_t job = msg.readInt16("class"); Being *dstBeing = actorManager->findBeing(id); @@ -510,8 +508,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) msg.readInt32("guild id"); msg.readInt16("guild emblem"); dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, CAST_U16( - msg.readInt32("opt3"))); + const uint32_t opt3 = msg.readInt32("opt3"); dstBeing->setKarma(msg.readUInt8("karma")); const uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); @@ -590,11 +587,10 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) msg.readString(24, "name"); } - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffffU)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffffU)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); } void BeingRecv::processBeingSpawn(Net::MessageIn &msg) @@ -613,10 +609,10 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) Ea::BeingRecv::mSpawnId = id; const BeingId spawnId = id; int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); + const uint32_t opt1 = msg.readInt16("opt1"); // probably wrong effect usage - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt32("option"))) << 16; + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt32("option"); const int16_t job = msg.readInt16("class"); Being *dstBeing = actorManager->findBeing(id); @@ -675,8 +671,7 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) msg.readInt32("guild id"); msg.readInt16("guild emblem"); dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, CAST_U16( - msg.readInt32("opt3"))); + const uint32_t opt3 = msg.readInt32("opt3"); dstBeing->setKarma(msg.readUInt8("karma")); const uint8_t gender = CAST_U8(msg.readUInt8("gender") & 3); @@ -742,11 +737,10 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) msg.readString(24, "name"); } - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffffU)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffffU)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); } void BeingRecv::processMapTypeProperty(Net::MessageIn &msg) @@ -1208,16 +1202,14 @@ void BeingRecv::processPlayerStatusChange(Net::MessageIn &msg) if (!dstBeing) return; - const uint16_t stunMode = msg.readInt16("opt1"); - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt32("option"))) << 16; + const uint32_t opt1 = msg.readInt16("opt1"); + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt32("option"); dstBeing->setKarma(msg.readUInt8("karma")); - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2); BLOCK_END("BeingRecv::processPlayerStop") } @@ -1233,14 +1225,10 @@ void BeingRecv::processPlayerStatusChange2(Net::MessageIn &msg) if (!dstBeing) return; - const uint32_t statusEffects = msg.readInt32("option"); + const uint32_t option = msg.readInt32("option"); dstBeing->setLevel(msg.readInt32("level")); msg.readInt32("showEFST"); - - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpiton0(option); } void BeingRecv::processPlayerStatusChangeNoTick(Net::MessageIn &msg) diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index fa2cfe186..c9b29d224 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -230,10 +230,9 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) // An update about a player, potentially including movement. const BeingId id = msg.readBeingId("account id"); const int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt16("option"))) - << 16; + const uint32_t opt1 = msg.readInt16("opt1"); + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt16("option"); const int16_t job = msg.readInt16("job"); int disguiseId = 0; if (toInt(id, int) < 110000000 && job >= 1000) @@ -303,7 +302,7 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) msg.readInt16("emblem"); dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + const uint32_t opt3 = msg.readInt16("opt3"); dstBeing->setKarma(msg.readUInt8("karma")); // reserving bit for future usage dstBeing->setGender(Being::intToGender( @@ -344,11 +343,10 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) dstBeing->setActionTime(tick_time); - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); BLOCK_END("BeingRecv::processPlayerMoveUpdate") } @@ -365,10 +363,9 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) // An update about a player, potentially including movement. const BeingId id = msg.readBeingId("account id"); const int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt16("option"))) - << 16; + const uint32_t opt1 = msg.readInt16("opt1"); + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt16("option"); const int16_t job = msg.readInt16("job"); int disguiseId = 0; if (toInt(id, int) < 110000000 && job >= 1000) @@ -437,7 +434,7 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) msg.readInt16("emblem"); dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + const uint32_t opt3 = msg.readInt16("opt3"); dstBeing->setKarma(msg.readUInt8("karma")); // reserving bit for future usage dstBeing->setGender(Being::intToGender( @@ -475,11 +472,10 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) dstBeing->setLevel(level); dstBeing->setActionTime(tick_time); - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); BLOCK_END("BeingRecv::processPlayerMoveUpdate") } @@ -496,10 +492,9 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) // An update about a player, potentially including movement. const BeingId id = msg.readBeingId("account id"); const int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt16("option"))) - << 16; + const uint32_t opt1 = msg.readInt16("opt1"); + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt16("option"); const int16_t job = msg.readInt16("job"); int disguiseId = 0; if (toInt(id, int) < 110000000 && job >= 1000) @@ -571,7 +566,7 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) msg.readInt16("emblem"); dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + const uint32_t opt3 = msg.readInt16("opt3"); dstBeing->setKarma(msg.readUInt8("karma")); // reserving bit for future usage dstBeing->setGender(Being::intToGender( @@ -634,11 +629,10 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) if (dstBeing->getType() != ActorType::Player) dstBeing->setActionTime(tick_time); - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); @@ -664,9 +658,9 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) spawnId = BeingId_zero; Ea::BeingRecv::mSpawnId = BeingId_zero; int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt16("option"))) << 16; + const uint32_t opt1 = msg.readInt16("opt1"); + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt16("option"); const int16_t job = msg.readInt16("class"); int disguiseId = 0; if (id == localPlayer->getId() && job >= 1000) @@ -780,7 +774,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) } dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + const uint32_t opt3 = msg.readInt16("opt3"); if (serverFeatures->haveMonsterAttackRange() && dstBeing->getType() == ActorType::Monster) { @@ -845,11 +839,10 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) msg.readUInt8("unknown"); msg.readUInt8("unknown"); - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); BLOCK_END("BeingRecv::processBeingVisibleOrMove") } @@ -872,9 +865,9 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) spawnId = BeingId_zero; Ea::BeingRecv::mSpawnId = BeingId_zero; int16_t speed = msg.readInt16("speed"); - const uint16_t stunMode = msg.readInt16("opt1"); - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt16("option"))) << 16; + const uint32_t opt1 = msg.readInt16("opt1"); + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt16("option"); const int16_t job = msg.readInt16("class"); int disguiseId = 0; if (id == localPlayer->getId() && job >= 1000) @@ -982,7 +975,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) } dstBeing->setManner(msg.readInt16("manner")); - dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); + const uint32_t opt3 = msg.readInt16("opt3"); if (serverFeatures->haveMonsterAttackRange() && dstBeing->getType() == ActorType::Monster) { @@ -1036,11 +1029,10 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) msg.readUInt8("unknown"); msg.readUInt8("unknown"); - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2, + opt3); BLOCK_END("BeingRecv::processBeingVisibleOrMove") } @@ -1184,16 +1176,14 @@ void BeingRecv::processPlayerStatusChange(Net::MessageIn &msg) return; } - const uint16_t stunMode = msg.readInt16("opt1"); - uint32_t statusEffects = msg.readInt16("opt2"); - statusEffects |= (CAST_U32(msg.readInt16("option"))) << 16; + const uint32_t opt1 = msg.readInt16("opt1"); + const uint32_t opt2 = msg.readInt16("opt2"); + const uint32_t option = msg.readInt16("option"); msg.readUInt8("Unused?"); - dstBeing->setStunMode(stunMode); - dstBeing->setStatusEffectBlock(0, CAST_U16( - (statusEffects >> 16) & 0xffff)); - dstBeing->setStatusEffectBlock(16, CAST_U16( - statusEffects & 0xffff)); + dstBeing->setStatusEffectOpitons(option, + opt1, + opt2); BLOCK_END("BeingRecv::processPlayerStop") } |