Revert "use TickRender() for RenderSprites and PaletteModifier"

This reverts commit 87fd576b26.
This commit is contained in:
Paul Chote
2014-07-08 10:44:36 +12:00
parent 802b6a652c
commit 5650d5fc98
25 changed files with 48 additions and 56 deletions

4
OpenRA.Game/Traits/Render/RenderSprites.cs Normal file → Executable file
View File

@@ -31,7 +31,7 @@ namespace OpenRA.Traits
public virtual object Create(ActorInitializer init) { return new RenderSprites(init.self); }
}
public class RenderSprites : IRender, ITickRender, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
public class RenderSprites : IRender, ITick, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
{
class AnimationWrapper
{
@@ -126,7 +126,7 @@ namespace OpenRA.Traits
}
}
public virtual void TickRender(WorldRenderer wr, Actor self)
public virtual void Tick(Actor self)
{
foreach (var a in anims.Values)
a.Animation.Animation.Tick();

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA
public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.self, this); }
}
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender, ITickRender
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender
{
public readonly FirePort[] Ports;
@@ -183,8 +183,10 @@ namespace OpenRA.Mods.RA
yield return r;
}
public void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
base.Tick(self);
// Take a copy so that Tick() can remove animations
foreach (var m in muzzles.ToList())
m.Animation.Tick();

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
{
class ChronoshiftPaletteEffectInfo : TraitInfo<ChronoshiftPaletteEffect> { }
public class ChronoshiftPaletteEffect : IPaletteModifier, ITickRender
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick
{
const int chronoEffectLength = 60;
int remainingFrames;
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
remainingFrames = chronoEffectLength;
}
public void TickRender(WorldRenderer wr, Actor self)
public void Tick(Actor self)
{
if (remainingFrames > 0)
remainingFrames--;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
{
public class CloakPaletteEffectInfo : TraitInfo<CloakPaletteEffect> { }
public class CloakPaletteEffect : IPaletteModifier, ITickRender
public class CloakPaletteEffect : IPaletteModifier, ITick
{
float t = 0;
string paletteName = "cloak";
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA
}
}
public void TickRender(WorldRenderer wr, Actor self)
public void Tick(Actor self)
{
t += 0.25f;
if (t >= 256) t = 0;

0
OpenRA.Mods.RA/Effects/Bullet.cs Normal file → Executable file
View File

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects
this.b = a.Trait<IronCurtainable>();
}
public void Tick(World world)
public void Tick( World world )
{
if (a.IsDead() || b.GetDamageModifier(null, null) > 0)
world.AddFrameEndTask(w => w.Remove(this));

0
OpenRA.Mods.RA/Effects/Missile.cs Normal file → Executable file
View File

0
OpenRA.Mods.RA/Effects/NukeLaunch.cs Normal file → Executable file
View File

0
OpenRA.Mods.RA/Effects/RepairIndicator.cs Normal file → Executable file
View File

View File

@@ -23,10 +23,10 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
}
class LightPaletteRotator : ITickRender, IPaletteModifier
class LightPaletteRotator : ITick, IPaletteModifier
{
float t = 0;
public void TickRender(WorldRenderer wr, Actor self)
public void Tick(Actor self)
{
t += .5f;
}

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
{
class NukePaletteEffectInfo : TraitInfo<NukePaletteEffect> { }
public class NukePaletteEffect : IPaletteModifier, ITickRender
public class NukePaletteEffect : IPaletteModifier, ITick
{
const int nukeEffectLength = 20;
int remainingFrames;
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
remainingFrames = nukeEffectLength;
}
public void TickRender(WorldRenderer wr, Actor self)
public void Tick(Actor self)
{
if (remainingFrames > 0)
remainingFrames--;

View File

@@ -54,9 +54,9 @@ namespace OpenRA.Mods.RA.Render
self.Trait<IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
base.TickRender(wr, self);
base.Tick(self);
if (buildComplete)
return;

View File

@@ -9,7 +9,6 @@
#endregion
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
@@ -22,7 +21,7 @@ namespace OpenRA.Mods.RA.Render
public override object Create(ActorInitializer init) { return new RenderBuildingWall(init, this); }
}
class RenderBuildingWall : RenderBuilding, INotifyAddedToWorld, INotifyRemovedFromWorld, ITick
class RenderBuildingWall : RenderBuilding, INotifyAddedToWorld, INotifyRemovedFromWorld
{
readonly RenderBuildingWallInfo info;
int adjacent = 0;
@@ -45,13 +44,10 @@ namespace OpenRA.Mods.RA.Render
DefaultAnimation.PlayFetchIndex(NormalizeSequence(DefaultAnimation, e.DamageState, info.Sequence), () => adjacent);
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
base.TickRender(wr, self);
}
base.Tick(self);
public void Tick(Actor self)
{
if (!dirty)
return;

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render
}
}
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITickRender, INotifyProduction, INotifySold, ISync
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITick, INotifyProduction, INotifySold, ISync
{
Animation roof;
[Sync] bool isOpen;
@@ -62,9 +62,9 @@ namespace OpenRA.Mods.RA.Render
buildComplete = true;
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
base.TickRender(wr, self);
base.Tick(self);
if (isOpen && !self.World.ActorMap.GetUnitsAt(openExit).Any( a => a != self ))
{
isOpen = false;

View File

@@ -9,7 +9,6 @@
#endregion
using OpenRA.Traits;
using OpenRA.Graphics;
namespace OpenRA.Mods.RA.Render
{
@@ -32,7 +31,7 @@ namespace OpenRA.Mods.RA.Render
intendedSprite = disguise.AsSprite;
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
if (disguise.AsSprite != intendedSprite)
{
@@ -41,7 +40,7 @@ namespace OpenRA.Mods.RA.Render
UpdatePalette();
}
base.TickRender(wr, self);
base.Tick(self);
}
}
}

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Render
new Animation(self.World, image);
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
var desiredState = harv.Fullness * (info.ImagesByFullness.Length - 1) / 100;
var desiredImage = info.ImagesByFullness[desiredState];
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Render
if (DefaultAnimation.Name != desiredImage)
DefaultAnimation.ChangeImage(desiredImage, "idle");
base.TickRender(wr, self);
base.Tick(self);
}
public void Harvested(Actor self, ResourceType resource)

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -8,7 +8,6 @@
*/
#endregion
using OpenRA.Graphics;
using OpenRA.Mods.RA.Effects;
using OpenRA.Traits;
@@ -80,9 +79,9 @@ namespace OpenRA.Mods.RA.Render
Attacking(self, target);
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
base.TickRender(wr, self);
base.Tick(self);
if ((State == AnimationState.Moving || dirty) && !move.IsMoving)
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -8,7 +8,6 @@
*/
#endregion
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
@@ -44,13 +43,13 @@ namespace OpenRA.Mods.RA.Render
return base.AllowIdleAnimation(self) && !sc.Panicking;
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick (Actor self)
{
if (wasPanic != sc.Panicking)
dirty = true;
wasPanic = sc.Panicking;
base.TickRender(wr, self);
base.Tick(self);
}
}
}

View File

@@ -9,7 +9,6 @@
#endregion
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
@@ -42,7 +41,7 @@ namespace OpenRA.Mods.RA.Render
public bool ShouldBeOpen()
{
if (self.CenterPosition.Z > 0 || move.IsMoving || cargo.CurrentAdjacentCells == null)
if (self.CenterPosition.Z > 0 || move.IsMoving)
return false;
return cargo.CurrentAdjacentCells.Any(c => self.World.Map.Contains(c)
@@ -71,14 +70,14 @@ namespace OpenRA.Mods.RA.Render
PlayCustomAnimBackwards(self, info.OpenAnim, null);
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
if (ShouldBeOpen())
Open();
else
Close();
base.TickRender(wr, self);
base.Tick(self);
}
}
}

View File

@@ -9,7 +9,6 @@
#endregion
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
@@ -35,13 +34,13 @@ namespace OpenRA.Mods.RA.Render
.Single(a => a.Info.Name == info.Armament);
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
var sequence = (armament.IsReloading ? "empty-" : "") + (attack.IsAttacking ? "aim" : "idle");
if (sequence != DefaultAnimation.CurrentSequence.Name)
DefaultAnimation.ReplaceAnim(sequence);
base.TickRender(wr, self);
base.Tick(self);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Render
public object Create(ActorInitializer init) { return new WithMakeAnimation(init, this); }
}
public class WithMakeAnimation : ITickRender
public class WithMakeAnimation : ITick
{
WithMakeAnimationInfo info;
RenderBuilding building;
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA.Render
buildComplete = init.Contains<SkipMakeAnimsInit>();
}
public void TickRender(WorldRenderer wr, Actor self)
public void Tick(Actor self)
{
if (self.IsDead() || buildComplete)
return;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Render
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.self, this); }
}
class WithMuzzleFlash : INotifyAttack, IRender, ITickRender
class WithMuzzleFlash : INotifyAttack, IRender, ITick
{
Dictionary<Barrel, bool> visible = new Dictionary<Barrel, bool>();
Dictionary<Barrel, AnimationWithOffset> anims = new Dictionary<Barrel, AnimationWithOffset>();
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA.Render
}
}
public void TickRender(WorldRenderer wr, Actor self)
public void Tick(Actor self)
{
foreach (var a in anims.Values)
a.Animation.Tick();

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -9,7 +9,6 @@
#endregion
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Render;
using OpenRA.Traits;
@@ -99,13 +98,13 @@ namespace OpenRA.Mods.RA
return base.AllowIdleAnimation(self) && !tc.IsProne;
}
public override void TickRender(WorldRenderer wr, Actor self)
public override void Tick(Actor self)
{
if (wasProne != tc.IsProne)
dirty = true;
wasProne = tc.IsProne;
base.TickRender(wr, self);
base.Tick(self);
}
}
}

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new WaterPaletteRotation(init.world, this); }
}
class WaterPaletteRotation : ITickRender, IPaletteModifier
class WaterPaletteRotation : ITick, IPaletteModifier
{
float t = 0;
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA
this.info = info;
}
public void TickRender(WorldRenderer wr, Actor self) { t += .25f; }
public void Tick(Actor self) { t += .25f; }
uint[] temp = new uint[7]; /* allocating this on the fly actually hurts our profile */

0
OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs Normal file → Executable file
View File