Iron Curtain and Powerdown palette effects

This commit is contained in:
Paul Chote
2010-01-08 00:45:41 +13:00
parent 4cd817bcac
commit 0e05f4db5c
4 changed files with 13 additions and 20 deletions

View File

@@ -5,8 +5,8 @@ namespace OpenRa.Game.Graphics
{ {
public enum PaletteType public enum PaletteType
{ {
Gold, Blue, Red, Orange, Teal, Salmon, Green, Gray, Gold, Blue, Red, Orange, Teal, Salmon, Green, Gray,
Shadow, Invuln, Chrome, Shroud, Highlight, Shadow, Invuln, Disabled, Highlight, Shroud, Chrome,
}; };
class HardwarePalette : Sheet class HardwarePalette : Sheet
@@ -23,11 +23,12 @@ namespace OpenRa.Game.Graphics
foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" }) foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" })
AddPalette(new Palette(pal, new PlayerColorRemap(FileSystem.Open(remap + ".rem")))); AddPalette(new Palette(pal, new PlayerColorRemap(FileSystem.Open(remap + ".rem"))));
AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(140, 0, 0, 0)))); AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(140, 0, 0, 0)))); // Shadow
AddPalette(pal); // iron curtain. todo: remap! AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(128, 128, 0, 0)))); // Invulnerable (Iron Curtain)
AddPalette(pal); // chrome (it's like gold, but we're not going to hax it in palettemods) AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(180, 0, 0, 0)))); // Disabled / Low power
AddPalette(new Palette(pal, new ShroudPaletteRemap())); AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(128, 255, 255, 255)))); // Highlight
AddPalette(new Palette(pal, new SingleColorRemap(Color.FromArgb(128, 255, 255, 255)))); AddPalette(new Palette(pal, new ShroudPaletteRemap())); // Shroud
AddPalette(pal); // Chrome (it's like gold, but we're not going to hax it in palettemods)
} }
int AddPalette(Palette p) int AddPalette(Palette p)

View File

@@ -84,6 +84,7 @@
<Compile Include="Effects\DelayedAction.cs" /> <Compile Include="Effects\DelayedAction.cs" />
<Compile Include="Effects\FlashTarget.cs" /> <Compile Include="Effects\FlashTarget.cs" />
<Compile Include="Effects\MoveFlash.cs" /> <Compile Include="Effects\MoveFlash.cs" />
<Compile Include="Effects\PowerDownIndicator.cs" />
<Compile Include="Effects\RepairIndicator.cs" /> <Compile Include="Effects\RepairIndicator.cs" />
<Compile Include="Effects\Smoke.cs" /> <Compile Include="Effects\Smoke.cs" />
<Compile Include="Effects\TeslaZap.cs" /> <Compile Include="Effects\TeslaZap.cs" />

View File

@@ -15,6 +15,7 @@ namespace OpenRa.Game.Traits
public readonly BuildingInfo unitInfo; public readonly BuildingInfo unitInfo;
bool isRepairing = false; bool isRepairing = false;
bool isPoweredDown = false; bool isPoweredDown = false;
public bool IsPoweredDown { get { return isPoweredDown; } }
public Building(Actor self) public Building(Actor self)
{ {
@@ -50,19 +51,8 @@ namespace OpenRa.Game.Traits
List<Renderable> nrs = new List<Renderable>(rs); List<Renderable> nrs = new List<Renderable>(rs);
foreach(var r in rs) foreach(var r in rs)
{ {
// Need 2 shadows to make it dark enough nrs.Add(r.WithPalette(PaletteType.Disabled));
nrs.Add(r.WithPalette(PaletteType.Shadow));
nrs.Add(r.WithPalette(PaletteType.Shadow));
} }
if (isPoweredDown)
{
iconAnim = new Animation("powerdown");
iconAnim.PlayRepeating("disabled");
nrs.Add(new Renderable(iconAnim.Image, self.CenterLocation - 0.5f*iconAnim.Image.size, PaletteType.Chrome));
}
return nrs; return nrs;
} }
@@ -93,6 +83,7 @@ namespace OpenRa.Game.Traits
if (order.OrderString == "PowerDown") if (order.OrderString == "PowerDown")
{ {
isPoweredDown = !isPoweredDown; isPoweredDown = !isPoweredDown;
if (isPoweredDown) Game.world.AddFrameEndTask(w => w.Add(new PowerDownIndicator(self)));
Sound.Play((isPoweredDown) ? "bleep12.aud" : "bleep11.aud"); Sound.Play((isPoweredDown) ? "bleep12.aud" : "bleep11.aud");
} }
} }

View File

@@ -49,7 +49,7 @@ namespace OpenRa.Game.Traits
List<Renderable> nrs = new List<Renderable>(rs); List<Renderable> nrs = new List<Renderable>(rs);
foreach(var r in rs) foreach(var r in rs)
{ {
nrs.Add(r.WithPalette(PaletteType.Shadow)); nrs.Add(r.WithPalette(PaletteType.Invuln));
} }
return nrs; return nrs;
} }