Improved "make door" functionality. It now actually creates usable doors in Hexen and UDMF maps.

This commit is contained in:
boris_i 2012-04-14 12:22:19 +00:00
parent 3ab5c83f3b
commit f5c8ce9466
12 changed files with 149 additions and 64 deletions

View file

@ -43,11 +43,13 @@ upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 11; // See linedeftypes
makedoorarg0= -1; // -1 can be used for a new sector tag here
makedoortrack = "D_END2";
makedooraction = 12; // See linedeftypes
makedooractivate = 1024; // See linedefactivations
makedoorflags = "512"; // see linedefflags, as string, CSV
makedoorarg0 = 0;
makedoorarg1 = 16;
makedoorarg2 = 0;
makedoorarg2 = 150;
makedoorarg3 = 0;
makedoorarg4 = 0;

View file

@ -46,13 +46,16 @@ lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedooraction = 12; // See linedeftypes
makedooractivate = 1024; // See linedefactivations
makedoorflags = { 512; } // see linedefflags, as string, CSV
makedoorarg0 = 0;
makedoorarg1 = 16;
makedoorarg2 = 0;
makedoorarg3 = 3;
makedoorarg2 = 150;
makedoorarg3 = 0;
makedoorarg4 = 0;
// Generalized actions
generalizedlinedefs = false;
generalizedsectors = false;

View file

@ -46,11 +46,13 @@ lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedooraction = 12; // See linedeftypes
makedooractivate = 1024; // See linedefactivations
makedoorflags { 512; } // see linedefflags
makedoorarg0 = 0;
makedoorarg1 = 16;
makedoorarg2 = 0;
makedoorarg3 = 3;
makedoorarg2 = 150;
makedoorarg3 = 0;
makedoorarg4 = 0;
// Generalized actions

View file

@ -47,11 +47,12 @@ lowerunpeggedflag = "dontpegbottom";
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedooraction = 12; // See linedeftypes
makedoorflags { repeatspecial; playeruse; monsteractivate; } // see linedefflags
makedoorarg0 = 0;
makedoorarg1 = 16;
makedoorarg2 = 0;
makedoorarg3 = 3;
makedoorarg2 = 150;
makedoorarg3 = 0;
makedoorarg4 = 0;
// Generalized actions

View file

@ -45,14 +45,17 @@ upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedoortrack = "METL2";
makedooraction = 12; // See linedeftypes
makedooractivate = 1024; // See linedefactivations
makedoorflags = { 512; } // see linedefflags
makedoorarg0 = 0;
makedoorarg1 = 16;
makedoorarg2 = 0;
makedoorarg3 = 3;
makedoorarg2 = 150;
makedoorarg3 = 0;
makedoorarg4 = 0;
// Generalized actions
generalizedlinedefs = false;
generalizedsectors = true;

View file

@ -45,11 +45,13 @@ upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 11; // See linedeftypes
makedoorarg0 = -1; // -1 can be used for a new sector tag here
makedoortrack = "D_END2";
makedooraction = 12; // See linedeftypes
makedooractivate = 1024; // See linedefactivations
makedoorflags = { 512; } // see linedefflags
makedoorarg0 = 0;
makedoorarg1 = 16;
makedoorarg2 = 0;
makedoorarg2 = 150;
makedoorarg3 = 0;
makedoorarg4 = 0;

View file

@ -46,11 +46,13 @@ lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedooraction = 12; // See linedeftypes
makedooractivate = 1024; // See linedefactivations
makedoorflags { 512; } // see linedefflags
makedoorarg0 = 0;
makedoorarg1 = 16;
makedoorarg2 = 0;
makedoorarg3 = 3;
makedoorarg2 = 150;
makedoorarg3 = 0;
makedoorarg4 = 0;
// Generalized actions

View file

@ -68,7 +68,9 @@ namespace CodeImp.DoomBuilder.Config
private bool testshortpaths;
private string makedoortrack;
private int makedooraction;
private int makedooractivate;
private int[] makedoorargs;
private Dictionary<string, bool> makedoorflags;
private bool linetagindicatesectors;
private string decorategames;
private string skyflatname;
@ -158,6 +160,8 @@ namespace CodeImp.DoomBuilder.Config
public bool TestShortPaths { get { return testshortpaths; } }
public string MakeDoorTrack { get { return makedoortrack; } }
public int MakeDoorAction { get { return makedooraction; } }
public int MakeDoorActivate { get { return makedooractivate; } }
public Dictionary<string, bool> MakeDoorFlags { get { return makedoorflags; } }
public int[] MakeDoorArgs { get { return makedoorargs; } }
public bool LineTagIndicatesSectors { get { return linetagindicatesectors ; } }
public string DecorateGames { get { return decorategames; } }
@ -252,6 +256,7 @@ namespace CodeImp.DoomBuilder.Config
this.linedefflagstranslation = new List<FlagTranslation>();
this.thingfilters = new List<ThingsFilter>();
this.brightnesslevels = new StepsList();
this.makedoorflags = new Dictionary<string, bool>();
// Read general settings
configname = cfg.ReadSetting("game", "<unnamed game>");
@ -271,6 +276,7 @@ namespace CodeImp.DoomBuilder.Config
testshortpaths = cfg.ReadSetting("testshortpaths", false);
makedoortrack = cfg.ReadSetting("makedoortrack", "-");
makedooraction = cfg.ReadSetting("makedooraction", 0);
makedooractivate = cfg.ReadSetting("makedooractivate", 0);
linetagindicatesectors = cfg.ReadSetting("linetagindicatesectors", false);
decorategames = cfg.ReadSetting("decorategames", "");
skyflatname = cfg.ReadSetting("skyflatname", "F_SKY1");
@ -281,7 +287,7 @@ namespace CodeImp.DoomBuilder.Config
bottomboundary = cfg.ReadSetting("bottomboundary", -32768);
doomlightlevels = cfg.ReadSetting("doomlightlevels", true);
for(int i = 0; i < Linedef.NUM_ARGS; i++) makedoorargs[i] = cfg.ReadSetting("makedoorarg" + i.ToString(CultureInfo.InvariantCulture), 0);
// Flags have special (invariant culture) conversion
// because they are allowed to be written as integers in the configs
obj = cfg.ReadSettingObject("soundlinedefflag", 0);
@ -342,6 +348,9 @@ namespace CodeImp.DoomBuilder.Config
// Defaults
LoadTextureSets();
LoadThingFilters();
// Make door flags
LoadMakeDoorFlags();
}
// Destructor
@ -764,6 +773,26 @@ namespace CodeImp.DoomBuilder.Config
thingfilters.Add(f);
}
}
// Make door flags
private void LoadMakeDoorFlags()
{
IDictionary dic;
dic = cfg.ReadSetting("makedoorflags", new Hashtable());
foreach (DictionaryEntry de in dic)
{
// Using minus will unset the flag
if (de.Key.ToString()[0] == '-')
{
makedoorflags[de.Key.ToString().TrimStart('-')] = false;
}
else
{
makedoorflags[de.Key.ToString()] = true;
}
}
}
#endregion

View file

@ -953,8 +953,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(orderedselection.Count > 0)
{
string doortex = "";
string tracktex = General.Map.Config.MakeDoorTrack;
string floortex = null;
string ceiltex = null;
bool resetoffsets = true;
// Find ceiling and floor textures
foreach(Sector s in orderedselection)
@ -965,11 +967,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Show the dialog
MakeDoorForm form = new MakeDoorForm();
if(form.Show(General.Interface, doortex, ceiltex, floortex) == DialogResult.OK)
if(form.Show(General.Interface, doortex, tracktex, ceiltex, floortex, resetoffsets) == DialogResult.OK)
{
doortex = form.DoorTexture;
tracktex = form.TrackTexture;
ceiltex = form.CeilingTexture;
floortex = form.FloorTexture;
resetoffsets = form.ResetOffsets;
// Create undo
General.Map.UndoRedo.CreateUndo("Make door (" + doortex + ")");
@ -992,7 +996,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// Make this a doortrak
sd.SetTextureHigh("-");
sd.SetTextureMid(General.Map.Config.MakeDoorTrack);
sd.SetTextureMid(tracktex);
sd.SetTextureLow("-");
// Set upper/lower unpegged flags
@ -1013,6 +1017,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get door linedef type from config
sd.Line.Action = General.Map.Config.MakeDoorAction;
// Set activation type
sd.Line.Activate = General.Map.Config.MakeDoorActivate;
// Set the flags
foreach(var flagpair in General.Map.Config.MakeDoorFlags)
sd.Line.SetFlag(flagpair.Key, flagpair.Value);
// Set the linedef args
for(int i = 0; i < Linedef.NUM_ARGS; i++)
{
@ -1037,6 +1048,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
sd.Line.FlipSidedefs();
}
}
// Reset the texture offsets if required
if (resetoffsets)
{
sd.OffsetX = 0;
sd.OffsetY = 0;
if (sd.Other != null)
{
sd.Other.OffsetX = 0;
sd.Other.OffsetY = 0;
}
}
}
}

View file

@ -36,11 +36,14 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
this.label3 = new System.Windows.Forms.Label();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
this.resetoffsets = new System.Windows.Forms.CheckBox();
this.tracktexture = new CodeImp.DoomBuilder.Controls.TextureSelectorControl();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// doortexture
//
this.doortexture.Location = new System.Drawing.Point(22, 34);
this.doortexture.Location = new System.Drawing.Point(21, 34);
this.doortexture.Name = "doortexture";
this.doortexture.Required = false;
this.doortexture.Size = new System.Drawing.Size(96, 115);
@ -49,7 +52,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
//
// label1
//
this.label1.Location = new System.Drawing.Point(22, 15);
this.label1.Location = new System.Drawing.Point(21, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(96, 21);
this.label1.TabIndex = 1;
@ -58,7 +61,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
//
// label2
//
this.label2.Location = new System.Drawing.Point(132, 15);
this.label2.Location = new System.Drawing.Point(247, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(99, 21);
this.label2.TabIndex = 2;
@ -67,7 +70,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
//
// ceilingtexture
//
this.ceilingtexture.Location = new System.Drawing.Point(135, 34);
this.ceilingtexture.Location = new System.Drawing.Point(247, 34);
this.ceilingtexture.Name = "ceilingtexture";
this.ceilingtexture.Size = new System.Drawing.Size(96, 115);
this.ceilingtexture.TabIndex = 1;
@ -75,7 +78,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
//
// floortexture
//
this.floortexture.Location = new System.Drawing.Point(248, 34);
this.floortexture.Location = new System.Drawing.Point(360, 34);
this.floortexture.Name = "floortexture";
this.floortexture.Size = new System.Drawing.Size(96, 115);
this.floortexture.TabIndex = 2;
@ -83,7 +86,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
//
// label3
//
this.label3.Location = new System.Drawing.Point(245, 15);
this.label3.Location = new System.Drawing.Point(360, 15);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(99, 21);
this.label3.TabIndex = 4;
@ -94,7 +97,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(187, 180);
this.cancel.Location = new System.Drawing.Point(243, 180);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 4;
@ -105,7 +108,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
// apply
//
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.apply.Location = new System.Drawing.Point(69, 180);
this.apply.Location = new System.Drawing.Point(125, 180);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 3;
@ -113,13 +116,46 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
this.apply.UseVisualStyleBackColor = true;
this.apply.Click += new System.EventHandler(this.apply_Click);
//
// resetoffsets
//
this.resetoffsets.AutoSize = true;
this.resetoffsets.Checked = true;
this.resetoffsets.CheckState = System.Windows.Forms.CheckState.Checked;
this.resetoffsets.Location = new System.Drawing.Point(21, 156);
this.resetoffsets.Name = "resetoffsets";
this.resetoffsets.Size = new System.Drawing.Size(129, 18);
this.resetoffsets.TabIndex = 5;
this.resetoffsets.Text = "Reset texture offsets";
this.resetoffsets.UseVisualStyleBackColor = true;
//
// tracktexture
//
this.tracktexture.Location = new System.Drawing.Point(134, 34);
this.tracktexture.Name = "tracktexture";
this.tracktexture.Required = false;
this.tracktexture.Size = new System.Drawing.Size(96, 115);
this.tracktexture.TabIndex = 6;
this.tracktexture.TextureName = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(134, 15);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(96, 21);
this.label4.TabIndex = 7;
this.label4.Text = "Track";
this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// MakeDoorForm
//
this.AcceptButton = this.apply;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(368, 219);
this.ClientSize = new System.Drawing.Size(481, 219);
this.Controls.Add(this.tracktexture);
this.Controls.Add(this.label4);
this.Controls.Add(this.resetoffsets);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
this.Controls.Add(this.floortexture);
@ -139,6 +175,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
this.Text = "Make Door";
this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.MakeDoorForm_HelpRequested);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -152,5 +189,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.Button apply;
private System.Windows.Forms.CheckBox resetoffsets;
private CodeImp.DoomBuilder.Controls.TextureSelectorControl tracktexture;
private System.Windows.Forms.Label label4;
}
}

View file

@ -42,8 +42,10 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
#region ================== Properties
public string DoorTexture { get { return doortexture.TextureName; } }
public string TrackTexture { get { return tracktexture.TextureName; } }
public string CeilingTexture { get { return ceilingtexture.TextureName; } }
public string FloorTexture { get { return floortexture.TextureName; } }
public bool ResetOffsets { get { return resetoffsets.Checked; } }
#endregion
@ -56,11 +58,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
}
// This sets the properties and shows the form
public DialogResult Show(IWin32Window owner, string doortex, string ceilingtex, string floortex)
public DialogResult Show(IWin32Window owner, string doortex, string tracktex, string ceilingtex, string floortex, bool roffsets)
{
this.doortexture.TextureName = doortex;
this.tracktexture.TextureName = tracktex;
this.ceilingtexture.TextureName = ceilingtex;
this.floortexture.TextureName = floortex;
this.resetoffsets.Checked = roffsets;
return this.ShowDialog(owner);
}

View file

@ -117,31 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="doortexture.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ceilingtexture.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="floortexture.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>