Fixed sprite offsets (for PNGs we just use zero offset)

This commit is contained in:
codeimp 2009-03-18 10:19:44 +00:00
parent cb5a6234cc
commit 0cef612562
4 changed files with 13 additions and 6 deletions

View file

@ -113,6 +113,13 @@ namespace CodeImp.DoomBuilder.Data
height = bitmap.Size.Height; height = bitmap.Size.Height;
scaledwidth = (float)bitmap.Size.Width; scaledwidth = (float)bitmap.Size.Width;
scaledheight = (float)bitmap.Size.Height; scaledheight = (float)bitmap.Size.Height;
// Make offset corrections if the offset was not given
if((offsetx == int.MinValue) || (offsety == int.MinValue))
{
offsetx = (int)(scaledwidth * 0.5f);
offsety = (int)scaledheight;
}
} }
else else
{ {

View file

@ -85,8 +85,8 @@ namespace CodeImp.DoomBuilder.IO
// Returns null on failure // Returns null on failure
public Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety) public Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety)
{ {
offsetx = 0; offsetx = int.MinValue;
offsety = 0; offsety = int.MinValue;
return ReadAsBitmap(stream); return ReadAsBitmap(stream);
} }

View file

@ -52,8 +52,8 @@ namespace CodeImp.DoomBuilder.IO
// Returns null on failure // Returns null on failure
public Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety) public Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety)
{ {
offsetx = 0; offsetx = int.MinValue;
offsety = 0; offsety = int.MinValue;
return ReadAsBitmap(stream); return ReadAsBitmap(stream);
} }

View file

@ -52,8 +52,8 @@ namespace CodeImp.DoomBuilder.IO
// Returns null on failure // Returns null on failure
public Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety) public Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety)
{ {
offsetx = 0; offsetx = int.MinValue;
offsety = 0; offsety = int.MinValue;
return ReadAsBitmap(stream); return ReadAsBitmap(stream);
} }