net: fix UPDATEFLAG_LIVING pitch misalignment for swimming entities

parseMovementBlock was checking moveFlags & 0x02000000 for the pitch
field, but SWIMMING is 0x00200000 in WotLK 3.3.5a. Swimming NPCs and
players in SMSG_UPDATE_OBJECT packets never triggered the pitch read,
so the fallTime/jumpData/splineElevation fields were read from the wrong
offsets, producing incorrect positions and orientations.

Fix: check both SWIMMING (0x00200000) and FLYING (0x02000000), matching
the WotLK format — same condition used in the write path.
This commit is contained in:
Kelsi 2026-03-10 11:03:33 -07:00
parent d7ebc5c8c7
commit 3439df0333

View file

@ -865,7 +865,14 @@ bool UpdateObjectParser::parseMovementBlock(network::Packet& packet, UpdateBlock
}
// Swimming/flying pitch
if ((moveFlags & 0x02000000) || (moveFlags2 & 0x0010)) { // MOVEMENTFLAG_SWIMMING or MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING
// WotLK 3.3.5a flags: SWIMMING=0x00200000, FLYING=0x02000000
// Pitch is present when SWIMMING or FLYING are set, or MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING.
// The original check (0x02000000 only) missed SWIMMING, causing misaligned reads for
// swimming NPCs/players — all subsequent fields (fallTime, jumpData, splineElevation)
// would be read from the wrong offsets.
if ((moveFlags & 0x00200000) /* SWIMMING */ ||
(moveFlags & 0x02000000) /* FLYING(WotLK) */ ||
(moveFlags2 & 0x0010) /* MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING */) {
/*float pitch =*/ packet.readFloat();
}