diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj
index 30a70c20eb..a3fdea3343 100644
--- a/OpenRA.Game/OpenRA.Game.csproj
+++ b/OpenRA.Game/OpenRA.Game.csproj
@@ -218,7 +218,6 @@
-
diff --git a/OpenRA.Game/Widgets/SpriteSequenceWidget.cs b/OpenRA.Game/Widgets/SpriteSequenceWidget.cs
deleted file mode 100644
index 7990c69d3f..0000000000
--- a/OpenRA.Game/Widgets/SpriteSequenceWidget.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-#region Copyright & License Information
-/*
- * Copyright 2007-2015 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,
- * see COPYING.
- */
-#endregion
-
-using System;
-using OpenRA.Graphics;
-
-namespace OpenRA.Widgets
-{
- public class SpriteSequenceWidget : SpriteWidget
- {
- public string Unit = null;
- public string Sequence = null;
- public int Frame = 0;
- public int Facing = 0;
-
- public Func GetAnimation;
- public Func GetFacing;
-
- [ObjectCreator.UseCtor]
- public SpriteSequenceWidget(WorldRenderer worldRenderer)
- : base(worldRenderer)
- {
- GetAnimation = () => null;
- }
-
- public override void Initialize(WidgetArgs args)
- {
- base.Initialize(args);
-
- if (Unit != null && Sequence != null)
- {
- var anim = new Animation(WorldRenderer.World, Unit, () => Facing);
- anim.PlayFetchIndex(Sequence, () => Frame);
- GetAnimation = () => anim;
- }
-
- GetSprite = () =>
- {
- var anim = GetAnimation();
- return anim != null ? anim.Image : null;
- };
- }
-
- protected SpriteSequenceWidget(SpriteSequenceWidget other)
- : base(other)
- {
- Unit = other.Unit;
- Sequence = other.Sequence;
- Frame = other.Frame;
- Facing = other.Facing;
-
- GetAnimation = other.GetAnimation;
- GetFacing = other.GetFacing;
- }
-
- public override Widget Clone() { return new SpriteSequenceWidget(this); }
- }
-}
diff --git a/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs
index 2c4f119c14..a44ee3e553 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs
@@ -10,6 +10,7 @@
using System;
using OpenRA.Graphics;
+using OpenRA.Primitives;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
@@ -17,16 +18,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class ColorPickerLogic
{
[ObjectCreator.UseCtor]
- public ColorPickerLogic(Widget widget, HSLColor initialColor, Action onChange, WorldRenderer worldRenderer)
+ public ColorPickerLogic(Widget widget, World world, HSLColor initialColor, Action onChange, WorldRenderer worldRenderer)
{
- var ticker = widget.GetOrNull("ANIMATE_PREVIEW");
- if (ticker != null)
- {
- var preview = widget.Get("PREVIEW");
- var anim = preview.GetAnimation();
- anim.PlayRepeating(anim.CurrentSequence.Name);
- ticker.OnTick = anim.Tick;
- }
+ string actorType;
+ if (!ChromeMetrics.TryGet("ColorPickerActorType", out actorType))
+ actorType = "mcv";
+
+ var preview = widget.GetOrNull("PREVIEW");
+ var actor = world.Map.Rules.Actors[actorType];
+ preview.SetPreview(actor, world.WorldActor.Owner, new TypeDictionary());
var hueSlider = widget.Get("HUE");
var mixer = widget.Get("MIXER");
diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs
index 72f92d53bd..39ddcde156 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs
@@ -32,6 +32,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly OrderManager orderManager;
readonly bool skirmishMode;
readonly Ruleset modRules;
+ readonly World shellmapWorld;
enum PanelType { Players, Options, Kick, ForceStart }
PanelType panel = PanelType.Players;
@@ -108,6 +109,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.onExit = onExit;
this.skirmishMode = skirmishMode;
this.modRules = modRules;
+ shellmapWorld = worldRenderer.World;
orderManager.AddChatLine += AddChatLine;
Game.LobbyInfoChanged += UpdateCurrentMap;
@@ -699,7 +701,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
else
LobbyUtils.SetupEditableNameWidget(template, slot, client, orderManager);
- LobbyUtils.SetupEditableColorWidget(template, slot, client, orderManager, colorPreview);
+ LobbyUtils.SetupEditableColorWidget(template, slot, client, orderManager, shellmapWorld, colorPreview);
LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, countries);
LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, Map);
LobbyUtils.SetupEditableSpawnWidget(template, slot, client, orderManager, Map);
diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs
index 4b3dd4bf5a..446bcb014c 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client,
- OrderManager orderManager, ColorPreviewManagerWidget preview)
+ OrderManager orderManager, World world, ColorPreviewManagerWidget preview)
{
Action onExit = () =>
{
@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Action onChange = c => preview.Color = c;
- var colorChooser = Game.LoadWidget(orderManager.World, "COLOR_CHOOSER", null, new WidgetArgs()
+ var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs()
{
{ "onChange", onChange },
{ "initialColor", client.Color }
@@ -377,11 +377,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
}
- public static void SetupEditableColorWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, ColorPreviewManagerWidget colorPreview)
+ public static void SetupEditableColorWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, World world, ColorPreviewManagerWidget colorPreview)
{
var color = parent.Get("COLOR");
color.IsDisabled = () => (s != null && s.LockColor) || orderManager.LocalClient.IsReady;
- color.OnMouseDown = _ => ShowColorDropDown(color, c, orderManager, colorPreview);
+ color.OnMouseDown = _ => ShowColorDropDown(color, c, orderManager, world, colorPreview);
SetupColorWidget(color, s, c);
}
diff --git a/mods/cnc/chrome/color-picker.yaml b/mods/cnc/chrome/color-picker.yaml
index a659b56bc7..8e03d21587 100644
--- a/mods/cnc/chrome/color-picker.yaml
+++ b/mods/cnc/chrome/color-picker.yaml
@@ -30,14 +30,12 @@ Background@COLOR_CHOOSER:
Y: 2
Width: 144
Height: 72
- SpriteSequence@PREVIEW:
+ ActorPreview@PREVIEW:
X: 153
Y: 1
Width: 80
Height: 73
- Palette: colorpicker
- Unit: fact
- Sequence: idle
+ Animate: true
Button@RANDOM_BUTTON:
Key: tab
X: 158
diff --git a/mods/cnc/metrics.yaml b/mods/cnc/metrics.yaml
index 13c4b0da05..81e18610c7 100644
--- a/mods/cnc/metrics.yaml
+++ b/mods/cnc/metrics.yaml
@@ -20,6 +20,7 @@ Metrics:
TextContrast: false
TextContrastColor: 0,0,0
ColorPickerRemapIndices: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
+ ColorPickerActorType: ^fact.colorpicker
SpawnFont: TinyBold
SpawnColor: 255,255,255
SpawnContrastColor: 0,0,0
diff --git a/mods/cnc/rules/misc.yaml b/mods/cnc/rules/misc.yaml
index 6982a8be0d..384137e931 100644
--- a/mods/cnc/rules/misc.yaml
+++ b/mods/cnc/rules/misc.yaml
@@ -42,6 +42,12 @@ waypoint:
RenderEditorOnly:
BodyOrientation:
+^fact.colorpicker:
+ Inherits: FACT
+ RenderBuilding:
+ Image: fact
+ Palette: colorpicker
+
CAMERA:
Immobile:
OccupiesSpace: false
diff --git a/mods/d2k/chrome/color-picker.yaml b/mods/d2k/chrome/color-picker.yaml
index d2d4a2a792..5427cd376f 100644
--- a/mods/d2k/chrome/color-picker.yaml
+++ b/mods/d2k/chrome/color-picker.yaml
@@ -29,15 +29,11 @@ Background@COLOR_CHOOSER:
Y: 2
Width: 144
Height: 72
- SpriteSequence@FACT:
+ ActorPreview@PREVIEW:
X: 153
Y: 1
Width: 80
Height: 73
- Palette: colorpicker
- Unit: carryall
- Sequence: idle
- Facing: 104
Button@RANDOM_BUTTON:
Key: tab
X: 158
diff --git a/mods/d2k/metrics.yaml b/mods/d2k/metrics.yaml
index 0d1147ea49..b0cd208e75 100644
--- a/mods/d2k/metrics.yaml
+++ b/mods/d2k/metrics.yaml
@@ -20,6 +20,7 @@ Metrics:
TextContrast: false
TextContrastColor: 0,0,0
ColorPickerRemapIndices: 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240
+ ColorPickerActorType: ^carryall.colorpicker
SpawnFont: TinyBold
SpawnColor: 255,255,255
SpawnContrastColor: 0,0,0
diff --git a/mods/d2k/rules/misc.yaml b/mods/d2k/rules/misc.yaml
index 57084a2a1c..d878294ffa 100644
--- a/mods/d2k/rules/misc.yaml
+++ b/mods/d2k/rules/misc.yaml
@@ -140,6 +140,14 @@ waypoint:
RenderEditorOnly:
BodyOrientation:
+^carryall.colorpicker:
+ Inherits: ^CARRYALL
+ RenderUnit:
+ Image: carryall
+ Palette: colorpicker
+ Helicopter:
+ InitialFacing: 104
+
CAMERA:
Immobile:
OccupiesSpace: false
diff --git a/mods/ra/chrome/color-picker.yaml b/mods/ra/chrome/color-picker.yaml
index e5b790203c..5427cd376f 100644
--- a/mods/ra/chrome/color-picker.yaml
+++ b/mods/ra/chrome/color-picker.yaml
@@ -29,14 +29,11 @@ Background@COLOR_CHOOSER:
Y: 2
Width: 144
Height: 72
- SpriteSequence@FACT:
+ ActorPreview@PREVIEW:
X: 153
Y: 1
Width: 80
Height: 73
- Palette: colorpicker
- Unit: fact
- Sequence: idle
Button@RANDOM_BUTTON:
Key: tab
X: 158
diff --git a/mods/ra/metrics.yaml b/mods/ra/metrics.yaml
index ce65490323..7e05014dc7 100644
--- a/mods/ra/metrics.yaml
+++ b/mods/ra/metrics.yaml
@@ -20,6 +20,7 @@ Metrics:
TextContrast: false
TextContrastColor: 0,0,0
ColorPickerRemapIndices: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
+ ColorPickerActorType: ^fact.colorpicker
SpawnFont: TinyBold
SpawnColor: 255,255,255
SpawnContrastColor: 0,0,0
diff --git a/mods/ra/rules/misc.yaml b/mods/ra/rules/misc.yaml
index 5cdfc30393..b9bf3cbf1e 100644
--- a/mods/ra/rules/misc.yaml
+++ b/mods/ra/rules/misc.yaml
@@ -368,6 +368,12 @@ waypoint:
RenderEditorOnly:
BodyOrientation:
+^fact.colorpicker:
+ Inherits: FACT
+ RenderBuilding:
+ Image: fact
+ Palette: colorpicker
+
CTFLAG:
Inherits: ^TechBuilding
Building:
diff --git a/mods/ts/chrome/color-picker.yaml b/mods/ts/chrome/color-picker.yaml
index 61ddd97e38..f027657764 100644
--- a/mods/ts/chrome/color-picker.yaml
+++ b/mods/ts/chrome/color-picker.yaml
@@ -29,14 +29,11 @@ Background@COLOR_CHOOSER:
Y: 2
Width: 144
Height: 72
- SpriteSequence@PREVIEW:
- X: 153
- Y: 1-40
+ ActorPreview@PREVIEW:
+ X: 163
Width: 80
- Height: 73
- Palette: colorpicker
- Unit: gacnst
- Sequence: make
+ Height: 74
+ Animate: true
Button@RANDOM_BUTTON:
Key: tab
X: 158
diff --git a/mods/ts/metrics.yaml b/mods/ts/metrics.yaml
index b6222a2053..ee97b3c6f5 100644
--- a/mods/ts/metrics.yaml
+++ b/mods/ts/metrics.yaml
@@ -20,6 +20,7 @@ Metrics:
TextContrast: false
TextContrastColor: 0,0,0
ColorPickerRemapIndices: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
+ ColorPickerActorType: ^mmch.colorpicker
SpawnFont: TinyBold
SpawnColor: 255,255,255
SpawnContrastColor: 0,0,0
diff --git a/mods/ts/rules/misc.yaml b/mods/ts/rules/misc.yaml
index 92f58e10b5..5c43c50251 100644
--- a/mods/ts/rules/misc.yaml
+++ b/mods/ts/rules/misc.yaml
@@ -10,6 +10,20 @@ waypoint:
RenderEditorOnly:
BodyOrientation:
+^mmch.colorpicker:
+ Inherits: MMCH
+ Mobile:
+ InitialFacing: 160
+ Turreted:
+ InitialFacing: 160
+ RenderInfantry:
+ Image: mmch
+ StandAnimations: run
+ Palette: colorpicker
+ RenderVoxels:
+ Image: mmch
+ Palette: colorpicker
+
CAMERA:
Immobile:
OccupiesSpace: false
diff --git a/mods/ts/rules/world.yaml b/mods/ts/rules/world.yaml
index 9675140a65..6cadda1463 100644
--- a/mods/ts/rules/world.yaml
+++ b/mods/ts/rules/world.yaml
@@ -37,6 +37,7 @@ World:
Name: colorpicker
Filename: unittem.pal
AllowModifiers: false
+ ShadowIndex: 1
PaletteFromRGBA@shadow:
Name: shadow
R: 0