UDMF: sidedef flags are now defined in game configuration instead of being hardcoded.

Texture scale controls now have "Link" button. 
Thing, Sector (UDMF) and Linedef edit forms now work in realtime mode.
Some more fixes in Edit form realtime update stuff.
Removed some unused variables and functions.
This commit is contained in:
MaxED 2013-07-19 15:30:58 +00:00
parent 7f3461209a
commit bafb8ed511
59 changed files with 2695 additions and 1181 deletions

View file

@ -97,6 +97,15 @@ linedefactivations
passuse = "Pass use on";
}
sidedefflags
{
clipmidtex = "Clip middle texture";
wrapmidtex = "Wrap middle texture";
nofakecontrast = "No fake contrast";
nodecals = "No decals";
smoothlighting = "Smooth lighting";
lightfog = "Use sidedef brightness on fogged walls";
}
/*
MAP LUMP NAMES

View file

@ -367,6 +367,12 @@ mapformat_udmf
include("ZDoom_misc.cfg", "linedefflagstranslation");
}
//SIDEDEF FLAGS
sidedefflags
{
include("UDMF_misc.cfg", "sidedefflags");
}
// THING FLAGS
thingflags
{

View file

@ -248,12 +248,6 @@ universalfields
sidedef
{
clipmidtex
{
type = 3;
default = false;
}
comment
{
type = 2;
@ -272,18 +266,6 @@ universalfields
default = false;
}
nodecals
{
type = 3;
default = false;
}
nofakecontrast
{
type = 3;
default = false;
}
offsetx_top
{
type = 1;
@ -355,24 +337,6 @@ universalfields
type = 1;
default = 1.0f;
}
smoothlighting
{
type = 3;
default = false;
}
wrapmidtex
{
type = 3;
default = false;
}
lightfog
{
type = 3;
default = true;
}
}
thing

View file

@ -57,7 +57,7 @@ namespace CodeImp.DoomBuilder.Actions
private bool exclusiverequested;
// Disposing
private bool isdisposed = false;
private bool isdisposed;
#endregion
@ -530,7 +530,6 @@ namespace CodeImp.DoomBuilder.Actions
internal bool KeyReleased(int key)
{
int strippedkey = key & ~((int)Keys.Alt | (int)Keys.Shift | (int)Keys.Control);
List<Action> keepactions = new List<Action>();
// Update pressed keys
if(pressedkeys.Contains(strippedkey)) pressedkeys.Remove(strippedkey);

View file

@ -918,8 +918,10 @@
<Content Include="Resources\Light_animate.png" />
<None Include="Resources\MLogo.png" />
<None Include="Resources\Marine.png" />
<None Include="Resources\Link.png" />
<Content Include="Resources\Model.png" />
<Content Include="Resources\Model_selected.png" />
<None Include="Resources\Unlink.png" />
<None Include="Resources\Unpin.png" />
<None Include="Resources\Pin.png" />
<None Include="Resources\Reset.png" />

View file

@ -109,6 +109,9 @@ namespace CodeImp.DoomBuilder.Config
private List<LinedefActivateInfo> linedefactivates;
private List<GeneralizedCategory> genactioncategories;
private List<FlagTranslation> linedefflagstranslation;
//mxd. Sidedefs
private Dictionary<string, string> sidedefflags; //mxd
// Sectors
private Dictionary<string, string> sectorflags; //mxd
@ -205,8 +208,11 @@ namespace CodeImp.DoomBuilder.Config
public List<GeneralizedCategory> GenActionCategories { get { return genactioncategories; } }
public List<FlagTranslation> LinedefFlagsTranslation { get { return linedefflagstranslation; } }
//mxd. Sidedefs
public IDictionary<string, string> SidedefFlags { get { return sidedefflags; } }
// Sectors
public IDictionary<string, string> SectorFlags { get { return sectorflags; } }
public IDictionary<string, string> SectorFlags { get { return sectorflags; } } //mxd
public IDictionary<int, SectorEffectInfo> SectorEffects { get { return sectoreffects; } }
public List<SectorEffectInfo> SortedSectorEffects { get { return sortedsectoreffects; } }
public List<GeneralizedOption> GenEffectOptions { get { return geneffectoptions; } }
@ -250,6 +256,7 @@ namespace CodeImp.DoomBuilder.Config
this.actioncategories = new List<LinedefActionCategory>();
this.sortedlinedefactions = new List<LinedefActionInfo>();
this.linedefactivates = new List<LinedefActivateInfo>();
this.sidedefflags = new Dictionary<string, string>(); //mxd
this.genactioncategories = new List<GeneralizedCategory>();
this.sectorflags = new Dictionary<string, string>(); //mxd
this.sectoreffects = new Dictionary<int, SectorEffectInfo>();
@ -346,6 +353,9 @@ namespace CodeImp.DoomBuilder.Config
LoadLinedefActivations();
LoadLinedefGeneralizedActions();
//mxd. Sidedefs
LoadSidedefFlags();
// Sectors
LoadSectorFlags(); //mxd
LoadBrightnessLevels();
@ -617,6 +627,14 @@ namespace CodeImp.DoomBuilder.Config
}
}
//mxd. SIdedef flags
private void LoadSidedefFlags() {
// Get linedef flags
IDictionary dic = cfg.ReadSetting("sidedefflags", new Hashtable());
foreach(DictionaryEntry de in dic)
sidedefflags.Add(de.Key.ToString(), de.Value.ToString());
}
//mxd. Sector flags
private void LoadSectorFlags() {
// Get linedef flags

View file

@ -28,13 +28,13 @@ namespace CodeImp.DoomBuilder.Controls
{
public partial class CheckboxArrayControl : UserControl
{
// Constants
//private const int SPACING_Y = 1;
private int spacingY = 1; //mxd
// Events
public event EventHandler OnValueChanged; //mxd
// Variables
private List<CheckBox> checkboxes;
private int columns;
private int spacingY = 1; //mxd
// Properties
public List<CheckBox> Checkboxes { get { return checkboxes; } }
@ -61,6 +61,7 @@ namespace CodeImp.DoomBuilder.Controls
c.UseVisualStyleBackColor = true;
c.Text = text;
c.Tag = tag;
c.CheckedChanged += new EventHandler(checkbox_CheckedChanged); //mxd
// Add to list
this.Controls.Add(c);
@ -138,5 +139,10 @@ namespace CodeImp.DoomBuilder.Controls
e.Graphics.DrawRectangle(p, 0, 0, this.ClientRectangle.Width - 1, this.ClientRectangle.Height - 1);
}
}
//mxd
private void checkbox_CheckedChanged(object sender, EventArgs e) {
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
}
}

View file

@ -177,7 +177,10 @@ namespace CodeImp.DoomBuilder.Controls
//mxd. Got a valid multiselection? Well, can't show any useful info about that...
if(typelist.UseMultiSelection && typelist.SelectedNodes.Count > 1 && getValidNodes().Count > 1) {
doupdatenode = false;
typeid.Text = "";
if(!string.IsNullOrEmpty(typeid.Text)) // Event will be raised in typeid_OnTextChanged
typeid.Text = "";
else if(OnTypeChanged != null) // Or raise event here
OnTypeChanged(thinginfo);
doupdatenode = true;
}
else if(typelist.SelectedNode != null) //Anything selected?

View file

@ -10,14 +10,27 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
{
public partial class ColorFieldsControl : UserControl
{
#region ================== Events
public event EventHandler OnValueChanged; //mxd
#endregion
#region ================== Variables
private int defaultValue;
private string field;
private bool blockUpdate;
#endregion
#region ================== Properties
public int DefaultValue { get { return defaultValue; } set { defaultValue = value; } }
public string Label { get { return cpColor.Label; } set { cpColor.Label = value; } }
public string Field { get { return field; } set { field = value; } }
private bool blockUpdate;
#endregion
public ColorFieldsControl() {
InitializeComponent();
@ -29,9 +42,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
checkColor();
}
public void ApplyTo(UniFields fields) {
if(string.IsNullOrEmpty(tbColor.Text)) return;
UDMFTools.SetInteger(fields, field, (cpColor.Color.ToInt() & 0x00ffffff), defaultValue, false);
public void ApplyTo(UniFields fields, int oldValue) {
if(string.IsNullOrEmpty(tbColor.Text)) {
UDMFTools.SetInteger(fields, field, oldValue, defaultValue, false);
} else {
UDMFTools.SetInteger(fields, field, (cpColor.Color.ToInt() & 0x00ffffff), defaultValue, false);
}
}
private void checkColor() {
@ -40,6 +56,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
tbColor.ForeColor = changed ? SystemColors.WindowText : SystemColors.GrayText;
}
#region ================== Events
private void bReset_Click(object sender, EventArgs e) {
cpColor.Color = PixelColor.FromInt(defaultValue).WithAlpha(255);
cpColor_ColorChanged(this, EventArgs.Empty);
@ -53,6 +71,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
blockUpdate = false;
checkColor();
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
private void tbColor_TextChanged(object sender, EventArgs e) {
@ -69,5 +89,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
checkColor();
}
#endregion
}
}

View file

@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
//validate
for(int i = 0; i < configInfo.LinedefColorPresets.Length; i++) {
validatePreset(configInfo.LinedefColorPresets[i]);
hasDuplicates(configInfo.LinedefColorPresets[i]);
checkDuplicates(configInfo.LinedefColorPresets[i]);
}
lbColorPresets.Items.AddRange(configInfo.LinedefColorPresets);
@ -50,23 +50,22 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
return presets.ToArray();
}
private bool validatePreset(LinedefColorPreset preset) {
private void validatePreset(LinedefColorPreset preset) {
bool hasAction = preset.Action != 0;
bool hasFlags = preset.Flags.Count > 0 || preset.RestrictedFlags.Count > 0;
bool hasActivation = preset.Activation != 0;
//validate
if(!hasAction && !hasFlags && !hasActivation) {
if(colorProperties.UDMF) {
if(colorProperties.UDMF) {
preset.SetInvalid("Invalid preset: no flags, action or activation type selected!");
} else {
preset.SetInvalid("Invalid preset: no flags or action selected!");
}
return false;
return;
}
preset.SetValid();
return true;
preset.SetValid();
}
private bool validatePresetName() {
@ -87,8 +86,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
return true;
}
private bool hasDuplicates(LinedefColorPreset preset) {
foreach(LinedefColorPreset p in lbColorPresets.Items) {
private void checkDuplicates(LinedefColorPreset preset)
{
foreach(LinedefColorPreset p in lbColorPresets.Items) {
if(preset.Name == p.Name) continue;
if(p.Action != preset.Action) continue;
if(p.Activation != preset.Activation) continue;
@ -114,10 +114,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
//we have a match
preset.WarningDescription = "Preset matches '" + p.Name + "'";
return true;
return;
}
return false;
}
private void updatePresetListControls() {
@ -210,7 +208,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
LinedefColorPreset preset = (LinedefColorPreset)lbColorPresets.SelectedItem;
preset.SetValid(); //clear error/warning messages
validatePreset(preset); //validate it
hasDuplicates(preset);
checkDuplicates(preset);
colorProperties.UpdateMessages(); //update error/warning messages
lbColorPresets.Invalidate(); //redraw icons

View file

@ -27,31 +27,43 @@
private void InitializeComponent() {
this.label = new System.Windows.Forms.Label();
this.bReset = new System.Windows.Forms.Button();
this.bLink = new System.Windows.Forms.Button();
this.value1 = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.value2 = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.SuspendLayout();
//
// label
//
this.label.Location = new System.Drawing.Point(0, 6);
this.label.Location = new System.Drawing.Point(3, 6);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(87, 14);
this.label.Size = new System.Drawing.Size(86, 14);
this.label.TabIndex = 36;
this.label.Text = "Upper Offset:";
this.label.Text = "Texture Offsets:";
this.label.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// bReset
//
this.bReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bReset.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset;
this.bReset.Location = new System.Drawing.Point(222, 1);
this.bReset.Location = new System.Drawing.Point(245, 1);
this.bReset.Name = "bReset";
this.bReset.Size = new System.Drawing.Size(23, 23);
this.bReset.TabIndex = 39;
this.bReset.TabIndex = 40;
this.bReset.UseVisualStyleBackColor = true;
this.bReset.Visible = false;
this.bReset.Click += new System.EventHandler(this.bReset_Click);
//
// bLink
//
this.bLink.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bLink.Image = global::CodeImp.DoomBuilder.Properties.Resources.Link;
this.bLink.Location = new System.Drawing.Point(220, 1);
this.bLink.Name = "bLink";
this.bLink.Size = new System.Drawing.Size(23, 23);
this.bLink.TabIndex = 39;
this.bLink.UseVisualStyleBackColor = true;
this.bLink.Click += new System.EventHandler(this.bLink_Click);
//
// value1
//
this.value1.AllowDecimal = false;
@ -59,7 +71,8 @@
this.value1.AllowRelative = true;
this.value1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.value1.ButtonStep = 1;
this.value1.Location = new System.Drawing.Point(89, 1);
this.value1.ButtonStepFloat = 1F;
this.value1.Location = new System.Drawing.Point(87, 1);
this.value1.Name = "value1";
this.value1.Size = new System.Drawing.Size(62, 24);
this.value1.StepValues = null;
@ -74,33 +87,37 @@
this.value2.AllowRelative = true;
this.value2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.value2.ButtonStep = 1;
this.value2.Location = new System.Drawing.Point(157, 1);
this.value2.ButtonStepFloat = 1F;
this.value2.Location = new System.Drawing.Point(155, 1);
this.value2.Name = "value2";
this.value2.Size = new System.Drawing.Size(62, 24);
this.value2.StepValues = null;
this.value2.TabIndex = 38;
this.value2.Tag = "offsety_top";
this.value2.WhenTextChanged += new System.EventHandler(this.value1_WhenTextChanged);
this.value2.WhenTextChanged += new System.EventHandler(this.value2_WhenTextChanged);
//
// PairedFieldsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.bReset);
this.Controls.Add(this.bLink);
this.Controls.Add(this.label);
this.Controls.Add(this.value1);
this.Controls.Add(this.value2);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.Name = "PairedFieldsControl";
this.Size = new System.Drawing.Size(249, 26);
this.Size = new System.Drawing.Size(268, 26);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button bReset;
private System.Windows.Forms.Button bLink;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox value1;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox value2;
private System.Windows.Forms.Label label;
private System.Windows.Forms.Button bReset;
}
}

View file

@ -1,15 +1,36 @@
using System;
#region ================== Namespaces
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.GZBuilder.Tools;
using CodeImp.DoomBuilder.Properties;
#endregion
namespace CodeImp.DoomBuilder.GZBuilder.Controls
{
public partial class PairedFieldsControl : UserControl
{
#region ================== Events
public event EventHandler OnValuesChanged;
#endregion
#region ================== Variables
private float defaultValue;
private string field1;
private string field2;
private bool allowValueLinking;
private bool linkValues;
private bool blockUpdate;
private int bResetPosX;
#endregion
#region ================== Properties
public string Label { get { return label.Text; } set { label.Text = value; } }
public float DefaultValue { get { return defaultValue; } set { defaultValue = value; } }
@ -18,12 +39,25 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
public bool AllowDecimal { get { return value1.AllowDecimal; } set { value1.AllowDecimal = value; value2.AllowDecimal = value; } }
public int ButtonStep { get { return value1.ButtonStep; } set { value1.ButtonStep = value; value2.ButtonStep = value; } }
public float ButtonStepFloat { get { return value1.ButtonStepFloat; } set { value1.ButtonStepFloat = value; value2.ButtonStepFloat = value; } }
public bool AllowValueLinking { get { return allowValueLinking; } set { allowValueLinking = value; updateButtons(); } }
public bool LinkValues { get { return linkValues; } set { linkValues = value; updateButtons(); } }
#endregion
#region ================== Constructor
public PairedFieldsControl() {
InitializeComponent();
bResetPosX = bReset.Left;
}
public void SetValuesFrom(UniFields fields) {
#endregion
#region ================== Methods
public void SetValuesFrom(UniFields fields, bool first) {
blockUpdate = true;
string newValue1;
string newValue2;
@ -38,16 +72,28 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
newValue2 = UDMFTools.GetFloat(fields, field2, defaultValue).ToString();
}
value1.Text = ((!string.IsNullOrEmpty(value1.Text) && value1.Text != newValue1) ? "" : newValue1);
value2.Text = ((!string.IsNullOrEmpty(value2.Text) && value2.Text != newValue2) ? "" : newValue2);
if(first) {
value1.Text = newValue1;
value2.Text = newValue2;
} else {
value1.Text = ((!string.IsNullOrEmpty(value1.Text) && value1.Text != newValue1) ? "" : newValue1);
value2.Text = ((!string.IsNullOrEmpty(value2.Text) && value2.Text != newValue2) ? "" : newValue2);
}
checkValues();
blockUpdate = false;
}
public void ApplyTo(UniFields fields, int min, int max) {
if(value1.Text != "")
public void ApplyTo(UniFields fields, int min, int max, float oldValue1, float oldValue2) {
if(value1.Text != "")
UDMFTools.SetFloat(fields, field1, General.Clamp(value1.GetResultFloat(defaultValue), min, max), defaultValue, false);
else
UDMFTools.SetFloat(fields, field1, oldValue1, defaultValue, false);
if(value2.Text != "")
UDMFTools.SetFloat(fields, field2, General.Clamp(value2.GetResultFloat(defaultValue), min, max), defaultValue, false);
else
UDMFTools.SetFloat(fields, field2, oldValue2, defaultValue, false);
}
private void checkValues() {
@ -58,6 +104,28 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
label.Enabled = changed;
bReset.Visible = changed;
if(!blockUpdate && OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void updateButtons() {
bLink.Visible = allowValueLinking;
if(!allowValueLinking) {
bReset.Left = bLink.Left;
} else {
bReset.Left = bResetPosX;
bLink.Image = (linkValues ? Resources.Link : Resources.Unlink);
}
}
#endregion
#region ================== Events
private void bLink_Click(object sender, EventArgs e) {
linkValues = !linkValues;
bLink.Image = (linkValues ? Resources.Link : Resources.Unlink);
}
private void bReset_Click(object sender, EventArgs e) {
@ -68,7 +136,29 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
}
private void value1_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
if(linkValues) {
blockUpdate = true;
value2.Text = value1.Text;
blockUpdate = false;
}
checkValues();
}
private void value2_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
if(linkValues) {
blockUpdate = true;
value1.Text = value2.Text;
blockUpdate = false;
}
checkValues();
}
#endregion
}
}

View file

@ -1,22 +1,43 @@
using System;
#region ================== Namespaces
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.GZBuilder.Controls
{
public partial class PairedIntControl : UserControl
{
#region ================== Events
public event EventHandler OnValuesChanged;
#endregion
#region ================== Variables
private int defaultValue;
private bool blockUpdate;
#endregion
#region ================== Properties
public string Label { get { return label.Text; } set { label.Text = value; } }
public int DefaultValue { get { return defaultValue; } set { defaultValue = value; } }
public int ButtonStep { get { return (int)value1.ButtonStep; } set { value1.ButtonStep = value; value2.ButtonStep = value; } }
#endregion
public PairedIntControl() {
InitializeComponent();
}
public void SetValues(int val1, int val2) {
blockUpdate = true;
if(!string.IsNullOrEmpty(value1.Text) && value1.Text != val1.ToString())
value1.Text = "";
else
@ -26,6 +47,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
value2.Text = "";
else
value2.Text = val2.ToString();
blockUpdate = false;
}
public int GetValue1(int original) {
@ -44,6 +67,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
label.Enabled = changed;
bReset.Visible = changed;
if(!blockUpdate && OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void bReset_Click(object sender, EventArgs e) {

View file

@ -18,7 +18,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
}
}
public enum GZDoomLightType : int
public enum GZDoomLightType
{
NORMAL = 0,
PULSE = 1,
@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
}
//divide these by 100 to get light color alpha
public enum GZDoomLightRenderStyle : int
public enum GZDoomLightRenderStyle
{
NONE = 0,
NORMAL = 99,

View file

@ -1,6 +1,6 @@

namespace CodeImp.DoomBuilder.GZBuilder.Data {
public enum GameType : int {
public enum GameType {
UNKNOWN = 0,
DOOM = 1,
HERETIC = 2,

View file

@ -1,6 +1,6 @@

namespace CodeImp.DoomBuilder.GZBuilder.Data {
internal enum ScriptType : int {
internal enum ScriptType {
UNKNOWN = 0,
ACS = 1,
MODELDEF = 2,

View file

@ -74,7 +74,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
//texture has unsupported extension?
if(mde.TextureNames[i] == TextureData.INVALID_TEXTURE) {
foreach(Mesh m in result.Meshes)
for (int c = 0; c < result.Meshes.Count; c++)
mde.Model.Textures.Add(General.Map.Data.UnknownTexture3D.Texture);
//texture not defined in MODELDEF?

View file

@ -530,7 +530,7 @@ namespace CodeImp.DoomBuilder
internal static void Main(string[] args)
{
Uri localpath;
Version thisversion;
//Version thisversion;
// Determine states
#if DEBUG
@ -555,7 +555,7 @@ namespace CodeImp.DoomBuilder
// Get a reference to this assembly
thisasm = Assembly.GetExecutingAssembly();
thisversion = thisasm.GetName().Version;
//thisversion = thisasm.GetName().Version;
// Find application path
localpath = new Uri(Path.GetDirectoryName(thisasm.GetName().CodeBase));

View file

@ -345,7 +345,7 @@ namespace CodeImp.DoomBuilder
catch(Exception e)
{
// Unable to start the program
General.ShowErrorMessage("Unable to start the test program, " + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK); ;
General.ShowErrorMessage("Unable to start the test program, " + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK);
}
General.MainWindow.DisplayReady();

View file

@ -115,7 +115,7 @@ namespace CodeImp.DoomBuilder.Geometry
ry = 0;
}
float r = (float)Math.Sqrt(rx * rx + ry * ry); // length of the summed vector - not being used, but there it is anyway
//float r = (float)Math.Sqrt(rx * rx + ry * ry); // length of the summed vector - not being used, but there it is anyway
float theta = (float)Math.Atan2(ry, rx); // angle of the new vector
float controlDist = Math.Min(a, b) * z; // Distance of curve control points from current point: a fraction the length of the shorter adjacent triangle side

View file

@ -860,7 +860,6 @@ namespace CodeImp.DoomBuilder.Geometry
List<Vertex> newverts = new List<Vertex>();
List<Vertex> intersectverts = new List<Vertex>();
List<Linedef> newlines = new List<Linedef>();
List<bool> newlinescw = new List<bool>();
List<Linedef> oldlines = new List<Linedef>(General.Map.Map.Linedefs);
List<Sidedef> insidesides = new List<Sidedef>();
List<Vertex> mergeverts = new List<Vertex>();

View file

@ -155,7 +155,7 @@ namespace CodeImp.DoomBuilder.IO
private const string ERROR_ASSIGNINVALID = "Invalid assignment. Missing a previous terminator symbol?";
private const string ERROR_VALUEINVALID = "Invalid value in assignment. Missing a previous terminator symbol?";
private const string ERROR_VALUETOOBIG = "Value too big.";
private const string ERROR_KEYNOTUNQIUE = "Key is not unique within scope.";
//private const string ERROR_KEYNOTUNQIUE = "Key is not unique within scope.";
private const string ERROR_KEYWORDUNKNOWN = "Unknown keyword in assignment. Missing a previous terminator symbol?";
private const string ERROR_UNEXPECTED_END = "Unexpected end of data. Missing a previous terminator symbol?";
private const string ERROR_UNKNOWN_FUNCTION = "Unknown function call.";

View file

@ -169,7 +169,6 @@ namespace CodeImp.DoomBuilder.IO
// Returns null on failure
private PixelColorBlock ReadAsPixelData(Stream stream, out int width, out int height)
{
BinaryReader reader = new BinaryReader(stream);
PixelColorBlock pixeldata = null;
byte[] bytes;

View file

@ -175,7 +175,7 @@ namespace CodeImp.DoomBuilder.IO
// Returns null on failure
private PixelColorBlock ReadAsPixelData(Stream stream, out int width, out int height)
{
BinaryReader reader = new BinaryReader(stream);
new BinaryReader(stream);
PixelColorBlock pixeldata = null;
float sqrlength;
byte[] bytes;

View file

@ -59,12 +59,10 @@ namespace CodeImp.DoomBuilder.IO
{
BinaryReader reader = new BinaryReader(stream);
int width, height;
int dataoffset;
int datalength;
int columnaddr;
// Initialize
dataoffset = (int)stream.Position;
datalength = (int)stream.Length - (int)stream.Position;
// Need at least 4 bytes

View file

@ -47,7 +47,7 @@ namespace CodeImp.DoomBuilder.IO
// Error strings
private const string ERROR_KEYMISSING = "Missing key name in assignment or scope.";
private const string ERROR_KEYCHARACTERS = "Invalid characters in key name.";
private const string ERROR_ASSIGNINVALID = "Invalid assignment. Missing a previous terminator symbol?";
//private const string ERROR_ASSIGNINVALID = "Invalid assignment. Missing a previous terminator symbol?";
private const string ERROR_VALUEINVALID = "Invalid value in assignment. Missing a previous terminator symbol?";
private const string ERROR_VALUETOOBIG = "Value too big.";
private const string ERROR_KEYWITHOUTVALUE = "Key has no value assigned.";

View file

@ -95,6 +95,10 @@ namespace CodeImp.DoomBuilder.IO
config.WriteSetting("managedfields.linedef." + fn, true);
}
//mxd. Add sidedef flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.SidedefFlags)
config.WriteSetting("managedfields.sidedef." + flag.Key, true);
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
@ -308,13 +312,18 @@ namespace CodeImp.DoomBuilder.IO
string tmid = GetCollectionEntry<string>(sc, "texturemiddle", false, "-", where);
int sector = GetCollectionEntry<int>(sc, "sector", true, 0, where);
//mxd. Flags
Dictionary<string, bool> stringflags = new Dictionary<string, bool>();
foreach(KeyValuePair<string, string> flag in General.Map.Config.SidedefFlags)
stringflags[flag.Key] = GetCollectionEntry<bool>(sc, flag.Key, false, false, where);
// Create sidedef
if(sectorlink.ContainsKey(sector))
{
Sidedef s = map.CreateSidedef(ld, front, sectorlink[sector]);
if(s != null)
{
s.Update(offsetx, offsety, thigh, tmid, tlow);
s.Update(offsetx, offsety, thigh, tmid, tlow, stringflags);
// Custom fields
ReadCustomFields(sc, s, "sidedef");

View file

@ -220,8 +220,6 @@ namespace CodeImp.DoomBuilder.IO
// Go for all sidedefs
foreach(Sidedef s in sidedefs)
{
int sectorid = (s.Sector != null) ? sectorids[s.Sector] : -1;
// Make collection
UniversalCollection coll = new UniversalCollection();
if(s.OffsetX != 0) coll.Add("offsetx", s.OffsetX);
@ -231,6 +229,10 @@ namespace CodeImp.DoomBuilder.IO
if(s.LongMiddleTexture != MapSet.EmptyLongName) coll.Add("texturemiddle", s.MiddleTexture);
coll.Add("sector", sectorids[s.Sector]);
coll.Comment = s.Index.ToString();
//mxd. Flags
foreach(KeyValuePair<string, bool> flag in s.Flags)
if(flag.Value) coll.Add(flag.Key, flag.Value);
// Add custom fields
AddCustomFields(s, "sidedef", coll);

View file

@ -27,10 +27,6 @@ namespace CodeImp.DoomBuilder.Map
{
public sealed class Sidedef : MapElement
{
#region ================== Constants
#endregion
#region ================== Variables
// Map
@ -55,6 +51,9 @@ namespace CodeImp.DoomBuilder.Map
private long longtexnamemid;
private long longtexnamelow;
//mxd. UDMF properties
private Dictionary<string, bool> flags;
// Clone
private int serializedindex;
@ -67,6 +66,7 @@ namespace CodeImp.DoomBuilder.Map
public Linedef Line { get { return linedef; } }
public Sidedef Other { get { if(this == linedef.Front) return linedef.Back; else return linedef.Front; } }
public Sector Sector { get { return sector; } }
internal Dictionary<string, bool> Flags { get { return flags; } } //mxd
public float Angle { get { if(IsFront) return linedef.Angle; else return Angle2D.Normalized(linedef.Angle + Angle2D.PI); } }
public int OffsetX { get { return offsetx; } set { BeforePropsChange(); offsetx = value; } }
public int OffsetY { get { return offsety; } set { BeforePropsChange(); offsety = value; } }
@ -94,6 +94,7 @@ namespace CodeImp.DoomBuilder.Map
this.longtexnamehigh = MapSet.EmptyLongName;
this.longtexnamemid = MapSet.EmptyLongName;
this.longtexnamelow = MapSet.EmptyLongName;
this.flags = new Dictionary<string, bool>(); //mxd
// Attach linedef
this.linedef = l;
@ -165,6 +166,28 @@ namespace CodeImp.DoomBuilder.Map
base.ReadWrite(s);
//mxd
if(s.IsWriting) {
s.wInt(flags.Count);
foreach(KeyValuePair<string, bool> f in flags) {
s.wString(f.Key);
s.wBool(f.Value);
}
} else {
int c;
s.rInt(out c);
flags = new Dictionary<string, bool>(c);
for(int i = 0; i < c; i++) {
string t;
s.rString(out t);
bool b;
s.rBool(out b);
flags.Add(t, b);
}
}
s.rwInt(ref offsetx);
s.rwInt(ref offsety);
s.rwString(ref texnamehigh);
@ -189,6 +212,7 @@ namespace CodeImp.DoomBuilder.Map
s.longtexnamehigh = longtexnamehigh;
s.longtexnamemid = longtexnamemid;
s.longtexnamelow = longtexnamelow;
s.flags = new Dictionary<string, bool>(flags); //mxd
base.CopyPropertiesTo(s);
}
@ -241,6 +265,35 @@ namespace CodeImp.DoomBuilder.Map
#endregion
#region ================== Methods
// This checks and returns a flag without creating it
public bool IsFlagSet(string flagname) {
if(flags.ContainsKey(flagname))
return flags[flagname];
else
return false;
}
// This sets a flag
public void SetFlag(string flagname, bool value) {
if(!flags.ContainsKey(flagname) || (IsFlagSet(flagname) != value)) {
BeforePropsChange();
flags[flagname] = value;
}
}
// This returns a copy of the flags dictionary
public Dictionary<string, bool> GetFlags() {
return new Dictionary<string, bool>(flags);
}
// This clears all flags
public void ClearFlags() {
BeforePropsChange();
flags.Clear();
}
// This removes textures that are not required
public void RemoveUnneededTextures(bool removemiddle)
@ -460,13 +513,19 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Changes
// This updates all properties
public void Update(int offsetx, int offsety, string thigh, string tmid, string tlow)
public void Update(int offsetx, int offsety, string thigh, string tmid, string tlow) {
Update(offsetx, offsety, thigh, tmid, tlow, new Dictionary<string, bool>());
}
//mxd. This updates all properties (UDMF version)
public void Update(int offsetx, int offsety, string thigh, string tmid, string tlow, Dictionary<string, bool> flags)
{
BeforePropsChange();
// Apply changes
this.offsetx = offsetx;
this.offsety = offsety;
this.flags = new Dictionary<string, bool>(flags); //mxd
SetTextureHigh(thigh);
SetTextureMid(tmid);
SetTextureLow(tlow);

View file

@ -263,6 +263,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap Link {
get {
object obj = ResourceManager.GetObject("Link", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap List {
get {
object obj = ResourceManager.GetObject("List", resourceCulture);
@ -613,6 +620,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap Unlink {
get {
object obj = ResourceManager.GetObject("Unlink", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Unpin {
get {
object obj = ResourceManager.GetObject("Unpin", resourceCulture);

View file

@ -118,8 +118,8 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="mergegeometry2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Monster3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Monster3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -187,6 +187,9 @@
<data name="Status2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Status2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Unpin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Unpin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Redo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -223,9 +226,6 @@
<data name="fx" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\fx.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mergegeometry2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -235,9 +235,15 @@
<data name="List" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\List.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Keyboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Keyboard.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Question" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Question.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Reset" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Reset.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -319,6 +325,9 @@
<data name="Light_animate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="TagStatistics" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TagStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -337,6 +346,12 @@
<data name="Grid2_arrowup" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Pin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ViewNormal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ViewNormal.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -370,22 +385,13 @@
<data name="Text" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Text.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="TagStatistics" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TagStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Check" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Keyboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Keyboard.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Link" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Reset" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Reset.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Pin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Unpin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Unpin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Unlink" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Unlink.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -324,11 +324,11 @@ namespace CodeImp.DoomBuilder.Rendering
}
// This is to disable the automatic resize reset
private static void CancelResize(object sender, CancelEventArgs e)
/*private static void CancelResize(object sender, CancelEventArgs e)
{
// Cancel resize event
e.Cancel = true;
}
}*/
// This creates present parameters
private PresentParameters CreatePresentParameters(int adapter)
@ -376,10 +376,8 @@ namespace CodeImp.DoomBuilder.Rendering
// This resets the device and returns true on success
internal bool Reset()
{
PresentParameters displaypp;
// Test the cooperative level
Result coopresult = device.TestCooperativeLevel();
//Result coopresult = device.TestCooperativeLevel();
// Can we reset?
//if(coopresult.Name != "D3DERR_DEVICENOTRESET")
@ -394,7 +392,7 @@ namespace CodeImp.DoomBuilder.Rendering
depthbuffer = null;
// Make present parameters
displaypp = CreatePresentParameters(adapter);
PresentParameters displaypp = CreatePresentParameters(adapter);
try
{

View file

@ -49,7 +49,7 @@ namespace CodeImp.DoomBuilder.Rendering
private const float THING_CIRCLE_SIZE = 1f;
private const float THING_CIRCLE_SHRINK = 0f;
private const int THING_BUFFER_SIZE = 100;
private const float THINGS_BACK_ALPHA = 0.3f;
//private const float THINGS_BACK_ALPHA = 0.3f;
private const string FONT_NAME = "Verdana";
private const int FONT_WIDTH = 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View file

@ -476,8 +476,7 @@ namespace CodeImp.DoomBuilder.VisualModes
protected void DoCulling()
{
Dictionary<Linedef, Linedef> visiblelines = new Dictionary<Linedef, Linedef>(200);
Vector2D campos2d = (Vector2D)General.Map.VisualCamera.Position;
float viewdist = General.Settings.ViewDistance;
Vector2D campos2d = General.Map.VisualCamera.Position;
// Make collections
visiblesectors = new Dictionary<Sector, VisualSector>(visiblesectors.Count);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -171,9 +171,6 @@
<metadata name="activationlabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
@ -204,9 +201,6 @@
<metadata name="flags.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="checkBox1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabproperties.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Windows
private const int MAX_RECENT_FILES_PIXELS = 250;
// Dockers
private const int DOCKER_TAB_WIDTH = 20;
//private const int DOCKER_TAB_WIDTH = 20;
// Status bar
private const string STATUS_READY_TEXT = "Ready.";
@ -96,8 +96,8 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Delegates
private delegate void CallUpdateStatusIcon();
private delegate void CallImageDataLoaded(ImageData img);
//private delegate void CallUpdateStatusIcon();
//private delegate void CallImageDataLoaded(ImageData img);
private delegate void CallBlink(); //mxd
#endregion
@ -287,9 +287,6 @@ namespace CodeImp.DoomBuilder.Windows
// This sets up the interface
internal void SetupInterface()
{
float scalex = this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width;
float scaley = this.CurrentAutoScaleDimensions.Height / this.AutoScaleDimensions.Height;
// Setup docker
if(General.Settings.DockersPosition != 2)
{
@ -2094,9 +2091,6 @@ namespace CodeImp.DoomBuilder.Windows
// Tag set for this item?
if((item.Tag != null) && (item.Tag is string))
{
// Get the action name
string actionname = item.Tag.ToString();
// Check if the tag doe not already begin with the assembly name
if(!(item.Tag as string).StartsWith(plugin.Name + "_", StringComparison.InvariantCultureIgnoreCase))
{
@ -2993,6 +2987,7 @@ namespace CodeImp.DoomBuilder.Windows
// Show line edit dialog
LinedefEditForm f = new LinedefEditForm();
f.Setup(lines);
f.OnValuesChanged += new EventHandler(EditForm_OnValuesChanged);
result = f.ShowDialog(this);
f.Dispose();
@ -3030,6 +3025,7 @@ namespace CodeImp.DoomBuilder.Windows
// Show thing edit dialog
ThingEditForm f = new ThingEditForm();
f.Setup(things);
f.OnValuesChanged += new EventHandler(EditForm_OnValuesChanged);
result = f.ShowDialog(this);
f.Dispose();
@ -3038,8 +3034,7 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void EditForm_OnValuesChanged(object sender, EventArgs e) {
if(OnEditFormValuesChanged != null)
OnEditFormValuesChanged(sender, e);
if(OnEditFormValuesChanged != null) OnEditFormValuesChanged(sender, e);
}
#endregion

View file

@ -390,21 +390,6 @@ namespace CodeImp.DoomBuilder.Windows
viewdistancelabel.Text = value.ToString() + " mp";
}
private void scriptfontname_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateScriptFontPreview();
}
private void scriptfontsize_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateScriptFontPreview();
}
private void scriptfontbold_CheckedChanged(object sender, EventArgs e)
{
UpdateScriptFontPreview();
}
private void autoscrollspeed_ValueChanged(object sender, EventArgs e)
{
if(autoscrollspeed.Value == 0)
@ -704,14 +689,6 @@ namespace CodeImp.DoomBuilder.Windows
}
}
// Key combination displayed
private void actionkey_TextChanged(object sender, EventArgs e)
{
// Cursor to the end
actionkey.SelectionStart = actionkey.Text.Length;
actionkey.SelectionLength = 0;
}
// Special key selected
private void actioncontrol_SelectedIndexChanged(object sender, EventArgs e)
{

View file

@ -37,7 +37,7 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Variables
private ICollection<Sector> sectors;
private List<SectorProperties> sectorProps;
private List<SectorProperties> sectorProps; //mxd
private bool blockUpdate; //mxd
private struct SectorProperties //mxd
@ -85,14 +85,19 @@ namespace CodeImp.DoomBuilder.Windows
// This sets up the form to edit the given sectors
public void Setup(ICollection<Sector> sectors)
{
blockUpdate = true;
blockUpdate = true; //mxd
Sector sc;
// Keep this list
this.sectors = sectors;
if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")";
sectorProps = new List<SectorProperties>();
sectorProps = new List<SectorProperties>(); //mxd
//mxd. Make undo
string undodesc = "sector";
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
////////////////////////////////////////////////////////////////////////
// Set all options to the first sector properties
@ -142,12 +147,7 @@ namespace CodeImp.DoomBuilder.Windows
// Show sector height
UpdateSectorHeight();
//mxd. Make undo
string undodesc = "sector";
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
blockUpdate = false;
blockUpdate = false; //mxd
}
// This updates the sector height field
@ -227,6 +227,7 @@ namespace CodeImp.DoomBuilder.Windows
// Done
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); //mxd
this.DialogResult = DialogResult.OK;
this.Close();
}
@ -235,7 +236,7 @@ namespace CodeImp.DoomBuilder.Windows
private void cancel_Click(object sender, EventArgs e)
{
//mxd. perform undo
General.Map.UndoRedo.PerformUndo();
General.Map.UndoRedo.WithdrawUndo();
// And be gone
this.DialogResult = DialogResult.Cancel;
@ -257,7 +258,7 @@ namespace CodeImp.DoomBuilder.Windows
#endregion
#region ================== mxd. Control Events
#region ================== mxd. Realtime Events
// Ceiling height changes
private void ceilingheight_TextChanged(object sender, EventArgs e)

View file

@ -159,6 +159,7 @@
this.fadeColor.Name = "fadeColor";
this.fadeColor.Size = new System.Drawing.Size(207, 31);
this.fadeColor.TabIndex = 30;
this.fadeColor.OnValueChanged += new System.EventHandler(this.fadeColor_OnValueChanged);
//
// lightColor
//
@ -169,6 +170,7 @@
this.lightColor.Name = "lightColor";
this.lightColor.Size = new System.Drawing.Size(207, 29);
this.lightColor.TabIndex = 29;
this.lightColor.OnValueChanged += new System.EventHandler(this.lightColor_OnValueChanged);
//
// brightness
//
@ -182,6 +184,7 @@
this.brightness.Size = new System.Drawing.Size(81, 24);
this.brightness.StepValues = null;
this.brightness.TabIndex = 24;
this.brightness.WhenTextChanged += new System.EventHandler(this.brightness_WhenTextChanged);
//
// desaturation
//
@ -458,9 +461,9 @@
// floorAngleControl
//
this.floorAngleControl.Angle = 0;
this.floorAngleControl.Location = new System.Drawing.Point(186, 113);
this.floorAngleControl.Location = new System.Drawing.Point(186, 108);
this.floorAngleControl.Name = "floorAngleControl";
this.floorAngleControl.Size = new System.Drawing.Size(32, 32);
this.floorAngleControl.Size = new System.Drawing.Size(38, 38);
this.floorAngleControl.TabIndex = 56;
this.floorAngleControl.AngleChanged += new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl.AngleChangedDelegate(this.floorAngleControl_AngleChanged);
//
@ -530,9 +533,9 @@
this.floorLightAbsolute.Name = "floorLightAbsolute";
this.floorLightAbsolute.Size = new System.Drawing.Size(69, 18);
this.floorLightAbsolute.TabIndex = 49;
this.floorLightAbsolute.Tag = "lightfloorabsolute";
this.floorLightAbsolute.Text = "Absolute";
this.floorLightAbsolute.UseVisualStyleBackColor = true;
this.floorLightAbsolute.CheckedChanged += new System.EventHandler(this.floorLightAbsolute_CheckedChanged);
//
// label12
//
@ -557,6 +560,7 @@
this.floorBrightness.StepValues = null;
this.floorBrightness.TabIndex = 48;
this.floorBrightness.Tag = "lightfloor";
this.floorBrightness.WhenTextChanged += new System.EventHandler(this.floorBrightness_WhenTextChanged);
//
// floorRenderStyle
//
@ -573,30 +577,38 @@
// floorScale
//
this.floorScale.AllowDecimal = true;
this.floorScale.AllowValueLinking = true;
this.floorScale.ButtonStep = 1;
this.floorScale.ButtonStepFloat = 0.1F;
this.floorScale.DefaultValue = 1F;
this.floorScale.Field1 = "xscalefloor";
this.floorScale.Field2 = "yscalefloor";
this.floorScale.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.floorScale.Label = "Texture Scale:";
this.floorScale.LinkValues = false;
this.floorScale.Location = new System.Drawing.Point(23, 51);
this.floorScale.Name = "floorScale";
this.floorScale.Size = new System.Drawing.Size(255, 28);
this.floorScale.Size = new System.Drawing.Size(276, 28);
this.floorScale.TabIndex = 17;
this.floorScale.OnValuesChanged += new System.EventHandler(this.floorScale_OnValuesChanged);
//
// floorOffsets
//
this.floorOffsets.AllowDecimal = true;
this.floorOffsets.AllowValueLinking = false;
this.floorOffsets.ButtonStep = 1;
this.floorOffsets.ButtonStepFloat = 16F;
this.floorOffsets.DefaultValue = 0F;
this.floorOffsets.Field1 = "xpanningfloor";
this.floorOffsets.Field2 = "ypanningfloor";
this.floorOffsets.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.floorOffsets.Label = "Texture Offsets:";
this.floorOffsets.LinkValues = false;
this.floorOffsets.Location = new System.Drawing.Point(23, 19);
this.floorOffsets.Name = "floorOffsets";
this.floorOffsets.Size = new System.Drawing.Size(255, 26);
this.floorOffsets.Size = new System.Drawing.Size(276, 26);
this.floorOffsets.TabIndex = 16;
this.floorOffsets.OnValuesChanged += new System.EventHandler(this.floorOffsets_OnValuesChanged);
//
// floortex
//
@ -605,6 +617,7 @@
this.floortex.Size = new System.Drawing.Size(83, 105);
this.floortex.TabIndex = 15;
this.floortex.TextureName = "";
this.floortex.OnValueChanged += new System.EventHandler(this.floortex_OnValueChanged);
//
// groupBox1
//
@ -633,9 +646,9 @@
// ceilAngleControl
//
this.ceilAngleControl.Angle = 0;
this.ceilAngleControl.Location = new System.Drawing.Point(186, 113);
this.ceilAngleControl.Location = new System.Drawing.Point(186, 108);
this.ceilAngleControl.Name = "ceilAngleControl";
this.ceilAngleControl.Size = new System.Drawing.Size(32, 32);
this.ceilAngleControl.Size = new System.Drawing.Size(38, 38);
this.ceilAngleControl.TabIndex = 55;
this.ceilAngleControl.AngleChanged += new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl.AngleChangedDelegate(this.ceilAngleControl_AngleChanged);
//
@ -705,9 +718,10 @@
this.ceilLightAbsolute.Name = "ceilLightAbsolute";
this.ceilLightAbsolute.Size = new System.Drawing.Size(69, 18);
this.ceilLightAbsolute.TabIndex = 49;
this.ceilLightAbsolute.Tag = "lightceilingabsolute";
this.ceilLightAbsolute.Tag = "";
this.ceilLightAbsolute.Text = "Absolute";
this.ceilLightAbsolute.UseVisualStyleBackColor = true;
this.ceilLightAbsolute.CheckedChanged += new System.EventHandler(this.ceilLightAbsolute_CheckedChanged);
//
// labelLightFront
//
@ -732,6 +746,7 @@
this.ceilBrightness.StepValues = null;
this.ceilBrightness.TabIndex = 48;
this.ceilBrightness.Tag = "lightceiling";
this.ceilBrightness.WhenTextChanged += new System.EventHandler(this.ceilBrightness_WhenTextChanged);
//
// ceilRenderStyle
//
@ -748,30 +763,38 @@
// ceilScale
//
this.ceilScale.AllowDecimal = true;
this.ceilScale.AllowValueLinking = true;
this.ceilScale.ButtonStep = 1;
this.ceilScale.ButtonStepFloat = 0.1F;
this.ceilScale.DefaultValue = 1F;
this.ceilScale.Field1 = "xscaleceiling";
this.ceilScale.Field2 = "yscaleceiling";
this.ceilScale.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ceilScale.Label = "Texture Scale:";
this.ceilScale.LinkValues = false;
this.ceilScale.Location = new System.Drawing.Point(23, 51);
this.ceilScale.Name = "ceilScale";
this.ceilScale.Size = new System.Drawing.Size(255, 28);
this.ceilScale.Size = new System.Drawing.Size(276, 28);
this.ceilScale.TabIndex = 17;
this.ceilScale.OnValuesChanged += new System.EventHandler(this.ceilScale_OnValuesChanged);
//
// ceilOffsets
//
this.ceilOffsets.AllowDecimal = true;
this.ceilOffsets.AllowValueLinking = false;
this.ceilOffsets.ButtonStep = 1;
this.ceilOffsets.ButtonStepFloat = 16F;
this.ceilOffsets.DefaultValue = 0F;
this.ceilOffsets.Field1 = "xpanningceiling";
this.ceilOffsets.Field2 = "ypanningceiling";
this.ceilOffsets.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.ceilOffsets.Label = "Texture Offsets:";
this.ceilOffsets.LinkValues = false;
this.ceilOffsets.Location = new System.Drawing.Point(23, 19);
this.ceilOffsets.Name = "ceilOffsets";
this.ceilOffsets.Size = new System.Drawing.Size(255, 26);
this.ceilOffsets.Size = new System.Drawing.Size(276, 26);
this.ceilOffsets.TabIndex = 16;
this.ceilOffsets.OnValuesChanged += new System.EventHandler(this.ceilOffsets_OnValuesChanged);
//
// ceilingtex
//
@ -780,6 +803,7 @@
this.ceilingtex.Size = new System.Drawing.Size(83, 105);
this.ceilingtex.TabIndex = 15;
this.ceilingtex.TextureName = "";
this.ceilingtex.OnValueChanged += new System.EventHandler(this.ceilingtex_OnValueChanged);
//
// tabcustom
//
@ -813,6 +837,8 @@
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldUndefined += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
//
// cancel
//

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.GZBuilder.Tools;
namespace CodeImp.DoomBuilder.Windows
@ -19,6 +18,78 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Variables
private ICollection<Sector> sectors;
private List<SectorProperties> sectorProps; //mxd
private bool blockUpdate; //mxd
//Value linking
private static bool linkCeilingScale;
private static bool linkFloorScale;
private struct SectorProperties //mxd
{
public int Brightness;
public int FloorHeight;
public int CeilHeight;
public string FloorTexture;
public string CeilTexture;
//UDMF stuff
public int LightColor;
public int FadeColor;
//public float Desaturation;
//UDMF Ceiling
public float CeilOffsetX;
public float CeilOffsetY;
public float CeilScaleX;
public float CeilScaleY;
//public float CeilAlpha;
public float CeilRotation;
public int CeilBrightness;
public bool CeilLightAbsoulte;
//UDMF Floor
public float FloorOffsetX;
public float FloorOffsetY;
public float FloorScaleX;
public float FloorScaleY;
//public float FloorAlpha;
public float FloorRotation;
public int FloorBrightness;
public bool FloorLightAbsoulte;
public SectorProperties(Sector s) {
Brightness = s.Brightness;
FloorHeight = s.FloorHeight;
CeilHeight = s.CeilHeight;
FloorTexture = s.FloorTexture;
CeilTexture = s.CeilTexture;
//UDMF stuff
LightColor = UDMFTools.GetInteger(s.Fields, "lightcolor", 16777215);
FadeColor = UDMFTools.GetInteger(s.Fields, "fadecolor", 0);
//UDMF Ceiling
CeilOffsetX = UDMFTools.GetFloat(s.Fields, "xpanningceiling", 0f);
CeilOffsetY = UDMFTools.GetFloat(s.Fields, "ypanningceiling", 0f);
CeilScaleX = UDMFTools.GetFloat(s.Fields, "xscaleceiling", 1.0f);
CeilScaleY = UDMFTools.GetFloat(s.Fields, "yscaleceiling", 1.0f);
//CeilAlpha = UDMFTools.GetFloat(s.Fields, "alphaceiling", 1.0f);
CeilRotation = s.Fields.GetValue("rotationceiling", 0.0f);
CeilBrightness = s.Fields.GetValue("lightceiling", 0);
CeilLightAbsoulte = s.Fields.GetValue("lightceilingabsolute", false);
//UDMF Floor
FloorOffsetX = UDMFTools.GetFloat(s.Fields, "xpanningfloor", 0f);
FloorOffsetY = UDMFTools.GetFloat(s.Fields, "ypanningfloor", 0f);
FloorScaleX = UDMFTools.GetFloat(s.Fields, "xscalefloor", 1.0f);
FloorScaleY = UDMFTools.GetFloat(s.Fields, "yscalefloor", 1.0f);
//FloorAlpha = UDMFTools.GetFloat(s.Fields, "alphafloor", 1.0f);
FloorRotation = s.Fields.GetValue("rotationfloor", 0.0f);
FloorBrightness = s.Fields.GetValue("lightfloor", 0);
FloorLightAbsoulte = s.Fields.GetValue("lightfloorabsolute", false);
}
}
#endregion
@ -50,6 +121,10 @@ namespace CodeImp.DoomBuilder.Windows
// Initialize custom fields editor
fieldslist.Setup("sector");
// Value linking
ceilScale.LinkValues = linkCeilingScale;
floorScale.LinkValues = linkFloorScale;
}
#endregion
@ -58,18 +133,24 @@ namespace CodeImp.DoomBuilder.Windows
// This sets up the form to edit the given sectors
public void Setup(ICollection<Sector> sectors) {
Sector sc;
blockUpdate = true; //mxd
// Keep this list
this.sectors = sectors;
if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")";
sectorProps = new List<SectorProperties>(); //mxd
//mxd. Make undo
string undodesc = "sector";
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
////////////////////////////////////////////////////////////////////////
// Set all options to the first sector properties
////////////////////////////////////////////////////////////////////////
// Get first sector
sc = General.GetByIndex(sectors, 0);
Sector sc = General.GetByIndex(sectors, 0);
// Flags
foreach(CheckBox c in flags.Checkboxes)
@ -87,12 +168,12 @@ namespace CodeImp.DoomBuilder.Windows
//UDMF stuff
//Texture offsets
ceilOffsets.SetValuesFrom(sc.Fields);
floorOffsets.SetValuesFrom(sc.Fields);
ceilOffsets.SetValuesFrom(sc.Fields, true);
floorOffsets.SetValuesFrom(sc.Fields, true);
//Texture scale
ceilScale.SetValuesFrom(sc.Fields);
floorScale.SetValuesFrom(sc.Fields);
ceilScale.SetValuesFrom(sc.Fields, true);
floorScale.SetValuesFrom(sc.Fields, true);
//Texture rotation
float ceilAngle = sc.Fields.GetValue("rotationceiling", 0.0f);
@ -107,6 +188,8 @@ namespace CodeImp.DoomBuilder.Windows
//Texture brightness
ceilBrightness.Text = sc.Fields.GetValue("lightceiling", 0).ToString();
floorBrightness.Text = sc.Fields.GetValue("lightfloor", 0).ToString();
ceilLightAbsolute.Checked = sc.Fields.GetValue("lightceilingabsolute", false);
floorLightAbsolute.Checked = sc.Fields.GetValue("lightfloorabsolute", false);
//Alpha
ceilAlpha.Text = General.Clamp(sc.Fields.GetValue("alphaceiling", 1.0f), 0f, 1f).ToString();
@ -160,12 +243,12 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. UDMF stuff
//Texture offsets
ceilOffsets.SetValuesFrom(s.Fields);
floorOffsets.SetValuesFrom(s.Fields);
ceilOffsets.SetValuesFrom(s.Fields, false);
floorOffsets.SetValuesFrom(s.Fields, false);
//Texture scale
ceilScale.SetValuesFrom(s.Fields);
floorScale.SetValuesFrom(s.Fields);
ceilScale.SetValuesFrom(s.Fields, false);
floorScale.SetValuesFrom(s.Fields, false);
//Texture rotation
if(s.Fields.GetValue("rotationceiling", 0.0f).ToString() != ceilRotation.Text) {
@ -179,7 +262,17 @@ namespace CodeImp.DoomBuilder.Windows
//Texture brightness
if(s.Fields.GetValue("lightceiling", 0).ToString() != ceilBrightness.Text) ceilBrightness.Text = "";
if(s.Fields.GetValue("lightfloor", 0).ToString() != floorBrightness.Text) floorBrightness.Text = "";
if(s.Fields.GetValue("lightfloor", 0).ToString() != floorBrightness.Text)
floorBrightness.Text = "";
if(s.Fields.GetValue("lightceilingabsolute", false) != ceilLightAbsolute.Checked) {
ceilLightAbsolute.ThreeState = true;
ceilLightAbsolute.CheckState = CheckState.Indeterminate;
}
if(s.Fields.GetValue("lightfloorabsolute", false) != floorLightAbsolute.Checked) {
floorLightAbsolute.ThreeState = true;
floorLightAbsolute.CheckState = CheckState.Indeterminate;
}
//Alpha
if(s.Fields.GetValue("alphaceiling", 1.0f).ToString() != ceilAlpha.Text) ceilAlpha.Text = "";
@ -202,11 +295,17 @@ namespace CodeImp.DoomBuilder.Windows
if(s.Tag != sc.Tag) tagSelector.ClearTag(); //mxd
// Custom fields
s.Fields.BeforeFieldsChange(); //mxd
fieldslist.SetValues(s.Fields, false);
//mxd. Store initial properties
sectorProps.Add(new SectorProperties(s));
}
// Show sector height
UpdateSectorHeight();
blockUpdate = false; //mxd
}
// This updates the sector height field
@ -250,8 +349,6 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Events
private void apply_Click(object sender, EventArgs e) {
string undodesc = "sector";
// Verify the tag
tagSelector.ValidateTag(); //mxd
if((tagSelector.GetTag(0) < General.Map.FormatInterface.MinTag) || (tagSelector.GetTag(0) > General.Map.FormatInterface.MaxTag)) {
@ -265,10 +362,6 @@ namespace CodeImp.DoomBuilder.Windows
return;
}
// Make undo
if(sectors.Count > 1) undodesc = sectors.Count + " sectors";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
// Go for all sectors
foreach(Sector s in sectors) {
// Apply all flags
@ -281,44 +374,17 @@ namespace CodeImp.DoomBuilder.Windows
if(!effect.Empty) s.Effect = effect.Value;
s.Brightness = General.Clamp(brightness.GetResult(s.Brightness), General.Map.FormatInterface.MinBrightness, General.Map.FormatInterface.MaxBrightness);
// Floor/Ceiling
s.FloorHeight = floorheight.GetResult(s.FloorHeight);
s.CeilHeight = ceilingheight.GetResult(s.CeilHeight);
s.SetFloorTexture(floortex.GetResult(s.FloorTexture));
s.SetCeilTexture(ceilingtex.GetResult(s.CeilTexture));
// Action
s.Tag = tagSelector.GetTag(s.Tag); //mxd
// Custom fields
fieldslist.Apply(s.Fields);
//mxd. UDMF stuff
ceilOffsets.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset);
floorOffsets.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset);
ceilScale.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset);
floorScale.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset);
//rotation
if(ceilRotation.Text != ""){
float angle = General.ClampAngle(ceilRotation.GetResultFloat(0f));
UDMFTools.SetFloat(s.Fields, "rotationceiling", angle, 0f, false);
}
if(floorRotation.Text != "") {
float angle = General.ClampAngle(floorRotation.GetResultFloat(0f));
UDMFTools.SetFloat(s.Fields, "rotationfloor", angle, 0f, false);
}
//alpha
if(ceilAlpha.Text != "") {
float ceilAlphaVal = General.Clamp(ceilAlpha.GetResultFloat(1.0f), 0f, 1f);
if(!string.IsNullOrEmpty(ceilAlpha.Text)) {
float ceilAlphaVal = General.Clamp(ceilAlpha.GetResultFloat(s.Fields.GetValue("alphaceiling", 1.0f)), 0f, 1f);
UDMFTools.SetFloat(s.Fields, "alphaceiling", ceilAlphaVal, 1.0f, false);
}
if(floorAlpha.Text != ""){
float floorAlphaVal = General.Clamp(floorAlpha.GetResultFloat(1.0f), 0f, 1f);
if(!string.IsNullOrEmpty(floorAlpha.Text)){
float floorAlphaVal = General.Clamp(floorAlpha.GetResultFloat(s.Fields.GetValue("alphafloor", 1.0f)), 0f, 1f);
UDMFTools.SetFloat(s.Fields, "alphafloor", floorAlphaVal, 1.0f, false);
}
@ -335,30 +401,12 @@ namespace CodeImp.DoomBuilder.Windows
s.Fields.Remove("renderstylefloor");
}
//brightness
if(!string.IsNullOrEmpty(ceilBrightness.Text)) {
string key = ceilBrightness.Tag.ToString();
bool absolute = (ceilLightAbsolute.CheckState == CheckState.Checked);
int value = General.Clamp(ceilBrightness.GetResult(UDMFTools.GetInteger(s.Fields, key, 0)), (absolute ? 0 : -255), 255);
UDMFTools.SetInteger(s.Fields, key, value, 0, false);
}
if(!string.IsNullOrEmpty(floorBrightness.Text)) {
string key = floorBrightness.Tag.ToString();
bool absolute = (floorLightAbsolute.CheckState == CheckState.Checked);
int value = General.Clamp(floorBrightness.GetResult(UDMFTools.GetInteger(s.Fields, key, 0)), (absolute ? 0 : -255), 255);
UDMFTools.SetInteger(s.Fields, key, value, 0, false);
}
//Sector colors
fadeColor.ApplyTo(s.Fields);
lightColor.ApplyTo(s.Fields);
//misc
if(soundSequence.Text != "") s.Fields["soundsequence"] = new UniValue(UniversalType.String, soundSequence.Text);
if(gravity.Text != "") UDMFTools.SetFloat(s.Fields, "alphafloor", gravity.GetResultFloat(1.0f), 1.0f, false);
if(gravity.Text != "")
UDMFTools.SetFloat(s.Fields, "gravity", gravity.GetResultFloat(s.Fields.GetValue("gravity", 1.0f)), 1.0f, false);
if(desaturation.Text != "") {
float val = General.Clamp(desaturation.GetResultFloat(0f), 0f, 1f);
float val = General.Clamp(desaturation.GetResultFloat(s.Fields.GetValue("desaturation", 0f)), 0f, 1f);
UDMFTools.SetFloat(s.Fields, "desaturation", val, 0f, false);
}
}
@ -366,17 +414,21 @@ namespace CodeImp.DoomBuilder.Windows
// Update the used textures
General.Map.Data.UpdateUsedTextures();
// Store value linking
linkCeilingScale = ceilScale.LinkValues;
linkFloorScale = floorScale.LinkValues;
// Done
General.Map.IsChanged = true;
//dbg
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); //mxd
this.DialogResult = DialogResult.OK;
this.Close();
}
private void cancel_Click(object sender, EventArgs e) {
//mxd. Let's pretend nothing of this really happened...
General.Map.UndoRedo.WithdrawUndo();
// Be gone
this.DialogResult = DialogResult.Cancel;
this.Close();
@ -386,14 +438,6 @@ namespace CodeImp.DoomBuilder.Windows
effect.Value = EffectBrowserForm.BrowseEffect(this, effect.Value);
}
private void ceilingheight_WhenTextChanged(object sender, EventArgs e) {
UpdateSectorHeight();
}
private void floorheight_WhenTextChanged(object sender, EventArgs e) {
UpdateSectorHeight();
}
private void SectorEditFormUDMF_HelpRequested(object sender, HelpEventArgs hlpevent) {
General.ShowHelp("w_sectoredit.html");
hlpevent.Handled = true;
@ -411,14 +455,493 @@ namespace CodeImp.DoomBuilder.Windows
floorRotation.Text = (General.ClampAngle(360 - floorAngleControl.Angle)).ToString();
}
#endregion
#region mxd. Sector Realtime events
private void ceilingheight_WhenTextChanged(object sender, EventArgs e) {
UpdateSectorHeight();
if(blockUpdate) return;
//restore values
if(string.IsNullOrEmpty(ceilingheight.Text)) {
int i = 0;
foreach(Sector s in sectors)
s.CeilHeight = sectorProps[i++].CeilHeight;
//update values
} else {
foreach(Sector s in sectors)
s.CeilHeight = ceilingheight.GetResult(s.CeilHeight);
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void floorheight_WhenTextChanged(object sender, EventArgs e) {
UpdateSectorHeight();
if(blockUpdate) return;
//restore values
if(string.IsNullOrEmpty(floorheight.Text)) {
int i = 0;
foreach(Sector s in sectors)
s.FloorHeight = sectorProps[i++].FloorHeight;
//update values
} else {
foreach(Sector s in sectors)
s.FloorHeight = floorheight.GetResult(s.FloorHeight);
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void brightness_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
//restore values
if(string.IsNullOrEmpty(brightness.Text)) {
int i = 0;
foreach(Sector s in sectors)
s.Brightness = sectorProps[i++].Brightness;
//update values
} else {
//clamp value?
int val = brightness.GetResult(0);
int clampedVal = General.Clamp(val, 0, 255);
if(val != clampedVal) {
brightness.Text = clampedVal.ToString();
return;
}
foreach(Sector s in sectors)
s.Brightness = General.Clamp(brightness.GetResult(s.Brightness), General.Map.FormatInterface.MinBrightness, General.Map.FormatInterface.MaxBrightness);
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void ceilingtex_OnValueChanged(object sender, EventArgs e) {
if(blockUpdate) return;
//restore values
if(string.IsNullOrEmpty(ceilingtex.TextureName)) {
int i = 0;
foreach(Sector s in sectors)
s.SetCeilTexture(sectorProps[i++].CeilTexture);
//update values
} else {
foreach(Sector s in sectors)
s.SetCeilTexture(ceilingtex.GetResult(s.CeilTexture));
}
// Update the used textures
General.Map.Data.UpdateUsedTextures();
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void floortex_OnValueChanged(object sender, EventArgs e) {
if(blockUpdate) return;
//restore values
if(string.IsNullOrEmpty(floortex.TextureName)) {
int i = 0;
foreach(Sector s in sectors)
s.SetFloorTexture(sectorProps[i++].FloorTexture);
//update values
} else {
foreach(Sector s in sectors)
s.SetFloorTexture(floortex.GetResult(s.FloorTexture));
}
// Update the used textures
General.Map.Data.UpdateUsedTextures();
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void floorRotation_WhenTextChanged(object sender, EventArgs e) {
floorAngleControl.Angle = General.ClampAngle(360 - floorRotation.GetResult(0));
if(blockUpdate) return;
int i = 0;
//restore values
if(string.IsNullOrEmpty(floorRotation.Text)) {
foreach(Sector s in sectors) {
UDMFTools.SetFloat(s.Fields, "rotationfloor", sectorProps[i++].FloorRotation, 0f, false);
s.UpdateNeeded = true;
}
//update values
} else {
foreach(Sector s in sectors) {
UDMFTools.SetFloat(s.Fields, "rotationfloor", floorRotation.GetResult((int)sectorProps[i++].FloorRotation), 0f, false);
s.UpdateNeeded = true;
}
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void ceilRotation_WhenTextChanged(object sender, EventArgs e) {
ceilAngleControl.Angle = General.ClampAngle(360 - ceilRotation.GetResult(0));
if(blockUpdate) return;
int i = 0;
//restore values
if(string.IsNullOrEmpty(ceilRotation.Text)) {
foreach(Sector s in sectors) {
UDMFTools.SetFloat(s.Fields, "rotationceiling", sectorProps[i++].CeilRotation, 0f, false);
s.UpdateNeeded = true;
}
//update values
} else {
foreach(Sector s in sectors) {
UDMFTools.SetFloat(s.Fields, "rotationceiling", ceilRotation.GetResult((int)sectorProps[i++].CeilRotation), 0f, false);
s.UpdateNeeded = true;
}
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void fieldslist_OnFieldValueChanged(string fieldname) {
if(blockUpdate) return;
Sector sc = null;
foreach(Sector s in sectors) {
fieldslist.Apply(s.Fields);
s.UpdateNeeded = true;
if(sc == null) sc = s;
}
if(sc == null) return;
//update interface... yaaaay...
switch(fieldname) {
case "xpanningfloor":
case "ypanningfloor":
floorOffsets.SetValuesFrom(sc.Fields, true);
break;
case "xpanningceiling":
case "ypanningceiling":
ceilOffsets.SetValuesFrom(sc.Fields, true);
break;
case "xscalefloor":
case "yscalefloor":
floorScale.SetValuesFrom(sc.Fields, true);
break;
case "xscaleceiling":
case "yscaleceiling":
ceilScale.SetValuesFrom(sc.Fields, true);
break;
case "rotationceiling":
ceilRotation.Text = sc.Fields.GetValue("rotationceiling", 0f).ToString();
break;
case "rotationfloor":
floorRotation.Text = sc.Fields.GetValue("rotationfloor", 0f).ToString();
break;
case "lightfloor":
floorBrightness.Text = sc.Fields.GetValue("lightfloor", 0).ToString();
break;
case "lightceiling":
ceilBrightness.Text = sc.Fields.GetValue("lightceiling", 0).ToString();
break;
case "lightfloorabsolute":
floorLightAbsolute.Checked = sc.Fields.GetValue("lightfloorabsolute", false);
break;
case "lightceilingabsolute":
ceilLightAbsolute.Checked = sc.Fields.GetValue("lightceilingabsolute", false);
break;
case "alphafloor":
floorAlpha.Text = sc.Fields.GetValue("alphafloor", 1.0f).ToString();
break;
case "alphaceiling":
floorAlpha.Text = sc.Fields.GetValue("alphaceiling", 1.0f).ToString();
break;
case "gravity":
gravity.Text = sc.Fields.GetValue("gravity", 1.0f).ToString();
break;
case "desaturation":
desaturation.Text = sc.Fields.GetValue("desaturation", 0f).ToString();
break;
case "lightcolor":
lightColor.SetValueFrom(sc.Fields);
break;
case "fadecolor":
fadeColor.SetValueFrom(sc.Fields);
break;
case "renderstylefloor":
string rsf = sc.Fields.GetValue("renderstylefloor", string.Empty);
if(string.IsNullOrEmpty(rsf) || rsf.ToLower() == "translucent") {
floorRenderStyle.SelectedIndex = 0;
} else {
floorRenderStyle.SelectedIndex = 1;
}
break;
case "renderstyleceiling":
string rsc = sc.Fields.GetValue("renderstyleceiling", string.Empty);
if(string.IsNullOrEmpty(rsc) || rsc.ToLower() == "translucent") {
ceilRenderStyle.SelectedIndex = 0;
} else {
ceilRenderStyle.SelectedIndex = 1;
}
break;
case "soundsequence":
soundSequence.Text = sc.Fields.GetValue("soundsequence", string.Empty);
break;
}
}
private void lightColor_OnValueChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
foreach(Sector s in sectors) {
lightColor.ApplyTo(s.Fields, sectorProps[i++].LightColor);
s.UpdateNeeded = true;
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void fadeColor_OnValueChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
foreach(Sector s in sectors) {
fadeColor.ApplyTo(s.Fields, sectorProps[i++].FadeColor);
s.UpdateNeeded = true;
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
#endregion
#region mxd. Ceiling/Floor realtime events
private void ceilOffsets_OnValuesChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
foreach(Sector s in sectors) {
ceilOffsets.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset, sectorProps[i].CeilOffsetX, sectorProps[i++].CeilOffsetY);
s.UpdateNeeded = true;
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void floorOffsets_OnValuesChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
foreach(Sector s in sectors) {
floorOffsets.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset, sectorProps[i].FloorOffsetX, sectorProps[i++].FloorOffsetY);
s.UpdateNeeded = true;
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void ceilScale_OnValuesChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
foreach(Sector s in sectors) {
ceilScale.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset, sectorProps[i].CeilScaleX, sectorProps[i++].CeilScaleY);
s.UpdateNeeded = true;
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void floorScale_OnValuesChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
foreach(Sector s in sectors) {
floorScale.ApplyTo(s.Fields, General.Map.FormatInterface.MinTextureOffset, General.Map.FormatInterface.MaxTextureOffset, sectorProps[i].FloorScaleX, sectorProps[i++].FloorScaleY);
s.UpdateNeeded = true;
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void ceilBrightness_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
//restore values
if(string.IsNullOrEmpty(ceilBrightness.Text)) {
foreach(Sector s in sectors) {
UDMFTools.SetInteger(s.Fields, "lightceiling", sectorProps[i++].CeilBrightness, 0, false);
s.UpdateNeeded = true;
}
//update values
} else {
foreach(Sector s in sectors) {
bool absolute = false;
if(ceilLightAbsolute.CheckState == CheckState.Indeterminate) {
absolute = s.Fields.GetValue("lightceilingabsolute", false);
} else if(ceilLightAbsolute.CheckState == CheckState.Checked) {
absolute = true;
}
int value = General.Clamp(ceilBrightness.GetResult(sectorProps[i++].CeilBrightness), (absolute ? 0 : -255), 255);
UDMFTools.SetInteger(s.Fields, "lightceiling", value, 0, false);
s.UpdateNeeded = true;
}
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void floorBrightness_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
//restore values
if(string.IsNullOrEmpty(floorBrightness.Text)) {
foreach(Sector s in sectors) {
UDMFTools.SetInteger(s.Fields, "lightfloor", sectorProps[i++].FloorBrightness, 0, false);
s.UpdateNeeded = true;
}
//update values
} else {
foreach(Sector s in sectors) {
bool absolute = false;
if(floorLightAbsolute.CheckState == CheckState.Indeterminate) {
absolute = s.Fields.GetValue("lightfloorabsolute", false);
} else if(floorLightAbsolute.CheckState == CheckState.Checked) {
absolute = true;
}
int value = General.Clamp(floorBrightness.GetResult(sectorProps[i++].FloorBrightness), (absolute ? 0 : -255), 255);
UDMFTools.SetInteger(s.Fields, "lightfloor", value, 0, false);
s.UpdateNeeded = true;
}
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void ceilLightAbsolute_CheckedChanged(object sender, EventArgs e) {
if(blockUpdate) return;
if(ceilLightAbsolute.Checked) {
foreach(Sector s in sectors) {
s.Fields["lightceilingabsolute"] = new UniValue(UniversalType.Boolean, true);
s.UpdateNeeded = true;
}
} else if(ceilLightAbsolute.CheckState == CheckState.Indeterminate) {
int i = 0;
foreach(Sector s in sectors) {
if(sectorProps[i].CeilLightAbsoulte) {
s.Fields["lightceilingabsolute"] = new UniValue(UniversalType.Boolean, true);
s.UpdateNeeded = true;
}else if(s.Fields.ContainsKey("lightceilingabsolute")) {
s.Fields.Remove("lightceilingabsolute");
s.UpdateNeeded = true;
}
i++;
}
} else {
foreach(Sector s in sectors) {
if(s.Fields.ContainsKey("lightceilingabsolute")) {
s.Fields.Remove("lightceilingabsolute");
s.UpdateNeeded = true;
}
}
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void floorLightAbsolute_CheckedChanged(object sender, EventArgs e) {
if(blockUpdate) return;
if(floorLightAbsolute.Checked){
foreach(Sector s in sectors) {
s.Fields["lightfloorabsolute"] = new UniValue(UniversalType.Boolean, true);
s.UpdateNeeded = true;
}
} else if(floorLightAbsolute.CheckState == CheckState.Indeterminate) {
int i = 0;
foreach(Sector s in sectors) {
if(sectorProps[i].FloorLightAbsoulte) {
s.Fields["lightfloorabsolute"] = new UniValue(UniversalType.Boolean, true);
s.UpdateNeeded = true;
} else if(s.Fields.ContainsKey("lightfloorabsolute")) {
s.Fields.Remove("lightfloorabsolute");
s.UpdateNeeded = true;
}
i++;
}
} else {
foreach(Sector s in sectors) {
if(s.Fields.ContainsKey("lightfloorabsolute")) {
s.Fields.Remove("lightfloorabsolute");
s.UpdateNeeded = true;
}
}
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
#endregion
}
}

View file

@ -147,6 +147,12 @@
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tabproperties.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -156,4 +162,7 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -659,8 +659,8 @@ namespace CodeImp.DoomBuilder.Windows
// Fields
private const string blueColorScheme = "NormalColor";
private const string oliveColorScheme = "HomeStead";
private const string silverColorScheme = "Metallic";
private Dictionary<TanColorTable.KnownColors, Color> tanRGB;
//private const string silverColorScheme = "Metallic";
private Dictionary<KnownColors, Color> tanRGB;
// Nested Types
private static class DisplayInformation
@ -668,21 +668,21 @@ namespace CodeImp.DoomBuilder.Windows
// Methods
static DisplayInformation()
{
SystemEvents.UserPreferenceChanged += TanColorTable.DisplayInformation.OnUserPreferenceChanged;
TanColorTable.DisplayInformation.SetScheme();
SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
SetScheme();
}
private static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
TanColorTable.DisplayInformation.SetScheme();
SetScheme();
}
private static void SetScheme()
{
TanColorTable.DisplayInformation.isLunaTheme = false;
isLunaTheme = false;
if(VisualStyleRenderer.IsSupported)
{
DisplayInformation.colorScheme = VisualStyleInformation.ColorScheme;
colorScheme = VisualStyleInformation.ColorScheme;
if(!VisualStyleInformation.IsEnabledByUser)
{
@ -691,11 +691,11 @@ namespace CodeImp.DoomBuilder.Windows
StringBuilder builder1 = new StringBuilder(0x200);
GetCurrentThemeName(builder1, builder1.Capacity, null, 0, null, 0);
string text1 = builder1.ToString();
TanColorTable.DisplayInformation.isLunaTheme = string.Equals(lunaFileName, Path.GetFileName(text1), StringComparison.InvariantCultureIgnoreCase);
isLunaTheme = string.Equals(lunaFileName, Path.GetFileName(text1), StringComparison.InvariantCultureIgnoreCase);
}
else
{
TanColorTable.DisplayInformation.colorScheme = null;
colorScheme = null;
}
}

View file

@ -186,6 +186,7 @@ namespace CodeImp.DoomBuilder.Windows
this.posX.Size = new System.Drawing.Size(72, 24);
this.posX.StepValues = null;
this.posX.TabIndex = 13;
this.posX.WhenTextChanged += new System.EventHandler(this.posX_WhenTextChanged);
//
// posY
//
@ -199,6 +200,7 @@ namespace CodeImp.DoomBuilder.Windows
this.posY.Size = new System.Drawing.Size(72, 24);
this.posY.StepValues = null;
this.posY.TabIndex = 12;
this.posY.WhenTextChanged += new System.EventHandler(this.posY_WhenTextChanged);
//
// posZ
//
@ -212,6 +214,7 @@ namespace CodeImp.DoomBuilder.Windows
this.posZ.Size = new System.Drawing.Size(72, 24);
this.posZ.StepValues = null;
this.posZ.TabIndex = 11;
this.posZ.WhenTextChanged += new System.EventHandler(this.posZ_WhenTextChanged);
//
// angle
//

View file

@ -35,6 +35,12 @@ namespace CodeImp.DoomBuilder.Windows
/// </summary>
internal partial class ThingEditForm : DelayedForm
{
#region ================== Events
public event EventHandler OnValuesChanged; //mxd
#endregion
#region ================== Variables
private ICollection<Thing> things;
@ -43,11 +49,26 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private Vector3D initialPosition; //initial position of a thing used to fill posX, posY and posZ fields
private int initialFloorHeight; //floor height of the sector first thing is in
private static bool ABSOLUTE_HEIGHT;
private static bool useAbsoluteHeight;
#endregion
private List<ThingProperties> thingProps; //mxd
#region ================== Properties
private struct ThingProperties //mxd
{
public int Type;
public int AngleDoom;
public float X;
public float Y;
public float Z;
public ThingProperties(Thing t) {
X = t.Position.x;
Y = t.Position.y;
Z = t.Position.z;
Type = t.Type;
AngleDoom = t.AngleDoom;
}
}
#endregion
@ -85,6 +106,13 @@ namespace CodeImp.DoomBuilder.Windows
posZ.Visible = General.Map.FormatInterface.HasThingHeight;
zlabel.Visible = General.Map.FormatInterface.HasThingHeight;
cbAbsoluteHeight.Visible = General.Map.FormatInterface.HasThingHeight; //mxd
//mxd. Decimals allowed?
if(General.Map.FormatInterface.VertexDecimals > 0) {
posX.AllowDecimal = true;
posY.AllowDecimal = true;
posZ.AllowDecimal = true;
}
// Setup types list
thingtype.Setup();
@ -100,6 +128,11 @@ namespace CodeImp.DoomBuilder.Windows
// Keep this list
this.things = things;
if(things.Count > 1) this.Text = "Edit Things (" + things.Count + ")";
//mxd. Make undo
string undodesc = "thing";
if(things.Count > 1) undodesc = things.Count + " things";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
////////////////////////////////////////////////////////////////////////
// Set all options to the first thing properties
@ -116,8 +149,8 @@ namespace CodeImp.DoomBuilder.Windows
// Coordination
angle.Text = ft.AngleDoom.ToString();
zlabel.Text = ABSOLUTE_HEIGHT ? "Z:" : "Height:"; //mxd
cbAbsoluteHeight.Checked = ABSOLUTE_HEIGHT; //mxd
zlabel.Text = useAbsoluteHeight ? "Z:" : "Height:"; //mxd
cbAbsoluteHeight.Checked = useAbsoluteHeight; //mxd
//mxd
initialPosition = ft.Position;
@ -125,7 +158,7 @@ namespace CodeImp.DoomBuilder.Windows
initialFloorHeight = ft.Sector.FloorHeight;
posX.Text = ((int)ft.Position.x).ToString();
posY.Text = ((int)ft.Position.y).ToString();
posZ.Text = ABSOLUTE_HEIGHT ? ((int)ft.Position.z + initialFloorHeight).ToString() : ((int)ft.Position.z).ToString();
posZ.Text = useAbsoluteHeight ? ((int)ft.Position.z + initialFloorHeight).ToString() : ((int)ft.Position.z).ToString();
posX.ButtonStep = General.Map.Grid.GridSize;
posY.ButtonStep = General.Map.Grid.GridSize;
posZ.ButtonStep = General.Map.Grid.GridSize;
@ -152,7 +185,9 @@ namespace CodeImp.DoomBuilder.Windows
////////////////////////////////////////////////////////////////////////
// Now go for all lines and change the options when a setting is different
////////////////////////////////////////////////////////////////////////
thingProps = new List<ThingProperties>();
// Go for all things
foreach(Thing t in things)
{
@ -179,7 +214,7 @@ namespace CodeImp.DoomBuilder.Windows
if(t.AngleDoom.ToString() != angle.Text) angle.Text = "";
//mxd
if (ABSOLUTE_HEIGHT && t.Sector != null) {
if (useAbsoluteHeight && t.Sector != null) {
if(((int)t.Position.z + t.Sector.FloorHeight).ToString() != posZ.Text) posZ.Text = "";
} else {
if(((int)t.Position.z).ToString() != posZ.Text) posZ.Text = "";
@ -196,8 +231,12 @@ namespace CodeImp.DoomBuilder.Windows
if(t.Args[4] != arg4.GetResult(-1)) arg4.ClearValue();
// Custom fields
t.Fields.BeforeFieldsChange(); //mxd
fieldslist.SetValues(t.Fields, false);
//mxd. Store initial properties
thingProps.Add(new ThingProperties(t));
//mxd. add user vars
/*if(info != null && info.Actor != null && info.Actor.UserVars.Count > 0) {
foreach(string s in info.Actor.UserVars) {
@ -257,38 +296,7 @@ namespace CodeImp.DoomBuilder.Windows
#endregion
#region ================== Interface
// Selected type changes
private void thingtype_OnTypeChanged(ThingTypeInfo value)
{
thinginfo = value;
// Update preview image
if(thinginfo != null)
{
if(thinginfo.Sprite.ToLowerInvariant().StartsWith(DataManager.INTERNAL_PREFIX) &&
(thinginfo.Sprite.Length > DataManager.INTERNAL_PREFIX.Length))
{
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(thinginfo.Sprite).GetBitmap());
}
else if((thinginfo.Sprite.Length <= 8) && (thinginfo.Sprite.Length > 0))
{
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(thinginfo.Sprite).GetPreview());
}
else
{
spritetex.BackgroundImage = null;
}
}
else
{
spritetex.BackgroundImage = null;
}
// Update arguments
action_ValueChanges(this, EventArgs.Empty);
}
#region ================== Events
//mxd
private void thingtype_OnTypeDoubleClicked() {
@ -370,19 +378,20 @@ namespace CodeImp.DoomBuilder.Windows
private void angle_TextChanged(object sender, EventArgs e)
{
anglecontrol.Value = angle.GetResult(int.MinValue);
updateAngle(); //mxd
}
// Angle control clicked
private void anglecontrol_ButtonClicked(object sender, EventArgs e)
{
angle.Text = anglecontrol.Value.ToString();
updateAngle(); //mxd
}
// Apply clicked
private void apply_Click(object sender, EventArgs e)
{
List<string> defaultflags = new List<string>();
string undodesc = "thing";
//mxd
// Verify the tag
@ -409,34 +418,25 @@ namespace CodeImp.DoomBuilder.Windows
return;
}
// Make undo
if(things.Count > 1) undodesc = things.Count + " things";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
//mxd
Vector2D delta = new Vector2D((float)posX.GetResult((int)initialPosition.x) - initialPosition.x, (float)posY.GetResult((int)initialPosition.y) - initialPosition.y);
bool hasAcs = Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1;
bool hasArg0str = General.Map.UDMF && !action.Empty && hasAcs && arg0str.Text.Length > 0;
// Go for all the things
foreach(Thing t in things)
{
// Thing type index
t.Type = General.Clamp(thingtype.GetResult(t.Type), General.Map.FormatInterface.MinThingType, General.Map.FormatInterface.MaxThingType);
// Coordination
//mxd
if(cbRandomAngle.Checked) {
t.Rotate(General.Random(0, 359));
} else {
t.Rotate(angle.GetResult(t.AngleDoom));
}
//mxd
float z = (float)posZ.GetResult((int)t.Position.z);
if (ABSOLUTE_HEIGHT && t.Sector != null)
z -= t.Sector.FloorHeight;
t.Move(t.Position.x + delta.x, t.Position.y + delta.y, z);
//mxd. Check position
float px = General.Clamp(t.Position.x, General.Map.Config.LeftBoundary, General.Map.Config.RightBoundary);
float py = General.Clamp(t.Position.y, General.Map.Config.BottomBoundary, General.Map.Config.TopBoundary);
if(t.Position.x != px || t.Position.y != py)
t.Move(new Vector2D(px, py));
// Apply all flags
foreach(CheckBox c in flags.Checkboxes)
@ -489,6 +489,7 @@ namespace CodeImp.DoomBuilder.Windows
// Done
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); //mxd
this.DialogResult = DialogResult.OK;
this.Close();
}
@ -496,6 +497,9 @@ namespace CodeImp.DoomBuilder.Windows
// Cancel clicked
private void cancel_Click(object sender, EventArgs e)
{
//mxd. perform undo
General.Map.UndoRedo.WithdrawUndo();
// Be gone
this.DialogResult = DialogResult.Cancel;
this.Close();
@ -527,9 +531,9 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void cbAbsoluteHeight_CheckedChanged(object sender, EventArgs e) {
ABSOLUTE_HEIGHT = cbAbsoluteHeight.Checked;
zlabel.Text = ABSOLUTE_HEIGHT ? "Z:" : "Height:";
posZ.Text = (ABSOLUTE_HEIGHT ? initialFloorHeight + initialPosition.z : initialPosition.z).ToString();
useAbsoluteHeight = cbAbsoluteHeight.Checked;
zlabel.Text = useAbsoluteHeight ? "Z:" : "Height:";
posZ.Text = (useAbsoluteHeight ? initialFloorHeight + initialPosition.z : initialPosition.z).ToString();
}
//mxd
@ -552,5 +556,134 @@ namespace CodeImp.DoomBuilder.Windows
}
#endregion
#region ================== mxd. Realtime events
private void posX_WhenTextChanged(object sender, EventArgs e) {
if(preventchanges) return;
int i = 0;
//restore values
if(string.IsNullOrEmpty(posX.Text)) {
// Apply position
foreach(Thing t in things)
t.Move(new Vector2D(thingProps[i++].X, t.Position.y));
} else { //update values
int delta = posX.GetResult((int)initialPosition.x) - (int)initialPosition.x;
// Apply position
foreach(Thing t in things)
t.Move(new Vector2D(thingProps[i++].X + delta, t.Position.y));
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void posY_WhenTextChanged(object sender, EventArgs e) {
if(preventchanges) return;
int i = 0;
//restore values
if(string.IsNullOrEmpty(posY.Text)) {
// Apply position
foreach(Thing t in things)
t.Move(new Vector2D(t.Position.x, thingProps[i++].Y));
} else { //update values
int delta = posY.GetResult((int)initialPosition.y) - (int)initialPosition.y;
// Apply position
foreach(Thing t in things)
t.Move(new Vector2D(t.Position.x, thingProps[i++].Y + delta));
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void posZ_WhenTextChanged(object sender, EventArgs e) {
if(preventchanges) return;
//restore values
if(string.IsNullOrEmpty(posY.Text)) {
int i = 0;
// Apply position
foreach(Thing t in things)
t.Move(new Vector3D(t.Position.x, t.Position.y, thingProps[i++].Z));
} else { //update values
// Apply position
foreach(Thing t in things) {
float z = (float)posZ.GetResult((int)t.Position.z);
if(useAbsoluteHeight && t.Sector != null)
z -= t.Sector.FloorHeight;
t.Move(new Vector3D(t.Position.x, t.Position.y, z));
}
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
// Selected type changes
private void thingtype_OnTypeChanged(ThingTypeInfo value) {
thinginfo = value;
// Update preview image
if(thinginfo != null) {
if(thinginfo.Sprite.ToLowerInvariant().StartsWith(DataManager.INTERNAL_PREFIX) &&
(thinginfo.Sprite.Length > DataManager.INTERNAL_PREFIX.Length)) {
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(thinginfo.Sprite).GetBitmap());
} else if((thinginfo.Sprite.Length <= 8) && (thinginfo.Sprite.Length > 0)) {
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(thinginfo.Sprite).GetPreview());
} else {
spritetex.BackgroundImage = null;
}
} else {
spritetex.BackgroundImage = null;
}
// Update arguments
action_ValueChanges(this, EventArgs.Empty);
//mxd. Update things
if(preventchanges) return;
if(((thingtype.GetResult(0) < General.Map.FormatInterface.MinThingType) || (thingtype.GetResult(0) > General.Map.FormatInterface.MaxThingType)))
return;
foreach(Thing t in things) {
//Set type
t.Type = thingtype.GetResult(t.Type);
// Update settings
t.UpdateConfiguration();
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
//mxd
private void updateAngle() {
if(preventchanges) return;
//restore values
if(string.IsNullOrEmpty(angle.Text)) {
int i = 0;
// Apply rotation
foreach(Thing t in things)
t.Rotate(thingProps[i++].AngleDoom);
} else { //update values
// Apply rotation
foreach(Thing t in things)
t.Rotate(angle.GetResult(t.AngleDoom));
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
#endregion
}
}

View file

@ -138,9 +138,36 @@
<metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabcustom.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg0label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -156,9 +183,6 @@
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabcustom.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -60,7 +60,6 @@ namespace CodeImp.DoomBuilder.Windows
ZCeiling = v.ZCeiling;
ZFloor = v.ZFloor;
}
}
#endregion
@ -110,6 +109,11 @@ namespace CodeImp.DoomBuilder.Windows
if(vertices.Count > 1) this.Text = "Edit Vertices (" + vertices.Count + ")";
vertexProps = new List<VertexProperties>(); //mxd
//mxd. Make undo
string undodesc = "vertex";
if(vertices.Count > 1) undodesc = vertices.Count + " vertices";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
////////////////////////////////////////////////////////////////////////
// Set all options to the first vertex properties
////////////////////////////////////////////////////////////////////////
@ -161,17 +165,12 @@ namespace CodeImp.DoomBuilder.Windows
}
}
//mxd. Make undo
string undodesc = "vertex";
if(vertices.Count > 1) undodesc = vertices.Count + " vertices";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
blockUpdate = false; //mxd
}
#endregion
#region ================== mxd. Control Events
#region ================== mxd. Realtime Events
private void positionx_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
@ -306,6 +305,9 @@ namespace CodeImp.DoomBuilder.Windows
// OK clicked
private void apply_Click(object sender, EventArgs e)
{
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
// Done
this.DialogResult = DialogResult.OK;
this.Close();
@ -315,7 +317,7 @@ namespace CodeImp.DoomBuilder.Windows
private void cancel_Click(object sender, EventArgs e)
{
//mxd. perform undo
General.Map.UndoRedo.PerformUndo();
General.Map.UndoRedo.WithdrawUndo();
// And close
this.DialogResult = DialogResult.Cancel;

View file

@ -633,6 +633,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs();
General.Interface.RedrawDisplay();
}
}
}

View file

@ -408,17 +408,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Edit only when preferred
if(!thinginserted || BuilderPlug.Me.EditNewThing)
{
// Show thing edit dialog
//mxd. Show realtime thing edit dialog
General.Interface.OnEditFormValuesChanged += new EventHandler(thingEditForm_OnValuesChanged);
General.Interface.ShowEditThings(selected);
General.Interface.OnEditFormValuesChanged -= thingEditForm_OnValuesChanged;
// When a single thing was selected, deselect it now
if(selected.Count == 1) General.Map.Map.ClearSelectedThings();
// Update things filter
General.Map.ThingsFilter.Update();
// Update entire display
General.Interface.RedrawDisplay();
if(selected.Count == 1) {
General.Map.Map.ClearSelectedThings();
General.Interface.RedrawDisplay();
}
}
}
}
@ -430,6 +429,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnEditEnd();
}
//mxd
private void thingEditForm_OnValuesChanged(object sender, EventArgs e) {
// Update things filter
General.Map.ThingsFilter.Update();
// Update entire display
General.Interface.RedrawDisplay();
}
// Mouse moves
public override void OnMouseMove(MouseEventArgs e)
{

View file

@ -410,7 +410,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.OnEditFormValuesChanged -= vertexEditForm_OnValuesChanged;
// When a single vertex was selected, deselect it now
if(selected.Count == 1) General.Map.Map.ClearSelectedVertices();
if(selected.Count == 1) {
General.Map.Map.ClearSelectedVertices();
General.Interface.RedrawDisplay();
}
}
}

View file

@ -649,12 +649,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
General.Interface.OnEditFormValuesChanged += new System.EventHandler(Interface_OnEditFormValuesChanged);
General.Interface.OnEditFormValuesChanged += new System.EventHandler(Interface_OnEditFormValuesChanged); //mxd
mode.StartRealtimeInterfaceUpdate(SelectionType.Sectors); //mxd
General.Interface.ShowEditSectors(sectors);
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;
mode.StopRealtimeInterfaceUpdate(SelectionType.Sectors); //mxd
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged; //mxd
updateList.Clear();
updateList = null;
updateList.Clear(); //mxd
updateList = null; //mxd
}
}

View file

@ -60,6 +60,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private int prevoffsetx; // We have to provide delta offsets, but I don't
private int prevoffsety; // want to calculate with delta offsets to prevent
// inaccuracy in the dragging.
private static List<BaseVisualSector> updateList; //mxd
// Undo/redo
private int undoticket;
@ -946,27 +948,37 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(General.Interface.IsActiveWindow)
{
List<Linedef> linedefs = mode.GetSelectedLinedefs();
updateList = new List<BaseVisualSector>(); //mxd
foreach(Linedef l in linedefs) {
if(l.Front != null && mode.VisualSectorExists(l.Front.Sector))
updateList.Add((BaseVisualSector)mode.GetVisualSector(l.Front.Sector));
if(l.Back != null && mode.VisualSectorExists(l.Back.Sector))
updateList.Add((BaseVisualSector)mode.GetVisualSector(l.Back.Sector));
}
General.Interface.OnEditFormValuesChanged += new System.EventHandler(Interface_OnEditFormValuesChanged);
mode.StartRealtimeInterfaceUpdate(SelectionType.Linedefs);
DialogResult result = General.Interface.ShowEditLinedefs(linedefs);
mode.StopRealtimeInterfaceUpdate(SelectionType.Linedefs);
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;
updateList.Clear();
updateList = null;
if(result == DialogResult.OK)
{
foreach(Linedef l in linedefs)
{
if(l.Front != null)
if(l.Front != null && mode.VisualSectorExists(l.Front.Sector))
{
if(mode.VisualSectorExists(l.Front.Sector))
{
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(l.Front.Sector);
vs.UpdateSectorGeometry(false);
}
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(l.Front.Sector);
vs.UpdateSectorGeometry(false);
}
if(l.Back != null)
if(l.Back != null && mode.VisualSectorExists(l.Back.Sector))
{
if(mode.VisualSectorExists(l.Back.Sector))
{
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(l.Back.Sector);
vs.UpdateSectorGeometry(false);
}
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(l.Back.Sector);
vs.UpdateSectorGeometry(false);
}
}
@ -974,6 +986,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
//mxd
private void Interface_OnEditFormValuesChanged(object sender, System.EventArgs e) {
foreach(BaseVisualSector vs in updateList)
vs.UpdateSectorGeometry(false);
}
// Mouse moves
public virtual void OnMouseMove(MouseEventArgs e)

View file

@ -684,6 +684,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.DisplayStatus(StatusType.Selection, result);
}
//mxd
internal void StartRealtimeInterfaceUpdate(SelectionType selectionType) {
if(selectionType == SelectionType.Sectors || selectionType == SelectionType.Linedefs || selectionType == SelectionType.All) {
General.Interface.OnEditFormValuesChanged += new EventHandler(Interface_OnSectorEditFormValuesChanged);
} else {
General.Interface.OnEditFormValuesChanged += new EventHandler(Interface_OnEditFormValuesChanged);
}
}
//mxd
internal void StopRealtimeInterfaceUpdate(SelectionType selectionType) {
if(selectionType == SelectionType.Sectors || selectionType == SelectionType.Linedefs || selectionType == SelectionType.All) {
General.Interface.OnEditFormValuesChanged -= Interface_OnSectorEditFormValuesChanged;
} else {
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;
}
}
#endregion
@ -1303,6 +1321,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
updateSelectionInfo();
}
//mxd
private void Interface_OnSectorEditFormValuesChanged(object sender, EventArgs e) {
if(allsectors == null) return;
// Reset changed flags
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors) {
BaseVisualSector bvs = (vs.Value as BaseVisualSector);
foreach(VisualFloor vf in bvs.ExtraFloors)
vf.Changed = false;
foreach(VisualCeiling vc in bvs.ExtraCeilings)
vc.Changed = false;
foreach(VisualFloor vf in bvs.ExtraBackFloors)
vf.Changed = false;
foreach(VisualCeiling vc in bvs.ExtraBackCeilings)
vc.Changed = false;
bvs.Floor.Changed = false;
bvs.Ceiling.Changed = false;
}
UpdateChangedObjects();
ShowTargetInfo();
}
//mxd
private void Interface_OnEditFormValuesChanged(object sender, EventArgs e) {
UpdateChangedObjects();
ShowTargetInfo();
}
#endregion
@ -1713,37 +1760,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void EndEdit()
{
PreActionNoChange();
//mxd
General.Interface.OnEditFormValuesChanged += new EventHandler(Interface_OnEditFormValuesChanged);
GetTargetEventReceiver(false).OnEditEnd();
PostAction();
}
//mxd
private void Interface_OnEditFormValuesChanged(object sender, EventArgs e) {
if(allsectors == null) return;
// Reset changed flags
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors) {
BaseVisualSector bvs = (vs.Value as BaseVisualSector);
foreach(VisualFloor vf in bvs.ExtraFloors)
vf.Changed = false;
foreach(VisualCeiling vc in bvs.ExtraCeilings)
vc.Changed = false;
foreach(VisualFloor vf in bvs.ExtraBackFloors)
vf.Changed = false;
foreach(VisualCeiling vc in bvs.ExtraBackCeilings)
vc.Changed = false;
bvs.Floor.Changed = false;
bvs.Ceiling.Changed = false;
}
UpdateChangedObjects();
ShowTargetInfo();
}
[BeginAction("raisesector8")]
public void RaiseSector8()
{

View file

@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private Vector2D pos2d;
private Vector3D boxp1;
private Vector3D boxp2;
private static List<BaseVisualThing> updateList; //mxd
// Undo/redo
private int undoticket;
@ -510,19 +511,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
if(General.Interface.IsActiveWindow)
{
List<Thing> things = mode.GetSelectedThings();
DialogResult result = General.Interface.ShowEditThings(things);
if(result == DialogResult.OK)
{
foreach(Thing t in things)
{
VisualThing vt = mode.GetVisualThing(t);
if(vt != null)
(vt as BaseVisualThing).Changed = true;
}
//mxd
updateList = new List<BaseVisualThing>();
foreach(Thing t in things) {
VisualThing vt = mode.GetVisualThing(t);
if(vt != null)
updateList.Add(vt as BaseVisualThing);
}
General.Interface.OnEditFormValuesChanged += new System.EventHandler(Interface_OnEditFormValuesChanged);
mode.StartRealtimeInterfaceUpdate(SelectionType.Things);
General.Interface.ShowEditThings(things);
mode.StopRealtimeInterfaceUpdate(SelectionType.Things);
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;
updateList.Clear();
updateList = null;
}
}
//mxd
private void Interface_OnEditFormValuesChanged(object sender, System.EventArgs e) {
foreach(BaseVisualThing vt in updateList)
vt.Changed = true;
}
// Raise/lower thing
public virtual void OnChangeTargetHeight(int amount)

View file

@ -305,7 +305,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
General.Interface.OnEditFormValuesChanged += new System.EventHandler(Interface_OnEditFormValuesChanged);
mode.StartRealtimeInterfaceUpdate(SelectionType.Vertices);
General.Interface.ShowEditVertices(verts, false);
mode.StopRealtimeInterfaceUpdate(SelectionType.Vertices);
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;
updateList.Clear();

View file

@ -173,10 +173,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
CropPoly(ref poly, osd.Floor.plane, true);
// Determine if we should repeat the middle texture
if(Sidedef.Fields.ContainsKey("wrapmidtex"))
repeatmidtex = Sidedef.Fields.GetValue("wrapmidtex", false);
else
repeatmidtex = Sidedef.Line.IsFlagSet("wrapmidtex");
repeatmidtex = Sidedef.IsFlagSet("wrapmidtex") || Sidedef.Line.IsFlagSet("wrapmidtex"); //mxd
if(!repeatmidtex) {
// First determine the visible portion of the texture