Game configurations: added "fixedrotation" property to dynamic lights, which use the angle property as a parameter.

Maintenance: removed a ton of redundant stuff.
This commit is contained in:
MaxED 2014-02-21 14:42:12 +00:00
parent d9e53f2899
commit 3e5f85dc8f
215 changed files with 608 additions and 943 deletions

View file

@ -39,7 +39,8 @@ gzdoom_lights
} }
9801 9801
{ {
title = "Light Pulse"; title = "Pulse Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -68,7 +69,8 @@ gzdoom_lights
} }
9802 9802
{ {
title = "Light Flicker"; title = "Flicker Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -97,7 +99,7 @@ gzdoom_lights
} }
9803 9803
{ {
title = "Light Sector"; title = "Sector Light";
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -121,7 +123,8 @@ gzdoom_lights
} }
9804 9804
{ {
title = "Light Random"; title = "Random Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -150,7 +153,7 @@ gzdoom_lights
} }
9810 9810
{ {
title = "Light, Additive"; title = "Additive Light";
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -174,7 +177,8 @@ gzdoom_lights
} }
9811 9811
{ {
title = "Light Pulse, Additive"; title = "Additive Pulse Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -203,7 +207,8 @@ gzdoom_lights
} }
9812 9812
{ {
title = "Light Flicker, Additive"; title = "Additive Flicker Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -232,7 +237,7 @@ gzdoom_lights
} }
9813 9813
{ {
title = "Light Sector, Additive"; title = "Additive Sector Light";
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -256,7 +261,8 @@ gzdoom_lights
} }
9814 9814
{ {
title = "Light Random, Additive"; title = "Additive Random Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -285,7 +291,7 @@ gzdoom_lights
} }
9820 9820
{ {
title = "Light, Subtractive"; title = "Subtractive Light";
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -309,7 +315,8 @@ gzdoom_lights
} }
9821 9821
{ {
title = "Light Pulse, Subtractive"; title = "Subtractive Pulse Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -338,7 +345,8 @@ gzdoom_lights
} }
9822 9822
{ {
title = "Light Flicker, Subtractive"; title = "Subtractive Flicker Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -367,7 +375,7 @@ gzdoom_lights
} }
9823 9823
{ {
title = "Light Sector, Subtractive"; title = "Subtractive Sector Light";
arg0 arg0
{ {
title = "Red"; title = "Red";
@ -391,7 +399,8 @@ gzdoom_lights
} }
9824 9824
{ {
title = "Light Random, Subtractive"; title = "Subtractive Random Light";
fixedrotation = true;
arg0 arg0
{ {
title = "Red"; title = "Red";

View file

@ -505,7 +505,6 @@
<Reference Include="System.Design" /> <Reference Include="System.Design" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Trackbar, Version=1.0.2486.37933, Culture=neutral, PublicKeyToken=503bf28f63ad27b4"> <Reference Include="Trackbar, Version=1.0.2486.37933, Culture=neutral, PublicKeyToken=503bf28f63ad27b4">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>

View file

@ -90,7 +90,7 @@ namespace CodeImp.DoomBuilder.Compilers
{ {
if(!isdisposed) if(!isdisposed)
{ {
Exception deleteerror = null; Exception deleteerror;
float starttime = General.Clock.CurrentTime; float starttime = General.Clock.CurrentTime;
do do

View file

@ -74,7 +74,7 @@ namespace CodeImp.DoomBuilder.Config
for(int i = 0; i < filters.Count; i++) for(int i = 0; i < filters.Count; i++)
{ {
// Add filters // Add filters
dic.Add("filter" + i.ToString(), filters[i].ToUpperInvariant()); dic.Add("filter" + i, filters[i].ToUpperInvariant());
} }
// Write to config // Write to config

View file

@ -787,7 +787,7 @@ namespace CodeImp.DoomBuilder.Config
dic = cfg.ReadSetting("skills", new Hashtable()); dic = cfg.ReadSetting("skills", new Hashtable());
foreach(DictionaryEntry de in dic) foreach(DictionaryEntry de in dic)
{ {
int num = 0; int num;
if(int.TryParse(de.Key.ToString(), out num)) if(int.TryParse(de.Key.ToString(), out num))
{ {
skills.Add(new SkillInfo(num, de.Value.ToString())); skills.Add(new SkillInfo(num, de.Value.ToString()));
@ -808,7 +808,7 @@ namespace CodeImp.DoomBuilder.Config
dic = cfg.ReadSetting("texturesets", new Hashtable()); dic = cfg.ReadSetting("texturesets", new Hashtable());
foreach(DictionaryEntry de in dic) foreach(DictionaryEntry de in dic)
{ {
DefinedTextureSet s = new DefinedTextureSet(cfg, "texturesets." + de.Key.ToString()); DefinedTextureSet s = new DefinedTextureSet(cfg, "texturesets." + de.Key);
texturesets.Add(s); texturesets.Add(s);
} }
} }
@ -822,7 +822,7 @@ namespace CodeImp.DoomBuilder.Config
dic = cfg.ReadSetting("thingsfilters", new Hashtable()); dic = cfg.ReadSetting("thingsfilters", new Hashtable());
foreach(DictionaryEntry de in dic) foreach(DictionaryEntry de in dic)
{ {
ThingsFilter f = new ThingsFilter(cfg, "thingsfilters." + de.Key.ToString()); ThingsFilter f = new ThingsFilter(cfg, "thingsfilters." + de.Key);
thingfilters.Add(f); thingfilters.Add(f);
} }
} }

View file

@ -23,7 +23,7 @@ namespace CodeImp.DoomBuilder.Config
private List<GeneralizedOption> options; private List<GeneralizedOption> options;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -39,7 +39,7 @@ namespace CodeImp.DoomBuilder.Config
private List<LinedefActionInfo> actions; private List<LinedefActionInfo> actions;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -35,8 +35,6 @@ namespace CodeImp.DoomBuilder.Config
// Construct from IDictionary // Construct from IDictionary
internal MapLumpInfo(string name, Configuration cfg) internal MapLumpInfo(string name, Configuration cfg)
{ {
string scriptconfig = "";
// Apply settings // Apply settings
this.name = name; this.name = name;
this.script = null; this.script = null;
@ -44,7 +42,7 @@ namespace CodeImp.DoomBuilder.Config
this.blindcopy = cfg.ReadSetting("maplumpnames." + name + ".blindcopy", false); this.blindcopy = cfg.ReadSetting("maplumpnames." + name + ".blindcopy", false);
this.nodebuild = cfg.ReadSetting("maplumpnames." + name + ".nodebuild", false); this.nodebuild = cfg.ReadSetting("maplumpnames." + name + ".nodebuild", false);
this.allowempty = cfg.ReadSetting("maplumpnames." + name + ".allowempty", false); this.allowempty = cfg.ReadSetting("maplumpnames." + name + ".allowempty", false);
scriptconfig = cfg.ReadSetting("maplumpnames." + name + ".script", ""); string scriptconfig = cfg.ReadSetting("maplumpnames." + name + ".script", "");
// Find script configuration // Find script configuration
if(scriptconfig.Length > 0) if(scriptconfig.Length > 0)

View file

@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.Config
private string group; private string group;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion
@ -108,8 +108,8 @@ namespace CodeImp.DoomBuilder.Config
// 1 if the flag overlaps // 1 if the flag overlaps
public int Compare(Thing t1, Thing t2) public int Compare(Thing t1, Thing t2)
{ {
bool t1flag = false; bool t1flag;
bool t2flag = false; bool t2flag;
// Check if the flags exist // Check if the flags exist
if(!t1.Flags.ContainsKey(flag) || !t2.Flags.ContainsKey(flag)) { if(!t1.Flags.ContainsKey(flag) || !t2.Flags.ContainsKey(flag)) {

View file

@ -33,7 +33,7 @@ namespace CodeImp.DoomBuilder.Controls
// Variables // Variables
private List<GeneralizedCategory> generalizedcategories; private List<GeneralizedCategory> generalizedcategories;
private bool controlpressed = false; private bool controlpressed;
// Constants // Constants
private const string NUMBER_SEPERATOR = "\t"; private const string NUMBER_SEPERATOR = "\t";
@ -99,8 +99,8 @@ namespace CodeImp.DoomBuilder.Controls
INumberedTitle item; INumberedTitle item;
Brush displaybrush = SystemBrushes.WindowText; Brush displaybrush = SystemBrushes.WindowText;
Brush backbrush = SystemBrushes.Window; Brush backbrush = SystemBrushes.Window;
string displayname = ""; string displayname = string.Empty;
int intnumber = 0; int intnumber;
// Only when running // Only when running
if(!this.DesignMode) if(!this.DesignMode)

View file

@ -392,7 +392,7 @@ namespace CodeImp.DoomBuilder.Controls
if(gotTagArgument && combobox.SelectedItem != null) if(gotTagArgument && combobox.SelectedItem != null)
return General.Clamp(((TagInfo)combobox.SelectedItem).Tag, General.Map.FormatInterface.MinArgument, General.Map.FormatInterface.MaxArgument); return General.Clamp(((TagInfo)combobox.SelectedItem).Tag, General.Map.FormatInterface.MinArgument, General.Map.FormatInterface.MaxArgument);
int result = 0; int result;
// Strip prefixes // Strip prefixes
string str = combobox.Text.Trim().ToLowerInvariant(); string str = combobox.Text.Trim().ToLowerInvariant();

View file

@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Variables #region ================== Variables
private int eventcount = 0; private int eventcount;
#endregion #endregion

View file

@ -37,8 +37,8 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Variables #region ================== Variables
private bool ignorebuttonchange = false; private bool ignorebuttonchange;
private StepsList steps = null; private StepsList steps;
private int stepsize = 1; private int stepsize = 1;
private float stepsizeFloat = 1.0f; //mxd private float stepsizeFloat = 1.0f; //mxd

View file

@ -90,7 +90,7 @@ namespace CodeImp.DoomBuilder.Controls
tabs.TabsOffsetTop = buttonTogglePinning.Bottom + 2; //mxd tabs.TabsOffsetTop = buttonTogglePinning.Bottom + 2; //mxd
if(General.Settings != null) if(General.Settings != null)
buttonTogglePinning.Image = General.Settings.CollapseDockers ? CodeImp.DoomBuilder.Properties.Resources.Unpin : CodeImp.DoomBuilder.Properties.Resources.Pin; //mxd buttonTogglePinning.Image = General.Settings.CollapseDockers ? Properties.Resources.Unpin : Properties.Resources.Pin; //mxd
} }
#endregion #endregion
@ -448,7 +448,7 @@ namespace CodeImp.DoomBuilder.Controls
private void buttonTogglePinning_Click(object sender, EventArgs e) { private void buttonTogglePinning_Click(object sender, EventArgs e) {
General.Settings.CollapseDockers = !General.Settings.CollapseDockers; General.Settings.CollapseDockers = !General.Settings.CollapseDockers;
General.MainWindow.SetupInterface(); General.MainWindow.SetupInterface();
buttonTogglePinning.Image = General.Settings.CollapseDockers ? CodeImp.DoomBuilder.Properties.Resources.Unpin : CodeImp.DoomBuilder.Properties.Resources.Pin; buttonTogglePinning.Image = General.Settings.CollapseDockers ? Properties.Resources.Unpin : Properties.Resources.Pin;
} }
#endregion #endregion

View file

@ -471,7 +471,7 @@ namespace CodeImp.DoomBuilder.Controls
else if(e.ColumnIndex == 2) else if(e.ColumnIndex == 2)
{ {
// Get the row // Get the row
FieldsEditorRow frow = null; FieldsEditorRow frow;
DataGridViewRow row = fieldslist.Rows[e.RowIndex]; DataGridViewRow row = fieldslist.Rows[e.RowIndex];
if(row is FieldsEditorRow) if(row is FieldsEditorRow)
{ {
@ -526,10 +526,9 @@ namespace CodeImp.DoomBuilder.Controls
private void fieldslist_CellEndEdit(object sender, DataGridViewCellEventArgs e) private void fieldslist_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{ {
FieldsEditorRow frow = null; FieldsEditorRow frow = null;
DataGridViewRow row = null;
// Get the row // Get the row
row = fieldslist.Rows[e.RowIndex]; DataGridViewRow row = fieldslist.Rows[e.RowIndex];
if(row is FieldsEditorRow) frow = row as FieldsEditorRow; if(row is FieldsEditorRow) frow = row as FieldsEditorRow;
// Renaming a field? // Renaming a field?
@ -825,13 +824,12 @@ namespace CodeImp.DoomBuilder.Controls
private void UpdateBrowseButton() private void UpdateBrowseButton()
{ {
FieldsEditorRow frow = null; FieldsEditorRow frow = null;
DataGridViewRow row = null;
// Any row selected? // Any row selected?
if(fieldslist.SelectedRows.Count > 0) if(fieldslist.SelectedRows.Count > 0)
{ {
// Get selected row // Get selected row
row = fieldslist.SelectedRows[0]; DataGridViewRow row = fieldslist.SelectedRows[0];
if(row is FieldsEditorRow) frow = row as FieldsEditorRow; if(row is FieldsEditorRow) frow = row as FieldsEditorRow;
// Not the new row and FieldsEditorRow available? // Not the new row and FieldsEditorRow available?

View file

@ -46,7 +46,7 @@ namespace CodeImp.DoomBuilder.Controls
DisplayImageSize(0, 0); //mxd DisplayImageSize(0, 0); //mxd
// Flat required! // Flat required!
return CodeImp.DoomBuilder.Properties.Resources.MissingTexture; return Properties.Resources.MissingTexture;
} }
else else
{ {

View file

@ -99,7 +99,7 @@ namespace CodeImp.DoomBuilder.Controls
Rectangle imagerect = new Rectangle(bounds.Left + ((bounds.Width - General.Map.Data.Previews.MaxImageWidth) >> 1), Rectangle imagerect = new Rectangle(bounds.Left + ((bounds.Width - General.Map.Data.Previews.MaxImageWidth) >> 1),
bounds.Top + ((bounds.Height - General.Map.Data.Previews.MaxImageHeight - (int)textsize.Height) >> 1), bounds.Top + ((bounds.Height - General.Map.Data.Previews.MaxImageHeight - (int)textsize.Height) >> 1),
General.Map.Data.Previews.MaxImageWidth, General.Map.Data.Previews.MaxImageHeight); General.Map.Data.Previews.MaxImageWidth, General.Map.Data.Previews.MaxImageHeight);
PointF textpos = new PointF(bounds.Left + ((float)bounds.Width - textsize.Width) * 0.5f, bounds.Bottom - textsize.Height - 2); PointF textpos = new PointF(bounds.Left + (bounds.Width - textsize.Width) * 0.5f, bounds.Bottom - textsize.Height - 2);
// Determine colors // Determine colors
if(this.Selected) if(this.Selected)

View file

@ -79,9 +79,9 @@ namespace CodeImp.DoomBuilder.Controls
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, false); this.SetStyle(ControlStyles.Opaque, false);
this.UpdateStyles(); this.UpdateStyles();
this.BackColor = System.Drawing.SystemColors.AppWorkspace; this.BackColor = SystemColors.AppWorkspace;
this.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.Splash3_trans; this.BackgroundImage = Properties.Resources.Splash3_trans;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.BackgroundImageLayout = ImageLayout.Center;
} }
// This sets up the control for manual rendering // This sets up the control for manual rendering
@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.Controls
this.UpdateStyles(); this.UpdateStyles();
this.BackColor = Color.Black; this.BackColor = Color.Black;
this.BackgroundImage = null; this.BackgroundImage = null;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.BackgroundImageLayout = ImageLayout.None;
} }
#endregion #endregion

View file

@ -2295,7 +2295,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
if(controlptr != IntPtr.Zero) if(controlptr != IntPtr.Zero)
{ {
return (UInt32)Perform(directptr, message, (UInt32)wParam, (UInt32)lParam); return (UInt32)Perform(directptr, message, wParam, lParam);
} }
else else
{ {
@ -2309,7 +2309,7 @@ namespace CodeImp.DoomBuilder.Controls
this.ignoredkeys.Add(key, key); this.ignoredkeys.Add(key, key);
} }
public void AddIgnoredKey(System.Windows.Forms.Keys key, System.Windows.Forms.Keys modifier) public void AddIgnoredKey(Keys key, Keys modifier)
{ {
this.ignoredkeys.Add((int)key + (int)modifier, (int)key + (int)modifier); this.ignoredkeys.Add((int)key + (int)modifier, (int)key + (int)modifier);
} }
@ -2370,7 +2370,7 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Message Pump #region ================== Message Pump
// This handles messages // This handles messages
protected override void WndProc(ref System.Windows.Forms.Message m) protected override void WndProc(ref Message m)
{ {
// Notify message? // Notify message?
if(m.Msg == WM_NOTIFY) if(m.Msg == WM_NOTIFY)
@ -2524,7 +2524,7 @@ namespace CodeImp.DoomBuilder.Controls
string textstr = null; string textstr = null;
try try
{ {
textstr = System.Runtime.InteropServices.Marshal.PtrToStringAuto(scn.text); textstr = Marshal.PtrToStringAuto(scn.text);
} }
catch(IndexOutOfRangeException) catch(IndexOutOfRangeException)
{ {

View file

@ -92,7 +92,7 @@ namespace CodeImp.DoomBuilder.Controls
navigator.Name = "navigator"; navigator.Name = "navigator";
navigator.TabStop = true; navigator.TabStop = true;
navigator.TabIndex = 0; navigator.TabIndex = 0;
navigator.DropDown += new EventHandler(navigator_DropDown); navigator.DropDown += navigator_DropDown;
this.Controls.Add(navigator); this.Controls.Add(navigator);
// Make the script control // Make the script control
@ -311,7 +311,7 @@ namespace CodeImp.DoomBuilder.Controls
if (Array.IndexOf(ScriptTypes.TYPES, config.Description) != -1) { if (Array.IndexOf(ScriptTypes.TYPES, config.Description) != -1) {
updateNavigator(new MemoryStream(editor.GetText()), config.Description); updateNavigator(new MemoryStream(editor.GetText()), config.Description);
navigator.Enabled = true; navigator.Enabled = true;
navigator.SelectedIndexChanged += new EventHandler(navigator_SelectedIndexChanged); navigator.SelectedIndexChanged += navigator_SelectedIndexChanged;
}else{ }else{
navigator.Items.Clear(); navigator.Items.Clear();
navigator.Enabled = false; navigator.Enabled = false;

View file

@ -77,8 +77,8 @@ namespace CodeImp.DoomBuilder.Controls
// Current position information // Current position information
private string curfunctionname = ""; private string curfunctionname = "";
private int curargumentindex = 0; private int curargumentindex;
private int curfunctionstartpos = 0; private int curfunctionstartpos;
// Status // Status
private bool changed; private bool changed;
@ -158,7 +158,7 @@ namespace CodeImp.DoomBuilder.Controls
// Events // Events
scriptedit.ModEventMask = 0x7FFFF; // Which events to receive (see also ScriptModificationFlags) scriptedit.ModEventMask = 0x7FFFF; // Which events to receive (see also ScriptModificationFlags)
scriptedit.Modified += new ScintillaControl.ModifiedHandler(scriptedit_Modified); scriptedit.Modified += scriptedit_Modified;
} }
#endregion #endregion
@ -333,7 +333,7 @@ namespace CodeImp.DoomBuilder.Controls
stylelookup.Add(stylenum, (ScriptStyleType)(int)de.Value); stylelookup.Add(stylenum, (ScriptStyleType)(int)de.Value);
// Apply color to style // Apply color to style
int colorindex = 0; int colorindex;
switch((ScriptStyleType)(int)de.Value) switch((ScriptStyleType)(int)de.Value)
{ {
case ScriptStyleType.PlainText: colorindex = ColorCollection.PLAINTEXT; break; case ScriptStyleType.PlainText: colorindex = ColorCollection.PLAINTEXT; break;
@ -570,7 +570,7 @@ namespace CodeImp.DoomBuilder.Controls
} }
// This registers an XPM image for the autocomplete list // This registers an XPM image for the autocomplete list
private unsafe void RegisterAutoCompleteImage(ImageIndex index, byte[] imagedata) private void RegisterAutoCompleteImage(ImageIndex index, byte[] imagedata)
{ {
// Convert to string // Convert to string
string bigstring = Encoding.UTF8.GetString(imagedata); string bigstring = Encoding.UTF8.GetString(imagedata);
@ -580,7 +580,7 @@ namespace CodeImp.DoomBuilder.Controls
} }
// This registers an XPM image for the markes list // This registers an XPM image for the markes list
private unsafe void RegisterMarkerImage(ImageIndex index, byte[] imagedata) private void RegisterMarkerImage(ImageIndex index, byte[] imagedata)
{ {
// Convert to string // Convert to string
string bigstring = Encoding.UTF8.GetString(imagedata); string bigstring = Encoding.UTF8.GetString(imagedata);

View file

@ -78,14 +78,14 @@ namespace CodeImp.DoomBuilder.Controls
item = new ToolStripMenuItem(cfg.Description); item = new ToolStripMenuItem(cfg.Description);
//item.Image = buttonnew.Image; //item.Image = buttonnew.Image;
item.Tag = cfg; item.Tag = cfg;
item.Click += new EventHandler(buttonnew_Click); item.Click += buttonnew_Click;
buttonnew.DropDownItems.Add(item); buttonnew.DropDownItems.Add(item);
// Button for script type menu // Button for script type menu
item = new ToolStripMenuItem(cfg.Description); item = new ToolStripMenuItem(cfg.Description);
//item.Image = buttonnew.Image; //item.Image = buttonnew.Image;
item.Tag = cfg; item.Tag = cfg;
item.Click += new EventHandler(buttonscriptconfig_Click); item.Click += buttonscriptconfig_Click;
buttonscriptconfig.DropDownItems.Add(item); buttonscriptconfig.DropDownItems.Add(item);
} }
@ -344,9 +344,9 @@ namespace CodeImp.DoomBuilder.Controls
ei.ImageIndex = 0; ei.ImageIndex = 0;
ei.SubItems.Add(e.description); ei.SubItems.Add(e.description);
if(e.filename.StartsWith("?")) if(e.filename.StartsWith("?"))
ei.SubItems.Add(e.filename.Replace("?", "") + " (line " + e.linenumber.ToString() + ")"); ei.SubItems.Add(e.filename.Replace("?", "") + " (line " + e.linenumber + ")");
else else
ei.SubItems.Add(Path.GetFileName(e.filename) + " (line " + e.linenumber.ToString() + ")"); ei.SubItems.Add(Path.GetFileName(e.filename) + " (line " + e.linenumber + ")");
ei.Tag = e; ei.Tag = e;
errorlist.Items.Add(ei); errorlist.Items.Add(ei);
listindex++; listindex++;
@ -735,7 +735,7 @@ namespace CodeImp.DoomBuilder.Controls
// Show warning // Show warning
if((compilererrors != null) && (compilererrors.Count > 0)) if((compilererrors != null) && (compilererrors.Count > 0))
General.MainWindow.DisplayStatus(StatusType.Warning, compilererrors.Count.ToString() + " errors while compiling " + t.Text + "!"); General.MainWindow.DisplayStatus(StatusType.Warning, compilererrors.Count + " errors while compiling " + t.Text + "!");
else else
General.MainWindow.DisplayStatus(StatusType.Info, "Script " + t.Text + " compiled without errors."); General.MainWindow.DisplayStatus(StatusType.Info, "Script " + t.Text + " compiled without errors.");

View file

@ -88,7 +88,7 @@ namespace CodeImp.DoomBuilder.Controls
// Compile script // Compile script
public override void Compile() public override void Compile()
{ {
bool success = false; //mxd bool success; //mxd
// Compile // Compile
if(ismapheader) if(ismapheader)

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Controls
// This shows the info // This shows the info
public void ShowInfo(Sector s) public void ShowInfo(Sector s)
{ {
string effectinfo = ""; string effectinfo;
int sheight = s.CeilHeight - s.FloorHeight; int sheight = s.CeilHeight - s.FloorHeight;
@ -50,9 +50,9 @@ namespace CodeImp.DoomBuilder.Controls
if(General.Map.Config.SectorEffects.ContainsKey(s.Effect)) if(General.Map.Config.SectorEffects.ContainsKey(s.Effect))
effectinfo = General.Map.Config.SectorEffects[s.Effect].ToString(); effectinfo = General.Map.Config.SectorEffects[s.Effect].ToString();
else if(s.Effect == 0) else if(s.Effect == 0)
effectinfo = s.Effect.ToString() + " - Normal"; effectinfo = s.Effect + " - Normal";
else else
effectinfo = s.Effect.ToString() + " - Unknown"; effectinfo = s.Effect + " - Unknown";
// Sector info // Sector info
sectorinfo.Text = " Sector " + s.Index + " (" + (s.Sidedefs == null ? "no" : s.Sidedefs.Count.ToString()) + " sidedefs)"; //mxd sectorinfo.Text = " Sector " + s.Index + " (" + (s.Sidedefs == null ? "no" : s.Sidedefs.Count.ToString()) + " sidedefs)"; //mxd
@ -213,7 +213,7 @@ namespace CodeImp.DoomBuilder.Controls
showExtededCeilingInfo = true; showExtededCeilingInfo = true;
ceilingAngle.Enabled = true; ceilingAngle.Enabled = true;
ceilingAngleLabel.Enabled = true; ceilingAngleLabel.Enabled = true;
ceilingAngle.Text = s.Fields["rotationceiling"].Value.ToString() + "\u00B0"; ceilingAngle.Text = s.Fields["rotationceiling"].Value + "\u00B0";
} else { } else {
ceilingAngle.Text = "-"; ceilingAngle.Text = "-";
ceilingAngle.Enabled = false; ceilingAngle.Enabled = false;
@ -224,7 +224,7 @@ namespace CodeImp.DoomBuilder.Controls
showExtededFloorInfo = true; showExtededFloorInfo = true;
floorAngle.Enabled = true; floorAngle.Enabled = true;
floorAngleLabel.Enabled = true; floorAngleLabel.Enabled = true;
floorAngle.Text = s.Fields["rotationfloor"].Value.ToString() + "\u00B0"; floorAngle.Text = s.Fields["rotationfloor"].Value + "\u00B0";
} else { } else {
floorAngle.Text = "-"; floorAngle.Text = "-";
floorAngle.Enabled = false; floorAngle.Enabled = false;

View file

@ -47,15 +47,11 @@ namespace CodeImp.DoomBuilder.Controls
timer.Stop(); //mxd timer.Stop(); //mxd
// Check if name is a "none" texture // Check if name is a "none" texture
if((imagename.Length < 1) || (imagename == "-")) if((imagename.Length < 1) || (imagename == "-")) {
{
DisplayImageSize(0, 0); //mxd DisplayImageSize(0, 0); //mxd
// Determine image to show // Determine image to show
if(required) return (required ? Properties.Resources.MissingTexture : null);
return CodeImp.DoomBuilder.Properties.Resources.MissingTexture;
else
return null;
} }
else else
{ {
@ -71,13 +67,10 @@ namespace CodeImp.DoomBuilder.Controls
} }
// This browses for a texture // This browses for a texture
protected override string BrowseImage(string imagename) protected override string BrowseImage(string imagename) {
{
string result;
// Browse for texture // Browse for texture
result = TextureBrowserForm.Browse(this.ParentForm, imagename, false); string result = TextureBrowserForm.Browse(this.ParentForm, imagename, false);
if(result != null) return result; else return imagename; return result ?? imagename;
} }
} }
} }

View file

@ -48,9 +48,8 @@ namespace CodeImp.DoomBuilder.Controls
// This shows the info // This shows the info
public void ShowInfo(Thing t) public void ShowInfo(Thing t)
{ {
ThingTypeInfo ti;
LinedefActionInfo act = null; LinedefActionInfo act = null;
string actioninfo = ""; string actioninfo;
string zinfo; string zinfo;
float zvalue; float zvalue;
@ -78,7 +77,7 @@ namespace CodeImp.DoomBuilder.Controls
flagsPanel.Left = spritepanel.Left + spritepanel.Width + spritepanel.Margin.Right + flagsPanel.Margin.Left; //mxd flagsPanel.Left = spritepanel.Left + spritepanel.Width + spritepanel.Margin.Right + flagsPanel.Margin.Left; //mxd
// Lookup thing info // Lookup thing info
ti = General.Map.Data.GetThingInfo(t.Type); ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
// Get thing action information // Get thing action information
if(General.Map.Config.LinedefActions.ContainsKey(t.Action)) if(General.Map.Config.LinedefActions.ContainsKey(t.Action))
@ -87,9 +86,9 @@ namespace CodeImp.DoomBuilder.Controls
actioninfo = act.ToString(); actioninfo = act.ToString();
} }
else if(t.Action == 0) else if(t.Action == 0)
actioninfo = t.Action.ToString() + " - None"; actioninfo = t.Action + " - None";
else else
actioninfo = t.Action.ToString() + " - Unknown"; actioninfo = t.Action + " - Unknown";
// Determine z info to show // Determine z info to show
t.DetermineSector(); t.DetermineSector();
@ -117,7 +116,7 @@ namespace CodeImp.DoomBuilder.Controls
else else
{ {
zvalue = t.Position.z; zvalue = t.Position.z;
if(zvalue >= 0.0f) zinfo = "+" + zvalue.ToString(); else zinfo = zvalue.ToString(); if(zvalue >= 0.0f) zinfo = "+" + zvalue; else zinfo = zvalue.ToString();
} }
} }

View file

@ -98,7 +98,7 @@ namespace CodeImp.DoomBuilder.Data
private float loadfinishtime; private float loadfinishtime;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion
@ -1513,7 +1513,7 @@ namespace CodeImp.DoomBuilder.Data
// Go for all things // Go for all things
foreach(ThingTypeInfo ti in thingtypes.Values) { foreach(ThingTypeInfo ti in thingtypes.Values) {
// Valid sprite name? // Valid sprite name?
string sprite = string.Empty; string sprite;
if(ti.Sprite.Length == 0 || ti.Sprite.Length > 8) { if(ti.Sprite.Length == 0 || ti.Sprite.Length > 8) {
if(ti.Actor == null) continue; if(ti.Actor == null) continue;

View file

@ -36,8 +36,8 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Variables #region ================== Variables
protected DataLocation location; protected DataLocation location;
protected bool issuspended = false; protected bool issuspended;
protected bool isdisposed = false; protected bool isdisposed;
protected ResourceTextureSet textureset; protected ResourceTextureSet textureset;
#endregion #endregion

View file

@ -67,12 +67,12 @@ namespace CodeImp.DoomBuilder.Data
protected Bitmap bitmap; protected Bitmap bitmap;
// Direct3D texture // Direct3D texture
private int mipmaplevels = 0; // 0 = all mipmaps private int mipmaplevels; // 0 = all mipmaps
protected bool dynamictexture; protected bool dynamictexture;
private Texture texture; private Texture texture;
// Disposing // Disposing
protected bool isdisposed = false; protected bool isdisposed;
#endregion #endregion

View file

@ -17,7 +17,6 @@
#region ================== Namespaces #region ================== Namespaces
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;

View file

@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Data
private Queue<ImageData> imageque; private Queue<ImageData> imageque;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -27,7 +27,7 @@ namespace CodeImp.DoomBuilder.Data
{ {
#region ================== Variables #region ================== Variables
private Bitmap loadbitmap = null; private Bitmap loadbitmap;
#endregion #endregion

View file

@ -449,7 +449,7 @@ namespace CodeImp.DoomBuilder.Editing
{ {
// Scale and power this for nicer usability // Scale and power this for nicer usability
Vector2D pansign = panamount.GetSign(); Vector2D pansign = panamount.GetSign();
panamount = (panamount * panamount) * pansign * 0.0001f * (float)General.Settings.AutoScrollSpeed / renderer.Scale; panamount = (panamount * panamount) * pansign * 0.0001f * General.Settings.AutoScrollSpeed / renderer.Scale;
// Multiply by delta time // Multiply by delta time
panamount.x *= deltatime; panamount.x *= deltatime;

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Variables #region ================== Variables
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
// Last inserted prefab // Last inserted prefab
private string lastprefabfile; private string lastprefabfile;
@ -161,7 +161,7 @@ namespace CodeImp.DoomBuilder.Editing
General.Map.UndoRedo.CreateUndo("Insert prefab"); General.Map.UndoRedo.CreateUndo("Insert prefab");
// Decompress stream // Decompress stream
MemoryStream memstream = null; //mxd MemoryStream memstream; //mxd
filedata.Seek(0, SeekOrigin.Begin); filedata.Seek(0, SeekOrigin.Begin);
try { try {

View file

@ -32,16 +32,16 @@ namespace CodeImp.DoomBuilder.Editing
#region ================== Variables #region ================== Variables
// Properties // Properties
private string switchaction = null; private string switchaction;
private string buttonimage = null; private string buttonimage;
private int buttonorder = 0; private int buttonorder;
private string buttongroup = "~none"; private string buttongroup = "~none";
private bool optional = true; private bool optional = true;
private bool isvolatile = false; private bool isvolatile;
private string displayname = "<unnamed mode>"; private string displayname = "<unnamed mode>";
private bool allowcopypaste = true; private bool allowcopypaste = true;
private bool usebydefault = false; private bool usebydefault;
private bool safestartmode = false; private bool safestartmode;
#endregion #endregion

View file

@ -41,13 +41,13 @@ namespace CodeImp.DoomBuilder.Editing
private EditModeAttribute attribs; private EditModeAttribute attribs;
// Mode switching // Mode switching
private BeginActionAttribute switchactionattr = null; private BeginActionAttribute switchactionattr;
private ActionDelegate switchactiondel = null; private ActionDelegate switchactiondel;
// Mode button // Mode button
private Stream buttonimagestream = null; private Stream buttonimagestream;
private Image buttonimage = null; private Image buttonimage;
private string buttondesc = null; private string buttondesc;
private int buttonorder = int.MaxValue; private int buttonorder = int.MaxValue;
#endregion #endregion
@ -115,7 +115,7 @@ namespace CodeImp.DoomBuilder.Editing
{ {
if((switchactiondel == null) && (switchactionattr != null)) if((switchactiondel == null) && (switchactionattr != null))
{ {
switchactiondel = new ActionDelegate(UserSwitchToMode); switchactiondel = UserSwitchToMode;
General.Actions.BindBeginDelegate(plugin.Assembly, switchactiondel, switchactionattr); General.Actions.BindBeginDelegate(plugin.Assembly, switchactiondel, switchactionattr);
} }
} }

View file

@ -54,7 +54,7 @@ namespace CodeImp.DoomBuilder.Editing
private bool disengaging; private bool disengaging;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -135,8 +135,8 @@ namespace CodeImp.DoomBuilder.Editing
backsource = cfg.ReadSetting(path + ".backsource", 0); backsource = cfg.ReadSetting(path + ".backsource", 0);
backoffsetx = cfg.ReadSetting(path + ".backoffsetx", 0); backoffsetx = cfg.ReadSetting(path + ".backoffsetx", 0);
backoffsety = cfg.ReadSetting(path + ".backoffsety", 0); backoffsety = cfg.ReadSetting(path + ".backoffsety", 0);
backscalex = (float)cfg.ReadSetting(path + ".backscalex", 100) / 100.0f; backscalex = cfg.ReadSetting(path + ".backscalex", 100) / 100.0f;
backscaley = (float)cfg.ReadSetting(path + ".backscaley", 100) / 100.0f; backscaley = cfg.ReadSetting(path + ".backscaley", 100) / 100.0f;
gridsize = cfg.ReadSetting(path + ".gridsize", DEFAULT_GRID_SIZE); gridsize = cfg.ReadSetting(path + ".gridsize", DEFAULT_GRID_SIZE);
// Setup // Setup
@ -149,7 +149,7 @@ namespace CodeImp.DoomBuilder.Editing
{ {
// Change grid // Change grid
this.gridsize = size; this.gridsize = size;
this.gridsizef = (float)gridsize; this.gridsizef = gridsize;
this.gridsizefinv = 1f / gridsizef; this.gridsizefinv = 1f / gridsizef;
// Update in main window // Update in main window

View file

@ -66,7 +66,7 @@ namespace CodeImp.DoomBuilder.Editing
protected Dictionary<Thing, bool> thingsvisiblestate; protected Dictionary<Thing, bool> thingsvisiblestate;
// Disposing // Disposing
protected bool isdisposed = false; protected bool isdisposed;
#endregion #endregion
@ -140,7 +140,7 @@ namespace CodeImp.DoomBuilder.Editing
foreach(DictionaryEntry de in fields) foreach(DictionaryEntry de in fields)
{ {
// Add to the corresponding list // Add to the corresponding list
if((bool)de.Value == true) if((bool)de.Value)
requiredfields.Add(de.Key.ToString()); requiredfields.Add(de.Key.ToString());
else else
forbiddenfields.Add(de.Key.ToString()); forbiddenfields.Add(de.Key.ToString());
@ -150,7 +150,7 @@ namespace CodeImp.DoomBuilder.Editing
IDictionary fieldvalues = cfg.ReadSetting(path + ".customfieldvalues", new Hashtable()); IDictionary fieldvalues = cfg.ReadSetting(path + ".customfieldvalues", new Hashtable());
foreach(DictionaryEntry fv in fieldvalues) foreach(DictionaryEntry fv in fieldvalues)
{ {
int ft = cfg.ReadSetting(path + ".customfieldtypes." + fv.Key.ToString(), 0); int ft = cfg.ReadSetting(path + ".customfieldtypes." + fv.Key, 0);
customfields.Add(fv.Key.ToString(), new UniValue(ft, fv.Value)); customfields.Add(fv.Key.ToString(), new UniValue(ft, fv.Value));
} }
@ -377,7 +377,7 @@ namespace CodeImp.DoomBuilder.Editing
{ {
if(t.Flags.ContainsKey(s)) if(t.Flags.ContainsKey(s))
{ {
if(t.Flags[s] == true) if(t.Flags[s])
{ {
qualifies = false; qualifies = false;
break; break;

View file

@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.Editing
private Thread backgroundthread; private Thread backgroundthread;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion
@ -170,7 +170,7 @@ namespace CodeImp.DoomBuilder.Editing
General.Actions.BindMethods(this); General.Actions.BindMethods(this);
// Start background thread // Start background thread
backgroundthread = new Thread(new ThreadStart(BackgroundThread)); backgroundthread = new Thread(BackgroundThread);
backgroundthread.Name = "Snapshot Compressor"; backgroundthread.Name = "Snapshot Compressor";
backgroundthread.Priority = ThreadPriority.Lowest; backgroundthread.Priority = ThreadPriority.Lowest;
backgroundthread.IsBackground = true; backgroundthread.IsBackground = true;

View file

@ -76,7 +76,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private void tbColor_TextChanged(object sender, EventArgs e) { private void tbColor_TextChanged(object sender, EventArgs e) {
if(blockUpdate) return; if(blockUpdate) return;
int colorVal = defaultValue; int colorVal;
if(int.TryParse(tbColor.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out colorVal)){ if(int.TryParse(tbColor.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out colorVal)){
colorVal = General.Clamp(colorVal, 0, 16777215); colorVal = General.Clamp(colorVal, 0, 16777215);

View file

@ -13,7 +13,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
{ {
#region Selected Node(s) Properties #region Selected Node(s) Properties
private List<TreeNode> m_SelectedNodes = null; private List<TreeNode> m_SelectedNodes;
public List<TreeNode> SelectedNodes { public List<TreeNode> SelectedNodes {
get { get {
return m_SelectedNodes; return m_SelectedNodes;

View file

@ -2,7 +2,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
#endregion #endregion

View file

@ -106,8 +106,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
} }
} }
Vector3D start = new Vector3D(); Vector3D start, end;
Vector3D end = new Vector3D();
//process path nodes //process path nodes
if (result.ProcessPathNodes) { if (result.ProcessPathNodes) {

View file

@ -1,9 +1,4 @@
using System; namespace CodeImp.DoomBuilder.GZBuilder.Data
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeImp.DoomBuilder.GZBuilder.Data
{ {
public enum ModelLoadState public enum ModelLoadState
{ {

View file

@ -78,7 +78,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
//check if we have something like "999(void)" as a token //check if we have something like "999(void)" as a token
if (token.Contains("(")) token = token.Substring(0, token.IndexOf("(")); if (token.Contains("(")) token = token.Substring(0, token.IndexOf("("));
int n = 0; int n;
if (int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out n)) { if (int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out n)) {
int endPos = (int)stream.Position - 1; int endPos = (int)stream.Position - 1;

View file

@ -1,5 +1,4 @@
using System; using System.Drawing;
using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using SlimDX; using SlimDX;

View file

@ -24,7 +24,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
if (token == "MODEL") { if (token == "MODEL") {
SkipWhitespace(true); SkipWhitespace(true);
token = ReadToken(); //should be model name ReadToken(); //should be model name
SkipWhitespace(true); SkipWhitespace(true);
token = ReadToken();//should be opening brace token = ReadToken();//should be opening brace
@ -35,9 +35,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
}else if(token == "SCRIPT"){ }else if(token == "SCRIPT"){
SkipWhitespace(true); SkipWhitespace(true);
token = ReadToken(); //should be script name or number ReadToken(); //should be script name or number
SkipWhitespace(true); SkipWhitespace(true);
token = ReadToken(); //should be script parameters/type ReadToken(); //should be script parameters/type
SkipWhitespace(true); SkipWhitespace(true);
token = ReadToken(); //should be opening brace token = ReadToken(); //should be opening brace
@ -48,7 +48,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
}else if(token == "ACTOR"){ }else if(token == "ACTOR"){
SkipWhitespace(true); SkipWhitespace(true);
token = ReadToken(); //should be actor name ReadToken(); //should be actor name
SkipWhitespace(true); SkipWhitespace(true);
token = ReadToken(); token = ReadToken();

View file

@ -1,6 +1,4 @@
using System; using CodeImp.DoomBuilder.Actions;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.GZBuilder.Data; using CodeImp.DoomBuilder.GZBuilder.Data;

View file

@ -251,7 +251,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
foreach(Thing t in list) { foreach(Thing t in list) {
t.Selected = true; t.Selected = true;
Vector2D p = (Vector2D)t.Position; Vector2D p = t.Position;
points.Add(p); points.Add(p);
points.Add(p + new Vector2D(t.Size * 2.0f, t.Size * 2.0f)); points.Add(p + new Vector2D(t.Size * 2.0f, t.Size * 2.0f));
points.Add(p + new Vector2D(t.Size * 2.0f, -t.Size * 2.0f)); points.Add(p + new Vector2D(t.Size * 2.0f, -t.Size * 2.0f));
@ -345,7 +345,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
foreach(Thing t in list) { foreach(Thing t in list) {
t.Selected = true; t.Selected = true;
Vector2D p = (Vector2D)t.Position; Vector2D p = t.Position;
points.Add(p); points.Add(p);
points.Add(p + new Vector2D(t.Size * 2.0f, t.Size * 2.0f)); points.Add(p + new Vector2D(t.Size * 2.0f, t.Size * 2.0f));
points.Add(p + new Vector2D(t.Size * 2.0f, -t.Size * 2.0f)); points.Add(p + new Vector2D(t.Size * 2.0f, -t.Size * 2.0f));

View file

@ -483,13 +483,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
s.Position = ofs_tris + start; s.Position = ofs_tris + start;
for (int i = 0; i < num_tris; i++) { for (int i = 0; i < num_tris; i++) {
polyIndecesList.Add((int)br.ReadUInt16()); polyIndecesList.Add(br.ReadUInt16());
polyIndecesList.Add((int)br.ReadUInt16()); polyIndecesList.Add(br.ReadUInt16());
polyIndecesList.Add((int)br.ReadUInt16()); polyIndecesList.Add(br.ReadUInt16());
uvIndecesList.Add((int)br.ReadUInt16()); uvIndecesList.Add(br.ReadUInt16());
uvIndecesList.Add((int)br.ReadUInt16()); uvIndecesList.Add(br.ReadUInt16());
uvIndecesList.Add((int)br.ReadUInt16()); uvIndecesList.Add(br.ReadUInt16());
} }
//UV coords //UV coords
@ -504,8 +504,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
if (s.Position != ofs_animFrame + start) if (s.Position != ofs_animFrame + start)
s.Position = ofs_animFrame + start; s.Position = ofs_animFrame + start;
Vector3 scale = new Vector3((float)br.ReadSingle(), (float)br.ReadSingle(), (float)br.ReadSingle()); Vector3 scale = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
Vector3 translate = new Vector3((float)br.ReadSingle(), (float)br.ReadSingle(), (float)br.ReadSingle()); Vector3 translate = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
s.Position += 16; //frame name s.Position += 16; //frame name
@ -522,9 +522,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
for (int i = 0; i < num_verts; i++) { for (int i = 0; i < num_verts; i++) {
WorldVertex v = new WorldVertex(); WorldVertex v = new WorldVertex();
v.x = ((float)br.ReadByte() * scale.X + translate.X); v.x = (br.ReadByte() * scale.X + translate.X);
v.y = ((float)br.ReadByte() * scale.Y + translate.Y); v.y = (br.ReadByte() * scale.Y + translate.Y);
v.z = ((float)br.ReadByte() * scale.Z + translate.Z); v.z = (br.ReadByte() * scale.Z + translate.Z);
//rotate it //rotate it
float rx = angleOfsetCos * v.x - angleOfsetSin * v.y; float rx = angleOfsetCos * v.x - angleOfsetSin * v.y;
@ -900,7 +900,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
ms.Dispose(); ms.Dispose();
if(bitmap != null) { if(bitmap != null) {
BitmapData bmlock = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat); BitmapData bmlock = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
texture = new Texture(device, bitmap.Width, bitmap.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed); texture = new Texture(device, bitmap.Width, bitmap.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
DataRectangle textureLock = texture.LockRectangle(0, LockFlags.None); DataRectangle textureLock = texture.LockRectangle(0, LockFlags.None);
@ -921,7 +921,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
private static string ReadString(BinaryReader br, int len) { private static string ReadString(BinaryReader br, int len) {
var NAME = string.Empty; var NAME = string.Empty;
int i = 0; int i;
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
var c = br.ReadChar(); var c = br.ReadChar();
if (c == '\0') { if (c == '\0') {

View file

@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder
}; };
internal static uint ComputeCrc32(uint oldCrc, byte value) { internal static uint ComputeCrc32(uint oldCrc, byte value) {
return (uint)(Crc32.CrcTable[(oldCrc ^ value) & 0xFF] ^ (oldCrc >> 8)); return (Crc32.CrcTable[(oldCrc ^ value) & 0xFF] ^ (oldCrc >> 8));
} }
/// <summary> /// <summary>
@ -155,7 +155,7 @@ namespace CodeImp.DoomBuilder
/// </summary> /// </summary>
public long Value { public long Value {
get { get {
return (long)crc; return crc;
} }
set { set {
crc = (uint)value; crc = (uint)value;

View file

@ -373,7 +373,7 @@ namespace CodeImp.DoomBuilder
catch(Exception e) catch(Exception e)
{ {
// Unable to load configuration // Unable to load configuration
errorlogger.Add(ErrorType.Error, "Unable to load the nodebuilder configuration '" + de.Key.ToString() + "' from \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message); errorlogger.Add(ErrorType.Error, "Unable to load the nodebuilder configuration '" + de.Key + "' from \"" + Path.GetFileName(filepath) + "\". Error: " + e.Message);
} }
} }
} }

View file

@ -164,7 +164,7 @@ namespace CodeImp.DoomBuilder
// Store the number if we found one // Store the number if we found one
if(numstr.Length > 0) if(numstr.Length > 0)
{ {
int num = 0; int num;
int.TryParse(numstr, out num); int.TryParse(numstr, out num);
if(first) p_l1 = num.ToString(); else p_l2 = num.ToString(); if(first) p_l1 = num.ToString(); else p_l2 = num.ToString();
numstr = ""; numstr = "";
@ -176,7 +176,7 @@ namespace CodeImp.DoomBuilder
// Store the number if we found one // Store the number if we found one
if(numstr.Length > 0) if(numstr.Length > 0)
{ {
int num = 0; int num;
int.TryParse(numstr, out num); int.TryParse(numstr, out num);
if(first) p_l1 = num.ToString(); else p_l2 = num.ToString(); if(first) p_l1 = num.ToString(); else p_l2 = num.ToString();
} }

View file

@ -1121,7 +1121,7 @@ namespace CodeImp.DoomBuilder {
// We don't want to bother the user with this. There are a lot of lumps in // We don't want to bother the user with this. There are a lot of lumps in
// the game configs that are trivial and don't need to be found. // the game configs that are trivial and don't need to be found.
if (lumprequired) { if (lumprequired) {
General.ErrorLogger.Add(ErrorType.Warning, ml.Key.ToString() + " (required lump) should be read but was not found in the WAD file."); General.ErrorLogger.Add(ErrorType.Warning, ml.Key + " (required lump) should be read but was not found in the WAD file.");
} }
} }
} }

View file

@ -33,7 +33,7 @@ namespace CodeImp.DoomBuilder
while(low < high) while(low < high)
{ {
int mid = (int)Math.Floor((float)(low + high) * 0.5f); int mid = (int)Math.Floor((low + high) * 0.5f);
int l = base[mid]; int l = base[mid];
if(l <= level) if(l <= level)
@ -53,7 +53,7 @@ namespace CodeImp.DoomBuilder
while(low < high) while(low < high)
{ {
int mid = (int)Math.Ceiling((float)(low + high) * 0.5f); int mid = (int)Math.Ceiling((low + high) * 0.5f);
int l = base[mid]; int l = base[mid];
if(l >= level) if(l >= level)
@ -85,7 +85,7 @@ namespace CodeImp.DoomBuilder
while(low < high) while(low < high)
{ {
int mid = (int)Math.Floor((float)(low + high) * 0.5f); int mid = (int)Math.Floor((low + high) * 0.5f);
int l = base[mid]; int l = base[mid];
if(l <= level) if(l <= level)

View file

@ -39,7 +39,7 @@ namespace CodeImp.DoomBuilder.Geometry
// This converts doom angle to real angle // This converts doom angle to real angle
public static float DoomToReal(int doomangle) public static float DoomToReal(int doomangle)
{ {
return (float)Math.Round(Normalized(DegToRad((float)(doomangle + 90))), 4); return (float)Math.Round(Normalized(DegToRad((doomangle + 90))), 4);
} }
// This converts real angle to doom angle // This converts real angle to doom angle

View file

@ -214,7 +214,7 @@ namespace CodeImp.DoomBuilder.Geometry
int totalSteps = steps + 1; int totalSteps = steps + 1;
Vector2D[] points = new Vector2D[totalSteps]; Vector2D[] points = new Vector2D[totalSteps];
float step = 1f / (float)steps; float step = 1f / steps;
float curStep = 0f; float curStep = 0f;
for(int i = 0; i < totalSteps; i++) { for(int i = 0; i < totalSteps; i++) {
@ -238,7 +238,7 @@ namespace CodeImp.DoomBuilder.Geometry
int totalSteps = steps + 1; int totalSteps = steps + 1;
Vector2D[] points = new Vector2D[totalSteps]; Vector2D[] points = new Vector2D[totalSteps];
float step = 1f / (float)steps; float step = 1f / steps;
float curStep = 0f; float curStep = 0f;
for(int i = 0; i < totalSteps; i++) { for(int i = 0; i < totalSteps; i++) {

View file

@ -17,7 +17,6 @@
#region ================== Namespaces #region ================== Namespaces
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;

View file

@ -320,19 +320,19 @@ namespace CodeImp.DoomBuilder.Geometry
} }
// Transform // Transform
public unsafe Vector2D GetTransformed(float offsetx, float offsety, float scalex, float scaley) public Vector2D GetTransformed(float offsetx, float offsety, float scalex, float scaley)
{ {
return new Vector2D((x + offsetx) * scalex, (y + offsety) * scaley); return new Vector2D((x + offsetx) * scalex, (y + offsety) * scaley);
} }
// Inverse Transform // Inverse Transform
public unsafe Vector2D GetInvTransformed(float invoffsetx, float invoffsety, float invscalex, float invscaley) public Vector2D GetInvTransformed(float invoffsetx, float invoffsety, float invscalex, float invscaley)
{ {
return new Vector2D((x * invscalex) + invoffsetx, (y * invscaley) + invoffsety); return new Vector2D((x * invscalex) + invoffsetx, (y * invscaley) + invoffsety);
} }
// Rotate (Added by Anders Åstrand 2008-05-18) // Rotate (Added by Anders Åstrand 2008-05-18)
public unsafe Vector2D GetRotated(float theta) public Vector2D GetRotated(float theta)
{ {
float cos = (float)Math.Cos(theta); float cos = (float)Math.Cos(theta);
float sin = (float)Math.Sin(theta); float sin = (float)Math.Sin(theta);

View file

@ -2,7 +2,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using System.IO; using System.IO;

View file

@ -36,7 +36,7 @@ namespace CodeImp.DoomBuilder.IO
private long position; private long position;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -621,8 +621,8 @@ namespace CodeImp.DoomBuilder.IO
// Is it a number? // Is it a number?
if(NUMBERS.IndexOf(c.ToString(CultureInfo.InvariantCulture)) > -1) if(NUMBERS.IndexOf(c.ToString(CultureInfo.InvariantCulture)) > -1)
{ {
int vv = 0; int vv;
char vc = '0'; char vc;
// Convert the next 3 characters to a number // Convert the next 3 characters to a number
string v = data.Substring(pos, 3); string v = data.Substring(pos, 3);
@ -712,7 +712,7 @@ namespace CodeImp.DoomBuilder.IO
// Floating point? // Floating point?
if(val.IndexOf("f") > -1) if(val.IndexOf("f") > -1)
{ {
float fval = 0; float fval;
// Convert to float (remove the f first) // Convert to float (remove the f first)
try { fval = Convert.ToSingle(val.Trim().Replace("f", ""), CultureInfo.InvariantCulture); } try { fval = Convert.ToSingle(val.Trim().Replace("f", ""), CultureInfo.InvariantCulture); }
@ -1188,7 +1188,7 @@ namespace CodeImp.DoomBuilder.IO
//db.Append("="); db.Append(spacing); db.Append("null;"); db.Append(newline); //db.Append("="); db.Append(spacing); db.Append("null;"); db.Append(newline);
// Output key only // Output key only
db.Append(leveltabs); db.Append(de.Key.ToString()); db.Append(";"); db.Append(newline); db.Append(leveltabs); db.Append(de.Key); db.Append(";"); db.Append(newline);
} }
// Check if the value if of ConfigStruct type // Check if the value if of ConfigStruct type
else if(de.Value is IDictionary) else if(de.Value is IDictionary)
@ -1208,13 +1208,13 @@ namespace CodeImp.DoomBuilder.IO
if((bool)de.Value) if((bool)de.Value)
{ {
// Output the keyword "true" // Output the keyword "true"
db.Append(leveltabs); db.Append(de.Key.ToString()); db.Append(spacing); db.Append(leveltabs); db.Append(de.Key); db.Append(spacing);
db.Append("="); db.Append(spacing); db.Append("true;"); db.Append(newline); db.Append("="); db.Append(spacing); db.Append("true;"); db.Append(newline);
} }
else else
{ {
// Output the keyword "false" // Output the keyword "false"
db.Append(leveltabs); db.Append(de.Key.ToString()); db.Append(spacing); db.Append(leveltabs); db.Append(de.Key); db.Append(spacing);
db.Append("="); db.Append(spacing); db.Append("false;"); db.Append(newline); db.Append("="); db.Append(spacing); db.Append("false;"); db.Append(newline);
} }
} }

View file

@ -27,7 +27,7 @@ using System.Drawing.Imaging;
namespace CodeImp.DoomBuilder.IO namespace CodeImp.DoomBuilder.IO
{ {
internal unsafe class DoomColormapReader : IImageReader internal class DoomColormapReader : IImageReader
{ {
#region ================== Variables #region ================== Variables
@ -82,7 +82,7 @@ namespace CodeImp.DoomBuilder.IO
// This creates a Bitmap from the given data // This creates a Bitmap from the given data
// Returns null on failure // Returns null on failure
public Bitmap ReadAsBitmap(Stream stream) public unsafe Bitmap ReadAsBitmap(Stream stream)
{ {
BitmapData bitmapdata; BitmapData bitmapdata;
PixelColorBlock pixeldata; PixelColorBlock pixeldata;
@ -167,9 +167,9 @@ namespace CodeImp.DoomBuilder.IO
// This creates pixel color data from the given data // This creates pixel color data from the given data
// Returns null on failure // Returns null on failure
private PixelColorBlock ReadAsPixelData(Stream stream, out int width, out int height) private unsafe PixelColorBlock ReadAsPixelData(Stream stream, out int width, out int height)
{ {
PixelColorBlock pixeldata = null; PixelColorBlock pixeldata;
byte[] bytes; byte[] bytes;
// Image will be 128x128 // Image will be 128x128

View file

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

View file

@ -193,7 +193,7 @@ namespace CodeImp.DoomBuilder.IO
y = reader.ReadInt16(); y = reader.ReadInt16();
// Create new item // Create new item
v = map.CreateVertex(new Vector2D((float)x, (float)y)); v = map.CreateVertex(new Vector2D(x, y));
// Add it to the lookup table // Add it to the lookup table
link.Add(i, v); link.Add(i, v);

View file

@ -179,7 +179,7 @@ namespace CodeImp.DoomBuilder.IO
private PixelColorBlock ReadAsPixelData(Stream stream, out int width, out int height, out int offsetx, out int offsety) private PixelColorBlock ReadAsPixelData(Stream stream, out int width, out int height, out int offsetx, out int offsety)
{ {
BinaryReader reader = new BinaryReader(stream); BinaryReader reader = new BinaryReader(stream);
PixelColorBlock pixeldata = null; PixelColorBlock pixeldata;
int y, read_y, count, p; int y, read_y, count, p;
int[] columns; int[] columns;
int dataoffset; int dataoffset;

View file

@ -203,7 +203,7 @@ namespace CodeImp.DoomBuilder.IO
y = reader.ReadInt16(); y = reader.ReadInt16();
// Create new item // Create new item
v = map.CreateVertex(new Vector2D((float)x, (float)y)); v = map.CreateVertex(new Vector2D(x, y));
// Add it to the lookup table // Add it to the lookup table
link.Add(i, v); link.Add(i, v);

View file

@ -49,7 +49,7 @@ namespace CodeImp.DoomBuilder.IO
private int length; private int length;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -21,7 +21,6 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
using System.Collections; using System.Collections;
using CodeImp.DoomBuilder.Types; using CodeImp.DoomBuilder.Types;

View file

@ -57,15 +57,13 @@ namespace CodeImp.DoomBuilder.IO
#region ================== Variables #region ================== Variables
// Error result // Error result
private int cpErrorResult = 0; private int cpErrorResult;
private string cpErrorDescription = ""; private string cpErrorDescription = "";
private int cpErrorLine = 0; private int cpErrorLine;
// Configuration root // Configuration root
private UniversalCollection root = null; private UniversalCollection root;
private const string numbers = "0123456789";
private const string numbers2 = "0123456789-.&";
private const string newline = "\n"; private const string newline = "\n";
private char[] newlineChar = new[] {'\n'}; private char[] newlineChar = new[] {'\n'};
private StringBuilder key; //mxd private StringBuilder key; //mxd
@ -343,7 +341,7 @@ namespace CodeImp.DoomBuilder.IO
pm = PM_STRING; //numbers pm = PM_STRING; //numbers
} }
// Check for numeric character numbers // Check for numeric character numbers
else if(numbers2.IndexOf(c) > -1) else if(Configuration.NUMBERS2.IndexOf(c) > -1)
{ {
// Now parsing number // Now parsing number
pm = PM_NUMBER; pm = PM_NUMBER;
@ -393,38 +391,38 @@ namespace CodeImp.DoomBuilder.IO
try try
{ {
// Convert to value // Convert to value
int ival = System.Convert.ToInt32(s.Substring(2).Trim(), 16); int ival = Convert.ToInt32(s.Substring(2).Trim(), 16);
// Add it to struct // Add it to struct
UniversalEntry entry = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), ival); UniversalEntry entry = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), ival);
cs.Add(entry); cs.Add(entry);
matches.Add(data[line], entry); matches.Add(data[line], entry);
} }
catch(System.OverflowException) catch(OverflowException)
{ {
// Too large for Int32, try Int64 // Too large for Int32, try Int64
try try
{ {
// Convert to value // Convert to value
long lval = System.Convert.ToInt64(s.Substring(2).Trim(), 16); long lval = Convert.ToInt64(s.Substring(2).Trim(), 16);
// Add it to struct // Add it to struct
UniversalEntry entry = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), lval); UniversalEntry entry = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), lval);
cs.Add(entry); cs.Add(entry);
matches.Add(data[line], entry); matches.Add(data[line], entry);
} }
catch(System.OverflowException) catch(OverflowException)
{ {
// Too large for Int64, return error // Too large for Int64, return error
RaiseError(line, ERROR_VALUETOOBIG); RaiseError(line, ERROR_VALUETOOBIG);
} }
catch(System.FormatException) catch(FormatException)
{ {
// ERROR: Invalid value in assignment // ERROR: Invalid value in assignment
RaiseError(line, ERROR_VALUEINVALID); RaiseError(line, ERROR_VALUEINVALID);
} }
} }
catch(System.FormatException) catch(FormatException)
{ {
// ERROR: Invalid value in assignment // ERROR: Invalid value in assignment
RaiseError(line, ERROR_VALUEINVALID); RaiseError(line, ERROR_VALUEINVALID);
@ -436,8 +434,8 @@ namespace CodeImp.DoomBuilder.IO
float fval = 0; float fval = 0;
// Convert to float (remove the f first) // Convert to float (remove the f first)
try { fval = System.Convert.ToSingle(s.Trim(), CultureInfo.InvariantCulture); } try { fval = Convert.ToSingle(s.Trim(), CultureInfo.InvariantCulture); }
catch(System.FormatException) catch(FormatException)
{ {
// ERROR: Invalid value in assignment // ERROR: Invalid value in assignment
RaiseError(line, ERROR_VALUEINVALID); RaiseError(line, ERROR_VALUEINVALID);
@ -454,14 +452,14 @@ namespace CodeImp.DoomBuilder.IO
try try
{ {
// Convert to value // Convert to value
int ival = System.Convert.ToInt32(s.Trim(), CultureInfo.InvariantCulture); int ival = Convert.ToInt32(s.Trim(), CultureInfo.InvariantCulture);
// Add it to struct // Add it to struct
UniversalEntry entry = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), ival); UniversalEntry entry = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), ival);
cs.Add(entry); cs.Add(entry);
matches.Add(data[line], entry); matches.Add(data[line], entry);
} }
catch(System.OverflowException) catch(OverflowException)
{ {
// Too large for Int32, try Int64 // Too large for Int32, try Int64
try try
@ -474,7 +472,7 @@ namespace CodeImp.DoomBuilder.IO
cs.Add(entry); cs.Add(entry);
matches.Add(data[line], entry); matches.Add(data[line], entry);
} }
catch(System.OverflowException) catch(OverflowException)
{ {
// Too large for Int64, return error // Too large for Int64, return error
RaiseError(line, ERROR_VALUETOOBIG); RaiseError(line, ERROR_VALUETOOBIG);
@ -485,7 +483,7 @@ namespace CodeImp.DoomBuilder.IO
RaiseError(line, ERROR_VALUEINVALID); RaiseError(line, ERROR_VALUEINVALID);
} }
} }
catch(System.FormatException) catch(FormatException)
{ {
// ERROR: Invalid value in assignment // ERROR: Invalid value in assignment
RaiseError(line, ERROR_VALUEINVALID); RaiseError(line, ERROR_VALUEINVALID);
@ -528,23 +526,23 @@ namespace CodeImp.DoomBuilder.IO
case 't': val.Append('\t'); break; case 't': val.Append('\t'); break;
default: default:
// Is it a number? // Is it a number?
if(numbers.IndexOf(c) > -1) if(Configuration.NUMBERS.IndexOf(c) > -1)
{ {
int vv = 0; int vv = 0;
char vc = '0'; char vc = '0';
// Convert the next 3 characters to a number // Convert the next 3 characters to a number
string v = data[line].Substring(pos, 3); string v = data[line].Substring(pos, 3);
try { vv = System.Convert.ToInt32(v.Trim(), CultureInfo.InvariantCulture); } try { vv = Convert.ToInt32(v.Trim(), CultureInfo.InvariantCulture); }
catch(System.FormatException) catch(FormatException)
{ {
// ERROR: Invalid value in assignment // ERROR: Invalid value in assignment
RaiseError(line, ERROR_VALUEINVALID); RaiseError(line, ERROR_VALUEINVALID);
} }
// Convert the number to a char // Convert the number to a char
try { vc = System.Convert.ToChar(vv, CultureInfo.InvariantCulture); } try { vc = Convert.ToChar(vv, CultureInfo.InvariantCulture); }
catch(System.FormatException) catch(FormatException)
{ {
// ERROR: Invalid value in assignment // ERROR: Invalid value in assignment
RaiseError(line, ERROR_VALUEINVALID); RaiseError(line, ERROR_VALUEINVALID);

View file

@ -26,7 +26,7 @@ using System.Drawing.Imaging;
namespace CodeImp.DoomBuilder.IO namespace CodeImp.DoomBuilder.IO
{ {
internal unsafe class UnknownImageReader : IImageReader internal class UnknownImageReader : IImageReader
{ {
public uint ImageType { get; private set; } //mxd public uint ImageType { get; private set; } //mxd
@ -56,13 +56,13 @@ namespace CodeImp.DoomBuilder.IO
// This reads the image and returns a Bitmap // This reads the image and returns a Bitmap
public Bitmap ReadAsBitmap(Stream stream) public Bitmap ReadAsBitmap(Stream stream)
{ {
return new Bitmap(CodeImp.DoomBuilder.Properties.Resources.Failed); return new Bitmap(Properties.Resources.Failed);
} }
// This reads the image and returns a Bitmap // This reads the image and returns a Bitmap
public static Bitmap ReadAsBitmap() public static Bitmap ReadAsBitmap()
{ {
return new Bitmap(CodeImp.DoomBuilder.Properties.Resources.Failed); return new Bitmap(Properties.Resources.Failed);
} }
// This draws the picture to the given pixel color data // This draws the picture to the given pixel color data

View file

@ -54,8 +54,8 @@ namespace CodeImp.DoomBuilder.IO
private List<Lump> lumps; private List<Lump> lumps;
// Status // Status
private bool isreadonly = false; private bool isreadonly;
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -114,8 +114,8 @@ namespace CodeImp.DoomBuilder.Map
// This returns the block center in world coordinates // This returns the block center in world coordinates
protected Vector2D GetBlockCenter(Point p) protected Vector2D GetBlockCenter(Point p)
{ {
return new Vector2D((float)((p.X << blocksizeshift) + (blocksize >> 1)) + range.Left, return new Vector2D(((p.X << blocksizeshift) + (blocksize >> 1)) + range.Left,
(float)((p.Y << blocksizeshift) + (blocksize >> 1)) + range.Top); ((p.Y << blocksizeshift) + (blocksize >> 1)) + range.Top);
} }
// This returns true when the given block is inside range // This returns true when the given block is inside range

View file

@ -398,7 +398,7 @@ namespace CodeImp.DoomBuilder.Map
{ {
// First make a single integer with all bits from activation and flags // First make a single integer with all bits from activation and flags
int bits = activate; int bits = activate;
int flagbit = 0; int flagbit;
foreach(KeyValuePair<string, bool> f in flags) foreach(KeyValuePair<string, bool> f in flags)
if(int.TryParse(f.Key, out flagbit) && f.Value) bits |= flagbit; if(int.TryParse(f.Key, out flagbit) && f.Value) bits |= flagbit;
@ -444,7 +444,7 @@ namespace CodeImp.DoomBuilder.Map
foreach(KeyValuePair<string, string> f in General.Map.Config.LinedefFlags) foreach(KeyValuePair<string, string> f in General.Map.Config.LinedefFlags)
{ {
// Flag must be numeric // Flag must be numeric
int flagbit = 0; int flagbit;
if(int.TryParse(f.Key, out flagbit)) if(int.TryParse(f.Key, out flagbit))
{ {
foreach(FlagTranslation ft in General.Map.Config.LinedefFlagsTranslation) foreach(FlagTranslation ft in General.Map.Config.LinedefFlagsTranslation)

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Map
protected bool marked; protected bool marked;
// Disposing // Disposing
protected bool isdisposed = false; protected bool isdisposed;
#endregion #endregion

View file

@ -43,7 +43,7 @@ namespace CodeImp.DoomBuilder.Map
private MapSet map; private MapSet map;
// Sector // Sector
private Sector sector = null; private Sector sector;
// List items // List items
private LinkedListNode<Thing> selecteditem; private LinkedListNode<Thing> selecteditem;
@ -256,7 +256,7 @@ namespace CodeImp.DoomBuilder.Map
{ {
// First make a single integer with all flags // First make a single integer with all flags
int bits = 0; int bits = 0;
int flagbit = 0; int flagbit;
foreach(KeyValuePair<string, bool> f in flags) foreach(KeyValuePair<string, bool> f in flags)
if(int.TryParse(f.Key, out flagbit) && f.Value) bits |= flagbit; if(int.TryParse(f.Key, out flagbit) && f.Value) bits |= flagbit;
@ -292,7 +292,7 @@ namespace CodeImp.DoomBuilder.Map
foreach(KeyValuePair<string, string> f in General.Map.Config.ThingFlags) foreach(KeyValuePair<string, string> f in General.Map.Config.ThingFlags)
{ {
// Flag must be numeric // Flag must be numeric
int flagbit = 0; int flagbit;
if(int.TryParse(f.Key, out flagbit)) if(int.TryParse(f.Key, out flagbit))
{ {
foreach(FlagTranslation ft in General.Map.Config.ThingFlagsTranslation) foreach(FlagTranslation ft in General.Map.Config.ThingFlagsTranslation)
@ -496,7 +496,7 @@ namespace CodeImp.DoomBuilder.Map
public void SnapToGrid() public void SnapToGrid()
{ {
// Calculate nearest grid coordinates // Calculate nearest grid coordinates
this.Move(General.Map.Grid.SnappedToGrid((Vector2D)pos)); this.Move(General.Map.Grid.SnappedToGrid(pos));
} }
// This snaps the vertex to the map format accuracy // This snaps the vertex to the map format accuracy

View file

@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.Plugins
private Plugin plugin; private Plugin plugin;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
//mxd. It's nice to have these avaliable to plugins... //mxd. It's nice to have these avaliable to plugins...
public static Point DisplayLocationAbs { public static Point DisplayLocationAbs {
@ -288,12 +288,12 @@ namespace CodeImp.DoomBuilder.Plugins
/// <summary> /// <summary>
/// Called when an Action begins. /// Called when an Action begins.
/// </summary> /// </summary>
public virtual void OnActionBegin(CodeImp.DoomBuilder.Actions.Action action) { } public virtual void OnActionBegin(Actions.Action action) { }
/// <summary> /// <summary>
/// Called when an Action ends. /// Called when an Action ends.
/// </summary> /// </summary>
public virtual void OnActionEnd(CodeImp.DoomBuilder.Actions.Action action) { } public virtual void OnActionEnd(Actions.Action action) { }
/// <summary> /// <summary>
/// Called when an Editing Mode engages /// Called when an Editing Mode engages

View file

@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.Plugins
private string name; private string name;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -47,7 +47,7 @@ namespace CodeImp.DoomBuilder.Plugins
private List<Plugin> plugins; private List<Plugin> plugins;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion
@ -286,8 +286,8 @@ namespace CodeImp.DoomBuilder.Plugins
public void OnSectorFloorSurfaceUpdate(Sector s, ref FlatVertex[] vertices) { foreach(Plugin p in plugins) p.Plug.OnSectorFloorSurfaceUpdate(s, ref vertices); } public void OnSectorFloorSurfaceUpdate(Sector s, ref FlatVertex[] vertices) { foreach(Plugin p in plugins) p.Plug.OnSectorFloorSurfaceUpdate(s, ref vertices); }
public void OnShowPreferences(PreferencesController controller) { foreach(Plugin p in plugins) p.Plug.OnShowPreferences(controller); } public void OnShowPreferences(PreferencesController controller) { foreach(Plugin p in plugins) p.Plug.OnShowPreferences(controller); }
public void OnClosePreferences(PreferencesController controller) { foreach(Plugin p in plugins) p.Plug.OnClosePreferences(controller); } public void OnClosePreferences(PreferencesController controller) { foreach(Plugin p in plugins) p.Plug.OnClosePreferences(controller); }
public void OnActionBegin(CodeImp.DoomBuilder.Actions.Action action) { foreach(Plugin p in plugins) p.Plug.OnActionBegin(action); } public void OnActionBegin(Actions.Action action) { foreach(Plugin p in plugins) p.Plug.OnActionBegin(action); }
public void OnActionEnd(CodeImp.DoomBuilder.Actions.Action action) { foreach(Plugin p in plugins) p.Plug.OnActionEnd(action); } public void OnActionEnd(Actions.Action action) { foreach(Plugin p in plugins) p.Plug.OnActionEnd(action); }
public void OnEditEngage(EditMode oldmode, EditMode newmode) { foreach(Plugin p in plugins) p.Plug.OnEditEngage(oldmode, newmode); } public void OnEditEngage(EditMode oldmode, EditMode newmode) { foreach(Plugin p in plugins) p.Plug.OnEditEngage(oldmode, newmode); }
public void OnEditDisengage(EditMode oldmode, EditMode newmode) { foreach(Plugin p in plugins) p.Plug.OnEditDisengage(oldmode, newmode); } public void OnEditDisengage(EditMode oldmode, EditMode newmode) { foreach(Plugin p in plugins) p.Plug.OnEditDisengage(oldmode, newmode); }
public void OnEditCancel() { foreach(Plugin p in plugins) p.Plug.OnEditCancel(); } public void OnEditCancel() { foreach(Plugin p in plugins) p.Plug.OnEditCancel(); }

View file

@ -21,7 +21,6 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using SlimDX.Direct3D9; using SlimDX.Direct3D9;
using System.ComponentModel;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
using SlimDX; using SlimDX;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
@ -61,7 +60,7 @@ namespace CodeImp.DoomBuilder.Rendering
private ResourceImage fonttexture; private ResourceImage fonttexture;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Rendering
protected VertexDeclaration vertexdecl; protected VertexDeclaration vertexdecl;
// Disposing // Disposing
protected bool isdisposed = false; protected bool isdisposed;
#endregion #endregion

View file

@ -112,26 +112,25 @@ namespace CodeImp.DoomBuilder.Rendering
//To ColorRef (alpha-less). mxd. Changed function name to more descriptive one... //To ColorRef (alpha-less). mxd. Changed function name to more descriptive one...
public int ToInversedColorRef() public int ToInversedColorRef()
{ {
return ((int)r + ((int)b << 16) + ((int)g << 8)); return (r + (b << 16) + (g << 8));
//return (((int)r << 16) + ((int)g << 8) + (int)b);
} }
// To ColorValue // To ColorValue
public Color4 ToColorValue() public Color4 ToColorValue()
{ {
return new Color4((float)a * BYTE_TO_FLOAT, return new Color4(a * BYTE_TO_FLOAT,
(float)r * BYTE_TO_FLOAT, r * BYTE_TO_FLOAT,
(float)g * BYTE_TO_FLOAT, g * BYTE_TO_FLOAT,
(float)b * BYTE_TO_FLOAT); b * BYTE_TO_FLOAT);
} }
// To ColorValue // To ColorValue
public Color4 ToColorValue(float withalpha) public Color4 ToColorValue(float withalpha)
{ {
return new Color4(withalpha, return new Color4(withalpha,
(float)r * BYTE_TO_FLOAT, r * BYTE_TO_FLOAT,
(float)g * BYTE_TO_FLOAT, g * BYTE_TO_FLOAT,
(float)b * BYTE_TO_FLOAT); b * BYTE_TO_FLOAT);
} }
// This returns a new PixelColor with adjusted alpha // This returns a new PixelColor with adjusted alpha
@ -146,11 +145,11 @@ namespace CodeImp.DoomBuilder.Rendering
PixelColor c = new PixelColor(); PixelColor c = new PixelColor();
float ba; float ba;
ba = (float)a.a * BYTE_TO_FLOAT; ba = a.a * BYTE_TO_FLOAT;
c.r = (byte)((float)a.r * (1f - ba) + (float)b.r * ba); c.r = (byte)(a.r * (1f - ba) + b.r * ba);
c.g = (byte)((float)a.g * (1f - ba) + (float)b.g * ba); c.g = (byte)(a.g * (1f - ba) + b.g * ba);
c.b = (byte)((float)a.b * (1f - ba) + (float)b.b * ba); c.b = (byte)(a.b * (1f - ba) + b.b * ba);
c.a = (byte)((float)a.a * (1f - ba) + ba); c.a = (byte)(a.a * (1f - ba) + ba);
return c; return c;
} }
@ -158,14 +157,14 @@ namespace CodeImp.DoomBuilder.Rendering
// This modulates two colors // This modulates two colors
public static PixelColor Modulate(PixelColor a, PixelColor b) public static PixelColor Modulate(PixelColor a, PixelColor b)
{ {
float aa = (float)a.a * BYTE_TO_FLOAT; float aa = a.a * BYTE_TO_FLOAT;
float ar = (float)a.r * BYTE_TO_FLOAT; float ar = a.r * BYTE_TO_FLOAT;
float ag = (float)a.g * BYTE_TO_FLOAT; float ag = a.g * BYTE_TO_FLOAT;
float ab = (float)a.b * BYTE_TO_FLOAT; float ab = a.b * BYTE_TO_FLOAT;
float ba = (float)b.a * BYTE_TO_FLOAT; float ba = b.a * BYTE_TO_FLOAT;
float br = (float)b.r * BYTE_TO_FLOAT; float br = b.r * BYTE_TO_FLOAT;
float bg = (float)b.g * BYTE_TO_FLOAT; float bg = b.g * BYTE_TO_FLOAT;
float bb = (float)b.b * BYTE_TO_FLOAT; float bb = b.b * BYTE_TO_FLOAT;
PixelColor c = new PixelColor(); PixelColor c = new PixelColor();
c.a = (byte)((aa * ba) * 255.0f); c.a = (byte)((aa * ba) * 255.0f);
c.r = (byte)((ar * br) * 255.0f); c.r = (byte)((ar * br) * 255.0f);

View file

@ -77,7 +77,7 @@ namespace CodeImp.DoomBuilder.Rendering
// This clears the memory black // This clears the memory black
public void Clear() public void Clear()
{ {
if(memorysize > 0) General.ZeroMemory(new IntPtr(memory), (int)memorysize); if(memorysize > 0) General.ZeroMemory(new IntPtr(memory), memorysize);
} }
#endregion #endregion

View file

@ -201,11 +201,11 @@ namespace CodeImp.DoomBuilder.Rendering
else else
{ {
// Blend with pixel // Blend with pixel
a = (float)c.a * 0.003921568627450980392156862745098f; a = c.a * 0.003921568627450980392156862745098f;
if((int)p->a + (int)c.a > 255) p->a = 255; else p->a += c.a; if(p->a + c.a > 255) p->a = 255; else p->a += c.a;
p->r = (byte)((float)p->r * (1f - a) + (float)c.r * a); p->r = (byte)(p->r * (1f - a) + c.r * a);
p->g = (byte)((float)p->g * (1f - a) + (float)c.g * a); p->g = (byte)(p->g * (1f - a) + c.g * a);
p->b = (byte)((float)p->b * (1f - a) + (float)c.b * a); p->b = (byte)(p->b * (1f - a) + c.b * a);
} }
} }
} }

View file

@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Simulat doom light levels // Simulat doom light levels
if((level < 192) && General.Map.Config.DoomLightLevels) if((level < 192) && General.Map.Config.DoomLightLevels)
flevel = (192.0f - (float)(192 - level) * 1.5f); flevel = (192.0f - (192 - level) * 1.5f);
byte blevel = (byte)General.Clamp((int)flevel, 0, 255); byte blevel = (byte)General.Clamp((int)flevel, 0, 255);
PixelColor c = new PixelColor(255, blevel, blevel, blevel); PixelColor c = new PixelColor(255, blevel, blevel, blevel);

View file

@ -1425,10 +1425,10 @@ namespace CodeImp.DoomBuilder.Rendering
// The geometry must be a triangle list // The geometry must be a triangle list
public void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords) public void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords)
{ {
Texture t = null;
if(vertices.Length > 0) if(vertices.Length > 0)
{ {
Texture t;
if(texture != null) if(texture != null)
{ {
// Make sure the texture is loaded // Make sure the texture is loaded
@ -1456,7 +1456,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw // Draw
graphics.Shaders.Display2D.Begin(); graphics.Shaders.Display2D.Begin();
graphics.Shaders.Display2D.BeginPass(1); graphics.Shaders.Display2D.BeginPass(1);
graphics.Device.DrawUserPrimitives<FlatVertex>(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices); graphics.Device.DrawUserPrimitives(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices);
graphics.Shaders.Display2D.EndPass(); graphics.Shaders.Display2D.EndPass();
graphics.Shaders.Display2D.End(); graphics.Shaders.Display2D.End();
} }

View file

@ -132,7 +132,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Dummy frustum // Dummy frustum
frustum = new ProjectedFrustum2D(new Vector2D(), 0.0f, 0.0f, PROJ_NEAR_PLANE, frustum = new ProjectedFrustum2D(new Vector2D(), 0.0f, 0.0f, PROJ_NEAR_PLANE,
General.Settings.ViewDistance, Angle2D.DegToRad((float)General.Settings.VisualFOV)); General.Settings.ViewDistance, Angle2D.DegToRad(General.Settings.VisualFOV));
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
@ -205,9 +205,9 @@ namespace CodeImp.DoomBuilder.Rendering
private void CreateCrosshairVerts(Size texturesize) private void CreateCrosshairVerts(Size texturesize)
{ {
// Determine coordinates // Determine coordinates
float width = (float)windowsize.Width; float width = windowsize.Width;
float height = (float)windowsize.Height; float height = windowsize.Height;
float size = (float)height * CROSSHAIR_SCALE; float size = height * CROSSHAIR_SCALE;
RectangleF rect = new RectangleF((width - size) / 2, (height - size) / 2, size, size); RectangleF rect = new RectangleF((width - size) / 2, (height - size) / 2, size, size);
// Make vertices // Make vertices
@ -269,14 +269,14 @@ namespace CodeImp.DoomBuilder.Rendering
{ {
// Calculate aspect // Calculate aspect
float aspect = (float)General.Map.Graphics.RenderTarget.ClientSize.Width / float aspect = (float)General.Map.Graphics.RenderTarget.ClientSize.Width /
(float)General.Map.Graphics.RenderTarget.ClientSize.Height; General.Map.Graphics.RenderTarget.ClientSize.Height;
// The DirectX PerspectiveFovRH matrix method calculates the scaling in X and Y as follows: // The DirectX PerspectiveFovRH matrix method calculates the scaling in X and Y as follows:
// yscale = 1 / tan(fovY / 2) // yscale = 1 / tan(fovY / 2)
// xscale = yscale / aspect // xscale = yscale / aspect
// The fov specified in the method is the FOV over Y, but we want the user to specify the FOV // The fov specified in the method is the FOV over Y, but we want the user to specify the FOV
// over X, so calculate what it would be over Y first; // over X, so calculate what it would be over Y first;
float fov = Angle2D.DegToRad((float)General.Settings.VisualFOV); float fov = Angle2D.DegToRad(General.Settings.VisualFOV);
float reversefov = 1.0f / (float)Math.Tan(fov / 2.0f); float reversefov = 1.0f / (float)Math.Tan(fov / 2.0f);
float reversefovy = reversefov * aspect; float reversefovy = reversefov * aspect;
float fovy = (float)Math.Atan(1.0f / reversefovy) * 2.0f; float fovy = (float)Math.Atan(1.0f / reversefovy) * 2.0f;
@ -291,14 +291,11 @@ namespace CodeImp.DoomBuilder.Rendering
// This creates matrices for a camera view // This creates matrices for a camera view
public void PositionAndLookAt(Vector3D pos, Vector3D lookat) public void PositionAndLookAt(Vector3D pos, Vector3D lookat)
{ {
Vector3D delta;
float anglexy, anglez;
// Calculate delta vector // Calculate delta vector
cameraposition = pos; cameraposition = pos;
delta = lookat - pos; Vector3D delta = lookat - pos;
anglexy = delta.GetAngleXY(); float anglexy = delta.GetAngleXY();
anglez = delta.GetAngleZ(); float anglez = delta.GetAngleZ();
// Create frustum // Create frustum
frustum = new ProjectedFrustum2D(pos, anglexy, anglez, PROJ_NEAR_PLANE, frustum = new ProjectedFrustum2D(pos, anglexy, anglez, PROJ_NEAR_PLANE,
@ -315,7 +312,7 @@ namespace CodeImp.DoomBuilder.Rendering
private void CreateMatrices2D() private void CreateMatrices2D()
{ {
windowsize = graphics.RenderTarget.ClientSize; windowsize = graphics.RenderTarget.ClientSize;
Matrix scaling = Matrix.Scaling((1f / (float)windowsize.Width) * 2f, (1f / (float)windowsize.Height) * -2f, 1f); Matrix scaling = Matrix.Scaling((1f / windowsize.Width) * 2f, (1f / windowsize.Height) * -2f, 1f);
Matrix translate = Matrix.Translation(-(float)windowsize.Width * 0.5f, -(float)windowsize.Height * 0.5f, 0f); Matrix translate = Matrix.Translation(-(float)windowsize.Width * 0.5f, -(float)windowsize.Height * 0.5f, 0f);
view2d = Matrix.Multiply(translate, scaling); view2d = Matrix.Multiply(translate, scaling);
} }
@ -582,7 +579,7 @@ namespace CodeImp.DoomBuilder.Rendering
ApplyMatrices3D(); ApplyMatrices3D();
// Setup color // Setup color
Color4 thingColor = new Color4(); Color4 thingColor;
if (t.Selected && showselection) { if (t.Selected && showselection) {
thingColor = General.Colors.Selection3D.ToColorValue(); thingColor = General.Colors.Selection3D.ToColorValue();
} else { } else {
@ -644,7 +641,7 @@ namespace CodeImp.DoomBuilder.Rendering
ApplyMatrices3D(); ApplyMatrices3D();
// Setup color // Setup color
Color4 color = new Color4(); Color4 color;
if(v.Selected && showselection) { if(v.Selected && showselection) {
color = General.Colors.Selection3D.ToColorValue(); color = General.Colors.Selection3D.ToColorValue();
} else { } else {

View file

@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.Rendering
private D3DDevice device; private D3DDevice device;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -26,6 +26,6 @@ namespace CodeImp.DoomBuilder.Rendering
// of sector vertices, the surface manager will take care of splitting it up in several SurfaceEntries. // of sector vertices, the surface manager will take care of splitting it up in several SurfaceEntries.
internal class SurfaceEntryCollection : List<SurfaceEntry> internal class SurfaceEntryCollection : List<SurfaceEntry>
{ {
public int totalvertices = 0; public int totalvertices;
} }
} }

View file

@ -63,7 +63,7 @@ namespace CodeImp.DoomBuilder.Rendering
private FontCharacter[] characters; private FontCharacter[] characters;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion
@ -122,8 +122,8 @@ namespace CodeImp.DoomBuilder.Rendering
// This is ancient code of mine. // This is ancient code of mine.
// The charater sizes were based on 800x600 resolution. // The charater sizes were based on 800x600 resolution.
characters[i].width = (float)(int)chr["width"] / 40f; characters[i].width = (int)chr["width"] / 40f;
characters[i].height = (float)(int)chr["height"] / 30f; characters[i].height = (int)chr["height"] / 30f;
characters[i].u1 = (float)chr["u1"]; characters[i].u1 = (float)chr["u1"];
characters[i].v1 = (float)chr["v1"]; characters[i].v1 = (float)chr["v1"];
characters[i].u2 = (float)chr["u2"]; characters[i].u2 = (float)chr["u2"];

View file

@ -59,7 +59,7 @@ namespace CodeImp.DoomBuilder.Rendering
private float lastscaley; private float lastscaley;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -57,13 +57,11 @@ namespace CodeImp.DoomBuilder.Types
{ {
int oldvalue = (int)Math.Round(value); int oldvalue = (int)Math.Round(value);
int newvalue = AngleForm.ShowDialog(parent, oldvalue); int newvalue = AngleForm.ShowDialog(parent, oldvalue);
if(newvalue != oldvalue) value = (float)newvalue; if(newvalue != oldvalue) value = newvalue;
} }
public override void SetValue(object value) public override void SetValue(object value)
{ {
float result;
// Null? // Null?
if(value == null) if(value == null)
{ {
@ -75,9 +73,9 @@ namespace CodeImp.DoomBuilder.Types
// Set directly // Set directly
this.value = Convert.ToSingle(value); this.value = Convert.ToSingle(value);
} }
else else {
{
// Try parsing as string // Try parsing as string
float result;
if(float.TryParse(value.ToString(), NumberStyles.Float, CultureInfo.CurrentCulture, out result)) if(float.TryParse(value.ToString(), NumberStyles.Float, CultureInfo.CurrentCulture, out result))
{ {
this.value = result; this.value = result;

View file

@ -28,7 +28,7 @@ namespace CodeImp.DoomBuilder.Types
#region ================== Variables #region ================== Variables
private object value = (int)0; private object value = 0;
#endregion #endregion
@ -43,7 +43,7 @@ namespace CodeImp.DoomBuilder.Types
if(value != null) if(value != null)
this.value = value; this.value = value;
else else
this.value = (int)0; this.value = 0;
} }
public override object GetValue() public override object GetValue()
@ -55,7 +55,7 @@ namespace CodeImp.DoomBuilder.Types
{ {
int result; int result;
if(int.TryParse(this.value.ToString(), out result)) return result; if(int.TryParse(this.value.ToString(), out result)) return result;
else return 0; return 0;
} }
public override string GetStringValue() public override string GetStringValue()

View file

@ -36,7 +36,7 @@ namespace CodeImp.DoomBuilder.Types
private Dictionary<int, TypeHandlerAttribute> handlertypes; private Dictionary<int, TypeHandlerAttribute> handlertypes;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -89,15 +89,15 @@ namespace CodeImp.DoomBuilder.VisualModes
// This returns the block center in world coordinates // This returns the block center in world coordinates
public Vector2D GetBlockCenter(Point p) public Vector2D GetBlockCenter(Point p)
{ {
return new Vector2D((float)((p.X << BLOCK_SIZE_SHIFT) + (BLOCK_SIZE >> 1)), return new Vector2D((p.X << BLOCK_SIZE_SHIFT) + (BLOCK_SIZE >> 1),
(float)((p.Y << BLOCK_SIZE_SHIFT) + (BLOCK_SIZE >> 1))); (p.Y << BLOCK_SIZE_SHIFT) + (BLOCK_SIZE >> 1));
} }
// This returns the key for a block at the given coordinates // This returns the key for a block at the given coordinates
// TODO: Could we just use the Point struct as key? // TODO: Could we just use the Point struct as key?
private ulong GetBlockKey(Point p) private ulong GetBlockKey(Point p)
{ {
return unchecked( ((ulong)(uint)p.X << 32) + (ulong)(uint)p.Y ); return unchecked( ((ulong)(uint)p.X << 32) + (uint)p.Y );
} }
// This returns the block with the given coordinates // This returns the block with the given coordinates

View file

@ -451,18 +451,17 @@ namespace CodeImp.DoomBuilder.VisualModes
if (target.picked == null) return new Vector2D(float.NaN, float.NaN); if (target.picked == null) return new Vector2D(float.NaN, float.NaN);
//now find where exactly did we hit //now find where exactly did we hit
Vector2D hitCoords = new Vector2D();
if (target.picked is VisualGeometry) { if (target.picked is VisualGeometry) {
VisualGeometry vg = target.picked as VisualGeometry; VisualGeometry vg = target.picked as VisualGeometry;
hitCoords = getIntersection(start, start + delta, new Vector3D(vg.BoundingBox[0].X, vg.BoundingBox[0].Y, vg.BoundingBox[0].Z), new Vector3D(vg.Vertices[0].nx, vg.Vertices[0].ny, vg.Vertices[0].nz)); return getIntersection(start, start + delta, new Vector3D(vg.BoundingBox[0].X, vg.BoundingBox[0].Y, vg.BoundingBox[0].Z), new Vector3D(vg.Vertices[0].nx, vg.Vertices[0].ny, vg.Vertices[0].nz));
} else if (target.picked is VisualThing) {
VisualThing vt = target.picked as VisualThing;
hitCoords = getIntersection(start, start + delta, new Vector3D(vt.BoundingBox[0].X, vt.BoundingBox[0].Y, vt.BoundingBox[0].Z), D3DDevice.V3D(vt.Center - vt.PositionV3));
} else {
return new Vector2D(float.NaN, float.NaN);
} }
return hitCoords; if (target.picked is VisualThing) {
VisualThing vt = target.picked as VisualThing;
return getIntersection(start, start + delta, new Vector3D(vt.BoundingBox[0].X, vt.BoundingBox[0].Y, vt.BoundingBox[0].Z), D3DDevice.V3D(vt.Center - vt.PositionV3));
}
return new Vector2D(float.NaN, float.NaN);
} }
//mxd. This checks intersection between line and plane //mxd. This checks intersection between line and plane
@ -1082,12 +1081,12 @@ namespace CodeImp.DoomBuilder.VisualModes
// Move the camera // Move the camera
if(General.Interface.ShiftState) multiplier = MOVE_SPEED_MULTIPLIER * 2.0f; else multiplier = MOVE_SPEED_MULTIPLIER; if(General.Interface.ShiftState) multiplier = MOVE_SPEED_MULTIPLIER * 2.0f; else multiplier = MOVE_SPEED_MULTIPLIER;
if(keyforward) camdeltapos += camvec * cammovemul * (float)General.Settings.MoveSpeed * multiplier * deltatime; if(keyforward) camdeltapos += camvec * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
if(keybackward) camdeltapos -= camvec * cammovemul * (float)General.Settings.MoveSpeed * multiplier * deltatime; if(keybackward) camdeltapos -= camvec * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
if(keyleft) camdeltapos -= camvecstrafe * cammovemul * (float)General.Settings.MoveSpeed * multiplier * deltatime; if(keyleft) camdeltapos -= camvecstrafe * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
if(keyright) camdeltapos += camvecstrafe * cammovemul * (float)General.Settings.MoveSpeed * multiplier * deltatime; if(keyright) camdeltapos += camvecstrafe * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
if(keyup) camdeltapos += upvec * cammovemul * (float)General.Settings.MoveSpeed * multiplier * deltatime; if(keyup) camdeltapos += upvec * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
if(keydown) camdeltapos += -upvec * cammovemul * (float)General.Settings.MoveSpeed * multiplier * deltatime; if(keydown) camdeltapos += -upvec * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
// Move the camera // Move the camera
General.Map.VisualCamera.ProcessMovement(camdeltapos); General.Map.VisualCamera.ProcessMovement(camdeltapos);
@ -1099,7 +1098,7 @@ namespace CodeImp.DoomBuilder.VisualModes
DoCulling(); DoCulling();
// Update labels in main window // Update labels in main window
General.MainWindow.UpdateCoordinates((Vector2D)General.Map.VisualCamera.Position); General.MainWindow.UpdateCoordinates(General.Map.VisualCamera.Position);
// Now redraw // Now redraw
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();

View file

@ -45,7 +45,7 @@ namespace CodeImp.DoomBuilder.VisualModes
private Sector sector; private Sector sector;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
#endregion #endregion

View file

@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.VisualModes
protected bool selected; protected bool selected;
// Disposing // Disposing
private bool isdisposed = false; private bool isdisposed;
//mxd //mxd
private int cameraDistance3D; private int cameraDistance3D;

View file

@ -130,7 +130,7 @@ namespace CodeImp.DoomBuilder.Windows
CheckBox box = options.Add(item.Title, item.GetIntValue()); CheckBox box = options.Add(item.Title, item.GetIntValue());
// Bind checking event // Bind checking event
box.CheckedChanged += new EventHandler(box_CheckedChanged); box.CheckedChanged += box_CheckedChanged;
// Checking the box? // Checking the box?
if((value & (int)box.Tag) == (int)box.Tag) if((value & (int)box.Tag) == (int)box.Tag)

Some files were not shown because too many files have changed in this diff Show more