mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 20:32:34 +00:00
3a77e6bc93
Updated ZDoom_DECORATE.cfg.
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
#region === Copyright (c) 2015 MaxED ===
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
{
|
|
class EffectTransferCeilingBrightness : SectorEffect
|
|
{
|
|
// Linedef that is used to create this effect
|
|
private readonly Linedef linedef;
|
|
|
|
// Constructor
|
|
public EffectTransferCeilingBrightness(SectorData data, Linedef sourcelinedef) : base(data)
|
|
{
|
|
linedef = sourcelinedef;
|
|
|
|
// 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);
|
|
}
|
|
}
|
|
|
|
// 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();
|
|
sd.AddUpdateSector(data.Sector, false);
|
|
|
|
// Transfer ceiling brightness, keep sector color
|
|
PixelColor lightcolor = PixelColor.FromInt(data.Sector.Fields.GetValue("lightcolor", -1));
|
|
PixelColor brightness = PixelColor.FromInt(General.Map.Renderer3D.CalculateBrightness(sd.Sector.Brightness));
|
|
data.Ceiling.color = PixelColor.Modulate(lightcolor, brightness).WithAlpha(255).ToInt();
|
|
}
|
|
}
|
|
}
|