1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Let other animation groups copy missing animations from primary group

This commit is contained in:
Aaron van Geffen
2024-12-09 17:42:41 +01:00
parent dbc394cb67
commit f2779fb7fb

View File

@@ -77,6 +77,23 @@ void PeepAnimationsObject::ReadJson(IReadObjectContext* context, json_t& root)
{
if (!groupJson["animations"].contains(typeStr))
{
// Successive animation groups can copy the basic animations from the primary group
if (!_animationGroups.empty())
{
auto& referenceAnim = _animationGroups[0][typeEnum];
if (referenceAnim.imageTableOffset != 0)
{
LOG_VERBOSE("Copying animation '%s' from primary group", typeStr);
std::vector<uint8_t> sequence = referenceAnim.frame_offsets;
group[typeEnum] = {
.imageTableOffset = referenceAnim.imageTableOffset,
.frame_offsets = sequence,
};
continue;
}
}
// No primary animation bail us out -- error here!
LOG_ERROR("Required animation does not exist: %s", typeStr);
continue;
}