Show X on buried items root

This commit is contained in:
Kurt 2020-04-11 11:57:28 -07:00
parent 95df4e9c53
commit da955be606
3 changed files with 27 additions and 4 deletions

View File

@ -19,12 +19,13 @@ public class FieldItem : IHeldItem
[Category(Derived)] public bool IsExtension => ItemType == EXTENSION;
[Category(Derived)] public bool IsRoot => ItemType < EXTENSION;
[Category(Derived)] public ushort DisplayItemId => IsExtension ? ExtensionItemId : ItemId;
[Category(Derived)] public bool IsBuried => (Flags0 & 4) != 0;
// Item Definition
[field: FieldOffset(0)][Category(HeldItem)] public ushort ItemId { get; set; }
[field: FieldOffset(2)][Category(HeldItem)] public byte Flags0 { get; set; }
[field: FieldOffset(3)][Category(HeldItem)] public byte Flags1 { get; set; }
[field: FieldOffset(4)][Category(HeldItem)] public ushort Count { get; set; }
[field: FieldOffset(4)][Category(HeldItem)] public ushort Count { get; set; } // Tree Shake/Fossil Item ID
[field: FieldOffset(6)][Category(HeldItem)] public ushort UseCount { get; set; }
// Field Item Definition

View File

@ -103,13 +103,35 @@ private static void DrawDirectionals(int[] data, FieldItemLayer layer, int w, in
for (int y = y0; y < y0 + layer.GridHeight; y++)
{
var tile = layer.GetTile(x, y);
if (!tile.IsExtension)
if (tile.IsNone)
continue;
DrawDirectional(data, tile, (x - x0) * scale, (y - y0) * scale, scale, w);
if (tile.IsBuried)
DrawX(data, (x - x0) * scale, (y - y0) * scale, scale, w);
else if (tile.IsExtension)
DrawDirectional(data, tile, (x - x0) * scale, (y - y0) * scale, scale, w);
}
}
}
private static void DrawX(int[] data, int x0, int y0, int scale, int w)
{
var opposite = scale - 1;
var wo = w * opposite;
// Starting offsets for each of the slashes
var bBackward = (w * y0) + x0; // Backwards \
var bForward = bBackward + wo; // Forwards /
for (int x = 0; x < scale; x++)
{
var wx = w * x;
var backward = bBackward + x + wx;
data[backward] ^= 0x808080;
var forward = bForward + x - wx;
data[forward] ^= 0x808080;
}
}
private static void DrawDirectional(int[] data, FieldItem tile, int x0, int y0, int scale, int w)
{
var eX = tile.ExtensionX;

View File

@ -365,7 +365,7 @@ private void InitializeComponent()
this.B_RemoveAll.Name = "B_RemoveAll";
this.B_RemoveAll.Size = new System.Drawing.Size(98, 40);
this.B_RemoveAll.TabIndex = 32;
this.B_RemoveAll.Text = "Remove Plants";
this.B_RemoveAll.Text = "Remove All";
this.B_RemoveAll.UseVisualStyleBackColor = true;
this.B_RemoveAll.Click += new System.EventHandler(this.B_RemoveAll_Click);
//