2010-09-11 20:14:36 +00:00
|
|
|
|
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
|
|
|
|
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
2010-09-11 20:14:36 +00:00
|
|
|
|
{
|
|
|
|
|
internal class EffectBrightnessLevel : SectorEffect
|
|
|
|
|
{
|
|
|
|
|
// Linedef that is used to create this effect
|
|
|
|
|
// The sector can be found by linedef.Front.Sector
|
|
|
|
|
private Linedef linedef;
|
|
|
|
|
|
|
|
|
|
// Level plane
|
|
|
|
|
private SectorLevel level;
|
|
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
|
public EffectBrightnessLevel(SectorData data, Linedef sourcelinedef) : base(data)
|
|
|
|
|
{
|
|
|
|
|
linedef = sourcelinedef;
|
2010-09-13 06:07:11 +00:00
|
|
|
|
|
|
|
|
|
// New effect added: This sector needs an update!
|
|
|
|
|
if(data.Mode.VisualSectorExists(data.Sector))
|
|
|
|
|
{
|
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
|
|
|
|
|
vs.UpdateSectorGeometry(false);
|
|
|
|
|
}
|
2010-09-11 20:14:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This makes sure we are updated with the source linedef information
|
|
|
|
|
public override void Update()
|
|
|
|
|
{
|
|
|
|
|
SectorData sd = data.Mode.GetSectorData(linedef.Front.Sector);
|
|
|
|
|
if(!sd.Updated) sd.Update();
|
2010-09-16 17:07:30 +00:00
|
|
|
|
sd.AddUpdateSector(data.Sector, false);
|
2010-09-11 20:14:36 +00:00
|
|
|
|
|
|
|
|
|
if(level == null)
|
|
|
|
|
{
|
|
|
|
|
level = new SectorLevel(sd.Ceiling);
|
|
|
|
|
data.AddSectorLevel(level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update level
|
|
|
|
|
sd.Ceiling.CopyProperties(level);
|
|
|
|
|
level.type = SectorLevelType.Light;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|