mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
A r1959 change in ImageSelectorControl prevented inherited classes from showing properly in Visual Studio's designer.
Also made a bunch of methods static.
This commit is contained in:
parent
e6204be571
commit
8555d75cd2
55 changed files with 193 additions and 167 deletions
|
@ -116,7 +116,7 @@ namespace CodeImp.DoomBuilder.Actions
|
|||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, string> processHints(Dictionary<string, List<string>> hintsgroup) {
|
||||
private static Dictionary<string, string> processHints(Dictionary<string, List<string>> hintsgroup) {
|
||||
var result = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
foreach(KeyValuePair<string, List<string>> group in hintsgroup) {
|
||||
result.Add(group.Key, "{\\rtf1" + string.Join("\\par\\par ", group.Value.ToArray()) + "}");
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.Compilers
|
|||
if(!isdisposed)
|
||||
{
|
||||
Exception deleteerror;
|
||||
float starttime = General.Clock.CurrentTime;
|
||||
float starttime = Clock.CurrentTime;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ namespace CodeImp.DoomBuilder.Compilers
|
|||
}
|
||||
|
||||
// Bail out when it takes too long
|
||||
if((General.Clock.CurrentTime - starttime) > 2000) break;
|
||||
if((Clock.CurrentTime - starttime) > 2000) break;
|
||||
}
|
||||
while(deleteerror != null);
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
}
|
||||
|
||||
// This makes the path prefix for the given assembly
|
||||
private string GetPluginPathPrefix(string assemblyname)
|
||||
private static string GetPluginPathPrefix(string assemblyname)
|
||||
{
|
||||
return "plugins." + assemblyname.ToLowerInvariant() + ".";
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
// This brightens or darkens a color
|
||||
private Color AdjustedColor(Color c, float amount)
|
||||
private static Color AdjustedColor(Color c, float amount)
|
||||
{
|
||||
Color4 cc = new Color4(c);
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
if(General.Settings.CapitalizeTextureNames) this.name.CharacterCasing = CharacterCasing.Upper; //mxd
|
||||
}
|
||||
|
||||
// Setup
|
||||
|
@ -67,6 +66,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
// set the max length of texture names
|
||||
name.MaxLength = General.Map.Config.MaxTextureNameLength;
|
||||
if(General.Settings.CapitalizeTextureNames) this.name.CharacterCasing = CharacterCasing.Upper; //mxd
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -228,15 +228,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Return the new value
|
||||
return name.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing given, keep original value
|
||||
return original;
|
||||
}
|
||||
|
||||
// Nothing given, keep original value
|
||||
return original;
|
||||
}
|
||||
|
||||
// This brightens or darkens a color
|
||||
private Color AdjustedColor(Color c, float amount)
|
||||
private static Color AdjustedColor(Color c, float amount)
|
||||
{
|
||||
Color4 cc = new Color4(c);
|
||||
|
||||
|
|
|
@ -457,7 +457,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void setUDMFLight(Sidedef sd, Label label, Label value) {
|
||||
private static void setUDMFLight(Sidedef sd, Label label, Label value)
|
||||
{
|
||||
if(sd.Fields.ContainsKey("light")) {
|
||||
int light = (int)sd.Fields["light"].Value;
|
||||
|
||||
|
@ -476,7 +477,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd
|
||||
private float getDefaultUDMFValue(string valueName) {
|
||||
private float getDefaultUDMFValue(string valueName)
|
||||
{
|
||||
foreach (UniversalFieldInfo fi in fieldInfos) {
|
||||
if (fi.Name == valueName) return (float)fi.Default;
|
||||
}
|
||||
|
@ -484,7 +486,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void setArgumentText(ArgumentInfo info, Label label, int value) {
|
||||
private static void setArgumentText(ArgumentInfo info, Label label, int value)
|
||||
{
|
||||
TypeHandler th = General.Types.GetArgumentHandler(info);
|
||||
th.SetValue(value);
|
||||
label.Text = th.GetStringValue();
|
||||
|
@ -515,7 +518,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
// This shows a sidedef texture in a panel
|
||||
private void DisplaySidedefTexture(Panel panel, Label label, string name, bool required)
|
||||
private static void DisplaySidedefTexture(Panel panel, Label label, string name, bool required)
|
||||
{
|
||||
// Check if name is a "none" texture
|
||||
if((name.Length < 1) || (name == "-"))
|
||||
|
|
|
@ -694,7 +694,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd. This converts [LB] markers to line breaks if necessary
|
||||
private string[] processLineBreaks(string[] lines)
|
||||
private static string[] processLineBreaks(string[] lines)
|
||||
{
|
||||
List<string> result = new List<string>(lines.Length);
|
||||
string[] separator = new[] { "[LB]" };
|
||||
|
|
|
@ -140,11 +140,12 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd
|
||||
private List<TreeNode> getValidNodes() {
|
||||
private List<TreeNode> getValidNodes()
|
||||
{
|
||||
List<TreeNode> validNodes = new List<TreeNode>();
|
||||
|
||||
foreach(TreeNode n in typelist.SelectedNodes) {
|
||||
if((n.Nodes.Count == 0) && (n.Tag != null) && (n.Tag is ThingTypeInfo))
|
||||
if((n.Nodes.Count == 0) && (n.Tag is ThingTypeInfo))
|
||||
validNodes.Add(n);
|
||||
}
|
||||
|
||||
|
@ -162,7 +163,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
// Node is a child node?
|
||||
TreeNode n = typelist.SelectedNode;
|
||||
if((n.Nodes.Count == 0) && (n.Tag != null) && (n.Tag is ThingTypeInfo))
|
||||
if((n.Nodes.Count == 0) && (n.Tag is ThingTypeInfo))
|
||||
{
|
||||
if((OnTypeDoubleClicked != null) && (typeid.Text.Length > 0)) OnTypeDoubleClicked();
|
||||
}
|
||||
|
@ -188,7 +189,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
TreeNode n = typelist.SelectedNode;
|
||||
|
||||
// Node is a child node?
|
||||
if((n.Nodes.Count == 0) && (n.Tag != null) && (n.Tag is ThingTypeInfo))
|
||||
if((n.Nodes.Count == 0) && (n.Tag is ThingTypeInfo))
|
||||
{
|
||||
ThingTypeInfo ti = (n.Tag as ThingTypeInfo);
|
||||
|
||||
|
|
|
@ -206,7 +206,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void setArgumentText(ArgumentInfo info, Label label, int value) {
|
||||
private static void setArgumentText(ArgumentInfo info, Label label, int value)
|
||||
{
|
||||
TypeHandler th = General.Types.GetArgumentHandler(info);
|
||||
th.SetValue(value);
|
||||
label.Text = th.GetStringValue();
|
||||
|
|
|
@ -506,7 +506,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
private void StartBackgroundLoader()
|
||||
{
|
||||
// Timing
|
||||
loadstarttime = General.Clock.CurrentTime;
|
||||
loadstarttime = Clock.CurrentTime;
|
||||
loadfinishtime = 0;
|
||||
|
||||
// If a loader is already running, stop it first
|
||||
|
@ -638,7 +638,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Timing
|
||||
if(loadfinishtime == 0)
|
||||
{
|
||||
loadfinishtime = General.Clock.CurrentTime;
|
||||
loadfinishtime = Clock.CurrentTime;
|
||||
float deltatimesec = (loadfinishtime - loadstarttime) / 1000.0f;
|
||||
General.WriteLogLine("Resources loading took " + deltatimesec.ToString("########0.00") + " seconds");
|
||||
}
|
||||
|
|
|
@ -402,13 +402,13 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This returns the type name as string
|
||||
private string TypeNameOrNull(Type type)
|
||||
private static string TypeNameOrNull(Type type)
|
||||
{
|
||||
return (type != null) ? type.Name : "NULL";
|
||||
}
|
||||
|
||||
// This returns the type name as string
|
||||
private string TypeNameOrNull(object obj)
|
||||
private static string TypeNameOrNull(object obj)
|
||||
{
|
||||
return (obj != null) ? obj.GetType().Name : "NULL";
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This checks and removes a level when the limit is reached
|
||||
private void LimitUndoRedoLevel(List<UndoSnapshot> list)
|
||||
private static void LimitUndoRedoLevel(List<UndoSnapshot> list)
|
||||
{
|
||||
UndoSnapshot u;
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
}
|
||||
}
|
||||
|
||||
private void HandleException(Exception ex) {
|
||||
private static void HandleException(Exception ex) {
|
||||
// Perform some error handling here.
|
||||
// We don't want to bubble errors to the CLR.
|
||||
General.ErrorLogger.Add(ErrorType.Error, ex.Message);
|
||||
|
|
|
@ -242,7 +242,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool getColor(string name, ref Color4 color) {
|
||||
private static bool getColor(string name, ref Color4 color) {
|
||||
if (name == "black") return true;
|
||||
|
||||
//probably it's a hex color (like FFCC11)?
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|||
dataGridView.Rows.Add(row);
|
||||
}
|
||||
|
||||
private List<Sector> getSectorsWithTag(int tag, int count) {
|
||||
private static List<Sector> getSectorsWithTag(int tag, int count) {
|
||||
List<Sector> list = new List<Sector>();
|
||||
foreach(Sector s in General.Map.Map.Sectors) {
|
||||
if(s.Tag == tag) {
|
||||
|
@ -112,7 +112,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|||
return list;
|
||||
}
|
||||
|
||||
private List<Linedef> getLinedefsWithTag(int tag, int count) {
|
||||
private static List<Linedef> getLinedefsWithTag(int tag, int count) {
|
||||
List<Linedef> list = new List<Linedef>();
|
||||
foreach(Linedef l in General.Map.Map.Linedefs) {
|
||||
if(l.Tag == tag) {
|
||||
|
@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|||
return list;
|
||||
}
|
||||
|
||||
private List<Thing> getThingsWithTag(int tag, int count) {
|
||||
private static List<Thing> getThingsWithTag(int tag, int count) {
|
||||
List<Thing> list = new List<Thing>();
|
||||
foreach(Thing t in General.Map.Map.Things) {
|
||||
if(t.Tag == tag) {
|
||||
|
@ -136,7 +136,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|||
return list;
|
||||
}
|
||||
|
||||
private void showSelection(List<Vector2D> points) {
|
||||
private static void showSelection(List<Vector2D> points) {
|
||||
RectangleF area = MapSet.CreateEmptyArea();
|
||||
|
||||
// Make a view area from the points
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|||
dataGridView.Sort(ThingType, ListSortDirection.Ascending);
|
||||
}
|
||||
|
||||
private List<Thing> getThingsByType(int type) {
|
||||
private static List<Thing> getThingsByType(int type) {
|
||||
List<Thing> list = new List<Thing>();
|
||||
foreach (Thing t in General.Map.Map.Things) {
|
||||
if (t.Type == type) list.Add(t);
|
||||
|
@ -77,7 +77,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|||
return list;
|
||||
}
|
||||
|
||||
private void showSelection(List<Vector2D> points) {
|
||||
private static void showSelection(List<Vector2D> points) {
|
||||
RectangleF area = MapSet.CreateEmptyArea();
|
||||
|
||||
// Make a view area from the points
|
||||
|
|
|
@ -21,6 +21,6 @@ namespace CodeImp.DoomBuilder
|
|||
public class Clock
|
||||
{
|
||||
// This queries the system for the current time
|
||||
public float CurrentTime { get { return Configuration.Timer.ElapsedMilliseconds; } }
|
||||
public static float CurrentTime { get { return Configuration.Timer.ElapsedMilliseconds; } }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1031,7 +1031,7 @@ namespace CodeImp.DoomBuilder {
|
|||
}
|
||||
|
||||
// This copies all lumps, except those of a specific map
|
||||
private void CopyAllLumpsExceptMap(WAD source, WAD target, GameConfiguration mapconfig, string sourcemapname) {
|
||||
private static void CopyAllLumpsExceptMap(WAD source, WAD target, GameConfiguration mapconfig, string sourcemapname) {
|
||||
// Go for all lumps
|
||||
bool skipping = false;
|
||||
foreach (Lump srclump in source.Lumps) {
|
||||
|
@ -1534,7 +1534,8 @@ namespace CodeImp.DoomBuilder {
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void updateScriptsFromLocation(AcsParserSE parser, string path) {
|
||||
private static void updateScriptsFromLocation(AcsParserSE parser, string path)
|
||||
{
|
||||
MemoryStream s = General.Map.Data.LoadFile(path);
|
||||
if(s != null && s.Length > 0) parser.Parse(s, path, true, true);
|
||||
}
|
||||
|
@ -1896,7 +1897,8 @@ namespace CodeImp.DoomBuilder {
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void snapThings(ICollection<Thing> things) {
|
||||
private static void snapThings(IEnumerable<Thing> things)
|
||||
{
|
||||
//we are terribly busy...
|
||||
Cursor.Current = Cursors.AppStarting;
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
#region ================== Tracing
|
||||
|
||||
// This traces sector lines to create a polygon tree
|
||||
private List<EarClipPolygon> DoTrace(Sector s)
|
||||
private static List<EarClipPolygon> DoTrace(Sector s)
|
||||
{
|
||||
Dictionary<Sidedef, bool> todosides = new Dictionary<Sidedef, bool>(s.Sidedefs.Count);
|
||||
Dictionary<Vertex, Vertex> ignores = new Dictionary<Vertex,Vertex>();
|
||||
|
@ -497,7 +497,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
}
|
||||
|
||||
// This finds the cut coordinates and splits the other poly with inner vertices
|
||||
private void SplitOuterWithInner(LinkedListNode<EarClipVertex> start, EarClipPolygon p)
|
||||
private static void SplitOuterWithInner(LinkedListNode<EarClipVertex> start, EarClipPolygon p)
|
||||
{
|
||||
LinkedListNode<EarClipVertex> v1, v2;
|
||||
LinkedListNode<EarClipVertex> insertbefore = null;
|
||||
|
@ -833,7 +833,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
// When the point is on an edge of the triangle, it depends on the lines
|
||||
// adjacent to the point if it is considered inside or not
|
||||
// NOTE: vertices in t must be in clockwise order!
|
||||
private bool PointInsideTriangle(EarClipVertex[] t, LinkedListNode<EarClipVertex> p)
|
||||
private static bool PointInsideTriangle(EarClipVertex[] t, LinkedListNode<EarClipVertex> p)
|
||||
{
|
||||
// If the triangle has no area, there can never be a point inside
|
||||
if(TriangleHasArea(t))
|
||||
|
|
|
@ -209,7 +209,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
}
|
||||
}
|
||||
|
||||
private void AddSidedef(MapSet map, SidedefData data, Linedef ld, bool front, Dictionary<int, Sector> sectorlink) {
|
||||
private static void AddSidedef(MapSet map, SidedefData data, Linedef ld, bool front, Dictionary<int, Sector> sectorlink) {
|
||||
// Create sidedef
|
||||
if(sectorlink.ContainsKey(data.SectorID)) {
|
||||
Sidedef s = map.CreateSidedef(ld, front, sectorlink[data.SectorID]);
|
||||
|
@ -344,11 +344,11 @@ namespace CodeImp.DoomBuilder.IO
|
|||
return fields;
|
||||
}
|
||||
|
||||
private string ReadString(BinaryReader reader) {
|
||||
private static string ReadString(BinaryReader reader) {
|
||||
int len = reader.ReadInt32();
|
||||
if (len == 0) return string.Empty;
|
||||
char[] chars = new char[len];
|
||||
for (int i = 0; i < len; ++i) chars[i] = reader.ReadChar(); //sb.Append(reader.ReadChar());
|
||||
for (int i = 0; i < len; ++i) chars[i] = reader.ReadChar();
|
||||
return new string(chars);
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
}
|
||||
}
|
||||
|
||||
private void AddFlags(Dictionary<string, bool> elementFlags, BinaryWriter writer) {
|
||||
private static void AddFlags(Dictionary<string, bool> elementFlags, BinaryWriter writer) {
|
||||
List<string> flags = new List<string>();
|
||||
|
||||
foreach(KeyValuePair<string, bool> f in elementFlags) {
|
||||
|
|
|
@ -1051,7 +1051,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
#region ================== Selection
|
||||
|
||||
// This checks a flag in a selection type
|
||||
private bool InSelectionType(SelectionType value, SelectionType bits)
|
||||
private static bool InSelectionType(SelectionType value, SelectionType bits)
|
||||
{
|
||||
return (value & bits) == bits;
|
||||
}
|
||||
|
@ -2775,7 +2775,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// Handler for finding a new tag
|
||||
private void NewTagHandler(MapElement element, bool actionargument, UniversalType type, ref int value, Dictionary<int, bool> usedtags)
|
||||
private static void NewTagHandler(MapElement element, bool actionargument, UniversalType type, ref int value, Dictionary<int, bool> usedtags)
|
||||
{
|
||||
usedtags[value] = true;
|
||||
}
|
||||
|
@ -2857,7 +2857,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// This checks if the given action argument type is a tag type
|
||||
private bool CheckIsTagType(int argtype)
|
||||
private static bool CheckIsTagType(int argtype)
|
||||
{
|
||||
return (argtype == (int)UniversalType.LinedefTag) ||
|
||||
(argtype == (int)UniversalType.SectorTag) ||
|
||||
|
@ -2994,7 +2994,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
Dictionary<uint, List<Sidedef>> storedsides = new Dictionary<uint, List<Sidedef>>(numsidedefs);
|
||||
int originalsidescount = numsidedefs;
|
||||
float starttime = General.Clock.CurrentTime;
|
||||
float starttime = Clock.CurrentTime;
|
||||
|
||||
BeginAddRemove();
|
||||
|
||||
|
@ -3081,7 +3081,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
EndAddRemove();
|
||||
|
||||
// Output info
|
||||
float endtime = General.Clock.CurrentTime;
|
||||
float endtime = Clock.CurrentTime;
|
||||
float deltatimesec = (endtime - starttime) / 1000.0f;
|
||||
float ratio = 100.0f - ((numsidedefs / (float)originalsidescount) * 100.0f);
|
||||
General.WriteLogLine("Sidedefs compressed: " + numsidedefs + " remaining out of " + originalsidescount + " (" + ratio.ToString("########0.00") + "%) in " + deltatimesec.ToString("########0.00") + " seconds");
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
// This clamps a value between 0 and 1
|
||||
private float Saturate(float v)
|
||||
private static float Saturate(float v)
|
||||
{
|
||||
if(v < 0f) return 0f; else if(v > 1f) return 1f; else return v;
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
// This makes screen vertices for display
|
||||
private FlatVertex[] CreateScreenVerts(Size texturesize)
|
||||
private static FlatVertex[] CreateScreenVerts(Size texturesize)
|
||||
{
|
||||
FlatVertex[] screenverts = new FlatVertex[4];
|
||||
screenverts[0].x = 0.5f;
|
||||
|
@ -1026,7 +1026,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void CreateThingSpriteVerts(Vector2D screenpos, float width, float height, ref FlatVertex[] verts, int offset, int color) {
|
||||
private static void CreateThingSpriteVerts(Vector2D screenpos, float width, float height, ref FlatVertex[] verts, int offset, int color)
|
||||
{
|
||||
// Setup fixed rect for circle
|
||||
verts[offset].x = screenpos.x - width;
|
||||
verts[offset].y = screenpos.y - height;
|
||||
|
|
|
@ -375,7 +375,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Highlight
|
||||
if(General.Settings.AnimateVisualSelection)
|
||||
{
|
||||
float time = General.Clock.CurrentTime;
|
||||
float time = Clock.CurrentTime;
|
||||
highlightglow = (float)Math.Sin(time / 100.0f) * 0.1f + 0.4f;
|
||||
//mxd. WHY?!
|
||||
//highlightglowinv = -(float)Math.Sin(time / 100.0f) * 0.1f + 0.4f;
|
||||
|
@ -549,13 +549,16 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
private int sortThingsByCameraDistance(VisualThing t1, VisualThing t2) {
|
||||
private static int sortThingsByCameraDistance(VisualThing t1, VisualThing t2)
|
||||
{
|
||||
if (t1.CameraDistance3D == t2.CameraDistance3D) return 0;
|
||||
if (t1.CameraDistance3D > t2.CameraDistance3D) return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//mxd
|
||||
private int sortThingsByLightRenderStyle(VisualThing t1, VisualThing t2) {
|
||||
private static int sortThingsByLightRenderStyle(VisualThing t1, VisualThing t2)
|
||||
{
|
||||
if (t1.LightRenderStyle == t2.LightRenderStyle) return 0;
|
||||
if (t1.LightRenderStyle > t2.LightRenderStyle) return 1;
|
||||
return -1;
|
||||
|
@ -1120,7 +1123,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd. This returns distance, at which fog color completely replaces texture color for given sector
|
||||
private float getFogEnd(Sector s) {
|
||||
private static float getFogEnd(Sector s)
|
||||
{
|
||||
float brightness = Math.Max(30, s.Brightness);
|
||||
|
||||
if (s.HasFogColor) {
|
||||
|
|
|
@ -465,7 +465,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
}
|
||||
|
||||
//mxd. This checks intersection between line and plane
|
||||
protected Vector2D getIntersection(Vector3D start, Vector3D end, Vector3D planeCenter, Vector3D planeNormal) {
|
||||
protected Vector2D getIntersection(Vector3D start, Vector3D end, Vector3D planeCenter, Vector3D planeNormal)
|
||||
{
|
||||
Vector3D delta = new Vector3D(planeCenter.x - start.x, planeCenter.y - start.y, planeCenter.z - start.z);
|
||||
return start + Vector3D.DotProduct(planeNormal, delta) / Vector3D.DotProduct(planeNormal, end - start) * (end - start);
|
||||
}
|
||||
|
@ -627,22 +628,14 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
}
|
||||
|
||||
// This returns the camera sector from linedef
|
||||
private Sector GetCameraSectorFromLinedef(Linedef ld)
|
||||
private static Sector GetCameraSectorFromLinedef(Linedef ld)
|
||||
{
|
||||
if(ld.SideOfLine(General.Map.VisualCamera.Position) < 0)
|
||||
{
|
||||
if(ld.Front != null)
|
||||
return ld.Front.Sector;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ld.Back != null)
|
||||
return ld.Back.Sector;
|
||||
else
|
||||
return null;
|
||||
return (ld.Front != null ? ld.Front.Sector : null);
|
||||
}
|
||||
|
||||
return (ld.Back != null ? ld.Back.Sector : null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -957,7 +950,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
public VisualThing GetVisualThing(Thing t) { return allthings[t]; }
|
||||
|
||||
//mxd
|
||||
public List<VisualThing> GetSelectedVisualThings(bool refreshSelection) {
|
||||
public List<VisualThing> GetSelectedVisualThings(bool refreshSelection)
|
||||
{
|
||||
if (refreshSelection || selectedVisualThings == null) {
|
||||
selectedVisualThings = new List<VisualThing>();
|
||||
foreach (KeyValuePair<Thing, VisualThing> group in allthings) {
|
||||
|
@ -973,7 +967,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
VisualPickResult target = PickObject(start, start + delta);
|
||||
|
||||
//not appropriate way to do this, but...
|
||||
if (target.picked != null && target.picked is VisualThing)
|
||||
if (target.picked is VisualThing)
|
||||
selectedVisualThings.Add((VisualThing)target.picked);
|
||||
}
|
||||
}
|
||||
|
@ -984,7 +978,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
/// <summary>
|
||||
/// mxd. This returns list of selected sectors based on surfaces selected in visual mode
|
||||
/// </summary>
|
||||
public List<VisualSector> GetSelectedVisualSectors(bool refreshSelection) {
|
||||
public List<VisualSector> GetSelectedVisualSectors(bool refreshSelection)
|
||||
{
|
||||
if (refreshSelection || selectedVisualSectors == null) {
|
||||
selectedVisualSectors = new List<VisualSector>();
|
||||
foreach (KeyValuePair<Sector, VisualSector> group in allsectors) {
|
||||
|
@ -1008,12 +1003,12 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
/// <summary>
|
||||
/// mxd. This returns list of surfaces selected in visual mode
|
||||
/// </summary>
|
||||
public List<VisualGeometry> GetSelectedSurfaces() {
|
||||
public List<VisualGeometry> GetSelectedSurfaces()
|
||||
{
|
||||
List<VisualGeometry> selectedSurfaces = new List<VisualGeometry>();
|
||||
foreach (KeyValuePair<Sector, VisualSector> group in allsectors) {
|
||||
foreach (VisualGeometry vg in group.Value.AllGeometry) {
|
||||
if (vg.Selected)
|
||||
selectedSurfaces.Add(vg);
|
||||
if (vg.Selected) selectedSurfaces.Add(vg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1026,16 +1021,16 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
}
|
||||
|
||||
//mxd
|
||||
private VisualGeometry getHilightedSurface() {
|
||||
private VisualGeometry getHilightedSurface()
|
||||
{
|
||||
Vector3D start = General.Map.VisualCamera.Position;
|
||||
Vector3D delta = General.Map.VisualCamera.Target - General.Map.VisualCamera.Position;
|
||||
delta = delta.GetFixedLength(General.Settings.ViewDistance * 0.98f);
|
||||
VisualPickResult target = PickObject(start, start + delta);
|
||||
|
||||
if(target.picked != null && target.picked is VisualGeometry) {
|
||||
if(target.picked is VisualGeometry) {
|
||||
VisualGeometry vg = (VisualGeometry)target.picked;
|
||||
if (vg.Sector != null)
|
||||
return vg;
|
||||
if (vg.Sector != null) return vg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
return;
|
||||
}
|
||||
|
||||
float time = General.Clock.CurrentTime;
|
||||
float time = Clock.CurrentTime;
|
||||
float rMin = Math.Min(lightPrimaryRadius, lightSecondaryRadius);
|
||||
float rMax = Math.Max(lightPrimaryRadius, lightSecondaryRadius);
|
||||
float diff = rMax - rMin;
|
||||
|
|
|
@ -236,7 +236,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void listconfigs_ItemChecked(object sender, ItemCheckedEventArgs e) {
|
||||
private void listconfigs_ItemChecked(object sender, ItemCheckedEventArgs e)
|
||||
{
|
||||
e.Item.ForeColor = (e.Item.Checked ? SystemColors.WindowText : SystemColors.InactiveCaptionText);
|
||||
}
|
||||
|
||||
|
|
|
@ -1761,7 +1761,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
// This updates the seperators
|
||||
// Hides redundant seperators and shows single seperators
|
||||
private void UpdateToolStripSeparators(ToolStripItemCollection items, bool defaultvisible)
|
||||
private static void UpdateToolStripSeparators(ToolStripItemCollection items, bool defaultvisible)
|
||||
{
|
||||
ToolStripItem pvi = null;
|
||||
foreach(ToolStripItem i in items)
|
||||
|
@ -2184,7 +2184,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
// This sets the shortcut keys on menu items
|
||||
private void ApplyShortcutKeys(ToolStripItemCollection items)
|
||||
private static void ApplyShortcutKeys(ToolStripItemCollection items)
|
||||
{
|
||||
// Go for all controls to find menu items
|
||||
foreach(ToolStripItem item in items)
|
||||
|
@ -2227,13 +2227,13 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
// This fixes short action names to fully qualified
|
||||
// action names on menu item tags
|
||||
private void RenameTagsToFullActions(ToolStripItemCollection items, Plugin plugin)
|
||||
private static void RenameTagsToFullActions(ToolStripItemCollection items, Plugin plugin)
|
||||
{
|
||||
// Go for all controls to find menu items
|
||||
foreach(ToolStripItem item in items)
|
||||
{
|
||||
// Tag set for this item?
|
||||
if((item.Tag != null) && (item.Tag is string))
|
||||
if(item.Tag is string)
|
||||
{
|
||||
// Check if the tag doe not already begin with the assembly name
|
||||
if(!(item.Tag as string).StartsWith(plugin.Name + "_", StringComparison.InvariantCultureIgnoreCase))
|
||||
|
@ -3462,7 +3462,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(!processor.Enabled)
|
||||
{
|
||||
processor.Enabled = true;
|
||||
lastupdatetime = General.Clock.CurrentTime;
|
||||
lastupdatetime = Clock.CurrentTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3488,7 +3488,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private void processor_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Vector2D deltamouse;
|
||||
float curtime = General.Clock.CurrentTime;
|
||||
float curtime = Clock.CurrentTime;
|
||||
float deltatime = curtime - lastupdatetime;
|
||||
lastupdatetime = curtime;
|
||||
|
||||
|
|
|
@ -171,7 +171,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
// mxd. This matches a WAD file with the specified game configuration
|
||||
// by checking if the specific lumps are detected
|
||||
private bool MatchConfiguration(Configuration cfg, WAD wadfile) {
|
||||
private static bool MatchConfiguration(Configuration cfg, WAD wadfile)
|
||||
{
|
||||
int scanindex, checkoffset;
|
||||
int lumpsfound, lumpsrequired = 0;
|
||||
string lumpname;
|
||||
|
|
|
@ -170,12 +170,14 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
//mxd
|
||||
private int sortImageData(ImageData img1, ImageData img2) {
|
||||
private static int sortImageData(ImageData img1, ImageData img2)
|
||||
{
|
||||
return img1.FullName.CompareTo(img2.FullName);
|
||||
}
|
||||
|
||||
//mxd
|
||||
private TreeNode findTextureByLongName(TreeNode node, long longname) {
|
||||
private static TreeNode findTextureByLongName(TreeNode node, long longname)
|
||||
{
|
||||
//first search in child nodes
|
||||
TreeNode match;
|
||||
|
||||
|
@ -194,7 +196,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
//mxd
|
||||
private TreeNode findNodeByName(TreeNodeCollection nodes, string selectname) {
|
||||
private static TreeNode findNodeByName(TreeNodeCollection nodes, string selectname)
|
||||
{
|
||||
foreach (TreeNode n in nodes) {
|
||||
if (n.Name == selectname) return n;
|
||||
|
||||
|
@ -205,7 +208,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void createNodes(TreeNode root) {
|
||||
private void createNodes(TreeNode root)
|
||||
{
|
||||
ResourceTextureSet set = root.Tag as ResourceTextureSet;
|
||||
if (set == null) {
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Resource " + root.Name + " doesn't have TextureSet!");
|
||||
|
@ -266,7 +270,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void SetItemsCount(TreeNode node) {
|
||||
private static void SetItemsCount(TreeNode node)
|
||||
{
|
||||
ResourceTextureSet ts = node.Tag as ResourceTextureSet;
|
||||
if (ts == null) throw new Exception("Expected IFilledTextureSet, but got null...");
|
||||
node.Text += " [" + ts.Textures.Count + "]";
|
||||
|
|
|
@ -34,11 +34,6 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Builder, Version=2.1.2.1557, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Build\Builder.exe</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
|
@ -139,6 +134,13 @@
|
|||
<ItemGroup>
|
||||
<None Include="Resources\Terrain.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Core\Builder.csproj">
|
||||
<Project>{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}</Project>
|
||||
<Name>Builder</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -383,7 +383,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
|||
setUpperTexture(sd, textureName, textureName);
|
||||
}
|
||||
|
||||
private void setUpperTexture(SidedefData sd, string textureName, string otherTextureName) {
|
||||
private static void setUpperTexture(SidedefData sd, string textureName, string otherTextureName) {
|
||||
if(!keepExistingSideTextures || string.IsNullOrEmpty(sd.HighTexture) || sd.HighTexture == "-")
|
||||
sd.Side.SetTextureHigh(textureName);
|
||||
|
||||
|
@ -395,7 +395,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
|||
setLowerTexture(sd, textureName, textureName);
|
||||
}
|
||||
|
||||
private void setLowerTexture(SidedefData sd, string textureName, string otherTextureName) {
|
||||
private static void setLowerTexture(SidedefData sd, string textureName, string otherTextureName) {
|
||||
if(!keepExistingSideTextures || string.IsNullOrEmpty(sd.LowTexture) || sd.LowTexture == "-")
|
||||
sd.Side.SetTextureLow(textureName);
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
|
|||
return line;
|
||||
}
|
||||
|
||||
private Vertex getVertex(Dictionary<Vector3D, Vertex> verts, Vector3D pos) {
|
||||
private static Vertex getVertex(Dictionary<Vector3D, Vertex> verts, Vector3D pos) {
|
||||
//already there?
|
||||
if(verts.ContainsKey(pos)) return verts[pos];
|
||||
|
||||
|
|
|
@ -519,7 +519,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
|
|||
}
|
||||
|
||||
//this returns relative handle location
|
||||
private Vector2D getHandleLocation(Vector2D start, Vector2D end, Vector2D direction) {
|
||||
private static Vector2D getHandleLocation(Vector2D start, Vector2D end, Vector2D direction) {
|
||||
float angle = -(float)Math.Atan2(start.y - end.y, start.x - end.x);
|
||||
float dirAngle = -(float)Math.Atan2(direction.y - start.y, direction.x - start.x);
|
||||
float length = (float)Math.Sqrt(Math.Pow(Math.Abs(start.x - end.x), 2.0) + Math.Pow(Math.Abs(start.y - end.y), 2.0)) * 0.3f;
|
||||
|
@ -533,16 +533,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
|
|||
|
||||
//LINE DRAWING
|
||||
//returns true if 2 lines intersect
|
||||
private bool linesIntersect(Line line1, Line line2) {
|
||||
private static bool linesIntersect(Line line1, Line line2) {
|
||||
float zn = (line2.End.y - line2.Start.y) * (line1.End.x - line1.Start.x) - (line2.End.x - line2.Start.x) * (line1.End.y - line1.Start.y);
|
||||
float ch1 = (line2.End.x - line2.Start.x) * (line1.Start.y - line2.Start.y) - (line2.End.y - line2.Start.y) * (line1.Start.x - line2.Start.x);
|
||||
float ch2 = (line1.End.x - line1.Start.x) * (line1.Start.y - line2.Start.y) - (line1.End.y - line1.Start.y) * (line1.Start.x - line2.Start.x);
|
||||
|
||||
if (zn == 0) return false;
|
||||
|
||||
if ((ch1 / zn <= 1 && ch1 / zn >= 0) && (ch2 / zn <= 1 && ch2 / zn >= 0))
|
||||
return true;
|
||||
return false;
|
||||
return (ch1 / zn <= 1 && ch1 / zn >= 0) && (ch2 / zn <= 1 && ch2 / zn >= 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -658,7 +655,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
|
|||
/**
|
||||
* Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity.
|
||||
*/
|
||||
private int easeInSine(int val1, int val2, float delta) {
|
||||
private static int easeInSine(int val1, int val2, float delta) {
|
||||
float f_val1 = val1;
|
||||
float f_val2 = val2 - f_val1;
|
||||
return (int)(-f_val2 * Math.Cos(delta * Angle2D.PIHALF) + f_val2 + f_val1);
|
||||
|
@ -667,7 +664,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
|
|||
/**
|
||||
* Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity.
|
||||
*/
|
||||
private int easeOutSine(int val1, int val2, float delta) {
|
||||
private static int easeOutSine(int val1, int val2, float delta) {
|
||||
float f_val1 = val1;
|
||||
float f_val2 = val2;
|
||||
return (int)((f_val2 - f_val1) * Math.Sin(delta * Angle2D.PIHALF) + f_val1);
|
||||
|
@ -676,7 +673,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
|
|||
/**
|
||||
* Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration.
|
||||
*/
|
||||
private int easeInOutSine(int val1, int val2, float delta) {
|
||||
private static int easeInOutSine(int val1, int val2, float delta) {
|
||||
float f_val1 = val1;
|
||||
float f_val2 = val2;
|
||||
return (int)(-f_val2 / 2.0f * (Math.Cos(Angle2D.PI * delta) - 1.0f) + f_val1);
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#region ================== Methods
|
||||
|
||||
// This generates the vertices to split the line with, from start to end
|
||||
private List<Vector2D> GenerateCurve(Linedef line)
|
||||
private static List<Vector2D> GenerateCurve(Linedef line)
|
||||
{
|
||||
// Fetch settings from window
|
||||
int vertices = BuilderPlug.Me.CurveLinedefsForm.Vertices;
|
||||
|
|
|
@ -651,7 +651,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// This checks if a point is in a rect
|
||||
private bool PointInRectF(RectangleF rect, Vector2D point)
|
||||
private static bool PointInRectF(RectangleF rect, Vector2D point)
|
||||
{
|
||||
return !(point.x < rect.Left || point.x > rect.Right || point.y < rect.Top || point.y > rect.Bottom); //mxd
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
protected abstract ImageData GetTexture(Sector editsector);
|
||||
|
||||
// This checks if a point is in a rect
|
||||
private bool PointInRectF(RectangleF rect, Vector2D point)
|
||||
private static bool PointInRectF(RectangleF rect, Vector2D point)
|
||||
{
|
||||
return (point.x >= rect.Left) && (point.x <= rect.Right) && (point.y >= rect.Top) && (point.y <= rect.Bottom);
|
||||
}
|
||||
|
|
|
@ -662,7 +662,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. Check if any selected linedef is outside of map boundary
|
||||
private bool canDrag() {
|
||||
private static bool canDrag()
|
||||
{
|
||||
ICollection<Linedef> selectedlines = General.Map.Map.GetSelectedLinedefs(true);
|
||||
int unaffectedCount = 0;
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
flashpolygon = new FlatVertex[s.FlatVertices.Length];
|
||||
s.FlatVertices.CopyTo(flashpolygon, 0);
|
||||
flashintensity = 1.0f;
|
||||
flashstarttime = General.Clock.CurrentTime;
|
||||
flashstarttime = Clock.CurrentTime;
|
||||
General.Interface.EnableProcessing();
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
flashpolygon = new FlatVertex[s.FlatVertices.Length];
|
||||
s.FlatVertices.CopyTo(flashpolygon, 0);
|
||||
flashintensity = 1.0f;
|
||||
flashstarttime = General.Clock.CurrentTime;
|
||||
flashstarttime = Clock.CurrentTime;
|
||||
General.Interface.EnableProcessing();
|
||||
}
|
||||
else
|
||||
|
@ -516,7 +516,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(flashpolygon != null)
|
||||
{
|
||||
// Determine the intensity of the flash by time elapsed
|
||||
float curtime = General.Clock.CurrentTime;
|
||||
float curtime = Clock.CurrentTime;
|
||||
flashintensity = 1f - ((curtime - flashstarttime) / FLASH_DURATION);
|
||||
if(flashintensity > 0.0f)
|
||||
{
|
||||
|
|
|
@ -567,7 +567,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. Check if any selected thing is outside of map boundary
|
||||
private bool canDrag() {
|
||||
private static bool canDrag()
|
||||
{
|
||||
ICollection<Thing> selectedthings = General.Map.Map.GetSelectedThings(true);
|
||||
int unaffectedCount = 0;
|
||||
|
||||
|
@ -779,7 +780,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// This creates a new thing
|
||||
private Thing InsertThing(Vector2D pos)
|
||||
private static Thing InsertThing(Vector2D pos)
|
||||
{
|
||||
if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
|
||||
pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary)
|
||||
|
|
|
@ -556,7 +556,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. Check if any selected vertex is outside of map boundary
|
||||
private bool canDrag() {
|
||||
private static bool canDrag()
|
||||
{
|
||||
ICollection<Vertex> selectedverts = General.Map.Map.GetSelectedVertices(true);
|
||||
int unaffectedCount = 0;
|
||||
|
||||
|
@ -839,7 +840,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
[BeginAction("deleteitem", BaseAction = true)]
|
||||
public void DeleteItem() {
|
||||
public void DeleteItem()
|
||||
{
|
||||
// Make list of selected vertices
|
||||
ICollection<Vertex> selected = General.Map.Map.GetSelectedVertices(true);
|
||||
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted);
|
||||
|
@ -886,7 +888,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
[BeginAction("dissolveitem", BaseAction = true)] //mxd
|
||||
public void DissolveItem() {
|
||||
public void DissolveItem()
|
||||
{
|
||||
// Make list of selected vertices
|
||||
ICollection<Vertex> selected = General.Map.Map.GetSelectedVertices(true);
|
||||
if(selected.Count == 0) {
|
||||
|
@ -961,7 +964,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
[BeginAction("placethings")] //mxd
|
||||
public void PlaceThings() {
|
||||
public void PlaceThings()
|
||||
{
|
||||
// Make list of selected vertices
|
||||
ICollection<Vertex> selected = General.Map.Map.GetSelectedVertices(true);
|
||||
if (selected.Count == 0) {
|
||||
|
@ -981,7 +985,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
//mxd
|
||||
[BeginAction("selectsimilar")]
|
||||
public void SelectSimilar() {
|
||||
public void SelectSimilar()
|
||||
{
|
||||
ICollection<Vertex> selection = General.Map.Map.GetSelectedVertices(true);
|
||||
|
||||
if(selection.Count == 0) {
|
||||
|
@ -998,7 +1003,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#region ================== Action assist (mxd)
|
||||
|
||||
//mxd
|
||||
private void mergeLines(ICollection<Vertex> selected, Linedef ld1, Linedef ld2, Vertex v) {
|
||||
private void mergeLines(ICollection<Vertex> selected, Linedef ld1, Linedef ld2, Vertex v)
|
||||
{
|
||||
Vertex v1 = (ld1.Start == v) ? ld1.End : ld1.Start;
|
||||
Vertex v2 = (ld2.Start == v) ? ld2.End : ld2.Start;
|
||||
|
||||
|
@ -1038,7 +1044,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void drawLine(Vector2D start, Vector2D end) {
|
||||
private static void drawLine(Vector2D start, Vector2D end)
|
||||
{
|
||||
DrawnVertex dv1 = new DrawnVertex();
|
||||
DrawnVertex dv2 = new DrawnVertex();
|
||||
dv1.stitchline = true;
|
||||
|
@ -1055,7 +1062,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. If there are different sectors on both sides of given linedef, join them
|
||||
private void tryJoinSectors(Linedef ld) {
|
||||
private void tryJoinSectors(Linedef ld)
|
||||
{
|
||||
if(ld.IsDisposed) return;
|
||||
|
||||
if(ld.Front != null && ld.Front.Sector != null && ld.Back != null && ld.Back.Sector != null && ld.Front.Sector.Index != ld.Back.Sector.Index) {
|
||||
|
|
|
@ -204,13 +204,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Point in rect?
|
||||
private bool PointInRect(Vector2D lt, Vector2D rb, Vector2D p)
|
||||
private static bool PointInRect(Vector2D lt, Vector2D rb, Vector2D p)
|
||||
{
|
||||
return (p.x >= lt.x) && (p.x <= rb.x) && (p.y <= lt.y) && (p.y >= rb.y);
|
||||
}
|
||||
|
||||
// Checks if two things overlap
|
||||
private bool ThingsOverlap(Thing t1, Thing t2)
|
||||
private static bool ThingsOverlap(Thing t1, Thing t2)
|
||||
{
|
||||
Vector3D p1 = t1.Position;
|
||||
Vector3D p2 = t2.Position;
|
||||
|
@ -236,7 +236,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Checks if the flags of two things overlap (i.e. if they show up at the same time)
|
||||
private bool FlagsOverlap(Thing t1, Thing t2) {
|
||||
private static bool FlagsOverlap(Thing t1, Thing t2)
|
||||
{
|
||||
var groups = new Dictionary<string, List<ThingFlagsCompare>>(StringComparer.Ordinal);
|
||||
int overlappinggroups = 0;
|
||||
|
||||
|
@ -260,10 +261,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// All groups have to overlap for the things to show up
|
||||
// at the same time
|
||||
if (overlappinggroups == groups.Count)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return (overlappinggroups == groups.Count);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -445,8 +445,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
//mxd. merged from GZDoomEditing plugin
|
||||
// This applies the given values on the vertices
|
||||
private void SetupSurfaceVertices(FlatVertex[] vertices, Sector s, ImageData img, Vector2D offset,
|
||||
Vector2D scale, float rotate, int color, int light, bool absolute) {
|
||||
private static void SetupSurfaceVertices(FlatVertex[] vertices, Sector s, ImageData img, Vector2D offset,
|
||||
Vector2D scale, float rotate, int color, int light, bool absolute)
|
||||
{
|
||||
// Prepare for math!
|
||||
rotate = Angle2D.DegToRad(rotate);
|
||||
Vector2D texscale = new Vector2D(1.0f / img.ScaledWidth, 1.0f / img.ScaledHeight);
|
||||
|
|
|
@ -247,7 +247,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
|
|||
return geo;
|
||||
}
|
||||
|
||||
private void checkTextureName(ref Dictionary<string, List<WorldVertex[]>> geo, ref string texture) {
|
||||
private static void checkTextureName(ref Dictionary<string, List<WorldVertex[]>> geo, ref string texture) {
|
||||
if(!string.IsNullOrEmpty(texture) && texture != "-") {
|
||||
if(!geo.ContainsKey(texture))
|
||||
geo.Add(texture, new List<WorldVertex[]>());
|
||||
|
@ -258,7 +258,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
|
|||
|
||||
//SURFACE OPTIMIZATION
|
||||
//it's either quad, or triangle
|
||||
private WorldVertex[] optimizeWall(WorldVertex[] verts) {
|
||||
private static WorldVertex[] optimizeWall(WorldVertex[] verts) {
|
||||
if (verts.Length == 6) {
|
||||
return new[] { verts[5], verts[2], verts[1], verts[0] };
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
|
|||
return verts;
|
||||
}
|
||||
|
||||
private List<WorldVertex[]> optimizeSector(WorldVertex[] verts, VisualModes.VisualGeometryType visualGeometryType) {
|
||||
private static List<WorldVertex[]> optimizeSector(WorldVertex[] verts, VisualModes.VisualGeometryType visualGeometryType) {
|
||||
List<WorldVertex[]> groups = new List<WorldVertex[]>();
|
||||
|
||||
if(verts.Length == 6) { //rectangle surface
|
||||
|
@ -287,7 +287,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
|
|||
}
|
||||
|
||||
//OBJ Creation
|
||||
private StringBuilder createObjGeometry(Dictionary<string, List<WorldVertex[]>> geometryByTexture, WavefrontExportSettings data) {
|
||||
private static StringBuilder createObjGeometry(Dictionary<string, List<WorldVertex[]>> geometryByTexture, WavefrontExportSettings data) {
|
||||
StringBuilder obj = new StringBuilder();
|
||||
const string vertexFormatter = "{0} {2} {1}\n";
|
||||
|
||||
|
|
|
@ -516,7 +516,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd
|
||||
private Vector3D[] translateCoordinates(Vector3D[] coordinates, Vector2D direction, bool absolutePosition) {
|
||||
private static Vector3D[] translateCoordinates(Vector3D[] coordinates, Vector2D direction, bool absolutePosition)
|
||||
{
|
||||
if (coordinates.Length == 0) return null;
|
||||
|
||||
direction.x = (float)Math.Round(direction.x);
|
||||
|
@ -526,7 +527,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
//move things...
|
||||
if (!absolutePosition) { //...relatively (that's easy)
|
||||
int camAngle = (int)Math.Round(Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY));// * 180 / Math.PI);
|
||||
int camAngle = (int)Math.Round(Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY));
|
||||
int sector = General.ClampAngle(camAngle - 45) / 90;
|
||||
direction = direction.GetRotated(sector * Angle2D.PIHALF);
|
||||
|
||||
|
@ -1082,10 +1083,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Time to pick a new target?
|
||||
if(General.Clock.CurrentTime > (lastpicktime + PICK_INTERVAL))
|
||||
if(Clock.CurrentTime > (lastpicktime + PICK_INTERVAL))
|
||||
{
|
||||
PickTargetUnlocked();
|
||||
lastpicktime = General.Clock.CurrentTime;
|
||||
lastpicktime = Clock.CurrentTime;
|
||||
}
|
||||
|
||||
// The mouse is always in motion
|
||||
|
@ -1648,7 +1649,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
//mxd. Copied from BuilderModes.ThingsMode
|
||||
// This creates a new thing
|
||||
private Thing CreateThing(Vector2D pos) {
|
||||
private static Thing CreateThing(Vector2D pos)
|
||||
{
|
||||
if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
|
||||
pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Failed to insert thing: outside of map boundaries.");
|
||||
|
@ -3483,14 +3485,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd
|
||||
private bool sidePartIsSelected(List<BaseVisualGeometrySidedef> selection, Sidedef side, VisualGeometryType geoType) {
|
||||
private static bool sidePartIsSelected(List<BaseVisualGeometrySidedef> selection, Sidedef side, VisualGeometryType geoType)
|
||||
{
|
||||
foreach(BaseVisualGeometrySidedef vs in selection)
|
||||
if(vs.GeometryType == geoType && vs.Sidedef.Index == side.Index) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//mxd. This converts offsetY from/to "normalized" offset for given upper wall
|
||||
internal float GetTopOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized) {
|
||||
internal float GetTopOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized)
|
||||
{
|
||||
if(side.Line.IsFlagSet(General.Map.Config.UpperUnpeggedFlag) || side.Other == null || side.Other.Sector == null)
|
||||
return offset;
|
||||
|
||||
|
@ -3502,7 +3506,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. This converts offsetY from/to "normalized" offset for given middle wall
|
||||
internal float GetMiddleOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized) {
|
||||
internal float GetMiddleOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized)
|
||||
{
|
||||
if(!side.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag) || side.Sector == null)
|
||||
return offset;
|
||||
|
||||
|
@ -3514,7 +3519,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. This converts offsetY from/to "normalized" offset for given lower wall
|
||||
internal float GetBottomOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized) {
|
||||
internal float GetBottomOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized)
|
||||
{
|
||||
float surfaceHeight;
|
||||
if (side.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag)) {
|
||||
if (side.Other == null || side.Other.Sector == null || side.Sector.CeilTexture != General.Map.Config.SkyFlatName ||
|
||||
|
|
|
@ -354,7 +354,7 @@ namespace CodeImp.DoomBuilder.ColorPicker {
|
|||
}
|
||||
}
|
||||
|
||||
private int CalcDegrees(Point pt) {
|
||||
private static int CalcDegrees(Point pt) {
|
||||
int degrees;
|
||||
|
||||
if (pt.X == 0) {
|
||||
|
@ -433,7 +433,7 @@ namespace CodeImp.DoomBuilder.ColorPicker {
|
|||
return Points;
|
||||
}
|
||||
|
||||
private Point GetPoint(float degrees, float radius, Point centerPoint) {
|
||||
private static Point GetPoint(float degrees, float radius, Point centerPoint) {
|
||||
// Given the center of a circle and its radius, along
|
||||
// with the angle corresponding to the point, find the coordinates.
|
||||
// In other words, conver t from polar to rectangular coordinates.
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Controls {
|
|||
btnCancel.ForeColor = (RGB.Red < 180 && RGB.Green < 180) ? Color.White : Color.Black;
|
||||
}
|
||||
|
||||
private void refreshNudValue(NumericUpDown nud, int value) {
|
||||
private static void refreshNudValue(NumericUpDown nud, int value) {
|
||||
// Update the value of the NumericUpDown control, if the value is different than the current value.
|
||||
// Refresh the control, causing an immediate repaint.
|
||||
if (nud.Value != value) {
|
||||
|
|
|
@ -281,7 +281,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows {
|
|||
}
|
||||
|
||||
//this is called only once
|
||||
private Color getThingColor(Thing thing) {
|
||||
private static Color getThingColor(Thing thing) {
|
||||
if (thing.Type == 1502) //vavoom light
|
||||
return Color.White;
|
||||
if (thing.Type == 1503) //vavoom colored light
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace CodeImp.DoomBuilder.CommentsPanel
|
|||
}
|
||||
|
||||
// This adds comments from a MapElement
|
||||
private void AddComments(MapElement e, Dictionary<string, CommentInfo> comments)
|
||||
private static void AddComments(MapElement e, Dictionary<string, CommentInfo> comments)
|
||||
{
|
||||
if(e.Fields.ContainsKey("comment"))
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ namespace CodeImp.DoomBuilder.CommentsPanel
|
|||
}
|
||||
|
||||
// This changes the view to see the objects of a comment
|
||||
private void ViewComment(CommentInfo c)
|
||||
private static void ViewComment(CommentInfo c)
|
||||
{
|
||||
List<Vector2D> points = new List<Vector2D>();
|
||||
RectangleF area = MapSet.CreateEmptyArea();
|
||||
|
@ -293,7 +293,7 @@ namespace CodeImp.DoomBuilder.CommentsPanel
|
|||
}
|
||||
|
||||
// This selects the elements in a comment
|
||||
private void SelectComment(CommentInfo c, bool clear)
|
||||
private static void SelectComment(CommentInfo c, bool clear)
|
||||
{
|
||||
//string editmode = "";
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ namespace CodeImp.DoomBuilder.Plugins.NodesViewer
|
|||
/// <summary>
|
||||
/// Crop a polygon by a split line
|
||||
/// </summary>
|
||||
private void CropPolygon(List<Vector2D> poly, Split split)
|
||||
private static void CropPolygon(List<Vector2D> poly, Split split)
|
||||
{
|
||||
if(poly.Count == 0) return;
|
||||
Vector2D prev = poly[poly.Count - 1];
|
||||
|
|
|
@ -466,7 +466,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
|
|||
filteredAction = readNumber(serachStr, pos+1);
|
||||
}
|
||||
|
||||
private int readNumber(string serachStr, int startPoition) {
|
||||
private static int readNumber(string serachStr, int startPoition) {
|
||||
string token = "";
|
||||
int pos = startPoition;
|
||||
|
||||
|
@ -494,7 +494,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
|
|||
nodes.Sort(sortByIndex);
|
||||
}
|
||||
|
||||
private int sortByAction(TreeNode t1, TreeNode t2) {
|
||||
private static int sortByAction(TreeNode t1, TreeNode t2) {
|
||||
NodeInfo i1 = t1.Tag as NodeInfo;
|
||||
NodeInfo i2 = t2.Tag as NodeInfo;
|
||||
|
||||
|
@ -505,7 +505,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
|
|||
return -1; //should be i1 < i2
|
||||
}
|
||||
|
||||
private int sortByTag(TreeNode t1, TreeNode t2) {
|
||||
private static int sortByTag(TreeNode t1, TreeNode t2) {
|
||||
NodeInfo i1 = t1.Tag as NodeInfo;
|
||||
NodeInfo i2 = t2.Tag as NodeInfo;
|
||||
|
||||
|
@ -516,7 +516,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
|
|||
return -1; //should be i1 < i2
|
||||
}
|
||||
|
||||
private int sortByIndex(TreeNode t1, TreeNode t2) {
|
||||
private static int sortByIndex(TreeNode t1, TreeNode t2) {
|
||||
NodeInfo i1 = t1.Tag as NodeInfo;
|
||||
NodeInfo i2 = t2.Tag as NodeInfo;
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
|
|||
return combineName(comment.Length == 0 ? defaultName : comment, t.Tag, t.Action, t.Index, sortMode, isDefaultName);
|
||||
}
|
||||
|
||||
private string getSectorName(Sector s, ref string comment, string sortMode) {
|
||||
private static string getSectorName(Sector s, ref string comment, string sortMode) {
|
||||
bool isDefaultName = true;
|
||||
comment = "";
|
||||
if (TagExplorer.UDMF && s.Fields.ContainsKey("comment")) {
|
||||
|
@ -131,7 +131,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
|
|||
return combineName(comment.Length == 0 ? NodeInfoDefaultName.SECTOR : comment, s.Tag, s.Effect, s.Index, sortMode, isDefaultName);
|
||||
}
|
||||
|
||||
private string getLinedefName(Linedef l, ref string comment, string sortMode) {
|
||||
private static string getLinedefName(Linedef l, ref string comment, string sortMode) {
|
||||
bool isDefaultName = true;
|
||||
comment = "";
|
||||
if (TagExplorer.UDMF && l.Fields.ContainsKey("comment")) {
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace CodeImp.DoomBuilder.TagRange
|
|||
}
|
||||
|
||||
// Handler for finding a new tag
|
||||
private void TagHandler(MapElement element, bool actionargument, UniversalType type, ref int value, Dictionary<int, bool> usedtags)
|
||||
private static void TagHandler(MapElement element, bool actionargument, UniversalType type, ref int value, Dictionary<int, bool> usedtags)
|
||||
{
|
||||
usedtags[value] = true;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
|
|||
}
|
||||
|
||||
// This returns the tile position for the given map coordinate
|
||||
private Point TileForPoint(float x, float y)
|
||||
private static Point TileForPoint(float x, float y)
|
||||
{
|
||||
return new Point((int)Math.Floor(x / Tile.TILE_SIZE) * Tile.TILE_SIZE, (int)Math.Floor(y / Tile.TILE_SIZE) * Tile.TILE_SIZE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue