1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 16:54:52 +01:00

Create definitions for some coords related stuff (#10456)

* Create definitions for some coords related stuff

* Use constexpr; add define for Z step
This commit is contained in:
Michael Steenbeek
2019-12-30 16:03:51 +01:00
committed by Duncan
parent 2d7dccb0c2
commit 77494bbc73
30 changed files with 115 additions and 111 deletions

View File

@@ -1269,7 +1269,7 @@ static int32_t cc_for_date([[maybe_unused]] InteractiveConsole& console, [[maybe
// All cases involve providing a year, so grab that first
year = atoi(argv[0].c_str());
if (year < 1 || year > 8192)
if (year < 1 || year > MAX_YEAR)
{
return -1;
}

View File

@@ -297,11 +297,11 @@ static int32_t GetHighestBaseClearanceZ(CoordsXY location)
{
do
{
z = std::max<int32_t>(z, element->base_height);
z = std::max<int32_t>(z, element->clearance_height);
z = std::max<int32_t>(z, element->GetBaseZ());
z = std::max<int32_t>(z, element->GetClearanceZ());
} while (!(element++)->IsLastForTile());
}
return z * 8;
return z;
}
static int32_t GetTallestVisibleTileTop(int32_t mapSize, int32_t rotation)
@@ -311,7 +311,7 @@ static int32_t GetTallestVisibleTileTop(int32_t mapSize, int32_t rotation)
{
for (int32_t x = 1; x < mapSize - 1; x++)
{
auto location = CoordsXY(x * 32, y * 32);
auto location = TileCoordsXY(x, y).ToCoordsXY();
int32_t z = GetHighestBaseClearanceZ(location);
int32_t viewY = translate_3d_to_2d_with_z(rotation, CoordsXYZ(location, z)).y;
minViewY = std::min(minViewY, viewY);