2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#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.Collections.Generic;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
{
|
2010-08-15 13:45:43 +00:00
|
|
|
// Vertex
|
|
|
|
public class VertexProperties
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
public static bool ZCeiling = true; //mxd
|
|
|
|
public static bool ZFloor = true; //mxd
|
|
|
|
public static bool Universal_Fields = true; //mxd
|
|
|
|
|
|
|
|
private readonly UniFields fields;
|
|
|
|
private readonly float zceiling; //mxd
|
|
|
|
private readonly float zfloor; //mxd
|
2010-08-15 13:45:43 +00:00
|
|
|
|
|
|
|
public VertexProperties(Vertex v)
|
|
|
|
{
|
|
|
|
fields = new UniFields(v.Fields);
|
2013-07-08 13:13:28 +00:00
|
|
|
zceiling = v.ZCeiling; //mxd
|
|
|
|
zfloor = v.ZFloor; //mxd
|
2010-08-15 13:45:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Apply(Vertex v)
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
if (ZCeiling) v.ZCeiling = zceiling; //mxd
|
|
|
|
if (ZFloor) v.ZFloor = zfloor; //mxd
|
|
|
|
if (Universal_Fields) {
|
|
|
|
v.Fields.BeforeFieldsChange();
|
|
|
|
v.Fields.Clear();
|
|
|
|
foreach (KeyValuePair<string, UniValue> uv in fields)
|
|
|
|
v.Fields.Add(uv.Key, new UniValue(uv.Value));
|
|
|
|
}
|
2010-08-15 13:45:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Sector
|
|
|
|
public class SectorProperties
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
public static bool Floor_Height = true; //mxd
|
|
|
|
public static bool Ceiling_Height = true; //mxd
|
|
|
|
public static bool Floor_Texture = true; //mxd
|
|
|
|
public static bool Ceiling_Texture = true; //mxd
|
|
|
|
public static bool Brightness = true; //mxd
|
|
|
|
public static bool Tag = true; //mxd
|
|
|
|
public static bool Special = true; //mxd
|
|
|
|
public static bool Flags = true; //mxd
|
|
|
|
public static bool Universal_Fields = true; //mxd
|
|
|
|
|
|
|
|
private readonly int floorheight;
|
|
|
|
private readonly int ceilheight;
|
|
|
|
private readonly string floortexture;
|
|
|
|
private readonly string ceilingtexture;
|
|
|
|
private readonly int effect;
|
|
|
|
private readonly int brightness;
|
|
|
|
private readonly int tag;
|
|
|
|
private readonly UniFields fields;
|
|
|
|
private readonly Dictionary<string, bool> flags; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
public SectorProperties(Sector s)
|
|
|
|
{
|
|
|
|
floorheight = s.FloorHeight;
|
|
|
|
ceilheight = s.CeilHeight;
|
|
|
|
floortexture = s.FloorTexture;
|
|
|
|
ceilingtexture = s.CeilTexture;
|
|
|
|
brightness = s.Brightness;
|
2010-08-15 13:45:43 +00:00
|
|
|
effect = s.Effect;
|
2009-04-19 18:07:22 +00:00
|
|
|
tag = s.Tag;
|
2010-08-15 13:45:43 +00:00
|
|
|
fields = new UniFields(s.Fields);
|
2013-09-11 08:49:45 +00:00
|
|
|
flags = s.GetFlags(); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Apply(Sector s)
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
if (Floor_Height) s.FloorHeight = floorheight;
|
|
|
|
if (Ceiling_Height) s.CeilHeight = ceilheight;
|
|
|
|
if (Floor_Texture) s.SetFloorTexture(floortexture);
|
|
|
|
if (Ceiling_Texture) s.SetCeilTexture(ceilingtexture);
|
|
|
|
if (Brightness) s.Brightness = brightness;
|
|
|
|
if (Tag) s.Tag = tag;
|
|
|
|
if (Special) s.Effect = effect;
|
|
|
|
if (Flags) {
|
|
|
|
s.ClearFlags(); //mxd
|
|
|
|
foreach (KeyValuePair<string, bool> f in flags) //mxd
|
|
|
|
s.SetFlag(f.Key, f.Value);
|
|
|
|
}
|
|
|
|
if (Universal_Fields) {
|
|
|
|
s.Fields.BeforeFieldsChange();
|
|
|
|
s.Fields.Clear();
|
|
|
|
foreach (KeyValuePair<string, UniValue> v in fields)
|
|
|
|
s.Fields.Add(v.Key, new UniValue(v.Value));
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
2010-08-15 13:45:43 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Sidedef
|
|
|
|
public class SidedefProperties
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
public static bool Upper_Texture = true; //mxd
|
|
|
|
public static bool Middle_Texture = true; //mxd
|
|
|
|
public static bool Lower_Texture = true; //mxd
|
|
|
|
public static bool OffsetX = true; //mxd
|
|
|
|
public static bool OffsetY = true; //mxd
|
|
|
|
public static bool Flags = true; //mxd
|
|
|
|
public static bool Universal_Fields = true; //mxd
|
|
|
|
|
|
|
|
private readonly string hightexture;
|
|
|
|
private readonly string middletexture;
|
|
|
|
private readonly string lowtexture;
|
|
|
|
private readonly int offsetx;
|
|
|
|
private readonly int offsety;
|
|
|
|
private readonly UniFields fields;
|
|
|
|
private readonly Dictionary<string, bool> flags; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
public SidedefProperties(Sidedef s)
|
|
|
|
{
|
|
|
|
hightexture = s.HighTexture;
|
|
|
|
middletexture = s.MiddleTexture;
|
|
|
|
lowtexture = s.LowTexture;
|
|
|
|
offsetx = s.OffsetX;
|
|
|
|
offsety = s.OffsetY;
|
2010-08-15 13:45:43 +00:00
|
|
|
fields = new UniFields(s.Fields);
|
2013-09-11 08:49:45 +00:00
|
|
|
flags = s.GetFlags(); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Apply(Sidedef s)
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
if (Upper_Texture) s.SetTextureHigh(hightexture);
|
|
|
|
if (Middle_Texture) s.SetTextureMid(middletexture);
|
|
|
|
if (Lower_Texture) s.SetTextureLow(lowtexture);
|
|
|
|
if (OffsetX) s.OffsetX = offsetx;
|
|
|
|
if (OffsetY) s.OffsetY = offsety;
|
|
|
|
if (Flags) {
|
|
|
|
s.ClearFlags(); //mxd
|
|
|
|
foreach (KeyValuePair<string, bool> f in flags) //mxd
|
|
|
|
s.SetFlag(f.Key, f.Value);
|
|
|
|
}
|
|
|
|
if (Universal_Fields) {
|
|
|
|
s.Fields.BeforeFieldsChange();
|
|
|
|
s.Fields.Clear();
|
|
|
|
foreach (KeyValuePair<string, UniValue> v in fields)
|
|
|
|
s.Fields.Add(v.Key, new UniValue(v.Value));
|
|
|
|
}
|
2010-08-15 13:45:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Linedef
|
|
|
|
public class LinedefProperties
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
public static bool Sidedef_Properties = true; //mxd
|
|
|
|
public static bool Action = true; //mxd
|
|
|
|
public static bool Activation = true; //mxd
|
|
|
|
public static bool Tag = true; //mxd
|
|
|
|
public static bool Flags = true; //mxd
|
|
|
|
public static bool Universal_Fields = true; //mxd
|
|
|
|
|
|
|
|
private readonly SidedefProperties front;
|
|
|
|
private readonly SidedefProperties back;
|
|
|
|
private readonly Dictionary<string, bool> flags;
|
|
|
|
private readonly int action;
|
|
|
|
private readonly int activate;
|
|
|
|
private readonly int tag;
|
|
|
|
private readonly int[] args;
|
|
|
|
private readonly UniFields fields;
|
2010-08-15 13:45:43 +00:00
|
|
|
|
|
|
|
public LinedefProperties(Linedef l)
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
front = (l.Front != null ? new SidedefProperties(l.Front) : null);
|
|
|
|
back = (l.Back != null ? new SidedefProperties(l.Back) : null);
|
2010-08-15 13:45:43 +00:00
|
|
|
|
|
|
|
flags = l.GetFlags();
|
|
|
|
action = l.Action;
|
|
|
|
activate = l.Activate;
|
|
|
|
tag = l.Tag;
|
|
|
|
args = (int[])(l.Args.Clone());
|
|
|
|
fields = new UniFields(l.Fields);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Apply(Linedef l)
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
if (Sidedef_Properties) {
|
|
|
|
if ((front != null) && (l.Front != null)) front.Apply(l.Front);
|
|
|
|
if ((back != null) && (l.Back != null)) back.Apply(l.Back);
|
|
|
|
}
|
|
|
|
if (Flags) {
|
|
|
|
l.ClearFlags();
|
|
|
|
foreach (KeyValuePair<string, bool> f in flags)
|
|
|
|
l.SetFlag(f.Key, f.Value);
|
|
|
|
}
|
|
|
|
if (Activation) l.Activate = activate;
|
|
|
|
if (Tag)l.Tag = tag;
|
|
|
|
if (Action) {
|
|
|
|
l.Action = action;
|
|
|
|
for (int i = 0; i < l.Args.Length; i++)
|
|
|
|
l.Args[i] = args[i];
|
|
|
|
}
|
|
|
|
if (Universal_Fields) {
|
|
|
|
l.Fields.BeforeFieldsChange();
|
|
|
|
l.Fields.Clear();
|
|
|
|
foreach (KeyValuePair<string, UniValue> v in fields)
|
|
|
|
l.Fields.Add(v.Key, new UniValue(v.Value));
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Thing
|
|
|
|
public class ThingProperties
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
public static bool Type = true; //mxd
|
|
|
|
public static bool Angle = true; //mxd
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
public static bool Pitch = true; //mxd
|
|
|
|
public static bool Roll = true; //mxd
|
|
|
|
public static bool Scale = true; //mxd
|
2014-04-09 10:16:33 +00:00
|
|
|
public static bool Action = true; //mxd
|
|
|
|
public static bool Tag = true; //mxd
|
|
|
|
public static bool Flags = true; //mxd
|
|
|
|
public static bool Universal_Fields = true; //mxd
|
|
|
|
|
|
|
|
private readonly int type;
|
|
|
|
private readonly float angle;
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
private readonly int pitch; //mxd
|
|
|
|
private readonly int roll; //mxd
|
|
|
|
private readonly float scalex; //mxd
|
|
|
|
private readonly float scaley; //mxd
|
2014-04-09 10:16:33 +00:00
|
|
|
private readonly Dictionary<string, bool> flags;
|
|
|
|
private readonly int tag;
|
|
|
|
private readonly int action;
|
|
|
|
private readonly int[] args;
|
|
|
|
private readonly UniFields fields;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
public ThingProperties(Thing t)
|
|
|
|
{
|
|
|
|
type = t.Type;
|
|
|
|
angle = t.Angle;
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
pitch = t.Pitch;
|
|
|
|
roll = t.Roll;
|
|
|
|
scalex = t.ScaleX;
|
|
|
|
scaley = t.ScaleY;
|
2009-06-11 21:21:20 +00:00
|
|
|
flags = t.GetFlags();
|
2009-04-19 18:07:22 +00:00
|
|
|
tag = t.Tag;
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
action = t.Action;
|
2009-04-19 18:07:22 +00:00
|
|
|
args = (int[])(t.Args.Clone());
|
2010-08-15 13:45:43 +00:00
|
|
|
fields = new UniFields(t.Fields);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Apply(Thing t)
|
|
|
|
{
|
2014-04-09 10:16:33 +00:00
|
|
|
if (Type) t.Type = type;
|
|
|
|
if (Angle) t.Rotate(angle);
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
if (Pitch) t.SetPitch(pitch);
|
|
|
|
if (Roll) t.SetRoll(roll);
|
|
|
|
if (Scale) t.SetScale(scalex, scaley);
|
2014-04-09 10:16:33 +00:00
|
|
|
if (Flags) {
|
|
|
|
t.ClearFlags();
|
|
|
|
foreach (KeyValuePair<string, bool> f in flags)
|
|
|
|
t.SetFlag(f.Key, f.Value);
|
|
|
|
}
|
|
|
|
if (Tag) t.Tag = tag;
|
|
|
|
if (Action) {
|
|
|
|
t.Action = action;
|
|
|
|
for (int i = 0; i < t.Args.Length; i++)
|
|
|
|
t.Args[i] = args[i];
|
|
|
|
}
|
|
|
|
if (Universal_Fields) {
|
|
|
|
t.Fields.BeforeFieldsChange();
|
|
|
|
t.Fields.Clear();
|
|
|
|
foreach (KeyValuePair<string, UniValue> v in fields)
|
|
|
|
t.Fields.Add(v.Key, new UniValue(v.Value));
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|