From 7f7341a36990c632235d9a3f3994dae52ffa8580 Mon Sep 17 00:00:00 2001 From: Andre Mohren Date: Fri, 12 Jul 2019 19:30:59 +0200 Subject: [PATCH] Fixed incorrect sequence frame amount checks using Stride. --- OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 9f3491635e..222cac8f9a 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -204,16 +204,16 @@ namespace OpenRA.Mods.Common.Graphics "{0}: Sequence {1}.{2}: Length must be <= Frames.Length" .F(info.Nodes[0].Location, sequence, animation)); - if (Start < 0 || Start + Facings * Stride > frameCount) + if (Start < 0 || Start + (Facings - 1) * Stride + Length > frameCount) throw new InvalidOperationException( "{5}: Sequence {0}.{1} uses frames [{2}..{3}], but only 0..{4} actually exist" - .F(sequence, animation, Start, Start + Facings * Stride - 1, frameCount - 1, + .F(sequence, animation, Start, Start + (Facings - 1) * Stride + Length - 1, frameCount - 1, info.Nodes[0].Location)); - if (ShadowStart + Facings * Stride > frameCount) + if (ShadowStart + (Facings - 1) * Stride + Length > frameCount) throw new InvalidOperationException( "{5}: Sequence {0}.{1}'s shadow frames use frames [{2}..{3}], but only [0..{4}] actually exist" - .F(sequence, animation, ShadowStart, ShadowStart + Facings * Stride - 1, frameCount - 1, + .F(sequence, animation, ShadowStart, ShadowStart + (Facings - 1) * Stride + Length - 1, frameCount - 1, info.Nodes[0].Location)); var usedFrames = new List();