Added support for SRB2's 3D floors and slopes, as well as SRB2's method of storing the Z positions of Things

This commit is contained in:
MascaraSnake 2015-12-31 16:46:40 +01:00
parent 4cf012d92c
commit 29f05db92d
18 changed files with 1168 additions and 711 deletions

View file

@ -34,11 +34,20 @@ namespace CodeImp.DoomBuilder.IO
#endregion #endregion
#region ================== Variables
protected Dictionary<int, int[]> threeDFloorTypes;
protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes;
#endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
public DoomMapSetIO(WAD wad, MapManager manager) : base(wad, manager) public DoomMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
{ {
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
} }
#endregion #endregion
@ -66,6 +75,8 @@ namespace CodeImp.DoomBuilder.IO
public override bool HasNumericLinedefFlags { get { return true; } } public override bool HasNumericLinedefFlags { get { return true; } }
public override bool HasNumericThingFlags { get { return true; } } public override bool HasNumericThingFlags { get { return true; } }
public override bool HasNumericLinedefActivations { get { return true; } } public override bool HasNumericLinedefActivations { get { return true; } }
public override bool HasLinedefParameters { get { return true; } }
public override bool HasTranslucent3DFloors { get { return false; } }
public override int MaxTag { get { return ushort.MaxValue; } } public override int MaxTag { get { return ushort.MaxValue; } }
public override int MinTag { get { return ushort.MinValue; } } public override int MinTag { get { return ushort.MinValue; } }
public override int MaxAction { get { return ushort.MaxValue; } } public override int MaxAction { get { return ushort.MaxValue; } }
@ -78,11 +89,17 @@ namespace CodeImp.DoomBuilder.IO
public override int MinBrightness { get { return short.MinValue; } } public override int MinBrightness { get { return short.MinValue; } }
public override int MaxThingType { get { return ushort.MaxValue; } } public override int MaxThingType { get { return ushort.MaxValue; } }
public override int MinThingType { get { return ushort.MinValue; } } public override int MinThingType { get { return ushort.MinValue; } }
public override int MaxThingHeight { get { return int.MaxValue; } }
public override int MinThingHeight { get { return int.MinValue; } }
public override float MaxCoordinate { get { return short.MaxValue; } } public override float MaxCoordinate { get { return short.MaxValue; } }
public override float MinCoordinate { get { return short.MinValue; } } public override float MinCoordinate { get { return short.MinValue; } }
public override int MaxThingAngle { get { return short.MaxValue; } } public override int MaxThingAngle { get { return short.MaxValue; } }
public override int MinThingAngle { get { return short.MinValue; } } public override int MinThingAngle { get { return short.MinValue; } }
public override Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get { return uifields; } } //mxd public override Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get { return uifields; } } //mxd
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
public override int Custom3DFloorType { get { return 160; } }
#endregion #endregion
@ -114,7 +131,7 @@ namespace CodeImp.DoomBuilder.IO
} }
// This reads the THINGS from WAD file // This reads the THINGS from WAD file
private void ReadThings(MapSet map, int firstindex) protected virtual void ReadThings(MapSet map, int firstindex)
{ {
// Get the lump from wad file // Get the lump from wad file
Lump lump = wad.FindLump("THINGS", firstindex); Lump lump = wad.FindLump("THINGS", firstindex);
@ -394,7 +411,7 @@ namespace CodeImp.DoomBuilder.IO
} }
// This writes the THINGS to WAD file // This writes the THINGS to WAD file
private void WriteThings(MapSet map, int position, Dictionary<string, MapLumpInfo> maplumps) protected virtual void WriteThings(MapSet map, int position, Dictionary<string, MapLumpInfo> maplumps)
{ {
// Create memory to write to // Create memory to write to
MemoryStream mem = new MemoryStream(); MemoryStream mem = new MemoryStream();

View file

@ -34,10 +34,21 @@ namespace CodeImp.DoomBuilder.IO
#endregion #endregion
#region ================== Variables
protected Dictionary<int, int[]> threeDFloorTypes;
protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes;
#endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
public HexenMapSetIO(WAD wad, MapManager manager) : base(wad, manager) { } public HexenMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
{
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
}
#endregion #endregion
@ -64,6 +75,8 @@ namespace CodeImp.DoomBuilder.IO
public override bool HasNumericLinedefFlags { get { return true; } } public override bool HasNumericLinedefFlags { get { return true; } }
public override bool HasNumericThingFlags { get { return true; } } public override bool HasNumericThingFlags { get { return true; } }
public override bool HasNumericLinedefActivations { get { return true; } } public override bool HasNumericLinedefActivations { get { return true; } }
public override bool HasLinedefParameters { get { return true; } }
public override bool HasTranslucent3DFloors { get { return false; } }
public override int MaxTag { get { return ushort.MaxValue; } } public override int MaxTag { get { return ushort.MaxValue; } }
public override int MinTag { get { return ushort.MinValue; } } public override int MinTag { get { return ushort.MinValue; } }
public override int MaxAction { get { return byte.MaxValue; } } public override int MaxAction { get { return byte.MaxValue; } }
@ -76,11 +89,17 @@ namespace CodeImp.DoomBuilder.IO
public override int MinBrightness { get { return short.MinValue; } } public override int MinBrightness { get { return short.MinValue; } }
public override int MaxThingType { get { return ushort.MaxValue; } } public override int MaxThingType { get { return ushort.MaxValue; } }
public override int MinThingType { get { return ushort.MinValue; } } public override int MinThingType { get { return ushort.MinValue; } }
public override int MaxThingHeight { get { return int.MaxValue; } }
public override int MinThingHeight { get { return int.MinValue; } }
public override float MaxCoordinate { get { return short.MaxValue; } } public override float MaxCoordinate { get { return short.MaxValue; } }
public override float MinCoordinate { get { return short.MinValue; } } public override float MinCoordinate { get { return short.MinValue; } }
public override int MaxThingAngle { get { return short.MaxValue; } } public override int MaxThingAngle { get { return short.MaxValue; } }
public override int MinThingAngle { get { return short.MinValue; } } public override int MinThingAngle { get { return short.MinValue; } }
public override Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get { return uifields; } } //mxd public override Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get { return uifields; } } //mxd
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
public override int Custom3DFloorType { get { return 160; } }
#endregion #endregion

View file

@ -47,6 +47,8 @@ namespace CodeImp.DoomBuilder.IO
bool HasNumericLinedefFlags { get; } bool HasNumericLinedefFlags { get; }
bool HasNumericThingFlags { get; } bool HasNumericThingFlags { get; }
bool HasNumericLinedefActivations { get; } bool HasNumericLinedefActivations { get; }
bool HasLinedefParameters { get; }
bool HasTranslucent3DFloors { get; }
int MaxTag { get; } int MaxTag { get; }
int MinTag { get; } int MinTag { get; }
int MaxAction { get; } int MaxAction { get; }
@ -59,6 +61,8 @@ namespace CodeImp.DoomBuilder.IO
int MinBrightness { get; } int MinBrightness { get; }
int MaxThingType { get; } int MaxThingType { get; }
int MinThingType { get; } int MinThingType { get; }
int MaxThingHeight { get; }
int MinThingHeight { get; }
float MaxCoordinate { get; } float MaxCoordinate { get; }
float MinCoordinate { get; } float MinCoordinate { get; }
int MaxThingAngle { get; } int MaxThingAngle { get; }
@ -66,5 +70,9 @@ namespace CodeImp.DoomBuilder.IO
Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get; } //mxd. Element type (like "sector"), list of uifields. Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get; } //mxd. Element type (like "sector"), list of uifields.
string GetElementName(MapElementType elementtype); //mxd string GetElementName(MapElementType elementtype); //mxd
MapElementType GetElementType(string elementname); //mxd MapElementType GetElementType(string elementname); //mxd
Dictionary<int, int[]> ThreeDFloorTypes { get; }
Dictionary<int,int[]> SlopeTypes { get; }
Dictionary<int, int[]> SlopeCopyTypes { get; }
int Custom3DFloorType { get; }
} }
} }

View file

@ -70,6 +70,8 @@ namespace CodeImp.DoomBuilder.IO
public abstract bool HasNumericLinedefFlags { get; } public abstract bool HasNumericLinedefFlags { get; }
public abstract bool HasNumericThingFlags { get; } public abstract bool HasNumericThingFlags { get; }
public abstract bool HasNumericLinedefActivations { get; } public abstract bool HasNumericLinedefActivations { get; }
public abstract bool HasLinedefParameters { get; }
public abstract bool HasTranslucent3DFloors { get; }
public abstract int MaxTag { get; } public abstract int MaxTag { get; }
public abstract int MinTag { get; } public abstract int MinTag { get; }
public abstract int MaxAction { get; } public abstract int MaxAction { get; }
@ -82,11 +84,17 @@ namespace CodeImp.DoomBuilder.IO
public abstract int MinBrightness { get; } public abstract int MinBrightness { get; }
public abstract int MaxThingType { get; } public abstract int MaxThingType { get; }
public abstract int MinThingType { get; } public abstract int MinThingType { get; }
public abstract int MaxThingHeight { get; }
public abstract int MinThingHeight { get; }
public abstract float MaxCoordinate { get; } public abstract float MaxCoordinate { get; }
public abstract float MinCoordinate { get; } public abstract float MinCoordinate { get; }
public abstract int MaxThingAngle { get; } public abstract int MaxThingAngle { get; }
public abstract int MinThingAngle { get; } public abstract int MinThingAngle { get; }
public abstract Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get; } //mxd public abstract Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get; } //mxd
public abstract Dictionary<int, int[]> ThreeDFloorTypes { get; }
public abstract Dictionary<int, int[]> SlopeTypes { get; }
public abstract Dictionary<int, int[]> SlopeCopyTypes { get; }
public abstract int Custom3DFloorType { get; }
#endregion #endregion

View file

@ -0,0 +1,220 @@

#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.IO;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Types;
#endregion
namespace CodeImp.DoomBuilder.IO
{
internal class SRB2MapSetIO : DoomMapSetIO
{
#region ================== Constants
#endregion
#region ================== Constructor / Disposer
// Constructor
public SRB2MapSetIO(WAD wad, MapManager manager) : base(wad, manager)
{
threeDFloorTypes = new Dictionary<int, int[]>() {
{ 100, new int[4] { 1, 0, 2, 0} },
{ 101, new int[4] { 1, 1, 2, 1} },
{ 102, new int[4] { 1, 1, 1, 1} },
{ 103, new int[4] { 1, 1, 2, 1} },
{ 104, new int[4] { 1, 1, 2, 0} },
{ 105, new int[4] { 1, 1, 0, 1} },
{ 120, new int[4] { 6, 0, 2, 2} },
{ 121, new int[4] { 6, 0, 1, 2} },
{ 122, new int[4] { 6, 0, 2, 2} },
{ 123, new int[4] { 6, 0, 1, 2} },
{ 124, new int[4] { 6, 0, 1, 2} },
{ 125, new int[4] { 6, 0, 1, 2} },
{ 140, new int[4] { 1, 0, 2, 1} },
{ 141, new int[4] { 1, 0, 1, 1} },
{ 142, new int[4] { 1, 0, 1, 1} },
{ 143, new int[4] { 1, 0, 2, 1} },
{ 144, new int[4] { 1, 0, 1, 1} },
{ 145, new int[4] { 1, 0, 1, 1} },
{ 146, new int[4] { 1, 0, 2, 1} },
{ 150, new int[4] { 1, 0, 2, 0} },
{ 151, new int[4] { 1, 0, 2, 0} },
{ 152, new int[4] { 1, 0, 2, 0} },
{ 160, new int[4] { 1, 0, 2, 0} },
{ 170, new int[4] { 1, 0, 2, 0} },
{ 171, new int[4] { 1, 0, 2, 0} },
{ 172, new int[4] { 1, 0, 2, 1} },
{ 173, new int[4] { 1, 0, 2, 1} },
{ 174, new int[4] { 1, 0, 1, 1} },
{ 175, new int[4] { 1, 0, 1, 1} },
{ 176, new int[4] { 1, 0, 2, 0} },
{ 177, new int[4] { 1, 0, 2, 0} },
{ 178, new int[4] { 1, 0, 2, 0} },
{ 179, new int[4] { 1, 0, 2, 0} },
{ 180, new int[4] { 1, 0, 2, 0} },
{ 190, new int[4] { 1, 0, 2, 0} },
{ 191, new int[4] { 1, 1, 2, 1} },
{ 192, new int[4] { 1, 1, 1, 1} },
{ 193, new int[4] { 1, 1, 0, 1} },
{ 194, new int[4] { 1, 0, 2, 1} },
{ 195, new int[4] { 1, 0, 1, 1} },
{ 200, new int[4] { 3, 1, 0, 1} },
{ 201, new int[4] { 3, 0, 0, 0} },
{ 202, new int[4] { 3, 5, 2, 5} },
{ 220, new int[4] { 3, 0, 2, 0} },
{ 221, new int[4] { 3, 1, 1, 0} },
{ 222, new int[4] { 3, 1, 2, 0} },
{ 223, new int[4] { 3, 1, 0, 1} },
{ 250, new int[4] { 1, 0, 2, 0} },
{ 251, new int[4] { 1, 0, 2, 0} },
{ 252, new int[4] { 1, 0, 2, 0} },
{ 253, new int[4] { 1, 0, 1, 0} },
{ 254, new int[4] { 1, 0, 2, 0} },
{ 255, new int[4] { 1, 0, 2, 0} },
{ 256, new int[4] { 1, 0, 1, 0} },
{ 257, new int[4] { 5, 0, 2, 0} },
{ 258, new int[4] { 1, 1, 2, 0} },
{ 259, new int[4] { 1, 0, 2, 0} }
};
slopeTypes = new Dictionary<int, int[]>() {
{ 700, new int[2] { 1, 0 } },
{ 701, new int[2] { 0, 1 } },
{ 702, new int[2] { 1, 1 } },
{ 703, new int[2] { 1, 2 } },
{ 710, new int[2] { 2, 0 } },
{ 711, new int[2] { 0, 2 } },
{ 712, new int[2] { 2, 2 } },
{ 713, new int[2] { 2, 1 } }
};
slopeCopyTypes = new Dictionary<int, int[]>() {
{ 720, new int[2] { 1, 0 } },
{ 721, new int[2] { 0, 1 } },
{ 722, new int[2] { 1, 1 } },
};
}
#endregion
#region ================== Properties
public override bool HasThingHeight { get { return true; } }
public override bool HasLinedefParameters { get { return false; } }
public override bool HasTranslucent3DFloors { get { return true; } }
public override int Custom3DFloorType { get { return 259; } }
public override int MaxThingHeight { get { return 4095; } }
public override int MinThingHeight { get { return 0; } }
#endregion
#region ================== Reading
// This reads the THINGS from WAD file
protected override void ReadThings(MapSet map, int firstindex)
{
// Get the lump from wad file
Lump lump = wad.FindLump("THINGS", firstindex);
if (lump == null) throw new Exception("Could not find required lump THINGS!");
// Prepare to read the items
MemoryStream mem = new MemoryStream(lump.Stream.ReadAllBytes());
int num = (int)lump.Stream.Length / 10;
BinaryReader reader = new BinaryReader(mem);
// Read items from the lump
map.SetCapacity(0, 0, 0, 0, map.Things.Count + num);
for (int i = 0; i < num; i++)
{
// Read properties from stream
int x = reader.ReadInt16();
int y = reader.ReadInt16();
int angle = reader.ReadInt16();
int type = reader.ReadUInt16();
int flags = reader.ReadUInt16();
// Make string flags
Dictionary<string, bool> stringflags = new Dictionary<string, bool>(StringComparer.Ordinal);
foreach (KeyValuePair<string, string> f in manager.Config.ThingFlags)
{
int fnum;
if (int.TryParse(f.Key, out fnum)) stringflags[f.Key] = ((flags & fnum) == fnum);
}
// MascaraSnake: SRB2 stores Z position in upper 12 bits of flags. Read Z position and remove it from flags.
int z = flags >> 4;
flags &= 0xF;
// Create new item
Thing t = map.CreateThing();
t.Update(type, x, y, z, angle, 0, 0, 1.0f, 1.0f, stringflags, 0, 0, new int[Thing.NUM_ARGS]);
}
// Done
mem.Dispose();
}
#endregion
#region ================== Writing
// This writes the THINGS to WAD file
protected override void WriteThings(MapSet map, int position, Dictionary<string, MapLumpInfo> maplumps)
{
// Create memory to write to
MemoryStream mem = new MemoryStream();
BinaryWriter writer = new BinaryWriter(mem, WAD.ENCODING);
// Go for all things
foreach (Thing t in map.Things)
{
// Convert flags
int flags = 0;
foreach (KeyValuePair<string, bool> f in t.Flags)
{
int fnum;
if (f.Value && int.TryParse(f.Key, out fnum)) flags |= fnum;
}
// MascaraSnake: SRB2 stores Z position in upper 12 bits of flags. Add Z position to flags.
flags |= (UInt16)t.Position.z << 4;
// Write properties to stream
writer.Write((Int16)t.Position.x);
writer.Write((Int16)t.Position.y);
writer.Write((Int16)t.AngleDoom);
writer.Write((UInt16)t.Type);
writer.Write((UInt16)flags);
}
// Find insert position and remove old lump
int insertpos = MapManager.RemoveSpecificLump(wad, "THINGS", position, MapManager.TEMP_MAP_HEADER, maplumps);
if (insertpos == -1) insertpos = position + 1;
if (insertpos > wad.Lumps.Count) insertpos = wad.Lumps.Count;
// Create the lump from memory
Lump lump = wad.Insert("THINGS", insertpos, (int)mem.Length);
lump.Stream.Seek(0, SeekOrigin.Begin);
mem.WriteTo(lump.Stream);
mem.Flush();
}
#endregion
}
}

View file

@ -37,6 +37,12 @@ namespace CodeImp.DoomBuilder.IO
#endregion #endregion
#region ================== Variables
protected Dictionary<int, int[]> threeDFloorTypes;
protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes;
#endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
@ -44,6 +50,9 @@ namespace CodeImp.DoomBuilder.IO
{ {
if((manager != null) && (manager.Config != null)) if((manager != null) && (manager.Config != null))
{ {
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
// Make configuration // Make configuration
Configuration config = new Configuration(); Configuration config = new Configuration();
@ -116,6 +125,8 @@ namespace CodeImp.DoomBuilder.IO
public override bool HasNumericLinedefFlags { get { return false; } } public override bool HasNumericLinedefFlags { get { return false; } }
public override bool HasNumericThingFlags { get { return false; } } public override bool HasNumericThingFlags { get { return false; } }
public override bool HasNumericLinedefActivations { get { return false; } } public override bool HasNumericLinedefActivations { get { return false; } }
public override bool HasLinedefParameters { get { return true; } }
public override bool HasTranslucent3DFloors { get { return false; } }
public override int MaxTag { get { return int.MaxValue; } } public override int MaxTag { get { return int.MaxValue; } }
public override int MinTag { get { return int.MinValue; } } public override int MinTag { get { return int.MinValue; } }
public override int MaxAction { get { return int.MaxValue; } } public override int MaxAction { get { return int.MaxValue; } }
@ -128,11 +139,17 @@ namespace CodeImp.DoomBuilder.IO
public override int MinBrightness { get { return int.MinValue; } } public override int MinBrightness { get { return int.MinValue; } }
public override int MaxThingType { get { return int.MaxValue; } } public override int MaxThingType { get { return int.MaxValue; } }
public override int MinThingType { get { return int.MinValue; } } public override int MinThingType { get { return int.MinValue; } }
public override int MaxThingHeight { get { return int.MaxValue; } }
public override int MinThingHeight { get { return int.MinValue; } }
public override float MaxCoordinate { get { return short.MaxValue; } } //mxd. UDMF maps are still bounded to -32768 .. 32767 range public override float MaxCoordinate { get { return short.MaxValue; } } //mxd. UDMF maps are still bounded to -32768 .. 32767 range
public override float MinCoordinate { get { return short.MinValue; } } //mxd public override float MinCoordinate { get { return short.MinValue; } } //mxd
public override int MaxThingAngle { get { return int.MaxValue; } } public override int MaxThingAngle { get { return int.MaxValue; } }
public override int MinThingAngle { get { return int.MinValue; } } public override int MinThingAngle { get { return int.MinValue; } }
public override Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get { return uifields; } } //mxd public override Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get { return uifields; } } //mxd
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
public override int Custom3DFloorType { get { return 160; } }
#endregion #endregion

View file

@ -22,6 +22,7 @@ using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
using System.Drawing; using System.Drawing;
using System.Text.RegularExpressions;
using CodeImp.DoomBuilder.IO; using CodeImp.DoomBuilder.IO;
#endregion #endregion
@ -90,7 +91,9 @@ namespace CodeImp.DoomBuilder.Map
internal Dictionary<string, bool> Flags { get { return flags; } } internal Dictionary<string, bool> Flags { get { return flags; } }
public int Action { get { return action; } set { BeforePropsChange(); action = value; UpdateColorPreset(); } } public int Action { get { return action; } set { BeforePropsChange(); action = value; UpdateColorPreset(); } }
public int Activate { get { return activate; } set { BeforePropsChange(); activate = value; UpdateColorPreset(); } } public int Activate { get { return activate; } set { BeforePropsChange(); activate = value; UpdateColorPreset(); } }
public bool Is3DFloor { get { return General.Map.FormatInterface.ThreeDFloorTypes.ContainsKey(Action); } }
public bool IsSlope { get { return General.Map.FormatInterface.SlopeTypes.ContainsKey(Action); } }
public bool IsSlopeCopy { get { return General.Map.FormatInterface.SlopeCopyTypes.ContainsKey(Action); } }
public int Tag { get { return tags[0]; } set { BeforePropsChange(); tags[0] = value; if((value < General.Map.FormatInterface.MinTag) || (value > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } } //mxd public int Tag { get { return tags[0]; } set { BeforePropsChange(); tags[0] = value; if((value < General.Map.FormatInterface.MinTag) || (value > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } } //mxd
public List<int> Tags { get { return tags; } set { BeforePropsChange(); tags = value; } } //mxd public List<int> Tags { get { return tags; } set { BeforePropsChange(); tags = value; } } //mxd
public float LengthSq { get { return lengthsq; } } public float LengthSq { get { return lengthsq; } }
@ -755,6 +758,91 @@ namespace CodeImp.DoomBuilder.Map
#endregion #endregion
#region ================== Methods #region ================== Methods
public void Set3DFloorArgs()
{
Args[0] = Tag;
Args[1] = 1;
Args[2] = 0;
Args[3] = 0;
Args[4] = 0;
if (Action == General.Map.FormatInterface.Custom3DFloorType && Back != null)
{
string tex = Back.HighTexture;
Regex r = new Regex("^[A-F0-9]*$");
if (r.IsMatch(tex))
{
int value = Convert.ToInt32(tex, 16);
bool exists = (value & 0x1) == 0x1;
bool solid = ((value & 0x2) == 0x2) || ((value & 0x4) == 0x4);
bool render = ((value & 0x8) == 0x8) || ((value & 0x10) == 0x10);
bool water = (value & 0x20) == 0x20;
bool noshade = (value & 0x40) == 0x40;
bool translucent = (value & 0x1000) == 0x1000;
bool fog = (value & 0x2000) == 0x2000;
bool inside = ((value & 0x8000) == 0x8000) || ((value & 0x10000) == 0x10000);
if (exists)
{
Args[1] = water ? 2 : (solid ? 1 : 3);
if (inside) Args[1] += 4;
}
Args[2] = noshade ? 1 : 0;
if (inside) Args[2] += 2;
if (fog) Args[2] += 4;
Args[3] = render ? (translucent ? ParseTranslucency(Front.HighTexture) : 255) : 0;
}
}
else
{
int[] settings = General.Map.FormatInterface.ThreeDFloorTypes[Action];
Args[1] = settings[0];
Args[2] = Flags.ContainsKey("64") && Flags["64"] ? settings[3] : settings[1];
switch (settings[2])
{
case 0:
Args[3] = 0;
break;
case 1:
Args[3] = ParseTranslucency(Front.HighTexture);
break;
case 2:
Args[3] = 255;
break;
default:
Args[3] = 0;
break;
}
}
}
private int ParseTranslucency(string tex)
{
int result = 128;
if (tex.StartsWith("#") && tex.Length == 4)
{
int alpha;
if (int.TryParse(tex.Substring(1), out alpha) && alpha >= 0 && alpha <= 255) result = alpha;
}
return result;
}
public void SetSlopeArgs()
{
int[] settings = General.Map.FormatInterface.SlopeTypes[Action];
Args[0] = settings[0];
Args[1] = settings[1];
Args[2] = 0;
}
public void SetSlopeCopyArgs()
{
int[] settings = General.Map.FormatInterface.SlopeCopyTypes[Action];
if (settings[0] == 1) Args[0] = Tag;
if (settings[0] == 2) Args[2] = Tag;
if (settings[1] == 1) Args[1] = Tag;
if (settings[1] == 2) Args[3] = Tag;
Args[4] = 0;
}
// This checks and returns a flag without creating it // This checks and returns a flag without creating it
public bool IsFlagSet(string flagname) public bool IsFlagSet(string flagname)

View file

@ -670,7 +670,8 @@ namespace CodeImp.DoomBuilder.Map
foreach(Sidedef side in s.sidedefs) foreach(Sidedef side in s.sidedefs)
{ {
// Carbon copy of EffectLineSlope class here... // Carbon copy of EffectLineSlope class here...
if(side.Line.Action == 181 && ((side.Line.Args[0] == 1 && side == side.Line.Front) || side.Line.Args[0] == 2) && side.Other != null) // MascaraSnake: Handle slopes
if(side.Line.IsSlope && ((side.Line.Args[0] == 1 && side == side.Line.Front) || side.Line.Args[0] == 2) && side.Other != null)
{ {
Linedef l = side.Line; Linedef l = side.Line;
@ -750,7 +751,8 @@ namespace CodeImp.DoomBuilder.Map
foreach(Sidedef side in s.sidedefs) foreach(Sidedef side in s.sidedefs)
{ {
// Carbon copy of EffectLineSlope class here... // Carbon copy of EffectLineSlope class here...
if(side.Line.Action == 181 && ((side.Line.Args[1] == 1 && side == side.Line.Front) || side.Line.Args[1] == 2) && side.Other != null) // MascaraSnake: Handle slopes
if(side.Line.IsSlope && ((side.Line.Args[1] == 1 && side == side.Line.Front) || side.Line.Args[1] == 2) && side.Other != null)
{ {
Linedef l = side.Line; Linedef l = side.Line;

View file

@ -616,8 +616,10 @@ namespace CodeImp.DoomBuilder.Rendering
//find lines with 3d floor action and collect sector tags //find lines with 3d floor action and collect sector tags
foreach(Linedef l in General.Map.Map.Linedefs) foreach(Linedef l in General.Map.Map.Linedefs)
{ {
if(l.Action == 160) //MascaraSnake: 3D floor handling
if(l.Is3DFloor)
{ {
if (!General.Map.FormatInterface.HasLinedefParameters) l.Set3DFloorArgs();
int sectortag = (General.Map.UDMF || (l.Args[1] & 8) != 0) ? l.Args[0] : l.Args[0] + (l.Args[4] << 8); int sectortag = (General.Map.UDMF || (l.Args[1] & 8) != 0) ? l.Args[0] : l.Args[0] + (l.Args[4] << 8);
if(sectortag != 0 && !tags.Contains(sectortag)) tags.Add(sectortag); if(sectortag != 0 && !tags.Contains(sectortag)) tags.Add(sectortag);
} }

View file

@ -13,7 +13,7 @@ namespace CodeImp.DoomBuilder.Windows
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if(disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
@ -29,8 +29,8 @@ namespace CodeImp.DoomBuilder.Windows
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.Windows.Forms.GroupBox groupBox2;
System.Windows.Forms.Label label7; System.Windows.Forms.Label label7;
System.Windows.Forms.GroupBox groupBox2;
this.cbAbsoluteHeight = new System.Windows.Forms.CheckBox(); this.cbAbsoluteHeight = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
@ -38,43 +38,54 @@ namespace CodeImp.DoomBuilder.Windows
this.posY = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.posY = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.posZ = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.posZ = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.zlabel = new System.Windows.Forms.Label(); this.zlabel = new System.Windows.Forms.Label();
this.typegroup = new System.Windows.Forms.GroupBox(); this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.thingtype = new CodeImp.DoomBuilder.Controls.ThingBrowserControl(); this.browseaction = new System.Windows.Forms.Button();
this.anglecontrol = new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl(); this.apply = new System.Windows.Forms.Button();
this.cbRandomAngle = new System.Windows.Forms.CheckBox(); this.cancel = new System.Windows.Forms.Button();
this.angle = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.applypanel = new System.Windows.Forms.Panel();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.hintlabel = new System.Windows.Forms.Label();
this.settingsgroup = new System.Windows.Forms.GroupBox(); this.hint = new System.Windows.Forms.PictureBox();
this.missingflags = new System.Windows.Forms.PictureBox(); this.panel = new System.Windows.Forms.Panel();
this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl();
this.actiongroup = new System.Windows.Forms.GroupBox(); this.actiongroup = new System.Windows.Forms.GroupBox();
this.argscontrol = new CodeImp.DoomBuilder.Controls.ArgumentsControl(); this.argscontrol = new CodeImp.DoomBuilder.Controls.ArgumentsControl();
this.actionhelp = new CodeImp.DoomBuilder.Controls.ActionSpecialHelpButton(); this.actionhelp = new CodeImp.DoomBuilder.Controls.ActionSpecialHelpButton();
this.action = new CodeImp.DoomBuilder.Controls.ActionSelectorControl(); this.action = new CodeImp.DoomBuilder.Controls.ActionSelectorControl();
this.browseaction = new System.Windows.Forms.Button(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.cbRandomAngle = new System.Windows.Forms.CheckBox();
this.anglecontrol = new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl();
this.angle = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.idgroup = new System.Windows.Forms.GroupBox(); this.idgroup = new System.Windows.Forms.GroupBox();
this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector(); this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector();
this.cancel = new System.Windows.Forms.Button(); this.typegroup = new System.Windows.Forms.GroupBox();
this.apply = new System.Windows.Forms.Button(); this.thingtype = new CodeImp.DoomBuilder.Controls.ThingBrowserControl();
this.hint = new System.Windows.Forms.PictureBox(); this.settingsgroup = new System.Windows.Forms.GroupBox();
this.hintlabel = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.tooltip = new System.Windows.Forms.ToolTip(this.components); this.flagsvalue = new CodeImp.DoomBuilder.Controls.NumericTextbox();
this.panel = new System.Windows.Forms.Panel(); this.missingflags = new System.Windows.Forms.PictureBox();
this.applypanel = new System.Windows.Forms.Panel(); this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl();
groupBox2 = new System.Windows.Forms.GroupBox();
label7 = new System.Windows.Forms.Label(); label7 = new System.Windows.Forms.Label();
groupBox2 = new System.Windows.Forms.GroupBox();
groupBox2.SuspendLayout(); groupBox2.SuspendLayout();
this.typegroup.SuspendLayout(); this.applypanel.SuspendLayout();
this.groupBox4.SuspendLayout();
this.settingsgroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.missingflags)).BeginInit();
this.actiongroup.SuspendLayout();
this.idgroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.hint)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hint)).BeginInit();
this.panel.SuspendLayout(); this.panel.SuspendLayout();
this.applypanel.SuspendLayout(); this.actiongroup.SuspendLayout();
this.groupBox4.SuspendLayout();
this.idgroup.SuspendLayout();
this.typegroup.SuspendLayout();
this.settingsgroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.missingflags)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// label7
//
label7.AutoSize = true;
label7.Location = new System.Drawing.Point(15, 30);
label7.Name = "label7";
label7.Size = new System.Drawing.Size(40, 13);
label7.TabIndex = 9;
label7.Text = "Action:";
//
// groupBox2 // groupBox2
// //
groupBox2.Controls.Add(this.cbAbsoluteHeight); groupBox2.Controls.Add(this.cbAbsoluteHeight);
@ -84,9 +95,9 @@ namespace CodeImp.DoomBuilder.Windows
groupBox2.Controls.Add(this.posY); groupBox2.Controls.Add(this.posY);
groupBox2.Controls.Add(this.posZ); groupBox2.Controls.Add(this.posZ);
groupBox2.Controls.Add(this.zlabel); groupBox2.Controls.Add(this.zlabel);
groupBox2.Location = new System.Drawing.Point(260, 242); groupBox2.Location = new System.Drawing.Point(279, 242);
groupBox2.Name = "groupBox2"; groupBox2.Name = "groupBox2";
groupBox2.Size = new System.Drawing.Size(177, 134); groupBox2.Size = new System.Drawing.Size(158, 134);
groupBox2.TabIndex = 2; groupBox2.TabIndex = 2;
groupBox2.TabStop = false; groupBox2.TabStop = false;
groupBox2.Text = " Position "; groupBox2.Text = " Position ";
@ -183,124 +194,83 @@ namespace CodeImp.DoomBuilder.Windows
this.zlabel.Text = "Height:"; this.zlabel.Text = "Height:";
this.zlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.zlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// label7 // browseaction
// //
label7.AutoSize = true; this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List;
label7.Location = new System.Drawing.Point(15, 30); this.browseaction.Location = new System.Drawing.Point(482, 25);
label7.Name = "label7"; this.browseaction.Name = "browseaction";
label7.Size = new System.Drawing.Size(40, 13); this.browseaction.Size = new System.Drawing.Size(28, 25);
label7.TabIndex = 9; this.browseaction.TabIndex = 1;
label7.Text = "Action:"; this.browseaction.Text = " ";
this.tooltip.SetToolTip(this.browseaction, "Browse Action");
this.browseaction.UseVisualStyleBackColor = true;
this.browseaction.Click += new System.EventHandler(this.browseaction_Click);
// //
// typegroup // apply
// //
this.typegroup.Controls.Add(this.thingtype); this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.typegroup.Location = new System.Drawing.Point(4, 3); this.apply.Location = new System.Drawing.Point(320, 4);
this.typegroup.Name = "typegroup"; this.apply.Name = "apply";
this.typegroup.Size = new System.Drawing.Size(250, 373); this.apply.Size = new System.Drawing.Size(112, 25);
this.typegroup.TabIndex = 0; this.apply.TabIndex = 1;
this.typegroup.TabStop = false; this.apply.Text = "OK";
this.typegroup.Text = " Thing "; this.apply.UseVisualStyleBackColor = true;
this.apply.Click += new System.EventHandler(this.apply_Click);
// //
// thingtype // cancel
// //
this.thingtype.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Left))); this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.thingtype.Location = new System.Drawing.Point(9, 13); this.cancel.Location = new System.Drawing.Point(438, 4);
this.thingtype.Margin = new System.Windows.Forms.Padding(6); this.cancel.Name = "cancel";
this.thingtype.Name = "thingtype"; this.cancel.Size = new System.Drawing.Size(112, 25);
this.thingtype.Size = new System.Drawing.Size(232, 357); this.cancel.TabIndex = 2;
this.thingtype.TabIndex = 0; this.cancel.Text = "Cancel";
this.thingtype.UseMultiSelection = true; this.cancel.UseVisualStyleBackColor = true;
this.thingtype.OnTypeDoubleClicked += new CodeImp.DoomBuilder.Controls.ThingBrowserControl.TypeDoubleClickDeletegate(this.thingtype_OnTypeDoubleClicked); this.cancel.Click += new System.EventHandler(this.cancel_Click);
this.thingtype.OnTypeChanged += new CodeImp.DoomBuilder.Controls.ThingBrowserControl.TypeChangedDeletegate(this.thingtype_OnTypeChanged);
// //
// anglecontrol // applypanel
// //
this.anglecontrol.Angle = 0; this.applypanel.Controls.Add(this.cancel);
this.anglecontrol.AngleOffset = 0; this.applypanel.Controls.Add(this.apply);
this.anglecontrol.Location = new System.Drawing.Point(20, 40); this.applypanel.Controls.Add(this.hintlabel);
this.anglecontrol.Name = "anglecontrol"; this.applypanel.Controls.Add(this.hint);
this.anglecontrol.Size = new System.Drawing.Size(69, 69); this.applypanel.Location = new System.Drawing.Point(12, 624);
this.anglecontrol.TabIndex = 20; this.applypanel.Name = "applypanel";
this.anglecontrol.AngleChanged += new System.EventHandler(this.anglecontrol_AngleChanged); this.applypanel.Size = new System.Drawing.Size(553, 32);
this.applypanel.TabIndex = 6;
// //
// cbRandomAngle // hintlabel
// //
this.cbRandomAngle.AutoSize = true; this.hintlabel.AutoSize = true;
this.cbRandomAngle.Location = new System.Drawing.Point(6, 111); this.hintlabel.Location = new System.Drawing.Point(18, 3);
this.cbRandomAngle.Name = "cbRandomAngle"; this.hintlabel.Name = "hintlabel";
this.cbRandomAngle.Size = new System.Drawing.Size(95, 17); this.hintlabel.Size = new System.Drawing.Size(195, 26);
this.cbRandomAngle.TabIndex = 17; this.hintlabel.TabIndex = 4;
this.cbRandomAngle.Text = "Random angle"; this.hintlabel.Text = "Select categories or several thing types \r\nto randomly assign them to selection";
this.cbRandomAngle.UseVisualStyleBackColor = true;
this.cbRandomAngle.CheckedChanged += new System.EventHandler(this.cbRandomAngle_CheckedChanged);
// //
// angle // hint
// //
this.angle.AllowDecimal = false; this.hint.Image = global::CodeImp.DoomBuilder.Properties.Resources.Lightbulb;
this.angle.AllowNegative = true; this.hint.Location = new System.Drawing.Point(0, 8);
this.angle.AllowRelative = true; this.hint.Name = "hint";
this.angle.ButtonStep = 5; this.hint.Size = new System.Drawing.Size(16, 16);
this.angle.ButtonStepBig = 15F; this.hint.TabIndex = 3;
this.angle.ButtonStepFloat = 1F; this.hint.TabStop = false;
this.angle.ButtonStepSmall = 1F;
this.angle.ButtonStepsUseModifierKeys = true;
this.angle.ButtonStepsWrapAround = false;
this.angle.Location = new System.Drawing.Point(13, 16);
this.angle.Name = "angle";
this.angle.Size = new System.Drawing.Size(82, 24);
this.angle.StepValues = null;
this.angle.TabIndex = 10;
this.angle.WhenTextChanged += new System.EventHandler(this.angle_WhenTextChanged);
// //
// groupBox4 // panel
// //
this.groupBox4.Controls.Add(this.cbRandomAngle); this.panel.BackColor = System.Drawing.SystemColors.Window;
this.groupBox4.Controls.Add(this.anglecontrol); this.panel.Controls.Add(this.actiongroup);
this.groupBox4.Controls.Add(this.angle); this.panel.Controls.Add(this.groupBox4);
this.groupBox4.Location = new System.Drawing.Point(443, 242); this.panel.Controls.Add(this.idgroup);
this.groupBox4.Name = "groupBox4"; this.panel.Controls.Add(this.typegroup);
this.groupBox4.Size = new System.Drawing.Size(107, 134); this.panel.Controls.Add(groupBox2);
this.groupBox4.TabIndex = 3; this.panel.Controls.Add(this.settingsgroup);
this.groupBox4.TabStop = false; this.panel.Location = new System.Drawing.Point(12, 12);
this.groupBox4.Text = " Angle"; this.panel.Name = "panel";
// this.panel.Size = new System.Drawing.Size(553, 606);
// settingsgroup this.panel.TabIndex = 5;
//
this.settingsgroup.Controls.Add(this.missingflags);
this.settingsgroup.Controls.Add(this.flags);
this.settingsgroup.Location = new System.Drawing.Point(260, 3);
this.settingsgroup.Name = "settingsgroup";
this.settingsgroup.Size = new System.Drawing.Size(290, 233);
this.settingsgroup.TabIndex = 1;
this.settingsgroup.TabStop = false;
this.settingsgroup.Text = " Settings ";
//
// missingflags
//
this.missingflags.BackColor = System.Drawing.SystemColors.Window;
this.missingflags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
this.missingflags.Location = new System.Drawing.Point(55, -2);
this.missingflags.Name = "missingflags";
this.missingflags.Size = new System.Drawing.Size(16, 16);
this.missingflags.TabIndex = 5;
this.missingflags.TabStop = false;
this.missingflags.Visible = false;
//
// flags
//
this.flags.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flags.AutoScroll = true;
this.flags.Columns = 2;
this.flags.Location = new System.Drawing.Point(14, 19);
this.flags.Name = "flags";
this.flags.Size = new System.Drawing.Size(270, 211);
this.flags.TabIndex = 0;
this.flags.VerticalSpacing = 1;
this.flags.OnValueChanged += new System.EventHandler(this.flags_OnValueChanged);
// //
// actiongroup // actiongroup
// //
@ -344,17 +314,56 @@ namespace CodeImp.DoomBuilder.Windows
this.action.Value = 402; this.action.Value = 402;
this.action.ValueChanges += new System.EventHandler(this.action_ValueChanges); this.action.ValueChanges += new System.EventHandler(this.action_ValueChanges);
// //
// browseaction // groupBox4
// //
this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; this.groupBox4.Controls.Add(this.cbRandomAngle);
this.browseaction.Location = new System.Drawing.Point(482, 25); this.groupBox4.Controls.Add(this.anglecontrol);
this.browseaction.Name = "browseaction"; this.groupBox4.Controls.Add(this.angle);
this.browseaction.Size = new System.Drawing.Size(28, 25); this.groupBox4.Location = new System.Drawing.Point(443, 242);
this.browseaction.TabIndex = 1; this.groupBox4.Name = "groupBox4";
this.browseaction.Text = " "; this.groupBox4.Size = new System.Drawing.Size(107, 134);
this.tooltip.SetToolTip(this.browseaction, "Browse Action"); this.groupBox4.TabIndex = 3;
this.browseaction.UseVisualStyleBackColor = true; this.groupBox4.TabStop = false;
this.browseaction.Click += new System.EventHandler(this.browseaction_Click); this.groupBox4.Text = " Angle";
//
// cbRandomAngle
//
this.cbRandomAngle.AutoSize = true;
this.cbRandomAngle.Location = new System.Drawing.Point(6, 111);
this.cbRandomAngle.Name = "cbRandomAngle";
this.cbRandomAngle.Size = new System.Drawing.Size(95, 17);
this.cbRandomAngle.TabIndex = 17;
this.cbRandomAngle.Text = "Random angle";
this.cbRandomAngle.UseVisualStyleBackColor = true;
this.cbRandomAngle.CheckedChanged += new System.EventHandler(this.cbRandomAngle_CheckedChanged);
//
// anglecontrol
//
this.anglecontrol.Angle = 0;
this.anglecontrol.AngleOffset = 0;
this.anglecontrol.Location = new System.Drawing.Point(20, 40);
this.anglecontrol.Name = "anglecontrol";
this.anglecontrol.Size = new System.Drawing.Size(69, 69);
this.anglecontrol.TabIndex = 20;
this.anglecontrol.AngleChanged += new System.EventHandler(this.anglecontrol_AngleChanged);
//
// angle
//
this.angle.AllowDecimal = false;
this.angle.AllowNegative = true;
this.angle.AllowRelative = true;
this.angle.ButtonStep = 5;
this.angle.ButtonStepBig = 15F;
this.angle.ButtonStepFloat = 1F;
this.angle.ButtonStepSmall = 1F;
this.angle.ButtonStepsUseModifierKeys = true;
this.angle.ButtonStepsWrapAround = false;
this.angle.Location = new System.Drawing.Point(13, 16);
this.angle.Name = "angle";
this.angle.Size = new System.Drawing.Size(82, 24);
this.angle.StepValues = null;
this.angle.TabIndex = 10;
this.angle.WhenTextChanged += new System.EventHandler(this.angle_WhenTextChanged);
// //
// idgroup // idgroup
// //
@ -370,74 +379,91 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.tagSelector.Location = new System.Drawing.Point(6, 19); this.tagSelector.Location = new System.Drawing.Point(6, 19);
this.tagSelector.Name = "tagSelector"; this.tagSelector.Name = "tagSelector";
this.tagSelector.Size = new System.Drawing.Size(534, 35); this.tagSelector.Size = new System.Drawing.Size(430, 35);
this.tagSelector.TabIndex = 8; this.tagSelector.TabIndex = 8;
// //
// cancel // typegroup
// //
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.typegroup.Controls.Add(this.thingtype);
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.typegroup.Location = new System.Drawing.Point(4, 3);
this.cancel.Location = new System.Drawing.Point(438, 4); this.typegroup.Name = "typegroup";
this.cancel.Name = "cancel"; this.typegroup.Size = new System.Drawing.Size(269, 373);
this.cancel.Size = new System.Drawing.Size(112, 25); this.typegroup.TabIndex = 0;
this.cancel.TabIndex = 2; this.typegroup.TabStop = false;
this.cancel.Text = "Cancel"; this.typegroup.Text = " Thing ";
this.cancel.UseVisualStyleBackColor = true;
this.cancel.Click += new System.EventHandler(this.cancel_Click);
// //
// apply // thingtype
// //
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.thingtype.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.apply.Location = new System.Drawing.Point(320, 4); | System.Windows.Forms.AnchorStyles.Left)));
this.apply.Name = "apply"; this.thingtype.Location = new System.Drawing.Point(9, 13);
this.apply.Size = new System.Drawing.Size(112, 25); this.thingtype.Margin = new System.Windows.Forms.Padding(6);
this.apply.TabIndex = 1; this.thingtype.Name = "thingtype";
this.apply.Text = "OK"; this.thingtype.Size = new System.Drawing.Size(251, 357);
this.apply.UseVisualStyleBackColor = true; this.thingtype.TabIndex = 0;
this.apply.Click += new System.EventHandler(this.apply_Click); this.thingtype.UseMultiSelection = true;
this.thingtype.OnTypeChanged += new CodeImp.DoomBuilder.Controls.ThingBrowserControl.TypeChangedDeletegate(this.thingtype_OnTypeChanged);
this.thingtype.OnTypeDoubleClicked += new CodeImp.DoomBuilder.Controls.ThingBrowserControl.TypeDoubleClickDeletegate(this.thingtype_OnTypeDoubleClicked);
// //
// hint // settingsgroup
// //
this.hint.Image = global::CodeImp.DoomBuilder.Properties.Resources.Lightbulb; this.settingsgroup.Controls.Add(this.label3);
this.hint.Location = new System.Drawing.Point(0, 8); this.settingsgroup.Controls.Add(this.flagsvalue);
this.hint.Name = "hint"; this.settingsgroup.Controls.Add(this.missingflags);
this.hint.Size = new System.Drawing.Size(16, 16); this.settingsgroup.Controls.Add(this.flags);
this.hint.TabIndex = 3; this.settingsgroup.Location = new System.Drawing.Point(279, 3);
this.hint.TabStop = false; this.settingsgroup.Name = "settingsgroup";
this.settingsgroup.Size = new System.Drawing.Size(271, 233);
this.settingsgroup.TabIndex = 1;
this.settingsgroup.TabStop = false;
this.settingsgroup.Text = " Settings ";
// //
// hintlabel // label3
// //
this.hintlabel.AutoSize = true; this.label3.Location = new System.Drawing.Point(86, 198);
this.hintlabel.Location = new System.Drawing.Point(18, 3); this.label3.Name = "label3";
this.hintlabel.Name = "hintlabel"; this.label3.Size = new System.Drawing.Size(75, 14);
this.hintlabel.Size = new System.Drawing.Size(195, 26); this.label3.TabIndex = 16;
this.hintlabel.TabIndex = 4; this.label3.Text = "Flags value:";
this.hintlabel.Text = "Select categories or several thing types \r\nto randomly assign them to selection"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// panel // flagsvalue
// //
this.panel.BackColor = System.Drawing.SystemColors.Window; this.flagsvalue.AllowDecimal = false;
this.panel.Controls.Add(this.actiongroup); this.flagsvalue.AllowNegative = true;
this.panel.Controls.Add(this.groupBox4); this.flagsvalue.AllowRelative = true;
this.panel.Controls.Add(this.idgroup); this.flagsvalue.ForeColor = System.Drawing.SystemColors.HotTrack;
this.panel.Controls.Add(this.typegroup); this.flagsvalue.ImeMode = System.Windows.Forms.ImeMode.Off;
this.panel.Controls.Add(groupBox2); this.flagsvalue.Location = new System.Drawing.Point(177, 196);
this.panel.Controls.Add(this.settingsgroup); this.flagsvalue.Name = "flagsvalue";
this.panel.Location = new System.Drawing.Point(12, 12); this.flagsvalue.ReadOnly = true;
this.panel.Name = "panel"; this.flagsvalue.Size = new System.Drawing.Size(72, 20);
this.panel.Size = new System.Drawing.Size(553, 606); this.flagsvalue.TabIndex = 14;
this.panel.TabIndex = 5;
// //
// applypanel // missingflags
// //
this.applypanel.Controls.Add(this.cancel); this.missingflags.BackColor = System.Drawing.SystemColors.Window;
this.applypanel.Controls.Add(this.apply); this.missingflags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
this.applypanel.Controls.Add(this.hintlabel); this.missingflags.Location = new System.Drawing.Point(55, -2);
this.applypanel.Controls.Add(this.hint); this.missingflags.Name = "missingflags";
this.applypanel.Location = new System.Drawing.Point(12, 624); this.missingflags.Size = new System.Drawing.Size(16, 16);
this.applypanel.Name = "applypanel"; this.missingflags.TabIndex = 5;
this.applypanel.Size = new System.Drawing.Size(553, 32); this.missingflags.TabStop = false;
this.applypanel.TabIndex = 6; this.missingflags.Visible = false;
//
// flags
//
this.flags.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flags.AutoScroll = true;
this.flags.Columns = 2;
this.flags.Location = new System.Drawing.Point(14, 19);
this.flags.Name = "flags";
this.flags.Size = new System.Drawing.Size(251, 211);
this.flags.TabIndex = 0;
this.flags.VerticalSpacing = 1;
this.flags.OnValueChanged += new System.EventHandler(this.flags_OnValueChanged);
// //
// ThingEditForm // ThingEditForm
// //
@ -452,28 +478,28 @@ namespace CodeImp.DoomBuilder.Windows
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "ThingEditForm"; this.Name = "ThingEditForm";
this.Opacity = 1; this.Opacity = 1D;
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Thing"; this.Text = "Edit Thing";
this.Shown += new System.EventHandler(this.ThingEditForm_Shown);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ThingEditForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ThingEditForm_FormClosing);
this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.ThingEditForm_HelpRequested); this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.ThingEditForm_HelpRequested);
groupBox2.ResumeLayout(false); groupBox2.ResumeLayout(false);
groupBox2.PerformLayout(); groupBox2.PerformLayout();
this.typegroup.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.settingsgroup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.missingflags)).EndInit();
this.actiongroup.ResumeLayout(false);
this.actiongroup.PerformLayout();
this.idgroup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit();
this.panel.ResumeLayout(false);
this.applypanel.ResumeLayout(false); this.applypanel.ResumeLayout(false);
this.applypanel.PerformLayout(); this.applypanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit();
this.panel.ResumeLayout(false);
this.actiongroup.ResumeLayout(false);
this.actiongroup.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.idgroup.ResumeLayout(false);
this.typegroup.ResumeLayout(false);
this.settingsgroup.ResumeLayout(false);
this.settingsgroup.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.missingflags)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -510,5 +536,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.GroupBox typegroup; private System.Windows.Forms.GroupBox typegroup;
private System.Windows.Forms.Panel applypanel; private System.Windows.Forms.Panel applypanel;
private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol; private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol;
private System.Windows.Forms.Label label3;
private Controls.NumericTextbox flagsvalue;
} }
} }

View file

@ -142,6 +142,26 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Methods #region ================== Methods
private string evaluateFlagsValue()
{
int i = 1;
int value = 0;
foreach (CheckBox box in flags.Checkboxes)
{
if (box.CheckState == CheckState.Indeterminate) return "";
if (box.CheckState == CheckState.Checked) value += i;
i *= 2;
}
float z = General.GetByIndex(things, 0).Position.z;
foreach (Thing t in things)
{
if (t.Position.z != z) return "";
}
return (value + ((int)z << 4)).ToString();
}
// This sets up the form to edit the given things // This sets up the form to edit the given things
public void Setup(ICollection<Thing> things) public void Setup(ICollection<Thing> things)
{ {
@ -256,6 +276,7 @@ namespace CodeImp.DoomBuilder.Windows
angle_WhenTextChanged(angle, EventArgs.Empty); angle_WhenTextChanged(angle, EventArgs.Empty);
flags_OnValueChanged(flags, EventArgs.Empty); flags_OnValueChanged(flags, EventArgs.Empty);
preventmapchange = false; preventmapchange = false;
flagsvalue.Text = evaluateFlagsValue();
argscontrol.UpdateScriptControls(); //mxd argscontrol.UpdateScriptControls(); //mxd
actionhelp.UpdateAction(action.GetValue()); //mxd actionhelp.UpdateAction(action.GetValue()); //mxd
@ -526,10 +547,11 @@ namespace CodeImp.DoomBuilder.Windows
float z = posZ.GetResultFloat(thingprops[i++].Z); float z = posZ.GetResultFloat(thingprops[i++].Z);
if(useabsoluteheight && !posZ.CheckIsRelative() && t.Sector != null) if(useabsoluteheight && !posZ.CheckIsRelative() && t.Sector != null)
z -= (float)Math.Round(Sector.GetFloorPlane(t.Sector).GetZ(t.Position.x, t.Position.y), General.Map.FormatInterface.VertexDecimals); z -= (float)Math.Round(Sector.GetFloorPlane(t.Sector).GetZ(t.Position.x, t.Position.y), General.Map.FormatInterface.VertexDecimals);
t.Move(new Vector3D(t.Position.x, t.Position.y, z)); t.Move(new Vector3D(t.Position.x, t.Position.y, General.Clamp(z, General.Map.FormatInterface.MinThingHeight, General.Map.FormatInterface.MaxThingHeight)));
} }
} }
flagsvalue.Text = evaluateFlagsValue();
General.Map.IsChanged = true; General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
} }
@ -613,6 +635,7 @@ namespace CodeImp.DoomBuilder.Windows
//everything is OK //everything is OK
missingflags.Visible = false; missingflags.Visible = false;
settingsgroup.ForeColor = SystemColors.ControlText; settingsgroup.ForeColor = SystemColors.ControlText;
flagsvalue.Text = evaluateFlagsValue();
} }
#endregion #endregion

View file

@ -59,7 +59,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// set to be sky // set to be sky
if(sd.HighRequired() && sd.HighTexture == "-") if(sd.HighRequired() && sd.HighTexture == "-")
{ {
if(sd.Line.Action == 181 && sd.Line.Args[1] > 0) continue; //mxd. Ceiling slopes doesn't require upper texture // MascaraSnake: Slope handling
if(sd.Line.IsSlope && sd.Line.Args[1] > 0) continue; //mxd. Ceiling slopes doesn't require upper texture
if(sd.Other != null && sd.Other.Sector.CeilTexture != General.Map.Config.SkyFlatName) if(sd.Other != null && sd.Other.Sector.CeilTexture != General.Map.Config.SkyFlatName)
{ {
SubmitResult(new ResultMissingTexture(sd, SidedefPart.Upper)); SubmitResult(new ResultMissingTexture(sd, SidedefPart.Upper));
@ -77,7 +78,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// set to be sky // set to be sky
if(sd.LowRequired() && sd.LowTexture == "-") if(sd.LowRequired() && sd.LowTexture == "-")
{ {
if(sd.Line.Action == 181 && sd.Line.Args[0] > 0) continue; //mxd. Floor slopes doesn't require lower texture // MascaraSnake: Slope handling
if (sd.Line.IsSlope && sd.Line.Args[0] > 0) continue; //mxd. Floor slopes doesn't require lower texture
if(sd.Other != null && sd.Other.Sector.FloorTexture != General.Map.Config.SkyFlatName) if(sd.Other != null && sd.Other.Sector.FloorTexture != General.Map.Config.SkyFlatName)
{ {
SubmitResult(new ResultMissingTexture(sd, SidedefPart.Lower)); SubmitResult(new ResultMissingTexture(sd, SidedefPart.Lower));

View file

@ -228,8 +228,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. 3D floors may need updating... //mxd. 3D floors may need updating...
foreach(Sidedef s in level.sector.Sidedefs) foreach(Sidedef s in level.sector.Sidedefs)
{ {
if(s.Line.Action == 160 && s.Line.Front != null) // MascaraSnake: 3D floor handling
if(s.Line.Is3DFloor && s.Line.Front != null)
{ {
if (!General.Map.FormatInterface.HasLinedefParameters) s.Line.Set3DFloorArgs();
int sectortag = ((General.Map.UDMF || (s.Line.Args[1] & 8) != 0) ? s.Line.Args[0] : s.Line.Args[0] + (s.Line.Args[4] << 8)); int sectortag = ((General.Map.UDMF || (s.Line.Args[1] & 8) != 0) ? s.Line.Args[0] : s.Line.Args[0] + (s.Line.Args[4] << 8));
foreach(Sector sector in General.Map.Map.Sectors) foreach(Sector sector in General.Map.Map.Sectors)
{ {

View file

@ -509,8 +509,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void OnTextureChanged() private void OnTextureChanged()
{ {
//check for 3d floors //check for 3d floors
if(Sidedef.Line.Action == 160) // MascaraSnake: 3D floor handling
if(Sidedef.Line.Is3DFloor)
{ {
if (!General.Map.FormatInterface.HasLinedefParameters) Sidedef.Line.Set3DFloorArgs();
int sectortag = ((General.Map.UDMF || (Sidedef.Line.Args[1] & 8) != 0) ? Sidedef.Line.Args[0] : Sidedef.Line.Args[0] + (Sidedef.Line.Args[4] << 8)); int sectortag = ((General.Map.UDMF || (Sidedef.Line.Args[1] & 8) != 0) ? Sidedef.Line.Args[0] : Sidedef.Line.Args[0] + (Sidedef.Line.Args[4] << 8));
if(sectortag == 0) return; if(sectortag == 0) return;

View file

@ -855,8 +855,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
switch(t.Type) switch(t.Type)
{ {
case 1504: slopefloorthings.Add(t); break; //case 1504: slopefloorthings.Add(t); break;
case 1505: slopeceilingthings.Add(t); break; //case 1505: slopeceilingthings.Add(t); break;
} }
} }
} }
@ -886,34 +886,37 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Find interesting linedefs (such as line slopes) // Find interesting linedefs (such as line slopes)
foreach(Linedef l in General.Map.Map.Linedefs) foreach (Linedef l in General.Map.Map.Linedefs)
{
switch(l.Action)
{ {
// MascaraSnake: Slope handling
// ========== Plane Align (see http://zdoom.org/wiki/Plane_Align) ========== // ========== Plane Align (see http://zdoom.org/wiki/Plane_Align) ==========
case 181: if (l.IsSlope)
if(((l.Args[0] == 1) || (l.Args[1] == 1)) && (l.Front != null)) {
if (!General.Map.FormatInterface.HasLinedefParameters) l.SetSlopeArgs();
if (((l.Args[0] == 1) || (l.Args[1] == 1)) && (l.Front != null))
{ {
SectorData sd = GetSectorData(l.Front.Sector); SectorData sd = GetSectorData(l.Front.Sector);
sd.AddEffectLineSlope(l); sd.AddEffectLineSlope(l);
} }
if(((l.Args[0] == 2) || (l.Args[1] == 2)) && (l.Back != null)) if (((l.Args[0] == 2) || (l.Args[1] == 2)) && (l.Back != null))
{ {
SectorData sd = GetSectorData(l.Back.Sector); SectorData sd = GetSectorData(l.Back.Sector);
sd.AddEffectLineSlope(l); sd.AddEffectLineSlope(l);
} }
break; }
// MascaraSnake: Slope handling
// ========== Plane Copy (mxd) (see http://zdoom.org/wiki/Plane_Copy) ========== // ========== Plane Copy (mxd) (see http://zdoom.org/wiki/Plane_Copy) ==========
case 118: if (l.IsSlopeCopy)
{ {
if (!General.Map.FormatInterface.HasLinedefParameters) l.SetSlopeCopyArgs();
//check the flags... //check the flags...
bool floorCopyToBack = false; bool floorCopyToBack = false;
bool floorCopyToFront = false; bool floorCopyToFront = false;
bool ceilingCopyToBack = false; bool ceilingCopyToBack = false;
bool ceilingCopyToFront = false; bool ceilingCopyToFront = false;
if(l.Args[4] > 0 && l.Args[4] != 3 && l.Args[4] != 12) if (l.Args[4] > 0 && l.Args[4] != 3 && l.Args[4] != 12)
{ {
floorCopyToBack = (l.Args[4] & 1) == 1; floorCopyToBack = (l.Args[4] & 1) == 1;
floorCopyToFront = (l.Args[4] & 2) == 2; floorCopyToFront = (l.Args[4] & 2) == 2;
@ -922,9 +925,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Copy slope to front sector // Copy slope to front sector
if(l.Front != null) if (l.Front != null)
{ {
if( (l.Args[0] > 0 || l.Args[1] > 0) || (l.Back != null && (floorCopyToFront || ceilingCopyToFront)) ) if ((l.Args[0] > 0 || l.Args[1] > 0) || (l.Back != null && (floorCopyToFront || ceilingCopyToFront)))
{ {
SectorData sd = GetSectorData(l.Front.Sector); SectorData sd = GetSectorData(l.Front.Sector);
sd.AddEffectPlaneClopySlope(l, true); sd.AddEffectPlaneClopySlope(l, true);
@ -932,41 +935,47 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Copy slope to back sector // Copy slope to back sector
if(l.Back != null) if (l.Back != null)
{ {
if( (l.Args[2] > 0 || l.Args[3] > 0) || (l.Front != null && (floorCopyToBack || ceilingCopyToBack)) ) if ((l.Args[2] > 0 || l.Args[3] > 0) || (l.Front != null && (floorCopyToBack || ceilingCopyToBack)))
{ {
SectorData sd = GetSectorData(l.Back.Sector); SectorData sd = GetSectorData(l.Back.Sector);
sd.AddEffectPlaneClopySlope(l, false); sd.AddEffectPlaneClopySlope(l, false);
} }
} }
} }
break;
// MascaraSnake: 3D floor handling
// ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ========== // ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ==========
case 160: if (l.Is3DFloor)
if(l.Front != null)
{ {
if (l.Front != null)
{
if (!General.Map.FormatInterface.HasLinedefParameters) l.Set3DFloorArgs();
//mxd. Added hi-tag/line ID check //mxd. Added hi-tag/line ID check
int sectortag = (General.Map.UDMF || (l.Args[1] & (int)Effect3DFloor.FloorTypes.HiTagIsLineID) != 0) ? l.Args[0] : l.Args[0] + (l.Args[4] << 8); int sectortag = (General.Map.UDMF || (l.Args[1] & (int)Effect3DFloor.FloorTypes.HiTagIsLineID) != 0) ? l.Args[0] : l.Args[0] + (l.Args[4] << 8);
if(sectortags.ContainsKey(sectortag)) if (sectortags.ContainsKey(sectortag))
{ {
List<Sector> sectors = sectortags[sectortag]; List<Sector> sectors = sectortags[sectortag];
foreach(Sector s in sectors) foreach (Sector s in sectors)
{ {
SectorData sd = GetSectorData(s); SectorData sd = GetSectorData(s);
sd.AddEffect3DFloor(l); sd.AddEffect3DFloor(l);
} }
} }
} }
break;
}
if (General.Map.FormatInterface.HasLinedefParameters)
{
switch (l.Action)
{
// ========== Transfer Brightness (see http://zdoom.org/wiki/ExtraFloor_LightOnly) ========= // ========== Transfer Brightness (see http://zdoom.org/wiki/ExtraFloor_LightOnly) =========
case 50: case 50:
if(l.Front != null && sectortags.ContainsKey(l.Args[0])) if (l.Front != null && sectortags.ContainsKey(l.Args[0]))
{ {
List<Sector> sectors = sectortags[l.Args[0]]; List<Sector> sectors = sectortags[l.Args[0]];
foreach(Sector s in sectors) foreach (Sector s in sectors)
{ {
SectorData sd = GetSectorData(s); SectorData sd = GetSectorData(s);
sd.AddEffectBrightnessLevel(l); sd.AddEffectBrightnessLevel(l);
@ -976,10 +985,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// ========== mxd. Transfer Floor Brightness (see http://www.zdoom.org/w/index.php?title=Transfer_FloorLight) ========= // ========== mxd. Transfer Floor Brightness (see http://www.zdoom.org/w/index.php?title=Transfer_FloorLight) =========
case 210: case 210:
if(l.Front != null && sectortags.ContainsKey(l.Args[0])) if (l.Front != null && sectortags.ContainsKey(l.Args[0]))
{ {
List<Sector> sectors = sectortags[l.Args[0]]; List<Sector> sectors = sectortags[l.Args[0]];
foreach(Sector s in sectors) foreach (Sector s in sectors)
{ {
SectorData sd = GetSectorData(s); SectorData sd = GetSectorData(s);
sd.AddEffectTransferFloorBrightness(l); sd.AddEffectTransferFloorBrightness(l);
@ -989,10 +998,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// ========== mxd. Transfer Ceiling Brightness (see http://www.zdoom.org/w/index.php?title=Transfer_CeilingLight) ========= // ========== mxd. Transfer Ceiling Brightness (see http://www.zdoom.org/w/index.php?title=Transfer_CeilingLight) =========
case 211: case 211:
if(l.Front != null && sectortags.ContainsKey(l.Args[0])) if (l.Front != null && sectortags.ContainsKey(l.Args[0]))
{ {
List<Sector> sectors = sectortags[l.Args[0]]; List<Sector> sectors = sectortags[l.Args[0]];
foreach(Sector s in sectors) foreach (Sector s in sectors)
{ {
SectorData sd = GetSectorData(s); SectorData sd = GetSectorData(s);
sd.AddEffectTransferCeilingBrightness(l); sd.AddEffectTransferCeilingBrightness(l);
@ -1000,6 +1009,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
break; break;
} }
}
} }
// Find interesting things (such as sector slopes) // Find interesting things (such as sector slopes)
@ -3589,12 +3599,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
//assign/remove action //assign/remove action
if(vg.GeometryType == VisualGeometryType.WALL_LOWER) if(vg.GeometryType == VisualGeometryType.WALL_LOWER)
{ {
if(vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.Action == 181 && vg.Sidedef.Line.Args[0] == 0)) // MascaraSnake: Slope handling
if(vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsSlope && vg.Sidedef.Line.Args[0] == 0))
{ {
//check if the sector already has floor slopes //check if the sector already has floor slopes
foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs) foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs)
{ {
if(side == vg.Sidedef || side.Line.Action != 181) continue; // MascaraSnake: Slope handling
if(side == vg.Sidedef || !side.Line.IsSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2); int arg = (side == side.Line.Front ? 1 : 2);
@ -3616,12 +3628,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
else if(vg.GeometryType == VisualGeometryType.WALL_UPPER) else if(vg.GeometryType == VisualGeometryType.WALL_UPPER)
{ {
if(vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.Action == 181 && vg.Sidedef.Line.Args[1] == 0)) // MascaraSnake: Slope handling
if (vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsSlope && vg.Sidedef.Line.Args[1] == 0))
{ {
//check if the sector already has ceiling slopes //check if the sector already has ceiling slopes
foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs) foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs)
{ {
if(side == vg.Sidedef || side.Line.Action != 181) continue; // MascaraSnake: Slope handling
if (side == vg.Sidedef || !side.Line.IsSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2); int arg = (side == side.Line.Front ? 1 : 2);
@ -3646,7 +3660,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
//check if the sector has ceiling slopes //check if the sector has ceiling slopes
foreach(Sidedef side in vg.Sector.Sector.Sidedefs) foreach(Sidedef side in vg.Sector.Sector.Sidedefs)
{ {
if(side.Line.Action != 181) continue; // MascaraSnake: Slope handling
if (!side.Line.IsSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2); int arg = (side == side.Line.Front ? 1 : 2);
@ -3667,7 +3682,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
//check if the sector has floor slopes //check if the sector has floor slopes
foreach(Sidedef side in vg.Sector.Sector.Sidedefs) foreach(Sidedef side in vg.Sector.Sector.Sidedefs)
{ {
if(side.Line.Action != 181) continue; // MascaraSnake: Slope handling
if (!side.Line.IsSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2); int arg = (side == side.Line.Front ? 1 : 2);

View file

@ -164,7 +164,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
ceiling.splitsides = (!clipsides && !ignorebottomheight); // if "ignorebottomheight" flag is set, both ceiling and floor will be at the same level and sidedef clipping with floor level will fail resulting in incorrect light props transfer in some cases ceiling.splitsides = (!clipsides && !ignorebottomheight); // if "ignorebottomheight" flag is set, both ceiling and floor will be at the same level and sidedef clipping with floor level will fail resulting in incorrect light props transfer in some cases
//mxd. Check slopes, cause GZDoom can't handle sloped translucent 3d floors... //mxd. Check slopes, cause GZDoom can't handle sloped translucent 3d floors...
sloped3dfloor = ((alpha < 255 || renderadditive) && //MascaraSnake: SRB2 can, so only check in Doom
sloped3dfloor = (!General.Map.FormatInterface.HasTranslucent3DFloors && (alpha < 255 || renderadditive) &&
(Angle2D.RadToDeg(ceiling.plane.Normal.GetAngleZ()) != 270 || (Angle2D.RadToDeg(ceiling.plane.Normal.GetAngleZ()) != 270 ||
Angle2D.RadToDeg(floor.plane.Normal.GetAngleZ()) != 90)); Angle2D.RadToDeg(floor.plane.Normal.GetAngleZ()) != 90));

View file

@ -576,7 +576,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef side in Sector.Sector.Sidedefs) foreach(Sidedef side in Sector.Sector.Sidedefs)
{ {
if(side.Line.Action == 181) // MascaraSnake: Slope handling
if(side.Line.IsSlope)
{ {
if(side.Line.Args[1] == 1 && side.Line.Front != null && side.Line.Front == side) if(side.Line.Args[1] == 1 && side.Line.Front != null && side.Line.Front == side)
{ {

View file

@ -542,7 +542,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef side in Sector.Sector.Sidedefs) foreach(Sidedef side in Sector.Sector.Sidedefs)
{ {
if(side.Line.Action == 181) // MascaraSnake: Slope handling
if(side.Line.IsSlope)
{ {
if(side.Line.Args[0] == 1 && side.Line.Front != null && side.Line.Front == side) if(side.Line.Args[0] == 1 && side.Line.Front != null && side.Line.Front == side)
{ {