mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 21:00:56 +00:00
Visual Mode: changing brightness now affects sector brightness, holding Alt will change local brightness
This commit is contained in:
parent
20e1445515
commit
76f6483829
11 changed files with 62 additions and 35 deletions
|
@ -723,6 +723,7 @@ raisebrightness8
|
|||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
repeat = true;
|
||||
disregardalt = true;
|
||||
}
|
||||
|
||||
lowerbrightness8
|
||||
|
@ -734,6 +735,7 @@ lowerbrightness8
|
|||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
repeat = true;
|
||||
disregardalt = true;
|
||||
}
|
||||
|
||||
movetextureleft
|
||||
|
|
|
@ -830,7 +830,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Sector brightness change
|
||||
public virtual void OnChangeTargetBrightness(bool up)
|
||||
public virtual void OnChangeTargetBrightness(bool up, bool local)
|
||||
{
|
||||
mode.CreateUndo("Change sector brightness", UndoGroup.SectorBrightnessChange, Sector.Sector.FixedIndex);
|
||||
|
||||
|
|
|
@ -1585,10 +1585,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Sector brightness change
|
||||
public virtual void OnChangeTargetBrightness(bool up)
|
||||
public virtual void OnChangeTargetBrightness(bool up, bool local)
|
||||
{
|
||||
//mxd. Change UDMF wall light?
|
||||
if(General.Map.UDMF && (General.Map.Config.DistinctWallBrightness || General.Map.Config.DistinctSidedefPartBrightness))
|
||||
if(General.Map.UDMF && (General.Map.Config.DistinctWallBrightness || General.Map.Config.DistinctSidedefPartBrightness) && local)
|
||||
{
|
||||
string fieldname = "light";
|
||||
string fieldabsolutename = "lightabsolute";
|
||||
|
|
|
@ -3508,18 +3508,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
[BeginAction("raisebrightness8")]
|
||||
public void RaiseBrightness8()
|
||||
{
|
||||
bool local = General.Interface.AltState;
|
||||
PreAction(UndoGroup.SectorBrightnessChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false, false);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetBrightness(true);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetBrightness(true, local);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("lowerbrightness8")]
|
||||
public void LowerBrightness8()
|
||||
{
|
||||
bool local = General.Interface.AltState;
|
||||
PreAction(UndoGroup.SectorBrightnessChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false, false);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetBrightness(false);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetBrightness(false, local);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Unused
|
||||
public void OnSelectBegin() { }
|
||||
public void OnEditBegin() { }
|
||||
public void OnChangeTargetBrightness(bool up) { }
|
||||
public void OnChangeTargetBrightness(bool up, bool local) { }
|
||||
public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||
public void OnSelectTexture() { }
|
||||
public void OnCopyTexture() { }
|
||||
|
|
|
@ -699,7 +699,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Unused
|
||||
public void OnSelectBegin() { }
|
||||
public void OnEditBegin() { }
|
||||
public void OnChangeTargetBrightness(bool up) { }
|
||||
public void OnChangeTargetBrightness(bool up, bool local) { }
|
||||
public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||
public void OnSelectTexture() { }
|
||||
public void OnCopyTexture() { }
|
||||
|
|
|
@ -240,7 +240,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void OnSelectBegin() { }
|
||||
public void OnEditBegin() { }
|
||||
public void OnMouseMove(MouseEventArgs e) { }
|
||||
public void OnChangeTargetBrightness(bool up) { }
|
||||
public void OnChangeTargetBrightness(bool up, bool local) { }
|
||||
public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||
public void OnChangeScale(int incrementX, int incrementY) { }
|
||||
public void OnSelectTexture() { }
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
void OnEditEnd();
|
||||
void OnMouseMove(MouseEventArgs e);
|
||||
void OnChangeTargetHeight(int amount);
|
||||
void OnChangeTargetBrightness(bool up);
|
||||
void OnChangeTargetBrightness(bool up, bool local);
|
||||
void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection);
|
||||
void OnChangeScale(int incrementX, int incrementY); //mxd
|
||||
void OnResetTextureOffset();
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void OnEditEnd() { }
|
||||
public void OnMouseMove(MouseEventArgs e) { }
|
||||
public void OnChangeTargetHeight(int amount) { }
|
||||
public void OnChangeTargetBrightness(bool up) { }
|
||||
public void OnChangeTargetBrightness(bool up, bool local) { }
|
||||
public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||
public void OnChangeScale(int incrementX, int incrementY) { } //mxd
|
||||
public void OnResetTextureOffset() { }
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. Sector brightness change
|
||||
public override void OnChangeTargetBrightness(bool up)
|
||||
public override void OnChangeTargetBrightness(bool up, bool local)
|
||||
{
|
||||
if(level != null && level.sector != Sector.Sector)
|
||||
{
|
||||
|
@ -451,17 +451,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
if(index > -1 && index < Sector.ExtraCeilings.Count)
|
||||
((BaseVisualSector)mode.GetVisualSector(Sector.ExtraCeilings[index].level.sector)).Floor.OnChangeTargetBrightness(up);
|
||||
((BaseVisualSector)mode.GetVisualSector(Sector.ExtraCeilings[index].level.sector)).Floor.OnChangeTargetBrightness(up, false);
|
||||
else
|
||||
base.OnChangeTargetBrightness(up);
|
||||
base.OnChangeTargetBrightness(up, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Change the sector brightness if the map is not in UDMF format, or this ceiling is part of 3D-floor,
|
||||
// or the game configuration doesn't support distinct surfave brightnesses
|
||||
if(!General.Map.UDMF || (level != null && Sector.Sector != level.sector) || !General.Map.Config.DistinctFloorAndCeilingBrightness)
|
||||
// or the game configuration doesn't support distinct surface brightnesses
|
||||
if(!General.Map.UDMF || (level != null && Sector.Sector != level.sector) || !General.Map.Config.DistinctFloorAndCeilingBrightness || !local)
|
||||
{
|
||||
base.OnChangeTargetBrightness(up);
|
||||
base.OnChangeTargetBrightness(up, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -390,30 +390,53 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. Sector brightness change
|
||||
public override void OnChangeTargetBrightness(bool up)
|
||||
public override void OnChangeTargetBrightness(bool up, bool local)
|
||||
{
|
||||
if(level != null)
|
||||
// This floor is part of 3D-floor
|
||||
if (level != null && level.sector != Sector.Sector)
|
||||
{
|
||||
// This floor is part of 3D-floor
|
||||
if(level.sector != Sector.Sector)
|
||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||
vs.Floor.OnChangeTargetBrightness(up, local);
|
||||
vs.UpdateSectorGeometry(true);
|
||||
}
|
||||
// This is actual floor of a sector with extrafloors
|
||||
else if (level != null && Sector.ExtraFloors.Count > 0 && !Sector.ExtraFloors[0].ExtraFloor.Floor.restrictlighting && !Sector.ExtraFloors[0].ExtraFloor.Floor.disablelighting)
|
||||
{
|
||||
Sector.ExtraFloors[0].OnChangeTargetBrightness(up, local);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Change the sector brightness if the map is not in UDMF format, or this floor is part of 3D-floor,
|
||||
// or the game configuration doesn't support distinct surface brightnesses
|
||||
if (!General.Map.UDMF || (level != null && Sector.Sector != level.sector) || !General.Map.Config.DistinctFloorAndCeilingBrightness || !local)
|
||||
{
|
||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||
vs.Floor.OnChangeTargetBrightness(up);
|
||||
vs.UpdateSectorGeometry(true);
|
||||
}
|
||||
// This is actual floor of a sector with extrafloors
|
||||
else if(Sector.ExtraFloors.Count > 0 && !Sector.ExtraFloors[0].ExtraFloor.Floor.restrictlighting && !Sector.ExtraFloors[0].ExtraFloor.Floor.disablelighting)
|
||||
{
|
||||
Sector.ExtraFloors[0].OnChangeTargetBrightness(up);
|
||||
base.OnChangeTargetBrightness(up, false);
|
||||
return;
|
||||
}
|
||||
|
||||
int light = Sector.Sector.Fields.GetValue("lightfloor", 0);
|
||||
bool absolute = Sector.Sector.Fields.GetValue("lightfloorabsolute", false);
|
||||
int newLight;
|
||||
|
||||
if (up)
|
||||
newLight = General.Map.Config.BrightnessLevels.GetNextHigher(light, absolute);
|
||||
else
|
||||
{
|
||||
base.OnChangeTargetBrightness(up);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnChangeTargetBrightness(up);
|
||||
newLight = General.Map.Config.BrightnessLevels.GetNextLower(light, absolute);
|
||||
|
||||
if (newLight == light) return;
|
||||
|
||||
//create undo
|
||||
mode.CreateUndo("Change floor brightness", UndoGroup.SurfaceBrightnessChange, Sector.Sector.FixedIndex);
|
||||
Sector.Sector.Fields.BeforeFieldsChange();
|
||||
|
||||
//apply changes
|
||||
UniFields.SetInteger(Sector.Sector.Fields, "lightfloor", newLight, (absolute ? int.MinValue : 0));
|
||||
mode.SetActionResult("Changed floor brightness to " + newLight + ".");
|
||||
Sector.Sector.UpdateNeeded = true;
|
||||
Sector.Sector.UpdateCache();
|
||||
|
||||
//rebuild sector
|
||||
Sector.UpdateSectorGeometry(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue