Skip to content

Commit

Permalink
Fix out-of-bounds mini-map ellipse
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenCWills committed Feb 17, 2024
1 parent dc59cda commit a99eda1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Source/automap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,8 @@ void DrawMapEllipse(const Surface &out, Point from, int radius, uint8_t colorInd
from.x -= radius;

// Initial point
out.SetPixel({ from.x, from.y + b }, colorIndex);
out.SetPixel({ from.x, from.y - b }, colorIndex);
SetMapPixel(out, { from.x, from.y + b }, colorIndex);
SetMapPixel(out, { from.x, from.y - b }, colorIndex);

// Initialize the parameters
int p1 = (b * b) - (a * a * b) + (a * a) / 4;
Expand All @@ -856,10 +856,10 @@ void DrawMapEllipse(const Surface &out, Point from, int radius, uint8_t colorInd
p1 += (2 * b * b * x) - (2 * a * a * y) + (b * b);
}

out.SetPixel({ from.x + x, from.y + y }, colorIndex);
out.SetPixel({ from.x - x, from.y + y }, colorIndex);
out.SetPixel({ from.x + x, from.y - y }, colorIndex);
out.SetPixel({ from.x - x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y - y }, colorIndex);
}

// Initialize the second parameter for Region 2
Expand All @@ -875,10 +875,10 @@ void DrawMapEllipse(const Surface &out, Point from, int radius, uint8_t colorInd
p2 += (2 * b * b * x) - (2 * a * a * y) + (a * a);
}

out.SetPixel({ from.x + x, from.y + y }, colorIndex);
out.SetPixel({ from.x - x, from.y + y }, colorIndex);
out.SetPixel({ from.x + x, from.y - y }, colorIndex);
out.SetPixel({ from.x - x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y + y }, colorIndex);
SetMapPixel(out, { from.x + x, from.y - y }, colorIndex);
SetMapPixel(out, { from.x - x, from.y - y }, colorIndex);
}
}

Expand Down

0 comments on commit a99eda1

Please sign in to comment.