Skip to content
This repository has been archived by the owner on Apr 25, 2021. It is now read-only.

Commit

Permalink
Inventory has been added. Largely untested.
Browse files Browse the repository at this point in the history
  • Loading branch information
Squirrelies committed Feb 3, 2019
1 parent 1267193 commit cca8cbb
Show file tree
Hide file tree
Showing 12 changed files with 893 additions and 91 deletions.
87 changes: 24 additions & 63 deletions RE2REmakeSRT/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,69 +14,7 @@ public static class Extensions

public static void DrawInvItem(this Graphics g, ItemPositionEnumeration position, Image image = null, string text = "", Brush b = null, bool equipped = false)
{
//if (image == null)
// image = Program.emptySlot;

//if (b == null)
// b = Brushes.LawnGreen;

//byte bytePosition = (byte)position;
//if (position == ItemPositionEnumeration.DefItemSlot1) // 30
//{
// float xImg = ICON_OFFSET_X;
// float yImg = ICON_OFFSET_Y + (INVENTORY_ITEM_HEIGHT * (0 / 2));
// g.DrawImage(image, xImg, yImg, INVENTORY_ITEM_WIDTH, INVENTORY_ITEM_HEIGHT);

// if (equipped)
// g.DrawRectangle(new Pen(Color.LawnGreen, 3), xImg + 1, yImg + 1, INVENTORY_ITEM_WIDTH - 3, INVENTORY_ITEM_HEIGHT - 3);

// float xStr = ICON_OFFSET_X + 5;
// float yStr = ICON_OFFSET_Y + ((INVENTORY_ITEM_HEIGHT * (0 / 2)) + 64);
// g.DrawString(text, new Font("Consolas", 14, FontStyle.Bold), b, xStr, yStr);
//}
//else if (position == ItemPositionEnumeration.DefItemSlot2) // 30
//{
// float xImg = 96 + 30 + ICON_OFFSET_X;
// float yImg = ICON_OFFSET_Y + (INVENTORY_ITEM_HEIGHT * (0 / 2));
// g.DrawImage(image, xImg, yImg, INVENTORY_ITEM_WIDTH, INVENTORY_ITEM_HEIGHT);

// if (equipped)
// g.DrawRectangle(new Pen(Color.LawnGreen, 3), xImg + 1, yImg + 1, INVENTORY_ITEM_WIDTH - 3, INVENTORY_ITEM_HEIGHT - 3);

// float xStr = 96 + 30 + ICON_OFFSET_X + 5;
// float yStr = ICON_OFFSET_Y + ((INVENTORY_ITEM_HEIGHT * (0 / 2)) + 64);
// g.DrawString(text, new Font("Consolas", 14, FontStyle.Bold), b, xStr, yStr);
//}
//else if (position == ItemPositionEnumeration.EquippedItemSlot) // 30
//{
// float xImg = 192 + 60 + ICON_OFFSET_X;
// float yImg = ICON_OFFSET_Y + (INVENTORY_ITEM_HEIGHT * (0 / 2));
// g.DrawImage(image, xImg, yImg, INVENTORY_ITEM_WIDTH, INVENTORY_ITEM_HEIGHT);

// float xStr = 192 + 60 + ICON_OFFSET_X + 5;
// float yStr = ICON_OFFSET_Y + ((INVENTORY_ITEM_HEIGHT * (0 / 2)) + 64);
// g.DrawString(text, new Font("Consolas", 14, FontStyle.Bold), b, xStr, yStr);
//}
//else if (bytePosition % 2 == 1) // Odd
//{
// float xImg = ICON_OFFSET_X + INVENTORY_ITEM_WIDTH;
// float yImg = ICON_OFFSET_Y + (INVENTORY_ITEM_HEIGHT * (bytePosition / 2));
// g.DrawImage(image, xImg, yImg, INVENTORY_ITEM_WIDTH, INVENTORY_ITEM_HEIGHT);

// float xStr = ICON_OFFSET_X + INVENTORY_ITEM_WIDTH + 5;
// float yStr = ICON_OFFSET_Y + ((INVENTORY_ITEM_HEIGHT * (bytePosition / 2)) + 64);
// g.DrawString(text, new Font("Consolas", 14, FontStyle.Bold), b, xStr, yStr);
//}
//else // Even
//{
// float xImg = ICON_OFFSET_X;
// float yImg = ICON_OFFSET_Y + (INVENTORY_ITEM_HEIGHT * (bytePosition / 2));
// g.DrawImage(image, xImg, yImg, INVENTORY_ITEM_WIDTH, INVENTORY_ITEM_HEIGHT);

// float xStr = ICON_OFFSET_X + 5;
// float yStr = ICON_OFFSET_Y + ((INVENTORY_ITEM_HEIGHT * (bytePosition / 2)) + 64);
// g.DrawString(text, new Font("Consolas", 14, FontStyle.Bold), b, xStr, yStr);
//}

}

public static void DrawText(this Graphics g, float x, float y, string text = "", Brush b = null, Font f = null)
Expand Down Expand Up @@ -112,5 +50,28 @@ public static void ThreadSafeSetHealthImage(this PictureBox picBox, Image image,
}
}
}

public static bool ByteArrayEquals(this byte[] first, byte[] second)
{
// Check to see if the have the same reference.
if (first == second)
return true;

// Check to make sure neither are null.
if (first == null || second == null)
return false;

// Ensure the array lengths match.
if (first.Length != second.Length)
return false;

// Check each element side by side for equality.
for (int i = 0; i < first.Length; i++)
if (first[i] != second[i])
return false;

// We made it past the for loop, we're equals!
return true;
}
}
}
Loading

0 comments on commit cca8cbb

Please sign in to comment.