make door feature added

This commit is contained in:
codeimp 2008-10-17 09:39:07 +00:00
parent 7e664d1ba9
commit 38f1cb6c3a
29 changed files with 321 additions and 10 deletions

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = true;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = true;

View file

@ -35,6 +35,17 @@ soundlinedefflag = "blocksound";
singlesidedflag = "blocking";
doublesidedflag = "twosided";
impassableflag = "blocking";
upperunpeggedflag = "dontpegtop";
lowerunpeggedflag = "dontpegbottom";
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedoorarg1 = 0;
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 3;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = true;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,17 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 11; // See linedeftypes
makedoorarg1 = -1; // -1 can be used for a new sector tag here
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 0;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = true;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = true;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = true;

View file

@ -35,6 +35,17 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedoorarg1 = 0;
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 3;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = true;

View file

@ -36,6 +36,17 @@ soundlinedefflag = 64;
singlesidedflag = 1;
doublesidedflag = 4;
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedoorarg1 = 0;
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 3;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = false;

View file

@ -36,6 +36,17 @@ soundlinedefflag = "blocksound";
singlesidedflag = "blocking";
doublesidedflag = "twosided";
impassableflag = "blocking";
upperunpeggedflag = "dontpegtop";
lowerunpeggedflag = "dontpegbottom";
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedoorarg1 = 0;
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 3;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,17 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedoorarg1 = 0;
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 3;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,17 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 11; // See linedeftypes
makedoorarg1 = -1; // -1 can be used for a new sector tag here
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 0;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,17 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 202; // See linedeftypes
makedoorarg1 = 0;
makedoorarg2 = 16;
makedoorarg3 = 0;
makedoorarg4 = 3;
makedoorarg5 = 0;
// Generalized actions
generalizedlinedefs = false;

View file

@ -35,6 +35,12 @@ soundlinedefflag = 64; // See linedefflags
singlesidedflag = 1; // See linedefflags
doublesidedflag = 4; // See linedefflags
impassableflag = 1;
upperunpeggedflag = 8;
lowerunpeggedflag = 16;
// Door making
makedoortrack = "DOORTRAK";
makedooraction = 1; // See linedeftypes
// Generalized actions
generalizedlinedefs = false;

View file

@ -69,15 +69,7 @@ You could have ctrl groups in sectors, lines, vertices and even things mode.
===========================================================================================
Extend the background image feature so that images can be loaded from file. Also scalable and movable. This would allow the mapper to use a hand-drawn image as guidline for mapping.
===========================================================================================
Map statistics plugin
- Button on toolbar for stats window (stats also shown in text format for copy/paste)
- Command-line processing that saves text stats to file
===========================================================================================
A "Make Door" editing mode which allows you to quicly insert a door. On mousemove, show the door being made. Find the nearest line, then project two line along the normal of the nearest line. These will be the door lines. Find where they intersect another line. Then find the lines in between the two new lines that make up the doortrak. In between the two new lines, there may not be another line going from one doortrak to the other (or the door will fail).

View file

@ -450,6 +450,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// When a single sector was selected, deselect it now
if(selected.Count == 1)
{
orderedselection.Clear();
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs();
}
@ -686,6 +687,103 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
[BeginAction("makedoor")]
public void MakeDoor()
{
// Highlighted item not selected?
if(!highlighted.Selected)
{
if(highlighted != null)
{
// Make this the only selection
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs();
SelectSector(highlighted, true);
General.Interface.RedrawDisplay();
}
}
// Anything selected?
if(orderedselection.Count > 0)
{
// Select a texture for the door
string texture = General.Interface.BrowseTexture(General.Interface, "");
// Go for all selected sectors
foreach(Sector s in orderedselection)
{
// Lower the ceiling down to the floor
s.CeilHeight = s.FloorHeight;
// Make a unique tag (not sure if we need it yet, depends on the args)
int tag = General.Map.Map.GetNewTag();
// Go for all it's sidedefs
foreach(Sidedef sd in s.Sidedefs)
{
// Singlesided?
if(sd.Other == null)
{
// Make this a doortrak
sd.SetTextureHigh("-");
sd.SetTextureMid(General.Map.Config.MakeDoorTrack);
sd.SetTextureLow("-");
// Set upper/lower unpegged flags
sd.Line.Flags[General.Map.Config.UpperUnpeggedFlag] = false;
sd.Line.Flags[General.Map.Config.LowerUnpeggedFlag] = true;
}
else
{
// Set texture
if(texture.Length > 0)
{
if(sd.IsFront)
sd.SetTextureHigh(texture);
else
sd.Other.SetTextureHigh(texture);
}
// Get door linedef type from config
sd.Line.Action = General.Map.Config.MakeDoorAction;
// Set the linedef args
for(int i = 0; i < Linedef.NUM_ARGS; i++)
{
// A -1 arg indicates that the arg must be set to the new sector tag
// and only in this case we set the tag on the sector, because only
// then we know for sure that we need a tag.
if(General.Map.Config.MakeDoorArgs[i] == -1)
{
sd.Line.Args[i] = tag;
s.Tag = tag;
}
else
{
sd.Line.Args[i] = General.Map.Config.MakeDoorArgs[i];
}
}
// Make sure the line is facing outwards
if(sd.IsFront)
{
sd.Line.FlipVertices();
sd.Line.FlipSidedefs();
}
}
}
}
// When a single sector was selected, deselect it now
if(orderedselection.Count == 1)
{
orderedselection.Clear();
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs();
}
}
}
[BeginAction("deleteitem", BaseAction = true)]
public void DeleteItem()
{

View file

@ -247,3 +247,13 @@ gradientbrightness
allowmouse = true;
allowscroll = true;
}
makedoor
{
title = "Make Door";
category = "sectors";
description = "Creates doors from the highlighted or selected sectors.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
}

View file

@ -26,6 +26,7 @@ using CodeImp.DoomBuilder.Data;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
#endregion
@ -52,12 +53,17 @@ namespace CodeImp.DoomBuilder.Config
private string singlesidedflag;
private string doublesidedflag;
private string impassableflag;
private string upperunpeggedflag;
private string lowerunpeggedflag;
private bool mixtexturesflats;
private bool generalizedactions;
private bool generalizedeffects;
private int start3dmodethingtype;
private int linedefactivationsfilter;
private string testparameters;
private string makedoortrack;
private int makedooraction;
private int[] makedoorargs;
// Skills
private List<SkillInfo> skills;
@ -115,12 +121,17 @@ namespace CodeImp.DoomBuilder.Config
public string SingleSidedFlag { get { return singlesidedflag; } }
public string DoubleSidedFlag { get { return doublesidedflag; } }
public string ImpassableFlag { get { return impassableflag; } }
public string UpperUnpeggedFlag { get { return upperunpeggedflag; } }
public string LowerUnpeggedFlag { get { return lowerunpeggedflag; } }
public bool MixTexturesFlats { get { return mixtexturesflats; } }
public bool GeneralizedActions { get { return generalizedactions; } }
public bool GeneralizedEffects { get { return generalizedeffects; } }
public int Start3DModeThingType { get { return start3dmodethingtype; } }
public int LinedefActivationsFilter { get { return linedefactivationsfilter; } }
public string TestParameters { get { return testparameters; } }
public string MakeDoorTrack { get { return makedoortrack; } }
public int MakeDoorAction { get { return makedooraction; } }
public int[] MakeDoorArgs { get { return makedoorargs; } }
// Skills
public List<SkillInfo> Skills { get { return skills; } }
@ -191,6 +202,7 @@ namespace CodeImp.DoomBuilder.Config
this.enums = new Dictionary<string, EnumList>();
this.skills = new List<SkillInfo>();
this.texturesets = new List<DefinedTextureSet>();
this.makedoorargs = new int[Linedef.NUM_ARGS];
// Read general settings
configname = cfg.ReadSetting("game", "<unnamed game>");
@ -204,6 +216,9 @@ namespace CodeImp.DoomBuilder.Config
start3dmodethingtype = cfg.ReadSetting("start3dmode", 0);
linedefactivationsfilter = cfg.ReadSetting("linedefactivationsfilter", 0);
testparameters = cfg.ReadSetting("testparameters", "");
makedoortrack = cfg.ReadSetting("makedoortrack", "-");
makedooraction = cfg.ReadSetting("makedooraction", 0);
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
@ -215,6 +230,10 @@ namespace CodeImp.DoomBuilder.Config
if(obj is int) doublesidedflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else doublesidedflag = obj.ToString();
obj = cfg.ReadSettingObject("impassableflag", 0);
if(obj is int) impassableflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else impassableflag = obj.ToString();
obj = cfg.ReadSettingObject("upperunpeggedflag", 0);
if(obj is int) upperunpeggedflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else upperunpeggedflag = obj.ToString();
obj = cfg.ReadSettingObject("lowerunpeggedflag", 0);
if(obj is int) lowerunpeggedflag = ((int)obj).ToString(CultureInfo.InvariantCulture); else lowerunpeggedflag = obj.ToString();
// Get map lumps
maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());

View file

@ -207,7 +207,7 @@ namespace CodeImp.DoomBuilder.Windows
else
{
// Cancelled
return null;
return select;
}
}

View file

@ -86,6 +86,18 @@ namespace CodeImp.DoomBuilder.Windows
/// <returns>Returns the new effect or the same effect when cancelled</returns>
int BrowseSectorEffect(IWin32Window owner, int initialvalue);
/// <summary>
/// This browses for a texture
/// </summary>
/// <returns>Returns the new texture name or the same texture name when cancelled</returns>
string BrowseTexture(IWin32Window owner, string initialvalue);
/// <summary>
/// This browses for a flat
/// </summary>
/// <returns>Returns the new flat name or the same flat name when cancelled</returns>
string BrowseFlat(IWin32Window owner, string initialvalue);
/// <summary>
/// This adds a menu to the Doom Builder menu strip.
/// <para>

View file

@ -1863,6 +1863,20 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Dialogs
// This browses for a texture
// Returns the new texture name or the same texture name when cancelled
public string BrowseTexture(IWin32Window owner, string initialvalue)
{
return TextureBrowserForm.Browse(owner, initialvalue);
}
// This browses for a flat
// Returns the new flat name or the same flat name when cancelled
public string BrowseFlat(IWin32Window owner, string initialvalue)
{
return FlatBrowserForm.Browse(owner, initialvalue);
}
// This browses the lindef types
// Returns the new action or the same action when cancelled
public int BrowseLinedefActions(IWin32Window owner, int initialvalue)

View file

@ -207,7 +207,7 @@ namespace CodeImp.DoomBuilder.Windows
else
{
// Cancelled
return null;
return select;
}
}