Buildings with special rendering now skip their make animation. Removed IsMapActor; make-skipping is now controlled by a global in Game.
This commit is contained in:
@@ -21,12 +21,8 @@ namespace OpenRa.Game
|
||||
public int2 Location;
|
||||
public Player Owner;
|
||||
public int Health;
|
||||
public readonly bool IsMapActor;
|
||||
|
||||
public Actor(string name, int2 location, Player owner)
|
||||
: this( name, location, owner, false ) {}
|
||||
|
||||
public Actor( string name, int2 location, Player owner, bool isMapActor )
|
||||
public Actor( string name, int2 location, Player owner )
|
||||
{
|
||||
ActorID = Game.world.NextAID();
|
||||
unitInfo = Rules.UnitInfo[ name ];
|
||||
@@ -34,7 +30,6 @@ namespace OpenRa.Game
|
||||
CenterLocation = new float2( 12, 12 ) + Game.CellSize * (float2)Location;
|
||||
Owner = owner;
|
||||
Health = unitInfo.Strength; /* todo: handle cases where this is not true! */
|
||||
IsMapActor = isMapActor;
|
||||
|
||||
if( unitInfo.Traits != null )
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRa.Game
|
||||
if (orderGenerator != null)
|
||||
foreach (var order in orderGenerator.Order(xy.ToInt2(), left))
|
||||
{
|
||||
recentOrders.Add(order);
|
||||
AddOrder( order );
|
||||
if (order.Subject != null && order.Player == Game.LocalPlayer)
|
||||
doVoice = order.Subject;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace OpenRa.Game
|
||||
|
||||
public static string Replay;
|
||||
|
||||
public static bool skipMakeAnims = true;
|
||||
|
||||
public static void Initialize(string mapName, Renderer renderer, int2 clientSize, int localPlayer)
|
||||
{
|
||||
Rules.LoadRules(mapName);
|
||||
@@ -78,6 +80,8 @@ namespace OpenRa.Game
|
||||
: new OrderManager(new[] { new ReplayOrderSource(Replay) });
|
||||
|
||||
PlaySound("intro.aud", false);
|
||||
|
||||
skipMakeAnims = false;
|
||||
}
|
||||
|
||||
static void LoadMapBuildings( IniFile mapfile )
|
||||
@@ -87,7 +91,7 @@ namespace OpenRa.Game
|
||||
//num=owner,type,health,location,facing,trigger,unknown,shouldRepair
|
||||
var parts = s.Value.ToLowerInvariant().Split( ',' );
|
||||
var loc = int.Parse( parts[ 3 ] );
|
||||
world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ], true ) );
|
||||
world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +102,7 @@ namespace OpenRa.Game
|
||||
//num=owner,type,health,location,facing,action,trigger
|
||||
var parts = s.Value.ToLowerInvariant().Split( ',' );
|
||||
var loc = int.Parse( parts[ 3 ] );
|
||||
world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ], true ) );
|
||||
world.Add( new Actor( parts[ 1 ], new int2( loc % 128, loc / 128 ), players[ 0 ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +144,8 @@ namespace OpenRa.Game
|
||||
{
|
||||
lastTime += timestep;
|
||||
|
||||
if( orderManager.Tick() )
|
||||
{
|
||||
if( controller.orderGenerator != null )
|
||||
controller.orderGenerator.Tick();
|
||||
|
||||
@@ -147,8 +153,7 @@ namespace OpenRa.Game
|
||||
UnitInfluence.Tick();
|
||||
foreach( var player in players.Values )
|
||||
player.Tick();
|
||||
|
||||
orderManager.Tick();
|
||||
}
|
||||
}
|
||||
|
||||
viewport.cursor = controller.ChooseCursor();
|
||||
|
||||
@@ -27,9 +27,12 @@ namespace OpenRa.Game
|
||||
savingReplay = new BinaryWriter( new FileStream( replayFilename, FileMode.Create ) );
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
public bool Tick()
|
||||
{
|
||||
var localOrders = Game.controller.GetRecentOrders();
|
||||
if( localOrders == null )
|
||||
return false;
|
||||
|
||||
foreach( var p in players )
|
||||
p.Tick( localOrders );
|
||||
|
||||
@@ -48,6 +51,8 @@ namespace OpenRa.Game
|
||||
// sanity check on the framenumber. This is 2^31 frames maximum, or multiple *years* at 40ms/frame.
|
||||
if( ( frameNumber & 0x80000000 ) != 0 )
|
||||
throw new InvalidOperationException( "(OrderManager) Frame number too large" );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ namespace OpenRa.Game
|
||||
}
|
||||
else if (mi.Button == MouseButtons.Right && mi.Event == MouseInputEvent.Down)
|
||||
{
|
||||
if( producing == null ) return;
|
||||
if (item.Tag != producing.Item) return;
|
||||
|
||||
if (producing.Paused || producing.Done)
|
||||
|
||||
@@ -18,14 +18,19 @@ namespace OpenRa.Game.Traits
|
||||
public RenderBuilding(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
if (self.IsMapActor)
|
||||
anim.PlayRepeating("idle");
|
||||
else
|
||||
anim.PlayThen("make", () => anim.PlayRepeating("idle"));
|
||||
Make( () => anim.PlayRepeating("idle") );
|
||||
|
||||
DoBib(self, false);
|
||||
}
|
||||
|
||||
protected void Make( Action after )
|
||||
{
|
||||
if (Game.skipMakeAnims)
|
||||
after();
|
||||
else
|
||||
anim.PlayThen("make", after);
|
||||
}
|
||||
|
||||
void DoBib(Actor self, bool isRemove)
|
||||
{
|
||||
var buildingInfo = (UnitInfo.BuildingInfo)self.unitInfo;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace OpenRa.Game.Traits
|
||||
public RenderBuildingOre(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
anim.PlayThen("make", () => anim.PlayFetchIndex("idle",
|
||||
Make( () => anim.PlayFetchIndex("idle",
|
||||
() => (int)(5 * self.Owner.GetSiloFullness())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace OpenRa.Game.Traits
|
||||
public RenderBuildingTurreted(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
anim.PlayThen( "make", () => anim.PlayFetchIndex( "idle",
|
||||
Make( () => anim.PlayFetchIndex( "idle",
|
||||
() => self.traits.Get<Turreted>().turretFacing / 8 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRa.Game.Traits
|
||||
this.self = self;
|
||||
|
||||
roof = new Animation(self.unitInfo.Image ?? self.unitInfo.Name);
|
||||
anim.PlayThen("make", () =>
|
||||
Make( () =>
|
||||
{
|
||||
doneBuilding = true;
|
||||
anim.Play("idle");
|
||||
|
||||
Reference in New Issue
Block a user