Skip to content

Commit afd59dc

Browse files
authored
Supports mouse_opacity=2 (OpenDreamProject#2493)
1 parent fa6b11b commit afd59dc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

OpenDreamClient/Rendering/DreamPlane.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ public void DrawMouseMap(DrawingHandleWorld handle, DreamViewOverlay overlay, Ve
9696
if (texture == null)
9797
continue;
9898

99+
// For mouse_opacity = 2, discard transparency but keep the size.
100+
var textureSize = texture.Size;
101+
if (sprite.MouseOpacity == MouseOpacity.Opaque) {
102+
texture = Texture.White;
103+
}
104+
99105
var pos = (sprite.Position - worldAABB.BottomLeft) * overlay.IconSize;
100106
if (sprite.MainIcon != null)
101107
pos += sprite.MainIcon.TextureRenderOffset;
@@ -106,8 +112,8 @@ public void DrawMouseMap(DrawingHandleWorld handle, DreamViewOverlay overlay, Ve
106112
var colorB = (byte)((hash >> 16) & 0xFF);
107113
Color targetColor = new Color(colorR, colorG, colorB); //TODO - this could result in mis-clicks due to hash-collision since we ditch a whole byte.
108114
overlay.MouseMapLookup[targetColor] = sprite;
109-
handle.SetTransform(DreamViewOverlay.CalculateDrawingMatrix(sprite.TransformToApply, pos, texture.Size, renderTargetSize));
110-
handle.DrawTextureRect(texture, new Box2(Vector2.Zero, texture.Size), targetColor);
115+
handle.SetTransform(DreamViewOverlay.CalculateDrawingMatrix(sprite.TransformToApply, pos, textureSize, renderTargetSize));
116+
handle.DrawTextureRect(texture, new Box2(Vector2.Zero, textureSize), targetColor);
111117
}
112118
}
113119
}

0 commit comments

Comments
 (0)