Add paint session memory for tracks and paths

This commit is contained in:
Jeroen D Stout authored and Ted John committed 2017-11-16 19:02:28 +00:00
1 parent 95997ae78e
commit 3410330bb2
2 files changed
+38 -1

No files matched your search

+2 -1
View File
@@ -170,7 +170,8 @@ typedef struct paint_session
tunnel_entry RightTunnels[TUNNEL_MAX_COUNT];
uint8 RightTunnelCount;
uint8 VerticalTunnelHeight;
rct_tile_element * SurfaceElement;
rct_tile_element * PathElementOnSameHeight;
rct_tile_element * TrackElementOnSameHeight;
bool DidPassSurface;
uint8 Unk141E9DB;
uint16 Unk141E9DC;
@@ -234,6 +234,7 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
session->SpritePosition.x = x;
session->SpritePosition.y = y;
session->DidPassSurface = false;
sint32 previousHeight = 0;
do {
// Only paint tile_elements below the clip height.
if ((gCurrentViewportFlags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) && (tile_element->base_height > gClipHeight)) break;
@@ -241,6 +242,41 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
sint32 direction = tile_element_get_direction_with_offset(tile_element, rotation);
sint32 height = tile_element->base_height * 8;
// If we are on a new height level, look through elements on the
// same height and store any types might be relevant to others
if (height != previousHeight)
{
previousHeight = height;
session->PathElementOnSameHeight = 0;
session->TrackElementOnSameHeight = 0;
rct_tile_element * tile_element_sub_iterator = tile_element;
while (!map_element_is_last_for_tile(tile_element_sub_iterator++))
{
if (tile_element_sub_iterator->base_height != tile_element->base_height)
{
break;
}
switch (map_element_get_type(tile_element_sub_iterator))
{
case TILE_ELEMENT_TYPE_PATH:
session->PathElementOnSameHeight = tile_element_sub_iterator;
break;
case TILE_ELEMENT_TYPE_TRACK:
session->TrackElementOnSameHeight = tile_element_sub_iterator;
break;
case TILE_ELEMENT_TYPE_CORRUPT:
// To preserve regular behaviour, make an element hidden by
// corruption also invisible to this method.
if (tile_element_is_last_for_tile(tile_element))
{
break;
}
tile_element_sub_iterator++;
break;
}
}
}
LocationXY16 dword_9DE574 = session->MapPosition;
session->CurrentlyDrawnItem = tile_element;
// Setup the painting of for example: the underground, signs, rides, scenery, etc.