diff --git a/OpenDiablo2.Common/Interfaces/ISprite.cs b/OpenDiablo2.Common/Interfaces/ISprite.cs
index 622a69fa..1c4c6475 100644
--- a/OpenDiablo2.Common/Interfaces/ISprite.cs
+++ b/OpenDiablo2.Common/Interfaces/ISprite.cs
@@ -8,6 +8,7 @@ namespace OpenDiablo2.Common.Interfaces
{
Point Location { get; set; }
Size FrameSize { get; set; }
+ Size LocalFrameSize { get; }
int Frame { get; set; }
int TotalFrames { get; }
Palette CurrentPalette { get; set; }
diff --git a/OpenDiablo2.Common/Models/ImageSet.cs b/OpenDiablo2.Common/Models/ImageSet.cs
index d82fd223..c6349c98 100644
--- a/OpenDiablo2.Common/Models/ImageSet.cs
+++ b/OpenDiablo2.Common/Models/ImageSet.cs
@@ -67,7 +67,7 @@ namespace OpenDiablo2.Common.Models
{
stream.Seek(result.framePointers[i], SeekOrigin.Begin);
- var frame = new ImageFrame
+ result.Frames[i] = new ImageFrame
{
Flip = br.ReadUInt32(),
Width = br.ReadUInt32(),
@@ -79,14 +79,14 @@ namespace OpenDiablo2.Common.Models
Length = br.ReadUInt32()
};
- frame.ImageData = new Int16[frame.Width, frame.Height];
- for (int ty = 0; ty < frame.Height; ty++)
- for (int tx = 0; tx < frame.Width; tx++)
- frame.ImageData[tx, ty] = -1;
+ result.Frames[i].ImageData = new Int16[result.Frames[i].Width, result.Frames[i].Height];
+ for (int ty = 0; ty < result.Frames[i].Height; ty++)
+ for (int tx = 0; tx < result.Frames[i].Width; tx++)
+ result.Frames[i].ImageData[tx, ty] = -1;
int x = 0;
- int y = (int)frame.Height - 1;
+ int y = (int)result.Frames[i].Height - 1;
while (true)
{
var b = br.ReadByte();
@@ -105,7 +105,7 @@ namespace OpenDiablo2.Common.Models
var transparentPixelsToWrite = b & 0x7F;
for (int p = 0; p < transparentPixelsToWrite; p++)
{
- frame.ImageData[x++, y] = -1;
+ result.Frames[i].ImageData[x++, y] = -1;
}
continue;
}
@@ -113,11 +113,10 @@ namespace OpenDiablo2.Common.Models
for (int p = 0; p < b; p++)
{
- frame.ImageData[x++, y] = br.ReadByte();
+ result.Frames[i].ImageData[x++, y] = br.ReadByte();
}
}
- result.Frames[i] = frame;
}
diff --git a/OpenDiablo2.Core/OpenDiablo2.Core.csproj b/OpenDiablo2.Core/OpenDiablo2.Core.csproj
index 9b87a6fa..c3f8411c 100644
--- a/OpenDiablo2.Core/OpenDiablo2.Core.csproj
+++ b/OpenDiablo2.Core/OpenDiablo2.Core.csproj
@@ -86,5 +86,8 @@
+
+
+
\ No newline at end of file
diff --git a/OpenDiablo2.SDL2/SDL2Sprite.cs b/OpenDiablo2.SDL2/SDL2Sprite.cs
index abcaacd8..d15230a9 100644
--- a/OpenDiablo2.SDL2/SDL2Sprite.cs
+++ b/OpenDiablo2.SDL2/SDL2Sprite.cs
@@ -50,6 +50,8 @@ namespace OpenDiablo2.SDL2_
(Location.Y - FrameSize.Height) + source.Frames[Frame].OffsetY
);
+ public Size LocalFrameSize => new Size((int)source.Frames[Frame].Width, (int)source.Frames[Frame].Height);
+
private void UpdateTextureData()
{
foreach (var texture in textures)
diff --git a/OpenDiablo2.Scenes/MainMenu.cs b/OpenDiablo2.Scenes/MainMenu.cs
index 19def179..4dce7f27 100644
--- a/OpenDiablo2.Scenes/MainMenu.cs
+++ b/OpenDiablo2.Scenes/MainMenu.cs
@@ -97,13 +97,16 @@ namespace OpenDiablo2.Scenes
renderWindow.Clear();
for (int y = 0; y < 3; y++)
+ {
for (int x = 0; x < 4; x++)
{
backgroundSprite.Frame = x + (y * 4);
- backgroundSprite.Location = new Point(x * backgroundSprite.FrameSize.Width, (y + 1) * backgroundSprite.FrameSize.Height);
+ backgroundSprite.Location = new Point(x * 256, ((y+1) * 256) - (backgroundSprite.FrameSize.Height - backgroundSprite.LocalFrameSize.Height));
renderWindow.Draw(backgroundSprite);
}
+ }
+
diabloLogoLeftBlack.Frame = (int)((float)diabloLogoLeftBlack.TotalFrames * logoFrame);
renderWindow.Draw(diabloLogoLeftBlack);
diabloLogoRightBlack.Frame = (int)((float)diabloLogoRightBlack.TotalFrames * logoFrame);