Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.

Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
This commit is contained in:
MaxED 2015-03-30 21:44:04 +00:00
parent 791914a5db
commit a58f35227e
15 changed files with 291 additions and 90 deletions

View file

@ -261,21 +261,22 @@
<li><strong>[UDMF] </strong><a href="visual_mode/autoalignfloors.html">&quot;Auto-align textures&quot; actions now work on floors and ceilings</a>.</li>
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> New action: &quot;<strong>Match Brightness</strong>&quot;: this action makes the brightness of selected surfaces the same as the brightness of highlighted surface.</li>
<li><span class="style1"><strong>[new]</strong></span> New actions: &quot;<strong>Lower Floor/Ceiling to adjacent sector</strong>&quot; and &quot;<strong>Raise Floor/Ceiling to adjacent sector</strong>&quot; (default keys are PageDown and PageUp). By default, they will find next lower/higher surface in sectors, adjacent to selected ones, and lower/raise selected sectors to this height. If you hold Ctrl, they will lower/raise sectors to lowest/highest sector inside selection. And they will also drop selected things to ground or align them to ceiling.</li>
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> New actions: &quot;<strong>Scale Texture Up (X)</strong>&quot;, &quot;<strong>Scale Texture Down (X)</strong>&quot;, &quot;<strong>Scale Texture Up (Y)</strong>&quot;, &quot;<strong>Scale Texture Down (Y)</strong>&quot; actions. Default keys are Num6, Num4, Num8, Num5.<br />
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> New actions: &quot;<strong>Increase Scale</strong>&quot; (Num9), &quot;<strong>Decrease Scale</strong>&quot; (Num7), &quot;<strong>Increase Horizontal Scale</strong>&quot; (Num6), &quot;<strong>Decrease Horizontal Scale</strong>&quot; (Num4), &quot;<strong>Increase Vertical Scale</strong>&quot; (Num8), &quot;<strong>Decrease Vertical Scale</strong>&quot; (Num5) actions. These actions can be used to change thing scale and sidedef/floor/ceiling texture scale.<br />
</li>
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> New actions: &quot;<strong><a href="visual_mode/texturefit.html">Fit Texture</a></strong>&quot; (default key is Ctrl-Alt-A), &quot;<strong><a href="visual_mode/texturefit.html">Fit Texture's Width</a></strong>&quot; (Alt-A) and &quot;<strong><a href="visual_mode/texturefit.html">Fit Texture's Height</a></strong>&quot; (Alt-Shift-A).</li>
<li><span class="style1"><strong>[new]</strong></span> New action: &quot;<strong>Toggle slope</strong>&quot; (default key is Alt-S). Select or highlight upper/lower walls then call this action to add slopes. Select or highlight floors or ceilings then call this action to remove slopes.</li>
<li><span class="style1"><strong>[new]</strong></span> New action: &quot;<strong>Look Through Selection</strong>&quot; (default key is &quot;Y&quot;). This action places visual camera at the same position as selected/highlighted thing and rotates it to match thing's angle. Special handling is available if targeted thing is AimingCamera, MovingCamera, SecurityCamera or InterpolationPoint.</li>
<li><span class="style1"><strong>[new]</strong></span> New actions: &quot;<strong><a href="visual_mode/autoalign_to_selection.html">Auto-align Textures to Selection</a> (X)</strong>&quot;, &quot;<strong>Auto-align Textures to Selection (Y)</strong>&quot; and &quot;<strong>Auto-align Textures to Selection (X and Y)</strong>&quot;.</li>
<li>New actions: &quot;<strong>Rotate Clockwise</strong>&quot; and &quot;<strong>Rotate Counterclockwise</strong>&quot;, which can be used to rotate things and <span class="style1"><strong>[new]</strong></span><strong>[UDMF]</strong> floor/ceiling textures.</li>
<li><span class="style1"><strong>[new]</strong></span> New actions: &quot;<strong>Change Pitch Clockwise</strong>&quot;, &quot;<strong>Change Pitch Counterclockwise</strong>&quot;, &quot;<strong>Change Roll Clockwise</strong>&quot; and &quot;<strong>Change Roll Counterclockwise</strong>&quot;, which can be used to change pitch and roll of selected or highlighted things.</li>
<li>Things can be moved horizontally using &quot;<strong>Move Thing Forward/Backward/Left/Right</strong>&quot; actions.</li>
<li>Things can be moved to cursor position using &quot;<strong>Move Thing To Cursor Location</strong>&quot; (default key is Ctrl + Middle mouse) action.</li>
<li>Things can be inserted at cursor position using &quot;<strong>Insert Item</strong>&quot; action (default key is Insert).</li>
<li>Selected things can be deleted using &quot;<strong>Delete Item</strong>&quot; action (default key is Delete).</li>
<li>Selected things can be cut/copied/pasted at cursor position.</li>
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> Floor/ceiling texture rotation is now taken into account when moving texture offsets with arrow keys.</li>
<li><span class="style1"><strong>[new] </strong></span><strong>[UDMF] </strong>New action: &quot;<strong>Reset Local Texture Offsets (UDMF)</strong>&quot;. It will reset upper/middle/lower texture offsets, texture scale and rotation.</li>
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> &quot;<strong>Reset Texture Offsets</strong>&quot; action works on floors and ceilings.</li>
<li><span class="style1"><strong>[new] </strong></span><strong>[UDMF] </strong>New action: &quot;<strong>Reset Local Texture Offsets (UDMF)</strong>&quot;. It resets upper/middle/lower texture offsets, scale and brightness of targeted or selected sidedefs, resets texture offsets, rotation, scale and brightness of targeted or selected floors/ceilings and resets scale, pitch and roll of targeted or selected things.</li>
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> &quot;<strong>Reset Texture Offsets</strong>&quot; action now resets texture offsets of targeted or selected floors and ceilings and also resets scale of targeted or selected things.</li>
</ul>
</li>
</ul>

View file

@ -91,11 +91,11 @@ namespace CodeImp.DoomBuilder.GZBuilder.Rendering
//arrow
WorldVertex a0 = new WorldVertex(); //start
WorldVertex a1 = new WorldVertex(1.5f, 0.0f, 0.0f); //end
WorldVertex a2 = new WorldVertex(1.1f, 0.2f, 0.2f);
WorldVertex a3 = new WorldVertex(1.1f, -0.2f, 0.2f);
WorldVertex a4 = new WorldVertex(1.1f, 0.2f, -0.2f);
WorldVertex a5 = new WorldVertex(1.1f, -0.2f, -0.2f);
WorldVertex a1 = new WorldVertex( 0.0f, -1.5f, 0.0f); //end
WorldVertex a2 = new WorldVertex( 0.2f, -1.1f, 0.2f);
WorldVertex a3 = new WorldVertex(-0.2f, -1.1f, 0.2f);
WorldVertex a4 = new WorldVertex( 0.2f, -1.1f, -0.2f);
WorldVertex a5 = new WorldVertex(-0.2f, -1.1f, -0.2f);
WorldVertex[] arrowVerts = new WorldVertex[] {a0, a1,
a1, a2,

View file

@ -418,19 +418,19 @@ namespace CodeImp.DoomBuilder.Map
BeforePropsChange();
// Change angle
this.anglerad = Angle2D.DoomToReal(newangle);
this.angledoom = newangle;
anglerad = Angle2D.DoomToReal(newangle);
angledoom = newangle;
if(type != General.Map.Config.Start3DModeThingType)
General.Map.IsChanged = true;
}
//mxd
public void SetPitch(int p)
public void SetPitch(int newpitch)
{
BeforePropsChange();
pitch = p;
pitch = General.ClampAngle(newpitch);
pitchrad = ((isModel && General.Map.Data.ModeldefEntries[type].InheritActorPitch) ? Angle2D.DegToRad(pitch) : 0);
if (type != General.Map.Config.Start3DModeThingType)
@ -438,11 +438,11 @@ namespace CodeImp.DoomBuilder.Map
}
//mxd
public void SetRoll(int r)
public void SetRoll(int newroll)
{
BeforePropsChange();
roll = r;
roll = General.ClampAngle(newroll);
rollrad = ((isModel && General.Map.Data.ModeldefEntries[type].InheritActorRoll) ? Angle2D.DegToRad(roll) : 0);
if (type != General.Map.Config.Start3DModeThingType)

View file

@ -621,7 +621,7 @@ namespace CodeImp.DoomBuilder.Rendering
{
world = Matrix.Multiply(arrowScaler, t.Position * Matrix.Translation(0.0f, 0.0f, t.CageScales.M33 / 2));
}
Matrix rot = Matrix.RotationZ(t.Thing.Angle - Angle2D.PI / 2);
Matrix rot = Matrix.RotationY(-t.Thing.RollRad) * Matrix.RotationX(-t.Thing.PitchRad) * Matrix.RotationZ(t.Thing.Angle);
world = Matrix.Multiply(rot, world);
ApplyMatrices3D();

View file

@ -201,7 +201,7 @@
// roll
//
this.roll.AllowDecimal = false;
this.roll.AllowNegative = false;
this.roll.AllowNegative = true;
this.roll.AllowRelative = true;
this.roll.ButtonStep = 5;
this.roll.ButtonStepBig = 15F;
@ -228,7 +228,7 @@
// pitch
//
this.pitch.AllowDecimal = false;
this.pitch.AllowNegative = false;
this.pitch.AllowNegative = true;
this.pitch.AllowRelative = true;
this.pitch.ButtonStep = 5;
this.pitch.ButtonStepBig = 15F;

View file

@ -120,7 +120,4 @@
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -1045,12 +1045,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Make undo
if(selected.Count > 1)
{
General.Map.UndoRedo.CreateUndo("Rotate " + selected.Count + " things", this, UndoGroup.ThingRotate, CreateSelectionCRC(selected));
General.Map.UndoRedo.CreateUndo("Rotate " + selected.Count + " things", this, UndoGroup.ThingAngleChange, CreateSelectionCRC(selected));
General.Interface.DisplayStatus(StatusType.Action, "Rotated " + selected.Count + " things.");
}
else
{
General.Map.UndoRedo.CreateUndo("Rotate thing", this, UndoGroup.ThingRotate, CreateSelectionCRC(selected));
General.Map.UndoRedo.CreateUndo("Rotate thing", this, UndoGroup.ThingAngleChange, CreateSelectionCRC(selected));
General.Interface.DisplayStatus(StatusType.Action, "Rotated a thing.");
}

View file

@ -32,6 +32,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
public const int SurfaceBrightnessChange = 7; //mxd
public const int SectorHeightChange = 8;
public const int ThingMove = 9; //mxd
public const int ThingRotate = 10; //mxd
public const int ThingAngleChange = 10; //mxd
public const int ThingPitchChange = 11; //mxd
public const int ThingRollChange = 12; //mxd
}
}

View file

@ -770,6 +770,32 @@ movetexturedown8
default = 65576;
}
//mxd
scaleup
{
title = "Increase Scale";
category = "visual";
description = "Increases the scale of targeted or selected textures or things by 0.1 (UDMF only).";
allowkeys = true;
allowmouse = true;
allowscroll = true;
repeat = true;
default = 105; // Num 9
}
//mxd
scaledown
{
title = "Decrease Scale";
category = "visual";
description = "Decreases the scale of targeted or selected textures or things by 0.1 (UDMF only).";
allowkeys = true;
allowmouse = true;
allowscroll = true;
repeat = true;
default = 103; // Num 7
}
//mxd
scaleupx
{
@ -974,7 +1000,7 @@ resettexture
{
title = "Reset Texture Offsets";
category = "visual";
description = "Resets the texture offsets on targeted or selected sidedefs.";
description = "Resets the texture offsets of targeted or selected sidedefs (all map formats) and floors/ceilings (UDMF only). Also resets scale of targeted or selected things (UDMF only)";
allowkeys = true;
allowmouse = true;
allowscroll = true;
@ -985,7 +1011,7 @@ resettextureudmf
{
title = "Reset Local Texture Offsets (UDMF)";
category = "visual";
description = "Resets upper/middle/lower texture offsets and scale on targeted or selected sidedefs. Resets texture offsets, rotation and scale on targeted or selected floors/ceilings.";
description = "Resets upper/middle/lower texture offsets, scale and brightness of targeted or selected sidedefs. Resets texture offsets, rotation, scale and brightness of targeted or selected floors/ceilings. Resets scale, pitch and roll of targeted or selected things.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
@ -1129,7 +1155,7 @@ rotateclockwise
allowmouse = false;
allowscroll = true;
repeat = true;
default = 262138;
default = 262138; // Ctrl + Shift + ScrollUp
}
//mxd
@ -1142,7 +1168,59 @@ rotatecounterclockwise
allowmouse = false;
allowscroll = true;
repeat = true;
default = 262139;
default = 262139; // Ctrl + Shift + ScrollDown
}
//mxd
pitchclockwise
{
title = "Change Pitch Clockwise";
category = "visual";
description = "Increases pitch of selected or highlighted things (UDMF only).";
allowkeys = true;
allowmouse = false;
allowscroll = true;
repeat = true;
default = 458746; // Ctrl + Alt + ScrollUp
}
//mxd
pitchcounterclockwise
{
title = "Change Pitch Counterclockwise";
category = "visual";
description = "Decreases pitch of selected or highlighted things (UDMF only).";
allowkeys = true;
allowmouse = false;
allowscroll = true;
repeat = true;
default = 458747; // Ctrl + Alt + ScrollDown
}
//mxd
rollclockwise
{
title = "Change Roll Clockwise";
category = "visual";
description = "Increases roll of selected or highlighted things (UDMF only).";
allowkeys = true;
allowmouse = false;
allowscroll = true;
repeat = true;
default = 327674; // Alt + ScrollUp
}
//mxd
rollcounterclockwise
{
title = "Change Roll Counterclockwise";
category = "visual";
description = "Decreases roll of selected or highlighted things (UDMF only).";
allowkeys = true;
allowmouse = false;
allowscroll = true;
repeat = true;
default = 327675; // Alt + ScrollDown
}
//mxd

View file

@ -419,6 +419,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
//update geometry
Sector.UpdateSectorGeometry(false);
}
//mxd
protected void ClearFields(IEnumerable<string> keys, string undodescription, string resultdescription)
{
if(!General.Map.UDMF) return;
mode.CreateUndo(undodescription);
mode.SetActionResult(resultdescription);
Sector.Sector.Fields.BeforeFieldsChange();
foreach(string key in keys)
{
if(Sector.Sector.Fields.ContainsKey(key))
{
Sector.Sector.Fields.Remove(key);
Sector.Sector.UpdateNeeded = true;
}
}
if(Sector.Sector.UpdateNeeded) Sector.UpdateSectorGeometry(false);
}
#endregion

View file

@ -862,14 +862,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
return;
}
mode.CreateUndo("Reset local texture offsets");
mode.SetActionResult("Local texture offsets reset.");
mode.CreateUndo("Reset local texture offsets, scale and brightness");
mode.SetActionResult("Local texture offsets, scale and brightness reset.");
// Apply offsets
// Reset texture offsets
SetTextureOffsetX(0);
SetTextureOffsetY(0);
// Scale
ResetTextureScale();
// And brightness
if(Sidedef.Fields.ContainsKey("light")) Sidedef.Fields.Remove("light");
if(Sidedef.Fields.ContainsKey("lightabsolute")) Sidedef.Fields.Remove("lightabsolute");
// Update sidedef geometry
VisualSidedefParts parts = Sector.GetSidedefParts(Sidedef);
parts.SetupAllParts();
@ -1504,7 +1510,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementX != 0)
{
float pix = (int)Math.Round(Texture.Width * scaleX) + incrementX;
float pix = (int)Math.Round(Texture.Width * scaleX) - incrementX;
float newscaleX = (float)Math.Round(pix / Texture.Width, 3);
scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX);
UDMFTools.SetFloat(Sidedef.Fields, keyX, scaleX, 1.0f);
@ -1512,7 +1518,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementY != 0)
{
float pix = (int)Math.Round(Texture.Height * scaleY) + incrementY;
float pix = (int)Math.Round(Texture.Height * scaleY) - incrementY;
float newscaleY = (float)Math.Round(pix / Texture.Height, 3);
scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY);
UDMFTools.SetFloat(Sidedef.Fields, keyY, scaleY, 1.0f);

View file

@ -2637,13 +2637,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
PostAction();
}
//mxd
[BeginAction("scaleup")]
public void ScaleTextureUp()
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(1, 1);
PostAction();
}
//mxd
[BeginAction("scaledown")]
public void ScaleTextureDown()
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(-1, -1);
PostAction();
}
//mxd
[BeginAction("scaleupx")]
public void ScaleTextureUpX()
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(-1, 0);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(1, 0);
PostAction();
}
@ -2653,7 +2673,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(1, 0);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(-1, 0);
PostAction();
}
@ -2898,7 +2918,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ResetTexture()
{
PreAction(UndoGroup.None);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnResetTextureOffset();
PostAction();
}
@ -2907,7 +2927,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ResetLocalOffsets()
{
PreAction(UndoGroup.None);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnResetLocalTextureOffset();
PostAction();
}
@ -3089,14 +3109,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
PostAction();
}
//mxd. rotate clockwise
//mxd. Rotate clockwise
[BeginAction("rotateclockwise")]
public void RotateCW()
{
RotateThingsAndTextures(5);
}
//mxd. rotate counterclockwise
//mxd. Rotate counterclockwise
[BeginAction("rotatecounterclockwise")]
public void RotateCCW()
{
@ -3106,7 +3126,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
private void RotateThingsAndTextures(int increment)
{
PreAction(UndoGroup.ThingRotate);
PreAction(UndoGroup.ThingAngleChange);
List<IVisualEventReceiver> selection = GetSelectedObjects(true, false, true, false);
if(selection.Count == 0) return;
@ -3116,7 +3136,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(obj is BaseVisualThing)
{
BaseVisualThing t = obj as BaseVisualThing;
t.Rotate(General.ClampAngle(t.Thing.AngleDoom + increment));
t.SetAngle(General.ClampAngle(t.Thing.AngleDoom + increment));
}
else if(obj is VisualFloor)
{
@ -3133,6 +3153,70 @@ namespace CodeImp.DoomBuilder.BuilderModes
PostAction();
}
//mxd. Change pitch clockwise
[BeginAction("pitchclockwise")]
public void PitchCW()
{
ChangeThingsPitch(-5);
}
//mxd. Change pitch counterclockwise
[BeginAction("pitchcounterclockwise")]
public void PitchCCW()
{
ChangeThingsPitch(5);
}
//mxd
private void ChangeThingsPitch(int increment)
{
PreAction(UndoGroup.ThingPitchChange);
List<IVisualEventReceiver> selection = GetSelectedObjects(false, false, true, false);
if(selection.Count == 0) return;
foreach(IVisualEventReceiver obj in selection)
{
if(!(obj is BaseVisualThing)) continue;
BaseVisualThing t = obj as BaseVisualThing;
t.SetPitch(General.ClampAngle(t.Thing.Pitch + increment));
}
PostAction();
}
//mxd. Change pitch clockwise
[BeginAction("rollclockwise")]
public void RollCW()
{
ChangeThingsRoll(-5);
}
//mxd. Change pitch counterclockwise
[BeginAction("rollcounterclockwise")]
public void RollCCW()
{
ChangeThingsRoll(5);
}
//mxd
private void ChangeThingsRoll(int increment)
{
PreAction(UndoGroup.ThingRollChange);
List<IVisualEventReceiver> selection = GetSelectedObjects(false, false, true, false);
if(selection.Count == 0) return;
foreach(IVisualEventReceiver obj in selection)
{
if(!(obj is BaseVisualThing)) continue;
BaseVisualThing t = obj as BaseVisualThing;
t.SetRoll(General.ClampAngle(t.Thing.Roll + increment));
}
PostAction();
}
//mxd
[BeginAction("togglegzdoomgeometryeffects")]
public void ToggleGZDoomRenderingEffects()

View file

@ -469,8 +469,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnTextureAlign(bool alignx, bool aligny) { }
public virtual void OnToggleUpperUnpegged() { }
public virtual void OnToggleLowerUnpegged() { }
public virtual void OnResetTextureOffset() { }
public virtual void OnResetLocalTextureOffset() { } //mxd
public virtual void OnProcess(float deltatime) { }
public virtual void OnTextureFloodfill() { }
public virtual void OnInsert() { }
@ -564,6 +562,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
foreach(BaseVisualThing vt in updateList) vt.Changed = true;
}
//mxd
public virtual void OnResetTextureOffset()
{
mode.CreateUndo("Reset thing scale");
mode.SetActionResult("Thing scale reset.");
Thing.SetScale(1.0f, 1.0f);
// Update what must be updated
this.Changed = true;
}
//mxd
public virtual void OnResetLocalTextureOffset()
{
mode.CreateUndo("Reset thing scale, pitch and roll");
mode.SetActionResult("Thing scale, pitch and roll reset.");
Thing.SetScale(1.0f, 1.0f);
Thing.SetPitch(0);
Thing.SetRoll(0);
// Update what must be updated
this.Changed = true;
}
// Raise/lower thing
public virtual void OnChangeTargetHeight(int amount)
@ -647,12 +671,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd
public void Rotate(int ammount)
public void SetAngle(int newangle)
{
if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Rotate thing");
Thing.Rotate(ammount);
mode.SetActionResult("Changed thing rotation to " + Thing.AngleDoom + ".");
undoticket = mode.CreateUndo("Change thing angle");
Thing.Rotate(newangle);
mode.SetActionResult("Changed thing angle to " + Thing.AngleDoom + ".");
this.Changed = true;
}
//mxd
public void SetPitch(int newpitch)
{
if(!General.Map.UDMF) return;
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Change thing pitch");
Thing.SetPitch(newpitch);
mode.SetActionResult("Changed thing pitch to " + Thing.Pitch + ".");
this.Changed = true;
}
//mxd
public void SetRoll(int newroll)
{
if(!General.Map.UDMF) return;
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Change thing roll");
Thing.SetRoll(newroll);
mode.SetActionResult("Changed thing roll to " + Thing.Roll + ".");
this.Changed = true;
}

View file

@ -212,7 +212,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementX != 0)
{
float pix = (int)Math.Round(Texture.Width * scaleX) + incrementX;
float pix = (int)Math.Round(Texture.Width * scaleX) - incrementX;
float newscaleX = (float)Math.Round(pix / Texture.Width, 3);
scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX);
UDMFTools.SetFloat(s.Fields, "xscaleceiling", scaleX, 1.0f);
@ -220,7 +220,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementY != 0)
{
float pix = (int)Math.Round(Texture.Height * scaleY) + incrementY;
float pix = (int)Math.Round(Texture.Height * scaleY) - incrementY;
float newscaleY = (float)Math.Round(pix / Texture.Height, 3);
scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY);
UDMFTools.SetFloat(s.Fields, "yscaleceiling", scaleY, 1.0f);
@ -243,31 +243,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void OnResetTextureOffset()
{
if(!General.Map.UDMF) return;
mode.CreateUndo("Reset texture offsets");
mode.SetActionResult("Texture offsets reset.");
Sector.Sector.Fields.BeforeFieldsChange();
string[] keys = new[] { "xpanningceiling", "ypanningceiling", "xscaleceiling", "yscaleceiling", "rotationceiling" };
foreach(string key in keys)
{
if(Sector.Sector.Fields.ContainsKey(key))
{
Sector.Sector.Fields.Remove(key);
Sector.Sector.UpdateNeeded = true;
}
}
if(Sector.Sector.UpdateNeeded)
Sector.UpdateSectorGeometry(false);
ClearFields(new[] { "xpanningceiling", "ypanningceiling" }, "Reset texture offsets", "Texture offsets reset.");
}
//mxd
public override void OnResetLocalTextureOffset()
{
OnResetTextureOffset();
ClearFields(new[] { "xpanningceiling", "ypanningceiling", "xscaleceiling", "yscaleceiling", "rotationceiling", "lightceiling", "lightceilingabsolute" },
"Reset texture offsets, scale, rotation and brightness", "Texture offsets, scale, rotation and brightness reset.");
}
// Paste texture

View file

@ -214,7 +214,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementX != 0)
{
float pix = (int)Math.Round(Texture.Width * scaleX) + incrementX;
float pix = (int)Math.Round(Texture.Width * scaleX) - incrementX;
float newscaleX = (float)Math.Round(pix / Texture.Width, 3);
scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX);
UDMFTools.SetFloat(s.Fields, "xscalefloor", scaleX, 1.0f);
@ -222,7 +222,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementY != 0)
{
float pix = (int)Math.Round(Texture.Height * scaleY) + incrementY;
float pix = (int)Math.Round(Texture.Height * scaleY) - incrementY;
float newscaleY = (float)Math.Round(pix / Texture.Height, 3);
scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY);
UDMFTools.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0f);
@ -245,31 +245,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void OnResetTextureOffset()
{
if(!General.Map.UDMF) return;
mode.CreateUndo("Reset texture offsets");
mode.SetActionResult("Texture offsets reset.");
Sector.Sector.Fields.BeforeFieldsChange();
string[] keys = new[] { "xpanningfloor", "ypanningfloor", "xscalefloor", "yscalefloor", "rotationfloor" };
foreach(string key in keys)
{
if(Sector.Sector.Fields.ContainsKey(key))
{
Sector.Sector.Fields.Remove(key);
Sector.Sector.UpdateNeeded = true;
}
}
if(Sector.Sector.UpdateNeeded)
Sector.UpdateSectorGeometry(false);
ClearFields(new[] { "xpanningfloor", "ypanningfloor" }, "Reset texture offsets", "Texture offsets reset.");
}
//mxd
public override void OnResetLocalTextureOffset()
{
OnResetTextureOffset();
ClearFields(new[] { "xpanningfloor", "ypanningfloor", "xscalefloor", "yscalefloor", "rotationfloor", "lightfloor", "lightfloorabsolute" },
"Reset texture offsets, scale, rotation and brightness", "Texture offsets, scale, rotation and brightness reset.");
}
// Paste texture