diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index 79a948774a..6364e5dd2b 100644 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -219,7 +219,7 @@ namespace OpenRA.Editor try { var info = Program.Rules.Actors[a]; - if (!info.Traits.Contains()) continue; + if (!info.Traits.Contains()) continue; var etf = info.Traits.GetOrDefault(); if (etf != null && etf.ExcludeTilesets != null @@ -228,10 +228,10 @@ namespace OpenRA.Editor && !etf.RequireTilesets.Contains(tileset.Id)) continue; var templatePalette = shadowedPalette; - var rsi = info.Traits.GetOrDefault(); + var rsi = info.Traits.GetOrDefault(); // exception for desert buildings - if (rsi != null && rsi.Palette != null && rsi.Palette.Contains("terrain")) + if (rsi != null && rsi.EditorPalette != null && rsi.EditorPalette.Contains("terrain")) templatePalette = palette; var template = RenderUtils.RenderActor(info, tileset, templatePalette); diff --git a/OpenRA.Editor/RenderUtils.cs b/OpenRA.Editor/RenderUtils.cs index a7095ceaec..a3497a882f 100644 --- a/OpenRA.Editor/RenderUtils.cs +++ b/OpenRA.Editor/RenderUtils.cs @@ -47,8 +47,7 @@ namespace OpenRA.Editor public static ActorTemplate RenderActor(ActorInfo info, TileSet tileset, IPalette p) { - var image = RenderSprites.GetImage(info); - + var image = info.Traits.Get().EditorImage(info); using (var s = GlobalFileSystem.OpenWithExts(image, tileset.Extensions)) { var shp = new ShpReader(s); diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 467a2ffe1b..e795badd54 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -148,7 +148,6 @@ - @@ -193,17 +192,12 @@ - - - - - diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index ae952393bb..b079dd26ea 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -265,4 +265,10 @@ namespace OpenRA.Traits return a.TraitsImplementing().Any(d => d.Disabled); } } + + public interface ILegacyEditorRenderInfo + { + string EditorPalette { get; } + string EditorImage(ActorInfo actor); + } } diff --git a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs index dfcb3b8e8a..b2118fd4af 100644 --- a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs @@ -16,6 +16,7 @@ using OpenRA.Graphics; using OpenRA.Mods.RA; using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Orders; +using OpenRA.Mods.RA.Render; using OpenRA.Network; using OpenRA.Traits; using OpenRA.Widgets; diff --git a/OpenRA.Mods.Cnc/WithFire.cs b/OpenRA.Mods.Cnc/WithFire.cs index ad24efbd45..340739d0bf 100644 --- a/OpenRA.Mods.Cnc/WithFire.cs +++ b/OpenRA.Mods.Cnc/WithFire.cs @@ -9,6 +9,7 @@ #endregion using OpenRA.Graphics; +using OpenRA.Mods.RA.Render; using OpenRA.Traits; namespace OpenRA.Mods.Cnc diff --git a/OpenRA.Mods.Cnc/WithRoof.cs b/OpenRA.Mods.Cnc/WithRoof.cs index b334718a52..b7067907c8 100644 --- a/OpenRA.Mods.Cnc/WithRoof.cs +++ b/OpenRA.Mods.Cnc/WithRoof.cs @@ -9,6 +9,7 @@ #endregion using OpenRA.Graphics; +using OpenRA.Mods.RA.Render; using OpenRA.Traits; namespace OpenRA.Mods.Cnc diff --git a/OpenRA.Mods.RA/Buildings/Bib.cs b/OpenRA.Mods.RA/Buildings/Bib.cs index 9a67f8ac5d..6006414ec5 100755 --- a/OpenRA.Mods.RA/Buildings/Bib.cs +++ b/OpenRA.Mods.RA/Buildings/Bib.cs @@ -9,6 +9,7 @@ #endregion using OpenRA.Graphics; +using OpenRA.Mods.RA.Render; using OpenRA.Traits; namespace OpenRA.Mods.RA.Buildings diff --git a/OpenRA.Mods.RA/Buildings/DeadBuildingState.cs b/OpenRA.Mods.RA/Buildings/DeadBuildingState.cs index 62fc668a87..c5526241cd 100644 --- a/OpenRA.Mods.RA/Buildings/DeadBuildingState.cs +++ b/OpenRA.Mods.RA/Buildings/DeadBuildingState.cs @@ -10,6 +10,7 @@ using OpenRA.Effects; using OpenRA.Traits; +using OpenRA.Mods.RA.Render; namespace OpenRA.Mods.Cnc { diff --git a/OpenRA.Mods.RA/Buildings/LaysTerrain.cs b/OpenRA.Mods.RA/Buildings/LaysTerrain.cs index d375de521a..d079c374d0 100755 --- a/OpenRA.Mods.RA/Buildings/LaysTerrain.cs +++ b/OpenRA.Mods.RA/Buildings/LaysTerrain.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Buildings { - public class LaysTerrainInfo : ITraitInfo, Requires, Requires + public class LaysTerrainInfo : ITraitInfo, Requires { [Desc("The terrain template to place. If the template is PickAny, then" + "the actor footprint will be filled with this tile.")] diff --git a/OpenRA.Mods.RA/Burns.cs b/OpenRA.Mods.RA/Burns.cs index a117f80a3f..ce238f46de 100644 --- a/OpenRA.Mods.RA/Burns.cs +++ b/OpenRA.Mods.RA/Burns.cs @@ -9,6 +9,7 @@ #endregion using OpenRA.Graphics; +using OpenRA.Mods.RA.Render; using OpenRA.Traits; namespace OpenRA.Mods.RA diff --git a/OpenRA.Mods.RA/Crate.cs b/OpenRA.Mods.RA/Crate.cs index cf45a6ef05..ef8cb228e3 100644 --- a/OpenRA.Mods.RA/Crate.cs +++ b/OpenRA.Mods.RA/Crate.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.Linq; using OpenRA.Mods.RA.Buildings; +using OpenRA.Mods.RA.Render; using OpenRA.Primitives; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/Disguise.cs b/OpenRA.Mods.RA/Disguise.cs index cd70645053..8c59a53be7 100644 --- a/OpenRA.Mods.RA/Disguise.cs +++ b/OpenRA.Mods.RA/Disguise.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using OpenRA.Mods.RA.Orders; +using OpenRA.Mods.RA.Render; using OpenRA.Traits; namespace OpenRA.Mods.RA diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index 5f928fe8b9..8e3bfd1dd1 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -15,6 +15,7 @@ using System.Linq; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.RA.Graphics; using OpenRA.Traits; namespace OpenRA.Mods.RA.Effects diff --git a/OpenRA.Mods.RA/Effects/CashTick.cs b/OpenRA.Mods.RA/Effects/CashTick.cs index b51d6ef9be..4dfa5d8ad9 100644 --- a/OpenRA.Mods.RA/Effects/CashTick.cs +++ b/OpenRA.Mods.RA/Effects/CashTick.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Drawing; using OpenRA.Effects; using OpenRA.Graphics; +using OpenRA.Mods.RA.Graphics; namespace OpenRA.Mods.RA.Effects { diff --git a/OpenRA.Mods.RA/Effects/Contrail.cs b/OpenRA.Mods.RA/Effects/Contrail.cs index 9353adce9d..da330effce 100755 --- a/OpenRA.Mods.RA/Effects/Contrail.cs +++ b/OpenRA.Mods.RA/Effects/Contrail.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.Drawing; using OpenRA.Graphics; +using OpenRA.Mods.RA.Graphics; using OpenRA.Traits; namespace OpenRA.Mods.RA diff --git a/OpenRA.Mods.RA/Effects/ContrailFader.cs b/OpenRA.Mods.RA/Effects/ContrailFader.cs index 04f65ac001..9fc87f34c6 100755 --- a/OpenRA.Mods.RA/Effects/ContrailFader.cs +++ b/OpenRA.Mods.RA/Effects/ContrailFader.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using OpenRA.Effects; using OpenRA.Graphics; +using OpenRA.Mods.RA.Graphics; namespace OpenRA.Mods.RA.Effects { diff --git a/OpenRA.Mods.RA/Effects/LaserZap.cs b/OpenRA.Mods.RA/Effects/LaserZap.cs index e3da622a3d..4309485db0 100644 --- a/OpenRA.Mods.RA/Effects/LaserZap.cs +++ b/OpenRA.Mods.RA/Effects/LaserZap.cs @@ -13,6 +13,7 @@ using System.Drawing; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.RA.Graphics; namespace OpenRA.Mods.RA.Effects { diff --git a/OpenRA.Mods.RA/Effects/Missile.cs b/OpenRA.Mods.RA/Effects/Missile.cs index dc03778e29..75282aa1b5 100755 --- a/OpenRA.Mods.RA/Effects/Missile.cs +++ b/OpenRA.Mods.RA/Effects/Missile.cs @@ -14,6 +14,7 @@ using System.Linq; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.RA.Graphics; using OpenRA.Traits; namespace OpenRA.Mods.RA.Effects diff --git a/OpenRA.Game/Graphics/BeamRenderable.cs b/OpenRA.Mods.RA/Graphics/BeamRenderable.cs similarity index 97% rename from OpenRA.Game/Graphics/BeamRenderable.cs rename to OpenRA.Mods.RA/Graphics/BeamRenderable.cs index 965e5505b1..3c19af8b97 100644 --- a/OpenRA.Game/Graphics/BeamRenderable.cs +++ b/OpenRA.Mods.RA/Graphics/BeamRenderable.cs @@ -9,8 +9,9 @@ #endregion using System.Drawing; +using OpenRA.Graphics; -namespace OpenRA.Graphics +namespace OpenRA.Mods.RA.Graphics { public struct BeamRenderable : IRenderable { diff --git a/OpenRA.Game/Graphics/ContrailRenderable.cs b/OpenRA.Mods.RA/Graphics/ContrailRenderable.cs similarity index 98% rename from OpenRA.Game/Graphics/ContrailRenderable.cs rename to OpenRA.Mods.RA/Graphics/ContrailRenderable.cs index 3968badd81..07234627cf 100644 --- a/OpenRA.Game/Graphics/ContrailRenderable.cs +++ b/OpenRA.Mods.RA/Graphics/ContrailRenderable.cs @@ -10,8 +10,9 @@ using System.Drawing; using System.Linq; +using OpenRA.Graphics; -namespace OpenRA.Graphics +namespace OpenRA.Mods.RA.Graphics { public struct ContrailRenderable : IRenderable { diff --git a/OpenRA.Game/Graphics/TextRenderable.cs b/OpenRA.Mods.RA/Graphics/TextRenderable.cs similarity index 97% rename from OpenRA.Game/Graphics/TextRenderable.cs rename to OpenRA.Mods.RA/Graphics/TextRenderable.cs index 52a0a765ed..f07a82dc07 100644 --- a/OpenRA.Game/Graphics/TextRenderable.cs +++ b/OpenRA.Mods.RA/Graphics/TextRenderable.cs @@ -10,8 +10,9 @@ using System; using System.Drawing; +using OpenRA.Graphics; -namespace OpenRA.Graphics +namespace OpenRA.Mods.RA.Graphics { public struct TextRenderable : IRenderable { diff --git a/OpenRA.Game/Graphics/VoxelRenderable.cs b/OpenRA.Mods.RA/Graphics/VoxelRenderable.cs similarity index 99% rename from OpenRA.Game/Graphics/VoxelRenderable.cs rename to OpenRA.Mods.RA/Graphics/VoxelRenderable.cs index d951a31d30..2d59a63583 100644 --- a/OpenRA.Game/Graphics/VoxelRenderable.cs +++ b/OpenRA.Mods.RA/Graphics/VoxelRenderable.cs @@ -11,8 +11,9 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; +using OpenRA.Graphics; -namespace OpenRA.Graphics +namespace OpenRA.Mods.RA.Graphics { public struct VoxelRenderable : IRenderable { diff --git a/OpenRA.Mods.RA/Lint/CheckSequences.cs b/OpenRA.Mods.RA/Lint/CheckSequences.cs index e9ca3538c3..9383cc4603 100644 --- a/OpenRA.Mods.RA/Lint/CheckSequences.cs +++ b/OpenRA.Mods.RA/Lint/CheckSequences.cs @@ -11,6 +11,7 @@ using System; using System.Linq; using OpenRA.Traits; +using OpenRA.Mods.RA.Render; namespace OpenRA.Mods.RA { diff --git a/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs b/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs index 2baaf8ae8e..239e77fe7a 100644 --- a/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs +++ b/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { [Desc("This actor will remain visible (but not updated visually) under fog, once discovered.")] - public class FrozenUnderFogInfo : ITraitInfo, Requires, Requires + public class FrozenUnderFogInfo : ITraitInfo, Requires { public readonly bool StartsRevealed = false; diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index d54222bf87..fd531ad9d4 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -521,6 +521,12 @@ + + + + + + diff --git a/OpenRA.Mods.RA/Render/RenderNameTag.cs b/OpenRA.Mods.RA/Render/RenderNameTag.cs index bc6bb568d0..d017ea6d74 100644 --- a/OpenRA.Mods.RA/Render/RenderNameTag.cs +++ b/OpenRA.Mods.RA/Render/RenderNameTag.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.Drawing; using OpenRA.Graphics; +using OpenRA.Mods.RA.Graphics; using OpenRA.Traits; namespace OpenRA.Mods.RA.Render diff --git a/OpenRA.Game/Traits/Render/RenderSimple.cs b/OpenRA.Mods.RA/Render/RenderSimple.cs old mode 100755 new mode 100644 similarity index 82% rename from OpenRA.Game/Traits/Render/RenderSimple.cs rename to OpenRA.Mods.RA/Render/RenderSimple.cs index 01d65ceec9..14a640692e --- a/OpenRA.Game/Traits/Render/RenderSimple.cs +++ b/OpenRA.Mods.RA/Render/RenderSimple.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, @@ -11,10 +11,11 @@ using System; using System.Collections.Generic; using OpenRA.Graphics; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA.Render { - public class RenderSimpleInfo : RenderSpritesInfo, Requires + public class RenderSimpleInfo : RenderSpritesInfo, ILegacyEditorRenderInfo, Requires { public override object Create(ActorInitializer init) { return new RenderSimple(init.self); } @@ -25,6 +26,9 @@ namespace OpenRA.Traits return anim.Render(WPos.Zero, WVec.Zero, 0, pr, Scale); } + + public string EditorPalette { get { return Palette; } } + public string EditorImage(ActorInfo actor) { return RenderSimple.GetImage(actor); } } public class RenderSimple : RenderSprites, IAutoSelectionSize diff --git a/OpenRA.Game/Traits/Render/RenderSprites.cs b/OpenRA.Mods.RA/Render/RenderSprites.cs old mode 100755 new mode 100644 similarity index 98% rename from OpenRA.Game/Traits/Render/RenderSprites.cs rename to OpenRA.Mods.RA/Render/RenderSprites.cs index df8f56fa03..f93507498b --- a/OpenRA.Game/Traits/Render/RenderSprites.cs +++ b/OpenRA.Mods.RA/Render/RenderSprites.cs @@ -12,9 +12,10 @@ using System; using System.Collections.Generic; using System.Linq; using OpenRA.Graphics; +using OpenRA.Traits; using OpenRA.Primitives; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA.Render { public class RenderSpritesInfo : ITraitInfo { diff --git a/OpenRA.Mods.RA/Render/RenderVoxels.cs b/OpenRA.Mods.RA/Render/RenderVoxels.cs index 7c91cba27b..6b466817ff 100755 --- a/OpenRA.Mods.RA/Render/RenderVoxels.cs +++ b/OpenRA.Mods.RA/Render/RenderVoxels.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using OpenRA.Graphics; using OpenRA.Traits; +using OpenRA.Mods.RA.Graphics; namespace OpenRA.Mods.RA.Render { diff --git a/OpenRA.Mods.RA/SupportPowers/NukePower.cs b/OpenRA.Mods.RA/SupportPowers/NukePower.cs index 5e1582bcf4..c53a7b8363 100755 --- a/OpenRA.Mods.RA/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/NukePower.cs @@ -12,6 +12,7 @@ using System; using OpenRA.Effects; using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Effects; +using OpenRA.Mods.RA.Render; using OpenRA.Primitives; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/ThrowsParticle.cs b/OpenRA.Mods.RA/ThrowsParticle.cs index 8b8f628d2c..c8b0d2157d 100644 --- a/OpenRA.Mods.RA/ThrowsParticle.cs +++ b/OpenRA.Mods.RA/ThrowsParticle.cs @@ -10,6 +10,7 @@ using OpenRA.Graphics; using OpenRA.Traits; +using OpenRA.Mods.RA.Render; namespace OpenRA.Mods.RA { diff --git a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs index c2a3100bbf..d13454c86b 100644 --- a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs @@ -15,6 +15,7 @@ using System.Linq; using OpenRA.Graphics; using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Orders; +using OpenRA.Mods.RA.Render; using OpenRA.Network; using OpenRA.Primitives; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs index 3a7c502674..c8d103cff1 100644 --- a/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs +++ b/OpenRA.Mods.RA/Widgets/ObserverProductionIconsWidget.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using OpenRA.Graphics; +using OpenRA.Mods.RA.Render; using OpenRA.Traits; using OpenRA.Widgets;