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