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

Commit

Permalink
Fixed the missing inventory icon for the Old Key.
Browse files Browse the repository at this point in the history
Fixed infinite ammo quantity text from -1 to the infinite symbol.
  • Loading branch information
Squirrelies committed Feb 17, 2019
1 parent 2ab7442 commit ecb1ffd
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 23 deletions.
31 changes: 14 additions & 17 deletions RE2REmakeSRT/GameMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public void Refresh()
}

public static Bitmap inventoryImage;
public static Bitmap inventoryImagePatch1;
public static IReadOnlyDictionary<ItemEnumeration, Rectangle> ItemToImageTranslation;
public static IReadOnlyDictionary<Weapon, Rectangle> WeaponToImageTranslation;
public static void GenerateImages()
Expand All @@ -202,6 +203,7 @@ public static void GenerateImages()
try
{
inventoryImage = Properties.Resources.ui0100_iam_texout.Clone(new Rectangle(0, 0, Properties.Resources.ui0100_iam_texout.Width, Properties.Resources.ui0100_iam_texout.Height), PixelFormat.Format32bppPArgb);
inventoryImagePatch1 = Properties.Resources._40d_texout.Clone(new Rectangle(0, 0, Properties.Resources._40d_texout.Width, Properties.Resources._40d_texout.Height), PixelFormat.Format32bppPArgb);
}
catch (Exception ex)
{
Expand All @@ -211,25 +213,17 @@ public static void GenerateImages()
// Rescales the image down if the scaling factor is not 1.
if (Program.programSpecialOptions.ScalingFactor != 1d)
{
double sheetWidth = Math.Round(inventoryImage.Width * Program.programSpecialOptions.ScalingFactor, MidpointRounding.AwayFromZero);
double sheetHeight = Math.Round(inventoryImage.Height * Program.programSpecialOptions.ScalingFactor, MidpointRounding.AwayFromZero);
try
{
inventoryImage = new Bitmap(inventoryImage, (int)sheetWidth, (int)sheetHeight);
inventoryImage = new Bitmap(inventoryImage, (int)Math.Round(inventoryImage.Width * Program.programSpecialOptions.ScalingFactor, MidpointRounding.AwayFromZero), (int)Math.Round(inventoryImage.Height * Program.programSpecialOptions.ScalingFactor, MidpointRounding.AwayFromZero));
inventoryImagePatch1 = new Bitmap(inventoryImagePatch1, (int)Math.Round(inventoryImagePatch1.Width * Program.programSpecialOptions.ScalingFactor, MidpointRounding.AwayFromZero), (int)Math.Round(inventoryImagePatch1.Height * Program.programSpecialOptions.ScalingFactor, MidpointRounding.AwayFromZero));
}
catch (Exception ex)
{
Program.FailFast(string.Format(@"[{0}] An unhandled exception has occurred. Please see below for details.
---
[{1}] {2}
{3}
---
Resizing section.
sheetWidth: {4} ({7} * {6})
sheetHeight: {5} ({8} * {6})
scalingFactor: {6}
inventoryImage.Width: {7}
inventoryImage.Height: {8}", Program.srtVersion, ex.GetType().ToString(), ex.Message, ex.StackTrace, sheetWidth.ToString(), sheetHeight.ToString(), Program.programSpecialOptions.ScalingFactor.ToString(), inventoryImage.Width.ToString(), inventoryImage.Height.ToString()), ex);
{3}", Program.srtVersion, ex.GetType().ToString(), ex.Message, ex.StackTrace), ex);
}
}

Expand All @@ -241,19 +235,19 @@ Resizing section.

// Row 0.
{ ItemEnumeration.FirstAidSpray, new Rectangle(Program.INV_SLOT_WIDTH * (itemColumnInc = 0), Program.INV_SLOT_HEIGHT * ++itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Green1, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Red1, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Blue1, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Green2, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Red2, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Blue2, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Mixed_GG, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Mixed_GR, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Mixed_GB, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Mixed_GGB, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Mixed_GGG, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Mixed_GRB, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Mixed_RB, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Green2, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Red2, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Blue2, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Green1, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Red1, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.Herb_Blue1, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },

// Row 1.
{ ItemEnumeration.HandgunBullets, new Rectangle(Program.INV_SLOT_WIDTH * (itemColumnInc = 0), Program.INV_SLOT_HEIGHT * ++itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
Expand Down Expand Up @@ -400,6 +394,9 @@ Resizing section.
// Row 14.
{ ItemEnumeration.WoodenBox1, new Rectangle(Program.INV_SLOT_WIDTH * (itemColumnInc = 9), Program.INV_SLOT_HEIGHT * ++itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
{ ItemEnumeration.WoodenBox2, new Rectangle(Program.INV_SLOT_WIDTH * ++itemColumnInc, Program.INV_SLOT_HEIGHT * itemRowInc, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },

// Patch Items.
{ ItemEnumeration.OldKey, new Rectangle(0, 0, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT) },
};

int weaponColumnInc = -1;
Expand Down
1 change: 1 addition & 0 deletions RE2REmakeSRT/ItemEnumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public enum ItemEnumeration : int
BoltCutter = 0xF4,
StuffedDoll = 0xF5,
HipPouch = 0x0106,
OldKey = 0x011E,
PortableSafe = 0x0123,
TinStorageBox1 = 0x0125,
WoodenBox1 = 0x0126,
Expand Down
12 changes: 8 additions & 4 deletions RE2REmakeSRT/MainUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@ private void inventoryPanel_Paint(object sender, PaintEventArgs e)
if (inv.IsItem && GameMemory.ItemToImageTranslation.ContainsKey(inv.ItemID))
{
imageRect = GameMemory.ItemToImageTranslation[inv.ItemID];
imageBrush = new TextureBrush(GameMemory.inventoryImage, imageRect);

if (inv.ItemID == ItemEnumeration.OldKey)
imageBrush = new TextureBrush(GameMemory.inventoryImagePatch1, imageRect);
else
imageBrush = new TextureBrush(GameMemory.inventoryImage, imageRect);
}
else if (inv.IsWeapon && GameMemory.WeaponToImageTranslation.ContainsKey(weapon = new Weapon() { WeaponID = inv.WeaponID, Attachments = inv.Attachments }))
{
Expand All @@ -258,7 +262,7 @@ private void inventoryPanel_Paint(object sender, PaintEventArgs e)
}

e.Graphics.FillRectangle(imageBrush, imageX, imageY, imageRect.Width, imageRect.Height);
e.Graphics.DrawString(inv.Quantity.ToString(), new Font("Consolas", 14, FontStyle.Bold), textBrush, textX, textY, invStringFormat);
e.Graphics.DrawString((inv.Quantity != -1) ? inv.Quantity.ToString() : "∞", new Font("Consolas", 14, FontStyle.Bold), textBrush, textX, textY, invStringFormat);
}
}
}
Expand Down Expand Up @@ -288,8 +292,8 @@ private void statisticsPanel_Paint(object sender, PaintEventArgs e)
heightOffset = 25; // Adding an additional offset to accomdate Raw IGT.
}

e.Graphics.DrawString(string.Format("Rank: {0}", Program.gameMem.Rank), new Font("Consolas", 9, FontStyle.Bold), Brushes.Gray, 0, heightOffset + (heightGap * ++i), stdStringFormat);
e.Graphics.DrawString(string.Format("Score: {0}", Program.gameMem.RankScore), new Font("Consolas", 9, FontStyle.Bold), Brushes.Gray, 0, heightOffset + (heightGap * ++i), stdStringFormat);
e.Graphics.DrawString(string.Format("DA Rank: {0}", Program.gameMem.Rank), new Font("Consolas", 9, FontStyle.Bold), Brushes.Gray, 0, heightOffset + (heightGap * ++i), stdStringFormat);
e.Graphics.DrawString(string.Format("DA Score: {0}", Program.gameMem.RankScore), new Font("Consolas", 9, FontStyle.Bold), Brushes.Gray, 0, heightOffset + (heightGap * ++i), stdStringFormat);

e.Graphics.DrawString("Enemies", new Font("Consolas", 10, FontStyle.Bold), Brushes.Red, 0, heightOffset + (heightGap * ++i), stdStringFormat);
foreach (EnemyHP enemyHP in Program.gameMem.EnemyHealth.Where(a => a.IsAlive).OrderBy(a => a.Percentage).ThenByDescending(a => a.CurrentHP))
Expand Down
4 changes: 2 additions & 2 deletions RE2REmakeSRT/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
10 changes: 10 additions & 0 deletions RE2REmakeSRT/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions RE2REmakeSRT/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,7 @@
<data name="ui0100_iam_texout" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ui0100_iam.texout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="_40d_texout" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\40d.texout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
3 changes: 3 additions & 0 deletions RE2REmakeSRT/RE2REmakeSRT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
<ItemGroup>
<None Include="Resources\ui0100_iam.texout.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\40d.texout.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' == '' Or '$(BuildingInsideVisualStudio)' == 'true'">
<PostBuildEvent>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\signtool.exe" sign /tr "http://timestamp.digicert.com" /td SHA1 /n "Travis J Gutjahr" /sm /fd SHA1 "$(TargetDir)\RE2REmakeSRT.exe"
Expand Down
Binary file added RE2REmakeSRT/Resources/40d.texout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ecb1ffd

Please sign in to comment.