Remove custom D2k spice variant logic and improve editor cursor sprite.

This commit is contained in:
Paul Chote
2021-01-22 23:50:43 +00:00
committed by reaperrr
parent 80e92849da
commit c35e9fb016
3 changed files with 18 additions and 20 deletions

View File

@@ -41,17 +41,8 @@ namespace OpenRA.Mods.D2k.Traits
All = 0xFF All = 0xFF
} }
public static readonly Dictionary<string, int[]> Variants = new Dictionary<string, int[]>()
{
{ "cleara", new[] { 0, 50 } },
{ "clearb", new[] { 1, 51 } },
{ "clearc", new[] { 43, 52 } },
{ "cleard", new[] { 0, 53 } },
};
public static readonly Dictionary<ClearSides, int> SpriteMap = new Dictionary<ClearSides, int>() public static readonly Dictionary<ClearSides, int> SpriteMap = new Dictionary<ClearSides, int>()
{ {
{ ClearSides.None, 0 },
{ ClearSides.Left | ClearSides.Top | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 2 }, { ClearSides.Left | ClearSides.Top | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 2 },
{ ClearSides.Top | ClearSides.Right | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 3 }, { ClearSides.Top | ClearSides.Right | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 3 },
{ ClearSides.Left | ClearSides.Bottom | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 4 }, { ClearSides.Left | ClearSides.Bottom | ClearSides.TopLeft | ClearSides.TopRight | ClearSides.BottomLeft | ClearSides.BottomRight, 4 },
@@ -169,10 +160,10 @@ namespace OpenRA.Mods.D2k.Traits
if (clear == ClearSides.None) if (clear == ClearSides.None)
{ {
var sprites = Variants[content.Variant]; var sprites = renderType.Variants[content.Variant];
var frame = density > renderType.Info.MaxDensity / 2 ? 1 : 0; var frame = density > renderType.Info.MaxDensity / 2 ? 1 : 0;
UpdateSpriteLayers(cell, renderType.Variants.First().Value, sprites[frame], renderType.Palette); UpdateSpriteLayers(cell, sprites, frame, renderType.Palette);
} }
else if (SpriteMap.TryGetValue(clear, out var index)) else if (SpriteMap.TryGetValue(clear, out var index))
{ {
@@ -184,10 +175,5 @@ namespace OpenRA.Mods.D2k.Traits
else else
UpdateSpriteLayers(cell, null, 0, null); UpdateSpriteLayers(cell, null, 0, null);
} }
protected override string ChooseRandomVariant(ResourceType t)
{
return Variants.Keys.Random(Game.CosmeticRandom);
}
} }
} }

View File

@@ -113,7 +113,7 @@
ResourceType: 1 ResourceType: 1
Palette: d2k Palette: d2k
TerrainType: Spice TerrainType: Spice
Sequences: spice Sequences: spicea, spiceb, spicec, spiced
MaxDensity: 20 MaxDensity: 20
ValuePerUnit: 25 ValuePerUnit: 25
AllowedTerrainTypes: SpiceSand AllowedTerrainTypes: SpiceSand

View File

@@ -444,9 +444,21 @@ moveflsh:
EmbeddedPalette: moveflash EmbeddedPalette: moveflash
resources: resources:
spice: BLOXBASE.R8 spicea: BLOXBASE.R8
Frames: 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 300, 301, 320, 321 Frames: 748, 300, 750, 751, 752, 753, 754, 755, 756, 757, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 300
Length: 54 Length: *
Offset: -16,-16
spiceb: BLOXBASE.R8
Frames: 749, 301, 750, 751, 752, 753, 754, 755, 756, 757, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 301
Length: *
Offset: -16,-16
spicec: BLOXBASE.R8
Frames: 793, 320, 750, 751, 752, 753, 754, 755, 756, 757, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 320
Length: *
Offset: -16,-16
spiced: BLOXBASE.R8
Frames: 748, 321, 750, 751, 752, 753, 754, 755, 756, 757, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 321
Length: *
Offset: -16,-16 Offset: -16,-16
shroud: shroud: