- edit selection mode now also rotates thing angles

- edit selection mode now shows a rectangle selection that covers also the thing sizes
- fixed right-click to start drawing mode from linedefs mode
- fixed floor and ceiling texture coordinates in both classic modes and visual mode
This commit is contained in:
codeimp 2009-01-04 13:58:26 +00:00
parent caada1aa57
commit 851a7c7895
6 changed files with 23 additions and 22 deletions

View file

@ -3,20 +3,10 @@ quality over quantity. It is done when it's done.
The order and included items may also change any time.
=========================================================
- Info panel should be collapsable
- Create menus for different modes
- Create gradient ceiling/floor heights feature
- Fix flats alignment in Visual Mode (possibly also in Classic Modes)
- Fix flat texture coordinates in Classic Modes (some flats/textures on floors appear stretched or shrinked)
- Right-click in empty space in Linedefs mode does weird.
- Edit Selection mode does not take size of things into account.
- Set up forum for bug reports and development.
- Test map nomonsters option in same menu

View file

@ -99,6 +99,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private ICollection<Linedef> selectedlines;
private List<Vector2D> vertexpos;
private List<Vector2D> thingpos;
private List<float> thingangle;
private ICollection<Vertex> unselectedvertices;
private ICollection<Linedef> unselectedlines;
@ -494,6 +495,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
index = 0;
foreach(Thing t in selectedthings)
{
t.Rotate(Angle2D.Normalized(thingangle[index] + rotation));
t.Move(TransformedPoint(thingpos[index++]));
}
@ -621,6 +623,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Array to keep original coordinates
vertexpos = new List<Vector2D>(selectedvertices.Count);
thingpos = new List<Vector2D>(selectedthings.Count);
thingangle = new List<float>(selectedthings.Count);
// A selection must be made!
if((selectedvertices.Count > 0) || (selectedthings.Count > 0))
@ -647,13 +650,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Thing t in selectedthings)
{
// Find left-top and right-bottom
if(t.Position.x < offset.x) offset.x = t.Position.x;
if(t.Position.y < offset.y) offset.y = t.Position.y;
if(t.Position.x > right.x) right.x = t.Position.x;
if(t.Position.y > right.y) right.y = t.Position.y;
if((t.Position.x - t.Size) < offset.x) offset.x = t.Position.x - t.Size;
if((t.Position.y - t.Size) < offset.y) offset.y = t.Position.y - t.Size;
if((t.Position.x + t.Size) > right.x) right.x = t.Position.x + t.Size;
if((t.Position.y + t.Size) > right.y) right.y = t.Position.y + t.Size;
// Keep original coordinates
thingpos.Add(t.Position);
thingangle.Add(t.Angle);
}
// Calculate size
@ -726,7 +730,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
index = 0;
foreach(Thing t in selectedthings)
{
t.Rotate(thingangle[index]);
t.Move(thingpos[index++]);
}
General.Map.Map.Update(true, true);
@ -754,7 +761,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
index = 0;
foreach(Thing t in selectedthings)
{
t.Rotate(thingangle[index]);
t.Move(thingpos[index++]);
}
// Make undo
General.Map.UndoRedo.CreateUndo("Edit selection");

View file

@ -346,6 +346,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
bool snaptonearest = General.Interface.CtrlState ^ General.Interface.AutoMerge;
DrawnVertex v = DrawGeometryMode.GetCurrentPosition(mousemappos, snaptonearest, snaptogrid, renderer, new List<DrawnVertex>());
drawmode.DrawPointAt(v);
General.Editing.ChangeMode(drawmode);
}
base.OnEditBegin();

View file

@ -134,7 +134,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override void OnSectorFloorSurfaceUpdate(Sector s, ref FlatVertex[] vertices)
{
ImageData img = General.Map.Data.GetFlatImage(s.LongFloorTexture);
if(img != null)
if((img != null) && img.IsImageLoaded)
{
// Make scalars
float sw = 1.0f / img.ScaledWidth;
@ -144,7 +144,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
for(int i = 0; i < vertices.Length; i++)
{
vertices[i].u = vertices[i].u * sw;
vertices[i].v = vertices[i].v * sw;
vertices[i].v = -vertices[i].v * sh;
}
}
}
@ -153,7 +153,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override void OnSectorCeilingSurfaceUpdate(Sector s, ref FlatVertex[] vertices)
{
ImageData img = General.Map.Data.GetFlatImage(s.LongCeilTexture);
if(img != null)
if((img != null) && img.IsImageLoaded)
{
// Make scalars
float sw = 1.0f / img.ScaledWidth;
@ -163,7 +163,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
for(int i = 0; i < vertices.Length; i++)
{
vertices[i].u = vertices[i].u * sw;
vertices[i].v = vertices[i].v * sw;
vertices[i].v = -vertices[i].v * sh;
}
}
}

View file

@ -88,12 +88,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(base.Texture.IsImageLoaded)
{
verts[i].u = s.Triangles.Vertices[i].x / base.Texture.ScaledWidth;
verts[i].v = s.Triangles.Vertices[i].y / base.Texture.ScaledHeight;
verts[i].v = -s.Triangles.Vertices[i].y / base.Texture.ScaledHeight;
}
else
{
verts[i].u = s.Triangles.Vertices[i].x / 64;
verts[i].v = s.Triangles.Vertices[i].y / 64;
verts[i].v = -s.Triangles.Vertices[i].y / 64;
}
// Vertex coordinates

View file

@ -87,12 +87,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(base.Texture.IsImageLoaded)
{
verts[i].u = s.Triangles.Vertices[i].x / base.Texture.ScaledWidth;
verts[i].v = s.Triangles.Vertices[i].y / base.Texture.ScaledHeight;
verts[i].v = -s.Triangles.Vertices[i].y / base.Texture.ScaledHeight;
}
else
{
verts[i].u = s.Triangles.Vertices[i].x / 64;
verts[i].v = s.Triangles.Vertices[i].y / 64;
verts[i].v = -s.Triangles.Vertices[i].y / 64;
}
// Vertex coordinates