Fixed, Edit Selection: in some cases thing angles were updated incorrectly when things with "FixedRotation" game configuration property were among selected things.

Fixed, Visual mode: floor brightness was calculated incorrectly when "Disable Light Effects"/"Restrict light inside" 3d floor flags were used and the floor had "lightfloor" property.
Fixed: "lightabsolute" flag was accessed incorrectly in previous commit.
This commit is contained in:
MaxED 2015-02-06 21:03:20 +00:00
parent 54fccb73e7
commit cde97f2cfe
7 changed files with 32 additions and 10 deletions

View file

@ -494,7 +494,7 @@ namespace CodeImp.DoomBuilder.Controls
{
int light = (int)sd.Fields["light"].Value;
if (sd.Fields.ContainsKey("lightabsolute") && Boolean.Parse(sd.Fields["lightabsolute"].Value.ToString()))
if (sd.Fields.GetValue("lightabsolute", false))
value.Text = light + " (abs.)";
else
value.Text = light + " (" + Math.Min(255, Math.Max(0, (light + sd.Sector.Brightness))) + ")";

View file

@ -773,7 +773,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Thing t in selectedthings)
{
if(!fixedrotationthingtypes.Contains(t.Type)) //mxd. Polyobject Anchors, I hate you!
t.Rotate(Angle2D.Normalized(newthingangle[index++]));
t.Rotate(Angle2D.Normalized(newthingangle[index]));
index++;
}
UpdatePanel();

View file

@ -372,7 +372,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
protected void GetLightValue(out int lightvalue, out bool lightabsolute)
{
lightabsolute = Sidedef.IsFlagSet("lightabsolute");
lightabsolute = Sidedef.Fields.GetValue("lightabsolute", false);
bool affectedbyfog = General.Map.Data.MapInfo.HasFadeColor || (Sector.Sector.CeilTexture == General.Map.Config.SkyFlatName && General.Map.Data.MapInfo.HasOutsideFogColor) || Sector.Sector.Fields.ContainsKey("fadecolor");
bool ignorelight = affectedbyfog && !Sidedef.IsFlagSet("lightfog") && !lightabsolute;
lightvalue = ignorelight ? 0 : Sidedef.Fields.GetValue("light", 0); //mxd

View file

@ -142,6 +142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
floor.colorbelow = PixelColor.FromInt(0);
ceiling.color = 0;
ceiling.brightnessbelow = -1;
ceiling.transferbrightness = false; //mxd
ceiling.colorbelow = PixelColor.FromInt(0);
}
}

View file

@ -276,13 +276,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
lightlevels.Sort(0, lightlevels.Count, comparer); //mxd. Was lightlevels.Sort(1, lightlevels.Count - 2, comparer);
}
//mxd. 3d floors can be above the real ceiling, so let's find it first...
int startindex = lightlevels.Count - 2;
for(int i = lightlevels.Count - 2; i >= 0; i--)
{
if(lightlevels[i].type == SectorLevelType.Ceiling && lightlevels[i].sector.Index == sector.Index)
{
startindex = i;
break;
}
}
// Now that we know the levels in this sector (and in the right order) we
// can determine the lighting in between and on the levels.
// Start from the absolute ceiling and go down to 'cast' the lighting
for(int i = lightlevels.Count - 2; i >= 0; i--)
for(int i = startindex; i >= 0; i--)
{
SectorLevel l = lightlevels[i];
SectorLevel pl = lightlevels[i + 1];
//mxd. If the real floor has "lightfloor" value and the 3d floor above it doesn't cast down light, use real floor's brightness
if(General.Map.UDMF && l == floor && lightlevels.Count > 2 && !pl.transferbrightness && l.sector.Fields.ContainsKey("lightfloor"))
{
int light = l.sector.Fields.GetValue("lightfloor", pl.brightnessbelow);
pl.brightnessbelow = (l.sector.Fields.GetValue("lightfloorabsolute", false) ? light : l.sector.Brightness + light);
}
// Set color when no color is specified, or when a 3D floor is placed above the absolute floor
if((l.color == 0) || ((l == floor) && (lightlevels.Count > 2)))
@ -292,11 +310,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
l.color = floorcolor.WithAlpha(255).ToInt();
}
if(l.colorbelow.a == 0)
l.colorbelow = pl.colorbelow;
if(l.brightnessbelow == -1)
l.brightnessbelow = pl.brightnessbelow;
if(l.colorbelow.a == 0) l.colorbelow = pl.colorbelow;
if(l.brightnessbelow == -1) l.brightnessbelow = pl.brightnessbelow;
}
floorchanged = false;

View file

@ -30,6 +30,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// When this is 0, it takes the color from the sector above
public int brightnessbelow;
public PixelColor colorbelow;
public bool transferbrightness; //mxd
// Constructor
public SectorLevel(Sector s, SectorLevelType type)
@ -37,6 +38,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.type = type;
this.sector = s;
this.alpha = 255;
this.transferbrightness = true; //mxd
}
// Copy constructor
@ -55,6 +57,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
target.color = this.color;
target.brightnessbelow = this.brightnessbelow;
target.colorbelow = this.colorbelow;
target.transferbrightness = this.transferbrightness; //mxd
}
}
}

View file

@ -105,7 +105,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (!base.Texture.IsImageLoaded)
setuponloadedtexture = s.LongFloorTexture;
}
} else {
}
else
{
// Use missing texture
base.Texture = General.Map.Data.MissingTexture3D;
setuponloadedtexture = 0;