diff --git a/TombEngine/Game/gui.cpp b/TombEngine/Game/gui.cpp index ec338990f..26b9ad59c 100644 --- a/TombEngine/Game/gui.cpp +++ b/TombEngine/Game/gui.cpp @@ -3303,6 +3303,7 @@ namespace TEN::Gui while (g_Synchronizer.Synced()) { TimeInMenu++; + GlobalCounter++; SaveGame::Statistics.Game.TimeTaken++; SaveGame::Statistics.Level.TimeTaken++; @@ -3451,7 +3452,7 @@ namespace TEN::Gui needleOrient.Lerp(EulerAngles(0, item->Pose.Orientation.y, 0), LERP_ALPHA); float wibble = std::sin((float(GlobalCounter & 0x3F) / (float)0x3F) * PI_MUL_2); - CompassNeedleAngle = needleOrient.y + ANGLE(wibble / 2); + CompassNeedleAngle = needleOrient.y + ANGLE(wibble); // HACK: Needle is rotated in the draw function. const auto& invObject = InventoryObjectTable[INV_OBJECT_COMPASS]; diff --git a/TombEngine/Renderer/RendererCompatibility.cpp b/TombEngine/Renderer/RendererCompatibility.cpp index 77d2970d3..e8cc46136 100644 --- a/TombEngine/Renderer/RendererCompatibility.cpp +++ b/TombEngine/Renderer/RendererCompatibility.cpp @@ -671,18 +671,25 @@ namespace TEN::Renderer { auto* skinVertex = &_moveablesVertices[skinBucket->StartVertex + v2]; - auto vertex0 = _moveablesVertices[jointBucket->StartVertex + v1].Position + jointBone->GlobalTranslation; - auto vertex1 = _moveablesVertices[skinBucket->StartVertex + v2].Position + skinBone->GlobalTranslation; + // NOTE: Don't vectorize these coordinates, it breaks the connection in some cases. -- Lwmte, 21.12.24 - if (Vector3::Distance(vertex0, vertex1) > 2) - continue; + int x1 = _moveablesVertices[jointBucket->StartVertex + v1].Position.x + jointBone->GlobalTranslation.x; + int y1 = _moveablesVertices[jointBucket->StartVertex + v1].Position.y + jointBone->GlobalTranslation.y; + int z1 = _moveablesVertices[jointBucket->StartVertex + v1].Position.z + jointBone->GlobalTranslation.z; - jointVertex->Bone = bonesToCheck[k]; - jointVertex->Position = skinVertex->Position; - jointVertex->Normal = skinVertex->Normal; + int x2 = _moveablesVertices[skinBucket->StartVertex + v2].Position.x + skinBone->GlobalTranslation.x; + int y2 = _moveablesVertices[skinBucket->StartVertex + v2].Position.y + skinBone->GlobalTranslation.y; + int z2 = _moveablesVertices[skinBucket->StartVertex + v2].Position.z + skinBone->GlobalTranslation.z; - isDone = true; - break; + if (abs(x1 - x2) < 2 && abs(y1 - y2) < 2 && abs(z1 - z2) < 2) + { + jointVertex->Bone = bonesToCheck[k]; + jointVertex->Position = skinVertex->Position; + jointVertex->Normal = skinVertex->Normal; + + isDone = true; + break; + } } if (isDone) @@ -765,17 +772,23 @@ namespace TEN::Renderer { auto* parentVertex = &_moveablesVertices[parentBucket->StartVertex + v2]; - auto vertex1 = _moveablesVertices[currentBucket.StartVertex + v1].Position + currentBone->GlobalTranslation; - auto vertex2 = _moveablesVertices[parentBucket->StartVertex + v2].Position + parentBone->GlobalTranslation; + int x1 = _moveablesVertices[currentBucket.StartVertex + v1].Position.x + currentBone->GlobalTranslation.x; + int y1 = _moveablesVertices[currentBucket.StartVertex + v1].Position.y + currentBone->GlobalTranslation.y; + int z1 = _moveablesVertices[currentBucket.StartVertex + v1].Position.z + currentBone->GlobalTranslation.z; + + int x2 = _moveablesVertices[parentBucket->StartVertex + v2].Position.x + parentBone->GlobalTranslation.x; + int y2 = _moveablesVertices[parentBucket->StartVertex + v2].Position.y + parentBone->GlobalTranslation.y; + int z2 = _moveablesVertices[parentBucket->StartVertex + v2].Position.z + parentBone->GlobalTranslation.z; // FIXME: If a tolerance is used, a strange bug occurs where certain vertices don't connect. -- Lwmte, 14.12.2024 - if (vertex1 != vertex2) - continue; - currentVertex->Bone = j; - currentVertex->Position = parentVertex->Position; - currentVertex->Normal = parentVertex->Normal; - break; + if (abs(x1 - x2) == 0 && abs(y1 - y2) == 0 && abs(z1 - z2) == 0) + { + currentVertex->Bone = j; + currentVertex->Position = parentVertex->Position; + currentVertex->Normal = parentVertex->Normal; + break; + } } } }