read support power icons from sequences

so that d2k can grab them from DATA.R8
This commit is contained in:
Matthias Mailänder
2013-08-17 11:37:32 +02:00
parent 376a6c7a5d
commit efb55d4cb9
16 changed files with 88 additions and 219 deletions

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Widgets
readonly WorldRenderer worldRenderer; readonly WorldRenderer worldRenderer;
readonly SupportPowerManager spm; readonly SupportPowerManager spm;
Dictionary<string, Sprite> iconSprites; Animation icon;
Animation clock; Animation clock;
Dictionary<Rectangle, SupportPowerIcon> icons = new Dictionary<Rectangle, SupportPowerIcon>(); Dictionary<Rectangle, SupportPowerIcon> icons = new Dictionary<Rectangle, SupportPowerIcon>();
@@ -52,12 +52,7 @@ namespace OpenRA.Mods.Cnc.Widgets
tooltipContainer = Lazy.New(() => tooltipContainer = Lazy.New(() =>
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer)); Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
iconSprites = Rules.Info.Values.SelectMany(u => u.Traits.WithInterface<SupportPowerInfo>()) icon = new Animation("icon");
.Select(u => u.Image).Distinct()
.ToDictionary(
u => u,
u => Game.modData.SpriteLoader.LoadAllSprites(u)[0]);
clock = new Animation("clock"); clock = new Animation("clock");
} }
@@ -78,11 +73,12 @@ namespace OpenRA.Mods.Cnc.Widgets
foreach (var p in powers) foreach (var p in powers)
{ {
var rect = new Rectangle(rb.X + 1, rb.Y + i * (48 + Spacing) + 1, 64, 48); var rect = new Rectangle(rb.X + 1, rb.Y + i * (48 + Spacing) + 1, 64, 48);
icon.Play(p.Info.Icon);
var power = new SupportPowerIcon() var power = new SupportPowerIcon()
{ {
Power = p, Power = p,
Pos = new float2(rect.Location), Pos = new float2(rect.Location),
Sprite = iconSprites[p.Info.Image] Sprite = icon.Image
}; };
icons.Add(rect, power); icons.Add(rect, power);

View File

@@ -69,104 +69,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
new string[] { "--r8", pathToDataR8, pathToPalette, "130", "145", Path.Combine(pathToSHPs, "rockcrater2") }, new string[] { "--r8", pathToDataR8, pathToPalette, "130", "145", Path.Combine(pathToSHPs, "rockcrater2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "146", "161", Path.Combine(pathToSHPs, "sandcrater1") }, new string[] { "--r8", pathToDataR8, pathToPalette, "146", "161", Path.Combine(pathToSHPs, "sandcrater1") },
new string[] { "--r8", pathToDataR8, pathToPalette, "162", "177", Path.Combine(pathToSHPs, "sandcrater2") }, new string[] { "--r8", pathToDataR8, pathToPalette, "162", "177", Path.Combine(pathToSHPs, "sandcrater2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4011", "4011", Path.Combine(pathToSHPs, "rifleicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4012", "4012", Path.Combine(pathToSHPs, "bazookaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4013", "4013", Path.Combine(pathToSHPs, "engineericon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4014", "4014", Path.Combine(pathToSHPs, "thumpericon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4015", "4015", Path.Combine(pathToSHPs, "sardaukaricon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4016", "4016", Path.Combine(pathToSHPs, "trikeicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4017", "4017", Path.Combine(pathToSHPs, "raidericon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4018", "4018", Path.Combine(pathToSHPs, "quadicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4019", "4019", Path.Combine(pathToSHPs, "harvestericon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4020", "4020", Path.Combine(pathToSHPs, "combataicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4021", "4021", Path.Combine(pathToSHPs, "combathicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4022", "4022", Path.Combine(pathToSHPs, "combatoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4023", "4023", Path.Combine(pathToSHPs, "mcvicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4024", "4024", Path.Combine(pathToSHPs, "missiletankicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4025", "4025", Path.Combine(pathToSHPs, "deviatortankicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4026", "4026", Path.Combine(pathToSHPs, "siegetankicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4027", "4027", Path.Combine(pathToSHPs, "sonictankicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4028", "4028", Path.Combine(pathToSHPs, "devasticon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4029", "4029", Path.Combine(pathToSHPs, "carryallicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4030", "4030", Path.Combine(pathToSHPs, "carryallicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4031", "4031", Path.Combine(pathToSHPs, "orniicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4032", "4032", Path.Combine(pathToSHPs, "fremenicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4033", "4033", Path.Combine(pathToSHPs, "fremenicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4034", "4034", Path.Combine(pathToSHPs, "saboteuricon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4035", "4035", Path.Combine(pathToSHPs, "deathhandicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4036", "4036", Path.Combine(pathToSHPs, "rifleicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4037", "4037", Path.Combine(pathToSHPs, "bazookaicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4038", "4038", Path.Combine(pathToSHPs, "engineericon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4039", "4039", Path.Combine(pathToSHPs, "thumpericon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4040", "4040", Path.Combine(pathToSHPs, "sardaukaricon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4041", "4041", Path.Combine(pathToSHPs, "trikeicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4042", "4042", Path.Combine(pathToSHPs, "raidericon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4043", "4043", Path.Combine(pathToSHPs, "quadicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4044", "4044", Path.Combine(pathToSHPs, "harvestericon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4045", "4045", Path.Combine(pathToSHPs, "combataicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4046", "4046", Path.Combine(pathToSHPs, "conyardaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4047", "4047", Path.Combine(pathToSHPs, "conyardhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4048", "4048", Path.Combine(pathToSHPs, "conyardoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4049", "4049", Path.Combine(pathToSHPs, "conyardaicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4050", "4050", Path.Combine(pathToSHPs, "4plateaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4051", "4051", Path.Combine(pathToSHPs, "4platehicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4052", "4052", Path.Combine(pathToSHPs, "4plateoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4053", "4053", Path.Combine(pathToSHPs, "6plateaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4054", "4054", Path.Combine(pathToSHPs, "6platehicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4055", "4055", Path.Combine(pathToSHPs, "6plateoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4056", "4056", Path.Combine(pathToSHPs, "pwraicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4057", "4057", Path.Combine(pathToSHPs, "pwrhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4058", "4058", Path.Combine(pathToSHPs, "pwroicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4059", "4059", Path.Combine(pathToSHPs, "barraicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4060", "4060", Path.Combine(pathToSHPs, "barrhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4061", "4061", Path.Combine(pathToSHPs, "barroicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4062", "4062", Path.Combine(pathToSHPs, "orniicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4063", "4063", Path.Combine(pathToSHPs, "wallaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4064", "4064", Path.Combine(pathToSHPs, "wallhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4065", "4065", Path.Combine(pathToSHPs, "walloicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4066", "4066", Path.Combine(pathToSHPs, "refaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4067", "4067", Path.Combine(pathToSHPs, "refhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4068", "4068", Path.Combine(pathToSHPs, "refoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4069", "4069", Path.Combine(pathToSHPs, "guntoweraicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4070", "4070", Path.Combine(pathToSHPs, "guntowerhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4071", "4071", Path.Combine(pathToSHPs, "guntoweroicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4072", "4072", Path.Combine(pathToSHPs, "radaraicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4073", "4073", Path.Combine(pathToSHPs, "radarhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4074", "4074", Path.Combine(pathToSHPs, "radaroicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4075", "4075", Path.Combine(pathToSHPs, "rockettoweraicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4076", "4076", Path.Combine(pathToSHPs, "rockettowerhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4077", "4077", Path.Combine(pathToSHPs, "rockettoweroicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4078", "4078", Path.Combine(pathToSHPs, "hightechaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4079", "4079", Path.Combine(pathToSHPs, "hightechhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4080", "4080", Path.Combine(pathToSHPs, "hightechoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4081", "4081", Path.Combine(pathToSHPs, "lightaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4082", "4082", Path.Combine(pathToSHPs, "lighthicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4083", "4083", Path.Combine(pathToSHPs, "lightoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4084", "4084", Path.Combine(pathToSHPs, "siloaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4085", "4085", Path.Combine(pathToSHPs, "silohicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4086", "4086", Path.Combine(pathToSHPs, "silooicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4087", "4087", Path.Combine(pathToSHPs, "heavyaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4088", "4088", Path.Combine(pathToSHPs, "heavyhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4089", "4089", Path.Combine(pathToSHPs, "heavyoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4090", "4090", Path.Combine(pathToSHPs, "orniicon3") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4091", "4091", Path.Combine(pathToSHPs, "heavyhicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4092", "4092", Path.Combine(pathToSHPs, "starportaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4093", "4093", Path.Combine(pathToSHPs, "starporthicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4094", "4094", Path.Combine(pathToSHPs, "starportoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4095", "4095", Path.Combine(pathToSHPs, "orniicon4") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4096", "4096", Path.Combine(pathToSHPs, "repairaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4097", "4097", Path.Combine(pathToSHPs, "repairhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4098", "4098", Path.Combine(pathToSHPs, "repairoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4099", "4099", Path.Combine(pathToSHPs, "researchaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4100", "4100", Path.Combine(pathToSHPs, "researchhicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4101", "4101", Path.Combine(pathToSHPs, "researchoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4102", "4102", Path.Combine(pathToSHPs, "palaceaicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4103", "4103", Path.Combine(pathToSHPs, "palacehicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4104", "4104", Path.Combine(pathToSHPs, "palaceoicon") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4105", "4105", Path.Combine(pathToSHPs, "orniicon5") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4106", "4106", Path.Combine(pathToSHPs, "radaraicon2") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4107", "4107", Path.Combine(pathToSHPs, "radaraicon3") },
new string[] { "--r8", pathToDataR8, pathToPalette, "4108", "4108", Path.Combine(pathToSHPs, "conyardaicon3") },
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBASE.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "BASE"), "--tileset" }, new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBASE.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "BASE"), "--tileset" },
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBASE.R8"), pathToPalette, "748", "749", Path.Combine(pathToSHPs, "spice0") }, new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBASE.R8"), pathToPalette, "748", "749", Path.Combine(pathToSHPs, "spice0") },
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBAT.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "BAT"), "--tileset" }, new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBAT.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "BAT"), "--tileset" },
@@ -183,83 +86,6 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
new string[] { "--shp", Path.Combine(pathToSHPs, "rockcrater2.png"), "32" }, new string[] { "--shp", Path.Combine(pathToSHPs, "rockcrater2.png"), "32" },
new string[] { "--shp", Path.Combine(pathToSHPs, "sandcrater1.png"), "32" }, new string[] { "--shp", Path.Combine(pathToSHPs, "sandcrater1.png"), "32" },
new string[] { "--shp", Path.Combine(pathToSHPs, "sandcrater2.png"), "32" }, new string[] { "--shp", Path.Combine(pathToSHPs, "sandcrater2.png"), "32" },
new string[] { "--shp", Path.Combine(pathToSHPs, "rifleicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "bazookaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "engineericon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "thumpericon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "sardaukaricon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "trikeicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "raidericon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "quadicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "harvestericon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "combataicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "combathicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "combatoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "mcvicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "missiletankicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "deviatortankicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "siegetankicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "sonictankicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "devasticon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "carryallicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "orniicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "fremenicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "saboteuricon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "deathhandicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "conyardaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "conyardhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "conyardoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "4plateaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "4platehicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "4plateoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "6plateaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "6platehicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "6plateoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "pwraicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "pwrhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "pwroicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "barraicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "barrhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "barroicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "wallaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "wallhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "walloicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "refaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "refhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "refoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "guntoweraicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "guntowerhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "guntoweroicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "radaraicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "radarhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "radaroicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "rockettoweraicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "rockettowerhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "rockettoweroicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "hightechaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "hightechhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "hightechoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "lightaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "lighthicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "lightoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "siloaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "silohicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "silooicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "heavyaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "heavyhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "heavyoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "starportaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "starporthicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "starportoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "repairaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "repairhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "repairoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "researchaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "researchhicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "researchoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "palaceaicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "palacehicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "palaceoicon.png"), "60" },
new string[] { "--shp", Path.Combine(pathToSHPs, "spice0.png"), "32" }, new string[] { "--shp", Path.Combine(pathToSHPs, "spice0.png"), "32" },
}; };

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
public abstract class SupportPowerInfo : ITraitInfo public abstract class SupportPowerInfo : ITraitInfo
{ {
public readonly int ChargeTime = 0; public readonly int ChargeTime = 0;
public readonly string Image = null; public readonly string Icon = null;
public readonly string Description = ""; public readonly string Description = "";
public readonly string LongDesc = ""; public readonly string LongDesc = "";
public readonly bool AllowMultiple = false; public readonly bool AllowMultiple = false;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Widgets
public class ObserverSupportPowerIconsWidget : Widget public class ObserverSupportPowerIconsWidget : Widget
{ {
public Func<Player> GetPlayer; public Func<Player> GetPlayer;
Dictionary<string, Sprite> iconSprites; Animation icon;
World world; World world;
WorldRenderer worldRenderer; WorldRenderer worldRenderer;
Dictionary<string, Animation> clocks; Dictionary<string, Animation> clocks;
@@ -29,21 +29,18 @@ namespace OpenRA.Mods.RA.Widgets
public ObserverSupportPowerIconsWidget(World world, WorldRenderer worldRenderer) public ObserverSupportPowerIconsWidget(World world, WorldRenderer worldRenderer)
: base() : base()
{ {
iconSprites = Rules.Info.Values.SelectMany(u => u.Traits.WithInterface<SupportPowerInfo>())
.Select(u => u.Image).Distinct()
.ToDictionary(
u => u,
u => Game.modData.SpriteLoader.LoadAllSprites(u)[0]);
this.world = world; this.world = world;
this.worldRenderer = worldRenderer; this.worldRenderer = worldRenderer;
clocks = new Dictionary<string, Animation>(); clocks = new Dictionary<string, Animation>();
icon = new Animation("icon");
} }
protected ObserverSupportPowerIconsWidget(ObserverSupportPowerIconsWidget other) protected ObserverSupportPowerIconsWidget(ObserverSupportPowerIconsWidget other)
: base(other) : base(other)
{ {
GetPlayer = other.GetPlayer; GetPlayer = other.GetPlayer;
iconSprites = other.iconSprites; icon = other.icon;
world = other.world; world = other.world;
worldRenderer = other.worldRenderer; worldRenderer = other.worldRenderer;
clocks = other.clocks; clocks = other.clocks;
@@ -68,12 +65,12 @@ namespace OpenRA.Mods.RA.Widgets
foreach (var power in powers) foreach (var power in powers)
{ {
var item = power.a.Value; var item = power.a.Value;
if (item == null || item.Info == null || item.Info.Image == null) if (item == null || item.Info == null || item.Info.Icon == null)
continue; continue;
var sprite = iconSprites[item.Info.Image]; icon.Play(item.Info.Icon);
var size = sprite.size / new float2(2, 2); var size = icon.Image.size / new float2(2, 2);
var location = new float2(RenderBounds.Location) + new float2(power.i * (int)size.Length, 0); var location = new float2(RenderBounds.Location) + new float2(power.i * (int)size.Length, 0);
WidgetUtils.DrawSHP(sprite, location, worldRenderer, size); WidgetUtils.DrawSHP(icon.Image, location, worldRenderer, size);
var clock = clocks[power.a.Key]; var clock = clocks[power.a.Key];
clock.PlayFetchIndex("idle", clock.PlayFetchIndex("idle",

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Widgets
public string ReadyText = ""; public string ReadyText = "";
public string HoldText = ""; public string HoldText = "";
Dictionary<string, Sprite> spsprites; Animation icon;
Animation clock; Animation clock;
readonly List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle,Action<MouseInput>>>(); readonly List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle,Action<MouseInput>>>();
@@ -41,12 +41,7 @@ namespace OpenRA.Mods.RA.Widgets
{ {
base.Initialize(args); base.Initialize(args);
spsprites = Rules.Info.Values.SelectMany( u => u.Traits.WithInterface<SupportPowerInfo>() ) icon = new Animation("icon");
.Select(u => u.Image).Distinct()
.ToDictionary(
u => u,
u => Game.modData.SpriteLoader.LoadAllSprites(u)[0]);
clock = new Animation("clock"); clock = new Animation("clock");
} }
@@ -88,7 +83,7 @@ namespace OpenRA.Mods.RA.Widgets
WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-middle"), new float2(rectBounds.X, rectBounds.Y + i * 51)); WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-middle"), new float2(rectBounds.X, rectBounds.Y + i * 51));
WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-bottom"), new float2(rectBounds.X, rectBounds.Y + numPowers * 51)); WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-bottom"), new float2(rectBounds.X, rectBounds.Y + numPowers * 51));
// Hack Hack Hack // HACK: Hack Hack Hack
rectBounds.Width = 69; rectBounds.Width = 69;
rectBounds.Height = 10 + numPowers * 51 + 21; rectBounds.Height = 10 + numPowers * 51 + 21;
@@ -96,7 +91,7 @@ namespace OpenRA.Mods.RA.Widgets
foreach (var kv in powers) foreach (var kv in powers)
{ {
var sp = kv.Value; var sp = kv.Value;
var image = spsprites[sp.Info.Image]; icon.Play(sp.Info.Icon);
var drawPos = new float2(rectBounds.X + 5, y); var drawPos = new float2(rectBounds.X + 5, y);
var rect = new Rectangle(rectBounds.X + 5, y, 64, 48); var rect = new Rectangle(rectBounds.X + 5, y, 64, 48);
@@ -142,7 +137,7 @@ namespace OpenRA.Mods.RA.Widgets
} }
} }
WidgetUtils.DrawSHP(image, drawPos, worldRenderer); WidgetUtils.DrawSHP(icon.Image, drawPos, worldRenderer);
clock.PlayFetchIndex("idle", clock.PlayFetchIndex("idle",
() => sp.TotalTime == 0 ? clock.CurrentSequence.Length - 1 : (sp.TotalTime - sp.RemainingTime) () => sp.TotalTime == 0 ? clock.CurrentSequence.Length - 1 : (sp.TotalTime - sp.RemainingTime)

View File

@@ -373,7 +373,7 @@ HQ:
DetectCloaked: DetectCloaked:
Range: 8 Range: 8
AirstrikePower: AirstrikePower:
Image: bombicnh Icon: airstrike
ChargeTime: 180 ChargeTime: 180
Description: Air Strike Description: Air Strike
LongDesc: Deploy an aerial napalm strike.\nBurns buildings and infantry along a line. LongDesc: Deploy an aerial napalm strike.\nBurns buildings and infantry along a line.
@@ -434,7 +434,7 @@ EYE:
DetectCloaked: DetectCloaked:
Range: 8 Range: 8
IonCannonPower: IonCannonPower:
Image: ionicnh Icon: ioncannon
ChargeTime: 180 ChargeTime: 180
Description: Ion Cannon Description: Ion Cannon
LongDesc: Initiate an Ion Cannon strike.\nApplies instant damage to a small area. LongDesc: Initiate an Ion Cannon strike.\nApplies instant damage to a small area.
@@ -469,7 +469,7 @@ TMPL:
Range: 6 Range: 6
Bib: Bib:
NukePower: NukePower:
Image: atomicnh Icon: abomb
ChargeTime: 300 ChargeTime: 300
Description: Nuclear Strike Description: Nuclear Strike
LongDesc: Launch a tactical nuke.\nApplies heavy damage over a large area. LongDesc: Launch a tactical nuke.\nApplies heavy damage over a large area.

View File

@@ -297,3 +297,11 @@ poweroff:
Start: 0 Start: 0
Length: * Length: *
Tick: 160 Tick: 160
icon:
airstrike: bombicnh
Start: 0
ioncannon: ionicnh
Start: 0
abomb: atomicnh
Start: 0

View File

@@ -42,7 +42,7 @@ PALACEA:
Buildable: Buildable:
Owner: atreides Owner: atreides
AirstrikePower: AirstrikePower:
Image: orniicon Icon: ornistrike
Description: Air Strike Description: Air Strike
ChargeTime: 180 ChargeTime: 180
LongDesc: Ornithopter drops a load of parachuted\nbombs on your target LongDesc: Ornithopter drops a load of parachuted\nbombs on your target

View File

@@ -74,7 +74,7 @@ PALACEH:
Tooltip: Tooltip:
Description: Provides elite infantry\n Special Ability: Death Hand Missile Description: Provides elite infantry\n Special Ability: Death Hand Missile
NukePower: NukePower:
Image: deathhandicon Icon: deathhand
ChargeTime: 300 ChargeTime: 300
Description: Death Hand Description: Death Hand
LongDesc: Launches a nuclear missile at a target location LongDesc: Launches a nuclear missile at a target location

View File

@@ -71,7 +71,7 @@ PALACEO:
Buildable: Buildable:
Owner: ordos Owner: ordos
AirstrikePower: AirstrikePower:
Image: orniicon Icon: ornistrike
Description: Air Strike Description: Air Strike
ChargeTime: 180 ChargeTime: 180
LongDesc: Ornithopter drops a load of parachuted\nbombs on your target LongDesc: Ornithopter drops a load of parachuted\nbombs on your target

View File

@@ -543,7 +543,7 @@ WALL:
Name: IX Research Center Name: IX Research Center
Description: Unlocks experimental tanks\n Special Ability: Carryall Combat Drop Description: Unlocks experimental tanks\n Special Ability: Carryall Combat Drop
ParatroopersPower: ParatroopersPower:
Image: carryallicon Icon: paratroopers
UnitType: carryall.infantry UnitType: carryall.infantry
FlareTime: 0 FlareTime: 0
ChargeTime: 180 ChargeTime: 180

View File

@@ -5,6 +5,10 @@ carryall:
unload: DATA.R8 unload: DATA.R8
Start: 1923 Start: 1923
Facings: -32 Facings: -32
icon: DATA.R8
Start: 4029
Offset: -30,-24
orni: orni:
idle: DATA.R8 idle: DATA.R8
@@ -13,6 +17,9 @@ orni:
Length: 3 Length: 3
Tick: 120 Tick: 120
Transpose: true Transpose: true
icon: DATA.R8
Start: 4031
Offset: -30,-24
frigate: frigate:
idle: DATA.R8 idle: DATA.R8

View File

@@ -217,3 +217,14 @@ doubleblast:
idle: DATA.R8 idle: DATA.R8
Start: 3279 Start: 3279
Facings: -16 Facings: -16
icon:
paratroopers: DATA.R8
Start: 4029
Offset: -30,-24
ornistrike: DATA.R8
Start: 4031
Offset: -30,-24
deathhand: DATA.R8
Start: 4035
Offset: -30,-24

View File

@@ -24,7 +24,7 @@ MSLO:
Range: 5 Range: 5
IronCurtainable: IronCurtainable:
NukePower: NukePower:
Image: atomicon Icon: abomb
ChargeTime: 540 ChargeTime: 540
Description: Atom Bomb Description: Atom Bomb
LongDesc: Launches a devastating atomic bomb\nat a target location. LongDesc: Launches a devastating atomic bomb\nat a target location.
@@ -213,7 +213,7 @@ IRON:
Range: 10 Range: 10
IronCurtainable: IronCurtainable:
IronCurtainPower: IronCurtainPower:
Image: infxicon Icon: invuln
ChargeTime: 120 ChargeTime: 120
Description: Invulnerability Description: Invulnerability
LongDesc: Makes a group of units invulnerable\nfor 20 seconds. LongDesc: Makes a group of units invulnerable\nfor 20 seconds.
@@ -251,7 +251,7 @@ PDOX:
Range: 10 Range: 10
IronCurtainable: IronCurtainable:
ChronoshiftPower: ChronoshiftPower:
Image: warpicon Icon: chrono
ChargeTime: 120 ChargeTime: 120
Description: Chronoshift Description: Chronoshift
LongDesc: Teleports a group of units across\nthe map for 20 seconds. LongDesc: Teleports a group of units across\nthe map for 20 seconds.
@@ -851,7 +851,7 @@ ATEK:
Bib: Bib:
IronCurtainable: IronCurtainable:
GpsPower: GpsPower:
Image: gpssicon Icon: gps
OneShot: yes OneShot: yes
ChargeTime: 480 ChargeTime: 480
Description: GPS Satellite Description: GPS Satellite
@@ -1074,14 +1074,14 @@ AFLD:
Reservable: Reservable:
IronCurtainable: IronCurtainable:
SpyPlanePower: SpyPlanePower:
Image: smigicon Icon: spyplane
ChargeTime: 180 ChargeTime: 180
Description: Spy Plane Description: Spy Plane
LongDesc: Reveals an area of the map. LongDesc: Reveals an area of the map.
SelectTargetSound: slcttgt1.aud SelectTargetSound: slcttgt1.aud
EndChargeSound: spypln1.aud EndChargeSound: spypln1.aud
ParatroopersPower: ParatroopersPower:
Image: pinficon Icon: paratroopers
ChargeTime: 360 ChargeTime: 360
Description: Paratroopers Description: Paratroopers
LongDesc: A Badger drops a squad of Riflemen \nanywhere on the map LongDesc: A Badger drops a squad of Riflemen \nanywhere on the map
@@ -1307,6 +1307,7 @@ FACF:
Hotkey: c Hotkey: c
Queue: Defense Queue: Defense
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Construction Yard Name: Fake Construction Yard
Description: Looks like a Construction Yard. Description: Looks like a Construction Yard.
Building: Building:
@@ -1336,6 +1337,7 @@ WEAF:
Hotkey: x Hotkey: x
Queue: Defense Queue: Defense
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake War Factory Name: Fake War Factory
Description: Looks like a War Factory. Description: Looks like a War Factory.
Building: Building:
@@ -1366,6 +1368,7 @@ SYRF:
Hotkey: z Hotkey: z
Queue: Defense Queue: Defense
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Shipyard Name: Fake Shipyard
Description: Looks like a Shipyard Description: Looks like a Shipyard
TargetableBuilding: TargetableBuilding:
@@ -1399,6 +1402,7 @@ SPEF:
Hotkey: z Hotkey: z
Queue: Defense Queue: Defense
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Sub Pen Name: Fake Sub Pen
Description: Looks like a Sub Pen Description: Looks like a Sub Pen
Building: Building:
@@ -1422,6 +1426,7 @@ DOMF:
Valued: Valued:
Cost: 50 Cost: 50
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Radar Dome Name: Fake Radar Dome
Description: Looks like a Radar Dome Description: Looks like a Radar Dome
Buildable: Buildable:

View File

@@ -396,3 +396,17 @@ gpsdot:
Start: 5 Start: 5
Structure: Structure:
Start: 6 Start: 6
icon:
abomb: atomicon
Start: 0
invuln: infxicon
Start: 0
chrono: warpicon
Start: 0
spyplane: smigicon
Start: 0
paratroopers: pinficon
Start: 0
gps: gpssicon
Start: 0

View File

@@ -62,6 +62,8 @@ fact:
Length: * Length: *
icon: facticon icon: facticon
Start: 0 Start: 0
fake-icon: facficon
Start: 0
proc: proc:
idle: idle:
@@ -180,6 +182,8 @@ dome:
Length: * Length: *
icon: domeicon icon: domeicon
Start: 0 Start: 0
fake-icon: domficon
Start: 0
atek: atek:
idle: idle:
@@ -236,6 +240,8 @@ weap:
Length: * Length: *
icon: weapicon icon: weapicon
Start: 0 Start: 0
fake-icon: weaficon
Start: 0
hpad: hpad:
idle: idle:
@@ -298,6 +304,8 @@ spen:
Length: * Length: *
icon: spenicon icon: spenicon
Start: 0 Start: 0
fake-icon: speficon
Start: 0
syrd: syrd:
idle: idle:
@@ -309,6 +317,8 @@ syrd:
Length: * Length: *
icon: syrdicon icon: syrdicon
Start: 0 Start: 0
fake-icon: syrficon
Start: 0
fix: fix:
idle: idle: