mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-29 07:01:55 +00:00
Fixed an issue where sprite offsets defined in TEXTURES were not used
This commit is contained in:
parent
f34ab6a606
commit
085df399f5
5 changed files with 10 additions and 22 deletions
|
@ -48,6 +48,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
protected long longname;
|
||||
protected int width;
|
||||
protected int height;
|
||||
protected int offsetx;
|
||||
protected int offsety;
|
||||
protected Vector2D scale;
|
||||
protected bool worldpanning;
|
||||
private bool usecolorcorrection;
|
||||
|
@ -141,6 +143,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public int MipMapLevels { get { return mipmaplevels; } set { mipmaplevels = value; } }
|
||||
public virtual int Width { get { return width; } }
|
||||
public virtual int Height { get { return height; } }
|
||||
public int OffsetX { get { return offsetx; } }
|
||||
public int OffsetY { get { return offsety; } }
|
||||
//mxd. Scaled texture size is integer in ZDoom.
|
||||
public virtual float ScaledWidth { get { return (float)Math.Round(width * scale.x); } }
|
||||
public virtual float ScaledHeight { get { return (float)Math.Round(height * scale.y); } }
|
||||
|
|
|
@ -35,20 +35,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
public sealed class SpriteImage : ImageData, ISpriteImage
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
private int offsetx;
|
||||
private int offsety;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public int OffsetX { get { return offsetx; } }
|
||||
public int OffsetY { get { return offsety; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
|
|
|
@ -52,12 +52,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public TEXTURESImage(string name, string virtualpath, int width, int height, float scalex, float scaley,
|
||||
public TEXTURESImage(string name, string virtualpath, int width, int height, int offsetx, int offsety, float scalex, float scaley,
|
||||
bool worldpanning, TextureNamespace texturenamespace, bool optional, bool nulltexture)
|
||||
{
|
||||
// Initialize
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.offsetx = offsetx;
|
||||
this.offsety = offsety;
|
||||
this.scale.x = scalex;
|
||||
this.scale.y = scaley;
|
||||
this.worldpanning = worldpanning;
|
||||
|
|
|
@ -249,7 +249,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
float scaley = ((yscale == 0.0f) ? General.Map.Config.DefaultTextureScale : 1f / yscale);
|
||||
|
||||
// Make texture
|
||||
TEXTURESImage tex = new TEXTURESImage(name, virtualpath, width, height, scalex, scaley, worldpanning, texturenamespace, optional, nulltexture);
|
||||
TEXTURESImage tex = new TEXTURESImage(name, virtualpath, width, height, xoffset, yoffset, scalex, scaley, worldpanning, texturenamespace, optional, nulltexture);
|
||||
|
||||
// Add patches
|
||||
foreach(PatchStructure p in patches) tex.AddPatch(new TexturePatch(p));//mxd
|
||||
|
|
|
@ -322,12 +322,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Determine sprite size and offset
|
||||
float radius = sprite.ScaledWidth * 0.5f;
|
||||
float height = sprite.ScaledHeight;
|
||||
ISpriteImage spriteimg = sprite as ISpriteImage;
|
||||
if(spriteimg != null)
|
||||
{
|
||||
offsets.x = radius - spriteimg.OffsetX;
|
||||
offsets.y = spriteimg.OffsetY - height;
|
||||
}
|
||||
offsets.x = radius - sprite.OffsetX;
|
||||
offsets.y = sprite.OffsetY - height;
|
||||
|
||||
// Scale by thing type/actor scale
|
||||
// We do this after the offset x/y determination above, because that is entirely in sprite pixels space
|
||||
|
|
Loading…
Reference in a new issue