mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-08 00:32:20 +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;
|
allowmouse = true;
|
||||||
allowscroll = true;
|
allowscroll = true;
|
||||||
repeat = true;
|
repeat = true;
|
||||||
|
disregardalt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lowerbrightness8
|
lowerbrightness8
|
||||||
|
@ -734,6 +735,7 @@ lowerbrightness8
|
||||||
allowmouse = true;
|
allowmouse = true;
|
||||||
allowscroll = true;
|
allowscroll = true;
|
||||||
repeat = true;
|
repeat = true;
|
||||||
|
disregardalt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
movetextureleft
|
movetextureleft
|
||||||
|
|
|
@ -830,7 +830,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sector brightness change
|
// 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);
|
mode.CreateUndo("Change sector brightness", UndoGroup.SectorBrightnessChange, Sector.Sector.FixedIndex);
|
||||||
|
|
||||||
|
|
|
@ -1585,10 +1585,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sector brightness change
|
// Sector brightness change
|
||||||
public virtual void OnChangeTargetBrightness(bool up)
|
public virtual void OnChangeTargetBrightness(bool up, bool local)
|
||||||
{
|
{
|
||||||
//mxd. Change UDMF wall light?
|
//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 fieldname = "light";
|
||||||
string fieldabsolutename = "lightabsolute";
|
string fieldabsolutename = "lightabsolute";
|
||||||
|
|
|
@ -3508,18 +3508,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
[BeginAction("raisebrightness8")]
|
[BeginAction("raisebrightness8")]
|
||||||
public void RaiseBrightness8()
|
public void RaiseBrightness8()
|
||||||
{
|
{
|
||||||
|
bool local = General.Interface.AltState;
|
||||||
PreAction(UndoGroup.SectorBrightnessChange);
|
PreAction(UndoGroup.SectorBrightnessChange);
|
||||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false, false);
|
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();
|
PostAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BeginAction("lowerbrightness8")]
|
[BeginAction("lowerbrightness8")]
|
||||||
public void LowerBrightness8()
|
public void LowerBrightness8()
|
||||||
{
|
{
|
||||||
|
bool local = General.Interface.AltState;
|
||||||
PreAction(UndoGroup.SectorBrightnessChange);
|
PreAction(UndoGroup.SectorBrightnessChange);
|
||||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false, false);
|
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();
|
PostAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
// Unused
|
// Unused
|
||||||
public void OnSelectBegin() { }
|
public void OnSelectBegin() { }
|
||||||
public void OnEditBegin() { }
|
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 OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||||
public void OnSelectTexture() { }
|
public void OnSelectTexture() { }
|
||||||
public void OnCopyTexture() { }
|
public void OnCopyTexture() { }
|
||||||
|
|
|
@ -699,7 +699,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
// Unused
|
// Unused
|
||||||
public void OnSelectBegin() { }
|
public void OnSelectBegin() { }
|
||||||
public void OnEditBegin() { }
|
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 OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||||
public void OnSelectTexture() { }
|
public void OnSelectTexture() { }
|
||||||
public void OnCopyTexture() { }
|
public void OnCopyTexture() { }
|
||||||
|
|
|
@ -240,7 +240,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
public void OnSelectBegin() { }
|
public void OnSelectBegin() { }
|
||||||
public void OnEditBegin() { }
|
public void OnEditBegin() { }
|
||||||
public void OnMouseMove(MouseEventArgs e) { }
|
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 OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||||
public void OnChangeScale(int incrementX, int incrementY) { }
|
public void OnChangeScale(int incrementX, int incrementY) { }
|
||||||
public void OnSelectTexture() { }
|
public void OnSelectTexture() { }
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
void OnEditEnd();
|
void OnEditEnd();
|
||||||
void OnMouseMove(MouseEventArgs e);
|
void OnMouseMove(MouseEventArgs e);
|
||||||
void OnChangeTargetHeight(int amount);
|
void OnChangeTargetHeight(int amount);
|
||||||
void OnChangeTargetBrightness(bool up);
|
void OnChangeTargetBrightness(bool up, bool local);
|
||||||
void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection);
|
void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection);
|
||||||
void OnChangeScale(int incrementX, int incrementY); //mxd
|
void OnChangeScale(int incrementX, int incrementY); //mxd
|
||||||
void OnResetTextureOffset();
|
void OnResetTextureOffset();
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
public void OnEditEnd() { }
|
public void OnEditEnd() { }
|
||||||
public void OnMouseMove(MouseEventArgs e) { }
|
public void OnMouseMove(MouseEventArgs e) { }
|
||||||
public void OnChangeTargetHeight(int amount) { }
|
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 OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
||||||
public void OnChangeScale(int incrementX, int incrementY) { } //mxd
|
public void OnChangeScale(int incrementX, int incrementY) { } //mxd
|
||||||
public void OnResetTextureOffset() { }
|
public void OnResetTextureOffset() { }
|
||||||
|
|
|
@ -436,7 +436,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. Sector brightness change
|
//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)
|
if(level != null && level.sector != Sector.Sector)
|
||||||
{
|
{
|
||||||
|
@ -451,17 +451,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
if(index > -1 && index < Sector.ExtraCeilings.Count)
|
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
|
else
|
||||||
base.OnChangeTargetBrightness(up);
|
base.OnChangeTargetBrightness(up, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Change the sector brightness if the map is not in UDMF format, or this ceiling is part of 3D-floor,
|
// 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
|
// or the game configuration doesn't support distinct surface brightnesses
|
||||||
if(!General.Map.UDMF || (level != null && Sector.Sector != level.sector) || !General.Map.Config.DistinctFloorAndCeilingBrightness)
|
if(!General.Map.UDMF || (level != null && Sector.Sector != level.sector) || !General.Map.Config.DistinctFloorAndCeilingBrightness || !local)
|
||||||
{
|
{
|
||||||
base.OnChangeTargetBrightness(up);
|
base.OnChangeTargetBrightness(up, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,30 +390,53 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. Sector brightness change
|
//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
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||||
if(level.sector != Sector.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);
|
base.OnChangeTargetBrightness(up, false);
|
||||||
vs.Floor.OnChangeTargetBrightness(up);
|
return;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
else
|
||||||
{
|
newLight = General.Map.Config.BrightnessLevels.GetNextLower(light, absolute);
|
||||||
base.OnChangeTargetBrightness(up);
|
|
||||||
}
|
if (newLight == light) return;
|
||||||
}
|
|
||||||
else
|
//create undo
|
||||||
{
|
mode.CreateUndo("Change floor brightness", UndoGroup.SurfaceBrightnessChange, Sector.Sector.FixedIndex);
|
||||||
base.OnChangeTargetBrightness(up);
|
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