2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Namespaces
|
2013-11-22 09:23:59 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
2013-11-21 10:53:11 +00:00
|
|
|
|
using System.Windows.Forms;
|
2014-01-08 09:46:57 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Windows;
|
2013-11-21 10:53:11 +00:00
|
|
|
|
|
2013-11-22 09:23:59 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2013-11-21 10:53:11 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes.Interface
|
|
|
|
|
{
|
|
|
|
|
public partial class SectorDrawingOptionsPanel : UserControl
|
|
|
|
|
{
|
2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Constructor / Setup
|
2013-11-21 10:53:11 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public SectorDrawingOptionsPanel()
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
2013-11-22 09:23:59 +00:00
|
|
|
|
ceilHeight.Text = General.Map.Options.CustomCeilingHeight.ToString();
|
|
|
|
|
floorHeight.Text = General.Map.Options.CustomFloorHeight.ToString();
|
2013-11-21 10:53:11 +00:00
|
|
|
|
brightness.StepValues = General.Map.Config.BrightnessLevels;
|
2013-11-22 09:23:59 +00:00
|
|
|
|
brightness.Text = General.Map.Options.CustomBrightness.ToString();
|
2013-11-21 10:53:11 +00:00
|
|
|
|
ceiling.TextureName = General.Map.Options.DefaultCeilingTexture;
|
|
|
|
|
floor.TextureName = General.Map.Options.DefaultFloorTexture;
|
2014-01-08 09:46:57 +00:00
|
|
|
|
top.TextureName = General.Map.Options.DefaultTopTexture;
|
|
|
|
|
middle.TextureName = General.Map.Options.DefaultWallTexture;
|
|
|
|
|
bottom.TextureName = General.Map.Options.DefaultBottomTexture;
|
2013-11-21 10:53:11 +00:00
|
|
|
|
|
|
|
|
|
cbOverrideCeilingTexture.Checked = General.Map.Options.OverrideCeilingTexture;
|
|
|
|
|
cbOverrideFloorTexture.Checked = General.Map.Options.OverrideFloorTexture;
|
2014-01-08 09:46:57 +00:00
|
|
|
|
cbOverrideTopTexture.Checked = General.Map.Options.OverrideTopTexture;
|
|
|
|
|
cbOverrideMiddleTexture.Checked = General.Map.Options.OverrideMiddleTexture;
|
|
|
|
|
cbOverrideBottomTexture.Checked = General.Map.Options.OverrideBottomTexture;
|
2013-11-21 10:53:11 +00:00
|
|
|
|
cbCeilHeight.Checked = General.Map.Options.OverrideCeilingHeight;
|
|
|
|
|
cbFloorHeight.Checked = General.Map.Options.OverrideFloorHeight;
|
|
|
|
|
cbBrightness.Checked = General.Map.Options.OverrideBrightness;
|
|
|
|
|
|
2015-01-14 13:12:23 +00:00
|
|
|
|
getsectortexturesfromselection.Enabled = (cbOverrideCeilingTexture.Checked || cbOverrideFloorTexture.Checked);
|
|
|
|
|
getsidetexturesfromselection.Enabled = (cbOverrideTopTexture.Checked || cbOverrideMiddleTexture.Checked || cbOverrideBottomTexture.Checked);
|
|
|
|
|
getheightandbrightnessfromselection.Enabled = (cbCeilHeight.Checked || cbFloorHeight.Checked || cbBrightness.Checked);
|
|
|
|
|
|
2013-11-21 10:53:11 +00:00
|
|
|
|
ceiling.Enabled = cbOverrideCeilingTexture.Checked;
|
|
|
|
|
floor.Enabled = cbOverrideFloorTexture.Checked;
|
2014-01-08 09:46:57 +00:00
|
|
|
|
top.Enabled = cbOverrideTopTexture.Checked;
|
|
|
|
|
middle.Enabled = cbOverrideMiddleTexture.Checked;
|
|
|
|
|
bottom.Enabled = cbOverrideBottomTexture.Checked;
|
2013-11-21 10:53:11 +00:00
|
|
|
|
ceilHeight.Enabled = cbCeilHeight.Checked;
|
|
|
|
|
floorHeight.Enabled = cbFloorHeight.Checked;
|
|
|
|
|
brightness.Enabled = cbBrightness.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-16 12:10:43 +00:00
|
|
|
|
internal void Terminate()
|
|
|
|
|
{
|
|
|
|
|
ceiling.StopUpdate();
|
|
|
|
|
floor.StopUpdate();
|
|
|
|
|
top.StopUpdate();
|
|
|
|
|
middle.StopUpdate();
|
|
|
|
|
bottom.StopUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-21 10:53:11 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Checkbox Events
|
2013-11-21 10:53:11 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbOverrideCeilingTexture_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
ceiling.Enabled = cbOverrideCeilingTexture.Checked;
|
|
|
|
|
General.Map.Options.OverrideCeilingTexture = cbOverrideCeilingTexture.Checked;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
|
|
|
|
|
getsectortexturesfromselection.Enabled = (cbOverrideCeilingTexture.Checked || cbOverrideFloorTexture.Checked);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbOverrideFloorTexture_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
floor.Enabled = cbOverrideFloorTexture.Checked;
|
|
|
|
|
General.Map.Options.OverrideFloorTexture = cbOverrideFloorTexture.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbOverrideTopTexture_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
top.Enabled = cbOverrideTopTexture.Checked;
|
|
|
|
|
General.Map.Options.OverrideTopTexture = cbOverrideTopTexture.Checked;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
|
|
|
|
|
getsidetexturesfromselection.Enabled = (cbOverrideTopTexture.Checked || cbOverrideMiddleTexture.Checked || cbOverrideBottomTexture.Checked);
|
2014-01-08 09:46:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbOverrideMiddleTexture_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
middle.Enabled = cbOverrideMiddleTexture.Checked;
|
|
|
|
|
General.Map.Options.OverrideMiddleTexture = cbOverrideMiddleTexture.Checked;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
|
|
|
|
|
getsidetexturesfromselection.Enabled = (cbOverrideTopTexture.Checked || cbOverrideMiddleTexture.Checked || cbOverrideBottomTexture.Checked);
|
2014-01-08 09:46:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbOverrideBottomTexture_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
bottom.Enabled = cbOverrideBottomTexture.Checked;
|
|
|
|
|
General.Map.Options.OverrideBottomTexture = cbOverrideBottomTexture.Checked;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
|
|
|
|
|
getsidetexturesfromselection.Enabled = (cbOverrideTopTexture.Checked || cbOverrideMiddleTexture.Checked || cbOverrideBottomTexture.Checked);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbCeilHeight_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
ceilHeight.Enabled = cbCeilHeight.Checked;
|
|
|
|
|
General.Map.Options.OverrideCeilingHeight = cbCeilHeight.Checked;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
|
|
|
|
|
getheightandbrightnessfromselection.Enabled = (cbCeilHeight.Checked || cbFloorHeight.Checked || cbBrightness.Checked);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbFloorHeight_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
floorHeight.Enabled = cbFloorHeight.Checked;
|
|
|
|
|
General.Map.Options.OverrideFloorHeight = cbFloorHeight.Checked;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
|
|
|
|
|
getheightandbrightnessfromselection.Enabled = (cbCeilHeight.Checked || cbFloorHeight.Checked || cbBrightness.Checked);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbBrightness_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
brightness.Enabled = cbBrightness.Checked;
|
|
|
|
|
General.Map.Options.OverrideBrightness = cbBrightness.Checked;
|
2015-01-14 13:12:23 +00:00
|
|
|
|
|
|
|
|
|
getheightandbrightnessfromselection.Enabled = (cbCeilHeight.Checked || cbFloorHeight.Checked || cbBrightness.Checked);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Inputs Events
|
2013-11-21 10:53:11 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ceilHeight_WhenTextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-22 09:23:59 +00:00
|
|
|
|
General.Map.Options.CustomCeilingHeight = ceilHeight.GetResult(General.Map.Options.CustomCeilingHeight);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void floorHeight_WhenTextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-22 09:23:59 +00:00
|
|
|
|
General.Map.Options.CustomFloorHeight = floorHeight.GetResult(General.Map.Options.CustomFloorHeight);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void brightness_WhenTextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-22 09:23:59 +00:00
|
|
|
|
General.Map.Options.CustomBrightness = General.Clamp(brightness.GetResult(General.Map.Options.CustomBrightness), 0, 255);
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ceiling_OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
General.Map.Options.DefaultCeilingTexture = ceiling.TextureName;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void floor_OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-21 10:53:11 +00:00
|
|
|
|
General.Map.Options.DefaultFloorTexture = floor.TextureName;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void top_OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
General.Map.Options.DefaultTopTexture = top.TextureName;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void middle_OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
General.Map.Options.DefaultWallTexture = middle.TextureName;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bottom_OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
General.Map.Options.DefaultBottomTexture = bottom.TextureName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Texture Fill
|
2014-01-08 09:46:57 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void fillceiling_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
|
|
|
|
if(sectors.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "sector";
|
|
|
|
|
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear ceiling texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Sector s in sectors) s.SetCeilTexture(ceiling.TextureName);
|
2014-01-08 09:46:57 +00:00
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(General.Map.Renderer2D.ViewMode == Rendering.ViewMode.CeilingTextures)
|
2014-01-08 09:46:57 +00:00
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void fillfloor_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
|
|
|
|
if(sectors.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "sector";
|
|
|
|
|
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear ceiling texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Sector s in sectors) s.SetFloorTexture(floor.TextureName);
|
2014-01-08 09:46:57 +00:00
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(General.Map.Renderer2D.ViewMode == Rendering.ViewMode.FloorTextures)
|
2014-01-08 09:46:57 +00:00
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void fillupper_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "linedef";
|
|
|
|
|
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Fill upper texture for " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
if(l.Front != null && l.Front.HighRequired()) l.Front.SetTextureHigh(top.TextureName);
|
|
|
|
|
if(l.Back != null && l.Back.HighRequired()) l.Back.SetTextureHigh(top.TextureName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void fillmiddle_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "linedef";
|
|
|
|
|
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Fill middle texture for " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
if(l.Front != null && l.Front.MiddleRequired()) l.Front.SetTextureMid(middle.TextureName);
|
|
|
|
|
if(l.Back != null && l.Back.MiddleRequired()) l.Back.SetTextureMid(middle.TextureName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void filllower_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "linedef";
|
|
|
|
|
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Fill lower texture for " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
if(l.Front != null && l.Front.LowRequired()) l.Front.SetTextureLow(bottom.TextureName);
|
|
|
|
|
if(l.Back != null && l.Back.LowRequired()) l.Back.SetTextureLow(bottom.TextureName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void fillall_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
|
|
|
|
|
|
|
|
|
//if we have selected sectors - fill their textures
|
2015-12-28 15:01:53 +00:00
|
|
|
|
if(sectors.Count > 0)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
//make undo
|
2016-05-04 14:02:13 +00:00
|
|
|
|
General.Map.UndoRedo.CreateUndo("Fill all textures for " + sectors.Count + (sectors.Count > 1 ? " sectors" : " sector"));
|
2014-01-30 14:52:08 +00:00
|
|
|
|
|
2015-12-28 15:01:53 +00:00
|
|
|
|
foreach(Sector s in sectors)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
//fill sidedefs
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Sidedef side in s.Sidedefs)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(top.Enabled && side.HighRequired()) side.SetTextureHigh(top.TextureName);
|
|
|
|
|
if(middle.Enabled && side.MiddleRequired()) side.SetTextureMid(middle.TextureName);
|
|
|
|
|
if(bottom.Enabled && side.LowRequired()) side.SetTextureLow(bottom.TextureName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//fill flats
|
|
|
|
|
if(floor.Enabled) s.SetFloorTexture(floor.TextureName);
|
|
|
|
|
if(ceiling.Enabled) s.SetCeilTexture(ceiling.TextureName);
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else //if we don't - fill linedef textures
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
//make undo
|
2016-05-04 14:02:13 +00:00
|
|
|
|
General.Map.UndoRedo.CreateUndo("Fill all textures for " + lines.Count + (lines.Count > 1 ? " linedefs" : " linedef"));
|
2014-01-30 14:52:08 +00:00
|
|
|
|
|
|
|
|
|
//fill textures
|
2015-12-28 15:01:53 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
|
|
|
|
if(top.Enabled)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(l.Front != null && l.Front.HighRequired()) l.Front.SetTextureHigh(top.TextureName);
|
|
|
|
|
if(l.Back != null && l.Back.HighRequired()) l.Back.SetTextureHigh(top.TextureName);
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(middle.Enabled)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(l.Front != null && l.Front.MiddleRequired()) l.Front.SetTextureMid(middle.TextureName);
|
|
|
|
|
if(l.Back != null && l.Back.MiddleRequired()) l.Back.SetTextureMid(middle.TextureName);
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(bottom.Enabled)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(l.Front != null && l.Front.LowRequired()) l.Front.SetTextureLow(bottom.TextureName);
|
|
|
|
|
if(l.Back != null && l.Back.LowRequired()) l.Back.SetTextureLow(bottom.TextureName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
|
|
|
|
|
// Update entire display
|
|
|
|
|
General.Map.Map.Update();
|
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-08 09:46:57 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Clear Textures
|
2014-01-08 09:46:57 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void clearceiling_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
|
|
|
|
if(sectors.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "sector";
|
|
|
|
|
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear ceiling texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Sector s in sectors) s.SetCeilTexture("-");
|
2014-01-08 09:46:57 +00:00
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
|
|
|
|
|
// Update entire display
|
|
|
|
|
General.Map.Map.Update();
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(General.Map.Renderer2D.ViewMode == Rendering.ViewMode.CeilingTextures)
|
2014-01-08 09:46:57 +00:00
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void clearfloor_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
|
|
|
|
if(sectors.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "sector";
|
|
|
|
|
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear floor texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Sector s in sectors) s.SetFloorTexture("-");
|
2014-01-08 09:46:57 +00:00
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
|
|
|
|
|
// Update entire display
|
|
|
|
|
General.Map.Map.Update();
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(General.Map.Renderer2D.ViewMode == Rendering.ViewMode.FloorTextures)
|
2014-01-08 09:46:57 +00:00
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void clearupper_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "linedef";
|
|
|
|
|
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear upper texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
if(l.Front != null && l.Front.HighTexture != "-") l.Front.SetTextureHigh("-");
|
|
|
|
|
if(l.Back != null && l.Back.HighTexture != "-") l.Back.SetTextureHigh("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void clearmiddle_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "linedef";
|
|
|
|
|
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear middle texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
if(l.Front != null && l.Front.MiddleTexture != "-") l.Front.SetTextureMid("-");
|
|
|
|
|
if(l.Back != null && l.Back.MiddleTexture != "-") l.Back.SetTextureMid("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void clearlower_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
string undodesc = "linedef";
|
|
|
|
|
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear lower texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
|
|
|
|
{
|
2014-01-08 09:46:57 +00:00
|
|
|
|
if(l.Front != null && l.Front.LowTexture != "-") l.Front.SetTextureLow("-");
|
|
|
|
|
if(l.Back != null && l.Back.LowTexture != "-") l.Back.SetTextureLow("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void clearall_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
//if we have selected sectors - clear their textures
|
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
2015-12-28 15:01:53 +00:00
|
|
|
|
if(sectors.Count > 0)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
//make undo
|
|
|
|
|
string undodesc = "sector";
|
|
|
|
|
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear all texture from " + undodesc);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Sector s in sectors)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
//clear side textures
|
2015-12-28 15:01:53 +00:00
|
|
|
|
foreach(Sidedef side in s.Sidedefs)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(side.HighTexture != "-") side.SetTextureHigh("-");
|
|
|
|
|
if(side.MiddleTexture != "-") side.SetTextureMid("-");
|
|
|
|
|
if(side.LowTexture != "-") side.SetTextureLow("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//clear flats
|
|
|
|
|
s.SetCeilTexture("-");
|
|
|
|
|
s.SetFloorTexture("-");
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else //if we don't - clear linedef textures
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
//make undo
|
|
|
|
|
string undodesc = "linedef";
|
|
|
|
|
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Clear all texture from " + undodesc);
|
|
|
|
|
|
|
|
|
|
//clear textures
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
|
|
|
|
{
|
|
|
|
|
if(l.Front != null)
|
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(l.Front.HighTexture != "-") l.Front.SetTextureHigh("-");
|
|
|
|
|
if(l.Front.MiddleTexture != "-") l.Front.SetTextureMid("-");
|
|
|
|
|
if(l.Front.LowTexture != "-") l.Front.SetTextureLow("-");
|
|
|
|
|
}
|
2015-12-28 15:01:53 +00:00
|
|
|
|
if(l.Back != null)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-01-30 14:52:08 +00:00
|
|
|
|
if(l.Back.HighTexture != "-") l.Back.SetTextureHigh("-");
|
|
|
|
|
if(l.Back.MiddleTexture != "-") l.Back.SetTextureMid("-");
|
|
|
|
|
if(l.Back.LowTexture != "-") l.Back.SetTextureLow("-");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update the used textures
|
|
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
|
|
|
|
|
// Update entire display
|
|
|
|
|
General.Map.Map.Update();
|
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-21 10:53:11 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2015-01-14 13:12:23 +00:00
|
|
|
|
#region ================== Get Properties from Selection Events
|
|
|
|
|
|
|
|
|
|
private void getsectortexturesfromselection_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
|
|
|
|
if(sectors.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "This action requires selected sector");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sector s = General.GetByIndex(sectors, 0);
|
|
|
|
|
if(cbOverrideCeilingTexture.Checked) ceiling.TextureName = s.CeilTexture;
|
|
|
|
|
if(cbOverrideFloorTexture.Checked) floor.TextureName = s.FloorTexture;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void getsidetexturesfromselection_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
|
|
|
|
if(lines.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "This action requires selected linedef");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sidedef s = null;
|
2015-12-28 15:01:53 +00:00
|
|
|
|
foreach(Linedef l in lines)
|
2015-01-14 13:12:23 +00:00
|
|
|
|
{
|
|
|
|
|
s = (l.Front ?? l.Back);
|
|
|
|
|
if(s.MiddleTexture != "-" || s.HighTexture != "-" || s.LowTexture != "-") break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(s == null)
|
|
|
|
|
{
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Selection doesn't contain suitable sidedefs");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(cbOverrideTopTexture.Checked) top.TextureName = s.HighTexture;
|
|
|
|
|
if(cbOverrideMiddleTexture.Checked) middle.TextureName = s.MiddleTexture;
|
|
|
|
|
if(cbOverrideBottomTexture.Checked) bottom.TextureName = s.LowTexture;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void getheightandbrightnessfromselection_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
|
|
|
|
if(sectors.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "This action requires selected sector");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sector s = General.GetByIndex(sectors, 0);
|
|
|
|
|
if(cbCeilHeight.Checked) ceilHeight.Text = s.CeilHeight.ToString();
|
|
|
|
|
if(cbFloorHeight.Checked) floorHeight.Text = s.FloorHeight.ToString();
|
|
|
|
|
if(cbBrightness.Checked) brightness.Text = s.Brightness.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2013-11-21 10:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|