Fix queue preview for legacy paths; clean up legacy path image offsets

This commit is contained in:
Gymnasiast 2021-04-27 12:25:34 +02:00
parent 9f4d050d87
commit 28b2995ceb
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
3 changed files with 26 additions and 6 deletions

View File

@ -617,8 +617,8 @@ static void window_footpath_invalidate(rct_window* w)
if (pathObj != nullptr)
{
auto pathEntry = reinterpret_cast<rct_footpath_entry*>(pathObj->GetLegacyData());
pathImage = pathEntry->image + 71;
queueImage = pathEntry->image + 72;
pathImage = pathEntry->GetPreviewImage();
queueImage = pathEntry->GetQueuePreviewImage();
}
window_footpath_widgets[WIDX_FOOTPATH_TYPE].image = pathImage;
@ -670,7 +670,10 @@ static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi)
if (pathObj != nullptr)
{
auto pathEntry = reinterpret_cast<const rct_footpath_entry*>(pathObj->GetLegacyData());
baseImage = pathEntry->image;
if (gFootpathSelection.IsQueueSelected)
baseImage = pathEntry->GetQueueImage();
else
baseImage = pathEntry->image;
}
}
@ -766,7 +769,7 @@ static void window_footpath_show_footpath_types_dialog(rct_window* w, rct_widget
}
gDropdownItemsFormat[numPathTypes] = STR_NONE;
gDropdownItemsArgs[numPathTypes] = pathEntry->image + (showQueues ? 72 : 71);
gDropdownItemsArgs[numPathTypes] = showQueues ? pathEntry->GetQueuePreviewImage() : pathEntry->GetPreviewImage();
_dropdownEntries.push_back({ ObjectType::Paths, i });
numPathTypes++;
}

View File

@ -815,7 +815,7 @@ static FootpathPaintInfo GetFootpathPaintInfo(const PathElement* pathEl)
auto footpathEntry = reinterpret_cast<rct_footpath_entry*>(footpathObj->GetLegacyData());
if (pathEl->IsQueue())
{
pathPaintInfo.SurfaceImageId = footpathEntry->image + 51;
pathPaintInfo.SurfaceImageId = footpathEntry->GetQueueImage();
pathPaintInfo.SurfaceFlags = footpathEntry->flags | FOOTPATH_ENTRY_FLAG_IS_QUEUE;
}
else
@ -827,7 +827,7 @@ static FootpathPaintInfo GetFootpathPaintInfo(const PathElement* pathEl)
pathPaintInfo.SupportType = footpathEntry->support_type;
pathPaintInfo.BridgeImageId = footpathEntry->bridge_image;
pathPaintInfo.RailingFlags = footpathEntry->flags;
pathPaintInfo.RailingsImageId = footpathEntry->image + 73;
pathPaintInfo.RailingsImageId = footpathEntry->GetRailingsImage();
}
else
{

View File

@ -44,6 +44,23 @@ struct rct_footpath_entry
RailingEntrySupportType support_type; // 0x0A
uint8_t flags; // 0x0B
uint8_t scrolling_mode; // 0x0C
constexpr uint32_t GetQueueImage() const
{
return image + 51;
}
constexpr uint32_t GetPreviewImage() const
{
return image + 71;
}
constexpr uint32_t GetQueuePreviewImage() const
{
return image + 72;
}
constexpr uint32_t GetRailingsImage() const
{
return image + 73;
}
};
assert_struct_size(rct_footpath_entry, 13);
#pragma pack(pop)