From 909de47acdd63cd559b5a841700a3f4a341b235c Mon Sep 17 00:00:00 2001 From: solar Date: Sat, 2 Aug 2025 07:32:30 -0700 Subject: [PATCH] fix player movement deltas (jumping, turning) (#4975) Co-authored-by: solar --- zone/client_packet.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a62131b71..3bbfc7cb5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4983,9 +4983,6 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) { m_Proximity = glm::vec3(cx, cy, cz); } - /* Update internal state */ - m_Delta = glm::vec4(ppu->delta_x, ppu->delta_y, ppu->delta_z, EQ10toFloat(ppu->delta_heading)); - if (RuleB(Skills, TrackingAutoRefreshSkillUps) && IsTracking() && ((m_Position.x != cx) || (m_Position.y != cy))) { if (zone->random.Real(0, 100) < 70)//should be good CheckIncreaseSkill(EQ::skills::SkillTracking, nullptr, -20); @@ -5019,6 +5016,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) { rewind_timer.Start(30000, true); } + glm::vec4 prevDelta = m_Delta; // SetMoving clears m_Delta SetMoving(!(cy == m_Position.y && cx == m_Position.x)); if (RuleB(Character, EnableAutoAFK)) { @@ -5033,12 +5031,13 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) { CheckSendBulkNpcPositions(); - int32 new_animation = ppu->animation; - /* Update internal server position from what the client has sent */ - m_Position.x = cx; - m_Position.y = cy; - m_Position.z = cz; + glm::vec4 prevPosition = m_Position; + m_Position = glm::vec4(cx, cy, cz, new_heading); + m_Delta = glm::vec4(ppu->delta_x, ppu->delta_y, ppu->delta_z, EQ10toFloat(ppu->delta_heading)); + int32 prevAnimation = ppu->animation; + animation = ppu->animation; + bool positionUpdated = m_Position != prevPosition || m_Delta != prevDelta || m_Delta != glm::vec4(0.0f) || prevAnimation != animation; /* Visual Debugging */ if (RuleB(Character, OPClientUpdateVisualDebug)) { @@ -5048,11 +5047,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) { } /* Only feed real time updates when client is moving */ - if (IsMoving() || new_heading != m_Position.w || new_animation != animation) { - - animation = ppu->animation; - m_Position.w = new_heading; - + if (positionUpdated) { /* Broadcast update to other clients */ static EQApplicationPacket outapp(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct *position_update = (PlayerPositionUpdateServer_Struct *) outapp.pBuffer; @@ -5065,7 +5060,6 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) { entity_list.QueueCloseClients(this, &outapp, true, RuleI(Range, ClientPositionUpdates), nullptr, true); } - /* Always send position updates to group - send when beyond normal ClientPositionUpdate range */ Group *group = GetGroup(); Raid *raid = GetRaid(); @@ -5091,7 +5085,6 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) { } CheckVirtualZoneLines(); - } void Client::Handle_OP_CombatAbility(const EQApplicationPacket *app)