mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Added "Sector Floor Flat" and "Sector Ceiling Flat" Find and Replace modes.
Updated skybox model to better match GZDoom's skybox. Also the sky texture was flipped horizontally. Fixed, Visual mode: "Select with the same texture" action is now able to select sidedef parts only visible because of slopes. Fixed, Visual mode: skybox texture was not updated after using "Open map in current wad" action. Fixed, Visual mode: in some cases Visual camera was placed below sector's floor when "Sync camera position between 2D and 3D modes" setting was enabled. Fixed: numeric thing flags with inverted UDMF flag defined in "thingflagstranslation" Game configuration block were lost when copy-pasting a thing. Fixed, command line arguments: fixed a crash when loading a map from a wad with existing .dbs file.
This commit is contained in:
parent
ada38c4454
commit
998ec3bccc
20 changed files with 221 additions and 292 deletions
|
@ -2359,7 +2359,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
#region ================== mxd. Skybox Making
|
||||
|
||||
private void SetupSkybox()
|
||||
internal void SetupSkybox()
|
||||
{
|
||||
// Get rid of old texture
|
||||
if(skybox != null) skybox.Dispose(); skybox = null;
|
||||
|
@ -2526,6 +2526,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
else if(img.Height < 241) yscale = 1.0f + ((img.Height - 200.0f) / 200.0f) * 1.17f;
|
||||
else yscale = 1.2f * 1.17f;
|
||||
|
||||
// I guess my sky model doesn't exactly match the one GZDoom generates...
|
||||
yscale *= 1.65f;
|
||||
|
||||
// Make cubemap texture
|
||||
CubeTexture cubemap = new CubeTexture(device, cubemaptexsize, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
|
||||
Surface sysmemsurf = Surface.CreateOffscreenPlain(device, cubemaptexsize, cubemaptexsize, Format.A8R8G8B8, Pool.SystemMemory);
|
||||
|
|
|
@ -595,12 +595,10 @@ namespace CodeImp.DoomBuilder
|
|||
// Remove the previous log file and start logging
|
||||
if(File.Exists(logfile)) File.Delete(logfile);
|
||||
General.WriteLogLine("GZDoom Builder R" + thisasm.GetName().Version.Revision + " startup"); //mxd
|
||||
General.WriteLogLine("Application path: " + apppath);
|
||||
General.WriteLogLine("Temporary path: " + temppath);
|
||||
General.WriteLogLine("Local settings path: " + settingspath);
|
||||
General.WriteLogLine("Command-line arguments: " + args.Length);
|
||||
for(int i = 0; i < args.Length; i++)
|
||||
General.WriteLogLine("Argument " + i + ": \"" + args[i] + "\"");
|
||||
General.WriteLogLine("Application path: \"" + apppath + "\"");
|
||||
General.WriteLogLine("Temporary path: \"" + temppath + "\"");
|
||||
General.WriteLogLine("Local settings path: \"" + settingspath + "\"");
|
||||
General.WriteLogLine("Command-line arguments: \"" + string.Join(" ", args) + "\""); //mxd
|
||||
|
||||
// Load configuration
|
||||
General.WriteLogLine("Loading program configuration...");
|
||||
|
|
|
@ -470,7 +470,7 @@ namespace CodeImp.DoomBuilder
|
|||
#endif
|
||||
|
||||
this.changed = false;
|
||||
this.maploading = true; //mxd
|
||||
this.maploading = true;
|
||||
this.options = options;
|
||||
|
||||
// Create map data
|
||||
|
@ -512,27 +512,30 @@ namespace CodeImp.DoomBuilder
|
|||
// Close the map file
|
||||
mapwad.Dispose();
|
||||
|
||||
//mxd. Create MapSet
|
||||
// Create MapSet
|
||||
bool maprestored;
|
||||
if(!CreateMapSet(newmap, filepathname, options, out maprestored)) return false;
|
||||
|
||||
//mxd. And switch to it
|
||||
// And switch to it
|
||||
ChangeMapSet(newmap);
|
||||
|
||||
//mxd. Translate texture names
|
||||
// Translate texture names
|
||||
map.TranslateTextureNames(config.UseLongTextureNames, false);
|
||||
grid.TranslateBackgroundName(config.UseLongTextureNames);
|
||||
|
||||
//mxd. Sector textures may've been changed
|
||||
// Sector textures may've been changed
|
||||
data.UpdateUsedTextures();
|
||||
|
||||
//mxd. Update includes list and script names
|
||||
// Skybox may've been changed
|
||||
data.SetupSkybox();
|
||||
|
||||
// Update includes list and script names
|
||||
UpdateScriptNames(true);
|
||||
|
||||
//mxd. Restore selection groups
|
||||
// Restore selection groups
|
||||
options.ReadSelectionGroups();
|
||||
|
||||
//mxd. Center map in screen or on stored coordinates
|
||||
// Center map in screen or on stored coordinates
|
||||
if(General.Editing.Mode is ClassicMode)
|
||||
{
|
||||
ClassicMode mode = General.Editing.Mode as ClassicMode;
|
||||
|
@ -546,9 +549,9 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Success
|
||||
this.changed = maprestored;
|
||||
this.maploading = false; //mxd
|
||||
this.maploading = false;
|
||||
General.WriteLogLine("Map switching done");
|
||||
General.MainWindow.UpdateMapChangedStatus(); //mxd
|
||||
General.MainWindow.UpdateMapChangedStatus();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
//flags
|
||||
Dictionary<string, bool> stringflags = new Dictionary<string, bool>(StringComparer.Ordinal);
|
||||
int numFlags = reader.ReadInt32();
|
||||
for(int f = 0; f < numFlags; f++) stringflags.Add(ReadString(reader), true);
|
||||
for(int f = 0; f < numFlags; f++) stringflags.Add(ReadString(reader), reader.ReadBoolean());
|
||||
|
||||
//add missing flags
|
||||
foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags)
|
||||
|
|
|
@ -298,22 +298,15 @@ namespace CodeImp.DoomBuilder.IO
|
|||
}
|
||||
}
|
||||
|
||||
private static void AddFlags(Dictionary<string, bool> elementFlags, BinaryWriter writer)
|
||||
private static void AddFlags(Dictionary<string, bool> flags, BinaryWriter writer)
|
||||
{
|
||||
List<string> flags = new List<string>();
|
||||
|
||||
foreach(KeyValuePair<string, bool> f in elementFlags)
|
||||
{
|
||||
if(!f.Value) continue;
|
||||
flags.Add(f.Key);
|
||||
}
|
||||
|
||||
writer.Write(flags.Count);
|
||||
|
||||
foreach(string s in flags)
|
||||
foreach(KeyValuePair<string, bool> group in flags)
|
||||
{
|
||||
writer.Write(s.Length);
|
||||
writer.Write(s.ToCharArray());
|
||||
writer.Write(group.Key.Length);
|
||||
writer.Write(group.Key.ToCharArray());
|
||||
writer.Write(group.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -188,20 +188,12 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
if(nearestsector != null)
|
||||
{
|
||||
int sectorheight = nearestsector.CeilHeight - nearestsector.FloorHeight;
|
||||
if(General.Map.VisualCamera.Position.z < nearestsector.FloorHeight + 41)
|
||||
{
|
||||
if(sectorheight < 41)
|
||||
posz = nearestsector.FloorHeight + sectorheight / 2;
|
||||
else
|
||||
posz = nearestsector.FloorHeight + 41; // same as in doom
|
||||
}
|
||||
if(sectorheight < 41)
|
||||
posz = nearestsector.FloorHeight + Math.Max(16, sectorheight / 2);
|
||||
else if(General.Map.VisualCamera.Position.z < nearestsector.FloorHeight + 41)
|
||||
posz = nearestsector.FloorHeight + 41; // same as in doom
|
||||
else if(General.Map.VisualCamera.Position.z > nearestsector.CeilHeight)
|
||||
{
|
||||
if(sectorheight < 41)
|
||||
posz = nearestsector.FloorHeight + sectorheight / 2;
|
||||
else
|
||||
posz = nearestsector.CeilHeight - 4;
|
||||
}
|
||||
posz = nearestsector.CeilHeight - 4;
|
||||
}
|
||||
|
||||
General.Map.VisualCamera.Position = new Vector3D(initialcameraposition.x, initialcameraposition.y, posz);
|
||||
|
|
|
@ -495,7 +495,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Window is first shown
|
||||
private void MainForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
// Perform auto mapo loading action when the window is not delayed
|
||||
// Perform auto map loading action when the window is not delayed
|
||||
if(!General.DelayMainWindow) PerformAutoMapLoading();
|
||||
}
|
||||
|
||||
|
@ -532,9 +532,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
//TODO: test this!
|
||||
Configuration gamecfg = new Configuration(configfile);
|
||||
longtexturenamessupported = gamecfg.ReadSetting("longtexturenames", false);
|
||||
// Get if long texture names are supported from the game configuration
|
||||
ConfigurationInfo configinfo = General.GetConfigurationInfo(configfile);
|
||||
longtexturenamessupported = configinfo.Configuration.ReadSetting("longtexturenames", false);
|
||||
}
|
||||
|
||||
// Set map name and other options
|
||||
|
|
|
@ -280,8 +280,10 @@
|
|||
<Compile Include="FindReplace\BaseFindThing.cs" />
|
||||
<Compile Include="FindReplace\FindLinedefFlags.cs" />
|
||||
<Compile Include="FindReplace\FindSectorBrightness.cs" />
|
||||
<Compile Include="FindReplace\FindSectorCeilingFlat.cs" />
|
||||
<Compile Include="FindReplace\FindSectorCeilingHeight.cs" />
|
||||
<Compile Include="FindReplace\FindSectorFlags.cs" />
|
||||
<Compile Include="FindReplace\FindSectorFloorFlat.cs" />
|
||||
<Compile Include="FindReplace\FindSectorFloorHeight.cs" />
|
||||
<Compile Include="FindReplace\FindSidedefFlags.cs" />
|
||||
<Compile Include="FindReplace\FindThingAngle.cs" />
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#region ================== Namespaces
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[FindReplace("Sector Ceiling Flat", BrowseButton = true)]
|
||||
internal class FindSectorCeilingFlat : FindSectorFlat
|
||||
{
|
||||
#region ================== Methods
|
||||
|
||||
// This is called to perform a search (and replace)
|
||||
// Returns a list of items to show in the results list
|
||||
// replacewith is null when not replacing
|
||||
public override FindReplaceObject[] Find(string value, bool withinselection, bool replace, string replacewith, bool keepselection)
|
||||
{
|
||||
List<FindReplaceObject> objs = new List<FindReplaceObject>();
|
||||
|
||||
// Interpret the replacement
|
||||
if(replace && (string.IsNullOrEmpty(replacewith) || replacewith.Length > General.Map.Config.MaxTextureNameLength))
|
||||
{
|
||||
MessageBox.Show("Invalid replace value for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return objs.ToArray();
|
||||
}
|
||||
|
||||
// Interpret the find
|
||||
bool isregex = (value.IndexOf('*') != -1 || value.IndexOf('?') != -1); //mxd
|
||||
MatchingTextureSet set = new MatchingTextureSet(new Collection<string> { value.Trim() }); //mxd
|
||||
|
||||
// Where to search?
|
||||
ICollection<Sector> list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors;
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in list)
|
||||
{
|
||||
// Ceiling flat matches?
|
||||
if(set.IsMatch(s.CeilTexture))
|
||||
{
|
||||
// Replace and add to list
|
||||
if(replace) s.SetCeilTexture(replacewith);
|
||||
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (ceiling)" + (isregex ? " - " + s.CeilTexture : null)));
|
||||
}
|
||||
}
|
||||
|
||||
// When replacing, make sure we keep track of used textures
|
||||
if(replace)
|
||||
{
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
General.Map.Map.Update(); //mxd. And don't forget to update the view itself
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
return objs.ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
#region ================== Namespaces
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[FindReplace("Sector Floor Flat", BrowseButton = true)]
|
||||
internal class FindSectorFloorFlat : FindSectorFlat
|
||||
{
|
||||
#region ================== Methods
|
||||
|
||||
// This is called to perform a search (and replace)
|
||||
// Returns a list of items to show in the results list
|
||||
// replacewith is null when not replacing
|
||||
public override FindReplaceObject[] Find(string value, bool withinselection, bool replace, string replacewith, bool keepselection)
|
||||
{
|
||||
List<FindReplaceObject> objs = new List<FindReplaceObject>();
|
||||
|
||||
// Interpret the replacement
|
||||
if(replace && (string.IsNullOrEmpty(replacewith) || replacewith.Length > General.Map.Config.MaxTextureNameLength))
|
||||
{
|
||||
MessageBox.Show("Invalid replace value for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return objs.ToArray();
|
||||
}
|
||||
|
||||
// Interpret the find
|
||||
bool isregex = (value.IndexOf('*') != -1 || value.IndexOf('?') != -1); //mxd
|
||||
MatchingTextureSet set = new MatchingTextureSet(new Collection<string> { value.Trim() }); //mxd
|
||||
|
||||
// Where to search?
|
||||
ICollection<Sector> list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors;
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in list)
|
||||
{
|
||||
// Floor flat matches?
|
||||
if(set.IsMatch(s.FloorTexture))
|
||||
{
|
||||
// Replace and add to list
|
||||
if(replace) s.SetFloorTexture(replacewith);
|
||||
objs.Add(new FindReplaceObject(s, "Sector " + s.Index + " (floor)" + (isregex ? " - " + s.FloorTexture : null)));
|
||||
}
|
||||
}
|
||||
|
||||
// When replacing, make sure we keep track of used textures
|
||||
if(replace)
|
||||
{
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
General.Map.Map.Update(); //mxd. And don't forget to update the view itself
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
return objs.ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ using System.Drawing;
|
|||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
|
||||
|
@ -113,37 +114,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
#region ================== Sidedef
|
||||
|
||||
internal static Rectangle GetSidedefPartSize(BaseVisualGeometrySidedef side)
|
||||
internal static Rectangle GetSidedefPartSize(BaseVisualGeometrySidedef side)
|
||||
{
|
||||
if(side.GeometryType == VisualGeometryType.WALL_MIDDLE_3D)
|
||||
{
|
||||
Rectangle rect = new Rectangle(0, 0, Math.Max(1, (int)Math.Round(side.Sidedef.Line.Length)), 0);
|
||||
Linedef cl = side.GetControlLinedef();
|
||||
|
||||
if(cl.Front != null && cl.Front.Sector != null)
|
||||
{
|
||||
// Use floor height for vavoom-type 3d floors, because FloorHeight should be > CeilHeight for this type of 3d floor.
|
||||
if(cl.Args[1] == 0)
|
||||
{
|
||||
rect.Y = -cl.Front.Sector.FloorHeight;
|
||||
rect.Height = cl.Front.Sector.FloorHeight - cl.Front.Sector.CeilHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.Y = -cl.Front.Sector.CeilHeight;
|
||||
rect.Height = cl.Front.GetMiddleHeight();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.Y = -side.Sidedef.Sector.CeilHeight;
|
||||
rect.Height = side.Sidedef.GetMiddleHeight();
|
||||
}
|
||||
// We are interested in width, height and vertical position only
|
||||
float miny = float.MaxValue;
|
||||
float maxy = float.MinValue;
|
||||
|
||||
return rect;
|
||||
foreach(WorldVertex v in side.Vertices)
|
||||
{
|
||||
if(v.z < miny) miny = v.z;
|
||||
else if(v.z > maxy) maxy = v.z;
|
||||
}
|
||||
|
||||
return GetSidedefPartSize(side.Sidedef, side.GeometryType);
|
||||
return new Rectangle(0, (int)Math.Round(-maxy), Math.Max(1, (int)Math.Round(side.Sidedef.Line.Length)), (int)Math.Round(maxy - miny));
|
||||
}
|
||||
|
||||
public static Rectangle GetSidedefPartSize(Sidedef side, VisualGeometryType type)
|
||||
|
|
|
@ -526,9 +526,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd
|
||||
protected void SelectNeighbours(long longtexture, bool select, bool withSameTexture, bool withSameHeight)
|
||||
public void SelectNeighbours(bool select, bool matchtexture, bool matchheight)
|
||||
{
|
||||
if(Sidedef.Sector == null || Triangles < 1 || (!withSameTexture && !withSameHeight)) return;
|
||||
if(Sidedef.Sector == null || Triangles < 1 || (!matchtexture && !matchheight)) return;
|
||||
|
||||
Rectangle rect = BuilderModesTools.GetSidedefPartSize(this);
|
||||
if(rect.Height == 0) return;
|
||||
|
@ -544,169 +544,57 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
mode.RemoveSelectedObject(this);
|
||||
}
|
||||
|
||||
//select
|
||||
List<Linedef> connectedLines = new List<Linedef>();
|
||||
// Select
|
||||
SelectNeighbourLines(Sidedef.Line.Start.Linedefs, rect, select, matchtexture, matchheight);
|
||||
SelectNeighbourLines(Sidedef.Line.End.Linedefs, rect, select, matchtexture, matchheight);
|
||||
}
|
||||
|
||||
foreach(Linedef line in Sidedef.Line.Start.Linedefs)
|
||||
//mxd
|
||||
private void SelectNeighbourLines(IEnumerable<Linedef> lines, Rectangle sourcerect, bool select, bool matchtexture, bool matchheight)
|
||||
{
|
||||
foreach(Linedef line in lines)
|
||||
{
|
||||
if(line.Index == Sidedef.Line.Index) continue;
|
||||
connectedLines.Add(line);
|
||||
|
||||
if(line.Front != null && line.Front.Sector != null)
|
||||
SelectNeighbourSideParts(line.Front, sourcerect, select, matchtexture, matchheight);
|
||||
|
||||
if(line.Back != null && line.Back.Sector != null)
|
||||
SelectNeighbourSideParts(line.Back, sourcerect, select, matchtexture, matchheight);
|
||||
}
|
||||
foreach(Linedef line in Sidedef.Line.End.Linedefs)
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void SelectNeighbourSideParts(Sidedef side, Rectangle sourcerect, bool select, bool matchtexture, bool matchheight)
|
||||
{
|
||||
BaseVisualSector s = mode.GetVisualSector(side.Sector) as BaseVisualSector;
|
||||
if(s != null)
|
||||
{
|
||||
if(line.Index == Sidedef.Line.Index) continue;
|
||||
if(!connectedLines.Contains(line)) connectedLines.Add(line);
|
||||
VisualSidedefParts parts = s.GetSidedefParts(side);
|
||||
SelectNeighbourSidePart(parts.lower, sourcerect, select, matchtexture, matchheight);
|
||||
SelectNeighbourSidePart(parts.middlesingle, sourcerect, select, matchtexture, matchheight);
|
||||
SelectNeighbourSidePart(parts.middledouble, sourcerect, select, matchtexture, matchheight);
|
||||
SelectNeighbourSidePart(parts.upper, sourcerect, select, matchtexture, matchheight);
|
||||
|
||||
if(parts.middle3d != null)
|
||||
{
|
||||
foreach(VisualMiddle3D middle3D in parts.middle3d)
|
||||
SelectNeighbourSidePart(middle3D, sourcerect, select, matchtexture, matchheight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check connected lines
|
||||
foreach(Linedef line in connectedLines)
|
||||
//mxd
|
||||
private void SelectNeighbourSidePart(BaseVisualGeometrySidedef visualside, Rectangle sourcerect, bool select, bool matchtexture, bool matchheight)
|
||||
{
|
||||
if(visualside != null && visualside.Triangles > 0 && visualside.Selected != select)
|
||||
{
|
||||
bool addFrontTop = false;
|
||||
bool addFrontMiddle = false;
|
||||
bool addFrontBottom = false;
|
||||
bool addBackTop = false;
|
||||
bool addBackMiddle = false;
|
||||
bool addBackBottom = false;
|
||||
|
||||
bool lineHasFrontSector = (line.Front != null && line.Front.Sector != null);
|
||||
bool lineHasBackSector = (line.Back != null && line.Back.Sector != null);
|
||||
bool doublesided = (lineHasFrontSector && lineHasBackSector);
|
||||
|
||||
List<VisualMiddle3D> extrasides = new List<VisualMiddle3D>();
|
||||
|
||||
// Gather 3d floor sides
|
||||
if(doublesided)
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(visualside);
|
||||
if(r.Width == 0 || r.Height == 0) return;
|
||||
if((matchtexture && visualside.Texture == Texture && r.IntersectsWith(sourcerect)) ||
|
||||
(matchheight && sourcerect.Height == r.Height && sourcerect.Y == r.Y))
|
||||
{
|
||||
BaseVisualSector s = mode.GetVisualSector(line.Front.Sector) as BaseVisualSector;
|
||||
if(s != null) extrasides.AddRange(s.GetSidedefParts(line.Front).middle3d.ToArray());
|
||||
|
||||
s = mode.GetVisualSector(line.Back.Sector) as BaseVisualSector;
|
||||
if(s != null) extrasides.AddRange(s.GetSidedefParts(line.Back).middle3d.ToArray());
|
||||
}
|
||||
|
||||
// Add regular sides
|
||||
if(withSameTexture)
|
||||
{
|
||||
if(line.Front != null)
|
||||
{
|
||||
addFrontTop = (line.Front.LongHighTexture == longtexture
|
||||
&& line.Front.HighRequired()
|
||||
&& BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_UPPER).IntersectsWith(rect));
|
||||
|
||||
addFrontMiddle = (line.Front.LongMiddleTexture == longtexture
|
||||
&& (line.Front.MiddleRequired() || (line.Back != null && longtexture != MapSet.EmptyLongName))
|
||||
&& line.Front.GetMiddleHeight() > 0
|
||||
&& BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect));
|
||||
|
||||
addFrontBottom = (line.Front.LongLowTexture == longtexture
|
||||
&& line.Front.LowRequired()
|
||||
&& BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_LOWER).IntersectsWith(rect));
|
||||
|
||||
}
|
||||
|
||||
if(line.Back != null)
|
||||
{
|
||||
addBackTop = (line.Back.LongHighTexture == longtexture
|
||||
&& line.Back.HighRequired()
|
||||
&& BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_UPPER).IntersectsWith(rect));
|
||||
|
||||
addBackMiddle = (line.Back.LongMiddleTexture == longtexture
|
||||
&& (line.Back.MiddleRequired() || (line.Front != null && longtexture != MapSet.EmptyLongName))
|
||||
&& line.Back.GetMiddleHeight() > 0
|
||||
&& BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect));
|
||||
|
||||
addBackBottom = (line.Back.LongLowTexture == longtexture
|
||||
&& line.Back.LowRequired()
|
||||
&& BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_LOWER).IntersectsWith(rect));
|
||||
}
|
||||
|
||||
// Add 3d floor sides
|
||||
List<VisualMiddle3D> filtered = new List<VisualMiddle3D>();
|
||||
foreach(VisualMiddle3D side3d in extrasides)
|
||||
{
|
||||
Sidedef controlside = side3d.GetControlLinedef().Front;
|
||||
if(controlside.LongMiddleTexture == longtexture && BuilderModesTools.GetSidedefPartSize(controlside, VisualGeometryType.WALL_MIDDLE).IntersectsWith(rect))
|
||||
{
|
||||
filtered.Add(side3d);
|
||||
}
|
||||
}
|
||||
|
||||
extrasides = filtered;
|
||||
}
|
||||
|
||||
if(withSameHeight && rect.Height > 0)
|
||||
{
|
||||
// Upper parts match?
|
||||
if((!withSameTexture || addFrontTop) && doublesided && line.Front.HighRequired())
|
||||
{
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_UPPER);
|
||||
addFrontTop = (rect.Height == r.Height && rect.Y == r.Y);
|
||||
}
|
||||
|
||||
if((!withSameTexture || addBackTop) && doublesided && line.Back.HighRequired())
|
||||
{
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_UPPER);
|
||||
addBackTop = (rect.Height == r.Height && rect.Y == r.Y);
|
||||
}
|
||||
|
||||
// Middle parts match?
|
||||
if((!withSameTexture || addFrontMiddle)
|
||||
&& lineHasFrontSector
|
||||
&& (line.Front.MiddleRequired() || line.Front.LongMiddleTexture != MapSet.EmptyLongName) )
|
||||
{
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_MIDDLE);
|
||||
addFrontMiddle = (rect.Height == r.Height && rect.Y == r.Y);
|
||||
}
|
||||
|
||||
if((!withSameTexture || addBackMiddle)
|
||||
&& lineHasBackSector
|
||||
&& (line.Back.MiddleRequired() || line.Back.LongMiddleTexture != MapSet.EmptyLongName))
|
||||
{
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_MIDDLE);
|
||||
addBackMiddle = (rect.Height == r.Height && rect.Y == r.Y);
|
||||
}
|
||||
|
||||
// Lower parts match?
|
||||
if((!withSameTexture || addFrontBottom) && doublesided && line.Front.LowRequired())
|
||||
{
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Front, VisualGeometryType.WALL_LOWER);
|
||||
addFrontBottom = (rect.Height == r.Height && rect.Y == r.Y);
|
||||
}
|
||||
|
||||
if((!withSameTexture || addBackBottom) && doublesided && line.Back.LowRequired())
|
||||
{
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(line.Back, VisualGeometryType.WALL_LOWER);
|
||||
addBackBottom = (rect.Height == r.Height && rect.Y == r.Y);
|
||||
}
|
||||
|
||||
// 3d floor parts match?
|
||||
List<VisualMiddle3D> filtered = new List<VisualMiddle3D>();
|
||||
foreach(VisualMiddle3D side3d in extrasides)
|
||||
{
|
||||
Sidedef controlside = side3d.GetControlLinedef().Front;
|
||||
Rectangle r = BuilderModesTools.GetSidedefPartSize(controlside, VisualGeometryType.WALL_MIDDLE);
|
||||
if(rect.Height == r.Height && rect.Y == r.Y)
|
||||
{
|
||||
filtered.Add(side3d);
|
||||
}
|
||||
}
|
||||
|
||||
extrasides = filtered;
|
||||
}
|
||||
|
||||
// Select front?
|
||||
if(addFrontTop || addFrontMiddle || addFrontBottom)
|
||||
mode.SelectSideParts(line.Front, addFrontTop, addFrontMiddle, addFrontBottom, select, withSameTexture, withSameHeight);
|
||||
|
||||
// Select back?
|
||||
if(addBackTop || addBackMiddle || addBackBottom)
|
||||
mode.SelectSideParts(line.Back, addBackTop, addBackMiddle, addBackBottom, select, withSameTexture, withSameHeight);
|
||||
|
||||
// Select 3d floor sides?
|
||||
foreach(VisualMiddle3D side3d in extrasides)
|
||||
{
|
||||
if( (select && !side3d.Selected) || (!select && side3d.Selected) )
|
||||
side3d.SelectNeighbours(select, withSameTexture, withSameHeight);
|
||||
visualside.SelectNeighbours(select, matchtexture, matchheight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -839,7 +727,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
protected virtual void ResetTextureScale() { } //mxd
|
||||
protected abstract void MoveTextureOffset(Point xy);
|
||||
protected abstract Point GetTextureOffset();
|
||||
public virtual void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd
|
||||
public virtual void OnTextureFit(FitTextureOptions options) { } //mxd
|
||||
|
||||
// Insert middle texture
|
||||
|
|
|
@ -608,36 +608,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
return translatedCoords;
|
||||
}
|
||||
|
||||
//mxd
|
||||
internal void SelectSideParts(Sidedef side, bool toggleTop, bool toggleMid, bool toggleBottom, bool select, bool withSameTexture, bool withSameHeight)
|
||||
{
|
||||
BaseVisualSector vs = GetVisualSector(side.Sector) as BaseVisualSector;
|
||||
|
||||
if(toggleTop && vs.Sides[side].upper != null &&
|
||||
((select && !vs.Sides[side].upper.Selected) || (!select && vs.Sides[side].upper.Selected)))
|
||||
{
|
||||
vs.Sides[side].upper.SelectNeighbours(select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
if(toggleMid && vs.Sides[side].middlesingle != null &&
|
||||
((select && !vs.Sides[side].middlesingle.Selected) || (!select && vs.Sides[side].middlesingle.Selected)))
|
||||
{
|
||||
vs.Sides[side].middlesingle.SelectNeighbours(select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
if(toggleMid && vs.Sides[side].middledouble != null &&
|
||||
((select && !vs.Sides[side].middledouble.Selected) || (!select && vs.Sides[side].middledouble.Selected)))
|
||||
{
|
||||
vs.Sides[side].middledouble.SelectNeighbours(select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
if(toggleBottom && vs.Sides[side].lower != null &&
|
||||
((select && !vs.Sides[side].lower.Selected) || (!select && vs.Sides[side].lower.Selected)))
|
||||
{
|
||||
vs.Sides[side].lower.SelectNeighbours(select, withSameTexture, withSameHeight);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void UpdateSelectionInfo()
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Other methods
|
||||
string GetTextureName();
|
||||
void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight); //mxd
|
||||
void SelectNeighbours(bool select, bool matchtexture, bool matchheight); //mxd
|
||||
bool IsSelected(); //mxd
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,12 +275,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
FitTexture(options);
|
||||
Setup();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
|
||||
{
|
||||
SelectNeighbours(Sidedef.LongLowTexture, select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -387,12 +387,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
return extrafloor.Linedef;
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
|
||||
{
|
||||
SelectNeighbours(extrafloor.Linedef.Front.LongMiddleTexture, select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void OnTextureFit(FitTextureOptions options)
|
||||
{
|
||||
|
|
|
@ -375,12 +375,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
FitTexture(options);
|
||||
Setup();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
|
||||
{
|
||||
SelectNeighbours(Sidedef.LongMiddleTexture, select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -275,12 +275,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
FitTexture(options);
|
||||
Setup();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
|
||||
{
|
||||
SelectNeighbours(Sidedef.LongMiddleTexture, select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -277,12 +277,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
FitTexture(options);
|
||||
Setup();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
|
||||
{
|
||||
SelectNeighbours(Sidedef.LongHighTexture, select, withSameTexture, withSameHeight);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue