mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 18:31:59 -05:00
parent
270417f788
commit
938f2a891f
2 changed files with 43 additions and 29 deletions
|
@ -29,6 +29,7 @@
|
||||||
- Fix: [#10705] Apply multithreaded rendering to all viewports.
|
- Fix: [#10705] Apply multithreaded rendering to all viewports.
|
||||||
- Fix: [#10739] Mountain tool overlay for even-numbered selections.
|
- Fix: [#10739] Mountain tool overlay for even-numbered selections.
|
||||||
- Fix: [#10752] Mute button state not correctly set at startup.
|
- Fix: [#10752] Mute button state not correctly set at startup.
|
||||||
|
- Improved: [#682] The staff patrol area is now drawn on the water, instead of on the surface under water.
|
||||||
- Removed: [#6898] LOADMM and LOADRCT1 title sequence commands (use LOADSC instead).
|
- Removed: [#6898] LOADMM and LOADRCT1 title sequence commands (use LOADSC instead).
|
||||||
|
|
||||||
0.2.4 (2019-10-28)
|
0.2.4 (2019-10-28)
|
||||||
|
|
|
@ -902,6 +902,36 @@ static void viewport_surface_draw_water_side_top(
|
||||||
viewport_surface_draw_tile_side_top(session, edge, height, terrain, self, neighbour, true);
|
viewport_surface_draw_tile_side_top(session, edge, height, terrain, self, neighbour, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::pair<int32_t, int32_t> surface_get_height_above_water(
|
||||||
|
const SurfaceElement& surfaceElement, const int32_t height, const int32_t surfaceShape)
|
||||||
|
{
|
||||||
|
int32_t local_surfaceShape = surfaceShape;
|
||||||
|
int32_t local_height = height;
|
||||||
|
|
||||||
|
if (surfaceElement.GetWaterHeight() > 0)
|
||||||
|
{
|
||||||
|
int32_t waterHeight = surfaceElement.GetWaterHeight();
|
||||||
|
if (waterHeight > height)
|
||||||
|
{
|
||||||
|
local_height += (2 * COORDS_Z_STEP);
|
||||||
|
|
||||||
|
if (waterHeight != local_height || !(local_surfaceShape & TILE_ELEMENT_SURFACE_DIAGONAL_FLAG))
|
||||||
|
{
|
||||||
|
local_height = waterHeight;
|
||||||
|
local_surfaceShape = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int32_t bl = (surfaceShape ^ 0xF) << 2;
|
||||||
|
int32_t bh = bl >> 4;
|
||||||
|
local_surfaceShape = (bh & 0x3) | (bl & 0xC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { local_height, local_surfaceShape };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rct2: 0x0066062C
|
* rct2: 0x0066062C
|
||||||
*/
|
*/
|
||||||
|
@ -920,7 +950,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
||||||
const corner_height& cornerHeights = corner_heights[surfaceShape];
|
const corner_height& cornerHeights = corner_heights[surfaceShape];
|
||||||
|
|
||||||
tile_descriptor selfDescriptor = {
|
tile_descriptor selfDescriptor = {
|
||||||
{ base.x / 32, base.y / 32 },
|
TileCoordsXY(base),
|
||||||
tileElement,
|
tileElement,
|
||||||
(uint8_t)terrain_type,
|
(uint8_t)terrain_type,
|
||||||
surfaceShape,
|
surfaceShape,
|
||||||
|
@ -946,7 +976,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
||||||
tile_descriptor& descriptor = tileDescriptors[i + 1];
|
tile_descriptor& descriptor = tileDescriptors[i + 1];
|
||||||
|
|
||||||
descriptor.tile_element = nullptr;
|
descriptor.tile_element = nullptr;
|
||||||
if (position.x > 0x2000 || position.y > 0x2000)
|
if (!map_is_location_valid(position))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1053,9 +1083,14 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
||||||
{
|
{
|
||||||
assert(surfaceShape < std::size(byte_97B444));
|
assert(surfaceShape < std::size(byte_97B444));
|
||||||
|
|
||||||
image_id |= SPR_TERRAIN_SELECTION_PATROL_AREA + byte_97B444[surfaceShape];
|
auto [local_height, local_surfaceShape] = surface_get_height_above_water(
|
||||||
|
*tileElement->AsSurface(), height, surfaceShape);
|
||||||
|
image_id |= SPR_TERRAIN_SELECTION_PATROL_AREA + byte_97B444[local_surfaceShape];
|
||||||
image_id |= patrolColour << 19;
|
image_id |= patrolColour << 19;
|
||||||
paint_attach_to_previous_ps(session, image_id, 0, 0);
|
|
||||||
|
paint_struct* backup = session->LastRootPS;
|
||||||
|
sub_98196C(session, image_id, 0, 0, 32, 32, 1, local_height);
|
||||||
|
session->LastRootPS = backup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1155,31 +1190,9 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32_t local_surfaceShape = surfaceShape;
|
// The water tool should draw its grid _on_ the water, rather than on the surface under water.
|
||||||
int32_t local_height = height;
|
auto [local_height, local_surfaceShape] = surface_get_height_above_water(
|
||||||
// Water tool
|
*tileElement->AsSurface(), height, surfaceShape);
|
||||||
if (tileElement->AsSurface()->GetWaterHeight() > 0)
|
|
||||||
{
|
|
||||||
int32_t waterHeight = tileElement->AsSurface()->GetWaterHeight();
|
|
||||||
if (waterHeight > height)
|
|
||||||
{
|
|
||||||
local_height += 16;
|
|
||||||
|
|
||||||
if (waterHeight != local_height || !(local_surfaceShape & 0x10))
|
|
||||||
{
|
|
||||||
local_height = waterHeight;
|
|
||||||
local_surfaceShape = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int16_t bl, bh;
|
|
||||||
|
|
||||||
bl = (surfaceShape ^ 0xF) << 2;
|
|
||||||
bh = bl >> 4;
|
|
||||||
local_surfaceShape = (bh & 0x3) | (bl & 0xC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const int32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[local_surfaceShape]) | 0x21300000;
|
const int32_t image_id = (SPR_TERRAIN_SELECTION_CORNER + byte_97B444[local_surfaceShape]) | 0x21300000;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue