Textures with names starting with "-" were not processed correctly.

Textures were not loaded properly from PK3/PK7 archives.
Visual mode: restored ability to remove textures using Delete action.
Visual mode: fixed several bugs in Cut/Copy/Paste things actions.
Visual mode: vavoom style 3d floors were not displayed properly.
Visual mode, 3d floors: added support for "RestrictLighting" (2) flag.
Visual mode, 3d floors: inner sides of 3d floors with "swimmable"/"render inside" flags used incorrect brightness value.
This commit is contained in:
MaxED 2013-07-31 12:38:47 +00:00
parent 12d9e1b08f
commit 993328b57b
26 changed files with 178 additions and 166 deletions

View file

@ -2906,12 +2906,12 @@ zdoom
type = 12;
enum
{
1 = "Disables light effects";
2 = "Restricts light Inside";
4 = "Fog Effect";
8 = "Ignores bottom height";
16 = "Uses upper texture";
32 = "Uses lower texture";
1 = "Disable light effects";
2 = "Restrict light inside";
4 = "Fog effect";
8 = "Ignore bottom height";
16 = "Use upper texture";
32 = "Use lower texture";
64 = "Additive transluency";
}
}

View file

@ -117,13 +117,13 @@ namespace CodeImp.DoomBuilder.Controls
}
else if(textbox.AllowDecimal)
{
float newvalue = textbox.GetResultFloat(0.0f) - (float)(buttons.Value * stepsizeFloat);
float newvalue = textbox.GetResultFloat(0.0f) - (buttons.Value * stepsizeFloat);
if((newvalue < 0.0f) && !textbox.AllowNegative) newvalue = 0.0f;
textbox.Text = newvalue.ToString();
textbox.Text = newvalue.ToString(General.Map.FormatInterface.DecimalsFormat);
}
else
{
int newvalue = (int)(textbox.GetResult(0) - (buttons.Value * stepsize));
int newvalue = textbox.GetResult(0) - (buttons.Value * stepsize);
if((newvalue < 0) && !textbox.AllowNegative) newvalue = 0;
textbox.Text = newvalue.ToString();
}

View file

@ -39,7 +39,7 @@ namespace CodeImp.DoomBuilder.Controls
protected override Image FindImage(string imagename)
{
// Check if name is a "none" texture
if((imagename.Length < 1) || (imagename[0] == '-'))
if((imagename.Length < 1) || (imagename == "-"))
{
DisplayImageSize(0, 0); //mxd

View file

@ -431,15 +431,13 @@ namespace CodeImp.DoomBuilder.Controls
private void DisplaySidedefTexture(Panel panel, Label label, string name, bool required)
{
// Check if name is a "none" texture
if((name.Length < 1) || (name[0] == '-'))
if((name.Length < 1) || (name == "-"))
{
label.Visible = false; //mxd
// Determine image to show
if(required)
panel.BackgroundImage = CodeImp.DoomBuilder.Properties.Resources.MissingTexture;
else
panel.BackgroundImage = null;
if(required)
General.DisplayZoomedImage(panel, Properties.Resources.MissingTexture);
}
else
{
@ -453,24 +451,7 @@ namespace CodeImp.DoomBuilder.Controls
}
// Set the image
panel.BackgroundImage = texture.GetPreview();
}
// Image not null?
if(panel.BackgroundImage != null)
{
// Small enough to fit in panel?
if((panel.BackgroundImage.Size.Width < panel.ClientRectangle.Width) &&
(panel.BackgroundImage.Size.Height < panel.ClientRectangle.Height))
{
// Display centered
panel.BackgroundImageLayout = ImageLayout.Center;
}
else
{
// Display zoomed
panel.BackgroundImageLayout = ImageLayout.Zoom;
}
General.DisplayZoomedImage(panel, texture.GetPreview());
}
}
}

View file

@ -63,14 +63,22 @@ namespace CodeImp.DoomBuilder.Controls
floorname.Text = s.FloorTexture;
ceilingname.Text = s.CeilTexture;
ImageData floorImage = General.Map.Data.GetFlatImage(s.FloorTexture); //mxd
ImageData ceilingImage = General.Map.Data.GetFlatImage(s.CeilTexture); //mxd
//mxd. Texture info
if ((s.FloorTexture.Length < 1) || (s.FloorTexture == "-")){
General.DisplayZoomedImage(floortex, Properties.Resources.MissingTexture);
} else {
ImageData floorImage = General.Map.Data.GetFlatImage(s.FloorTexture);
DisplayTextureSize(labelFloorTextureSize, floorImage);
General.DisplayZoomedImage(floortex, floorImage.GetPreview());
}
DisplayTextureSize(labelFloorTextureSize, floorImage); //mxd
DisplayTextureSize(labelCeilTextureSize, ceilingImage); //mxd
General.DisplayZoomedImage(floortex, floorImage.GetPreview());
General.DisplayZoomedImage(ceilingtex, ceilingImage.GetPreview());
if((s.CeilTexture.Length < 1) || (s.CeilTexture == "-")) {
General.DisplayZoomedImage(ceilingtex, Properties.Resources.MissingTexture);
} else {
ImageData ceilingImage = General.Map.Data.GetFlatImage(s.CeilTexture);
DisplayTextureSize(labelCeilTextureSize, ceilingImage); //mxd
General.DisplayZoomedImage(ceilingtex, ceilingImage.GetPreview());
}
//mxd
bool showExtededFloorInfo = false;

View file

@ -46,7 +46,7 @@ namespace CodeImp.DoomBuilder.Controls
protected override Image FindImage(string imagename)
{
// Check if name is a "none" texture
if((imagename.Length < 1) || (imagename[0] == '-'))
if((imagename.Length < 1) || (imagename == "-"))
{
DisplayImageSize(0, 0); //mxd

View file

@ -29,7 +29,6 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Variables
private PK3Reader datareader;
//private string filepathname;
private int probableformat;
#endregion
@ -41,9 +40,8 @@ namespace CodeImp.DoomBuilder.Data
{
// Initialize
this.datareader = datareader;
//this.filepathname = filepathname;
this.fullName = filepathname;
SetName(name);
this.fullName = filepathname;
if(asflat)
{

View file

@ -1636,7 +1636,7 @@ namespace CodeImp.DoomBuilder.Geometry
// Apply texturing
if(j.sidedef.HighRequired() && j.sidedef.LongHighTexture == originaltexture) j.sidedef.SetTextureHigh(filltexture.Name);
if((((j.sidedef.MiddleTexture.Length > 0) && (j.sidedef.MiddleTexture[0] != '-')) || j.sidedef.MiddleRequired()) &&
if((((j.sidedef.MiddleTexture.Length > 0) && (j.sidedef.MiddleTexture != "-")) || j.sidedef.MiddleRequired()) &&
(j.sidedef.LongMiddleTexture == originaltexture)) j.sidedef.SetTextureMid(filltexture.Name);
if(j.sidedef.LowRequired() && j.sidedef.LongLowTexture == originaltexture) j.sidedef.SetTextureLow(filltexture.Name);
j.sidedef.Marked = true;
@ -1707,7 +1707,7 @@ namespace CodeImp.DoomBuilder.Geometry
{
return ((sd.LongHighTexture == texturelongname) && sd.HighRequired()) ||
((sd.LongLowTexture == texturelongname) && sd.LowRequired()) ||
((sd.LongMiddleTexture == texturelongname) && (sd.MiddleRequired() || ((sd.MiddleTexture.Length > 0) && (sd.MiddleTexture[0] != '-')))) ;
((sd.LongMiddleTexture == texturelongname) && (sd.MiddleRequired() || ((sd.MiddleTexture.Length > 0) && (sd.MiddleTexture != "-")))) ;
}
#endregion

View file

@ -465,7 +465,7 @@ namespace CodeImp.DoomBuilder.Map
s.BeforePropsChange();
// Upper texture set?
if((texnamehigh.Length > 0) && (texnamehigh[0] != '-'))
if((texnamehigh.Length > 0) && (texnamehigh != "-"))
{
// Copy upper texture
s.texnamehigh = texnamehigh;
@ -476,7 +476,7 @@ namespace CodeImp.DoomBuilder.Map
}
// Middle texture set?
if((texnamemid.Length > 0) && (texnamemid[0] != '-'))
if((texnamemid.Length > 0) && (texnamemid != "-"))
{
// Copy middle texture
s.texnamemid = texnamemid;
@ -487,7 +487,7 @@ namespace CodeImp.DoomBuilder.Map
}
// Lower texture set?
if((texnamelow.Length > 0) && (texnamelow[0] != '-'))
if((texnamelow.Length > 0) && (texnamelow != "-"))
{
// Copy middle texture
s.texnamelow = texnamelow;

View file

@ -57,7 +57,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Check upper texture. Also make sure not to return a false
// positive if the sector on the other side has the ceiling
// set to be sky
if (sd.HighRequired() && sd.HighTexture[0] == '-')
if (sd.HighRequired() && sd.HighTexture == "-")
{
if (sd.Other != null && sd.Other.Sector.CeilTexture != General.Map.Config.SkyFlatName)
{
@ -66,7 +66,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Check middle texture
if (sd.MiddleRequired() && sd.MiddleTexture[0] == '-')
if (sd.MiddleRequired() && sd.MiddleTexture == "-")
{
SubmitResult(new ResultMissingTexture(sd, SidedefPart.Middle));
}
@ -74,7 +74,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Check lower texture. Also make sure not to return a false
// positive if the sector on the other side has the floor
// set to be sky
if (sd.LowRequired() && sd.LowTexture[0] == '-')
if (sd.LowRequired() && sd.LowTexture == "-")
{
if (sd.Other != null && sd.Other.Sector.FloorTexture != General.Map.Config.SkyFlatName)
{

View file

@ -55,21 +55,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef sd in General.Map.Map.Sidedefs)
{
// Check upper texture
if(sd.HighRequired() && ((sd.HighTexture.Length < 1) || (sd.HighTexture[0] != '-')))
if(sd.HighRequired() && ((sd.HighTexture.Length < 1) || (sd.HighTexture != "-")))
{
if(!General.Map.Data.GetTextureExists(sd.LongHighTexture))
SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Upper));
}
// Check middle texture
if(sd.MiddleRequired() && ((sd.MiddleTexture.Length < 1) || (sd.MiddleTexture[0] != '-')))
if(sd.MiddleRequired() && ((sd.MiddleTexture.Length < 1) || (sd.MiddleTexture != "-")))
{
if(!General.Map.Data.GetTextureExists(sd.LongMiddleTexture))
SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Middle));
}
// Check lower texture
if(sd.LowRequired() && ((sd.LowTexture.Length < 1) || (sd.LowTexture[0] != '-')))
if(sd.LowRequired() && ((sd.LowTexture.Length < 1) || (sd.LowTexture != "-")))
{
if(!General.Map.Data.GetTextureExists(sd.LongLowTexture))
SubmitResult(new ResultUnknownTexture(sd, SidedefPart.Lower));

View file

@ -365,7 +365,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnCopyTextureOffsets() { }
public virtual void OnPasteTextureOffsets() { }
public virtual void OnInsert() { }
public virtual void OnDelete() { }
protected virtual void SetTexture(string texturename) { }
public virtual void ApplyUpperUnpegged(bool set) { }
public virtual void ApplyLowerUnpegged(bool set) { }
@ -452,6 +451,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
}
// Delete texture
public virtual void OnDelete() {
// Remove texture
mode.CreateUndo("Delete texture");
mode.SetActionResult("Deleted a texture.");
SetTexture("-");
// Update
Sector.Changed = true;
}
// Processing
public virtual void OnProcess(float deltatime)

View file

@ -511,7 +511,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnInsert()
{
// No middle texture yet?
if(!Sidedef.MiddleRequired() && (string.IsNullOrEmpty(Sidedef.MiddleTexture) || (Sidedef.MiddleTexture[0] == '-')))
if(!Sidedef.MiddleRequired() && (string.IsNullOrEmpty(Sidedef.MiddleTexture) || (Sidedef.MiddleTexture == "-")))
{
// Make it now
mode.CreateUndo("Create middle texture");
@ -523,7 +523,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Sector.Changed = true;
// Other side as well
if(string.IsNullOrEmpty(Sidedef.Other.MiddleTexture) || (Sidedef.Other.MiddleTexture[0] == '-'))
if(string.IsNullOrEmpty(Sidedef.Other.MiddleTexture) || (Sidedef.Other.MiddleTexture == "-"))
{
Sidedef.Other.SetTextureMid(General.Settings.DefaultTexture);

View file

@ -75,6 +75,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private Dictionary<Sector, SectorData> sectordata;
private Dictionary<Thing, ThingData> thingdata;
private Dictionary<Vertex, VertexData> vertexdata; //mxd
//private Dictionary<Thing, EffectDynamicLight> lightdata; //mxd
// This is true when a selection was made because the action is performed
// on an object that was not selected. In this case the previous selection
@ -520,52 +521,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
PostAction();
}
//mxd
private void deleteSelectedThings() {
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, true, false);
if(objs.Count == 0) return;
General.Map.UndoRedo.ClearAllRedos();
string rest = objs.Count + " thing" + (objs.Count > 1 ? "s." : ".");
//make undo
General.Map.UndoRedo.CreateUndo("Delete " + rest);
General.Interface.DisplayStatus(StatusType.Info, "Deleted " + rest);
//clear selection
ClearSelection();
PreActionNoChange();
foreach(IVisualEventReceiver i in objs) i.OnDelete(); //are they deleted from BlockMap automatically?..
// Update cache values
General.Map.IsChanged = true;
General.Map.ThingsFilter.Update();
PostAction();
}
//mxd
private void deleteSelectedVertices() {
if(!General.Map.UDMF) return;
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, false, true);
if(objs.Count == 0) return;
General.Map.UndoRedo.ClearAllRedos();
string description = "Reset height of " + objs.Count + (objs.Count > 1 ? " vertices." : " vertex.");
//make undo
General.Map.UndoRedo.CreateUndo(description);
General.Interface.DisplayStatus(StatusType.Info, description);
//clear selection
ClearSelection();
PreActionNoChange();
foreach(IVisualEventReceiver i in objs) {
((BaseVisualVertex)i).Vertex.Fields.BeforeFieldsChange();
i.OnDelete();
}
PostAction();
}
//mxd
private Vector3D[] translateCoordinates(Vector3D[] coordinates, Vector2D direction, bool absolutePosition) {
if (coordinates.Length == 0) return null;
@ -731,6 +686,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
return vertexdata[v];
}
//mxd
/*internal EffectDynamicLight GetDynamicLightData(Thing t) {
if(!lightdata.ContainsKey(t))
lightdata[t] = new EffectDynamicLight(this, t);
return lightdata[t];
}*/
//mxd
internal void UpdateVertexHandle(Vertex v) {
if(!vertices.ContainsKey(v))
@ -762,6 +724,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Dictionary<int, List<Sector>> sectortags = new Dictionary<int, List<Sector>>();
sectordata = new Dictionary<Sector, SectorData>(General.Map.Map.Sectors.Count);
thingdata = new Dictionary<Thing, ThingData>(General.Map.Map.Things.Count);
//lightdata = new Dictionary<Thing, EffectDynamicLight>(General.Map.Map.Things.Count); //mxd
if(General.Map.UDMF) {
vertexdata = new Dictionary<Vertex, VertexData>(General.Map.Map.Vertices.Count); //mxd
@ -2481,10 +2444,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
[BeginAction("deleteitem", BaseAction = true)]
public void DeleteSelectedObjects()
public void Delete()
{
deleteSelectedThings();
deleteSelectedVertices();
PreAction(UndoGroup.None);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
foreach(IVisualEventReceiver i in objs) i.OnDelete();
PostAction();
ClearSelection();
}
//mxd
@ -2508,7 +2475,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
[BeginAction("cutselection", BaseAction = true)]
public void CutSelection() {
CopySelection();
deleteSelectedThings();
//Create undo
string rest = copyBuffer.Count + " thing" + (copyBuffer.Count > 1 ? "s." : ".");
CreateUndo("Cut " + rest);
General.Interface.DisplayStatus(StatusType.Info, "Cut " + rest);
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, true, false);
foreach (IVisualEventReceiver i in objs) {
BaseVisualThing thing = i as BaseVisualThing;
thing.Thing.Fields.BeforeFieldsChange();
thing.Thing.Dispose();
thing.Dispose();
}
General.Map.IsChanged = true;
General.Map.ThingsFilter.Update();
}
//mxd. We'll just use currently selected objects
@ -2526,9 +2508,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
return;
}
General.Map.UndoRedo.ClearAllRedos();
string rest = copyBuffer.Count + " thing" + (copyBuffer.Count > 1 ? "s." : ".");
General.Map.UndoRedo.CreateUndo("Paste " + rest);
General.Map.UndoRedo.CreateUndo("Paste " + rest);
General.Interface.DisplayStatus(StatusType.Info, "Pasted " + rest);
PreActionNoChange();
@ -2996,7 +2977,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
bool matchtop = (!j.sidedef.Marked && (j.sidedef.LongHighTexture == texture.LongName) && j.sidedef.HighRequired());
bool matchbottom = (!j.sidedef.Marked && (j.sidedef.LongLowTexture == texture.LongName) && j.sidedef.LowRequired());
bool matchmid = ((j.controlSide.LongMiddleTexture == texture.LongName) && (j.controlSide.MiddleRequired() || ((j.controlSide.MiddleTexture.Length > 0) && (j.controlSide.MiddleTexture[0] != '-')))); //mxd
bool matchmid = ((j.controlSide.LongMiddleTexture == texture.LongName) && (j.controlSide.MiddleRequired() || ((j.controlSide.MiddleTexture.Length > 0) && (j.controlSide.MiddleTexture != "-")))); //mxd
//mxd. If there's a selection, check if matched part is actually selected
if(!singleselection) {

View file

@ -214,21 +214,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
for(int i = 0; i < data.ExtraFloors.Count; i++)
{
Effect3DFloor ef = data.ExtraFloors[i];
bool floorRequired = false; //mxd
bool ceilingRequired = false; //mxd
bool floorRequired = ef.VavoomType; //mxd
bool ceilingRequired = ef.VavoomType; //mxd
if(!ef.IgnoreBottomHeight) {
if(ef.VavoomType || !ef.IgnoreBottomHeight) {
//mxd. if normals match - check the offsets
if(ef.Ceiling.plane.Normal == floor.Level.plane.Normal) {
if(-floor.Level.plane.Offset < ef.Ceiling.plane.Offset) {
floorRequired = true;
} else if(-floor.Level.plane.Offset == ef.Ceiling.plane.Offset) {
if(!ef.VavoomType) {
if(ef.Ceiling.plane.Normal == floor.Level.plane.Normal) {
if(-floor.Level.plane.Offset < ef.Ceiling.plane.Offset) {
floorRequired = true;
} else if(-floor.Level.plane.Offset == ef.Ceiling.plane.Offset) {
//mxd. check if 3d floor is higher than real one at any vertex
floorRequired = checkFloorVertices(floor.Vertices, ef.Ceiling.plane);
}
} else {
//mxd. check if 3d floor is higher than real one at any vertex
floorRequired = checkFloorVertices(floor.Vertices, ef.Ceiling.plane);
}
} else {
//mxd. check if 3d floor is higher than real one at any vertex
floorRequired = checkFloorVertices(floor.Vertices, ef.Ceiling.plane);
}
//mxd. Create a floor
@ -238,7 +240,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.AddGeometry(vf);
//mxd. add backside as well
if(ef.RenderInside) {
if(!ef.VavoomType && ef.RenderInside) {
VisualFloor vfb = (i < extrabackfloors.Count) ? extrabackfloors[i] : new VisualFloor(mode, this);
if(vfb.Setup(ef.Ceiling, ef, true))
base.AddGeometry(vfb);
@ -252,16 +254,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. check if 3d ceiling is lower than real one at any vertex
if(ef.Floor.plane.Normal == ceiling.Level.plane.Normal) {
if(-ceiling.Level.plane.Offset > ef.Floor.plane.Offset) {
floorRequired = true;
} else if(-ceiling.Level.plane.Offset == ef.Floor.plane.Offset) {
if(!ef.VavoomType) {
if(ef.Floor.plane.Normal == ceiling.Level.plane.Normal) {
if(-ceiling.Level.plane.Offset > ef.Floor.plane.Offset) {
floorRequired = true;
} else if(-ceiling.Level.plane.Offset == ef.Floor.plane.Offset) {
//mxd. check if 3d floor is higher than real one at any vertex
ceilingRequired = checkCeilingVertices(ceiling.Vertices, ef.Floor.plane);
}
} else {
//mxd. check if 3d floor is higher than real one at any vertex
ceilingRequired = checkCeilingVertices(ceiling.Vertices, ef.Floor.plane);
}
} else {
//mxd. check if 3d floor is higher than real one at any vertex
ceilingRequired = checkCeilingVertices(ceiling.Vertices, ef.Floor.plane);
}
//mxd. Create a ceiling
@ -271,7 +275,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.AddGeometry(vc);
//mxd. add backside as well
if(ef.RenderInside || ef.IgnoreBottomHeight) {
if(!ef.VavoomType && (ef.RenderInside || ef.IgnoreBottomHeight)) {
VisualCeiling vcb = (i < extrabackceilings.Count) ? extrabackceilings[i] : new VisualCeiling(mode, this);
if(vcb.Setup(ef.Floor, ef, true))
base.AddGeometry(vcb);
@ -317,7 +321,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
for(int i = 0; i < osd.ExtraFloors.Count; i++)
{
Effect3DFloor ef = osd.ExtraFloors[i];
if(ef.IgnoreBottomHeight) continue;
if(!ef.VavoomType && ef.IgnoreBottomHeight) continue; //mxd
VisualMiddle3D vm3 = (i < middles.Count) ? middles[i] : new VisualMiddle3D(mode, this, sd);
if(vm3.Setup(ef))
@ -331,7 +335,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
for (int i = 0; i < data.ExtraFloors.Count; i++) {
Effect3DFloor ef = data.ExtraFloors[i];
if (ef.RenderInside && !ef.IgnoreBottomHeight) {
if (!ef.VavoomType && ef.RenderInside && !ef.IgnoreBottomHeight) {
VisualMiddleBack vms = new VisualMiddleBack(mode, this, sd);
if (vms.Setup(ef))
base.AddGeometry(vms);

View file

@ -485,8 +485,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Delete thing
public virtual void OnDelete() {
this.Thing.Dispose();
mode.CreateUndo("Delete thing");
mode.SetActionResult("Deleted a thing.");
this.Thing.Fields.BeforeFieldsChange();
this.Thing.Dispose();
this.Dispose();
General.Map.IsChanged = true;
General.Map.ThingsFilter.Update();
}
// Copy properties
@ -550,7 +557,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Change thing height");
Thing.Move(Thing.Position + new Vector3D(0.0f, 0.0f, (float)amount));
Thing.Move(Thing.Position + new Vector3D(0.0f, 0.0f, amount));
mode.SetActionResult("Changed thing height to " + Thing.Position.z + ".");

View file

@ -269,6 +269,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
//Delete key pressed - remove zoffset field
public virtual void OnDelete() {
mode.CreateUndo("Clear vertex height offset");
mode.SetActionResult("Cleared vertex height offset.");
if(ceilingVertex) {
if(float.IsNaN(vertex.ZCeiling)) return;
vertex.ZCeiling = float.NaN;

View file

@ -136,7 +136,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
ceiling.alpha = alpha;
// Do not adjust light? (works only for non-vavoom types)
if(((linedef.Args[2] & 1) != 0) && !vavoomtype)
if(!vavoomtype && ( ((linedef.Args[2] & (int)Flags.DisableLighting) != 0) || (((linedef.Args[2] & (int)Flags.RestrictLighting) != 0)) )) //mxd
{
floor.brightnessbelow = -1;
floor.colorbelow = PixelColor.FromInt(0);

View file

@ -88,10 +88,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
s.Fields.GetValue("yscaleceiling", 1.0f));
//Load ceiling texture
if((s.CeilTexture.Length > 0) && (s.CeilTexture[0] != '-')) {
if((s.CeilTexture.Length > 0) && (s.CeilTexture != "-")) {
base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture);
if(base.Texture == null) {
base.Texture = General.Map.Data.MissingTexture3D;
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = s.LongCeilTexture;
} else {
if(!base.Texture.IsImageLoaded) {

View file

@ -88,13 +88,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
s.Fields.GetValue("yscalefloor", 1.0f));
//Load floor texture
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
if(base.Texture == null) {
base.Texture = General.Map.Data.MissingTexture3D;
setuponloadedtexture = s.LongFloorTexture;
} else {
if(!base.Texture.IsImageLoaded)
if ((s.FloorTexture.Length > 0) && (s.FloorTexture != "-"))
{
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
if (base.Texture == null)
{
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = s.LongFloorTexture;
}
else
{
if (!base.Texture.IsImageLoaded)
setuponloadedtexture = s.LongFloorTexture;
}
} else {
// Use missing texture
base.Texture = General.Map.Data.MissingTexture3D;
setuponloadedtexture = 0;
}
// Determine texture scale

View file

@ -90,13 +90,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!osd.Updated) osd.Update();
// Texture given?
if((Sidedef.LowTexture.Length > 0) && (Sidedef.LowTexture[0] != '-'))
if((Sidedef.LowTexture.Length > 0) && (Sidedef.LowTexture != "-"))
{
// Load texture
base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongLowTexture);
if(base.Texture == null)
{
base.Texture = General.Map.Data.MissingTexture3D;
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = Sidedef.LongLowTexture;
}
else

View file

@ -96,24 +96,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. which texture we must use?
long textureLong = 0;
if((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseUpperTexture) != 0) {
if(Sidedef.HighTexture.Length > 0 && Sidedef.HighTexture[0] != '-')
if(Sidedef.HighTexture.Length > 0 && Sidedef.HighTexture != "-")
textureLong = Sidedef.LongHighTexture;
} else if((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseLowerTexture) != 0) {
if(Sidedef.LowTexture.Length > 0 && Sidedef.LowTexture[0] != '-')
if(Sidedef.LowTexture.Length > 0 && Sidedef.LowTexture != "-")
textureLong = Sidedef.LongLowTexture;
} else if((sourceside.MiddleTexture.Length > 0) && (sourceside.MiddleTexture[0] != '-')) {
} else if((sourceside.MiddleTexture.Length > 0) && (sourceside.MiddleTexture != "-")) {
textureLong = sourceside.LongMiddleTexture;
}
// Texture given?
//if((sourceside.MiddleTexture.Length > 0) && (sourceside.MiddleTexture[0] != '-'))
if(textureLong != 0)
{
// Load texture
base.Texture = General.Map.Data.GetTextureImage(textureLong);
if(base.Texture == null)
{
base.Texture = General.Map.Data.MissingTexture3D;
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = textureLong;
}
else

View file

@ -74,12 +74,12 @@ namespace CodeImp.DoomBuilder.BuilderModes {
//mxd. which texture we must use?
long textureLong = 0;
if ((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseUpperTexture) != 0) {
if (Sidedef.Other.HighTexture.Length > 0 && Sidedef.Other.HighTexture[0] != '-')
if (Sidedef.Other.HighTexture.Length > 0 && Sidedef.Other.HighTexture != "-")
textureLong = Sidedef.Other.LongHighTexture;
} else if ((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.UseLowerTexture) != 0) {
if(Sidedef.Other.LowTexture.Length > 0 && Sidedef.Other.LowTexture[0] != '-')
if(Sidedef.Other.LowTexture.Length > 0 && Sidedef.Other.LowTexture != "-")
textureLong = Sidedef.Other.LongLowTexture;
} else if ((sourceside.MiddleTexture.Length > 0) && (sourceside.MiddleTexture[0] != '-')) {
} else if ((sourceside.MiddleTexture.Length > 0) && (sourceside.MiddleTexture != "-")) {
textureLong = sourceside.LongMiddleTexture;
}
@ -88,7 +88,7 @@ namespace CodeImp.DoomBuilder.BuilderModes {
// Load texture
base.Texture = General.Map.Data.GetTextureImage(textureLong);
if (base.Texture == null) {
base.Texture = General.Map.Data.MissingTexture3D;
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = textureLong;
} else if (!base.Texture.IsImageLoaded) {
setuponloadedtexture = textureLong;
@ -174,7 +174,12 @@ namespace CodeImp.DoomBuilder.BuilderModes {
poly.Add(new Vector3D(vr.x, vr.y, fr));
// Determine initial color
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
int lightlevel = 0;
if(((sourceside.Line.Args[2] & (int)Effect3DFloor.Flags.DisableLighting) != 0)) {
lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
}else{
lightlevel = lightabsolute ? lightvalue : sourceside.Sector.Brightness + lightvalue;
}
//mxd
PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef));
PixelColor wallcolor = PixelColor.Modulate(sd.Ceiling.colorbelow, wallbrightness);

View file

@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override bool Setup()
{
//mxd
if(Sidedef.MiddleTexture.Length == 0 || Sidedef.MiddleTexture[0] == '-') return false;
if(Sidedef.MiddleTexture.Length == 0 || Sidedef.MiddleTexture == "-") return false;
Vector2D vl, vr;
@ -97,13 +97,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!osd.Updated) osd.Update();
// Load texture
base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongMiddleTexture);
if(base.Texture == null) {
base.Texture = General.Map.Data.MissingTexture3D;
setuponloadedtexture = Sidedef.LongMiddleTexture;
} else {
if(!base.Texture.IsImageLoaded)
if ((Sidedef.MiddleTexture.Length > 0) && (Sidedef.MiddleTexture != "-")){
base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongMiddleTexture);
if (base.Texture == null){
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = Sidedef.LongMiddleTexture;
} else {
if (!base.Texture.IsImageLoaded)
setuponloadedtexture = Sidedef.LongMiddleTexture;
}
} else {
// Use missing texture
base.Texture = General.Map.Data.MissingTexture3D;
setuponloadedtexture = 0;
}
// Get texture scaled size

View file

@ -88,13 +88,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
SectorData sd = mode.GetSectorData(Sidedef.Sector);
// Texture given?
if((Sidedef.MiddleTexture.Length > 0) && (Sidedef.MiddleTexture[0] != '-'))
if((Sidedef.MiddleTexture.Length > 0) && (Sidedef.MiddleTexture != "-"))
{
// Load texture
base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongMiddleTexture);
if(base.Texture == null)
{
base.Texture = General.Map.Data.MissingTexture3D;
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = Sidedef.LongMiddleTexture;
}
else

View file

@ -90,13 +90,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!osd.Updated) osd.Update();
// Texture given?
if((Sidedef.HighTexture.Length > 0) && (Sidedef.HighTexture[0] != '-'))
if((Sidedef.HighTexture.Length > 0) && (Sidedef.HighTexture != "-"))
{
// Load texture
base.Texture = General.Map.Data.GetTextureImage(Sidedef.LongHighTexture);
if(base.Texture == null)
{
base.Texture = General.Map.Data.MissingTexture3D;
base.Texture = General.Map.Data.UnknownTexture3D;
setuponloadedtexture = Sidedef.LongHighTexture;
}
else