- Fixed a problem in the linedef info panel where the linedef numbers was displayed instead of the sidedef number

- Fixed a problem where dragging geometry and things onto the window title bar locked up DB2
- Fixed a problem with wrong texture offsets of hi-res textures
This commit is contained in:
boris_i 2010-01-02 22:06:40 +00:00
parent ed9f393fb1
commit cdddeffa80
9 changed files with 71 additions and 10 deletions

View file

@ -145,7 +145,7 @@ namespace CodeImp.DoomBuilder.Controls
if(l.Front != null)
{
// Show sidedef info
frontpanel.Text = " Front Sidedef " + l.Index + " ";
frontpanel.Text = " Front Sidedef " + l.Front.Index + " ";
frontsector.Text = " Sector " + l.Front.Sector.Index;
frontsector.Visible = true;
frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY;
@ -181,7 +181,7 @@ namespace CodeImp.DoomBuilder.Controls
if(l.Back != null)
{
// Show sidedef info
backpanel.Text = " Back Sidedef " + l.Index + " ";
backpanel.Text = " Back Sidedef " + l.Back.Index + " ";
backsector.Text = " Sector " + l.Back.Sector.Index;
backsector.Visible = true;
backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;

View file

@ -344,6 +344,13 @@ namespace CodeImp.DoomBuilder.Geometry
double ry = sin * x + cos * y;
return new Vector2D((float)rx, (float)ry);
}
// Checks if the Vector has valid values for x and y
public bool IsFinite()
{
return !float.IsNaN(x) && !float.IsNaN(y) && !float.IsInfinity(x) && !float.IsInfinity(y);
}
#endregion
}
}

View file

@ -283,6 +283,13 @@ namespace CodeImp.DoomBuilder.Geometry
{
return x + ", " + y + ", " + z;
}
// Checks if the Vector has valid values for x, y and z
public bool IsFinite()
{
return !float.IsNaN(x) && !float.IsNaN(y) && !float.IsNaN(z) && !float.IsInfinity(x) && !float.IsInfinity(y) && !float.IsInfinity(z);
}
#endregion
}

View file

@ -166,6 +166,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D oldpos = dragitem.Position;
Vector2D anchorpos = dragitemposition + offset;
int i = 0;
// don't move if the offset contains invalid data
if (!offset.IsFinite()) return false;
// Snap to nearest?
if(snapnearest)

View file

@ -158,6 +158,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D oldpos = dragitem.Position;
Thing nearest;
int i = 0;
// don't move if the offset contains invalid data
if (!offset.IsFinite()) return false;
// Snap to nearest?
if(snapnearest)

View file

@ -114,8 +114,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
t2.y = t1.y + geoheight;
// Apply texture offset
t1 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
t2 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
if (General.Map.Config.ScaledTextureOffsets)
{
t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
}
else
{
t1 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
t2 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
}
// Transform pixel coordinates to texture coordinates
t1 /= tsz;

View file

@ -111,7 +111,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
textop = geotop;
// Apply texture offset
textop += Sidedef.OffsetY;
if (General.Map.Config.ScaledTextureOffsets)
{
textop += Sidedef.OffsetY * base.Texture.Scale.y;
}
else
{
textop += Sidedef.OffsetY;
}
// Calculate texture portion bottom
texbottom = textop - tsz.y;
@ -126,7 +134,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Determine texture coordinatess
t1.y = cliptop;
t2.y = tsz.y - clipbottom;
t1.x = Sidedef.OffsetX;
if (General.Map.Config.ScaledTextureOffsets)
{
t1.x = Sidedef.OffsetX * base.Texture.Scale.x;
}
else
{
t1.x = Sidedef.OffsetX;
}
t2.x = t1.x + Sidedef.Line.Length;
// Transform pixel coordinates to texture coordinates

View file

@ -114,8 +114,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
t2.y = t1.y + geoheight;
// Apply texture offset
t1 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
t2 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
if (General.Map.Config.ScaledTextureOffsets)
{
t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
}
else
{
t1 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
t2 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
}
// Transform pixel coordinates to texture coordinates
t1 /= tsz;

View file

@ -114,8 +114,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
t2.y = t1.y + geoheight;
// Apply texture offset
t1 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
t2 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
if (General.Map.Config.ScaledTextureOffsets)
{
t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
}
else
{
t1 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
t2 += new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
}
// Transform pixel coordinates to texture coordinates
t1 /= tsz;