fix a rounding problem in SHP(TS) offset floating point math

closes #5765
This commit is contained in:
Matthias Mailänder
2014-07-01 11:50:28 +02:00
parent cf7bd75dad
commit f5b749e9ce

View File

@@ -33,7 +33,8 @@ namespace OpenRA.FileFormats
var width = stream.ReadUInt16(); var width = stream.ReadUInt16();
var height = stream.ReadUInt16(); var height = stream.ReadUInt16();
Offset = new float2(x + 0.5f * (width - frameSize.Width), y + 0.5f * (height - frameSize.Height)); // Note: the mixed Integer / fp division is intentional, and required for calculating the correct offset.
Offset = new float2(x + width / 2 - 0.5f * frameSize.Width, y + height / 2 - 0.5f * frameSize.Height);
Size = new Size(width, height); Size = new Size(width, height);
FrameSize = frameSize; FrameSize = frameSize;