custom animation framerates
This commit is contained in:
@@ -126,7 +126,7 @@ namespace OpenRA.Graphics
|
|||||||
while( timeUntilNextFrame <= 0 )
|
while( timeUntilNextFrame <= 0 )
|
||||||
{
|
{
|
||||||
tickFunc();
|
tickFunc();
|
||||||
timeUntilNextFrame += 40; // 25 fps == 40 ms
|
timeUntilNextFrame += CurrentSequence != null ? CurrentSequence.Speed : 40; // 25 fps == 40 ms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,14 @@ namespace OpenRA.Graphics
|
|||||||
public class Sequence
|
public class Sequence
|
||||||
{
|
{
|
||||||
readonly Sprite[] sprites;
|
readonly Sprite[] sprites;
|
||||||
readonly int start, length, facings;
|
readonly int start, length, facings, speed;
|
||||||
|
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
public int Start { get { return start; } }
|
public int Start { get { return start; } }
|
||||||
public int End { get { return start + length; } }
|
public int End { get { return start + length; } }
|
||||||
public int Length { get { return length; } }
|
public int Length { get { return length; } }
|
||||||
public int Facings { get { return facings; } }
|
public int Facings { get { return facings; } }
|
||||||
|
public int Speed { get { return speed; } }
|
||||||
|
|
||||||
public Sequence(string unit, XmlElement e)
|
public Sequence(string unit, XmlElement e)
|
||||||
{
|
{
|
||||||
@@ -54,6 +55,11 @@ namespace OpenRA.Graphics
|
|||||||
facings = int.Parse( e.GetAttribute( "facings" ) );
|
facings = int.Parse( e.GetAttribute( "facings" ) );
|
||||||
else
|
else
|
||||||
facings = 1;
|
facings = 1;
|
||||||
|
|
||||||
|
if (e.HasAttribute("speed"))
|
||||||
|
speed = int.Parse(e.GetAttribute("speed"));
|
||||||
|
else
|
||||||
|
speed = 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sprite GetSprite( int frame )
|
public Sprite GetSprite( int frame )
|
||||||
|
|||||||
@@ -3,18 +3,18 @@
|
|||||||
<!-- Construction Yard -->
|
<!-- Construction Yard -->
|
||||||
<unit name="fact">
|
<unit name="fact">
|
||||||
<sequence name="build" start="4" length="20" />
|
<sequence name="build" start="4" length="20" />
|
||||||
<sequence name="idle" start="0" length="4" />
|
<sequence name="idle" start="0" length="4" speed="80"/>
|
||||||
<sequence name="critical-build" start="28" length="20" />
|
<sequence name="critical-build" start="28" length="20" />
|
||||||
<sequence name="damaged-build" start="28" length="20" />
|
<sequence name="damaged-build" start="28" length="20" />
|
||||||
<sequence name="critical-idle" start="48" length="1" />
|
<sequence name="critical-idle" start="48" length="1"/>
|
||||||
<sequence name="damaged-idle" start="24" length="4" />
|
<sequence name="damaged-idle" start="24" length="4" speed="80"/>
|
||||||
<sequence name="make" start="0" length="32" src="factmake" />
|
<sequence name="make" start="0" length="32" src="factmake" />
|
||||||
</unit>
|
</unit>
|
||||||
<!-- Power Plant -->
|
<!-- Power Plant -->
|
||||||
<unit name="nuke">
|
<unit name="nuke">
|
||||||
<sequence name="idle" start="0" length="4" />
|
<sequence name="idle" start="0" length="4" speed="160"/>
|
||||||
<sequence name="damaged-idle" start="4" length="4" />
|
<sequence name="damaged-idle" start="4" length="4" speed="160"/>
|
||||||
<sequence name="critical-idle" start="8" length="1" />
|
<sequence name="critical-idle" start="8" length="1" speed="160"/>
|
||||||
<sequence name="make" start="0" length="*" src="nukemake" />
|
<sequence name="make" start="0" length="*" src="nukemake" />
|
||||||
</unit>
|
</unit>
|
||||||
<!-- Tiberium Refinary -->
|
<!-- Tiberium Refinary -->
|
||||||
|
|||||||
Reference in New Issue
Block a user