The sprites of structures with no body are flipped correctly

This commit is contained in:
Regalis
2016-11-03 18:24:03 +02:00
parent 8f646a2723
commit 505b4f5f1a
+15 -8
View File
@@ -288,31 +288,38 @@ namespace Barotrauma
private void CreateSections() private void CreateSections()
{ {
int xsections = 1, ysections = 1; int xsections = 1, ysections = 1;
int width, height; int width = rect.Width, height = rect.Height;
if (!HasBody) if (!HasBody)
{ {
sections = new WallSection[1]; if (flippedX && isHorizontal)
sections[0] = new WallSection(rect); {
return; xsections = (int)Math.Ceiling((float)rect.Width / prefab.sprite.SourceRect.Width);
width = prefab.sprite.SourceRect.Width;
} }
else
{
xsections = 1;
ysections = 1;
}
sections = new WallSection[xsections];
}
else
{
if (isHorizontal) if (isHorizontal)
{ {
xsections = (int)Math.Ceiling((float)rect.Width / wallSectionSize); xsections = (int)Math.Ceiling((float)rect.Width / wallSectionSize);
sections = new WallSection[xsections]; sections = new WallSection[xsections];
width = (int)wallSectionSize; width = (int)wallSectionSize;
height = rect.Height;
} }
else else
{ {
ysections = (int)Math.Ceiling((float)rect.Height / wallSectionSize); ysections = (int)Math.Ceiling((float)rect.Height / wallSectionSize);
sections = new WallSection[ysections]; sections = new WallSection[ysections];
width = rect.Width; width = rect.Width;
height = (int)wallSectionSize;
} }
}
for (int x = 0; x < xsections; x++) for (int x = 0; x < xsections; x++)
{ {