fixed wrong palette remapping for neutral buildings in editor
for TEMPERAT (fields) and DESERT (buildings, trees, rocks)
This commit is contained in:
@@ -140,10 +140,8 @@ namespace OpenRA.Editor
|
|||||||
tileset.LoadTiles();
|
tileset.LoadTiles();
|
||||||
int[] ShadowIndex = { 3, 4 };
|
int[] ShadowIndex = { 3, 4 };
|
||||||
var palette = new Palette(FileSystem.Open(tileset.Palette), ShadowIndex);
|
var palette = new Palette(FileSystem.Open(tileset.Palette), ShadowIndex);
|
||||||
/* PlayerPalette is only used in RA desert terrain
|
|
||||||
* TODO: use the palette as defined in YAML
|
// required for desert terrain in RA
|
||||||
* defaults are wrong for DESERT rocks, trees, walls and ore mine
|
|
||||||
*/
|
|
||||||
var playerPalette = tileset.PlayerPalette ?? tileset.Palette;
|
var playerPalette = tileset.PlayerPalette ?? tileset.Palette;
|
||||||
var PlayerPalette = new Palette(FileSystem.Open(playerPalette), ShadowIndex);
|
var PlayerPalette = new Palette(FileSystem.Open(playerPalette), ShadowIndex);
|
||||||
|
|
||||||
@@ -217,7 +215,13 @@ namespace OpenRA.Editor
|
|||||||
if (etf != null && etf.RequireTilesets != null
|
if (etf != null && etf.RequireTilesets != null
|
||||||
&& !etf.RequireTilesets.Contains(tileset.Id)) continue;
|
&& !etf.RequireTilesets.Contains(tileset.Id)) continue;
|
||||||
|
|
||||||
var template = RenderUtils.RenderActor(info, tileset, PlayerPalette);
|
var TemplatePalette = PlayerPalette;
|
||||||
|
var rsi = info.Traits.GetOrDefault<RenderSimpleInfo>();
|
||||||
|
// exception for desert buildings
|
||||||
|
if (rsi != null && rsi.Palette != null && rsi.Palette.Contains("terrain"))
|
||||||
|
TemplatePalette = palette;
|
||||||
|
|
||||||
|
var template = RenderUtils.RenderActor(info, tileset, TemplatePalette);
|
||||||
var ibox = new PictureBox
|
var ibox = new PictureBox
|
||||||
{
|
{
|
||||||
Image = template.Bitmap,
|
Image = template.Bitmap,
|
||||||
|
|||||||
@@ -308,7 +308,10 @@ namespace OpenRA.Editor
|
|||||||
public void DrawActor(SGraphics g, CPos p, ActorTemplate t, ColorPalette cp)
|
public void DrawActor(SGraphics g, CPos p, ActorTemplate t, ColorPalette cp)
|
||||||
{
|
{
|
||||||
var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft;
|
var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft;
|
||||||
DrawImage(g, t.Bitmap, p, centered, cp);
|
var actorPalette = cp;
|
||||||
|
if (t.Appearance != null && t.Appearance.UseTerrainPalette)
|
||||||
|
actorPalette = Palette.AsSystemPalette();
|
||||||
|
DrawImage(g, t.Bitmap, p, centered, actorPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
float2 GetDrawPosition(CPos location, Bitmap bmp, bool centered)
|
float2 GetDrawPosition(CPos location, Bitmap bmp, bool centered)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace OpenRA.Traits
|
|||||||
public class EditorAppearanceInfo : TraitInfo<EditorAppearance>
|
public class EditorAppearanceInfo : TraitInfo<EditorAppearance>
|
||||||
{
|
{
|
||||||
public readonly bool RelativeToTopLeft = false;
|
public readonly bool RelativeToTopLeft = false;
|
||||||
|
public readonly bool UseTerrainPalette = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EditorAppearance { }
|
public class EditorAppearance { }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FCOM:
|
FCOM:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
Building:
|
Building:
|
||||||
Power: -200
|
Power: -200
|
||||||
Footprint: xx xx
|
Footprint: xx xx
|
||||||
@@ -15,7 +15,7 @@ FCOM:
|
|||||||
Bib:
|
Bib:
|
||||||
|
|
||||||
HOSP:
|
HOSP:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
Building:
|
Building:
|
||||||
Footprint: xx xx
|
Footprint: xx xx
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
@@ -170,7 +170,7 @@ V18:
|
|||||||
ExcludeTilesets: DESERT
|
ExcludeTilesets: DESERT
|
||||||
|
|
||||||
BARL:
|
BARL:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
Selectable:
|
Selectable:
|
||||||
Priority: 0
|
Priority: 0
|
||||||
Health:
|
Health:
|
||||||
@@ -181,7 +181,7 @@ BARL:
|
|||||||
Name: Explosive Barrel
|
Name: Explosive Barrel
|
||||||
|
|
||||||
BRL3:
|
BRL3:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
Selectable:
|
Selectable:
|
||||||
Priority: 0
|
Priority: 0
|
||||||
Health:
|
Health:
|
||||||
@@ -192,7 +192,7 @@ BRL3:
|
|||||||
Name: Explosive Barrel
|
Name: Explosive Barrel
|
||||||
|
|
||||||
MISS:
|
MISS:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
Selectable:
|
Selectable:
|
||||||
Priority: 0
|
Priority: 0
|
||||||
Building:
|
Building:
|
||||||
@@ -205,7 +205,7 @@ MISS:
|
|||||||
Bib:
|
Bib:
|
||||||
|
|
||||||
BIO:
|
BIO:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
Building:
|
Building:
|
||||||
Footprint: xx xx
|
Footprint: xx xx
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
@@ -214,7 +214,7 @@ BIO:
|
|||||||
|
|
||||||
|
|
||||||
OILB:
|
OILB:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
Selectable:
|
Selectable:
|
||||||
Priority: 0
|
Priority: 0
|
||||||
Building:
|
Building:
|
||||||
|
|||||||
@@ -237,12 +237,13 @@
|
|||||||
GivesExperience:
|
GivesExperience:
|
||||||
EditorAppearance:
|
EditorAppearance:
|
||||||
RelativeToTopLeft: yes
|
RelativeToTopLeft: yes
|
||||||
|
UseTerrainPalette: true
|
||||||
AutoTargetIgnore:
|
AutoTargetIgnore:
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Wall
|
Types:Wall
|
||||||
Sellable:
|
Sellable:
|
||||||
|
|
||||||
^CivBuilding:
|
^TechBuilding:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
-RepairableBuilding:
|
-RepairableBuilding:
|
||||||
Health:
|
Health:
|
||||||
@@ -259,6 +260,11 @@
|
|||||||
-Capturable:
|
-Capturable:
|
||||||
-CapturableBar:
|
-CapturableBar:
|
||||||
|
|
||||||
|
^CivBuilding:
|
||||||
|
Inherits: ^TechBuilding
|
||||||
|
EditorAppearance:
|
||||||
|
UseTerrainPalette: true
|
||||||
|
|
||||||
^CivField:
|
^CivField:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^CivBuilding
|
||||||
-Selectable:
|
-Selectable:
|
||||||
@@ -281,6 +287,7 @@
|
|||||||
Terrain: Tree
|
Terrain: Tree
|
||||||
EditorAppearance:
|
EditorAppearance:
|
||||||
RelativeToTopLeft: yes
|
RelativeToTopLeft: yes
|
||||||
|
UseTerrainPalette: true
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Tree
|
Types:Tree
|
||||||
|
|
||||||
@@ -369,10 +376,11 @@
|
|||||||
Terrain: Tree
|
Terrain: Tree
|
||||||
EditorAppearance:
|
EditorAppearance:
|
||||||
RelativeToTopLeft: yes
|
RelativeToTopLeft: yes
|
||||||
|
UseTerrainPalette: true
|
||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Tree
|
Types:Tree
|
||||||
|
|
||||||
^DesertCivBuilding
|
^DesertCivBuilding:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^CivBuilding
|
||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
Palette: terrain
|
Palette: terrain
|
||||||
|
|||||||
Reference in New Issue
Block a user