From e0006fb17dc6b359cecc8cc36b46a450d069c115 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 4 Jun 2025 23:41:26 +0100 Subject: [PATCH] stop old useless bytes to float and back to bytes --- .../ClientStack/Linden/UDP/LLClientView.cs | 19 +++++++++++++------ .../Framework/Scenes/SceneObjectPart.cs | 3 +-- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9b7945712c..41d43efe37 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -52,6 +52,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; using PermissionMask = OpenSim.Framework.PermissionMask; using RegionFlags = OpenMetaverse.RegionFlags; using System.Linq; +using System.Drawing; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -7544,8 +7545,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddShortLimitedUTF8(osUTF8PartText); //textcolor - byte[] tc = part.GetTextColor().GetBytes(false); - zc.AddBytes(tc, 4); + Color c = part.Color; + zc.AddByte(c.R); + zc.AddByte(c.G); + zc.AddByte(c.B); + zc.AddByte((byte)(0xff - c.A)); } //media url @@ -7965,7 +7969,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP else BlockLengh += extraParamBytes.Length; - byte[] hoverTextColor = null; osUTF8 osUTF8PartText = part.osUTF8Text; if (osUTF8PartText != null && osUTF8PartText.Length > 0) { @@ -7973,8 +7976,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP BlockLengh += osUTF8PartText.Length; if (osUTF8PartText[^1] != 0) ++BlockLengh; - hoverTextColor = part.GetTextColor().GetBytes(false); - BlockLengh += hoverTextColor.Length; + BlockLengh += 4; hastext = true; } @@ -8102,7 +8104,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP zc.AddBytes(osUTF8PartText.GetArray(), osUTF8PartText.Length); if (osUTF8PartText[^1] != 0) zc.AddZeros(1); - zc.AddBytes(hoverTextColor, hoverTextColor.Length); + + Color c = part.Color; + zc.AddByte(c.R); + zc.AddByte(c.G); + zc.AddByte(c.B); + zc.AddByte((byte)(0xff - c.A)); } if (hasmediaurl) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c1ed588822..ba100f1a55 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5308,9 +5308,8 @@ namespace OpenSim.Region.Framework.Scenes public Color4 GetTextColor() { - // note that Alpha is inverted for lludp Color color = m_color; - return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); + return new Color4(color.R, color.G, color.B, m_color.A); } public float GetTextAlpha() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 57a2e8647e..b866e12afe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -12070,7 +12070,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Vector(textColor.R, textColor.G, textColor.B)); - res.Add(new LSL_Float(part.GetTextAlpha())); + res.Add(new LSL_Float(textColor.A)); break; case ScriptBaseClass.PRIM_NAME: