fix problem with cnc nuke leaking the long idle sequence Tick

and avoid magic numbers
This commit is contained in:
Matthias Mailänder
2014-07-06 09:23:31 +02:00
parent 960248fe44
commit 565ea05bd7
2 changed files with 15 additions and 3 deletions

View File

@@ -23,9 +23,12 @@ namespace OpenRA.Graphics
int frame = 0;
bool backwards = false;
bool tickAlways;
string name;
readonly int defaultTick = 40; // 25 fps == 40 ms
bool tickAlways;
public string Name { get { return name; } }
readonly SequenceProvider sequenceProvider;
@@ -66,6 +69,12 @@ namespace OpenRA.Graphics
return Render(pos, WVec.Zero, 0, palette, 1f);
}
public void Initialize(string sequenceName)
{
CurrentSequence = sequenceProvider.GetSequence(name, sequenceName);
tickAlways = true;
}
public void Play(string sequenceName)
{
PlayThen(sequenceName, null);
@@ -149,7 +158,7 @@ namespace OpenRA.Graphics
while (timeUntilNextFrame <= 0)
{
tickFunc();
timeUntilNextFrame += CurrentSequence != null ? CurrentSequence.Tick : 40; // 25 fps == 40 ms
timeUntilNextFrame += CurrentSequence != null ? CurrentSequence.Tick : defaultTick;
}
}
}