Upper/lower textures are now applied in a more expected manner in Bridge mode.

This commit is contained in:
MaxED 2012-06-26 21:48:37 +00:00
parent 113f9c6039
commit 46642200eb

View file

@ -183,15 +183,23 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
// Make undo for the draw // Make undo for the draw
General.Map.UndoRedo.CreateUndo("Bridge ("+form.Subdivisions+" subdivisions)"); General.Map.UndoRedo.CreateUndo("Bridge ("+form.Subdivisions+" subdivisions)");
string lowTexture = "-"; List<List<SectorProperties>> sectorProps = new List<List<SectorProperties>>();
string highTexture = "-"; List<List<List<Sector>>> newSectors = new List<List<List<Sector>>>();
//create sector properties collection
//sector row
for (int i = 0; i < drawShapes.Count; i++) {
sectorProps.Add(new List<SectorProperties>());
//sector in row
for (int c = 0; c < drawShapes[i].Count; c++)
sectorProps[i].Add(getSectorProperties(i, c));
}
// Make the drawing // Make the drawing
//sector row //sector row
for (int i = 0; i < drawShapes.Count; i++) { for (int i = 0; i < drawShapes.Count; i++) {
//textures newSectors.Add(new List<List<Sector>>());
lowTexture = sectorProps1[i].LowTexture != "-" ? sectorProps1[i].LowTexture : sectorProps2[i].LowTexture;
highTexture = sectorProps1[i].HighTexture != "-" ? sectorProps1[i].HighTexture : sectorProps2[i].HighTexture;
//sector in row //sector in row
for (int c = 0; c < drawShapes[i].Count; c++) { for (int c = 0; c < drawShapes[i].Count; c++) {
@ -205,21 +213,47 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
} }
List<Sector> newsectors = General.Map.Map.GetMarkedSectors(true); List<Sector> newsectors = General.Map.Map.GetMarkedSectors(true);
newSectors[i].Add(newsectors);
//set floor/ceiling heights, lower/upper textures and brightness //set floor/ceiling heights and brightness
foreach (Sector s in newsectors) { foreach (Sector s in newsectors) {
SectorProperties sp = getSectorProperties(i, c); SectorProperties sp = sectorProps[i][c];
s.Brightness = sp.Brightness; s.Brightness = sp.Brightness;
s.FloorHeight = sp.FloorHeight; s.FloorHeight = sp.FloorHeight;
s.CeilHeight = (sp.CeilingHeight < sp.FloorHeight ? sp.FloorHeight + 8 : sp.CeilingHeight); s.CeilHeight = (sp.CeilingHeight < sp.FloorHeight ? sp.FloorHeight + 8 : sp.CeilingHeight);
}
}
}
//apply textures
//sector row
for (int i = 0; i < newSectors.Count; i++) {
//sector in row
for (int c = 0; c < newSectors[i].Count; c++) {
foreach (Sector s in newSectors[i][c]) {
foreach(Sidedef sd in s.Sidedefs){ foreach(Sidedef sd in s.Sidedefs){
if (sd.Line.Back != null && sd.Line.Front != null) { if (sd.LowRequired())
sd.Line.Back.SetTextureLow(lowTexture); sd.SetTextureLow(sectorProps[i][c].LowTexture);
sd.Line.Back.SetTextureHigh(highTexture); if (sd.HighRequired())
sd.Line.Front.SetTextureLow(lowTexture); sd.SetTextureHigh(sectorProps[i][c].HighTexture);
sd.Line.Front.SetTextureHigh(highTexture); }
} }
}
}
//apply textures to front/back sides of shape
//sector row
for (int i = 0; i < newSectors.Count; i++) {
//first/last sector in row
for (int c = 0; c < newSectors[i].Count; c += newSectors[i].Count-1) {
foreach (Sector s in newSectors[i][c]) {
foreach (Sidedef sd in s.Sidedefs) {
if (sd.Other != null) {
if (sd.Other.LowRequired() && sd.Other.LowTexture == "-")
sd.Other.SetTextureLow(sectorProps[i][c].LowTexture);
if (sd.Other.HighRequired() && sd.Other.HighTexture == "-")
sd.Other.SetTextureHigh(sectorProps[i][c].HighTexture);
}
} }
} }
} }
@ -407,6 +441,10 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
sp.FloorHeight = intepolateValue(sectorProps1[lineIndex].FloorHeight, sectorProps2[lineIndex].FloorHeight, delta, form.FloorAlignMode); sp.FloorHeight = intepolateValue(sectorProps1[lineIndex].FloorHeight, sectorProps2[lineIndex].FloorHeight, delta, form.FloorAlignMode);
sp.CeilingHeight = intepolateValue(sectorProps1[lineIndex].CeilingHeight, sectorProps2[lineIndex].CeilingHeight, delta, form.CeilingAlignMode); sp.CeilingHeight = intepolateValue(sectorProps1[lineIndex].CeilingHeight, sectorProps2[lineIndex].CeilingHeight, delta, form.CeilingAlignMode);
//textures
sp.LowTexture = sectorProps1[lineIndex].LowTexture != "-" ? sectorProps1[lineIndex].LowTexture : sectorProps2[lineIndex].LowTexture;
sp.HighTexture = sectorProps1[lineIndex].HighTexture != "-" ? sectorProps1[lineIndex].HighTexture : sectorProps2[lineIndex].HighTexture;
return sp; return sp;
} }