From a2e9b5ab0350b373f2d04cb5576d5a8d50cf6791 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 13:04:47 +0000 Subject: [PATCH] Decompile fn_21275 (CGameMode::BuildActorEntryPacket) Batch #16029 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_21275 CGameMode::BuildActorEntryPacket: logic confirmed by peer review Peer-reviewed-by: eAthena, alisonrag Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/EntityInit.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/EntityInit.cpp b/Source/EntityInit.cpp index 0142d6468..3ce175a55 100644 --- a/Source/EntityInit.cpp +++ b/Source/EntityInit.cpp @@ -99,7 +99,7 @@ std::vector CGameMode::BuildActorEntryPacket(CGameActor* actor, std::uint1 std::string name = this->nameCard.Name(actor->render.accountId); if (actor->render.state == 1) { - packet.resize(sizeof(ActorMoveEntryPacket)); + packet.resize(sizeof(ActorMoveEntryPacket), 0); ActorMoveEntryPacket* entry = reinterpret_cast(packet.data()); entry->hp = actor->GetGaugeCurrent(); entry->maxHp = actor->GetGaugeMaximum(); @@ -113,24 +113,24 @@ std::vector CGameMode::BuildActorEntryPacket(CGameActor* actor, std::uint1 int cellX; int subX; - if (x > 0.0f) { + if (x <= 0.0f) { + cellX = 0; + subX = 0; + } else { const double position = x + 0.5; cellX = static_cast(position); subX = static_cast(static_cast(position - cellX) * 16.0f); - } else { - cellX = 0; - subX = 0; } int cellY; int subY; - if (y > 0.0f) { + if (y <= 0.0f) { + cellY = 0; + subY = 0; + } else { const double position = y + 0.5; cellY = static_cast(position); subY = static_cast(static_cast(position - cellY) * 16.0f); - } else { - cellY = 0; - subY = 0; } const int destinationX = actor->movementState[5]; @@ -143,7 +143,7 @@ std::vector CGameMode::BuildActorEntryPacket(CGameActor* actor, std::uint1 entry->moveData[5] = static_cast((subX << 4) | (subY & 0x0F)); entry->packetType = packetType; - entry->packetLength = static_cast(name.size() + packet.size()); + entry->packetLength = static_cast(packet.size() + name.size()); entry->objectType = actor->objectType; entry->accountId = actor->render.accountId; entry->speed = *reinterpret_cast(actor->destinationAndSpeed + 4); @@ -177,7 +177,7 @@ std::vector CGameMode::BuildActorEntryPacket(CGameActor* actor, std::uint1 entry->body = static_cast(pc->GetBodyCostume()); } } else { - packet.resize(sizeof(ActorStandEntryPacket)); + packet.resize(sizeof(ActorStandEntryPacket), 0); ActorStandEntryPacket* entry = reinterpret_cast(packet.data()); entry->hp = actor->GetGaugeCurrent(); entry->maxHp = actor->GetGaugeMaximum(); @@ -197,7 +197,7 @@ std::vector CGameMode::BuildActorEntryPacket(CGameActor* actor, std::uint1 } entry->packetType = packetType; - entry->packetLength = static_cast(name.size() + packet.size()); + entry->packetLength = static_cast(packet.size() + name.size()); entry->objectType = actor->objectType; entry->accountId = actor->render.accountId; entry->speed = *reinterpret_cast(actor->destinationAndSpeed + 4);