diff options
| author | QAston <none@none> | 2010-08-04 14:39:45 +0200 |
|---|---|---|
| committer | QAston <none@none> | 2010-08-04 14:39:45 +0200 |
| commit | 6353e7dd8cd189a80fc6773bf653f159fc3a41d3 (patch) | |
| tree | 841ca8df929325ef8338c62f3b6c3b06cb06df5c /src/server/game/Server | |
| parent | 850868c8a33550b60ad1ae0c92f7985409d17bdc (diff) | |
*Update movement enums - thanks to Zor for info.
*Add functions for position data streaming.
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Server')
| -rw-r--r-- | src/server/game/Server/Protocol/Handlers/MovementHandler.cpp | 21 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSession.cpp | 51 |
2 files changed, 31 insertions, 41 deletions
diff --git a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp index 7c4f305bcd7..c41e3967ea2 100644 --- a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp @@ -280,7 +280,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) /* return; }*/ - if (!Trinity::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o)) + if (!movementInfo.pos.IsPositionValid()) { recv_data.rpos(recv_data.wpos()); // prevent warnings spam return; @@ -291,14 +291,14 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) { // transports size limited // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped) - if (movementInfo.t_x > 50 || movementInfo.t_y > 50 || movementInfo.t_z > 50) + if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50) { recv_data.rpos(recv_data.wpos()); // prevent warnings spam return; } - if (!Trinity::IsValidMapCoord(movementInfo.x+movementInfo.t_x, movementInfo.y + movementInfo.t_y, - movementInfo.z + movementInfo.t_z, movementInfo.o + movementInfo.t_o)) + if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(), + movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation())) { recv_data.rpos(recv_data.wpos()); // prevent warnings spam return; @@ -330,10 +330,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) { plMover->m_transport->RemovePassenger(plMover); plMover->m_transport = NULL; - movementInfo.t_x = 0.0f; - movementInfo.t_y = 0.0f; - movementInfo.t_z = 0.0f; - movementInfo.t_o = 0.0f; + movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); movementInfo.t_time = 0; movementInfo.t_seat = -1; } @@ -345,7 +342,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) if (plMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plMover->IsInWater()) { // now client not include swimming flag in case jumping under water - plMover->SetInWater(!plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.x, movementInfo.y, movementInfo.z)); + plMover->SetInWater(!plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); } /*----------------------*/ @@ -362,17 +359,17 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) // this is almost never true (not sure why it is sometimes, but it is), normally use mover->IsVehicle() if (mover->GetVehicle()) { - mover->SetOrientation(movementInfo.o); + mover->SetOrientation(movementInfo.pos.GetOrientation()); return; } - mover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); + mover->Relocate(movementInfo.pos); if (plMover) // nothing is charmed, or player charmed { plMover->UpdateFallInformationIfNeed(movementInfo, opcode); - if (movementInfo.z < -500.0f) + if (movementInfo.pos.GetPositionZ() < -500.0f) { if (plMover->InBattleGround() && plMover->GetBattleGround() diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 8dbe54a3b98..cc4644e0434 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -712,33 +712,32 @@ void WorldSession::SaveTutorialsData() void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) { data >> mi->flags; - data >> mi->unk1; + data >> mi->flags2; data >> mi->time; - data >> mi->x; - data >> mi->y; - data >> mi->z; - data >> mi->o; + data >> mi->pos.PositionXYZOStream(); if (mi->flags & MOVEMENTFLAG_ONTRANSPORT) { if (!data.readPackGUID(mi->t_guid)) return; - data >> mi->t_x; - data >> mi->t_y; - data >> mi->t_z; - data >> mi->t_o; + data >> mi->t_pos.PositionXYZOStream(); data >> mi->t_time; data >> mi->t_seat; - if(mi->x != mi->t_x) + if (mi->flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT) + { + data >> mi->t_time2; + } + + if(mi->pos.m_positionX != mi->t_pos.m_positionX) if(GetPlayer()->GetTransport()) GetPlayer()->GetTransport()->UpdatePosition(mi); } - if ((mi->flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (mi->unk1 & 0x20)) + if ((mi->flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (mi->flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING)) { - data >> mi->s_pitch; + data >> mi->pitch; } data >> mi->fallTime; @@ -751,9 +750,9 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) data >> mi->j_xyspeed; } - if (mi->flags & MOVEMENTFLAG_SPLINE) + if (mi->flags & MOVEMENTFLAG_SPLINE_ELEVATION) { - data >> mi->u_unk1; + data >> mi->splineElevation; } } @@ -762,28 +761,22 @@ void WorldSession::WriteMovementInfo(WorldPacket *data, MovementInfo *mi) data->appendPackGUID(mi->guid); *data << mi->flags; - *data << mi->unk1; + *data << mi->flags2; *data << mi->time; - *data << mi->x; - *data << mi->y; - *data << mi->z; - *data << mi->o; + *data << mi->pos.PositionXYZOStream(); if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) { data->appendPackGUID(mi->t_guid); - *data << mi->t_x; - *data << mi->t_y; - *data << mi->t_z; - *data << mi->t_o; - *data << mi->t_time; - *data << mi->t_seat; + *data << mi->t_pos.PositionXYZOStream(); + *data << mi->t_time; + *data << mi->t_seat; } - if ((mi->HasMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING))) || (mi->unk1 & 0x20)) + if ((mi->HasMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING))) || (mi->flags & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING)) { - *data << mi->s_pitch; + *data << mi->pitch; } *data << mi->fallTime; @@ -796,9 +789,9 @@ void WorldSession::WriteMovementInfo(WorldPacket *data, MovementInfo *mi) *data << mi->j_xyspeed; } - if (mi->HasMovementFlag(MOVEMENTFLAG_SPLINE)) + if (mi->HasMovementFlag(MOVEMENTFLAG_SPLINE_ELEVATION)) { - *data << mi->u_unk1; + *data << mi->splineElevation; } } |
