fix cnc cursors

This commit is contained in:
Chris Forbes
2010-03-07 23:26:50 +13:00
parent 34495cf3e7
commit cbd12f90ae
6 changed files with 14 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRA.FileFormats
return colors[index];
}
public Palette(Stream s)
public Palette(Stream s, bool remapTransparent)
{
using (BinaryReader reader = new BinaryReader(s))
{
@@ -46,9 +46,14 @@ namespace OpenRA.FileFormats
colors.Add(Color.FromArgb(r, g, b));
}
}
colors[0] = Color.FromArgb(0, 0, 0, 0);
colors[3] = Color.FromArgb(178, 0, 0, 0);
colors[4] = Color.FromArgb(140, 0, 0, 0);
if (remapTransparent)
{
colors[3] = Color.FromArgb(178, 0, 0, 0);
colors[4] = Color.FromArgb(140, 0, 0, 0);
}
}
public Palette(Palette p, IPaletteRemap r)

View File

@@ -27,6 +27,7 @@ namespace OpenRA.Traits
public readonly string Name = null;
public readonly string Theater = null;
public readonly string Filename = null;
public readonly bool Transparent = true;
public object Create(Actor self) { return new PaletteFromFile(self, this); }
}
@@ -37,8 +38,8 @@ namespace OpenRA.Traits
if (info.Theater == null ||
info.Theater.ToLowerInvariant() == self.World.Map.Theater.ToLowerInvariant())
{
//Log.Write("Loading palette {0} from file {1}", info.Name, info.Filename);
self.World.WorldRenderer.AddPalette(info.Name, new Palette(FileSystem.Open(info.Filename)));
self.World.WorldRenderer.AddPalette(info.Name,
new Palette(FileSystem.Open(info.Filename), info.Transparent));
}
}
}

View File

@@ -105,7 +105,7 @@ namespace SequenceEditor
Doc = new XmlDocument();
Doc.Load(XmlFilename);
var tempPal = new Palette(FileSystem.Open(args[2]));
var tempPal = new Palette(FileSystem.Open(args[2]), true);
Pal = tempPal;
UnitName = GetTextForm.GetString("Unit to edit?", "e1");

BIN
mods/cnc/mouse2.shp Normal file

Binary file not shown.

View File

@@ -4,7 +4,7 @@
<unit name="clock">
<sequence name="idle" start="0" length="*" src="hclock" />
</unit>
<cursor src="mouse">
<cursor src="mouse2">
<sequence name="default" start="0" />
<sequence name="scroll" start="1" length="8" />
<sequence name="generic-blocked" start="9" />

View File

@@ -152,6 +152,7 @@ World:
PaletteFromFile@cursor:
Name: cursor
Filename: temperat.pal
Transparent: no
PaletteFromRGBA@shadow:
Name: shadow
R: 0