mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-01-12 12:26:31 -05:00
Fixed menu rendering
This commit is contained in:
parent
03dc82f874
commit
77c4621295
@ -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; }
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,5 +86,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\MPQEditor.exe" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user