mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
working on visual mode
This commit is contained in:
parent
83c4524ce7
commit
5032c58797
11 changed files with 158 additions and 43 deletions
|
@ -317,3 +317,63 @@ showvisualthings
|
|||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
lowerbrightness8
|
||||
{
|
||||
title = "Lower Brightness by 8";
|
||||
category = "visual";
|
||||
description = "Lowers the targeted or selected sector brightness level by 8.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
raisebrightness8
|
||||
{
|
||||
title = "Raise Brightness by 8";
|
||||
category = "visual";
|
||||
description = "Raises the targeted or selected sector brightness level by 8.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
movetextureleft
|
||||
{
|
||||
title = "Move Texture Left";
|
||||
category = "visual";
|
||||
description = "Moves the offset of the targeted or selected textures to the left.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
movetextureright
|
||||
{
|
||||
title = "Move Texture Right";
|
||||
category = "visual";
|
||||
description = "Moves the offset of the targeted or selected textures to the right.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
movetextureup
|
||||
{
|
||||
title = "Move Texture Up";
|
||||
category = "visual";
|
||||
description = "Moves the offset of the targeted or selected textures up.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
movetexturedown
|
||||
{
|
||||
title = "Move Texture Down";
|
||||
category = "visual";
|
||||
description = "Moves the offset of the targeted or selected textures down.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
|
||||
new public BaseVisualSector Sector { get { return (BaseVisualSector)base.Sector; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Destructor
|
||||
|
@ -65,7 +67,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#region ================== Methods
|
||||
|
||||
// This changes the height
|
||||
public abstract void ChangeHeight(int amount);
|
||||
protected abstract void ChangeHeight(int amount);
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -85,6 +87,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
DialogResult result = General.Interface.ShowEditSectors(sectors);
|
||||
if(result == DialogResult.OK) (this.Sector as BaseVisualSector).Rebuild();
|
||||
}
|
||||
|
||||
// Sector height change
|
||||
public virtual void OnChangeTargetHeight(int amount)
|
||||
{
|
||||
ChangeHeight(amount);
|
||||
|
||||
// Rebuild sector
|
||||
Sector.Rebuild();
|
||||
|
||||
// Also rebuild surrounding sectors, because outside sidedefs may need to be adjusted
|
||||
foreach(Sidedef sd in Sector.Sector.Sidedefs)
|
||||
{
|
||||
if((sd.Other != null) && mode.VisualSectorExists(sd.Other.Sector))
|
||||
{
|
||||
BaseVisualSector bvs = (BaseVisualSector)mode.GetVisualSector(sd.Other.Sector);
|
||||
bvs.Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sector brightness change
|
||||
public virtual void OnChangeTargetBrightness(int amount)
|
||||
{
|
||||
// Change brightness
|
||||
General.Map.UndoRedo.CreateUndo("Change sector brightness", UndoGroup.SectorBrightnessChange, Sector.Sector.Index);
|
||||
Sector.Sector.Brightness = General.Clamp(Sector.Sector.Brightness + amount, 0, 255);
|
||||
|
||||
// Rebuild sector
|
||||
Sector.Rebuild();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -107,6 +107,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Unused
|
||||
public virtual void OnEditBegin() { }
|
||||
public virtual void OnChangeTargetHeight(int amount) { }
|
||||
|
||||
// Select button pressed
|
||||
public virtual void OnSelectBegin()
|
||||
|
@ -201,6 +202,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(parts.upper != null) parts.upper.Setup();
|
||||
}
|
||||
|
||||
// Sector brightness change
|
||||
public virtual void OnChangeTargetBrightness(int amount)
|
||||
{
|
||||
// Change brightness
|
||||
General.Map.UndoRedo.CreateUndo("Change sector brightness", UndoGroup.SectorBrightnessChange, Sector.Sector.Index);
|
||||
Sector.Sector.Brightness = General.Clamp(Sector.Sector.Brightness + amount, 0, 255);
|
||||
|
||||
// Rebuild sector
|
||||
Sector.Rebuild();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,29 +187,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
target = newtarget;
|
||||
}
|
||||
|
||||
// This changes the target's height
|
||||
private void ChangeTargetHeight(int amount)
|
||||
{
|
||||
if(target.picked is BaseVisualGeometrySector)
|
||||
{
|
||||
BaseVisualGeometrySector vgs = (target.picked as BaseVisualGeometrySector);
|
||||
vgs.ChangeHeight(amount);
|
||||
|
||||
// Rebuild sector
|
||||
(vgs.Sector as BaseVisualSector).Rebuild();
|
||||
|
||||
// Also rebuild surrounding sectors, because outside sidedefs may need to be adjusted
|
||||
foreach(Sidedef sd in vgs.Sector.Sector.Sidedefs)
|
||||
{
|
||||
if((sd.Other != null) && VisualSectorExists(sd.Other.Sector))
|
||||
{
|
||||
BaseVisualSector bvs = (BaseVisualSector)GetVisualSector(sd.Other.Sector);
|
||||
bvs.Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
@ -322,28 +299,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public void RaiseSector8()
|
||||
{
|
||||
PickTargetUnlocked();
|
||||
ChangeTargetHeight(8);
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(8);
|
||||
}
|
||||
|
||||
[BeginAction("lowersector8")]
|
||||
public void LowerSector8()
|
||||
{
|
||||
PickTargetUnlocked();
|
||||
ChangeTargetHeight(-8);
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(-8);
|
||||
}
|
||||
|
||||
[BeginAction("raisesector1")]
|
||||
public void RaiseSector1()
|
||||
{
|
||||
PickTargetUnlocked();
|
||||
ChangeTargetHeight(1);
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(1);
|
||||
}
|
||||
|
||||
[BeginAction("lowersector1")]
|
||||
public void LowerSector1()
|
||||
{
|
||||
PickTargetUnlocked();
|
||||
ChangeTargetHeight(-1);
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(-1);
|
||||
}
|
||||
|
||||
[BeginAction("showvisualthings")]
|
||||
|
@ -352,6 +329,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
BuilderPlug.Me.ShowVisualThings++;
|
||||
if(BuilderPlug.Me.ShowVisualThings > 2) BuilderPlug.Me.ShowVisualThings = 0;
|
||||
}
|
||||
|
||||
[BeginAction("raisebrightness8")]
|
||||
public void RaiseBrightness8()
|
||||
{
|
||||
PickTargetUnlocked();
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetBrightness(8);
|
||||
}
|
||||
|
||||
[BeginAction("lowerbrightness8")]
|
||||
public void LowerBrightness8()
|
||||
{
|
||||
PickTargetUnlocked();
|
||||
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetBrightness(-8);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -332,6 +332,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public virtual void OnSelectEnd() { }
|
||||
public virtual void OnEditBegin() { }
|
||||
public virtual void OnMouseMove(MouseEventArgs e) { }
|
||||
public virtual void OnChangeTargetHeight(int amount) { }
|
||||
public virtual void OnChangeTargetBrightness(int amount) { }
|
||||
|
||||
// Edit button released
|
||||
public virtual void OnEditEnd()
|
||||
|
|
|
@ -44,5 +44,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
void OnEditBegin();
|
||||
void OnEditEnd();
|
||||
void OnMouseMove(MouseEventArgs e);
|
||||
void OnChangeTargetHeight(int amount);
|
||||
void OnChangeTargetBrightness(int amount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#region ================== Methods
|
||||
|
||||
// This changes the height
|
||||
public override void ChangeHeight(int amount)
|
||||
protected override void ChangeHeight(int amount)
|
||||
{
|
||||
General.Map.UndoRedo.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, this.Sector.Sector.Index);
|
||||
this.Sector.Sector.CeilHeight += amount;
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#region ================== Methods
|
||||
|
||||
// This changes the height
|
||||
public override void ChangeHeight(int amount)
|
||||
protected override void ChangeHeight(int amount)
|
||||
{
|
||||
General.Map.UndoRedo.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, this.Sector.Sector.Index);
|
||||
this.Sector.Sector.FloorHeight += amount;
|
||||
|
|
|
@ -35,5 +35,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
None,
|
||||
FloorHeightChange,
|
||||
CeilingHeightChange,
|
||||
SectorBrightnessChange,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -699,22 +699,22 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
/// <summary>
|
||||
/// This returns the VisualSector for the given Sector.
|
||||
/// </summary>
|
||||
protected VisualSector GetVisualSector(Sector s) { return allsectors[s]; }
|
||||
public VisualSector GetVisualSector(Sector s) { return allsectors[s]; }
|
||||
|
||||
/// <summary>
|
||||
/// This returns the VisualThing for the given Thing.
|
||||
/// </summary>
|
||||
protected VisualThing GetVisualThing(Thing t) { return allthings[t]; }
|
||||
public VisualThing GetVisualThing(Thing t) { return allthings[t]; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns True when a VisualSector has been created for the specified Sector.
|
||||
/// </summary>
|
||||
protected bool VisualSectorExists(Sector s) { return allsectors.ContainsKey(s); }
|
||||
public bool VisualSectorExists(Sector s) { return allsectors.ContainsKey(s); }
|
||||
|
||||
/// <summary>
|
||||
/// Returns True when a VisualThing has been created for the specified Thing.
|
||||
/// </summary>
|
||||
protected bool VisualThingExists(Thing t) { return allthings.ContainsKey(t); }
|
||||
public bool VisualThingExists(Thing t) { return allthings.ContainsKey(t); }
|
||||
|
||||
/// <summary>
|
||||
/// This is called when the blockmap needs to be refilled, because it was invalidated.
|
||||
|
|
|
@ -892,6 +892,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
int key = 0;
|
||||
|
||||
int mod = 0;
|
||||
if(alt) mod |= (int)Keys.Alt;
|
||||
if(shift) mod |= (int)Keys.Shift;
|
||||
if(ctrl) mod |= (int)Keys.Control;
|
||||
|
||||
// Apply button
|
||||
mousebuttons |= e.Button;
|
||||
|
||||
|
@ -906,7 +911,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
// Invoke any actions associated with this key
|
||||
General.Actions.KeyPressed(key);
|
||||
General.Actions.KeyPressed(key | mod);
|
||||
|
||||
// Invoke on editing mode
|
||||
if((General.Map != null) && (General.Editing.Mode != null)) General.Editing.Mode.OnMouseDown(e);
|
||||
|
@ -936,7 +941,12 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private void display_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
int key = 0;
|
||||
|
||||
|
||||
int mod = 0;
|
||||
if(alt) mod |= (int)Keys.Alt;
|
||||
if(shift) mod |= (int)Keys.Shift;
|
||||
if(ctrl) mod |= (int)Keys.Control;
|
||||
|
||||
// Apply button
|
||||
mousebuttons &= ~e.Button;
|
||||
|
||||
|
@ -949,9 +959,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
case MouseButtons.XButton1: key = (int)Keys.XButton1; break;
|
||||
case MouseButtons.XButton2: key = (int)Keys.XButton2; break;
|
||||
}
|
||||
|
||||
|
||||
// Invoke any actions associated with this key
|
||||
General.Actions.KeyReleased(key);
|
||||
General.Actions.KeyReleased(key | mod);
|
||||
|
||||
// Invoke on editing mode
|
||||
if((General.Map != null) && (General.Editing.Mode != null)) General.Editing.Mode.OnMouseUp(e);
|
||||
|
@ -1065,21 +1075,26 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// When the mouse wheel is changed
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
int mod = 0;
|
||||
if(alt) mod |= (int)Keys.Alt;
|
||||
if(shift) mod |= (int)Keys.Shift;
|
||||
if(ctrl) mod |= (int)Keys.Control;
|
||||
|
||||
// Scrollwheel up?
|
||||
if(e.Delta > 0)
|
||||
{
|
||||
// Invoke actions for scrollwheel
|
||||
//for(int i = 0; i < e.Delta; i += 120)
|
||||
General.Actions.KeyPressed((int)SpecialKeys.MScrollUp);
|
||||
General.Actions.KeyReleased((int)SpecialKeys.MScrollUp);
|
||||
General.Actions.KeyPressed((int)SpecialKeys.MScrollUp | mod);
|
||||
General.Actions.KeyReleased((int)SpecialKeys.MScrollUp | mod);
|
||||
}
|
||||
// Scrollwheel down?
|
||||
else if(e.Delta < 0)
|
||||
{
|
||||
// Invoke actions for scrollwheel
|
||||
//for(int i = 0; i > e.Delta; i -= 120)
|
||||
General.Actions.KeyPressed((int)SpecialKeys.MScrollDown);
|
||||
General.Actions.KeyReleased((int)SpecialKeys.MScrollDown);
|
||||
General.Actions.KeyPressed((int)SpecialKeys.MScrollDown | mod);
|
||||
General.Actions.KeyReleased((int)SpecialKeys.MScrollDown | mod);
|
||||
}
|
||||
|
||||
// Let the base know
|
||||
|
|
Loading…
Reference in a new issue