Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed RA2 lobrdb sprites not getting loaded #13882

Merged
merged 2 commits into from Oct 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs
Expand Up @@ -104,7 +104,7 @@ bool IsShpTS(Stream s)
return false;
}

// Check the size and format flag
// Check the image size and compression type format flag
// Some files define bogus frames, so loop until we find a valid one
s.Position += 4;
ushort w, h, f = 0;
Expand All @@ -114,11 +114,17 @@ bool IsShpTS(Stream s)
w = s.ReadUInt16();
h = s.ReadUInt16();
type = s.ReadUInt8();

// Zero sized frames always define a non-zero type
if ((w == 0 || h == 0) && type == 0)
return false;

s.Position += 19;
}
while (w == 0 && h == 0 && f++ < imageCount);
while (w == 0 && h == 0 && ++f < imageCount);

s.Position = start;
return type < 4;
return f == imageCount || type < 4;
}

ShpTSFrame[] ParseFrames(Stream s)
Expand Down