Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions Code/Entities/AssistRectangle.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Celeste.Mod.Entities;
using Celeste.Mod.Helpers;
using Microsoft.Xna.Framework;
using Monocle;

Expand All @@ -16,32 +17,43 @@ public AssistRectangle(Vector2 position, int width, int height, Color color)
Position = position;
Collider = new Hitbox(width, height);
this.color = color;
Active = false;
}
public AssistRectangle(EntityData data, Vector2 offset) : this(data.Position + offset, data.Width, data.Height, Calc.HexToColor(data.Attr("color")))
{

}
public override void Render()
{
int num = (int)Left;
int num2 = (int)Right;
int num3 = (int)Top;
int num4 = (int)Bottom;
Draw.Rect(num + 4, num3 + 4, Width - 8f, Height - 8f, color * secretAlpha);
for (float num5 = num; num5 < (float)(num2 - 3); num5 += 3f)
int left = (int)Left;
int top = (int)Top;
float width = Width;
float height = Height;

if (!CullHelper.IsRectangleVisible(left, top, width, height))
{
Draw.Line(num5, num3, num5 + 2f, num3, color);
Draw.Line(num5, num4 - 1, num5 + 2f, num4 - 1, color);
return;
}
for (float num6 = num3; num6 < (float)(num4 - 3); num6 += 3f)

int right = (int)Right;
int bottom = (int)Bottom;

Draw.Rect(left + 4, top + 4, width - 8f, height - 8f, color * secretAlpha);
for (float x = left; x < right - 3; x += 3f)
{
Draw.Rect(x, top, 2, 1, color);
Draw.Rect(x, bottom - 1, 2, 1, color);
}
for (float y = top; y < bottom - 3; y += 3f)
{
Draw.Line(num + 1, num6, num + 1, num6 + 2f, color);
Draw.Line(num2, num6, num2, num6 + 2f, color);
Draw.Rect(left, y, 1, 2, color);
Draw.Rect(right - 1, y, 1, 2, color);
}
Draw.Rect(num + 1, num3, 1f, 2f, color);
Draw.Rect(num2 - 2, num3, 2f, 2f, color);
Draw.Rect(num, num4 - 2, 2f, 2f, color);
Draw.Rect(num2 - 2, num4 - 2, 2f, 2f, color);
Draw.Rect(left + 1, top, 1f, 2f, color);
Draw.Rect(right - 2, top, 2f, 2f, color);
Draw.Rect(left, bottom - 2, 2f, 2f, color);
Draw.Rect(right - 2, bottom - 2, 2f, 2f, color);

base.Render();
}
}
Expand Down
Loading