support reversed remapping for d2k

This commit is contained in:
Matthias Mailänder
2012-07-17 17:01:37 +02:00
parent 6204bfcabf
commit 44b8630c71
3 changed files with 11 additions and 10 deletions

View File

@@ -19,12 +19,6 @@ namespace OpenRA.FileFormats
{ {
Dictionary<int, Color> remapColors; Dictionary<int, Color> remapColors;
static int[] GetRemapRamp(int[] Ramp)
{
var RemapRamp = Ramp.Select(r => r - Ramp[0]).ToArray();
return RemapRamp;
}
public static int GetRemapIndex(int[] Ramp, int i) public static int GetRemapIndex(int[] Ramp, int i)
{ {
return Ramp[i]; return Ramp[i];
@@ -33,11 +27,18 @@ namespace OpenRA.FileFormats
public PlayerColorRemap(int[] Ramp, ColorRamp c) public PlayerColorRemap(int[] Ramp, ColorRamp c)
{ {
var c1 = c.GetColor(0); var c1 = c.GetColor(0);
var c2 = c.GetColor(1); /* temptemp: this can be expressed better */ var c2 = c.GetColor(1); // temptemp: this can be expressed better
var baseIndex = Ramp[0]; var baseIndex = Ramp[0];
var RemapRamp = GetRemapRamp(Ramp); var RemapRamp = Ramp.Select(r => r - Ramp[0]).ToArray();
if (Ramp[0] > Ramp[15]) // reversed remapping
{
baseIndex = Ramp[15];
for (int i=15; i>0; i--)
RemapRamp = Ramp.Select(r => r - Ramp[15]).ToArray();
}
remapColors = RemapRamp.Select((x, i) => Pair.New(baseIndex + i, Exts.ColorLerp(x / 16f, c1, c2))) remapColors = RemapRamp.Select((x, i) => Pair.New(baseIndex + i, Exts.ColorLerp(x / 16f, c1, c2)))
.ToDictionary(u => u.First, u => u.Second); .ToDictionary(u => u.First, u => u.Second);
} }

View File

@@ -20,7 +20,7 @@
# rework chrome UI, dialoges, tabs # rework chrome UI, dialoges, tabs
# add sonic tank weapon (currently uses tesla) # add sonic tank weapon (currently uses tesla)
# starport prices should vary # starport prices should vary
# black spots on buildings should be fading team colors # some transparent tiles (see Atreides Hightech Factory) should be white
# gamefile extraction (setup/setup.z) from CD fails # gamefile extraction (setup/setup.z) from CD fails
# support patch 1.06 gamefiles: DATA.R8 has more frames and currently fails to extract, also featuring new terrain with white houses and new units: grenade thrower, stealth raider icon # support patch 1.06 gamefiles: DATA.R8 has more frames and currently fails to extract, also featuring new terrain with white houses and new units: grenade thrower, stealth raider icon
# put TilesetBuilder.Export into OpenRA.Utility to call the functions directly when extracting game-files (instead of opening a GUI) # put TilesetBuilder.Export into OpenRA.Utility to call the functions directly when extracting game-files (instead of opening a GUI)

View File

@@ -53,7 +53,7 @@ Player:
SquadSize: 10 SquadSize: 10
PlayerColorPalette: PlayerColorPalette:
BasePalette: d2k BasePalette: d2k
RemapIndex: 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 RemapIndex: 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240
BaseAttackNotifier: BaseAttackNotifier:
HarvesterAttackNotifier: HarvesterAttackNotifier: