diff --git a/OpenRA.Game/Traits/SelectionDecorations.cs b/OpenRA.Game/Traits/SelectionDecorations.cs index 87f6178675..58a1db9c0f 100644 --- a/OpenRA.Game/Traits/SelectionDecorations.cs +++ b/OpenRA.Game/Traits/SelectionDecorations.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,18 +15,25 @@ namespace OpenRA.Traits { public class SelectionDecorationsInfo : ITraitInfo { - public object Create(ActorInitializer init) { return new SelectionDecorations(init.self); } + public readonly string Palette = "chrome"; + + public object Create(ActorInitializer init) { return new SelectionDecorations(init.self, this); } } public class SelectionDecorations : IPostRenderSelection { // depends on the order of pips in TraitsInterfaces.cs! - static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue" }; + static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" }; static readonly string[] tagStrings = { "", "tag-fake", "tag-primary" }; + public SelectionDecorationsInfo Info; Actor self; - public SelectionDecorations(Actor self) { this.self = self; } + public SelectionDecorations(Actor self, SelectionDecorationsInfo info) + { + this.self = self; + Info = info; + } public void RenderAfterWorld(WorldRenderer wr) { @@ -51,11 +58,12 @@ namespace OpenRA.Traits if (group == null) return; var pipImages = new Animation("pips"); + var pal = wr.Palette(Info.Palette); pipImages.PlayFetchIndex("groups", () => (int)group); pipImages.Tick(); var pos = wr.Viewport.WorldToViewPx(basePosition) - (0.5f * pipImages.Image.size).ToInt2() + new int2(9, 5); - Game.Renderer.SpriteRenderer.DrawSprite(pipImages.Image, pos, wr.Palette("chrome")); + Game.Renderer.SpriteRenderer.DrawSprite(pipImages.Image, pos, pal); } void DrawPips(WorldRenderer wr, Actor self, int2 basePosition) @@ -73,7 +81,7 @@ namespace OpenRA.Traits var pipSize = pipImages.Image.size.ToInt2(); var pipxyBase = wr.Viewport.WorldToViewPx(basePosition) + new int2(1 - pipSize.X / 2, - (3 + pipSize.Y / 2)); var pipxyOffset = new int2(0, 0); - var pal = wr.Palette("chrome"); + var pal = wr.Palette(Info.Palette); var width = self.Bounds.Value.Width; foreach (var pips in pipSources) @@ -108,7 +116,7 @@ namespace OpenRA.Traits return; var tagImages = new Animation("pips"); - var pal = wr.Palette("chrome"); + var pal = wr.Palette(Info.Palette); var tagxyOffset = new int2(0, 6); var tagBase = wr.Viewport.WorldToViewPx(basePosition); diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 20ff3898b5..203cf1e23a 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -21,7 +21,7 @@ using OpenRA.Primitives; namespace OpenRA.Traits { // depends on the order of pips in WorldRenderer.cs! - public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue }; + public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty }; public enum TagType { None, Fake, Primary }; public enum Stance { Enemy, Neutral, Ally }; diff --git a/OpenRA.Mods.RA/LimitedAmmo.cs b/OpenRA.Mods.RA/LimitedAmmo.cs index 2444163c1e..aad0afcf4f 100644 --- a/OpenRA.Mods.RA/LimitedAmmo.cs +++ b/OpenRA.Mods.RA/LimitedAmmo.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -19,6 +19,8 @@ namespace OpenRA.Mods.RA public readonly int Ammo = 0; [Desc("Defaults to value in Ammo.")] public readonly int PipCount = 0; + public readonly PipType PipType = PipType.Green; + public readonly PipType PipTypeEmpty = PipType.Transparent; [Desc("Time to reload measured in ticks.")] public readonly int ReloadTicks = 25 * 2; @@ -60,7 +62,7 @@ namespace OpenRA.Mods.RA { var pips = Info.PipCount != 0 ? Info.PipCount : Info.Ammo; return Exts.MakeArray(pips, - i => (ammo * pips) / Info.Ammo > i ? PipType.Green : PipType.Transparent); + i => (ammo * pips) / Info.Ammo > i ? Info.PipType : Info.PipTypeEmpty); } } } diff --git a/mods/ts/bits/ammopips.shp b/mods/ts/bits/ammopips.shp new file mode 100644 index 0000000000..93a98a2cb1 Binary files /dev/null and b/mods/ts/bits/ammopips.shp differ diff --git a/mods/ts/bits/pipsra.shp b/mods/ts/bits/pipsra.shp new file mode 100644 index 0000000000..da81c9bf59 Binary files /dev/null and b/mods/ts/bits/pipsra.shp differ diff --git a/mods/ts/rules/aircraft.yaml b/mods/ts/rules/aircraft.yaml index 4c8cea05ce..23925251c2 100644 --- a/mods/ts/rules/aircraft.yaml +++ b/mods/ts/rules/aircraft.yaml @@ -30,6 +30,8 @@ DPOD: LimitedAmmo: Ammo: 5 PipCount: 5 + PipType: Ammo + PipTypeEmpty: AmmoEmpty AutoTarget: RenderSprites: RenderVoxels: @@ -97,6 +99,8 @@ ORCA: LimitedAmmo: Ammo: 5 PipCount: 5 + PipType: Ammo + PipTypeEmpty: AmmoEmpty AutoTarget: RenderSprites: RenderVoxels: @@ -132,6 +136,8 @@ ORCAB: LimitedAmmo: Ammo: 2 PipCount: 2 + PipType: Ammo + PipTypeEmpty: AmmoEmpty AutoTarget: RenderSprites: RenderVoxels: @@ -225,6 +231,8 @@ SCRIN: LimitedAmmo: Ammo: 3 PipCount: 3 + PipType: Ammo + PipTypeEmpty: AmmoEmpty AutoTarget: RenderSprites: RenderVoxels: @@ -260,6 +268,8 @@ APACHE: LimitedAmmo: Ammo: 12 PipCount: 4 + PipType: Ammo + PipTypeEmpty: AmmoEmpty AutoTarget: WithRotor: Offset: 85,0,384 diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 3f81a22b31..e47b5c1a6d 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -1,6 +1,7 @@ ^Building: AppearsOnRadar: SelectionDecorations: + Palette: pips Selectable: Priority: 3 TargetableBuilding: @@ -96,6 +97,7 @@ Gems: 80 Beach: 80 SelectionDecorations: + Palette: pips Selectable: Voice: Infantry TargetableUnit: @@ -167,6 +169,7 @@ Beach: 40 ROT: 5 SelectionDecorations: + Palette: pips Selectable: Voice: Vehicle TargetableUnit: @@ -203,6 +206,7 @@ TargetTypes: Air GroundedTargetTypes: Ground SelectionDecorations: + Palette: pips Selectable: Voice: Heli Helicopter: diff --git a/mods/ts/rules/structures.yaml b/mods/ts/rules/structures.yaml index 5ea2d05bff..135820928e 100644 --- a/mods/ts/rules/structures.yaml +++ b/mods/ts/rules/structures.yaml @@ -141,6 +141,7 @@ GAWEAP: ExitCell: 3,3 Production: Produces: Vehicle + PrimaryBuilding: ProductionBar: WithProductionOverlay@WHITELIGHTS: Sequence: production-lights-white @@ -244,6 +245,7 @@ NAWEAP: ExitCell: 3,3 Production: Produces: Vehicle + PrimaryBuilding: ProductionBar: WithProductionOverlay@LIGHTS: Sequence: production-lights @@ -623,6 +625,7 @@ GAHPAD: SpawnOffset: 0,-256,0 Production: Produces: Air + PrimaryBuilding: BelowUnits: Reservable: RepairsUnits: @@ -655,6 +658,7 @@ NAHPAD: SpawnOffset: 0,-256,0 Production: Produces: Air + PrimaryBuilding: BelowUnits: Reservable: RepairsUnits: diff --git a/mods/ts/rules/world.yaml b/mods/ts/rules/world.yaml index cb3a069b6f..13759eea64 100644 --- a/mods/ts/rules/world.yaml +++ b/mods/ts/rules/world.yaml @@ -17,6 +17,11 @@ World: Filename: cameo.pal AllowModifiers: false ShadowIndex: 242 + PaletteFromFile@pips: + Name: pips + Filename: palette.pal + AllowModifiers: false + ShadowIndex: 4 PaletteFromFile@ra: Name: ra Filename: palette.pal diff --git a/mods/ts/sequences/misc.yaml b/mods/ts/sequences/misc.yaml index 1e38009345..e5d763e0c0 100644 --- a/mods/ts/sequences/misc.yaml +++ b/mods/ts/sequences/misc.yaml @@ -79,13 +79,14 @@ clock: Start: 0 Length: * -# TODO: -# needs palette.pal pips: medic: Start: 6 - tag-primary: + groups: pipsra #TODO: backfall to RA asset Start: 8 + Length: 10 + tag-primary: pipsra #TODO: backfall to RA asset + Start: 2 pip-empty: pips2 Start: 0 pip-green: pips2 @@ -98,8 +99,10 @@ pips: Start: 4 pip-blue: pips2 Start: 5 - pip-ammo: pips2 - Start: 6 + pip-ammo: ammopips + Start: 0 + pip-ammoempty: ammopips + Start: 1 # TODO: pip-empty-building: Start: 0