sequences for the rest of the buildable buildings, and fixes to make HBOX and MSLO work
- HBOX and MSLO sprites are in temperat/snow mixes with .tem/.sno extensions (and not present in interior)
This commit is contained in:
@@ -26,5 +26,20 @@ namespace OpenRa.FileFormats
|
||||
|
||||
throw new FileNotFoundException("File not found", filename);
|
||||
}
|
||||
|
||||
public static Stream OpenWithExts( string filename, params string[] exts )
|
||||
{
|
||||
foreach( var ext in exts )
|
||||
{
|
||||
foreach( IFolder folder in mountedFolders )
|
||||
{
|
||||
Stream s = folder.GetContent( filename + ext );
|
||||
if( s != null )
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
throw new FileNotFoundException( "File not found", filename );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ namespace OpenRa.Game
|
||||
public Actor( string name, int2 location, Player owner )
|
||||
{
|
||||
unitInfo = Rules.UnitInfo.Get( name );
|
||||
Location = location;
|
||||
Location = location;
|
||||
CenterLocation = new float2( 12, 12 ) + 24 * (float2)Location;
|
||||
Owner = owner;
|
||||
|
||||
switch( name )
|
||||
@@ -29,7 +30,7 @@ namespace OpenRa.Game
|
||||
///// vehicles /////
|
||||
case "mcv":
|
||||
traits.Add( new Traits.Mobile( this ) );
|
||||
traits.Add( new Traits.RenderUnit( this, name ) );
|
||||
traits.Add( new Traits.RenderUnit( this ) );
|
||||
traits.Add( new Traits.McvDeploy( this ) );
|
||||
break;
|
||||
case "mnly":
|
||||
@@ -37,7 +38,7 @@ namespace OpenRa.Game
|
||||
case "v2rl":
|
||||
case "arty":
|
||||
traits.Add( new Traits.Mobile( this ) );
|
||||
traits.Add( new Traits.RenderUnit( this, name ) );
|
||||
traits.Add( new Traits.RenderUnit( this ) );
|
||||
break;
|
||||
case "jeep":
|
||||
case "1tnk":
|
||||
@@ -48,11 +49,11 @@ namespace OpenRa.Game
|
||||
case "mgg":
|
||||
traits.Add( new Traits.Mobile( this ) );
|
||||
traits.Add( new Traits.Turreted( this ) );
|
||||
traits.Add( new Traits.RenderUnitTurreted( this, name ) );
|
||||
traits.Add( new Traits.RenderUnitTurreted( this ) );
|
||||
break;
|
||||
case "harv":
|
||||
traits.Add( new Traits.Mobile( this ) );
|
||||
traits.Add( new Traits.RenderUnit( this, name ) );
|
||||
traits.Add( new Traits.RenderUnit( this ) );
|
||||
break;
|
||||
///// TODO: infantry /////
|
||||
|
||||
@@ -66,7 +67,6 @@ namespace OpenRa.Game
|
||||
case "mslo":
|
||||
case "atek":
|
||||
case "stek":
|
||||
case "weap":
|
||||
case "fact":
|
||||
case "proc":
|
||||
case "silo":
|
||||
@@ -79,7 +79,8 @@ namespace OpenRa.Game
|
||||
case "tent":
|
||||
case "kenn":
|
||||
case "fix":
|
||||
//SYRD, SPEN
|
||||
case "spen":
|
||||
case "syrd":
|
||||
//GAP
|
||||
//SBAG, BRIK, FENC
|
||||
//FACF, WEAF, SYRF, SPEF, DOMF
|
||||
@@ -88,14 +89,18 @@ namespace OpenRa.Game
|
||||
case "tsla":
|
||||
case "ftur":
|
||||
traits.Add( new Traits.Building( this ) );
|
||||
traits.Add( new Traits.RenderBuilding( this, name ) );
|
||||
break;
|
||||
traits.Add( new Traits.RenderBuilding( this ) );
|
||||
break;
|
||||
case "weap":
|
||||
traits.Add( new Traits.Building( this ) );
|
||||
traits.Add( new Traits.RenderWarFactory( this ) );
|
||||
break;
|
||||
case "gun":
|
||||
case "agun":
|
||||
case "sam":
|
||||
traits.Add( new Traits.Building( this ) );
|
||||
traits.Add( new Traits.Turreted( this ) );
|
||||
traits.Add( new Traits.RenderBuildingTurreted( this, name ) );
|
||||
traits.Add( new Traits.RenderBuildingTurreted( this ) );
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException( "Actor traits for " + name );
|
||||
@@ -112,9 +117,9 @@ namespace OpenRa.Game
|
||||
{
|
||||
foreach( var tick in traits.WithInterface<Traits.ITick>() )
|
||||
tick.Tick( this, game, dt );
|
||||
}
|
||||
|
||||
public float2 CenterLocation { get { return new float2( 12, 12 ) + 24 * (float2)Location; } }
|
||||
}
|
||||
|
||||
public float2 CenterLocation;
|
||||
public float2 SelectedSize { get { return Render().FirstOrDefault().First.size; } }
|
||||
|
||||
public IEnumerable<Pair<Sprite, float2>> Render()
|
||||
@@ -152,9 +157,9 @@ namespace OpenRa.Game
|
||||
{
|
||||
public Animation anim;
|
||||
|
||||
public RenderSimple( Actor self, string unitName )
|
||||
public RenderSimple( Actor self )
|
||||
{
|
||||
anim = new Animation( unitName );
|
||||
anim = new Animation( self.unitInfo.Name );
|
||||
}
|
||||
|
||||
public abstract IEnumerable<Pair<Sprite, float2>> Render( Actor self );
|
||||
@@ -167,10 +172,10 @@ namespace OpenRa.Game
|
||||
|
||||
class RenderBuilding : RenderSimple
|
||||
{
|
||||
public RenderBuilding( Actor self, string unitName )
|
||||
: base( self, unitName )
|
||||
public RenderBuilding( Actor self )
|
||||
: base( self )
|
||||
{
|
||||
anim.PlayThen( "make", () => anim.Play( "idle" ) );
|
||||
anim.PlayThen( "make", () => anim.PlayRepeating( "idle" ) );
|
||||
}
|
||||
|
||||
public override IEnumerable<Pair<Sprite, float2>> Render( Actor self )
|
||||
@@ -181,19 +186,50 @@ namespace OpenRa.Game
|
||||
|
||||
class RenderBuildingTurreted : RenderBuilding
|
||||
{
|
||||
public RenderBuildingTurreted( Actor self, string unitName )
|
||||
: base( self, unitName )
|
||||
public RenderBuildingTurreted( Actor self )
|
||||
: base( self )
|
||||
{
|
||||
anim.PlayThen( "make", () => anim.PlayFetchIndex( "idle", () => self.traits.Get<Turreted>().turretFacing ) );
|
||||
}
|
||||
}
|
||||
|
||||
class RenderWarFactory : RenderBuilding
|
||||
{
|
||||
public Animation roof;
|
||||
bool doneBuilding;
|
||||
|
||||
public RenderWarFactory( Actor self )
|
||||
: base( self )
|
||||
{
|
||||
roof = new Animation( self.unitInfo.Name );
|
||||
anim.PlayThen( "make", () =>
|
||||
{
|
||||
doneBuilding = true;
|
||||
anim.Play( "idle" );
|
||||
roof.Play( "idle-top" );
|
||||
} );
|
||||
}
|
||||
|
||||
public override IEnumerable<Pair<Sprite, float2>> Render( Actor self )
|
||||
{
|
||||
yield return Pair.New( anim.Image, 24f * (float2)self.Location );
|
||||
if( doneBuilding )
|
||||
yield return Pair.New( roof.Image, 24f * (float2)self.Location );
|
||||
}
|
||||
|
||||
public override void Tick( Actor self, Game game, int dt )
|
||||
{
|
||||
base.Tick( self, game, dt );
|
||||
roof.Tick( dt );
|
||||
}
|
||||
}
|
||||
|
||||
class RenderUnit : RenderSimple
|
||||
{
|
||||
public RenderUnit( Actor self, string unitName )
|
||||
:base( self, unitName )
|
||||
{
|
||||
anim.PlayFetchIndex( "idle", () => self.traits.Get<Mobile>().facing );
|
||||
{
|
||||
public RenderUnit( Actor self )
|
||||
: base( self )
|
||||
{
|
||||
anim.PlayFetchIndex( "idle", () => self.traits.Get<Mobile>().facing );
|
||||
}
|
||||
|
||||
protected static Pair<Sprite, float2> Centered( Sprite s, float2 location )
|
||||
@@ -215,20 +251,18 @@ namespace OpenRa.Game
|
||||
{
|
||||
public Animation turretAnim;
|
||||
|
||||
public RenderUnitTurreted( Actor self, string unitName )
|
||||
: base( self, unitName )
|
||||
public RenderUnitTurreted( Actor self )
|
||||
: base( self )
|
||||
{
|
||||
turretAnim = new Animation( unitName );
|
||||
turretAnim = new Animation( self.unitInfo.Name );
|
||||
turretAnim.PlayFetchIndex( "turret", () => self.traits.Get<Turreted>().turretFacing );
|
||||
}
|
||||
|
||||
public override IEnumerable<Pair<Sprite, float2>> Render( Actor self )
|
||||
{
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
float fraction = ( mobile.moveFraction > 0 ) ? (float)mobile.moveFraction / mobile.moveFractionTotal : 0f;
|
||||
var centerLocation = new float2( 12, 12 ) + 24 * float2.Lerp( mobile.fromCell, mobile.toCell, fraction );
|
||||
yield return Centered( anim.Image, centerLocation );
|
||||
yield return Centered( turretAnim.Image, centerLocation );
|
||||
yield return Centered( anim.Image, self.CenterLocation );
|
||||
yield return Centered( turretAnim.Image, self.CenterLocation );
|
||||
}
|
||||
|
||||
public override void Tick( Actor self, Game game, int dt )
|
||||
@@ -285,9 +319,21 @@ namespace OpenRa.Game
|
||||
}
|
||||
|
||||
return highest;
|
||||
}
|
||||
|
||||
void UpdateCenterLocation()
|
||||
{
|
||||
float fraction = ( moveFraction > 0 ) ? (float)moveFraction / moveFractionTotal : 0f;
|
||||
self.CenterLocation = new float2( 12, 12 ) + 24 * float2.Lerp( fromCell, toCell, fraction );
|
||||
}
|
||||
|
||||
public void Tick( Actor self, Game game, int dt )
|
||||
{
|
||||
Move( self, game, dt );
|
||||
UpdateCenterLocation();
|
||||
}
|
||||
|
||||
void Move( Actor self, Game game, int dt )
|
||||
{
|
||||
if( fromCell != toCell )
|
||||
{
|
||||
@@ -378,14 +424,17 @@ namespace OpenRa.Game
|
||||
class Building : ITick
|
||||
{
|
||||
public Building( Actor self )
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
public void Tick( Actor self, Game game, int dt )
|
||||
{
|
||||
if( first && self.Owner == game.LocalPlayer )
|
||||
self.Owner.TechTree.Build( self.unitInfo.Name, true );
|
||||
{
|
||||
if( first && self.Owner == game.LocalPlayer )
|
||||
{
|
||||
self.Owner.TechTree.Build( self.unitInfo.Name, true );
|
||||
self.CenterLocation = 24 * (float2)self.Location + 0.5f * self.SelectedSize;
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenRa.Game.GameRules
|
||||
|
||||
public BaseInfo( string name, IniSection ini )
|
||||
{
|
||||
Name = name;
|
||||
Name = name.ToLowerInvariant();
|
||||
|
||||
foreach( var x in ini )
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
int low = sprites.Count;
|
||||
|
||||
ShpReader reader = new ShpReader(FileSystem.Open(name + ".shp"));
|
||||
ShpReader reader = new ShpReader( FileSystem.OpenWithExts( name, ".shp", ".tem", ".sno", ".int" ) );
|
||||
foreach (ImageHeader h in reader)
|
||||
sprites.Add(SheetBuilder.Add(h.Image, reader.Size));
|
||||
|
||||
|
||||
133
sequences.xml
133
sequences.xml
@@ -31,7 +31,6 @@
|
||||
<sequences>
|
||||
|
||||
<!-- construction yard -->
|
||||
|
||||
<unit name="fact">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="make" start="0" length="32" src="factmake" />
|
||||
@@ -41,23 +40,27 @@
|
||||
</unit>
|
||||
|
||||
<!-- refinery -->
|
||||
|
||||
<unit name="proc">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
<sequence name="make" start="0" length="*" src="procmake" />
|
||||
</unit>
|
||||
|
||||
<!-- power plant -->
|
||||
<!-- silo -->
|
||||
<unit name="silo">
|
||||
<sequence name="idle" start="0" length="5"/>
|
||||
<sequence name="damaged-idle" start="5" length="5"/>
|
||||
<sequence name="make" start="0" length="*" src="silomake" />
|
||||
</unit>
|
||||
|
||||
<!-- power plant -->
|
||||
<unit name="powr">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
<sequence name="make" start="0" length="*" src="powrmake" />
|
||||
</unit>
|
||||
|
||||
<!-- advanced power plant -->
|
||||
|
||||
<!-- advanced power plant -->
|
||||
<unit name="apwr">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
@@ -65,7 +68,6 @@
|
||||
</unit>
|
||||
|
||||
<!-- soviet barracks -->
|
||||
|
||||
<unit name="barr">
|
||||
<sequence name="idle" start="0" length="10"/>
|
||||
<sequence name="damaged-idle" start="10" length="10"/>
|
||||
@@ -73,15 +75,20 @@
|
||||
</unit>
|
||||
|
||||
<!-- allied barracks -->
|
||||
|
||||
<unit name="tent">
|
||||
<sequence name="idle" start="0" length="10"/>
|
||||
<sequence name="damaged-idle" start="10" length="10"/>
|
||||
<sequence name="make" start="0" length="*" src="tentmake" />
|
||||
</unit>
|
||||
|
||||
<!-- radar dome -->
|
||||
<!-- kennel -->
|
||||
<unit name="kenn">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
<sequence name="make" start="0" length="*" src="kennmake" />
|
||||
</unit>
|
||||
|
||||
<!-- radar dome -->
|
||||
<unit name="dome">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
@@ -89,7 +96,6 @@
|
||||
</unit>
|
||||
|
||||
<!-- allied tech center -->
|
||||
|
||||
<unit name="atek">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
@@ -97,7 +103,6 @@
|
||||
</unit>
|
||||
|
||||
<!-- soviet tech center -->
|
||||
|
||||
<unit name="stek">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
@@ -105,39 +110,111 @@
|
||||
</unit>
|
||||
|
||||
<!-- war factory -->
|
||||
|
||||
<unit name="weap">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
<sequence name="make" start="0" length="*" src="weapmake" />
|
||||
<sequence name="build-top" start="0" length="4" src="weap2" />
|
||||
<sequence name="build2-top" start="4" length="4" src="weap2" />
|
||||
<sequence name="idle-top" start="0" length="1" src="weap2" />
|
||||
<sequence name="damaged-idle_top" start="4" length="1" src="weap2" />
|
||||
<sequence name="build-top" start="0" length="4" src="weap2" />
|
||||
<sequence name="build2-top" start="4" length="4" src="weap2" />
|
||||
<sequence name="idle-top" start="0" length="1" src="weap2" />
|
||||
<sequence name="damaged-idle_top" start="4" length="1" src="weap2" />
|
||||
</unit>
|
||||
|
||||
<!-- helipad -->
|
||||
<unit name="hpad">
|
||||
<sequence name="idle" start="0" length="7"/>
|
||||
<sequence name="damaged-idle" start="7" length="7"/>
|
||||
<sequence name="make" start="0" length="*" src="hpadmake" />
|
||||
</unit>
|
||||
|
||||
<!-- airfield -->
|
||||
<unit name="afld">
|
||||
<sequence name="idle" start="0" length="8"/>
|
||||
<sequence name="damaged-idle" start="8" length="8"/>
|
||||
<sequence name="make" start="0" length="*" src="afldmake" />
|
||||
</unit>
|
||||
|
||||
<!-- sub pen -->
|
||||
<unit name="spen">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
<sequence name="make" start="0" length="*" src="spenmake" />
|
||||
</unit>
|
||||
|
||||
<!-- shipyard -->
|
||||
<unit name="syrd">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
<sequence name="make" start="0" length="*" src="syrdmake" />
|
||||
</unit>
|
||||
|
||||
<!-- repair pad -->
|
||||
<unit name="fix">
|
||||
<sequence name="idle" start="0" length="7"/>
|
||||
<sequence name="damaged-idle" start="7" length="7"/>
|
||||
<sequence name="make" start="0" length="*" src="fixmake" />
|
||||
</unit>
|
||||
|
||||
<!-- allied gun turret -->
|
||||
|
||||
<unit name="gun">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="damaged-idle" start="1" length="32"/>
|
||||
<sequence name="damaged-idle" start="32" length="32"/>
|
||||
<sequence name="make" start="0" length="*" src="gunmake" />
|
||||
</unit>
|
||||
|
||||
<!-- sam site -->
|
||||
<unit name="sam">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="damaged-idle" start="34" length="32"/>
|
||||
<sequence name="make" start="0" length="*" src="sammake" />
|
||||
</unit>
|
||||
|
||||
<!-- flame turret -->
|
||||
<unit name="ftur">
|
||||
<sequence name="idle" start="0"/>
|
||||
<sequence name="damaged-idle" start="1"/>
|
||||
<sequence name="make" start="0" length="*" src="fturmake" />
|
||||
</unit>
|
||||
|
||||
<!-- tesla coil -->
|
||||
<unit name="tsla">
|
||||
<sequence name="idle" start="0" length="10"/>
|
||||
<sequence name="damaged-idle" start="10" length="10"/>
|
||||
<sequence name="make" start="0" length="*" src="tslamake" />
|
||||
</unit>
|
||||
|
||||
<!-- iron curtain -->
|
||||
<unit name="iron">
|
||||
<sequence name="idle" start="0" length="11"/>
|
||||
<sequence name="damaged-idle" start="11" length="11"/>
|
||||
<sequence name="make" start="0" length="*" src="ironmake" />
|
||||
</unit>
|
||||
|
||||
<!-- chronosphere -->
|
||||
<unit name="pdox">
|
||||
<sequence name="idle" start="0" length="29"/>
|
||||
<sequence name="damaged-idle" start="29" length="29"/>
|
||||
<sequence name="make" start="0" length="*" src="pdoxmake" />
|
||||
</unit>
|
||||
|
||||
<!-- nuclear missile silo -->
|
||||
<unit name="mslo">
|
||||
<sequence name="idle" start="0" length="8"/>
|
||||
<sequence name="damaged-idle" start="8" length="8"/>
|
||||
<sequence name="make" start="0" length="*" src="mslomake" />
|
||||
</unit>
|
||||
|
||||
<!-- mcv -->
|
||||
|
||||
<unit name="mcv">
|
||||
<sequence name="idle" start="0" length="*"/>
|
||||
</unit>
|
||||
|
||||
<!-- truck -->
|
||||
|
||||
<unit name="truk">
|
||||
<sequence name="idle" start="0" length="*"/>
|
||||
</unit>
|
||||
|
||||
<!-- harv -->
|
||||
|
||||
<unit name="harv">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="harvest0" start="32" length="8"/>
|
||||
@@ -150,37 +227,32 @@
|
||||
<sequence name="harvest7" start="88" length="8"/>
|
||||
<sequence name="empty" start="96" length="15"/>
|
||||
</unit>
|
||||
|
||||
<!-- light tank -->
|
||||
|
||||
<!-- light tank -->
|
||||
<unit name="1tnk">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="turret" start="32" length="32"/>
|
||||
</unit>
|
||||
|
||||
<!-- medium tank -->
|
||||
|
||||
<unit name="2tnk">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="turret" start="32" length="32"/>
|
||||
</unit>
|
||||
|
||||
<!-- heavy tank -->
|
||||
|
||||
<unit name="3tnk">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="turret" start="32" length="32"/>
|
||||
</unit>
|
||||
|
||||
|
||||
<!-- mammoth tank -->
|
||||
|
||||
<unit name="4tnk">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="turret" start="32" length="32"/>
|
||||
</unit>
|
||||
|
||||
<!-- v2 rocket launcher -->
|
||||
|
||||
<unit name="v2rl">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="reloading" start="32" length="32"/>
|
||||
@@ -188,47 +260,40 @@
|
||||
</unit>
|
||||
|
||||
<!-- artillery -->
|
||||
|
||||
<unit name="arty">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
</unit>
|
||||
|
||||
<!-- jeep -->
|
||||
|
||||
<unit name="jeep">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="turret" start="32" length="32"/>
|
||||
</unit>
|
||||
|
||||
<!-- apc -->
|
||||
|
||||
<unit name="apc">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
</unit>
|
||||
|
||||
<!-- mine layer -->
|
||||
|
||||
<unit name="mnly">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<!-- and 16 "lay mine" sprites, not used in real-ra -->
|
||||
</unit>
|
||||
|
||||
<!-- radar jammer -->
|
||||
|
||||
<unit name="mrj">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="turret" start="32" length="32"/>
|
||||
</unit>
|
||||
|
||||
<!-- mobile gap generator -->
|
||||
|
||||
<unit name="mgg">
|
||||
<sequence name="idle" start="0" length="32"/>
|
||||
<sequence name="turret" start="32" length="8"/>
|
||||
</unit>
|
||||
|
||||
<!-- build clock - hacked in -->
|
||||
|
||||
<unit name="clock">
|
||||
<sequence name="idle" start="0" length="*"/>
|
||||
</unit>
|
||||
|
||||
Reference in New Issue
Block a user