Implement #17806: Warn user if fallback images are used

Warns user on the object debug info, when closing the object selection window after selecting objects, and when opening a park.
This commit is contained in:
spacek531 2022-09-03 06:56:23 -07:00 committed by GitHub
parent 6268197876
commit 8c8dc632b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 1 deletions

View File

@ -3620,6 +3620,9 @@ STR_6511 :Zero G Roll (right)
STR_6512 :Large Zero G Roll (left)
STR_6513 :Large Zero G Roll (right)
STR_6514 :Invalid height!
STR_6515 :{BLACK}RCT1 not linked - fallback images will be used.
STR_6516 :One or more objects added require RCT1 linked for proper display. Fallback images will be used.
STR_6517 :One or more objects in this park require RCT1 linked for proper display. Fallback images will be used.
#############
# Scenarios #

View File

@ -13,6 +13,7 @@
- Improved: [#15358] Park and scenario names can now contain up to 128 characters.
- Improved: [#16840] Add support for rectangular heightmaps.
- Improved: [#17575] You can now search for Authors in Object Selection.
- Improved: [#17806] Added warning when using RCT1 objects without RCT1 linked.
- Improved: [#17868] [Plugin] You can now change active tab of a custom window programmatically.
- Change: [#9104] Calculate maze support costs.
- Change: [#17319] Giant screenshots are now cropped to the horizontal view-clipping selection.

View File

@ -1256,7 +1256,15 @@ private:
void DrawDebugData(rct_drawpixelinfo* dpi)
{
ObjectListItem* listItem = &_listItems[selected_list_item];
auto screenPos = windowPos + ScreenCoordsXY{ width - 5, height - (LIST_ROW_HEIGHT * 5) };
auto screenPos = windowPos + ScreenCoordsXY{ width - 5, height - (LIST_ROW_HEIGHT * 6) };
// Draw fallback image warning
if (_loadedObject && _loadedObject->UsesFallbackImages())
{
DrawTextBasic(dpi, screenPos, STR_OBJECT_USES_FALLBACK_IMAGES, {}, { COLOUR_WHITE, TextAlignment::RIGHT });
}
screenPos.y += LIST_ROW_HEIGHT;
// Draw ride type.
if (GetSelectedObjectType() == ObjectType::Ride)
{
@ -1558,6 +1566,7 @@ void EditorLoadSelectedObjects()
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
int32_t numItems = static_cast<int32_t>(object_repository_get_items_count());
const ObjectRepositoryItem* items = object_repository_get_items();
bool showFallbackWarning = false;
for (int32_t i = 0; i < numItems; i++)
{
if (_objectSelectionFlags[i] & ObjectSelectionFlags::Selected)
@ -1588,6 +1597,10 @@ void EditorLoadSelectedObjects()
{
research_insert_scenery_group_entry(entryIndex, true);
}
if (loadedObject->UsesFallbackImages())
{
showFallbackWarning = true;
}
}
}
}
@ -1597,4 +1610,6 @@ void EditorLoadSelectedObjects()
// Reloads the default cyan water palette if no palette was selected.
load_palette();
}
if (showFallbackWarning)
context_show_error(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter::Common());
}

View File

@ -694,6 +694,13 @@ namespace OpenRCT2
ft.Add<uint32_t>(result.TargetVersion);
windowManager->ShowError(STR_WARNING_PARK_VERSION_TITLE, STR_WARNING_PARK_VERSION_MESSAGE, ft);
}
else if (HasObjectsThatUseFallbackImages())
{
Console::Error::WriteLine("Park has objects which require RCT1 linked. Fallback images will be used.");
auto windowManager = _uiContext->GetWindowManager();
windowManager->ShowError(STR_PARK_USES_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter());
}
return true;
}
catch (const ObjectLoadException& e)
@ -777,6 +784,24 @@ namespace OpenRCT2
}
private:
bool HasObjectsThatUseFallbackImages()
{
for (auto objectType : ObjectTypes)
{
auto maxObjectsOfType = static_cast<ObjectEntryIndex>(object_entry_group_counts[EnumValue(objectType)]);
for (ObjectEntryIndex i = 0; i < maxObjectsOfType; i++)
{
auto obj = _objectManager->GetLoadedObject(objectType, i);
if (obj != nullptr)
{
if (obj->UsesFallbackImages())
return true;
}
}
}
return false;
}
std::string GetOrPromptRCT2Path()
{
auto result = std::string();

View File

@ -3901,6 +3901,10 @@ enum : uint16_t
STR_INVALID_HEIGHT = 6514,
STR_OBJECT_USES_FALLBACK_IMAGES = 6515,
STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING = 6516,
STR_PARK_USES_FALLBACK_IMAGES_WARNING = 6517,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
};