mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-07 08:21:10 +00:00
Updated, Visual mode, UDMF: "Change Texture Scale" actions now take camera and texture angles into account when used on floors/ceilings.
Changed: "+++" and "---" prefixes are now incremented on the first step instead of the second when used in any numeric inputs, which support prefixes, except action arguments. Fixed, Visual mode, UDMF: texture offset/scale/rotation changes were applied several times when used on several 3d-floor floors/ceilings linked to the same control sector, when using "Move Texture Offsets" / "Change Texture Scale" / "Rotate Texture CW/CCW" actions. Updated ZDoom ACC (DamageActor). Updated ZDoom_ACS.cfg (DamageActor).
This commit is contained in:
parent
d1d0e93cef
commit
960db60973
17 changed files with 243 additions and 200 deletions
|
@ -397,6 +397,7 @@ special
|
|||
|
||||
// -1xx are reserved for Zandronum
|
||||
-200:CheckClass(1),
|
||||
-201:DamageActor(6), // [arookas]
|
||||
|
||||
// ZDaemon's
|
||||
-19620:GetTeamScore(1),
|
||||
|
|
|
@ -1375,7 +1375,7 @@ forcefield
|
|||
147
|
||||
{
|
||||
title = "ForceField Remove Around Tagged Sector";
|
||||
prefix = "SR";
|
||||
prefix = "S1";
|
||||
}
|
||||
|
||||
148
|
||||
|
|
|
@ -401,7 +401,7 @@ ammunition
|
|||
|
||||
153
|
||||
{
|
||||
title = "Phoshorus-Grenade Rounds";
|
||||
title = "Phosphorus-Grenade Rounds";
|
||||
sprite = "GRN2A0";
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ keywords
|
|||
//ConsoleCommand = "void ConsoleCommand(str command)";
|
||||
Cos = "fixed Cos(int angle)";
|
||||
CreateTranslation = "void CreateTranslation(int transnumber, a:b=c:d, ...)";
|
||||
DamageActor = "int DamageActor(int targettid, int targetptr, int inflictortid, int inflictorptr, int damage, str damagetype)";
|
||||
DamageThing = "DamageThing(amount, mod)";
|
||||
Delay = "void Delay(int tics)";
|
||||
Door_Animated = "Door_Animated(tag, speed, delay, lock)";
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
<br>
|
||||
<b>Action category:</b> Modes.<br>
|
||||
<b>Default key:</b> none.<br><br>
|
||||
This mode shows the sound environments in ZDoom maps (both Hexen format and UDMF). The gray areas do not belong to a sound environment.<br><br>
|
||||
This mode shows the sound environments in ZDoom UDMF maps. The gray areas do not belong to a sound environment.<br>
|
||||
<br>
|
||||
|
||||
The mode also supplies a docker that supplies information about the sound environments. It will display the sound environments, the SoundEnvironment things belonging to them and also the lines that are limit the sound environments. Clicking on the sound environments, things or lines in the list will center the map view on those objects.
|
||||
<br><br>
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public NumericTextbox()
|
||||
{
|
||||
this.ImeMode = ImeMode.Off;
|
||||
this.incrementstep = 1; //mxd
|
||||
|
||||
//mxd. Setup tooltip
|
||||
this.tooltip = new ToolTip { AutomaticDelay = 100, AutoPopDelay = 8000, InitialDelay = 100, ReshowDelay = 100 };
|
||||
|
@ -96,7 +97,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// When a key is pressed
|
||||
protected override void OnKeyPress(KeyPressEventArgs e)
|
||||
{
|
||||
incrementstep = 0; //mxd
|
||||
incrementstep = 1; //mxd
|
||||
string allowedchars = "0123456789\b";
|
||||
|
||||
// Determine allowed chars
|
||||
|
|
|
@ -181,60 +181,76 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
offsetx = (int)Math.Round(v.x);
|
||||
offsety = (int)Math.Round(v.y);
|
||||
|
||||
// Apply offsets
|
||||
// Calculate deltas
|
||||
int deltax, deltay;
|
||||
if(General.Interface.CtrlState && General.Interface.ShiftState)
|
||||
{
|
||||
//mxd. Clamp to grid size?
|
||||
int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
|
||||
int newoffsety = startoffsety + (int)Math.Round(offsety);
|
||||
int dx = prevoffsetx - newoffsetx;
|
||||
int dy = prevoffsety - newoffsety;
|
||||
deltax = prevoffsetx - newoffsetx;
|
||||
deltay = prevoffsety - newoffsety;
|
||||
|
||||
if(Math.Abs(dx) >= General.Map.Grid.GridSize)
|
||||
if(Math.Abs(deltax) >= General.Map.Grid.GridSize)
|
||||
{
|
||||
dx = General.Map.Grid.GridSize * Math.Sign(dx);
|
||||
deltax = General.Map.Grid.GridSize * Math.Sign(deltax);
|
||||
prevoffsetx = newoffsetx;
|
||||
}
|
||||
else
|
||||
{
|
||||
dx = 0;
|
||||
deltax = 0;
|
||||
}
|
||||
|
||||
if(Math.Abs(dy) >= General.Map.Grid.GridSize)
|
||||
if(Math.Abs(deltay) >= General.Map.Grid.GridSize)
|
||||
{
|
||||
dy = General.Map.Grid.GridSize * Math.Sign(dy);
|
||||
deltay = General.Map.Grid.GridSize * Math.Sign(deltay);
|
||||
prevoffsety = newoffsety;
|
||||
}
|
||||
else
|
||||
{
|
||||
dy = 0;
|
||||
deltay = 0;
|
||||
}
|
||||
|
||||
if(dx != 0 || dy != 0) mode.ApplyFlatOffsetChange(dx, dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
|
||||
int newoffsety = startoffsety + (int)Math.Round(offsety);
|
||||
mode.ApplyFlatOffsetChange(prevoffsetx - newoffsetx, prevoffsety - newoffsety);
|
||||
|
||||
deltax = prevoffsetx - newoffsetx;
|
||||
deltay = prevoffsety - newoffsety;
|
||||
|
||||
prevoffsetx = newoffsetx;
|
||||
prevoffsety = newoffsety;
|
||||
}
|
||||
|
||||
//mxd. Apply offset?
|
||||
if(deltax != 0 || deltay != 0)
|
||||
{
|
||||
mode.ApplyFlatOffsetChange(deltax, deltay);
|
||||
|
||||
// Update sector geometry
|
||||
Sector s = GetControlSector();
|
||||
if(s.Index != Sector.Sector.Index)
|
||||
{
|
||||
s.UpdateNeeded = true;
|
||||
s.UpdateCache();
|
||||
mode.GetSectorData(s).Update();
|
||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
|
||||
vs.UpdateSectorGeometry(false);
|
||||
vs.Rebuild();
|
||||
}
|
||||
|
||||
Sector.Sector.UpdateNeeded = true;
|
||||
Sector.Sector.UpdateCache();
|
||||
Sector.UpdateSectorGeometry(false);
|
||||
Sector.Rebuild();
|
||||
}
|
||||
|
||||
mode.ShowTargetInfo();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override Sector GetControlSector()
|
||||
{
|
||||
return level.sector;
|
||||
}
|
||||
|
||||
//mxd
|
||||
public virtual bool IsSelected()
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
public override Sector GetControlSector() { return level.sector; }
|
||||
|
||||
//mxd
|
||||
protected void AlignTextureToClosestLine(bool alignx, bool aligny)
|
||||
|
@ -453,7 +469,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public virtual void OnInsert() { }
|
||||
protected virtual void SetTexture(string texturename) { }
|
||||
public virtual void ApplyLinedefFlag(string flag, bool set) { }
|
||||
protected abstract void MoveTextureOffset(Point xy);
|
||||
protected abstract void MoveTextureOffset(int offsetx, int offsety);
|
||||
protected abstract Point GetTextureOffset();
|
||||
public virtual void OnPaintSelectEnd() { } // biwa
|
||||
|
||||
|
@ -873,6 +889,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
|
||||
undoticket = mode.CreateUndo("Change texture offsets");
|
||||
|
||||
//mxd
|
||||
changed = true;
|
||||
|
||||
//mxd
|
||||
if(General.Map.UDMF && doSurfaceAngleCorrection)
|
||||
{
|
||||
|
@ -907,24 +926,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Apply offsets
|
||||
MoveTextureOffset(new Point(-horizontal, -vertical));
|
||||
MoveTextureOffset(-horizontal, -vertical);
|
||||
|
||||
// Update sector geometry
|
||||
Sector s = GetControlSector();
|
||||
if(s.Index != Sector.Sector.Index)
|
||||
// Rebuild sector
|
||||
BaseVisualSector vs;
|
||||
if(mode.VisualSectorExists(level.sector))
|
||||
{
|
||||
s.UpdateNeeded = true;
|
||||
s.UpdateCache();
|
||||
mode.GetSectorData(s).Update();
|
||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
|
||||
vs.UpdateSectorGeometry(false);
|
||||
vs.Rebuild();
|
||||
vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||
}
|
||||
else
|
||||
{
|
||||
//mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
|
||||
vs = mode.CreateBaseVisualSector(level.sector);
|
||||
}
|
||||
|
||||
Sector.Sector.UpdateNeeded = true;
|
||||
Sector.Sector.UpdateCache();
|
||||
Sector.UpdateSectorGeometry(false);
|
||||
Sector.Rebuild();
|
||||
if(vs != null) vs.UpdateSectorGeometry(false);
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -938,23 +954,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
string key = (GeometryType == VisualGeometryType.FLOOR ? "rotationfloor" : "rotationceiling");
|
||||
mode.SetActionResult( (GeometryType == VisualGeometryType.FLOOR ? "Floor" : "Ceiling") + " rotation changed to " + angle);
|
||||
|
||||
//set value
|
||||
// Set new angle
|
||||
Sector s = GetControlSector();
|
||||
s.Fields.BeforeFieldsChange();
|
||||
UniFields.SetFloat(s.Fields, key, angle, 0.0f);
|
||||
|
||||
if(s.Index != Sector.Sector.Index)
|
||||
// Mark as changed
|
||||
changed = true;
|
||||
|
||||
// Rebuild sector
|
||||
BaseVisualSector vs;
|
||||
if(mode.VisualSectorExists(level.sector))
|
||||
{
|
||||
s.UpdateNeeded = true;
|
||||
s.UpdateCache();
|
||||
mode.GetSectorData(s).Update();
|
||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
|
||||
vs.UpdateSectorGeometry(false);
|
||||
vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||
}
|
||||
else
|
||||
{
|
||||
//mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
|
||||
vs = mode.CreateBaseVisualSector(level.sector);
|
||||
}
|
||||
|
||||
Sector.Sector.UpdateNeeded = true;
|
||||
Sector.Sector.UpdateCache();
|
||||
Sector.UpdateSectorGeometry(false);
|
||||
if(vs != null) vs.UpdateSectorGeometry(false);
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -962,11 +982,48 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
if(!General.Map.UDMF || !Texture.IsImageLoaded) return;
|
||||
|
||||
changed = true;
|
||||
|
||||
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
|
||||
undoticket = mode.CreateUndo("Change texture scale");
|
||||
|
||||
// Adjust to camera view
|
||||
float angle = Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY);
|
||||
if(GeometryType == VisualGeometryType.CEILING) angle += level.sector.Fields.GetValue("rotationceiling", 0f);
|
||||
else angle += level.sector.Fields.GetValue("rotationfloor", 0f);
|
||||
angle = General.ClampAngle(angle);
|
||||
|
||||
if(angle > 315 || angle < 46)
|
||||
{
|
||||
ChangeTextureScale(incrementX, incrementY);
|
||||
}
|
||||
else if(angle > 225)
|
||||
{
|
||||
ChangeTextureScale(incrementY, incrementX);
|
||||
}
|
||||
else if(angle > 135)
|
||||
{
|
||||
ChangeTextureScale(incrementX, incrementY);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeTextureScale(incrementY, incrementX);
|
||||
}
|
||||
|
||||
// Rebuild sector
|
||||
BaseVisualSector vs;
|
||||
if(mode.VisualSectorExists(level.sector))
|
||||
{
|
||||
vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||
}
|
||||
else
|
||||
{
|
||||
//mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
|
||||
vs = mode.CreateBaseVisualSector(level.sector);
|
||||
}
|
||||
|
||||
if(vs != null) vs.UpdateSectorGeometry(false);
|
||||
}
|
||||
|
||||
// biwa
|
||||
public virtual void OnPaintSelectBegin()
|
||||
|
|
|
@ -786,7 +786,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
protected abstract void SetTextureOffsetX(int x);
|
||||
protected abstract void SetTextureOffsetY(int y);
|
||||
protected virtual void ResetTextureScale() { } //mxd
|
||||
protected abstract void MoveTextureOffset(Point xy);
|
||||
protected abstract void MoveTextureOffset(int offsetx, int offsety);
|
||||
protected abstract Point GetTextureOffset();
|
||||
public virtual void OnTextureFit(FitTextureOptions options) { } //mxd
|
||||
public virtual void OnPaintSelectEnd() { } // biwa
|
||||
|
@ -1565,8 +1565,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd
|
||||
if(General.Map.UDMF)
|
||||
{
|
||||
// Apply UDMF offsets
|
||||
MoveTextureOffset(new Point(-horizontal, -vertical));
|
||||
// Apply per-texture offsets
|
||||
MoveTextureOffset(-horizontal, -vertical);
|
||||
Point p = GetTextureOffset();
|
||||
mode.SetActionResult("Changed texture offsets to " + p.X + ", " + p.Y + ".");
|
||||
|
||||
|
|
|
@ -2884,41 +2884,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetextureleft")]
|
||||
public void MoveTextureLeft1() { MoveTextureByOffset(-1, 0); }
|
||||
|
||||
[BeginAction("movetextureright")]
|
||||
public void MoveTextureRight1() { MoveTextureByOffset(1, 0); }
|
||||
|
||||
[BeginAction("movetextureup")]
|
||||
public void MoveTextureUp1() { MoveTextureByOffset(0, -1); }
|
||||
|
||||
[BeginAction("movetexturedown")]
|
||||
public void MoveTextureDown1() { MoveTextureByOffset(0, 1); }
|
||||
|
||||
[BeginAction("movetextureleft8")]
|
||||
public void MoveTextureLeft8() { MoveTextureByOffset(-8, 0); }
|
||||
|
||||
[BeginAction("movetextureright8")]
|
||||
public void MoveTextureRight8() { MoveTextureByOffset(8, 0); }
|
||||
|
||||
[BeginAction("movetextureup8")]
|
||||
public void MoveTextureUp8() { MoveTextureByOffset(0, -8); }
|
||||
|
||||
[BeginAction("movetexturedown8")]
|
||||
public void MoveTextureDown8() { MoveTextureByOffset(0, 8); }
|
||||
|
||||
[BeginAction("movetextureleftgs")] //mxd
|
||||
public void MoveTextureLeftGrid() { MoveTextureByOffset(-General.Map.Grid.GridSize, 0); }
|
||||
|
||||
[BeginAction("movetexturerightgs")] //mxd
|
||||
public void MoveTextureRightGrid() { MoveTextureByOffset(General.Map.Grid.GridSize, 0); }
|
||||
|
||||
[BeginAction("movetextureupgs")] //mxd
|
||||
public void MoveTextureUpGrid() { MoveTextureByOffset(0, -General.Map.Grid.GridSize); }
|
||||
|
||||
[BeginAction("movetexturedowngs")] //mxd
|
||||
public void MoveTextureDownGrid() { MoveTextureByOffset(0, General.Map.Grid.GridSize); }
|
||||
[BeginAction("movetextureleft")] public void MoveTextureLeft1() { MoveTextureByOffset(-1, 0); }
|
||||
[BeginAction("movetextureright")] public void MoveTextureRight1() { MoveTextureByOffset(1, 0); }
|
||||
[BeginAction("movetextureup")] public void MoveTextureUp1() { MoveTextureByOffset(0, -1); }
|
||||
[BeginAction("movetexturedown")] public void MoveTextureDown1() { MoveTextureByOffset(0, 1); }
|
||||
[BeginAction("movetextureleft8")] public void MoveTextureLeft8() { MoveTextureByOffset(-8, 0); }
|
||||
[BeginAction("movetextureright8")] public void MoveTextureRight8() { MoveTextureByOffset(8, 0); }
|
||||
[BeginAction("movetextureup8")] public void MoveTextureUp8() { MoveTextureByOffset(0, -8); }
|
||||
[BeginAction("movetexturedown8")] public void MoveTextureDown8() { MoveTextureByOffset(0, 8); }
|
||||
[BeginAction("movetextureleftgs")] public void MoveTextureLeftGrid() { MoveTextureByOffset(-General.Map.Grid.GridSize, 0); } //mxd
|
||||
[BeginAction("movetexturerightgs")] public void MoveTextureRightGrid() { MoveTextureByOffset(General.Map.Grid.GridSize, 0); } //mxd
|
||||
[BeginAction("movetextureupgs")] public void MoveTextureUpGrid() { MoveTextureByOffset(0, -General.Map.Grid.GridSize); } //mxd
|
||||
[BeginAction("movetexturedowngs")] public void MoveTextureDownGrid() { MoveTextureByOffset(0, General.Map.Grid.GridSize); } //mxd
|
||||
|
||||
//mxd
|
||||
private void MoveTextureByOffset(int ox, int oy)
|
||||
|
@ -2930,62 +2907,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
[BeginAction("scaleup")] public void ScaleTextureUp() { ScaleTexture(1, 1); }
|
||||
[BeginAction("scaledown")] public void ScaleTextureDown() { ScaleTexture(-1, -1); }
|
||||
[BeginAction("scaleupx")] public void ScaleTextureUpX() { ScaleTexture(1, 0); }
|
||||
[BeginAction("scaledownx")] public void ScaleTextureDownX() { ScaleTexture(-1, 0); }
|
||||
[BeginAction("scaleupy")] public void ScaleTextureUpY() { ScaleTexture(0, 1); }
|
||||
[BeginAction("scaledowny")] public void ScaleTextureDownY() { ScaleTexture(0, -1); }
|
||||
|
||||
//mxd
|
||||
[BeginAction("scaledown")]
|
||||
public void ScaleTextureDown()
|
||||
private void ScaleTexture(int incrementx, int incrementy)
|
||||
{
|
||||
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);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("scaledownx")]
|
||||
public void ScaleTextureDownX()
|
||||
{
|
||||
PreAction(UndoGroup.TextureScaleChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(-1, 0);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("scaleupy")]
|
||||
public void ScaleTextureUpY()
|
||||
{
|
||||
PreAction(UndoGroup.TextureScaleChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(0, 1);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("scaledowny")]
|
||||
public void ScaleTextureDownY()
|
||||
{
|
||||
PreAction(UndoGroup.TextureScaleChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(0, -1);
|
||||
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(incrementx, incrementy);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
|
|
|
@ -243,6 +243,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
//mxd
|
||||
public override void OnChangeScale(int incrementX, int incrementY)
|
||||
{
|
||||
// Only do this when not done yet in this call
|
||||
// Because we may be able to select the same 3D floor multiple times through multiple sectors
|
||||
SectorData sd = mode.GetSectorData(level.sector);
|
||||
if(!sd.CeilingChanged)
|
||||
{
|
||||
sd.CeilingChanged = true;
|
||||
base.OnChangeScale(incrementX, incrementY);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void OnChangeTextureRotation(float angle)
|
||||
{
|
||||
// Only do this when not done yet in this call
|
||||
// Because we may be able to select the same 3D floor multiple times through multiple sectors
|
||||
SectorData sd = mode.GetSectorData(level.sector);
|
||||
if(!sd.CeilingChanged)
|
||||
{
|
||||
sd.CeilingChanged = true;
|
||||
base.OnChangeTextureRotation(angle);
|
||||
}
|
||||
}
|
||||
|
||||
// Return texture coordinates
|
||||
protected override Point GetTextureOffset()
|
||||
{
|
||||
|
@ -250,8 +276,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Y = (int)Sector.Sector.Fields.GetValue("ypanningceiling", 0.0f) };
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection)
|
||||
{
|
||||
// Only do this when not done yet in this call
|
||||
// Because we may be able to select the same 3D floor multiple times through multiple sectors
|
||||
SectorData sd = mode.GetSectorData(level.sector);
|
||||
if(!sd.CeilingChanged)
|
||||
{
|
||||
sd.CeilingChanged = true;
|
||||
base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection);
|
||||
}
|
||||
}
|
||||
|
||||
// Move texture coordinates
|
||||
protected override void MoveTextureOffset(Point xy)
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety)
|
||||
{
|
||||
//mxd
|
||||
Sector s = GetControlSector();
|
||||
|
@ -274,8 +313,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if (!alignment.IsFlagSet("8192"))
|
||||
alignment.SetFlag("8192", true);
|
||||
|
||||
alignment.Front.OffsetX += xy.X;
|
||||
alignment.Front.OffsetY += xy.Y;
|
||||
alignment.Front.OffsetX += offsetx;
|
||||
alignment.Front.OffsetY += offsety;
|
||||
|
||||
float rotation = General.ClampAngle(90f - alignment.Angle * Angle2D.PIDEG);
|
||||
float rotationrad = rotation / Angle2D.PIDEG;
|
||||
|
@ -297,8 +336,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
else
|
||||
{
|
||||
float nx = (s.Fields.GetValue("xpanningceiling", 0.0f) + xy.X) % (Texture.ScaledWidth / s.Fields.GetValue("xscaleceiling", 1.0f));
|
||||
float ny = (s.Fields.GetValue("ypanningceiling", 0.0f) + xy.Y) % (Texture.ScaledHeight / s.Fields.GetValue("yscaleceiling", 1.0f));
|
||||
float nx = (s.Fields.GetValue("xpanningceiling", 0.0f) + offsetx) % (Texture.ScaledWidth / s.Fields.GetValue("xscaleceiling", 1.0f));
|
||||
float ny = (s.Fields.GetValue("ypanningceiling", 0.0f) + offsety) % (Texture.ScaledHeight / s.Fields.GetValue("yscaleceiling", 1.0f));
|
||||
s.Fields["xpanningceiling"] = new UniValue(UniversalType.Float, nx);
|
||||
s.Fields["ypanningceiling"] = new UniValue(UniversalType.Float, ny);
|
||||
s.UpdateNeeded = true;
|
||||
|
@ -333,21 +372,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
UniFields.SetFloat(s.Fields, "yscaleceiling", scaleY, 1.0f);
|
||||
}
|
||||
|
||||
// Update
|
||||
if(mode.VisualSectorExists(level.sector))
|
||||
{
|
||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||
vs.UpdateSectorGeometry(false);
|
||||
}
|
||||
|
||||
s.UpdateNeeded = true;
|
||||
s.UpdateCache();
|
||||
if(s.Index != Sector.Sector.Index)
|
||||
{
|
||||
Sector.Sector.UpdateNeeded = true;
|
||||
Sector.Sector.UpdateCache();
|
||||
}
|
||||
|
||||
mode.SetActionResult("Ceiling scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ").");
|
||||
}
|
||||
|
||||
|
|
|
@ -227,6 +227,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
//mxd
|
||||
public override void OnChangeScale(int incrementX, int incrementY)
|
||||
{
|
||||
// Only do this when not done yet in this call
|
||||
// Because we may be able to select the same 3D floor multiple times through multiple sectors
|
||||
SectorData sd = mode.GetSectorData(level.sector);
|
||||
if(!sd.FloorChanged)
|
||||
{
|
||||
sd.FloorChanged = true;
|
||||
base.OnChangeScale(incrementX, incrementY);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void OnChangeTextureRotation(float angle)
|
||||
{
|
||||
// Only do this when not done yet in this call
|
||||
// Because we may be able to select the same 3D floor multiple times through multiple sectors
|
||||
SectorData sd = mode.GetSectorData(level.sector);
|
||||
if(!sd.FloorChanged)
|
||||
{
|
||||
sd.FloorChanged = true;
|
||||
base.OnChangeTextureRotation(angle);
|
||||
}
|
||||
}
|
||||
|
||||
// Return texture coordinates
|
||||
protected override Point GetTextureOffset()
|
||||
{
|
||||
|
@ -234,8 +260,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Y = (int)Sector.Sector.Fields.GetValue("ypanningfloor", 0.0f) };
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection)
|
||||
{
|
||||
// Only do this when not done yet in this call
|
||||
// Because we may be able to select the same 3D floor multiple times through multiple sectors
|
||||
SectorData sd = mode.GetSectorData(level.sector);
|
||||
if(!sd.FloorChanged)
|
||||
{
|
||||
sd.FloorChanged = true;
|
||||
base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection);
|
||||
}
|
||||
}
|
||||
|
||||
// Move texture coordinates
|
||||
protected override void MoveTextureOffset(Point xy)
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety)
|
||||
{
|
||||
//mxd
|
||||
Sector s = GetControlSector();
|
||||
|
@ -258,8 +297,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if (!alignment.IsFlagSet("8192"))
|
||||
alignment.SetFlag("8192", true);
|
||||
|
||||
alignment.Front.OffsetX += xy.X;
|
||||
alignment.Front.OffsetY += xy.Y;
|
||||
alignment.Front.OffsetX += offsetx;
|
||||
alignment.Front.OffsetY += offsety;
|
||||
|
||||
float rotation = General.ClampAngle(90f - alignment.Angle * Angle2D.PIDEG);
|
||||
float rotationrad = rotation / Angle2D.PIDEG;
|
||||
|
@ -279,8 +318,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
else
|
||||
{
|
||||
float nx = (s.Fields.GetValue("xpanningfloor", 0.0f) + xy.X) % (Texture.ScaledWidth / s.Fields.GetValue("xscalefloor", 1.0f));
|
||||
float ny = (s.Fields.GetValue("ypanningfloor", 0.0f) + xy.Y) % (Texture.ScaledHeight / s.Fields.GetValue("yscalefloor", 1.0f));
|
||||
float nx = (s.Fields.GetValue("xpanningfloor", 0.0f) + offsetx) % (Texture.ScaledWidth / s.Fields.GetValue("xscalefloor", 1.0f));
|
||||
float ny = (s.Fields.GetValue("ypanningfloor", 0.0f) + offsety) % (Texture.ScaledHeight / s.Fields.GetValue("yscalefloor", 1.0f));
|
||||
s.Fields["xpanningfloor"] = new UniValue(UniversalType.Float, nx);
|
||||
s.Fields["ypanningfloor"] = new UniValue(UniversalType.Float, ny);
|
||||
s.UpdateNeeded = true;
|
||||
|
@ -315,21 +354,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
UniFields.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0f);
|
||||
}
|
||||
|
||||
// Update geometry
|
||||
if(mode.VisualSectorExists(level.sector))
|
||||
{
|
||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||
vs.UpdateSectorGeometry(false);
|
||||
}
|
||||
|
||||
s.UpdateNeeded = true;
|
||||
s.UpdateCache();
|
||||
if(s.Index != Sector.Sector.Index)
|
||||
{
|
||||
Sector.Sector.UpdateNeeded = true;
|
||||
Sector.Sector.UpdateCache();
|
||||
}
|
||||
|
||||
mode.SetActionResult("Floor scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ").");
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Unused
|
||||
protected override void SetTextureOffsetX(int x) { }
|
||||
protected override void SetTextureOffsetY(int y) { }
|
||||
protected override void MoveTextureOffset(Point xy) { }
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety) { }
|
||||
protected override Point GetTextureOffset() { return Point.Empty; }
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -299,7 +299,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, (float)y);
|
||||
}
|
||||
|
||||
protected override void MoveTextureOffset(Point xy)
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety)
|
||||
{
|
||||
Sidedef.Fields.BeforeFieldsChange();
|
||||
float oldx = Sidedef.Fields.GetValue("offsetx_bottom", 0.0f);
|
||||
|
@ -307,8 +307,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
float scalex = Sidedef.Fields.GetValue("scalex_bottom", 1.0f);
|
||||
float scaley = Sidedef.Fields.GetValue("scaley_bottom", 1.0f);
|
||||
bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd
|
||||
Sidedef.Fields["offsetx_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, textureloaded ? Texture.Width : -1)); //mxd
|
||||
Sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, textureloaded ? Texture.Height : -1)); //mxd
|
||||
Sidedef.Fields["offsetx_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, textureloaded ? Texture.Width : -1)); //mxd
|
||||
Sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, textureloaded ? Texture.Height : -1)); //mxd
|
||||
}
|
||||
|
||||
protected override Point GetTextureOffset()
|
||||
|
|
|
@ -452,15 +452,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y);
|
||||
}
|
||||
|
||||
protected override void MoveTextureOffset(Point xy)
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety)
|
||||
{
|
||||
Sidedef.Fields.BeforeFieldsChange();
|
||||
float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
|
||||
float oldy = Sidedef.Fields.GetValue("offsety_mid", 0.0f);
|
||||
float scalex = extrafloor.Linedef.Front.Fields.GetValue("scalex_mid", 1.0f); //mxd
|
||||
float scaley = extrafloor.Linedef.Front.Fields.GetValue("scaley_mid", 1.0f); //mxd
|
||||
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, Texture.Width)); //mxd
|
||||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, Texture.Height)); //mxd
|
||||
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, Texture.Width)); //mxd
|
||||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, Texture.Height)); //mxd
|
||||
}
|
||||
|
||||
protected override Point GetTextureOffset()
|
||||
|
|
|
@ -464,7 +464,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y);
|
||||
}
|
||||
|
||||
protected override void MoveTextureOffset(Point xy)
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety)
|
||||
{
|
||||
Sidedef.Fields.BeforeFieldsChange();
|
||||
float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
|
||||
|
@ -472,11 +472,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
float scalex = Sidedef.Fields.GetValue("scalex_mid", 1.0f);
|
||||
float scaley = Sidedef.Fields.GetValue("scaley_mid", 1.0f);
|
||||
bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd
|
||||
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, textureloaded ? Texture.Width : -1)); //mxd
|
||||
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, textureloaded ? Texture.Width : -1)); //mxd
|
||||
|
||||
//mxd. Don't clamp offsetY of clipped mid textures
|
||||
bool dontClamp = (!textureloaded || (!Sidedef.IsFlagSet("wrapmidtex") && !Sidedef.Line.IsFlagSet("wrapmidtex")));
|
||||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, dontClamp ? -1 : Texture.Height));
|
||||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, dontClamp ? -1 : Texture.Height));
|
||||
}
|
||||
|
||||
protected override Point GetTextureOffset()
|
||||
|
|
|
@ -293,15 +293,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y);
|
||||
}
|
||||
|
||||
protected override void MoveTextureOffset(Point xy)
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety)
|
||||
{
|
||||
Sidedef.Fields.BeforeFieldsChange();
|
||||
float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
|
||||
float oldy = Sidedef.Fields.GetValue("offsety_mid", 0.0f);
|
||||
float scalex = Sidedef.Fields.GetValue("scalex_mid", 1.0f);
|
||||
float scaley = Sidedef.Fields.GetValue("scaley_mid", 1.0f);
|
||||
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, Texture.Width)); //mxd
|
||||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, Texture.Height)); //mxd
|
||||
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, Texture.Width)); //mxd
|
||||
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, Texture.Height)); //mxd
|
||||
}
|
||||
|
||||
protected override Point GetTextureOffset()
|
||||
|
|
|
@ -294,7 +294,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, (float)y);
|
||||
}
|
||||
|
||||
protected override void MoveTextureOffset(Point xy)
|
||||
protected override void MoveTextureOffset(int offsetx, int offsety)
|
||||
{
|
||||
Sidedef.Fields.BeforeFieldsChange();
|
||||
float oldx = Sidedef.Fields.GetValue("offsetx_top", 0.0f);
|
||||
|
@ -302,8 +302,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
float scalex = Sidedef.Fields.GetValue("scalex_top", 1.0f);
|
||||
float scaley = Sidedef.Fields.GetValue("scaley_top", 1.0f);
|
||||
bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd
|
||||
Sidedef.Fields["offsetx_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, textureloaded ? Texture.Width : -1)); //mxd
|
||||
Sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, textureloaded ? Texture.Height : -1)); //mxd
|
||||
Sidedef.Fields["offsetx_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, textureloaded ? Texture.Width : -1)); //mxd
|
||||
Sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, textureloaded ? Texture.Height : -1)); //mxd
|
||||
}
|
||||
|
||||
protected override Point GetTextureOffset()
|
||||
|
|
Loading…
Reference in a new issue