Sector drawing: basic properties (textures, brightness, floor and ceiling height) are now taken from the nearest sector when a new isolated sector (e.g. a sector, which doesn't not intersect with already existing map geometry and is not inside of it) is drawn.

Visual mode: when "Synch camera position" setting is enabled, and the cursor was outside of a sector when entering Visual mode, camera height is now adjusted based on nearest sector (previously the height was adjusted only when the cursor was inside of a sector).  
"Auto-align textures X", "Auto-align textures X and Y" actions, UDMF: alignment source sidedef part's horizontal scale is now applied to all aligned sidedefs.
Visual mode, UDMF: 'lightfog' flag is now automatically updated when changing sidedef brightness or using "Match Brightness" action. 
Linedefs mode: added "Update 'lightfog' flag" menu item.
Game configurations: cosmetic changes in UDMF linedef flag names.
Updated ZDoom_DECORATE.cfg.
This commit is contained in:
MaxED 2015-02-12 22:04:49 +00:00
parent 3d3905e31c
commit 133e1367d8
13 changed files with 223 additions and 133 deletions

View file

@ -15,7 +15,7 @@ skills
linedefflags linedefflags
{ {
1 = "Impassable"; 1 = "Impassable";
2 = "Block Monster"; 2 = "Block Monsters";
4 = "Double Sided"; 4 = "Double Sided";
8 = "Upper Unpegged"; 8 = "Upper Unpegged";
16 = "Lower Unpegged"; 16 = "Lower Unpegged";

View file

@ -94,11 +94,11 @@ sectorflags
linedefflags linedefflags
{ {
blocking = "Impassable"; blocking = "Impassable";
blockmonsters = "Block monster"; blockmonsters = "Block monsters";
twosided = "Doublesided"; twosided = "Doublesided";
dontpegtop = "Upper unpegged"; dontpegtop = "Upper unpegged";
dontpegbottom = "Lower unpegged"; dontpegbottom = "Lower unpegged";
secret = "Secret"; secret = "Shown as 1-sided on automap";
blocksound = "Block sound"; blocksound = "Block sound";
dontdraw = "Not shown on automap"; dontdraw = "Not shown on automap";
transparent = "Transparent (25% opacity)"; transparent = "Transparent (25% opacity)";

View file

@ -33,7 +33,7 @@ linedefflags_udmf
blocking = "Impassable"; blocking = "Impassable";
blockeverything = "Block everything"; blockeverything = "Block everything";
blockplayers = "Block players"; blockplayers = "Block players";
blockmonsters = "Block monster"; blockmonsters = "Block monsters";
blockfloaters = "Block floating monsters"; blockfloaters = "Block floating monsters";
blocksound = "Block sound"; blocksound = "Block sound";
blockprojectiles = "Block projectiles"; blockprojectiles = "Block projectiles";
@ -45,13 +45,13 @@ linedefflags_udmf
jumpover = "Jump-over railing"; jumpover = "Jump-over railing";
clipmidtex = "Clip middle texture"; clipmidtex = "Clip middle texture";
wrapmidtex = "Wrap middle texture"; wrapmidtex = "Wrap middle texture";
mapped = "Initially shown on automap"; mapped = "Initially shown on map";
dontdraw = "Not shown on automap"; secret = "Shown as 1-sided on map";
dontdraw = "Not shown on map";
transparent = "Transparent (25% opacity)"; transparent = "Transparent (25% opacity)";
translucent = "Translucent (obsolete)"; translucent = "Translucent (obsolete)";
monsteractivate = "Monster activates"; monsteractivate = "Monster activates";
zoneboundary = "Sound zone boundary"; zoneboundary = "Sound zone boundary";
secret = "Secret";
} }

View file

@ -34,8 +34,8 @@ keywords
A_DamageTarget = "A_DamageTarget(int amount[, str damagetype = \"None\"[, int flags = 0[, str filter = \"None\"[, str species = \"None\"]]]])\namount: amount of damage to inflict. Use a negative value to heal.\ndamagetype: the type of damage to inflict.\nflags: DMSS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage."; A_DamageTarget = "A_DamageTarget(int amount[, str damagetype = \"None\"[, int flags = 0[, str filter = \"None\"[, str species = \"None\"]]]])\namount: amount of damage to inflict. Use a negative value to heal.\ndamagetype: the type of damage to inflict.\nflags: DMSS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage.";
A_DamageTracer = "A_DamageTracer(int amount[, str damagetype = \"None\"[, int flags = 0[, str filter = \"None\"[, str species = \"None\"]]]])\namount: amount of damage to inflict. Use a negative value to heal.\ndamagetype: the type of damage to inflict.\nflags: DMSS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage."; A_DamageTracer = "A_DamageTracer(int amount[, str damagetype = \"None\"[, int flags = 0[, str filter = \"None\"[, str species = \"None\"]]]])\namount: amount of damage to inflict. Use a negative value to heal.\ndamagetype: the type of damage to inflict.\nflags: DMSS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage.";
A_Die = "A_Die[(str damagetype)]"; A_Die = "A_Die[(str damagetype)]";
A_FaceTarget = "A_FaceTarget[(float angle = 0[, float pitch = 0])]"; A_FaceTarget = "A_FaceTarget[(float angle = 0[, float pitch = 0])]\nA_FaceTarget(float max_turn, float max_pitch, float ang_offset, float pitch_offset, int flags)";
A_FaceMaster = "A_FaceMaster[(float angle = 0[, float pitch = 0])]"; A_FaceMaster = "A_FaceMaster[(float angle = 0[, float pitch = 0])]\nA_FaceMaster(float max_turn, float max_pitch, float ang_offset, float pitch_offset, int flags)";
A_FastChase = "A_FastChase"; A_FastChase = "A_FastChase";
A_KillChildren = "A_KillChildren[(str damagetype = \"None\"[, int flags = 0[, str filter = \"None\[, str species = \"None\]]])]\ndamagetype: if the actor dies, the actor will enter a death state based on damagetype if present (or pain state if using NODAMAGE).\nflags: KILS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage."; A_KillChildren = "A_KillChildren[(str damagetype = \"None\"[, int flags = 0[, str filter = \"None\[, str species = \"None\]]])]\ndamagetype: if the actor dies, the actor will enter a death state based on damagetype if present (or pain state if using NODAMAGE).\nflags: KILS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage.";
A_KillMaster = "A_KillMaster[(str damagetype = \"None\"[, int flags = 0[, str filter = \"None\"[, str species = \"None\"]]])]\ndamagetype: if the actor dies, the actor will enter a death state based on damagetype if present (or pain state if using NODAMAGE).\nflags: KILS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage."; A_KillMaster = "A_KillMaster[(str damagetype = \"None\"[, int flags = 0[, str filter = \"None\"[, str species = \"None\"]]])]\ndamagetype: if the actor dies, the actor will enter a death state based on damagetype if present (or pain state if using NODAMAGE).\nflags: KILS flags.\nfilter: the actor class to damage.\nspecies: the actor species to damage.";
@ -177,6 +177,7 @@ keywords
A_SetReflective = "A_SetReflective"; A_SetReflective = "A_SetReflective";
A_SetReflectiveInvulnerable = "A_SetReflectiveInvulnerable"; A_SetReflectiveInvulnerable = "A_SetReflectiveInvulnerable";
A_SetScale = "A_SetScale(float scaleX[, float scaleY = scaleX[, int pointer = AAPTR_DEFAULT]])"; A_SetScale = "A_SetScale(float scaleX[, float scaleY = scaleX[, int pointer = AAPTR_DEFAULT]])";
A_SetRoll = "A_SetRoll(float pitch[, int flags = 0[, int pointer = AAPTR_DEFAULT]])";
A_SetShadow = "A_SetShadow"; A_SetShadow = "A_SetShadow";
A_SetShootable = "A_SetShootable"; A_SetShootable = "A_SetShootable";
A_SetSolid = "A_SetSolid"; A_SetSolid = "A_SetSolid";
@ -198,7 +199,7 @@ keywords
A_SeekerMissile = "A_SeekerMissile(angle threshold, angle maxturnangle[, int flags = 0[, int chance = 50[, int distance = 10]]])\nflags: SMF flags."; A_SeekerMissile = "A_SeekerMissile(angle threshold, angle maxturnangle[, int flags = 0[, int chance = 50[, int distance = 10]]])\nflags: SMF flags.";
A_Tracer = "A_Tracer"; A_Tracer = "A_Tracer";
A_Tracer2 = "A_Tracer2"; A_Tracer2 = "A_Tracer2";
A_FaceTracer = "A_FaceTracer[(float angle = 0[, float pitch = 0])]"; A_FaceTracer = "A_FaceTracer[(float angle = 0[, float pitch = 0])]\nA_FaceTracer(float max_turn, float max_pitch, float ang_offset, float pitch_offset, int flags)";
A_Fire = "A_Fire[(float height = 0)]"; A_Fire = "A_Fire[(float height = 0)]";
A_Weave = "A_Weave(int horzspeed, int vertspeed, float horzdist, float vertdist)"; A_Weave = "A_Weave(int horzspeed, int vertspeed, float horzdist, float vertdist)";
A_Warp = "A_Warp(int ptr_destination, float x-offset, float y-offset, float z-offset, float angle, int flags, str success_state)\nflags: WARPF flags."; A_Warp = "A_Warp(int ptr_destination, float x-offset, float y-offset, float z-offset, float angle, int flags, str success_state)\nflags: WARPF flags.";
@ -638,6 +639,7 @@ constants
SXF_SETTRACER; SXF_SETTRACER;
SXF_NOPOINTERS; SXF_NOPOINTERS;
SXF_ORIGINATOR; SXF_ORIGINATOR;
SXF_TRANSFERSPRITEFRAME;
//weapon flags //weapon flags
WRF_NOBOB; WRF_NOBOB;
WRF_NOFIRE; WRF_NOFIRE;
@ -1130,4 +1132,9 @@ constants
MRF_UNDOBYDEATH; MRF_UNDOBYDEATH;
MRF_UNDOBYDEATHFORCED; MRF_UNDOBYDEATHFORCED;
MRF_UNDOBYDEATHSAVES; MRF_UNDOBYDEATHSAVES;
//A_FaceTraget/Master/Tracer flags
FAF_BOTTOM;
FAF_MIDDLE;
FAF_TOP;
FAF_NODISTFACTOR;
} }

View file

@ -496,7 +496,8 @@ namespace CodeImp.DoomBuilder.Geometry
} }
} }
// Use default settings from neares linedef, if settings have been found yet // Use default settings from the nearest linedef, if settings have not been found yet
Sector nearestsector = null; //mxd
if( (nearbylines != null) && (alllines.Count > 0) && (!foundsidedefaults || (sourcesector == null)) ) if( (nearbylines != null) && (alllines.Count > 0) && (!foundsidedefaults || (sourcesector == null)) )
{ {
Vector2D testpoint = alllines[0].Line.GetSidePoint(alllines[0].Front); Vector2D testpoint = alllines[0].Line.GetSidePoint(alllines[0].Front);
@ -511,6 +512,16 @@ namespace CodeImp.DoomBuilder.Geometry
if(sourcesector == null) sourcesector = defaultside.Sector; if(sourcesector == null) sourcesector = defaultside.Sector;
TakeSidedefSettings(ref sourceside, defaultside); TakeSidedefSettings(ref sourceside, defaultside);
} }
else
{
//mxd. Any side is better than no side (but we'll want only basic settings from that)...
defaultside = (side < 0.0f ? nearest.Back : nearest.Front);
if(defaultside != null)
{
TakeSidedefSettings(ref sourceside, defaultside);
nearestsector = defaultside.Sector;
}
}
} }
} }
@ -522,21 +533,34 @@ namespace CodeImp.DoomBuilder.Geometry
{ {
// Copy properties from source to new sector // Copy properties from source to new sector
sourcesector.CopyPropertiesTo(newsector); sourcesector.CopyPropertiesTo(newsector);
}
//mxd. Apply overrides else if(nearestsector != null)
if(useOverrides) {
{ //mxd. Apply basic properties from the nearest sector
if (General.Map.Options.OverrideCeilingTexture) newsector.SetCeilTexture(General.Map.Options.DefaultCeilingTexture); newsector.SetFloorTexture(nearestsector.FloorTexture);
if (General.Map.Options.OverrideFloorTexture) newsector.SetFloorTexture(General.Map.Options.DefaultFloorTexture); newsector.SetCeilTexture(nearestsector.CeilTexture);
if (General.Map.Options.OverrideCeilingHeight) newsector.CeilHeight = General.Map.Options.CustomCeilingHeight; newsector.FloorHeight = nearestsector.FloorHeight;
if (General.Map.Options.OverrideFloorHeight) newsector.FloorHeight = General.Map.Options.CustomFloorHeight; newsector.CeilHeight = nearestsector.CeilHeight;
if (General.Map.Options.OverrideBrightness) newsector.Brightness = General.Map.Options.CustomBrightness; newsector.Brightness = nearestsector.Brightness;
}
} }
else else
{ {
// No source sector, apply default sector properties // No source sector, apply default sector properties
ApplyDefaultsToSector(newsector); newsector.SetFloorTexture(General.Map.Options.DefaultFloorTexture);
newsector.SetCeilTexture(General.Map.Options.DefaultCeilingTexture);
newsector.FloorHeight = General.Settings.DefaultFloorHeight;
newsector.CeilHeight = General.Settings.DefaultCeilingHeight;
newsector.Brightness = General.Settings.DefaultBrightness;
}
//mxd. Apply overrides?
if(useOverrides)
{
if(General.Map.Options.OverrideCeilingTexture) newsector.SetCeilTexture(General.Map.Options.DefaultCeilingTexture);
if(General.Map.Options.OverrideFloorTexture) newsector.SetFloorTexture(General.Map.Options.DefaultFloorTexture);
if(General.Map.Options.OverrideCeilingHeight) newsector.CeilHeight = General.Map.Options.CustomCeilingHeight;
if(General.Map.Options.OverrideFloorHeight) newsector.FloorHeight = General.Map.Options.CustomFloorHeight;
if(General.Map.Options.OverrideBrightness) newsector.Brightness = General.Map.Options.CustomBrightness;
} }
// Go for all sides to make sidedefs // Go for all sides to make sidedefs
@ -712,16 +736,6 @@ namespace CodeImp.DoomBuilder.Geometry
if(sd.LowRequired() && sd.LongLowTexture == MapSet.EmptyLongName) sd.SetTextureLow(defaults.newtexlow); //mxd if(sd.LowRequired() && sd.LongLowTexture == MapSet.EmptyLongName) sd.SetTextureLow(defaults.newtexlow); //mxd
} }
// This applies defaults to a sector
private static void ApplyDefaultsToSector(Sector s)
{
s.SetFloorTexture(General.Map.Options.DefaultFloorTexture);
s.SetCeilTexture(General.Map.Options.DefaultCeilingTexture);
s.FloorHeight = (General.Map.Options.OverrideFloorHeight ? General.Map.Options.CustomFloorHeight : General.Settings.DefaultFloorHeight);
s.CeilHeight = (General.Map.Options.OverrideCeilingHeight ? General.Map.Options.CustomCeilingHeight : General.Settings.DefaultCeilingHeight);
s.Brightness = (General.Map.Options.OverrideBrightness ? General.Map.Options.CustomBrightness : General.Settings.DefaultBrightness);
}
//mxd. This applies overrides to a sidedef //mxd. This applies overrides to a sidedef
private static void ApplyOverridesToSidedef(Sidedef sd) private static void ApplyOverridesToSidedef(Sidedef sd)
{ {
@ -2168,6 +2182,51 @@ namespace CodeImp.DoomBuilder.Geometry
#endregion #endregion
#region ================== Sidedefs (mxd)
/// <summary>Updates the 'lightfog' UDMF flag to display sidedef brightness on fogged walls. Returns 1 if flag was added, -1 if it was removed, 0 if flag wasn't changed</summary>
public static int UpdateLightFogFlag(Sidedef side)
{
//Side requires the flag?
if(side.Sector == null) return 0;
if(!side.Fields.ContainsKey("light"))
{
//Unset the flag
if(side.IsFlagSet("lightfog"))
{
side.SetFlag("lightfog", false);
return -1;
}
return 0;
}
//Update the flag
if(General.Map.Data.MapInfo.HasFadeColor ||
(General.Map.Data.MapInfo.HasOutsideFogColor && side.Sector.CeilTexture == General.Map.Config.SkyFlatName) ||
side.Sector.Fields.ContainsKey("fadecolor"))
{
//Set the flag
if(!side.IsFlagSet("lightfog"))
{
side.SetFlag("lightfog", true);
return 1;
}
}
else
{
//Unset the flag
if(side.IsFlagSet("lightfog"))
{
side.SetFlag("lightfog", false);
return -1;
}
}
return 0;
}
#endregion
#region ================== Misc Exported Functions #region ================== Misc Exported Functions
/// <summary> /// <summary>

View file

@ -170,28 +170,40 @@ namespace CodeImp.DoomBuilder.VisualModes
//mxd. Synch camera position to cursor position or center of the screen in 2d-mode //mxd. Synch camera position to cursor position or center of the screen in 2d-mode
if(General.Settings.GZSynchCameras) if(General.Settings.GZSynchCameras)
{ {
//if position is inside sector - adjust camera.z accordingly //If initial position is inside or nearby a sector - adjust camera.z accordingly
Sector sector = General.Map.Map.GetSectorByCoordinates(initialcameraposition, blockmap);
float posz = General.Map.VisualCamera.Position.z; float posz = General.Map.VisualCamera.Position.z;
if(sector != null) Sector nearestsector = General.Map.Map.GetSectorByCoordinates(initialcameraposition, blockmap);
if(nearestsector == null)
{ {
int sectorHeight = sector.CeilHeight - sector.FloorHeight; Linedef nearestline = MapSet.NearestLinedef(General.Map.Map.Linedefs, initialcameraposition);
if(General.Map.VisualCamera.Position.z < sector.FloorHeight + 41) if(nearestline != null)
{ {
if(sectorHeight < 41) float side = nearestline.SideOfLine(initialcameraposition);
posz = sector.FloorHeight + sectorHeight / 2; Sidedef nearestside = (side < 0.0f ? nearestline.Front : nearestline.Back) ?? (side < 0.0f ? nearestline.Back : nearestline.Front);
else if(nearestside != null) nearestsector = nearestside.Sector;
posz = sector.FloorHeight + 41; // same as in doom
}
else if(General.Map.VisualCamera.Position.z > sector.CeilHeight)
{
if(sectorHeight < 41)
posz = sector.FloorHeight + sectorHeight / 2;
else
posz = sector.CeilHeight - 4;
} }
} }
if(nearestsector != null)
{
int sectorheight = nearestsector.CeilHeight - nearestsector.FloorHeight;
if(General.Map.VisualCamera.Position.z < nearestsector.FloorHeight + 41)
{
if(sectorheight < 41)
posz = nearestsector.FloorHeight + sectorheight / 2;
else
posz = nearestsector.FloorHeight + 41; // same as in doom
}
else if(General.Map.VisualCamera.Position.z > nearestsector.CeilHeight)
{
if(sectorheight < 41)
posz = nearestsector.FloorHeight + sectorheight / 2;
else
posz = nearestsector.CeilHeight - 4;
}
}
General.Map.VisualCamera.Position = new Vector3D(initialcameraposition.x, initialcameraposition.y, posz); General.Map.VisualCamera.Position = new Vector3D(initialcameraposition.x, initialcameraposition.y, posz);
} }
else else

View file

@ -1516,41 +1516,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
int removedcount = 0; int removedcount = 0;
foreach(Linedef l in lines) foreach(Linedef l in lines)
{ {
if(l.Front != null) ToggleLightFogFlag(l.Front, ref addedcout, ref removedcount); if(l.Front != null)
if(l.Back != null) ToggleLightFogFlag(l.Back, ref addedcout, ref removedcount); {
int result = Tools.UpdateLightFogFlag(l.Front);
switch(result)
{
case 1: addedcout++; break;
case -1: removedcount++; break;
}
}
if(l.Back != null)
{
int result = Tools.UpdateLightFogFlag(l.Back);
switch(result)
{
case 1: addedcout++; break;
case -1: removedcount++; break;
}
}
} }
// Display info // Display info
General.Interface.DisplayStatus(StatusType.Action, "Added 'lightfog' flag to " + addedcout + " sidedefs, removed it from " + removedcount + " sidedefs."); General.Interface.DisplayStatus(StatusType.Action, "Added 'lightfog' flag to " + addedcout + " sidedefs, removed it from " + removedcount + " sidedefs.");
} }
//mxd
private void ToggleLightFogFlag(Sidedef side, ref int addedcout, ref int removedcount)
{
//Side requires the flag?
if(!side.Fields.ContainsKey("light") || side.Sector == null) return;
if(General.Map.Data.MapInfo.HasFadeColor ||
(General.Map.Data.MapInfo.HasOutsideFogColor && side.Sector.CeilTexture == General.Map.Config.SkyFlatName) ||
side.Sector.Fields.ContainsKey("fade"))
{
//Set the flag
if(!side.IsFlagSet("lightfog"))
{
side.SetFlag("lightfog", true);
addedcout++;
}
}
else
{
//Unset the flag
if(side.IsFlagSet("lightfog"))
{
side.SetFlag("lightfog", false);
removedcount++;
}
}
}
#endregion #endregion
} }
} }

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.curvelinedefsitem = new System.Windows.Forms.ToolStripMenuItem(); this.curvelinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.splitlinedefsitem = new System.Windows.Forms.ToolStripMenuItem(); this.splitlinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.alignLinedefsItem = new System.Windows.Forms.ToolStripMenuItem(); this.aligntexturesitem = new System.Windows.Forms.ToolStripMenuItem();
this.alignFloorToFrontItem = new System.Windows.Forms.ToolStripMenuItem(); this.alignFloorToFrontItem = new System.Windows.Forms.ToolStripMenuItem();
this.alignFloorToBackItem = new System.Windows.Forms.ToolStripMenuItem(); this.alignFloorToBackItem = new System.Windows.Forms.ToolStripMenuItem();
this.alignCeilingToFrontItem = new System.Windows.Forms.ToolStripMenuItem(); this.alignCeilingToFrontItem = new System.Windows.Forms.ToolStripMenuItem();
@ -100,6 +100,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.fileMenuStrip = new System.Windows.Forms.MenuStrip(); this.fileMenuStrip = new System.Windows.Forms.MenuStrip();
this.exportStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
this.updatelightfogitem = new System.Windows.Forms.ToolStripMenuItem();
this.menustrip.SuspendLayout(); this.menustrip.SuspendLayout();
this.manualstrip.SuspendLayout(); this.manualstrip.SuspendLayout();
this.fileMenuStrip.SuspendLayout(); this.fileMenuStrip.SuspendLayout();
@ -133,7 +134,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.curvelinedefsitem, this.curvelinedefsitem,
this.toolStripMenuItem3, this.toolStripMenuItem3,
this.splitlinedefsitem, this.splitlinedefsitem,
this.alignLinedefsItem, this.updatelightfogitem,
this.aligntexturesitem,
this.toolStripSeparator5, this.toolStripSeparator5,
this.selectSimilarLinesItem}); this.selectSimilarLinesItem});
this.linedefsmenu.Name = "linedefsmenu"; this.linedefsmenu.Name = "linedefsmenu";
@ -225,16 +227,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.splitlinedefsitem.Text = "S&plit Linedefs"; this.splitlinedefsitem.Text = "S&plit Linedefs";
this.splitlinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction); this.splitlinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
// //
// alignLinedefsItem // aligntexturesitem
// //
this.alignLinedefsItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.aligntexturesitem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.alignFloorToFrontItem, this.alignFloorToFrontItem,
this.alignFloorToBackItem, this.alignFloorToBackItem,
this.alignCeilingToFrontItem, this.alignCeilingToFrontItem,
this.alignCeilingToBackItem}); this.alignCeilingToBackItem});
this.alignLinedefsItem.Name = "alignLinedefsItem"; this.aligntexturesitem.Name = "aligntexturesitem";
this.alignLinedefsItem.Size = new System.Drawing.Size(245, 22); this.aligntexturesitem.Size = new System.Drawing.Size(245, 22);
this.alignLinedefsItem.Text = "&Align Textures"; this.aligntexturesitem.Text = "&Align Textures";
// //
// alignFloorToFrontItem // alignFloorToFrontItem
// //
@ -737,7 +739,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttonTextureOffsetLock.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.TextureLock; this.buttonTextureOffsetLock.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.TextureLock;
this.buttonTextureOffsetLock.ImageTransparentColor = System.Drawing.Color.Magenta; this.buttonTextureOffsetLock.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttonTextureOffsetLock.Name = "buttonTextureOffsetLock"; this.buttonTextureOffsetLock.Name = "buttonTextureOffsetLock";
this.buttonTextureOffsetLock.Size = new System.Drawing.Size(23, 20); this.buttonTextureOffsetLock.Size = new System.Drawing.Size(23, 22);
this.buttonTextureOffsetLock.ToolTipText = "Pin Texture Offsets.\r\nWhen enabled, keeps floor and ceiling texture offsets\r\ncons" + this.buttonTextureOffsetLock.ToolTipText = "Pin Texture Offsets.\r\nWhen enabled, keeps floor and ceiling texture offsets\r\ncons" +
"tant while sector is dragged"; "tant while sector is dragged";
this.buttonTextureOffsetLock.Click += new System.EventHandler(this.buttonTextureOffsetLock_Click); this.buttonTextureOffsetLock.Click += new System.EventHandler(this.buttonTextureOffsetLock_Click);
@ -768,6 +770,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.toolStripMenuItem5.Text = "Selection to Wavefront .obj..."; this.toolStripMenuItem5.Text = "Selection to Wavefront .obj...";
this.toolStripMenuItem5.Click += new System.EventHandler(this.InvokeTaggedAction); this.toolStripMenuItem5.Click += new System.EventHandler(this.InvokeTaggedAction);
// //
// updatelightfogitem
//
this.updatelightfogitem.Name = "updatelightfogitem";
this.updatelightfogitem.Size = new System.Drawing.Size(245, 22);
this.updatelightfogitem.Tag = "applylightfogflag";
this.updatelightfogitem.Text = "&Update \'lightfog\' flag";
//
// MenusForm // MenusForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -834,7 +843,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripMenuItem pointAtCursorItem; private System.Windows.Forms.ToolStripMenuItem pointAtCursorItem;
private System.Windows.Forms.ToolStripButton buttonTextureOffsetLock; private System.Windows.Forms.ToolStripButton buttonTextureOffsetLock;
private System.Windows.Forms.ToolStripMenuItem selectInSectorsItem; private System.Windows.Forms.ToolStripMenuItem selectInSectorsItem;
private System.Windows.Forms.ToolStripMenuItem alignLinedefsItem; private System.Windows.Forms.ToolStripMenuItem aligntexturesitem;
private System.Windows.Forms.ToolStripMenuItem alignFloorToFrontItem; private System.Windows.Forms.ToolStripMenuItem alignFloorToFrontItem;
private System.Windows.Forms.ToolStripMenuItem alignFloorToBackItem; private System.Windows.Forms.ToolStripMenuItem alignFloorToBackItem;
private System.Windows.Forms.ToolStripMenuItem alignCeilingToFrontItem; private System.Windows.Forms.ToolStripMenuItem alignCeilingToFrontItem;
@ -870,5 +879,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripComboBox gradientInterpolationMenu; private System.Windows.Forms.ToolStripComboBox gradientInterpolationMenu;
private System.Windows.Forms.ToolStripSeparator separatorsectors2; private System.Windows.Forms.ToolStripSeparator separatorsectors2;
private System.Windows.Forms.ToolStripSeparator separatorsectors3; private System.Windows.Forms.ToolStripSeparator separatorsectors3;
private System.Windows.Forms.ToolStripMenuItem updatelightfogitem;
} }
} }

View file

@ -237,7 +237,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd //mxd
private void linedefsmenu_DropDownOpening(object sender, EventArgs e) private void linedefsmenu_DropDownOpening(object sender, EventArgs e)
{ {
alignLinedefsItem.Enabled = General.Map.UDMF; aligntexturesitem.Enabled = General.Map.UDMF;
updatelightfogitem.Enabled = General.Map.UDMF;
} }
//mxd //mxd

View file

@ -123,12 +123,12 @@
<metadata name="menustrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menustrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="globalstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 17</value>
</metadata>
<metadata name="globalstrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="globalstrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="globalstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 17</value>
</metadata>
<metadata name="manualstrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="manualstrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

View file

@ -1347,22 +1347,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
int light = Sidedef.Fields.GetValue("light", 0); int light = Sidedef.Fields.GetValue("light", 0);
bool absolute = Sidedef.Fields.GetValue("lightabsolute", false); bool absolute = Sidedef.Fields.GetValue("lightabsolute", false);
int newLight; int newlight;
if(up) if(up)
newLight = General.Map.Config.BrightnessLevels.GetNextHigher(light, absolute); newlight = General.Map.Config.BrightnessLevels.GetNextHigher(light, absolute);
else else
newLight = General.Map.Config.BrightnessLevels.GetNextLower(light, absolute); newlight = General.Map.Config.BrightnessLevels.GetNextLower(light, absolute);
if(newLight == light) return; if(newlight == light) return;
//create undo //create undo
mode.CreateUndo("Change wall brightness", UndoGroup.SurfaceBrightnessChange, Sector.Sector.FixedIndex); mode.CreateUndo("Change wall brightness", UndoGroup.SurfaceBrightnessChange, Sector.Sector.FixedIndex);
Sidedef.Fields.BeforeFieldsChange(); Sidedef.Fields.BeforeFieldsChange();
//apply changes //apply changes
Sidedef.Fields["light"] = new UniValue(UniversalType.Integer, newLight); UDMFTools.SetInteger(Sidedef.Fields, "light", newlight, (absolute ? int.MinValue : 0));
mode.SetActionResult("Changed wall brightness to " + newLight + "."); Tools.UpdateLightFogFlag(Sidedef);
mode.SetActionResult("Changed wall brightness to " + newlight + ".");
Sector.Sector.UpdateCache(); Sector.Sector.UpdateCache();
//rebuild sector //rebuild sector

View file

@ -101,6 +101,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public Sidedef sidedef; public Sidedef sidedef;
public float offsetx; public float offsetx;
public float scaleX; //mxd
public float scaleY; //mxd public float scaleY; //mxd
private Sidedef controlside; //mxd private Sidedef controlside; //mxd
@ -2435,32 +2436,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
//get target brightness //get target brightness
int targetBrightness; int targetbrightness;
if(highlighted is VisualFloor) if(highlighted is VisualFloor)
{ {
VisualFloor v = highlighted as VisualFloor; VisualFloor v = highlighted as VisualFloor;
targetBrightness = v.Level.sector.Fields.GetValue("lightfloor", 0); targetbrightness = v.Level.sector.Fields.GetValue("lightfloor", 0);
if (!v.Level.sector.Fields.GetValue("lightfloorabsolute", false)) if (!v.Level.sector.Fields.GetValue("lightfloorabsolute", false))
{ {
targetBrightness += v.Level.sector.Brightness; targetbrightness += v.Level.sector.Brightness;
} }
} }
else if(highlighted is VisualCeiling) else if(highlighted is VisualCeiling)
{ {
VisualCeiling v = highlighted as VisualCeiling; VisualCeiling v = highlighted as VisualCeiling;
targetBrightness = v.Level.sector.Fields.GetValue("lightceiling", 0); targetbrightness = v.Level.sector.Fields.GetValue("lightceiling", 0);
if(!v.Level.sector.Fields.GetValue("lightceilingabsolute", false)) if(!v.Level.sector.Fields.GetValue("lightceilingabsolute", false))
{ {
targetBrightness += v.Level.sector.Brightness; targetbrightness += v.Level.sector.Brightness;
} }
} }
else if(highlighted is VisualUpper || highlighted is VisualMiddleSingle || highlighted is VisualMiddleDouble || highlighted is VisualLower) else if(highlighted is VisualUpper || highlighted is VisualMiddleSingle || highlighted is VisualMiddleDouble || highlighted is VisualLower)
{ {
BaseVisualGeometrySidedef v = highlighted as BaseVisualGeometrySidedef; BaseVisualGeometrySidedef v = highlighted as BaseVisualGeometrySidedef;
targetBrightness = v.Sidedef.Fields.GetValue("light", 0); targetbrightness = v.Sidedef.Fields.GetValue("light", 0);
if(!v.Sidedef.Fields.GetValue("lightabsolute", false)) if(!v.Sidedef.Fields.GetValue("lightabsolute", false))
{ {
targetBrightness += v.Sidedef.Sector.Brightness; targetbrightness += v.Sidedef.Sector.Brightness;
} }
} }
else if(highlighted is VisualMiddle3D) else if(highlighted is VisualMiddle3D)
@ -2472,10 +2473,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.DisplayStatus(StatusType.Warning, "Highlight a surface, to which you want to match the brightness."); General.Interface.DisplayStatus(StatusType.Warning, "Highlight a surface, to which you want to match the brightness.");
return; return;
} }
targetBrightness = sd.Fields.GetValue("light", 0); targetbrightness = sd.Fields.GetValue("light", 0);
if(!sd.Fields.GetValue("lightabsolute", false)) if(!sd.Fields.GetValue("lightabsolute", false))
{ {
targetBrightness += sd.Sector.Brightness; targetbrightness += sd.Sector.Brightness;
} }
} }
@ -2487,7 +2488,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//make undo //make undo
CreateUndo("Match Brightness"); CreateUndo("Match Brightness");
targetBrightness = General.Clamp(targetBrightness, 0, 255); targetbrightness = General.Clamp(targetbrightness, 0, 255);
//apply new brightness //apply new brightness
foreach (IVisualEventReceiver obj in selectedobjects) foreach (IVisualEventReceiver obj in selectedobjects)
@ -2502,11 +2503,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (v.Level.sector.Fields.GetValue("lightfloorabsolute", false)) if (v.Level.sector.Fields.GetValue("lightfloorabsolute", false))
{ {
v.Level.sector.Fields["lightfloor"] = new UniValue(UniversalType.Integer, targetBrightness); UDMFTools.SetInteger(v.Level.sector.Fields, "lightfloor", targetbrightness, 0);
} }
else else
{ {
v.Level.sector.Fields["lightfloor"] = new UniValue(UniversalType.Integer, targetBrightness - v.Level.sector.Brightness); v.Level.sector.Fields["lightfloor"] = new UniValue(UniversalType.Integer, targetbrightness - v.Level.sector.Brightness);
} }
v.Sector.UpdateSectorGeometry(false); v.Sector.UpdateSectorGeometry(false);
@ -2519,11 +2520,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(v.Level.sector.Fields.GetValue("lightceilingabsolute", false)) if(v.Level.sector.Fields.GetValue("lightceilingabsolute", false))
{ {
v.Level.sector.Fields["lightceiling"] = new UniValue(UniversalType.Integer, targetBrightness); UDMFTools.SetInteger(v.Level.sector.Fields, "lightceiling", targetbrightness, 0);
} }
else else
{ {
v.Level.sector.Fields["lightceiling"] = new UniValue(UniversalType.Integer, targetBrightness - v.Level.sector.Brightness); v.Level.sector.Fields["lightceiling"] = new UniValue(UniversalType.Integer, targetbrightness - v.Level.sector.Brightness);
} }
v.Sector.UpdateSectorGeometry(false); v.Sector.UpdateSectorGeometry(false);
@ -2536,16 +2537,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (v.Sidedef.Fields.GetValue("lightabsolute", false)) if (v.Sidedef.Fields.GetValue("lightabsolute", false))
{ {
v.Sidedef.Fields["light"] = new UniValue(UniversalType.Integer, targetBrightness); UDMFTools.SetInteger(v.Sidedef.Fields, "light", targetbrightness, 0);
} }
else else
{ {
v.Sidedef.Fields["light"] = new UniValue(UniversalType.Integer, targetBrightness - v.Sidedef.Sector.Brightness); v.Sidedef.Fields["light"] = new UniValue(UniversalType.Integer, targetbrightness - v.Sidedef.Sector.Brightness);
} }
//Update 'lightfog' flag
Tools.UpdateLightFogFlag(v.Sidedef);
} }
} }
//done //Done
General.Interface.DisplayStatus(StatusType.Action, "Matched brightness for " + selectedobjects.Count + " surfaces."); General.Interface.DisplayStatus(StatusType.Action, "Matched brightness for " + selectedobjects.Count + " surfaces.");
Interface_OnSectorEditFormValuesChanged(this, EventArgs.Empty); Interface_OnSectorEditFormValuesChanged(this, EventArgs.Empty);
} }
@ -3498,7 +3502,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
internal void AutoAlignTextures(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks, bool checkSelectedSidedefParts) internal void AutoAlignTextures(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks, bool checkSelectedSidedefParts)
{ {
if(General.Map.UDMF) if(General.Map.UDMF)
AutoAlignTexturesUdmf(start, texture, alignx, aligny, resetsidemarks, checkSelectedSidedefParts); AutoAlignTexturesUDMF(start, texture, alignx, aligny, resetsidemarks, checkSelectedSidedefParts);
else else
AutoAlignTextures(start, texture, alignx, aligny, resetsidemarks); AutoAlignTextures(start, texture, alignx, aligny, resetsidemarks);
} }
@ -3606,7 +3610,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned). // When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned).
// Setting resetsidemarks to false is usefull to align only within a specific selection // Setting resetsidemarks to false is usefull to align only within a specific selection
// (set the marked property to true for the sidedefs outside the selection) // (set the marked property to true for the sidedefs outside the selection)
private void AutoAlignTexturesUdmf(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks, bool checkSelectedSidedefParts) private void AutoAlignTexturesUDMF(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks, bool checkSelectedSidedefParts)
{ {
// Mark all sidedefs false (they will be marked true when the texture is aligned) // Mark all sidedefs false (they will be marked true when the texture is aligned)
if(resetsidemarks) General.Map.Map.ClearMarkedSidedefs(false); if(resetsidemarks) General.Map.Map.ClearMarkedSidedefs(false);
@ -3639,17 +3643,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
//mxd. scaleY //mxd. Scale
switch(start.GeometryType) switch(start.GeometryType)
{ {
case VisualGeometryType.WALL_UPPER: case VisualGeometryType.WALL_UPPER:
first.scaleX = start.Sidedef.Fields.GetValue("scalex_top", 1.0f);
first.scaleY = start.Sidedef.Fields.GetValue("scaley_top", 1.0f); first.scaleY = start.Sidedef.Fields.GetValue("scaley_top", 1.0f);
break; break;
case VisualGeometryType.WALL_MIDDLE: case VisualGeometryType.WALL_MIDDLE:
case VisualGeometryType.WALL_MIDDLE_3D: case VisualGeometryType.WALL_MIDDLE_3D:
first.scaleX = first.controlSide.Fields.GetValue("scalex_mid", 1.0f);
first.scaleY = first.controlSide.Fields.GetValue("scaley_mid", 1.0f); first.scaleY = first.controlSide.Fields.GetValue("scaley_mid", 1.0f);
break; break;
case VisualGeometryType.WALL_LOWER: case VisualGeometryType.WALL_LOWER:
first.scaleX = start.Sidedef.Fields.GetValue("scalex_bottom", 1.0f);
first.scaleY = start.Sidedef.Fields.GetValue("scaley_bottom", 1.0f); first.scaleY = start.Sidedef.Fields.GetValue("scaley_bottom", 1.0f);
break; break;
} }
@ -3701,7 +3708,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vertex v; Vertex v;
float forwardoffset; float forwardoffset;
float backwardoffset; float backwardoffset;
float offsetscalex = 1.0f;
// Get the align job to do // Get the align job to do
SidedefAlignJob j = todo.Pop(); SidedefAlignJob j = todo.Pop();
@ -3720,21 +3726,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
if(!matchbottom && !matchtop && !matchmid) continue; //mxd if(!matchbottom && !matchtop && !matchmid) continue; //mxd
if(matchtop)
offsetscalex = j.sidedef.Fields.GetValue("scalex_top", 1.0f);
else if(matchbottom)
offsetscalex = j.sidedef.Fields.GetValue("scalex_bottom", 1.0f);
else if(matchmid)
offsetscalex = j.controlSide.Fields.GetValue("scalex_mid", 1.0f);
j.sidedef.Fields.BeforeFieldsChange(); j.sidedef.Fields.BeforeFieldsChange();
j.controlSide.Fields.BeforeFieldsChange(); //mxd j.controlSide.Fields.BeforeFieldsChange(); //mxd
//mxd. Apply scaleY //mxd. Apply Scale
if(matchtop) UDMFTools.SetFloat(j.sidedef.Fields, "scaley_top", j.scaleY, 1.0f); if(matchtop)
if(matchmid) UDMFTools.SetFloat(j.controlSide.Fields, "scaley_mid", j.scaleY, 1.0f); {
if(matchbottom) UDMFTools.SetFloat(j.sidedef.Fields, "scaley_bottom", j.scaleY, 1.0f); UDMFTools.SetFloat(j.sidedef.Fields, "scalex_top", first.scaleX, 1.0f);
UDMFTools.SetFloat(j.sidedef.Fields, "scaley_top", j.scaleY, 1.0f);
}
if(matchmid)
{
UDMFTools.SetFloat(j.controlSide.Fields, "scalex_mid", first.scaleX, 1.0f);
UDMFTools.SetFloat(j.controlSide.Fields, "scaley_mid", j.scaleY, 1.0f);
}
if(matchbottom)
{
UDMFTools.SetFloat(j.sidedef.Fields, "scalex_bottom", first.scaleX, 1.0f);
UDMFTools.SetFloat(j.sidedef.Fields, "scaley_bottom", j.scaleY, 1.0f);
}
if(j.forward) if(j.forward)
{ {
@ -3806,7 +3817,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
forwardoffset = j.offsetx + (int)Math.Round(j.sidedef.Line.Length / scalex * offsetscalex); forwardoffset = j.offsetx + (int)Math.Round(j.sidedef.Line.Length / scalex * first.scaleX);
backwardoffset = j.offsetx; backwardoffset = j.offsetx;
// Done this sidedef // Done this sidedef
@ -3826,7 +3837,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply alignment // Apply alignment
if(alignx) if(alignx)
{ {
float offset = j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex * offsetscalex); float offset = j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex * first.scaleX);
offset -= j.sidedef.OffsetX; offset -= j.sidedef.OffsetX;
if(matchtop) if(matchtop)
@ -3890,7 +3901,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
forwardoffset = j.offsetx; forwardoffset = j.offsetx;
backwardoffset = j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex * offsetscalex); backwardoffset = j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex * first.scaleX);
// Done this sidedef // Done this sidedef
j.sidedef.Marked = true; j.sidedef.Marked = true;

View file

@ -23,7 +23,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Comparer // Comparer
public int Compare(SectorLevel x, SectorLevel y) public int Compare(SectorLevel x, SectorLevel y)
{ {
return Math.Sign(x.plane.GetZ(center) - y.plane.GetZ(center)); return (x == y ? 0 : Math.Sign(x.plane.GetZ(center) - y.plane.GetZ(center))); //mxd. Added equality check
} }
} }
} }