Skip to content

Commit 36c9fd9

Browse files
committed
Render spotlight arrow through ObjectSpriteRecord
1 parent 5185f5b commit 36c9fd9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/TSMapEditor/Rendering/ObjectRenderers/ObjectRenderer.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,21 @@ protected void DrawObjectFacingArrow(byte facing, Point2D drawPoint)
203203
// compass it points to top-right / northeast
204204
rad -= (float)Math.PI / 4.0f;
205205

206-
var arrowEndPoint = Helpers.VectorFromLengthAndAngle(Constants.CellSizeX / 4, rad);
206+
var arrowEndPoint = Helpers.VectorFromLengthAndAngle(Constants.CellSizeY, rad);
207207
arrowEndPoint += new Vector2(arrowEndPoint.X, 0f); // Isometric perspective
208-
RendererExtensions.DrawArrow(cellCenterPoint, cellCenterPoint + arrowEndPoint, Color.Yellow, 1f, 10f, 2);
208+
209+
Vector2 line = cellCenterPoint + arrowEndPoint - cellCenterPoint;
210+
float angle = Helpers.AngleFromVector(line) - (float)Math.PI;
211+
212+
Vector2 start = cellCenterPoint;
213+
Vector2 end = cellCenterPoint + arrowEndPoint;
214+
float sideLineLength = 10f;
215+
float angleDiff = 1f;
216+
int thickness = 2;
217+
218+
RenderDependencies.ObjectSpriteRecord.AddLineEntry(new LineEntry(start, end, Color.Yellow, thickness, 1f));
219+
RenderDependencies.ObjectSpriteRecord.AddLineEntry(new LineEntry(end, end + Helpers.VectorFromLengthAndAngle(sideLineLength, angle + angleDiff), Color.Yellow, thickness, 1f));
220+
RenderDependencies.ObjectSpriteRecord.AddLineEntry(new LineEntry(end, end + Helpers.VectorFromLengthAndAngle(sideLineLength, angle - angleDiff), Color.Yellow, thickness, 1f));
209221
}
210222

211223
private bool IsObjectInCamera(Rectangle drawingBounds)

0 commit comments

Comments
 (0)