forked from rosebudai/OpenRCT2-Web
Refactor CoordsRange.hpp/ScreenCoords.hpp members to camelCase (#27112)
This commit is contained in:
1 parent
242b916767
commit
b1175458bf
40 files changed
+338
-338
No files matched your search
@@ -696,14 +696,14 @@ void OpenGLDrawingContext::FillRect(
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
|
||||
left += clip.GetLeft() - rt.x;
|
||||
top += clip.GetTop() - rt.y;
|
||||
right += clip.GetLeft() - rt.x;
|
||||
bottom += clip.GetTop() - rt.y;
|
||||
left += clip.getLeft() - rt.x;
|
||||
top += clip.getTop() - rt.y;
|
||||
right += clip.getLeft() - rt.x;
|
||||
bottom += clip.getTop() - rt.y;
|
||||
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = 0;
|
||||
command.texColourBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
command.texMaskAtlas = 0;
|
||||
@@ -729,14 +729,14 @@ void OpenGLDrawingContext::FilterRect(
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
|
||||
left += clip.GetLeft() - rt.x;
|
||||
top += clip.GetTop() - rt.y;
|
||||
right += clip.GetLeft() - rt.x;
|
||||
bottom += clip.GetTop() - rt.y;
|
||||
left += clip.getLeft() - rt.x;
|
||||
top += clip.getTop() - rt.y;
|
||||
right += clip.getLeft() - rt.x;
|
||||
bottom += clip.getTop() - rt.y;
|
||||
|
||||
DrawRectCommand& command = _commandBuffers.transparent.allocate();
|
||||
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = 0;
|
||||
command.texColourBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
command.texMaskAtlas = 0;
|
||||
@@ -773,8 +773,8 @@ bool OpenGLDrawingContext::CohenSutherlandLineClip(ScreenLine& line, const Rende
|
||||
{
|
||||
ScreenCoordsXY topLeft = { rt.x, rt.y };
|
||||
ScreenCoordsXY bottomRight = { rt.x + rt.width - 1, rt.y + rt.height - 1 };
|
||||
uint8_t outcode1 = ComputeOutCode(line.Point1, topLeft, bottomRight);
|
||||
uint8_t outcode2 = ComputeOutCode(line.Point2, topLeft, bottomRight);
|
||||
uint8_t outcode1 = ComputeOutCode(line.point1, topLeft, bottomRight);
|
||||
uint8_t outcode2 = ComputeOutCode(line.point2, topLeft, bottomRight);
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -796,39 +796,39 @@ bool OpenGLDrawingContext::CohenSutherlandLineClip(ScreenLine& line, const Rende
|
||||
// clang-format off
|
||||
if (outcodeOut & kCSBottom)
|
||||
{
|
||||
clipped.x = line.Point1.x + (line.Point2.x - line.Point1.x) *
|
||||
(bottomRight.y - line.Point1.y) / (line.Point2.y - line.Point1.y);
|
||||
clipped.x = line.point1.x + (line.point2.x - line.point1.x) *
|
||||
(bottomRight.y - line.point1.y) / (line.point2.y - line.point1.y);
|
||||
clipped.y = bottomRight.y;
|
||||
}
|
||||
else if (outcodeOut & kCSTop)
|
||||
{
|
||||
clipped.x = line.Point1.x + (line.Point2.x - line.Point1.x) *
|
||||
(topLeft.y - line.Point1.y) / (line.Point2.y - line.Point1.y);
|
||||
clipped.x = line.point1.x + (line.point2.x - line.point1.x) *
|
||||
(topLeft.y - line.point1.y) / (line.point2.y - line.point1.y);
|
||||
clipped.y = topLeft.y;
|
||||
}
|
||||
else if (outcodeOut & kCSRight)
|
||||
{
|
||||
clipped.y = line.Point1.y + (line.Point2.y - line.Point1.y) *
|
||||
(bottomRight.x - line.Point1.x) / (line.Point2.x - line.Point1.x);
|
||||
clipped.y = line.point1.y + (line.point2.y - line.point1.y) *
|
||||
(bottomRight.x - line.point1.x) / (line.point2.x - line.point1.x);
|
||||
clipped.x = bottomRight.x;
|
||||
}
|
||||
else if (outcodeOut & kCSLeft)
|
||||
{
|
||||
clipped.y = line.Point1.y + (line.Point2.y - line.Point1.y) *
|
||||
(topLeft.x - line.Point1.x) / (line.Point2.x - line.Point1.x);
|
||||
clipped.y = line.point1.y + (line.point2.y - line.point1.y) *
|
||||
(topLeft.x - line.point1.x) / (line.point2.x - line.point1.x);
|
||||
clipped.x = topLeft.x;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
if (outcodeOut == outcode1)
|
||||
{
|
||||
line.Point1 = clipped;
|
||||
outcode1 = ComputeOutCode(line.Point1, topLeft, bottomRight);
|
||||
line.point1 = clipped;
|
||||
outcode1 = ComputeOutCode(line.point1, topLeft, bottomRight);
|
||||
}
|
||||
else
|
||||
{
|
||||
line.Point2 = clipped;
|
||||
outcode2 = ComputeOutCode(line.Point2, topLeft, bottomRight);
|
||||
line.point2 = clipped;
|
||||
outcode2 = ComputeOutCode(line.point2, topLeft, bottomRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -838,18 +838,18 @@ void OpenGLDrawingContext::DrawLine(RenderTarget& rt, PaletteIndex colour, const
|
||||
Guard::Assert(_inDraw == true);
|
||||
|
||||
const ZoomLevel zoom = rt.zoom_level;
|
||||
ScreenLine trimmedLine = { { zoom.ApplyInversedTo(line.GetX1()), zoom.ApplyInversedTo(line.GetY1()) },
|
||||
{ zoom.ApplyInversedTo(line.GetX2()), zoom.ApplyInversedTo(line.GetY2()) } };
|
||||
ScreenLine trimmedLine = { { zoom.ApplyInversedTo(line.getX1()), zoom.ApplyInversedTo(line.getY1()) },
|
||||
{ zoom.ApplyInversedTo(line.getX2()), zoom.ApplyInversedTo(line.getY2()) } };
|
||||
if (!CohenSutherlandLineClip(trimmedLine, rt))
|
||||
return;
|
||||
|
||||
DrawLineCommand& command = _commandBuffers.lines.allocate();
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
const int32_t x1 = trimmedLine.GetX1() - rt.x + clip.GetLeft();
|
||||
const int32_t y1 = trimmedLine.GetY1() - rt.y + clip.GetTop();
|
||||
const int32_t x2 = trimmedLine.GetX2() - rt.x + clip.GetLeft();
|
||||
const int32_t y2 = trimmedLine.GetY2() - rt.y + clip.GetTop();
|
||||
const int32_t x1 = trimmedLine.getX1() - rt.x + clip.getLeft();
|
||||
const int32_t y1 = trimmedLine.getY1() - rt.y + clip.getTop();
|
||||
const int32_t x2 = trimmedLine.getX2() - rt.x + clip.getLeft();
|
||||
const int32_t y2 = trimmedLine.getY2() - rt.y + clip.getTop();
|
||||
|
||||
command.bounds = { x1, y1, x2, y2 };
|
||||
command.colour = static_cast<GLuint>(colour);
|
||||
@@ -922,10 +922,10 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
|
||||
int32_t bottom = top + rt.zoom_level.ApplyInversedTo(g1Element->height + yModifier);
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
left += clip.GetLeft() - rt.x;
|
||||
top += clip.GetTop() - rt.y;
|
||||
right += clip.GetLeft() - rt.x;
|
||||
bottom += clip.GetTop() - rt.y;
|
||||
left += clip.getLeft() - rt.x;
|
||||
top += clip.getTop() - rt.y;
|
||||
right += clip.getLeft() - rt.x;
|
||||
bottom += clip.getTop() - rt.y;
|
||||
|
||||
const float zoom = rt.zoom_level >= ZoomLevel{ 0 } ? static_cast<float>(rt.zoom_level.ApplyTo(1))
|
||||
: 1.0f / static_cast<float>(rt.zoom_level.ApplyInversedTo(1));
|
||||
@@ -966,7 +966,7 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
|
||||
{
|
||||
DrawRectCommand& command = _commandBuffers.transparent.allocate();
|
||||
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = texture.index;
|
||||
command.texColourBounds = texture.coords;
|
||||
command.texMaskAtlas = texture.index;
|
||||
@@ -982,7 +982,7 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
|
||||
{
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = texture.index;
|
||||
command.texColourBounds = texture.coords;
|
||||
command.texMaskAtlas = 0;
|
||||
@@ -1036,17 +1036,17 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(
|
||||
bottom = rt.zoom_level.ApplyInversedTo(bottom);
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
left += clip.GetLeft() - rt.x;
|
||||
top += clip.GetTop() - rt.y;
|
||||
right += clip.GetLeft() - rt.x;
|
||||
bottom += clip.GetTop() - rt.y;
|
||||
left += clip.getLeft() - rt.x;
|
||||
top += clip.getTop() - rt.y;
|
||||
right += clip.getLeft() - rt.x;
|
||||
bottom += clip.getTop() - rt.y;
|
||||
|
||||
const float zoom = rt.zoom_level >= ZoomLevel{ 0 } ? static_cast<float>(rt.zoom_level.ApplyTo(1))
|
||||
: 1.0f / static_cast<float>(rt.zoom_level.ApplyInversedTo(1));
|
||||
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = textureColour.index;
|
||||
command.texColourBounds = textureColour.coords;
|
||||
command.texMaskAtlas = textureMask.index;
|
||||
@@ -1091,14 +1091,14 @@ void OpenGLDrawingContext::DrawSpriteSolid(RenderTarget& rt, const ImageId image
|
||||
}
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
left += clip.GetLeft() - rt.x;
|
||||
top += clip.GetTop() - rt.y;
|
||||
right += clip.GetLeft() - rt.x;
|
||||
bottom += clip.GetTop() - rt.y;
|
||||
left += clip.getLeft() - rt.x;
|
||||
top += clip.getTop() - rt.y;
|
||||
right += clip.getLeft() - rt.x;
|
||||
bottom += clip.getTop() - rt.y;
|
||||
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = 0;
|
||||
command.texColourBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
command.texMaskAtlas = texture.index;
|
||||
@@ -1143,17 +1143,17 @@ void OpenGLDrawingContext::DrawGlyph(RenderTarget& rt, const ImageId image, int3
|
||||
bottom = rt.zoom_level.ApplyInversedTo(bottom);
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
left += clip.GetLeft() - rt.x;
|
||||
top += clip.GetTop() - rt.y;
|
||||
right += clip.GetLeft() - rt.x;
|
||||
bottom += clip.GetTop() - rt.y;
|
||||
left += clip.getLeft() - rt.x;
|
||||
top += clip.getTop() - rt.y;
|
||||
right += clip.getLeft() - rt.x;
|
||||
bottom += clip.getTop() - rt.y;
|
||||
|
||||
const float zoom = rt.zoom_level >= ZoomLevel{ 0 } ? static_cast<float>(rt.zoom_level.ApplyTo(1))
|
||||
: 1.0f / static_cast<float>(rt.zoom_level.ApplyInversedTo(1));
|
||||
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = texture.index;
|
||||
command.texColourBounds = texture.coords;
|
||||
command.texMaskAtlas = 0;
|
||||
@@ -1202,10 +1202,10 @@ void OpenGLDrawingContext::DrawTTFBitmap(
|
||||
}
|
||||
|
||||
const ScreenRect clip = CalculateClipping(rt);
|
||||
left += clip.GetLeft() - rt.x;
|
||||
top += clip.GetTop() - rt.y;
|
||||
right += clip.GetLeft() - rt.x;
|
||||
bottom += clip.GetTop() - rt.y;
|
||||
left += clip.getLeft() - rt.x;
|
||||
top += clip.getTop() - rt.y;
|
||||
right += clip.getLeft() - rt.x;
|
||||
bottom += clip.getTop() - rt.y;
|
||||
|
||||
if (info.colourFlags.has(ColourFlag::withOutline))
|
||||
{
|
||||
@@ -1218,7 +1218,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
|
||||
for (auto b : boundsArr)
|
||||
{
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = texture.index;
|
||||
command.texColourBounds = texture.coords;
|
||||
command.texMaskAtlas = 0;
|
||||
@@ -1234,7 +1234,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
|
||||
if (info.colourFlags.has(ColourFlag::inset))
|
||||
{
|
||||
DrawRectCommand& command = _commandBuffers.rects.allocate();
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = texture.index;
|
||||
command.texColourBounds = texture.coords;
|
||||
command.texMaskAtlas = 0;
|
||||
@@ -1248,7 +1248,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
|
||||
}
|
||||
auto& cmdBuf = hintingThreshold > 0 ? _commandBuffers.transparent : _commandBuffers.rects;
|
||||
DrawRectCommand& command = cmdBuf.allocate();
|
||||
command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() };
|
||||
command.clip = { clip.getLeft(), clip.getTop(), clip.getRight(), clip.getBottom() };
|
||||
command.texColourAtlas = texture.index;
|
||||
command.texColourBounds = texture.coords;
|
||||
command.texMaskAtlas = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRCT2::Graph
|
||||
const int32_t yLabelStepPx, const ColourWithFlags lineCol, const FmtString& fmt)
|
||||
{
|
||||
T curLabel = max;
|
||||
int32_t curScreenPos = internalBounds.GetTop() - 5;
|
||||
int32_t curScreenPos = internalBounds.getTop() - 5;
|
||||
const T yLabelStep = (max - min) / (numYLabels - 1);
|
||||
for (int32_t i = 0; i < numYLabels; i++)
|
||||
{
|
||||
@@ -40,15 +40,15 @@ namespace OpenRCT2::Graph
|
||||
char buffer[64]{};
|
||||
FormatStringToBuffer(buffer, sizeof(buffer), fmt, curLabel);
|
||||
drawText(
|
||||
rt, { internalBounds.GetLeft() - kYTickMarkPadding, curScreenPos }, buffer,
|
||||
rt, { internalBounds.getLeft() - kYTickMarkPadding, curScreenPos }, buffer,
|
||||
{ FontStyle::small, TextAlignment::right });
|
||||
// Draw Y label tick mark
|
||||
Rectangle::fill(
|
||||
rt, { { internalBounds.GetLeft() - 5, curScreenPos + 5 }, { internalBounds.GetLeft(), curScreenPos + 5 } },
|
||||
rt, { { internalBounds.getLeft() - 5, curScreenPos + 5 }, { internalBounds.getLeft(), curScreenPos + 5 } },
|
||||
PaletteIndex::pi10);
|
||||
// Draw horizontal gridline
|
||||
Rectangle::fillInset(
|
||||
rt, { { internalBounds.GetLeft(), curScreenPos + 5 }, { internalBounds.GetRight(), curScreenPos + 5 } },
|
||||
rt, { { internalBounds.getLeft(), curScreenPos + 5 }, { internalBounds.getRight(), curScreenPos + 5 } },
|
||||
lineCol, Rectangle::BorderStyle::inset);
|
||||
curScreenPos += yLabelStepPx;
|
||||
curLabel -= yLabelStep;
|
||||
@@ -62,7 +62,7 @@ namespace OpenRCT2::Graph
|
||||
int32_t currentMonth = date.GetMonth();
|
||||
int32_t currentDay = date.GetMonthTicks();
|
||||
int32_t yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31;
|
||||
auto screenCoords = bounds.Point1;
|
||||
auto screenCoords = bounds.point1;
|
||||
for (int32_t i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (series[i] != TkNoValue && yearOver32 % 4 == 0)
|
||||
@@ -88,20 +88,20 @@ namespace OpenRCT2::Graph
|
||||
RenderTarget& rt, const T value, const int32_t hoverIdx, const ScreenRect& bounds, const int32_t xStep,
|
||||
const T minValue, const T maxValue, const_utf8string text, ColourWithFlags textCol)
|
||||
{
|
||||
const T screenRange = bounds.GetHeight();
|
||||
const T screenRange = bounds.getHeight();
|
||||
const T valueRange = maxValue - minValue;
|
||||
|
||||
const int32_t yPosition = bounds.GetBottom() - ((value - minValue) * screenRange) / valueRange;
|
||||
ScreenCoordsXY coords = { bounds.GetRight() - hoverIdx * xStep, yPosition };
|
||||
const int32_t yPosition = bounds.getBottom() - ((value - minValue) * screenRange) / valueRange;
|
||||
ScreenCoordsXY coords = { bounds.getRight() - hoverIdx * xStep, yPosition };
|
||||
|
||||
GfxDrawDashedLine(
|
||||
rt,
|
||||
{
|
||||
{ coords.x, bounds.GetTop() },
|
||||
{ coords.x, bounds.GetBottom() },
|
||||
{ coords.x, bounds.getTop() },
|
||||
{ coords.x, bounds.getBottom() },
|
||||
},
|
||||
kDashLength, PaletteIndex::pi10);
|
||||
GfxDrawDashedLine(rt, { { bounds.GetLeft(), coords.y }, coords }, kDashLength, PaletteIndex::pi10);
|
||||
GfxDrawDashedLine(rt, { { bounds.getLeft(), coords.y }, coords }, kDashLength, PaletteIndex::pi10);
|
||||
|
||||
drawText(rt, coords - ScreenCoordsXY{ 0, 16 }, text, { textCol, TextAlignment::centre });
|
||||
|
||||
@@ -114,18 +114,18 @@ namespace OpenRCT2::Graph
|
||||
RenderTarget& rt, const T* series, const int32_t count, const ScreenRect& bounds, const int32_t xStep, const T minValue,
|
||||
const T maxValue)
|
||||
{
|
||||
const T screenRange = bounds.GetHeight();
|
||||
const T screenRange = bounds.getHeight();
|
||||
const T valueRange = maxValue - minValue;
|
||||
|
||||
ScreenCoordsXY lastCoords;
|
||||
bool lastCoordsValid = false;
|
||||
ScreenCoordsXY coords = bounds.Point1;
|
||||
ScreenCoordsXY coords = bounds.point1;
|
||||
for (int32_t i = count - 1; i >= 0; i--)
|
||||
{
|
||||
auto value = series[i];
|
||||
if (value != TkNoValue)
|
||||
{
|
||||
coords.y = bounds.GetBottom() - ((value - minValue) * screenRange) / valueRange;
|
||||
coords.y = bounds.getBottom() - ((value - minValue) * screenRange) / valueRange;
|
||||
|
||||
if constexpr (TbackgroundLine)
|
||||
{
|
||||
|
||||
@@ -39,11 +39,11 @@ namespace OpenRCT2::Graph
|
||||
|
||||
void RecalculateLayout(const ScreenRect newBounds, const int32_t newNumYLabels, const int32_t newNumPoints)
|
||||
{
|
||||
yLabelStepPx = (newBounds.GetBottom() - newBounds.GetTop()) / (newNumYLabels - 1);
|
||||
xStepPx = (newBounds.GetRight() - newBounds.GetLeft()) / (newNumPoints - 1);
|
||||
yLabelStepPx = (newBounds.getBottom() - newBounds.getTop()) / (newNumYLabels - 1);
|
||||
xStepPx = (newBounds.getRight() - newBounds.getLeft()) / (newNumPoints - 1);
|
||||
// adjust bounds to be exact multiples of the steps.
|
||||
internalBounds = { newBounds.Point1,
|
||||
newBounds.Point1
|
||||
internalBounds = { newBounds.point1,
|
||||
newBounds.point1
|
||||
+ ScreenCoordsXY{ xStepPx * (newNumPoints - 1), yLabelStepPx * (newNumYLabels - 1) } };
|
||||
numPoints = newNumPoints;
|
||||
numYLabels = newNumYLabels;
|
||||
@@ -54,9 +54,9 @@ namespace OpenRCT2::Graph
|
||||
const ScreenCoordsXY cursorPos = ContextGetCursorPositionScaled();
|
||||
|
||||
int32_t i = -1;
|
||||
if (internalBounds.Contains(cursorPos))
|
||||
if (internalBounds.contains(cursorPos))
|
||||
{
|
||||
i = (numPoints - 1) - (cursorPos.x - internalBounds.GetLeft() + (xStepPx / 2)) / xStepPx;
|
||||
i = (numPoints - 1) - (cursorPos.x - internalBounds.getLeft() + (xStepPx / 2)) / xStepPx;
|
||||
if (i < 0)
|
||||
i = 1;
|
||||
if (i > numPoints - 1)
|
||||
|
||||
@@ -747,8 +747,8 @@ namespace OpenRCT2::Ui
|
||||
screenCoords - ScreenCoordsXY{ peep->spriteData.width, peep->spriteData.heightMin },
|
||||
screenCoords + ScreenCoordsXY{ peep->spriteData.width, peep->spriteData.heightMax });
|
||||
|
||||
auto distance = abs(((spriteRect.GetLeft() + spriteRect.GetRight()) / 2) - viewportCoords.x)
|
||||
+ abs(((spriteRect.GetTop() + spriteRect.GetBottom()) / 2) - viewportCoords.y);
|
||||
auto distance = abs(((spriteRect.getLeft() + spriteRect.getRight()) / 2) - viewportCoords.x)
|
||||
+ abs(((spriteRect.getTop() + spriteRect.getBottom()) / 2) - viewportCoords.y);
|
||||
if (distance > maxDistance)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace OpenRCT2::Audio
|
||||
bottom -= quarter_h;
|
||||
}
|
||||
|
||||
if (left >= vehicle.spriteData.spriteRect.GetRight() || bottom >= vehicle.spriteData.spriteRect.GetBottom())
|
||||
if (left >= vehicle.spriteData.spriteRect.getRight() || bottom >= vehicle.spriteData.spriteRect.getBottom())
|
||||
return false;
|
||||
|
||||
auto right = gMusicTrackingViewport->ViewWidth() + left;
|
||||
@@ -143,7 +143,7 @@ namespace OpenRCT2::Audio
|
||||
top += quarter_h + quarter_h;
|
||||
}
|
||||
|
||||
if (right < vehicle.spriteData.spriteRect.GetRight() || top < vehicle.spriteData.spriteRect.GetTop())
|
||||
if (right < vehicle.spriteData.spriteRect.getRight() || top < vehicle.spriteData.spriteRect.getTop())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -173,7 +173,7 @@ namespace OpenRCT2::Audio
|
||||
{
|
||||
VehicleSoundParams param;
|
||||
param.priority = priority;
|
||||
int32_t panX = (vehicle.spriteData.spriteRect.GetLeft() / 2) + (vehicle.spriteData.spriteRect.GetRight() / 2)
|
||||
int32_t panX = (vehicle.spriteData.spriteRect.getLeft() / 2) + (vehicle.spriteData.spriteRect.getRight() / 2)
|
||||
- gMusicTrackingViewport->viewPos.x;
|
||||
panX = gMusicTrackingViewport->zoom.ApplyInversedTo(panX);
|
||||
panX += gMusicTrackingViewport->pos.x;
|
||||
@@ -185,7 +185,7 @@ namespace OpenRCT2::Audio
|
||||
}
|
||||
param.panX = ((((panX * 65536) / screenWidth) - 0x8000) >> 4);
|
||||
|
||||
int32_t panY = (vehicle.spriteData.spriteRect.GetTop() / 2) + (vehicle.spriteData.spriteRect.GetBottom() / 2)
|
||||
int32_t panY = (vehicle.spriteData.spriteRect.getTop() / 2) + (vehicle.spriteData.spriteRect.getBottom() / 2)
|
||||
- gMusicTrackingViewport->viewPos.y;
|
||||
panY = gMusicTrackingViewport->zoom.ApplyInversedTo(panY);
|
||||
panY += gMusicTrackingViewport->pos.y;
|
||||
|
||||
@@ -63,10 +63,10 @@ namespace OpenRCT2::Scripting
|
||||
auto range = GetMapRange(ctx, value);
|
||||
if (range)
|
||||
{
|
||||
gMapSelectPositionA.x = range->GetX1();
|
||||
gMapSelectPositionA.y = range->GetY1();
|
||||
gMapSelectPositionB.x = range->GetX2();
|
||||
gMapSelectPositionB.y = range->GetY2();
|
||||
gMapSelectPositionA.x = range->getX1();
|
||||
gMapSelectPositionA.y = range->getY1();
|
||||
gMapSelectPositionB.x = range->getX2();
|
||||
gMapSelectPositionB.y = range->getY2();
|
||||
gMapSelectType = MapSelectType::full;
|
||||
gMapSelectFlags.set(MapSelectFlag::enable);
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto checkmark = Formatter();
|
||||
checkmark.Add<StringId>(STR_STRING);
|
||||
checkmark.Add<char*>(kCheckMarkString);
|
||||
drawText(rt, ScreenCoordsXY{ rect.GetLeft() + 1, rect.GetTop() }, STR_WINDOW_COLOUR_2_STRINGID, checkmark);
|
||||
drawText(rt, ScreenCoordsXY{ rect.getLeft() + 1, rect.getTop() }, STR_WINDOW_COLOUR_2_STRINGID, checkmark);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -777,7 +777,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
Formatter ft;
|
||||
ft.Add<money64>(currentValue);
|
||||
drawText(rt, _graphBounds.Point1 - ScreenCoordsXY{ 0, 11 }, fmt, ft);
|
||||
drawText(rt, _graphBounds.point1 - ScreenCoordsXY{ 0, 11 }, fmt, ft);
|
||||
|
||||
// Graph
|
||||
Rectangle::fillInset(
|
||||
@@ -787,7 +787,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr ScreenCoordsXY offset{ 1, 1 };
|
||||
constexpr ScreenCoordsXY bigOffset{ 5, 5 };
|
||||
Rectangle::fillInset(
|
||||
rt, { _graphBounds.Point2 - bigOffset, _graphBounds.Point2 - offset }, colours[1], Rectangle::BorderStyle::none,
|
||||
rt, { _graphBounds.point2 - bigOffset, _graphBounds.point2 - offset }, colours[1], Rectangle::BorderStyle::none,
|
||||
Rectangle::FillBrightness::light, Rectangle::FillMode::dontLightenWhenInset);
|
||||
|
||||
Graph::DrawFinanceGraph(rt, _graphProps);
|
||||
@@ -825,7 +825,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
_graphBounds = { windowPos + ScreenCoordsXY{ graphPageWidget->left + 4, graphPageWidget->top + 15 },
|
||||
windowPos + ScreenCoordsXY{ graphPageWidget->right - 4, graphPageWidget->bottom - 4 } };
|
||||
_graphProps.RecalculateLayout(
|
||||
{ _graphBounds.Point1 + dynamicPadding, _graphBounds.Point2 - kGraphBottomRightPadding }, kGraphNumYLabels,
|
||||
{ _graphBounds.point1 + dynamicPadding, _graphBounds.point2 - kGraphBottomRightPadding }, kGraphNumYLabels,
|
||||
kGraphNumPoints);
|
||||
_graphProps.lineCol = colours[2];
|
||||
}
|
||||
|
||||
@@ -1131,9 +1131,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
static std::vector<ProvisionalTile> buildTileVector(MapRange range, int32_t baseZ)
|
||||
{
|
||||
std::vector<ProvisionalTile> tiles{};
|
||||
for (auto y = range.GetY1(); y <= range.GetY2(); y += kCoordsXYStep)
|
||||
for (auto y = range.getY1(); y <= range.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (auto x = range.GetX1(); x <= range.GetX2(); x += kCoordsXYStep)
|
||||
for (auto x = range.getX1(); x <= range.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
FootpathPlacementResult placement = { baseZ, {} };
|
||||
if (baseZ == 0)
|
||||
@@ -1169,13 +1169,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
int32_t rangeXTiles = (range.GetX2() - range.GetX1()) / kCoordsXYStep + 1;
|
||||
int32_t rangeYTiles = (range.GetY2() - range.GetY1()) / kCoordsXYStep + 1;
|
||||
int32_t rangeXTiles = (range.getX2() - range.getX1()) / kCoordsXYStep + 1;
|
||||
int32_t rangeYTiles = (range.getY2() - range.getY1()) / kCoordsXYStep + 1;
|
||||
size_t expectedTileCount = static_cast<size_t>(rangeXTiles * rangeYTiles);
|
||||
|
||||
bool currentlyUsingModifiers = _footpathPlaceShiftState || _footpathPlaceCtrlState;
|
||||
if (_provisionalFootpath.flags.has(ProvisionalPathFlag::placed) && range.Point1 == _provisionalFootpath.positionA
|
||||
&& range.Point2 == _provisionalFootpath.positionB && baseZ == _provisionalFootpath.startZ
|
||||
if (_provisionalFootpath.flags.has(ProvisionalPathFlag::placed) && range.point1 == _provisionalFootpath.positionA
|
||||
&& range.point2 == _provisionalFootpath.positionB && baseZ == _provisionalFootpath.startZ
|
||||
&& _provisionalFootpath.tiles.size() == expectedTileCount
|
||||
&& _provisionalFootpath.usingModifiers == currentlyUsingModifiers)
|
||||
{
|
||||
@@ -1188,7 +1188,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
FootpathUpdateProvisional();
|
||||
|
||||
std::vector<ProvisionalTile> tiles;
|
||||
bool isSingleTile = (range.Point1 == range.Point2);
|
||||
bool isSingleTile = (range.point1 == range.point2);
|
||||
|
||||
if (baseZ == 0 && !currentlyUsingModifiers && !isSingleTile)
|
||||
{
|
||||
@@ -1202,7 +1202,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto pathType = gFootpathSelection.getSelectedSurface();
|
||||
auto constructFlags = FootpathCreateConstructFlags(pathType);
|
||||
const auto footpathCost = FootpathProvisionalSet(
|
||||
pathType, gFootpathSelection.railings, range.Point1, range.Point2, baseZ, tiles, constructFlags);
|
||||
pathType, gFootpathSelection.railings, range.point1, range.point2, baseZ, tiles, constructFlags);
|
||||
_provisionalFootpath.usingModifiers = currentlyUsingModifiers;
|
||||
|
||||
if (_windowFootpathCost != footpathCost)
|
||||
|
||||
@@ -675,7 +675,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y };
|
||||
|
||||
_ratingProps.RecalculateLayout(
|
||||
{ _ratingGraphBounds.Point1 + dynamicPadding, _ratingGraphBounds.Point2 - kGraphBottomRightPadding },
|
||||
{ _ratingGraphBounds.point1 + dynamicPadding, _ratingGraphBounds.point2 - kGraphBottomRightPadding },
|
||||
kGraphNumYLabels, kParkRatingHistorySize);
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr ScreenCoordsXY offset{ 1, 1 };
|
||||
constexpr ScreenCoordsXY bigOffset{ 5, 5 };
|
||||
Rectangle::fillInset(
|
||||
rt, { _ratingGraphBounds.Point2 - bigOffset, _ratingGraphBounds.Point2 - offset }, colours[1],
|
||||
rt, { _ratingGraphBounds.point2 - bigOffset, _ratingGraphBounds.point2 - offset }, colours[1],
|
||||
Rectangle::BorderStyle::none, Rectangle::FillBrightness::light, Rectangle::FillMode::dontLightenWhenInset);
|
||||
|
||||
Graph::DrawRatingGraph(rt, _ratingProps);
|
||||
@@ -755,7 +755,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
const ScreenCoordsXY dynamicPadding{ std::max(maxGraphWidth, kGraphTopLeftPadding.x), kGraphTopLeftPadding.y };
|
||||
|
||||
_guestProps.RecalculateLayout(
|
||||
{ _guestGraphBounds.Point1 + dynamicPadding, _guestGraphBounds.Point2 - kGraphBottomRightPadding },
|
||||
{ _guestGraphBounds.point1 + dynamicPadding, _guestGraphBounds.point2 - kGraphBottomRightPadding },
|
||||
kGraphNumYLabels, kGuestsInParkHistorySize);
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr ScreenCoordsXY offset{ 1, 1 };
|
||||
constexpr ScreenCoordsXY bigOffset{ 5, 5 };
|
||||
Rectangle::fillInset(
|
||||
rt, { _guestGraphBounds.Point2 - bigOffset, _guestGraphBounds.Point2 - offset }, colours[1],
|
||||
rt, { _guestGraphBounds.point2 - bigOffset, _guestGraphBounds.point2 - offset }, colours[1],
|
||||
Rectangle::BorderStyle::none, Rectangle::FillBrightness::light, Rectangle::FillMode::dontLightenWhenInset);
|
||||
|
||||
Graph::DrawGuestGraph(rt, _guestProps);
|
||||
|
||||
@@ -3175,9 +3175,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
_lastProvisionalError = {};
|
||||
|
||||
auto mapRange = getMapSelectRange();
|
||||
for (auto y = mapRange.GetY1(); y <= mapRange.GetY2(); y += kCoordsXYStep)
|
||||
for (auto y = mapRange.getY1(); y <= mapRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (auto x = mapRange.GetX1(); x <= mapRange.GetX2(); x += kCoordsXYStep)
|
||||
for (auto x = mapRange.getX1(); x <= mapRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
auto wallPlaceAction = GameActions::WallPlaceAction(
|
||||
tabSelection.EntryIndex, { x, y, gSceneryPlaceZ }, _startEdge, _sceneryPrimaryColour,
|
||||
@@ -3246,7 +3246,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
auto mapRange = getMapSelectRange();
|
||||
CoordsXYZ lastLocation = { mapRange.Point2, gSceneryPlaceZ };
|
||||
CoordsXYZ lastLocation = { mapRange.point2, gSceneryPlaceZ };
|
||||
auto& gameState = getGameState();
|
||||
|
||||
// First query all tiles to get total cost and check for errors
|
||||
|
||||
@@ -1012,7 +1012,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements
|
||||
const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1;
|
||||
const ScreenRect checkboxColumnRect{ { 2, 0 }, { 15, screenCoords.y } };
|
||||
if (index >= 0 && checkboxColumnRect.Contains(screenCoords))
|
||||
if (index >= 0 && checkboxColumnRect.contains(screenCoords))
|
||||
{ // Checkbox was clicked
|
||||
ToggleInvisibility(index);
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_NEW_VERSION].setVisible(newVersionAvailable);
|
||||
|
||||
if (newVersionAvailable)
|
||||
_filterRect.Point1.y = windowPos.y;
|
||||
_filterRect.point1.y = windowPos.y;
|
||||
}
|
||||
|
||||
void onDraw(RenderTarget& rt) override
|
||||
|
||||
@@ -65,10 +65,10 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
void Visit(MapRange& param)
|
||||
{
|
||||
Visit("x1", param.Point1.x);
|
||||
Visit("y1", param.Point1.y);
|
||||
Visit("x2", param.Point2.x);
|
||||
Visit("y2", param.Point2.y);
|
||||
Visit("x1", param.point1.x);
|
||||
Visit("y1", param.point1.y);
|
||||
Visit("x2", param.point2.x);
|
||||
Visit("y2", param.point2.y);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -68,24 +68,24 @@ namespace OpenRCT2::GameActions
|
||||
MapRange normRange = _range.normalise();
|
||||
// Keep big coordinates within map boundaries
|
||||
auto mapSizeMaxXY = GetMapSizeMaxXY();
|
||||
auto aX = std::max<decltype(normRange.GetX1())>(32, normRange.GetX1());
|
||||
auto bX = std::min<decltype(normRange.GetX2())>(mapSizeMaxXY.x, normRange.GetX2());
|
||||
auto aY = std::max<decltype(normRange.GetY1())>(32, normRange.GetY1());
|
||||
auto bY = std::min<decltype(normRange.GetY2())>(mapSizeMaxXY.y, normRange.GetY2());
|
||||
auto aX = std::max<decltype(normRange.getX1())>(32, normRange.getX1());
|
||||
auto bX = std::min<decltype(normRange.getX2())>(mapSizeMaxXY.x, normRange.getX2());
|
||||
auto aY = std::max<decltype(normRange.getY1())>(32, normRange.getY1());
|
||||
auto bY = std::min<decltype(normRange.getY2())>(mapSizeMaxXY.y, normRange.getY2());
|
||||
|
||||
MapRange validRange = MapRange{ aX, aY, bX, bY };
|
||||
|
||||
CoordsXYZ centre{ (validRange.GetX1() + validRange.GetX2()) / 2 + 16,
|
||||
(validRange.GetY1() + validRange.GetY2()) / 2 + 16, 0 };
|
||||
CoordsXYZ centre{ (validRange.getX1() + validRange.getX2()) / 2 + 16,
|
||||
(validRange.getY1() + validRange.getY2()) / 2 + 16, 0 };
|
||||
centre.z = TileElementHeight(centre);
|
||||
|
||||
res.position = centre;
|
||||
res.expenditure = ExpenditureType::landPurchase;
|
||||
|
||||
// Game command modified to accept selection size
|
||||
for (auto y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (auto y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (auto x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (auto x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
|
||||
@@ -74,8 +74,8 @@ namespace OpenRCT2::GameActions
|
||||
auto res = Result();
|
||||
|
||||
auto validRange = ClampRangeWithinMap(_range.normalise());
|
||||
CoordsXYZ centre{ (validRange.GetX1() + validRange.GetX2()) / 2 + 16,
|
||||
(validRange.GetY1() + validRange.GetY2()) / 2 + 16, 0 };
|
||||
CoordsXYZ centre{ (validRange.getX1() + validRange.getX2()) / 2 + 16,
|
||||
(validRange.getY1() + validRange.getY2()) / 2 + 16, 0 };
|
||||
centre.z = TileElementHeight(centre);
|
||||
|
||||
res.position = centre;
|
||||
@@ -87,9 +87,9 @@ namespace OpenRCT2::GameActions
|
||||
}
|
||||
|
||||
// Game command modified to accept selection size
|
||||
for (auto y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (auto y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (auto x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (auto x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
static void InvalidatePatrolTiles(const MapRange& range)
|
||||
{
|
||||
MapInvalidateRegion(range.Point1, range.Point2);
|
||||
MapInvalidateRegion(range.point1, range.point2);
|
||||
}
|
||||
|
||||
Result StaffSetPatrolAreaAction::QueryExecute(GameState_t& gameState, bool executing) const
|
||||
@@ -70,9 +70,9 @@ namespace OpenRCT2::GameActions
|
||||
}
|
||||
|
||||
auto validRange = ClampRangeWithinMap(_range);
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid({ x, y }))
|
||||
{
|
||||
|
||||
@@ -67,8 +67,8 @@ namespace OpenRCT2::GameActions
|
||||
result.errorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
||||
result.expenditure = ExpenditureType::landscaping;
|
||||
|
||||
auto x = (_range.GetX1() + _range.GetX2()) / 2 + 16;
|
||||
auto y = (_range.GetY1() + _range.GetY2()) / 2 + 16;
|
||||
auto x = (_range.getX1() + _range.getX2()) / 2 + 16;
|
||||
auto y = (_range.getY1() + _range.getY2()) / 2 + 16;
|
||||
auto z = TileElementHeight({ x, y });
|
||||
result.position = CoordsXYZ(x, y, z);
|
||||
|
||||
@@ -85,9 +85,9 @@ namespace OpenRCT2::GameActions
|
||||
money64 totalCost = 0;
|
||||
|
||||
auto validRange = ClampRangeWithinMap(_range);
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (LocationValid({ x, y }) && MapCanClearAt(gameState, { x, y }))
|
||||
{
|
||||
|
||||
@@ -83,9 +83,9 @@ namespace OpenRCT2::GameActions
|
||||
uint8_t maxHeight = MapGetHighestLandHeight(validRange);
|
||||
bool withinOwnership = false;
|
||||
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
|
||||
@@ -84,9 +84,9 @@ namespace OpenRCT2::GameActions
|
||||
uint8_t minHeight = MapGetLowestLandHeight(validRange);
|
||||
bool withinOwnership = false;
|
||||
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
|
||||
@@ -337,10 +337,10 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
auto normRange = _range.normalise();
|
||||
// Cap bounds to map
|
||||
auto l = std::max(normRange.GetX1(), 32);
|
||||
auto t = std::max(normRange.GetY1(), 32);
|
||||
auto r = std::clamp(normRange.GetX2(), 0, kMaximumTileStartXY);
|
||||
auto b = std::clamp(normRange.GetY2(), 0, kMaximumTileStartXY);
|
||||
auto l = std::max(normRange.getX1(), 32);
|
||||
auto t = std::max(normRange.getY1(), 32);
|
||||
auto r = std::clamp(normRange.getX2(), 0, kMaximumTileStartXY);
|
||||
auto b = std::clamp(normRange.getY2(), 0, kMaximumTileStartXY);
|
||||
auto validRange = MapRange{ l, t, r, b };
|
||||
|
||||
int32_t centreZ = TileElementHeight(_coords);
|
||||
@@ -360,51 +360,51 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
// Smooth the 4 corners
|
||||
{ // top-left
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX1(), validRange.GetY1() });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX1(), validRange.getY1() });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
int32_t z = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, -32, 0, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, -32, 0, 2);
|
||||
}
|
||||
}
|
||||
{ // bottom-left
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX1(), validRange.GetY2() });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX1(), validRange.getY2() });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
int32_t z = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY2() }, z, -32, 32, 1, 3);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY2() }, z, -32, 32, 1, 3);
|
||||
}
|
||||
}
|
||||
{ // bottom-right
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX2(), validRange.GetY2() });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX2(), validRange.getY2() });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
int32_t z = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX2(), validRange.GetY2() }, z, 32, 32, 2, 0);
|
||||
gameState, isExecuting, { validRange.getX2(), validRange.getY2() }, z, 32, 32, 2, 0);
|
||||
}
|
||||
}
|
||||
{ // top-right
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX2(), validRange.GetY1() });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX2(), validRange.getY1() });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
int32_t z = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 1)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX2(), validRange.GetY1() }, z, 32, -32, 3, 1);
|
||||
gameState, isExecuting, { validRange.getX2(), validRange.getY1() }, z, 32, -32, 3, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Smooth the edges
|
||||
int32_t z1, z2;
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX1(), y });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX1(), y });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
z1 = std::clamp(
|
||||
@@ -412,10 +412,10 @@ namespace OpenRCT2::GameActions
|
||||
z2 = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByEdge(
|
||||
gameState, isExecuting, { validRange.GetX1(), y }, z1, z2, -32, 0, 0, 1, 3, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), y }, z1, z2, -32, 0, 0, 1, 3, 2);
|
||||
}
|
||||
|
||||
surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX2(), y });
|
||||
surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX2(), y });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
z1 = std::clamp(
|
||||
@@ -423,13 +423,13 @@ namespace OpenRCT2::GameActions
|
||||
z2 = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 0)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByEdge(
|
||||
gameState, isExecuting, { validRange.GetX2(), y }, z1, z2, 32, 0, 2, 3, 1, 0);
|
||||
gameState, isExecuting, { validRange.getX2(), y }, z1, z2, 32, 0, 2, 3, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, validRange.GetY1() });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, validRange.getY1() });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
z1 = std::clamp(
|
||||
@@ -437,10 +437,10 @@ namespace OpenRCT2::GameActions
|
||||
z2 = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 2)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByEdge(
|
||||
gameState, isExecuting, { x, validRange.GetY1() }, z1, z2, 0, -32, 0, 3, 1, 2);
|
||||
gameState, isExecuting, { x, validRange.getY1() }, z1, z2, 0, -32, 0, 3, 1, 2);
|
||||
}
|
||||
|
||||
surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, validRange.GetY2() });
|
||||
surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, validRange.getY2() });
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
z1 = std::clamp(
|
||||
@@ -448,7 +448,7 @@ namespace OpenRCT2::GameActions
|
||||
z2 = std::clamp(
|
||||
static_cast<uint8_t>(TileElementGetCornerHeight(surfaceElement, 3)), minHeight, maxHeight);
|
||||
res.cost += SmoothLandRowByEdge(
|
||||
gameState, isExecuting, { x, validRange.GetY2() }, z1, z2, 0, 32, 1, 2, 0, 3);
|
||||
gameState, isExecuting, { x, validRange.getY2() }, z1, z2, 0, 32, 1, 2, 0, 3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -458,7 +458,7 @@ namespace OpenRCT2::GameActions
|
||||
case MapSelectType::corner2:
|
||||
case MapSelectType::corner3:
|
||||
{
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX1(), validRange.GetY1() });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX1(), validRange.getY1() });
|
||||
if (surfaceElement == nullptr)
|
||||
break;
|
||||
uint8_t newBaseZ = surfaceElement->baseHeight;
|
||||
@@ -483,16 +483,16 @@ namespace OpenRCT2::GameActions
|
||||
// Smooth the corners
|
||||
int32_t z = MapGetCornerHeight(newBaseZ, newSlope, 2);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, -32, 0, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, -32, 0, 2);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 32, 2, 0);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, 32, 2, 0);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 32, 1, 3);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, 32, 1, 3);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, -32, 3, 1);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, -32, 3, 1);
|
||||
|
||||
// Smooth the edges
|
||||
switch (selectionType)
|
||||
@@ -500,54 +500,54 @@ namespace OpenRCT2::GameActions
|
||||
case MapSelectType::corner0:
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 3, 0);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, 0, 3, 0);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 1, 0);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, 32, 1, 0);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 0, 3);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, 0, 0, 3);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 0, 1);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, -32, 0, 1);
|
||||
break;
|
||||
case MapSelectType::corner1:
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 2, 1);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, 0, 2, 1);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 0, 1);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, -32, 0, 1);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 1, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, 0, 1, 2);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 1, 0);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, 32, 1, 0);
|
||||
break;
|
||||
case MapSelectType::corner2:
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 1, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, 0, 1, 2);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 3, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, -32, 3, 2);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 2, 1);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, 0, 2, 1);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 2, 3);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, 32, 2, 3);
|
||||
break;
|
||||
case MapSelectType::corner3:
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 0, 0, 3);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, 0, 0, 3);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, 32, 2, 3);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, 32, 2, 3);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 0, 3, 0);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, 0, 3, 0);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 2);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 0, -32, 3, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 0, -32, 3, 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -561,7 +561,7 @@ namespace OpenRCT2::GameActions
|
||||
{
|
||||
// TODO: Handle smoothing by edge
|
||||
// Get the two corners to raise
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetX1(), validRange.GetY1() });
|
||||
auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.getX1(), validRange.getY1() });
|
||||
if (surfaceElement == nullptr)
|
||||
break;
|
||||
uint8_t newBaseZ = surfaceElement->baseHeight;
|
||||
@@ -607,32 +607,32 @@ namespace OpenRCT2::GameActions
|
||||
uint8_t z4 = MapGetCornerHeight(newBaseZ, newSlope, c4);
|
||||
// Smooth the edge at the top of the new slope
|
||||
res.cost += SmoothLandRowByEdge(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z1, z2, stepOffsets[edge].x,
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z1, z2, stepOffsets[edge].x,
|
||||
stepOffsets[edge].y, c3, c4, c1, c2);
|
||||
// Smooth the edge at the bottom of the new slope
|
||||
res.cost += SmoothLandRowByEdge(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z3, z4, -stepOffsets[edge].x,
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z3, z4, -stepOffsets[edge].x,
|
||||
-stepOffsets[edge].y, c1, c2, c3, c4);
|
||||
|
||||
// Smooth corners
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z1, -stepOffsets[edge].y,
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z1, -stepOffsets[edge].y,
|
||||
stepOffsets[edge].x, c2, c1);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z2, stepOffsets[edge].y,
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z2, stepOffsets[edge].y,
|
||||
-stepOffsets[edge].x, c1, c2);
|
||||
int32_t z = MapGetCornerHeight(newBaseZ, newSlope, 2);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, -32, 0, 2);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, -32, 0, 2);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 0);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, 32, 2, 0);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, 32, 2, 0);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 3);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, -32, 32, 1, 3);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, -32, 32, 1, 3);
|
||||
z = MapGetCornerHeight(newBaseZ, newSlope, 1);
|
||||
res.cost += SmoothLandRowByCorner(
|
||||
gameState, isExecuting, { validRange.GetX1(), validRange.GetY1() }, z, 32, -32, 3, 1);
|
||||
gameState, isExecuting, { validRange.getX1(), validRange.getY1() }, z, 32, -32, 3, 1);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -74,8 +74,8 @@ namespace OpenRCT2::GameActions
|
||||
}
|
||||
}
|
||||
|
||||
auto xMid = (validRange.GetX1() + validRange.GetX2()) / 2 + 16;
|
||||
auto yMid = (validRange.GetY1() + validRange.GetY2()) / 2 + 16;
|
||||
auto xMid = (validRange.getX1() + validRange.getX2()) / 2 + 16;
|
||||
auto yMid = (validRange.getY1() + validRange.getY2()) / 2 + 16;
|
||||
auto heightMid = TileElementHeight({ xMid, yMid });
|
||||
|
||||
res.position.x = xMid;
|
||||
@@ -91,10 +91,10 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
money64 surfaceCost = 0;
|
||||
money64 edgeCost = 0;
|
||||
for (CoordsXY coords = { validRange.GetX1(), validRange.GetY1() }; coords.x <= validRange.GetX2();
|
||||
for (CoordsXY coords = { validRange.getX1(), validRange.getY1() }; coords.x <= validRange.getX2();
|
||||
coords.x += kCoordsXYStep)
|
||||
{
|
||||
for (coords.y = validRange.GetY1(); coords.y <= validRange.GetY2(); coords.y += kCoordsXYStep)
|
||||
for (coords.y = validRange.getY1(); coords.y <= validRange.getY2(); coords.y += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid(coords))
|
||||
continue;
|
||||
@@ -148,8 +148,8 @@ namespace OpenRCT2::GameActions
|
||||
res.expenditure = ExpenditureType::landscaping;
|
||||
|
||||
auto validRange = ClampRangeWithinMap(_range.normalise());
|
||||
auto xMid = (validRange.GetX1() + validRange.GetX2()) / 2 + 16;
|
||||
auto yMid = (validRange.GetY1() + validRange.GetY2()) / 2 + 16;
|
||||
auto xMid = (validRange.getX1() + validRange.getX2()) / 2 + 16;
|
||||
auto yMid = (validRange.getY1() + validRange.getY2()) / 2 + 16;
|
||||
auto heightMid = TileElementHeight({ xMid, yMid });
|
||||
|
||||
res.position.x = xMid;
|
||||
@@ -158,10 +158,10 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
money64 surfaceCost = 0;
|
||||
money64 edgeCost = 0;
|
||||
for (CoordsXY coords = { validRange.GetX1(), validRange.GetY1() }; coords.x <= validRange.GetX2();
|
||||
for (CoordsXY coords = { validRange.getX1(), validRange.getY1() }; coords.x <= validRange.getX2();
|
||||
coords.x += kCoordsXYStep)
|
||||
{
|
||||
for (coords.y = validRange.GetY1(); coords.y <= validRange.GetY2(); coords.y += kCoordsXYStep)
|
||||
for (coords.y = validRange.getY1(); coords.y <= validRange.getY2(); coords.y += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid(coords))
|
||||
continue;
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace OpenRCT2::GameActions
|
||||
auto res = Result();
|
||||
|
||||
auto validRange = ClampRangeWithinMap(_range);
|
||||
res.position.x = ((validRange.GetX1() + validRange.GetX2()) / 2) + 16;
|
||||
res.position.y = ((validRange.GetY1() + validRange.GetY2()) / 2) + 16;
|
||||
res.position.x = ((validRange.getX1() + validRange.getX2()) / 2) + 16;
|
||||
res.position.y = ((validRange.getY1() + validRange.getY2()) / 2) + 16;
|
||||
int16_t z = TileElementHeight(res.position);
|
||||
int16_t waterHeight = TileElementWaterHeight(res.position);
|
||||
if (waterHeight != 0)
|
||||
@@ -71,9 +71,9 @@ namespace OpenRCT2::GameActions
|
||||
uint8_t minHeight = GetLowestHeight(gameState, validRange);
|
||||
bool hasChanged = false;
|
||||
bool withinOwnership = false;
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
@@ -135,9 +135,9 @@ namespace OpenRCT2::GameActions
|
||||
{
|
||||
// The lowest height to lower the water to is the highest water level in the selection
|
||||
uint8_t minHeight{ 0 };
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode)
|
||||
{
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace OpenRCT2::GameActions
|
||||
auto res = Result();
|
||||
|
||||
auto validRange = ClampRangeWithinMap(_range);
|
||||
res.position.x = ((validRange.GetX1() + validRange.GetX2()) / 2) + 16;
|
||||
res.position.y = ((validRange.GetY1() + validRange.GetY2()) / 2) + 16;
|
||||
res.position.x = ((validRange.getX1() + validRange.getX2()) / 2) + 16;
|
||||
res.position.y = ((validRange.getY1() + validRange.getY2()) / 2) + 16;
|
||||
int32_t z = TileElementHeight(res.position);
|
||||
int16_t waterHeight = TileElementWaterHeight(res.position);
|
||||
if (waterHeight != 0)
|
||||
@@ -71,9 +71,9 @@ namespace OpenRCT2::GameActions
|
||||
auto maxHeight = GetHighestHeight(gameState, validRange) / kCoordsZStep;
|
||||
bool hasChanged = false;
|
||||
bool withinOwnership = false;
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (!LocationValid({ x, y }))
|
||||
continue;
|
||||
@@ -149,9 +149,9 @@ namespace OpenRCT2::GameActions
|
||||
{
|
||||
// The highest height to raise the water to is the lowest water level in the selection
|
||||
uint16_t maxHeight = 255 * kCoordsZStep;
|
||||
for (int32_t y = validRange.GetY1(); y <= validRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = validRange.getY1(); y <= validRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = validRange.GetX1(); x <= validRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = validRange.getX1(); x <= validRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode)
|
||||
{
|
||||
|
||||
@@ -14,24 +14,24 @@
|
||||
template<class T>
|
||||
struct CoordsRange
|
||||
{
|
||||
T Point1{ 0, 0 };
|
||||
T Point2{ 0, 0 };
|
||||
T point1{ 0, 0 };
|
||||
T point2{ 0, 0 };
|
||||
|
||||
constexpr int32_t GetX1() const
|
||||
constexpr int32_t getX1() const
|
||||
{
|
||||
return Point1.x;
|
||||
return point1.x;
|
||||
}
|
||||
constexpr int32_t GetY1() const
|
||||
constexpr int32_t getY1() const
|
||||
{
|
||||
return Point1.y;
|
||||
return point1.y;
|
||||
}
|
||||
constexpr int32_t GetX2() const
|
||||
constexpr int32_t getX2() const
|
||||
{
|
||||
return Point2.x;
|
||||
return point2.x;
|
||||
}
|
||||
constexpr int32_t GetY2() const
|
||||
constexpr int32_t getY2() const
|
||||
{
|
||||
return Point2.y;
|
||||
return point2.y;
|
||||
}
|
||||
|
||||
constexpr CoordsRange() = default;
|
||||
@@ -41,8 +41,8 @@ struct CoordsRange
|
||||
}
|
||||
|
||||
constexpr CoordsRange(const T& pointOne, const T& pointTwo)
|
||||
: Point1(pointOne)
|
||||
, Point2(pointTwo)
|
||||
: point1(pointOne)
|
||||
, point2(pointTwo)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -427,10 +427,10 @@ namespace OpenRCT2
|
||||
{
|
||||
static void encode(IStream* stream, const MapRange& v)
|
||||
{
|
||||
stream->WriteValue(ByteSwapBE(v.GetX1()));
|
||||
stream->WriteValue(ByteSwapBE(v.GetY1()));
|
||||
stream->WriteValue(ByteSwapBE(v.GetX2()));
|
||||
stream->WriteValue(ByteSwapBE(v.GetY2()));
|
||||
stream->WriteValue(ByteSwapBE(v.getX1()));
|
||||
stream->WriteValue(ByteSwapBE(v.getY1()));
|
||||
stream->WriteValue(ByteSwapBE(v.getX2()));
|
||||
stream->WriteValue(ByteSwapBE(v.getY2()));
|
||||
}
|
||||
static void decode(IStream* stream, MapRange& v)
|
||||
{
|
||||
@@ -444,8 +444,8 @@ namespace OpenRCT2
|
||||
{
|
||||
char coords[128] = {};
|
||||
snprintf(
|
||||
coords, sizeof(coords), "MapRange(x1 = %d, y1 = %d, x2 = %d, y2 = %d)", v.GetX1(), v.GetY1(), v.GetX2(),
|
||||
v.GetY2());
|
||||
coords, sizeof(coords), "MapRange(x1 = %d, y1 = %d, x2 = %d, y2 = %d)", v.getX1(), v.getY1(), v.getX2(),
|
||||
v.getY2());
|
||||
|
||||
stream->Write(coords, strlen(coords));
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ namespace OpenRCT2::Drawing
|
||||
void GfxDrawLineSoftware(RenderTarget& rt, const ScreenLine& line, PaletteIndex colour)
|
||||
{
|
||||
const ZoomLevel zoom = rt.zoom_level;
|
||||
int32_t x1 = zoom.ApplyInversedTo(line.GetX1());
|
||||
int32_t x2 = zoom.ApplyInversedTo(line.GetX2());
|
||||
int32_t y1 = zoom.ApplyInversedTo(line.GetY1());
|
||||
int32_t y2 = zoom.ApplyInversedTo(line.GetY2());
|
||||
int32_t x1 = zoom.ApplyInversedTo(line.getX1());
|
||||
int32_t x2 = zoom.ApplyInversedTo(line.getX2());
|
||||
int32_t y1 = zoom.ApplyInversedTo(line.getY1());
|
||||
int32_t y2 = zoom.ApplyInversedTo(line.getY2());
|
||||
// Check to make sure the line is within the drawing area
|
||||
if ((x1 < rt.x) && (x2 < rt.x))
|
||||
{
|
||||
@@ -195,23 +195,23 @@ namespace OpenRCT2::Drawing
|
||||
constexpr int32_t kPrecisionFactor = 1000;
|
||||
|
||||
const int32_t dashedLineLength = std::hypot(
|
||||
screenLine.GetX2() - screenLine.GetX1(), screenLine.GetY2() - screenLine.GetY1());
|
||||
screenLine.getX2() - screenLine.getX1(), screenLine.getY2() - screenLine.getY1());
|
||||
const int32_t lineSegmentCount = dashedLineLength / dashedLineSegmentLength / 2;
|
||||
if (lineSegmentCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const int32_t lineXDist = std::abs(screenLine.GetX2() - screenLine.GetX1());
|
||||
const int32_t lineYDist = std::abs(screenLine.GetY2() - screenLine.GetY1());
|
||||
const int32_t lineXDist = std::abs(screenLine.getX2() - screenLine.getX1());
|
||||
const int32_t lineYDist = std::abs(screenLine.getY2() - screenLine.getY1());
|
||||
const int32_t dxPrecise = kPrecisionFactor * lineXDist / lineSegmentCount / 2;
|
||||
const int32_t dyPrecise = kPrecisionFactor * lineYDist / lineSegmentCount / 2;
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
|
||||
for (int32_t i = 0, x, y; i < lineSegmentCount; ++i)
|
||||
{
|
||||
x = screenLine.GetX1() + dxPrecise * i * 2 / kPrecisionFactor;
|
||||
y = screenLine.GetY1() + dyPrecise * i * 2 / kPrecisionFactor;
|
||||
x = screenLine.getX1() + dxPrecise * i * 2 / kPrecisionFactor;
|
||||
y = screenLine.getY1() + dyPrecise * i * 2 / kPrecisionFactor;
|
||||
dc->DrawLine(rt, colour, { { x, y }, { x + dxPrecise / kPrecisionFactor, y + dyPrecise / kPrecisionFactor } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void GfxSetDirtyBlocks(const ScreenRect& rect)
|
||||
auto drawingEngine = GetDrawingEngine();
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
drawingEngine->Invalidate(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||
drawingEngine->Invalidate(rect.getLeft(), rect.getTop(), rect.getRight(), rect.getBottom());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRCT2::Drawing::Rectangle
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
dc->FillRect(rt, paletteIndex, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom(), crossHatch);
|
||||
dc->FillRect(rt, paletteIndex, rect.getLeft(), rect.getTop(), rect.getRight(), rect.getBottom(), crossHatch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,10 +47,10 @@ namespace OpenRCT2::Drawing::Rectangle
|
||||
RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, BorderStyle borderStyle, FillBrightness brightness,
|
||||
FillMode fillMode)
|
||||
{
|
||||
const auto leftTop = ScreenCoordsXY{ rect.GetLeft(), rect.GetTop() };
|
||||
const auto leftBottom = ScreenCoordsXY{ rect.GetLeft(), rect.GetBottom() };
|
||||
const auto rightTop = ScreenCoordsXY{ rect.GetRight(), rect.GetTop() };
|
||||
const auto rightBottom = ScreenCoordsXY{ rect.GetRight(), rect.GetBottom() };
|
||||
const auto leftTop = ScreenCoordsXY{ rect.getLeft(), rect.getTop() };
|
||||
const auto leftBottom = ScreenCoordsXY{ rect.getLeft(), rect.getBottom() };
|
||||
const auto rightTop = ScreenCoordsXY{ rect.getRight(), rect.getTop() };
|
||||
const auto rightBottom = ScreenCoordsXY{ rect.getRight(), rect.getBottom() };
|
||||
if (colour.flags.has(ColourFlag::translucent))
|
||||
{
|
||||
auto palette = kTranslucentWindowPalettes[EnumValue(colour.colour)];
|
||||
@@ -150,7 +150,7 @@ namespace OpenRCT2::Drawing::Rectangle
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
dc->FilterRect(rt, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||
dc->FilterRect(rt, palette, rect.getLeft(), rect.getTop(), rect.getRight(), rect.getBottom());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1184,13 +1184,13 @@ namespace OpenRCT2
|
||||
{
|
||||
if (peep->x == kLocationNull)
|
||||
continue;
|
||||
if (viewport->viewPos.x > peep->spriteData.spriteRect.GetRight())
|
||||
if (viewport->viewPos.x > peep->spriteData.spriteRect.getRight())
|
||||
continue;
|
||||
if (viewport->viewPos.x + viewport->ViewWidth() < peep->spriteData.spriteRect.GetLeft())
|
||||
if (viewport->viewPos.x + viewport->ViewWidth() < peep->spriteData.spriteRect.getLeft())
|
||||
continue;
|
||||
if (viewport->viewPos.y > peep->spriteData.spriteRect.GetBottom())
|
||||
if (viewport->viewPos.y > peep->spriteData.spriteRect.getBottom())
|
||||
continue;
|
||||
if (viewport->viewPos.y + viewport->ViewHeight() < peep->spriteData.spriteRect.GetTop())
|
||||
if (viewport->viewPos.y + viewport->ViewHeight() < peep->spriteData.spriteRect.getTop())
|
||||
continue;
|
||||
|
||||
visiblePeeps += peep->state == PeepState::queuing ? 1 : 2;
|
||||
|
||||
@@ -281,9 +281,9 @@ namespace OpenRCT2
|
||||
|
||||
void Staff::setPatrolArea(const MapRange& range, bool value)
|
||||
{
|
||||
for (int32_t yy = range.GetY1(); yy <= range.GetY2(); yy += kCoordsXYStep)
|
||||
for (int32_t yy = range.getY1(); yy <= range.getY2(); yy += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t xx = range.GetX1(); xx <= range.GetX2(); xx += kCoordsXYStep)
|
||||
for (int32_t xx = range.getX1(); xx <= range.getX2(); xx += kCoordsXYStep)
|
||||
{
|
||||
setPatrolArea({ xx, yy }, value);
|
||||
}
|
||||
|
||||
@@ -135,21 +135,21 @@ struct RectRange : public CoordsRange<T>
|
||||
{
|
||||
using CoordsRange<T>::CoordsRange;
|
||||
|
||||
constexpr int32_t GetLeft() const
|
||||
constexpr int32_t getLeft() const
|
||||
{
|
||||
return CoordsRange<T>::GetX1();
|
||||
return CoordsRange<T>::getX1();
|
||||
}
|
||||
constexpr int32_t GetTop() const
|
||||
constexpr int32_t getTop() const
|
||||
{
|
||||
return CoordsRange<T>::GetY1();
|
||||
return CoordsRange<T>::getY1();
|
||||
}
|
||||
constexpr int32_t GetRight() const
|
||||
constexpr int32_t getRight() const
|
||||
{
|
||||
return CoordsRange<T>::GetX2();
|
||||
return CoordsRange<T>::getX2();
|
||||
}
|
||||
constexpr int32_t GetBottom() const
|
||||
constexpr int32_t getBottom() const
|
||||
{
|
||||
return CoordsRange<T>::GetY2();
|
||||
return CoordsRange<T>::getY2();
|
||||
}
|
||||
|
||||
constexpr RectRange(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
@@ -171,16 +171,16 @@ struct ScreenRect : public RectRange<ScreenCoordsXY>
|
||||
{
|
||||
using RectRange::RectRange;
|
||||
|
||||
constexpr int32_t GetWidth() const
|
||||
constexpr int32_t getWidth() const
|
||||
{
|
||||
return GetRight() - GetLeft();
|
||||
return getRight() - getLeft();
|
||||
}
|
||||
constexpr int32_t GetHeight() const
|
||||
constexpr int32_t getHeight() const
|
||||
{
|
||||
return GetBottom() - GetTop();
|
||||
return getBottom() - getTop();
|
||||
}
|
||||
constexpr bool Contains(const ScreenCoordsXY& coords) const
|
||||
constexpr bool contains(const ScreenCoordsXY& coords) const
|
||||
{
|
||||
return coords.x >= GetLeft() && coords.x <= GetRight() && coords.y >= GetTop() && coords.y <= GetBottom();
|
||||
return coords.x >= getLeft() && coords.x <= getRight() && coords.y >= getTop() && coords.y <= getBottom();
|
||||
}
|
||||
};
|
||||
@@ -305,9 +305,9 @@ namespace OpenRCT2
|
||||
if (window != nullptr)
|
||||
{
|
||||
// skip current window and non-intersecting windows
|
||||
if (window == originalWindow || drawRect.GetRight() <= window->windowPos.x
|
||||
|| drawRect.GetLeft() >= window->windowPos.x + window->width || drawRect.GetBottom() <= window->windowPos.y
|
||||
|| drawRect.GetTop() >= window->windowPos.y + window->height)
|
||||
if (window == originalWindow || drawRect.getRight() <= window->windowPos.x
|
||||
|| drawRect.getLeft() >= window->windowPos.x + window->width || drawRect.getBottom() <= window->windowPos.y
|
||||
|| drawRect.getTop() >= window->windowPos.y + window->height)
|
||||
{
|
||||
auto itWindowPos = WindowGetIterator(window);
|
||||
// Get next valid window after.
|
||||
@@ -324,52 +324,52 @@ namespace OpenRCT2
|
||||
return;
|
||||
}
|
||||
|
||||
if (drawRect.GetLeft() < window->windowPos.x)
|
||||
if (drawRect.getLeft() < window->windowPos.x)
|
||||
{
|
||||
ScreenRect leftRect = { drawRect.Point1, { window->windowPos.x, drawRect.GetBottom() } };
|
||||
ScreenRect leftRect = { drawRect.point1, { window->windowPos.x, drawRect.getBottom() } };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, leftRect);
|
||||
|
||||
ScreenRect rightRect = { { window->windowPos.x, drawRect.GetTop() }, drawRect.Point2 };
|
||||
ScreenRect rightRect = { { window->windowPos.x, drawRect.getTop() }, drawRect.point2 };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, rightRect);
|
||||
}
|
||||
else if (drawRect.GetRight() > window->windowPos.x + window->width)
|
||||
else if (drawRect.getRight() > window->windowPos.x + window->width)
|
||||
{
|
||||
ScreenRect leftRect = { drawRect.Point1, { window->windowPos.x + window->width, drawRect.GetBottom() } };
|
||||
ScreenRect leftRect = { drawRect.point1, { window->windowPos.x + window->width, drawRect.getBottom() } };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, leftRect);
|
||||
|
||||
ScreenRect rightRect = { { window->windowPos.x + window->width, drawRect.GetTop() }, drawRect.Point2 };
|
||||
ScreenRect rightRect = { { window->windowPos.x + window->width, drawRect.getTop() }, drawRect.point2 };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, rightRect);
|
||||
}
|
||||
else if (drawRect.GetTop() < window->windowPos.y)
|
||||
else if (drawRect.getTop() < window->windowPos.y)
|
||||
{
|
||||
ScreenRect topRect = { drawRect.Point1, { drawRect.GetRight(), window->windowPos.y } };
|
||||
ScreenRect topRect = { drawRect.point1, { drawRect.getRight(), window->windowPos.y } };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, topRect);
|
||||
|
||||
ScreenRect bottomRect = { { drawRect.GetLeft(), window->windowPos.y }, drawRect.Point2 };
|
||||
ScreenRect bottomRect = { { drawRect.getLeft(), window->windowPos.y }, drawRect.point2 };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, bottomRect);
|
||||
}
|
||||
else if (drawRect.GetBottom() > window->windowPos.y + window->height)
|
||||
else if (drawRect.getBottom() > window->windowPos.y + window->height)
|
||||
{
|
||||
ScreenRect topRect = { drawRect.Point1, { drawRect.GetRight(), window->windowPos.y + window->height } };
|
||||
ScreenRect topRect = { drawRect.point1, { drawRect.getRight(), window->windowPos.y + window->height } };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, topRect);
|
||||
|
||||
ScreenRect bottomRect = { { drawRect.GetLeft(), window->windowPos.y + window->height }, drawRect.Point2 };
|
||||
ScreenRect bottomRect = { { drawRect.getLeft(), window->windowPos.y + window->height }, drawRect.point2 };
|
||||
ViewportRedrawAfterShift(rt, window, originalWindow, shift, bottomRect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto left = drawRect.GetLeft();
|
||||
auto right = drawRect.GetRight();
|
||||
auto top = drawRect.GetTop();
|
||||
auto bottom = drawRect.GetBottom();
|
||||
auto left = drawRect.getLeft();
|
||||
auto right = drawRect.getRight();
|
||||
auto top = drawRect.getTop();
|
||||
auto bottom = drawRect.getBottom();
|
||||
|
||||
// if moved more than the draw rectangle size
|
||||
if (abs(shift.x) < drawRect.GetWidth() && abs(shift.y) < drawRect.GetHeight())
|
||||
if (abs(shift.x) < drawRect.getWidth() && abs(shift.y) < drawRect.getHeight())
|
||||
{
|
||||
// update whole block ?
|
||||
DrawingEngineCopyRect(
|
||||
drawRect.GetLeft(), drawRect.GetTop(), drawRect.GetWidth(), drawRect.GetHeight(), shift.x, shift.y);
|
||||
drawRect.getLeft(), drawRect.getTop(), drawRect.getWidth(), drawRect.getHeight(), shift.x, shift.y);
|
||||
|
||||
if (shift.x > 0)
|
||||
{
|
||||
@@ -420,20 +420,20 @@ namespace OpenRCT2
|
||||
if (w->viewport == window->viewport)
|
||||
continue;
|
||||
|
||||
if (drawRect.GetRight() <= w->windowPos.x)
|
||||
if (drawRect.getRight() <= w->windowPos.x)
|
||||
continue;
|
||||
if (w->windowPos.x + w->width <= drawRect.GetLeft())
|
||||
if (w->windowPos.x + w->width <= drawRect.getLeft())
|
||||
continue;
|
||||
|
||||
if (drawRect.GetBottom() <= w->windowPos.y)
|
||||
if (drawRect.getBottom() <= w->windowPos.y)
|
||||
continue;
|
||||
if (w->windowPos.y + w->height <= drawRect.GetTop())
|
||||
if (w->windowPos.y + w->height <= drawRect.getTop())
|
||||
continue;
|
||||
|
||||
const int32_t left = std::max(w->windowPos.x, drawRect.GetLeft());
|
||||
const int32_t right = std::min(w->windowPos.x + w->width, drawRect.GetRight());
|
||||
const int32_t top = std::max(w->windowPos.y, drawRect.GetTop());
|
||||
const int32_t bottom = std::min(w->windowPos.y + w->height, drawRect.GetBottom());
|
||||
const int32_t left = std::max(w->windowPos.x, drawRect.getLeft());
|
||||
const int32_t right = std::min(w->windowPos.x + w->width, drawRect.getRight());
|
||||
const int32_t top = std::max(w->windowPos.y, drawRect.getTop());
|
||||
const int32_t bottom = std::min(w->windowPos.y + w->height, drawRect.getBottom());
|
||||
|
||||
if (left >= right || top >= bottom)
|
||||
continue;
|
||||
@@ -1765,18 +1765,18 @@ namespace OpenRCT2
|
||||
auto viewPos = viewport->viewPos;
|
||||
auto viewportScreenPos = viewport->pos;
|
||||
|
||||
ScreenRect invalidRect = { { zoom.ApplyInversedTo(screenRect.GetLeft() - viewPos.x),
|
||||
zoom.ApplyInversedTo(screenRect.GetTop() - viewPos.y) },
|
||||
{ zoom.ApplyInversedTo(screenRect.GetRight() - viewPos.x),
|
||||
zoom.ApplyInversedTo(screenRect.GetBottom() - viewPos.y) } };
|
||||
ScreenRect invalidRect = { { zoom.ApplyInversedTo(screenRect.getLeft() - viewPos.x),
|
||||
zoom.ApplyInversedTo(screenRect.getTop() - viewPos.y) },
|
||||
{ zoom.ApplyInversedTo(screenRect.getRight() - viewPos.x),
|
||||
zoom.ApplyInversedTo(screenRect.getBottom() - viewPos.y) } };
|
||||
|
||||
if (invalidRect.GetTop() >= viewport->height || invalidRect.GetBottom() <= 0 || invalidRect.GetLeft() >= viewport->width
|
||||
|| invalidRect.GetRight() <= 0)
|
||||
if (invalidRect.getTop() >= viewport->height || invalidRect.getBottom() <= 0 || invalidRect.getLeft() >= viewport->width
|
||||
|| invalidRect.getRight() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
invalidRect.Point1 += viewportScreenPos;
|
||||
invalidRect.Point2 += viewportScreenPos;
|
||||
invalidRect.point1 += viewportScreenPos;
|
||||
invalidRect.point2 += viewportScreenPos;
|
||||
GfxSetDirtyBlocks(invalidRect);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,10 +111,10 @@ void EntityPaintSetup(PaintSession& session, const CoordsXY& pos)
|
||||
screenCoords + ScreenCoordsXY{ entity->spriteData.width, entity->spriteData.heightMax });
|
||||
|
||||
const ZoomLevel zoom = session.rt.zoom_level;
|
||||
if (session.rt.y + session.rt.height <= zoom.ApplyInversedTo(spriteRect.GetTop())
|
||||
|| zoom.ApplyInversedTo(spriteRect.GetBottom()) <= session.rt.y
|
||||
|| session.rt.x + session.rt.width <= zoom.ApplyInversedTo(spriteRect.GetLeft())
|
||||
|| zoom.ApplyInversedTo(spriteRect.GetRight()) <= session.rt.x)
|
||||
if (session.rt.y + session.rt.height <= zoom.ApplyInversedTo(spriteRect.getTop())
|
||||
|| zoom.ApplyInversedTo(spriteRect.getBottom()) <= session.rt.y
|
||||
|| session.rt.x + session.rt.width <= zoom.ApplyInversedTo(spriteRect.getLeft())
|
||||
|| zoom.ApplyInversedTo(spriteRect.getRight()) <= session.rt.x)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -626,9 +626,9 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
MapRange mapRange = { JSToCoordXY(ctx, coordsOrRange, "leftTop"),
|
||||
JSToCoordXY(ctx, coordsOrRange, "rightBottom") };
|
||||
for (int32_t y = mapRange.GetY1(); y <= mapRange.GetY2(); y += kCoordsXYStep)
|
||||
for (int32_t y = mapRange.getY1(); y <= mapRange.getY2(); y += kCoordsXYStep)
|
||||
{
|
||||
for (int32_t x = mapRange.GetX1(); x <= mapRange.GetX2(); x += kCoordsXYStep)
|
||||
for (int32_t x = mapRange.getX1(); x <= mapRange.getX2(); x += kCoordsXYStep)
|
||||
{
|
||||
CoordsXY coord(x, y);
|
||||
staff->setPatrolArea(coord, reset);
|
||||
|
||||
@@ -55,51 +55,51 @@ namespace OpenRCT2
|
||||
public:
|
||||
ConnectedPathSlopes(MapRange range, CoordsXY dragStart)
|
||||
{
|
||||
dragWidth = range.GetX2() - range.GetX1();
|
||||
dragHeight = range.GetY2() - range.GetY1();
|
||||
dragWidth = range.getX2() - range.getX1();
|
||||
dragHeight = range.getY2() - range.getY1();
|
||||
startPos = dragStart.toTileStart();
|
||||
|
||||
startPos.x = std::clamp(startPos.x, range.GetX1(), range.GetX2());
|
||||
startPos.y = std::clamp(startPos.y, range.GetY1(), range.GetY2());
|
||||
startPos.x = std::clamp(startPos.x, range.getX1(), range.getX2());
|
||||
startPos.y = std::clamp(startPos.y, range.getY1(), range.getY2());
|
||||
|
||||
primaryIsX = dragWidth >= dragHeight;
|
||||
|
||||
if (primaryIsX)
|
||||
{
|
||||
secondaryStart = range.GetY1();
|
||||
secondaryEnd = range.GetY2();
|
||||
secondaryStart = range.getY1();
|
||||
secondaryEnd = range.getY2();
|
||||
|
||||
if (startPos.x <= (range.GetX1() + range.GetX2()) / 2)
|
||||
if (startPos.x <= (range.getX1() + range.getX2()) / 2)
|
||||
{
|
||||
primaryStart = range.GetX1();
|
||||
primaryEnd = range.GetX2();
|
||||
primaryStart = range.getX1();
|
||||
primaryEnd = range.getX2();
|
||||
primaryStep = kCoordsXYStep;
|
||||
slopeDirection = TILE_ELEMENT_DIRECTION_EAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
primaryStart = range.GetX2();
|
||||
primaryEnd = range.GetX1();
|
||||
primaryStart = range.getX2();
|
||||
primaryEnd = range.getX1();
|
||||
primaryStep = -kCoordsXYStep;
|
||||
slopeDirection = TILE_ELEMENT_DIRECTION_WEST;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
secondaryStart = range.GetX1();
|
||||
secondaryEnd = range.GetX2();
|
||||
secondaryStart = range.getX1();
|
||||
secondaryEnd = range.getX2();
|
||||
|
||||
if (startPos.y <= (range.GetY1() + range.GetY2()) / 2)
|
||||
if (startPos.y <= (range.getY1() + range.getY2()) / 2)
|
||||
{
|
||||
primaryStart = range.GetY1();
|
||||
primaryEnd = range.GetY2();
|
||||
primaryStart = range.getY1();
|
||||
primaryEnd = range.getY2();
|
||||
primaryStep = kCoordsXYStep;
|
||||
slopeDirection = TILE_ELEMENT_DIRECTION_NORTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
primaryStart = range.GetY2();
|
||||
primaryEnd = range.GetY1();
|
||||
primaryStart = range.getY2();
|
||||
primaryEnd = range.getY1();
|
||||
primaryStep = -kCoordsXYStep;
|
||||
slopeDirection = TILE_ELEMENT_DIRECTION_SOUTH;
|
||||
}
|
||||
|
||||
@@ -681,10 +681,10 @@ struct MapRange : public CoordsRange<CoordsXY>
|
||||
// Don't use std::min/max, as they require <algorithm>, one of C++'s heaviest
|
||||
// in this very common header.
|
||||
auto result = MapRange(
|
||||
GetX1() < GetX2() ? GetX1() : GetX2(), // min
|
||||
GetY1() < GetY2() ? GetY1() : GetY2(), // min
|
||||
GetX1() > GetX2() ? GetX1() : GetX2(), // max
|
||||
GetY1() > GetY2() ? GetY1() : GetY2() // max
|
||||
getX1() < getX2() ? getX1() : getX2(), // min
|
||||
getY1() < getY2() ? getY1() : getY2(), // min
|
||||
getX1() > getX2() ? getX1() : getX2(), // max
|
||||
getY1() > getY2() ? getY1() : getY2() // max
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1047,10 +1047,10 @@ namespace OpenRCT2
|
||||
{
|
||||
uint32_t rotation = GetCurrentRotation();
|
||||
const std::array corners{
|
||||
CoordsXY{ _range.GetX1(), _range.GetY1() },
|
||||
CoordsXY{ _range.GetX2(), _range.GetY1() },
|
||||
CoordsXY{ _range.GetX2(), _range.GetY2() },
|
||||
CoordsXY{ _range.GetX1(), _range.GetY2() },
|
||||
CoordsXY{ _range.getX1(), _range.getY1() },
|
||||
CoordsXY{ _range.getX2(), _range.getY1() },
|
||||
CoordsXY{ _range.getX2(), _range.getY2() },
|
||||
CoordsXY{ _range.getX1(), _range.getY2() },
|
||||
};
|
||||
|
||||
*left = std::numeric_limits<int32_t>::max();
|
||||
@@ -2117,10 +2117,10 @@ namespace OpenRCT2
|
||||
MapRange ClampRangeWithinMap(const MapRange& range)
|
||||
{
|
||||
auto mapSizeMax = GetMapSizeMaxXY();
|
||||
auto aX = std::max<decltype(range.GetX1())>(kCoordsXYStep, range.GetX1());
|
||||
auto bX = std::min<decltype(range.GetX2())>(mapSizeMax.x, range.GetX2());
|
||||
auto aY = std::max<decltype(range.GetY1())>(kCoordsXYStep, range.GetY1());
|
||||
auto bY = std::min<decltype(range.GetY2())>(mapSizeMax.y, range.GetY2());
|
||||
auto aX = std::max<decltype(range.getX1())>(kCoordsXYStep, range.getX1());
|
||||
auto bX = std::min<decltype(range.getX2())>(mapSizeMax.x, range.getX2());
|
||||
auto aY = std::max<decltype(range.getY1())>(kCoordsXYStep, range.getY1());
|
||||
auto bY = std::min<decltype(range.getY2())>(mapSizeMax.y, range.getY2());
|
||||
MapRange validRange = MapRange{ aX, aY, bX, bY };
|
||||
return validRange;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRCT2::Map
|
||||
|
||||
MapRangeView getClampedRange(const MapRange& range)
|
||||
{
|
||||
return getClampedRange(range.Point1, range.Point2);
|
||||
return getClampedRange(range.point1, range.point2);
|
||||
}
|
||||
|
||||
MapRangeView getDrawableTileRange()
|
||||
|
||||
@@ -36,8 +36,8 @@ MapRange getMapSelectRange()
|
||||
void setMapSelectRange(const MapRange& range)
|
||||
{
|
||||
const auto normalised = range.normalise();
|
||||
gMapSelectPositionA = normalised.Point1;
|
||||
gMapSelectPositionB = normalised.Point2;
|
||||
gMapSelectPositionA = normalised.point1;
|
||||
gMapSelectPositionB = normalised.point2;
|
||||
}
|
||||
|
||||
void setMapSelectRange(const CoordsXY coords)
|
||||
|
||||
Reference in new issue
Block a user