mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Merge pull request #11061 from Gymnasiast/fix/7094
Fix #7094: Back wall edge texture in water missing
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
0.2.5+ (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: [#11013] Ctrl+C copies input dialog text to clipboard.
|
||||
- Fix: [#475] Water sides drawn incorrectly (original bug).
|
||||
- Fix: [#6123, #7907, #9472, #11028] Cannot build some track designs with 4 stations (original bug).
|
||||
- Fix: [#7094] Back wall edge texture in water missing.
|
||||
- Fix: [#11027] Third color on walls becomes black when saving.
|
||||
|
||||
0.2.5 (2020-03-24)
|
||||
|
||||
@@ -531,9 +531,11 @@ static bool tile_is_inside_clip_view(const tile_descriptor& tile)
|
||||
}
|
||||
|
||||
static void viewport_surface_draw_tile_side_bottom(
|
||||
paint_session* session, enum edge_t edge, uint8_t height, uint8_t edgeStyle, struct tile_descriptor self,
|
||||
paint_session* session, enum edge_t edge, uint16_t height, uint8_t edgeStyle, struct tile_descriptor self,
|
||||
struct tile_descriptor neighbour, bool isWater)
|
||||
{
|
||||
// From big Z to tiny Z
|
||||
height /= COORDS_Z_PER_TINY_Z;
|
||||
int16_t cornerHeight1, neighbourCornerHeight1, cornerHeight2, neighbourCornerHeight2;
|
||||
|
||||
CoordsXY offset = { 0, 0 };
|
||||
@@ -634,7 +636,7 @@ static void viewport_surface_draw_tile_side_bottom(
|
||||
if (curHeight != cornerHeight1 && curHeight != cornerHeight2)
|
||||
{
|
||||
uint32_t image_id = base_image_id + image_offset;
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * 16);
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * COORDS_Z_PER_TINY_Z);
|
||||
curHeight++;
|
||||
}
|
||||
}
|
||||
@@ -658,7 +660,7 @@ static void viewport_surface_draw_tile_side_bottom(
|
||||
}
|
||||
|
||||
const uint32_t image_id = base_image_id + image_offset;
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * 16);
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * COORDS_Z_PER_TINY_Z);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -673,7 +675,7 @@ static void viewport_surface_draw_tile_side_bottom(
|
||||
|
||||
if (isWater || curHeight != tunnelArray[tunnelIndex].height)
|
||||
{
|
||||
sub_98196C(session, base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * 16);
|
||||
sub_98196C(session, base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * COORDS_Z_PER_TINY_Z);
|
||||
|
||||
curHeight++;
|
||||
continue;
|
||||
@@ -705,7 +707,7 @@ static void viewport_surface_draw_tile_side_bottom(
|
||||
session, image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, zOffset, 0, 0,
|
||||
boundBoxOffsetZ);
|
||||
|
||||
boundBoxOffsetZ = curHeight * 16;
|
||||
boundBoxOffsetZ = curHeight * COORDS_Z_PER_TINY_Z;
|
||||
boundBoxLength = _tunnelHeights[tunnelType][1] * 16;
|
||||
boundBoxOffsetZ += _boundBoxZOffsets[tunnelType];
|
||||
if (boundBoxOffsetZ == 0)
|
||||
@@ -716,8 +718,8 @@ static void viewport_surface_draw_tile_side_bottom(
|
||||
|
||||
image_id = get_tunnel_image(edgeStyle, tunnelType) + (edge == EDGE_BOTTOMRIGHT ? 2 : 0) + 1;
|
||||
sub_98197C(
|
||||
session, image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1, curHeight * 16,
|
||||
tunnelTopBoundBoxOffset.x, tunnelTopBoundBoxOffset.y, boundBoxOffsetZ);
|
||||
session, image_id, offset.x, offset.y, tunnelBounds.x, tunnelBounds.y, boundBoxLength - 1,
|
||||
curHeight * COORDS_Z_PER_TINY_Z, tunnelTopBoundBoxOffset.x, tunnelTopBoundBoxOffset.y, boundBoxOffsetZ);
|
||||
|
||||
curHeight += _tunnelHeights[tunnelType][0];
|
||||
tunnelIndex++;
|
||||
@@ -728,7 +730,7 @@ static void viewport_surface_draw_tile_side_bottom(
|
||||
* rct2: 0x0065EB7D, 0x0065F0D8
|
||||
*/
|
||||
static void viewport_surface_draw_land_side_bottom(
|
||||
paint_session* session, enum edge_t edge, uint8_t height, uint8_t edgeStyle, struct tile_descriptor self,
|
||||
paint_session* session, enum edge_t edge, uint16_t height, uint8_t edgeStyle, struct tile_descriptor self,
|
||||
struct tile_descriptor neighbour)
|
||||
{
|
||||
viewport_surface_draw_tile_side_bottom(session, edge, height, edgeStyle, self, neighbour, false);
|
||||
@@ -738,20 +740,23 @@ static void viewport_surface_draw_land_side_bottom(
|
||||
* rct2: 0x0065F8B9, 0x0065FE26
|
||||
*/
|
||||
static void viewport_surface_draw_water_side_bottom(
|
||||
paint_session* session, enum edge_t edge, uint8_t height, uint8_t edgeStyle, struct tile_descriptor self,
|
||||
paint_session* session, enum edge_t edge, uint16_t height, uint8_t edgeStyle, struct tile_descriptor self,
|
||||
struct tile_descriptor neighbour)
|
||||
{
|
||||
viewport_surface_draw_tile_side_bottom(session, edge, height, edgeStyle, self, neighbour, true);
|
||||
}
|
||||
|
||||
static void viewport_surface_draw_tile_side_top(
|
||||
paint_session* session, enum edge_t edge, uint8_t height, uint8_t terrain, struct tile_descriptor self,
|
||||
paint_session* session, enum edge_t edge, uint16_t height, uint8_t terrain, struct tile_descriptor self,
|
||||
struct tile_descriptor neighbour, bool isWater)
|
||||
{
|
||||
// From big Z to tiny Z
|
||||
height /= COORDS_Z_PER_TINY_Z;
|
||||
|
||||
if (!is_csg_loaded() && terrain >= TERRAIN_EDGE_RCT2_COUNT)
|
||||
terrain = TERRAIN_EDGE_ROCK;
|
||||
|
||||
int16_t cornerHeight1, neighbourCornerHeight1, cornerHeight2, neighbourCornerHeight2, dl = 0;
|
||||
int16_t cornerHeight1, neighbourCornerHeight1, cornerHeight2, neighbourCornerHeight2;
|
||||
|
||||
CoordsXY offset = { 0, 0 };
|
||||
CoordsXY bounds = { 0, 0 };
|
||||
@@ -784,9 +789,6 @@ static void viewport_surface_draw_tile_side_top(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isWater)
|
||||
dl = height;
|
||||
|
||||
// save ecx
|
||||
if (neighbour.tile_element == nullptr)
|
||||
{
|
||||
@@ -797,14 +799,14 @@ static void viewport_surface_draw_tile_side_top(
|
||||
{
|
||||
if (isWater)
|
||||
{
|
||||
auto waterHeight = neighbour.tile_element->AsSurface()->GetWaterHeight() / COORDS_Z_STEP;
|
||||
if (dl == waterHeight)
|
||||
auto waterHeight = neighbour.tile_element->AsSurface()->GetWaterHeight() / (COORDS_Z_STEP * 2);
|
||||
if (height == waterHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cornerHeight1 = dl;
|
||||
cornerHeight2 = dl;
|
||||
cornerHeight1 = height;
|
||||
cornerHeight2 = height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -830,7 +832,7 @@ static void viewport_surface_draw_tile_side_top(
|
||||
{
|
||||
const uint8_t incline = (cornerHeight2 - cornerHeight1) + 1;
|
||||
const uint32_t image_id = get_edge_image(terrain, 3) + (edge == EDGE_TOPLEFT ? 3 : 0) + incline; // var_c;
|
||||
const int16_t y = (dl - cornerHeight1) * 16;
|
||||
const int16_t y = (height - cornerHeight1) * COORDS_Z_PER_TINY_Z;
|
||||
paint_attach_to_previous_ps(session, image_id, 0, y);
|
||||
return;
|
||||
}
|
||||
@@ -850,7 +852,7 @@ static void viewport_surface_draw_tile_side_top(
|
||||
if (cur_height != cornerHeight1 && cur_height != cornerHeight2)
|
||||
{
|
||||
const uint32_t image_id = base_image_id + image_offset;
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * 16);
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * COORDS_Z_PER_TINY_Z);
|
||||
cur_height++;
|
||||
}
|
||||
}
|
||||
@@ -865,7 +867,7 @@ static void viewport_surface_draw_tile_side_top(
|
||||
|
||||
while (cur_height < cornerHeight1 && cur_height < neighbourCornerHeight1)
|
||||
{
|
||||
sub_98196C(session, base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * 16);
|
||||
sub_98196C(session, base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * COORDS_Z_PER_TINY_Z);
|
||||
cur_height++;
|
||||
}
|
||||
|
||||
@@ -881,14 +883,14 @@ static void viewport_surface_draw_tile_side_top(
|
||||
}
|
||||
|
||||
const uint32_t image_id = base_image_id + image_offset;
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * 16);
|
||||
sub_98196C(session, image_id, offset.x, offset.y, bounds.x, bounds.y, 15, cur_height * COORDS_Z_PER_TINY_Z);
|
||||
}
|
||||
|
||||
/**
|
||||
* rct2: 0x0065F63B, 0x0065F77D
|
||||
*/
|
||||
static void viewport_surface_draw_land_side_top(
|
||||
paint_session* session, enum edge_t edge, uint8_t height, uint8_t terrain, struct tile_descriptor self,
|
||||
paint_session* session, enum edge_t edge, uint16_t height, uint8_t terrain, struct tile_descriptor self,
|
||||
struct tile_descriptor neighbour)
|
||||
{
|
||||
viewport_surface_draw_tile_side_top(session, edge, height, terrain, self, neighbour, false);
|
||||
@@ -898,7 +900,7 @@ static void viewport_surface_draw_land_side_top(
|
||||
* rct2: 0x0066039B, 0x006604F1
|
||||
*/
|
||||
static void viewport_surface_draw_water_side_top(
|
||||
paint_session* session, enum edge_t edge, uint8_t height, uint8_t terrain, struct tile_descriptor self,
|
||||
paint_session* session, enum edge_t edge, uint16_t height, uint8_t terrain, struct tile_descriptor self,
|
||||
struct tile_descriptor neighbour)
|
||||
{
|
||||
viewport_surface_draw_tile_side_top(session, edge, height, terrain, self, neighbour, true);
|
||||
@@ -1018,7 +1020,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
||||
}
|
||||
|
||||
bool has_surface = false;
|
||||
if (session->VerticalTunnelHeight * 16 == height)
|
||||
if (session->VerticalTunnelHeight * COORDS_Z_PER_TINY_Z == height)
|
||||
{
|
||||
// Vertical tunnels
|
||||
sub_98197C(session, 1575, 0, 0, 1, 30, 39, height, -2, 1, height - 40);
|
||||
@@ -1257,14 +1259,12 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
||||
std::memcpy(backupLeftTunnels, session->LeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
std::memcpy(backupRightTunnels, session->RightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
|
||||
viewport_surface_draw_land_side_top(
|
||||
session, EDGE_TOPLEFT, height / 16, edgeStyle, tileDescriptors[0], tileDescriptors[3]);
|
||||
viewport_surface_draw_land_side_top(
|
||||
session, EDGE_TOPRIGHT, height / 16, edgeStyle, tileDescriptors[0], tileDescriptors[4]);
|
||||
viewport_surface_draw_land_side_top(session, EDGE_TOPLEFT, height, edgeStyle, tileDescriptors[0], tileDescriptors[3]);
|
||||
viewport_surface_draw_land_side_top(session, EDGE_TOPRIGHT, height, edgeStyle, tileDescriptors[0], tileDescriptors[4]);
|
||||
viewport_surface_draw_land_side_bottom(
|
||||
session, EDGE_BOTTOMLEFT, height / 16, edgeStyle, tileDescriptors[0], tileDescriptors[1]);
|
||||
session, EDGE_BOTTOMLEFT, height, edgeStyle, tileDescriptors[0], tileDescriptors[1]);
|
||||
viewport_surface_draw_land_side_bottom(
|
||||
session, EDGE_BOTTOMRIGHT, height / 16, edgeStyle, tileDescriptors[0], tileDescriptors[2]);
|
||||
session, EDGE_BOTTOMRIGHT, height, edgeStyle, tileDescriptors[0], tileDescriptors[2]);
|
||||
|
||||
std::memcpy(session->LeftTunnels, backupLeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
std::memcpy(session->RightTunnels, backupRightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
@@ -1300,14 +1300,14 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
||||
const uint32_t edgeStyle = tileElement->AsSurface()->GetEdgeStyle();
|
||||
// end new code
|
||||
|
||||
viewport_surface_draw_water_side_top(
|
||||
session, EDGE_TOPLEFT, waterHeight / 16, edgeStyle, tileDescriptors[0], tileDescriptors[3]);
|
||||
viewport_surface_draw_water_side_top(
|
||||
session, EDGE_TOPRIGHT, waterHeight / 16, edgeStyle, tileDescriptors[0], tileDescriptors[4]);
|
||||
viewport_surface_draw_water_side_bottom(
|
||||
session, EDGE_BOTTOMLEFT, waterHeight / 16, edgeStyle, tileDescriptors[0], tileDescriptors[1]);
|
||||
session, EDGE_BOTTOMLEFT, waterHeight, edgeStyle, tileDescriptors[0], tileDescriptors[1]);
|
||||
viewport_surface_draw_water_side_bottom(
|
||||
session, EDGE_BOTTOMRIGHT, waterHeight / 16, edgeStyle, tileDescriptors[0], tileDescriptors[2]);
|
||||
session, EDGE_BOTTOMRIGHT, waterHeight, edgeStyle, tileDescriptors[0], tileDescriptors[2]);
|
||||
viewport_surface_draw_water_side_top(
|
||||
session, EDGE_TOPLEFT, waterHeight, edgeStyle, tileDescriptors[0], tileDescriptors[3]);
|
||||
viewport_surface_draw_water_side_top(
|
||||
session, EDGE_TOPRIGHT, waterHeight, edgeStyle, tileDescriptors[0], tileDescriptors[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user