Game Configurations: added support for new property "fixedrotation", which keeps thing's angle constant when a thing is rotated in Edit Selection mode.

Game Configurations: added "fixedrotation" property to "Polyobject Anchor" (9300), "Polyobject Start Spot" (9301), "Polyobject Start Spot (crush)" (9302) and "Polyobject Start Spot (hurts to touch)" (9303) actors.
Color Picker plugin: moved plugin button to "Modes" toolbar group.
API: added ToolbarSection.Modes property, which can be used in MainForm.AddButton() to add a button to Modes group.
Removed a bunch of unused variables.
This commit is contained in:
MaxED 2014-02-20 12:36:09 +00:00
parent c04a2e7c11
commit d9e53f2899
17 changed files with 91 additions and 61 deletions

View file

@ -1501,9 +1501,20 @@ other
width = 32;
fixedsize = false;
}
3000 = "Polyobject Anchor";
3001 = "Polyobject Start Spot";
3002 = "Polyobject Start Spot (crush)";
3000
{
title = "Polyobject Anchor";
fixedrotation = true;
}
3001{
title = "Polyobject Start Spot";
fixedrotation = true;
}
3002
{
title = "Polyobject Start Spot (crush)";
fixedrotation = true;
}
10225
{
title = "Spawn Bat";

View file

@ -750,14 +750,14 @@ zdoom
}
9040 = "Map Marker";
9045
{
title = "Deep Water";
sprite = "internal:DeepWater";
}
{
title = "Deep Water";
sprite = "internal:DeepWater";
}
9046
{
title = "Secret";
sprite = "internal:Secret";
sprite = "internal:Secret";
arg0
{
title = "Mode";
@ -772,27 +772,42 @@ zdoom
}
}
9300
{
title = "Polyobject Anchor";
sprite = "internal:anchor";
}
9301 = "Polyobject Start Spot";
9302 = "Polyobject Start Spot (crush)";
9303 = "Polyobject Spawn(Hurts to touch)";
{
title = "Polyobject Anchor";
sprite = "internal:anchor";
fixedrotation = true;
}
9301{
title = "Polyobject Start Spot";
sprite = "internal:anchor";
fixedrotation = true;
}
9302
{
title = "Polyobject Start Spot (crush)";
sprite = "internal:anchor";
fixedrotation = true;
}
9303
{
title = "Polyobject Start Spot (hurts to touch)";
sprite = "internal:anchor";
fixedrotation = true;
}
9001
{
title = "Map Spot";
sprite = "internal:MapSpot";
}
{
title = "Map Spot";
sprite = "internal:MapSpot";
}
9013
{
title = "Map Spot (gravity)";
sprite = "internal:MapSpotGravity";
}
{
title = "Map Spot (gravity)";
sprite = "internal:MapSpotGravity";
}
9076
{
title = "Hate target";
sprite = "internal:Target";
title = "Hate target";
sprite = "internal:Target";
}
9988
{

View file

@ -52,11 +52,12 @@ namespace CodeImp.DoomBuilder.Config
private int blocking;
private int errorcheck;
private bool fixedsize;
private bool fixedrotation; //mxd
private bool absolutez;
private float spritescale;
// Disposing
private bool isdisposed = false;
private bool isdisposed;
#endregion
@ -74,6 +75,7 @@ namespace CodeImp.DoomBuilder.Config
public int Blocking { get { return blocking; } }
public int ErrorCheck { get { return errorcheck; } }
public bool FixedSize { get { return fixedsize; } }
public bool FixedRotation { get { return fixedrotation; } } //mxd
public bool IsDisposed { get { return isdisposed; } }
public bool AbsoluteZ { get { return absolutez; } }
public float SpriteScale { get { return spritescale; } }
@ -102,6 +104,7 @@ namespace CodeImp.DoomBuilder.Config
this.blocking = 0;
this.errorcheck = 1;
this.fixedsize = false;
this.fixedrotation = false; //mxd
this.absolutez = false;
this.spritescale = 1.0f;
@ -131,6 +134,7 @@ namespace CodeImp.DoomBuilder.Config
this.blocking = cfg.ReadSetting("thingtypes." + name + ".blocking", 0);
this.errorcheck = cfg.ReadSetting("thingtypes." + name + ".error", 1);
this.fixedsize = cfg.ReadSetting("thingtypes." + name + ".fixedsize", false);
this.fixedrotation = cfg.ReadSetting("thingtypes." + name + ".fixedrotation", false); //mxd
this.absolutez = cfg.ReadSetting("thingtypes." + name + ".absolutez", false);
this.spritescale = cfg.ReadSetting("thingtypes." + name + ".spritescale", 1.0f);

View file

@ -58,6 +58,7 @@ namespace CodeImp.DoomBuilder.Config
private int blocking;
private int errorcheck;
private bool fixedsize;
private bool fixedrotation; //mxd
private ThingCategory category;
private ArgumentInfo[] args;
private bool isknown;
@ -84,6 +85,7 @@ namespace CodeImp.DoomBuilder.Config
public int Blocking { get { return blocking; } }
public int ErrorCheck { get { return errorcheck; } }
public bool FixedSize { get { return fixedsize; } }
public bool FixedRotation { get { return fixedrotation; } } //mxd
public ThingCategory Category { get { return category; } }
public ArgumentInfo[] Args { get { return args; } }
public bool IsKnown { get { return isknown; } }
@ -116,6 +118,7 @@ namespace CodeImp.DoomBuilder.Config
this.errorcheck = 0;
this.spritescale = new SizeF(1.0f, 1.0f);
this.fixedsize = false;
this.fixedrotation = false; //mxd
this.spritelongname = long.MaxValue;
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
this.isknown = false;
@ -148,6 +151,7 @@ namespace CodeImp.DoomBuilder.Config
this.blocking = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".blocking", cat.Blocking);
this.errorcheck = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".error", cat.ErrorCheck);
this.fixedsize = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".fixedsize", cat.FixedSize);
this.fixedrotation = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".fixedrotation", cat.FixedRotation); //mxd
this.absolutez = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".absolutez", cat.AbsoluteZ);
float sscale = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".spritescale", cat.SpriteScale);
this.spritescale = new SizeF(sscale, sscale);
@ -178,7 +182,7 @@ namespace CodeImp.DoomBuilder.Config
// Constructor
public ThingTypeInfo(ThingCategory cat, int index, string title)
{
string key = index.ToString(CultureInfo.InvariantCulture);
//string key = index.ToString(CultureInfo.InvariantCulture);
// Initialize
this.index = index;
@ -199,6 +203,7 @@ namespace CodeImp.DoomBuilder.Config
this.blocking = cat.Blocking;
this.errorcheck = cat.ErrorCheck;
this.fixedsize = cat.FixedSize;
this.fixedrotation = cat.FixedRotation; //mxd
this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
@ -237,6 +242,7 @@ namespace CodeImp.DoomBuilder.Config
this.blocking = cat.Blocking;
this.errorcheck = cat.ErrorCheck;
this.fixedsize = cat.FixedSize;
this.fixedrotation = cat.FixedRotation; //mxd
this.absolutez = cat.AbsoluteZ;
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);

View file

@ -1941,9 +1941,9 @@ namespace CodeImp.DoomBuilder
// This returns the short path name for a file
public static string GetShortFilePath(string longpath)
{
int maxlen = 256;
const int maxlen = 256;
StringBuilder shortname = new StringBuilder(maxlen);
uint len = GetShortPathName(longpath, shortname, (uint)maxlen);
GetShortPathName(longpath, shortname, maxlen);
return shortname.ToString();
}

View file

@ -1650,6 +1650,7 @@ namespace CodeImp.DoomBuilder.Windows
case ToolbarSection.Views: toolbar.Items.Insert(toolbar.Items.IndexOf(seperatorviews), button); break;
case ToolbarSection.Geometry: toolbar.Items.Insert(toolbar.Items.IndexOf(seperatorgeometry), button); break;
case ToolbarSection.Testing: toolbar.Items.Insert(toolbar.Items.IndexOf(seperatortesting), button); break;
case ToolbarSection.Modes: toolbar.Items.Insert(toolbar.Items.IndexOf(seperatormodes), button); break; //mxd
case ToolbarSection.Custom: toolbar.Items.Add(button); break;
}

View file

@ -31,6 +31,7 @@ namespace CodeImp.DoomBuilder.Windows
Views,
Geometry,
Testing,
Custom
Custom,
Modes //mxd
}
}

View file

@ -292,7 +292,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
}
private void applyCeilingHeightJitter(int ammount) {
Random rnd = new Random();
int curAmmount;
if(relativeCeilingHeight) {
@ -318,7 +317,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
}
private void applyFloorHeightJitter(int ammount) {
Random rnd = new Random();
int curAmmount;
if(relativeFloorHeight) {

View file

@ -107,8 +107,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//utility
private void applyTranslationJitter(int ammount) {
Random rndX = new Random();
Random rndY = new Random();
int curAmmount;
if(relativePosition) {
@ -129,8 +127,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
}
private void applyRotationJitter(int ammount) {
Random rnd = new Random();
for(int i = 0; i < selection.Count; i++)
selection[i].Rotate((int)((thingData[i].Angle + ammount * thingData[i].JitterRotation) % 360));

View file

@ -98,6 +98,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Selection
private ICollection<Vertex> selectedvertices;
private ICollection<Thing> selectedthings;
private List<int> fixedrotationthingtypes; //mxd
private ICollection<Linedef> selectedlines;
private List<Vector2D> vertexpos;
private List<Vector2D> thingpos;
@ -770,7 +771,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
index = 0;
foreach(Thing t in selectedthings)
{
t.Rotate(Angle2D.Normalized(newthingangle[index++]));
if(!fixedrotationthingtypes.Contains(t.Type)) //mxd. Polyobject Anchors, I hate you!
t.Rotate(Angle2D.Normalized(newthingangle[index++]));
}
UpdatePanel();
@ -927,6 +929,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
vertexpos = new List<Vector2D>(selectedvertices.Count);
thingpos = new List<Vector2D>(selectedthings.Count);
thingangle = new List<float>(selectedthings.Count);
fixedrotationthingtypes = new List<int>(); //mxd
// A selection must be made!
if((selectedvertices.Count > 0) || (selectedthings.Count > 0))
@ -958,6 +961,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
if((t.Position.x + t.Size) > right.x) right.x = t.Position.x + t.Size;
if((t.Position.y + t.Size) > right.y) right.y = t.Position.y + t.Size;
//mxd
if (!fixedrotationthingtypes.Contains(t.Type)) {
ThingTypeInfo tti = General.Map.Data.GetThingInfoEx(t.Type);
if (tti != null && tti.FixedRotation) fixedrotationthingtypes.Add(t.Type);
}
// Keep original coordinates
thingpos.Add(t.Position);
thingangle.Add(t.Angle);

View file

@ -857,7 +857,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(v.Linedefs.Count == 2) {
Linedef ld1 = General.GetByIndex(v.Linedefs, 0);
Linedef ld2 = General.GetByIndex(v.Linedefs, 1);
Vertex v1 = (ld1.Start == v) ? ld1.End : ld1.Start;
//Vertex v1 = (ld1.Start == v) ? ld1.End : ld1.Start;
Vertex v2 = (ld2.Start == v) ? ld2.End : ld2.Start;
if(ld1.Start == v) ld1.SetStartVertex(v2); else ld1.SetEndVertex(v2);
ld2.Dispose();

View file

@ -162,7 +162,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Perform the search / replace and show the results
if(doreplace.Checked)
{
int ticket = General.Map.UndoRedo.CreateUndo("Replace " + searchtypes.SelectedItem);
General.Map.UndoRedo.CreateUndo("Replace " + searchtypes.SelectedItem);
resultslist.Items.AddRange(finder.Find(findinput.Text, withinselection.Checked, replaceinput.Text, false));
resultscount.Text = resultslist.Items.Count + " items found and replaced.";

View file

@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
levels.Reverse();
int numundos = levels.Count;
levels.AddRange(General.Map.UndoRedo.GetRedoList());
int numredos = levels.Count - numundos;
//int numredos = levels.Count - numundos;
// Determine the offset to show items at
int offset = numundos - (MAX_DISPLAY_LEVELS >> 1);

View file

@ -301,7 +301,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
protected void alignTextureToSlopeLine(Linedef slopeSource, float slopeAngle, bool isFront, bool alignx, bool aligny) {
Vector2D hitpos = mode.GetHitPosition();
bool isFloor = (geoType == VisualGeometryType.FLOOR);
Sector.Sector.Fields.BeforeFieldsChange();

View file

@ -302,16 +302,14 @@ namespace CodeImp.DoomBuilder.ColorPicker {
// brightness.
CreateGradient();
using (Brush selectedBrush = new SolidBrush(selectedColor)) {
// Draw the saved color wheel image.
g.DrawImage(colorImage, colorRectangle);
// Draw the saved color wheel image.
g.DrawImage(colorImage, colorRectangle);
// Draw the "brightness" rectangle.
DrawLinearGradient(fullColor);
// Draw the two pointers.
DrawColorPointer(colorPoint);
DrawBrightnessPointer(brightnessPoint);
}
// Draw the "brightness" rectangle.
DrawLinearGradient(fullColor);
// Draw the two pointers.
DrawColorPointer(colorPoint);
DrawBrightnessPointer(brightnessPoint);
}
private void CalcCoordsAndUpdate(ColorHandler.HSV HSV) {

View file

@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder;
using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.ColorPicker
{
@ -15,9 +9,7 @@ namespace CodeImp.DoomBuilder.ColorPicker
public ToolsForm() {
InitializeComponent();
General.Interface.AddButton(separator1);
General.Interface.AddButton(cpButton);
General.Interface.AddButton(separator2);
General.Interface.AddButton(cpButton, ToolbarSection.Modes);
}
private void InvokeTaggedAction(object sender, EventArgs e) {

View file

@ -145,7 +145,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
private void ProcessingThread(object index)
{
// Get function pointers
VPO_GetError GetError = (VPO_GetError)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_GetError"), typeof(VPO_GetError));
//VPO_GetError GetError = (VPO_GetError)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_GetError"), typeof(VPO_GetError));
VPO_LoadWAD LoadWAD = (VPO_LoadWAD)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_LoadWAD"), typeof(VPO_LoadWAD));
VPO_OpenMap OpenMap = (VPO_OpenMap)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_OpenMap"), typeof(VPO_OpenMap));
VPO_FreeWAD FreeWAD = (VPO_FreeWAD)Marshal.GetDelegateForFunctionPointer(GetProcAddress(dlls[(int)index], "VPO_FreeWAD"), typeof(VPO_FreeWAD));