mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-19 22:02:57 +01:00
Small cleanup of variables (#13655)
Co-authored-by: Gymnasiast <m.o.steenbeek@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include "../../world/Banner.h"
|
#include "../../world/Banner.h"
|
||||||
#include "../../world/Entrance.h"
|
#include "../../world/Entrance.h"
|
||||||
#include "../../world/Footpath.h"
|
#include "../../world/Footpath.h"
|
||||||
|
#include "../../world/Map.h"
|
||||||
#include "../../world/Scenery.h"
|
#include "../../world/Scenery.h"
|
||||||
#include "../../world/Surface.h"
|
#include "../../world/Surface.h"
|
||||||
#include "../Paint.h"
|
#include "../Paint.h"
|
||||||
@@ -146,27 +147,24 @@ static void sub_68B3FB(paint_session* session, int32_t x, int32_t y)
|
|||||||
}
|
}
|
||||||
#endif // __TESTPAINT__
|
#endif // __TESTPAINT__
|
||||||
|
|
||||||
int32_t dx = 0;
|
|
||||||
switch (rotation)
|
switch (rotation)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
dx = x + y;
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
x += 32;
|
x += 32;
|
||||||
dx = y - x;
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
x += 32;
|
x += 32;
|
||||||
y += 32;
|
y += 32;
|
||||||
dx = -(x + y);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
y += 32;
|
y += 32;
|
||||||
dx = x - y;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dx >>= 1;
|
|
||||||
|
int32_t screenMinY = translate_3d_to_2d_with_z(rotation, { x, y, 0 }).y;
|
||||||
|
|
||||||
// Display little yellow arrow when building footpaths?
|
// Display little yellow arrow when building footpaths?
|
||||||
if ((gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_ARROW) && session->MapPosition.x == gMapSelectArrowPosition.x
|
if ((gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_ARROW) && session->MapPosition.x == gMapSelectArrowPosition.x
|
||||||
&& session->MapPosition.y == gMapSelectArrowPosition.y)
|
&& session->MapPosition.y == gMapSelectArrowPosition.y)
|
||||||
@@ -182,9 +180,8 @@ static void sub_68B3FB(paint_session* session, int32_t x, int32_t y)
|
|||||||
|
|
||||||
PaintAddImageAsParent(session, imageId, { 0, 0, arrowZ }, { 32, 32, -1 }, { 0, 0, arrowZ + 18 });
|
PaintAddImageAsParent(session, imageId, { 0, 0, arrowZ }, { 32, 32, -1 }, { 0, 0, arrowZ + 18 });
|
||||||
}
|
}
|
||||||
int32_t bx = dx + 52;
|
|
||||||
|
|
||||||
if (bx <= dpi->y)
|
if (screenMinY + 52 <= dpi->y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const TileElement* element = tile_element; // push tile_element
|
const TileElement* element = tile_element; // push tile_element
|
||||||
@@ -210,9 +207,7 @@ static void sub_68B3FB(paint_session* session, int32_t x, int32_t y)
|
|||||||
}
|
}
|
||||||
#endif // __TESTPAINT__
|
#endif // __TESTPAINT__
|
||||||
|
|
||||||
dx -= max_height + 32;
|
if (screenMinY - (max_height + 32) >= dpi->y + dpi->height)
|
||||||
dx -= dpi->height;
|
|
||||||
if (dx >= dpi->y)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
session->SpritePosition.x = x;
|
session->SpritePosition.x = x;
|
||||||
|
|||||||
@@ -894,3 +894,10 @@ namespace OpenRCT2
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} // namespace OpenRCT2
|
} // namespace OpenRCT2
|
||||||
|
|
||||||
|
ScreenCoordsXY translate_3d_to_2d_with_z(int32_t rotation, const CoordsXYZ& pos)
|
||||||
|
{
|
||||||
|
auto rotated = pos.Rotate(rotation);
|
||||||
|
// Use right shift to avoid issues like #9301
|
||||||
|
return ScreenCoordsXY{ rotated.y - rotated.x, ((rotated.x + rotated.y) >> 1) - pos.z };
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user