From d301042f42434cdf32848c62e2a97ea69b0cd2b9 Mon Sep 17 00:00:00 2001 From: MaxED Date: Fri, 17 Jun 2016 20:44:14 +0000 Subject: [PATCH] Changed: "Unable to save the map: there are too many unique sidedefs!" error message now displays info about sidedefs counts before and after sidedef compression. Fixed, Draw Grid mode: in some cases invalid geometry was created when drawing very large grids. Fixed, Things mode, "Rotate Clockwise" action: fixed inability to change thing angle from 0 to 315 when "doomthingrotationangles" Game Configuration property was set to true. Updated ZDoom_DECORATE.cfg. --- Build/Scripting/ZDoom_DECORATE.cfg | 16 ++++++--- Source/Core/General/MapManager.cs | 33 ++++++++++--------- Source/Core/Geometry/Tools.cs | 5 +++ .../BuilderModes/ClassicModes/DrawGridMode.cs | 16 +++++---- .../BuilderModes/ClassicModes/ThingsMode.cs | 3 +- 5 files changed, 45 insertions(+), 28 deletions(-) diff --git a/Build/Scripting/ZDoom_DECORATE.cfg b/Build/Scripting/ZDoom_DECORATE.cfg index 44a5b60..009c150 100644 --- a/Build/Scripting/ZDoom_DECORATE.cfg +++ b/Build/Scripting/ZDoom_DECORATE.cfg @@ -113,7 +113,7 @@ keywords //Generic monster attacks A_CustomMissile = "A_CustomMissile(str missiletype[, float spawnheight = 0.0[, int spawnofs_horiz = 0[, int angle = 0[, int aimflags = 0[, int pitch = 0[, int target = AAPTR_TARGET]]]]]])"; A_CustomBulletAttack = "A_CustomBulletAttack(float horz_spread, float vert_spread, int numbullets, int damageperbullet[, str pufftype = \"BulletPuff\"[, float range = 0.0[, int flags = 0[, int target = AAPTR_TARGET]]]])"; - A_CustomRailgun = "A_CustomRailgun(int damage[, int offset[, color ringcolor[, color corecolor[, int flags = 0[, bool aim = false[, float maxdiff = 0.0[, str pufftype = \"\"[, float spread_xy = 0.0[, float spread_z = 0.0[, float range = 8192[, int duration = 35[, float sparsity = 1.0[, float driftspeed = 1.0[, str spawnclass = \"\"[, float spawnofs_z = 0[, int spiraloffset = 270]]]]]]]]]]]]]]]])"; + A_CustomRailgun = "A_CustomRailgun(int damage[, int offset[, color ringcolor[, color corecolor[, int flags = 0[, bool aim = false[, float maxdiff = 0.0[, str pufftype = \"\"[, float spread_xy = 0.0[, float spread_z = 0.0[, float range = 8192[, int duration = 35[, float sparsity = 1.0[, float driftspeed = 1.0[, str spawnclass = \"\"[, float spawnofs_z = 0[, int spiraloffset = 270[, int actorpiercelimit = 0]]]]]]]]]]]]]]]]])"; A_CustomMeleeAttack = "A_CustomMeleeAttack[(int damage = 0[, str meleesound = \"\"[, str misssound = \"\"[, str damagetype = \"Melee\"[, bool bleed = true]]]])]"; A_CustomComboAttack = "A_CustomComboAttack(str missiletype, float spawnheight, int damage, str meleesound[, str damagetype = \"Melee\"[, bool bleed = true]])"; A_MonsterRefire = "state A_MonsterRefire(int chancecontinue, str abortstate)"; @@ -285,6 +285,7 @@ keywords A_RadiusGive = "int A_RadiusGive(str item, float distance, int flags[, int amount = 0[, str filter = \"None\"[, str species = \"None\"[, int mindist = 0[, int limit = 0]]]]])\nflags: RGF flags."; //Weapon functions A_WeaponReady = "A_WeaponReady[(int flags = 0)]\nflags: WRF flags."; + A_WeaponOffset = "A_WeaponOffset[(float x = 0[, float y = 32[, int flags = 0])]\nflags: WOF flags."; A_Lower = "A_Lower"; A_Raise = "A_Raise"; A_ReFire = "A_ReFire[(str state = \"Hold\")]"; @@ -298,17 +299,19 @@ keywords A_Light1 = "A_Light1"; A_Light2 = "A_Light2"; A_LightInverse = "A_LightInverse"; + A_Overlay = "A_Overlay(int layer[, state start])"; + A_OverlayFlags = "A_OverlayFlags(int layer, int flags, bool set)\nflags: PSPF flags."; + A_OverlayOffset = "A_OverlayOffset[(int layer = 0[, float x = 0.0f[, float y = 32.0f[, int flags = 0]]]])]\nflags: WOF flags."; A_Recoil = "A_Recoil(float force)"; A_ZoomFactor = "A_ZoomFactor[(float zoom = 1.0[, int flags = 0])]\nflags: ZOOM flags."; A_SetCrosshair = "A_SetCrosshair(int number)"; - A_WeaponOffset = "A_WeaponOffset[(float x = 0[, float y = 32[, int flags = 0])]\nflags: WOF flags."; //Weapon attack functions A_Punch = "A_Punch"; A_Saw = "A_Saw[(str fullsound = \"weapons/sawfull\"[, str hitsound = \"weapons/sawhit\"[, int damage = 0[, str pufftype = \"BulletPuff\"[, int flags = 0[, float range = 65.0[, float spread_xy = 2.8125[, float spread_z = 0.0[, float lifesteal = 0.0[, int lifestealmax = 0[, str armorbonustype = \"ArmorBonus\"]]]]]]]]]])]"; A_CustomPunch = "A_CustomPunch(int damage[, bool norandom = false[, int flags = 0[, str pufftype = \"BulletPuff\"[, float range = 64.0[, float lifesteal = 0.0[, int lifestealmax = 0[, str armorbonustype = \"ArmorBonus\"[, str meleesound[, str misssound]]]]]]]]])"; A_FireBullets = "A_FireBullets(int spread_horz, int spread_vert, int numbullets, int damage[, str pufftype = \"\"[, int flags = FBF_USEAMMO[, float range = 0.0]]])"; - A_FireCustomMissile = "A_FireCustomMissile(str missiletype[, int angle = 0[, bool useammo = false[, int spawnofs_horz = 0[, int spawnheight = 0[, int flags = 0[, angle pitch = 0]]]]]])"; - A_RailAttack = "A_RailAttack(int damage[, int spawnofs_horz[, bool useammo[, str ringcolor[, str corecolor[, int flags[, int maxdiff[, str pufftype[, float spread_xy = 0.0[, float spread_z = 0.0[, float range = 8192.0[, int duration = 35[, float sparsity = 1.0[, float driftspeed = 1.0[, str spawnclass[, float spawnofs_z = 0.0[, int spiraloffset = 270]]]]]]]]]]]]]]]])"; + A_FireCustomMissile = "A_FireCustomMissile(str missiletype[, int angle = 0[, bool useammo = false[, float spawnofs_horz = 0.0[, int spawnheight = 0[, int flags = 0[, angle pitch = 0]]]]]])"; + A_RailAttack = "A_RailAttack(int damage[, int spawnofs_horz[, bool useammo[, str ringcolor[, str corecolor[, int flags[, int maxdiff[, str pufftype[, float spread_xy = 0.0[, float spread_z = 0.0[, float range = 8192.0[, int duration = 35[, float sparsity = 1.0[, float driftspeed = 1.0[, str spawnclass[, float spawnofs_z = 0.0[, int spiraloffset = 270[, int actorpiercelimit = 0]]]]]]]]]]]]]]]]])"; A_FireAssaultGun = "A_FireAssaultGun"; A_FireBFG = "A_FireBFG"; A_FireOldBFG = "A_FireOldBFG"; @@ -1347,4 +1350,9 @@ constants WOF_KEEPX; WOF_KEEPY; WOF_ADD; +//A_OverlayFlags flags + PSPF_ADDWEAPON; + PSPF_ADDBOB; + PSPF_POWDOUBLE; + PSPF_CVARFAST; } diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index f6730f1..34faa0c 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -659,22 +659,25 @@ namespace CodeImp.DoomBuilder } } - // Do we need sidedefs compression? - if (map.Sidedefs.Count > io.MaxSidedefs) - { - // Compress sidedefs - General.MainWindow.DisplayStatus(StatusType.Busy, "Compressing sidedefs..."); - outputset.CompressSidedefs(); + // Do we need sidedefs compression? + if(map.Sidedefs.Count > io.MaxSidedefs) + { + // Compress sidedefs + int initialsidescount = outputset.Sidedefs.Count; //mxd + General.MainWindow.DisplayStatus(StatusType.Busy, "Compressing sidedefs..."); + outputset.CompressSidedefs(); - // Check if it still doesnt fit - if (outputset.Sidedefs.Count > io.MaxSidedefs) - { - // Problem! Can't save the map like this! - General.ShowErrorMessage("Unable to save the map: There are too many unique sidedefs!", MessageBoxButtons.OK); - General.MainWindow.DisplayStatus(oldstatus); - return false; - } - } + // Check if it still doesnt + if(outputset.Sidedefs.Count > io.MaxSidedefs) + { + // Problem! Can't save the map like this! + General.ShowErrorMessage("Unable to save the map: there are too many unique sidedefs!" + Environment.NewLine + Environment.NewLine + + "Sidedefs before compresion: " + initialsidescount + Environment.NewLine + + "Sidedefs after compresion: " + outputset.Sidedefs.Count, MessageBoxButtons.OK); + General.MainWindow.DisplayStatus(oldstatus); + return false; + } + } // Check things if (map.Things.Count > io.MaxThings) diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs index 43da981..8f18753 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -939,6 +939,7 @@ namespace CodeImp.DoomBuilder.Geometry if(points[0].stitch) mergeverts.Add(v1); else nonmergeverts.Add(v1); // Go for all other points + int roundprecision = (General.Map.FormatInterface.VertexDecimals > 0 ? General.Map.FormatInterface.VertexDecimals - 1 : 0); //mxd for(int i = 1; i < points.Count; i++) { // Create vertex for point @@ -1001,6 +1002,10 @@ namespace CodeImp.DoomBuilder.Geometry // may already have changed in length due to a previous split Vector2D splitpoint = measureline.GetCoordinatesAt(u); + //mxd. Work around some imprecisions when splitting very long lines (like 19000 mu long) + splitpoint.x = (float)Math.Round(splitpoint.x, roundprecision); + splitpoint.y = (float)Math.Round(splitpoint.y, roundprecision); + // Make the vertex Vertex splitvertex = map.CreateVertex(splitpoint); if(splitvertex == null) return false; diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs index 9d3be66..ddd3e94 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs @@ -363,7 +363,8 @@ namespace CodeImp.DoomBuilder.BuilderModes int step = width / slicesH; for(int w = 0; w < slicesH; w++) { - shapes.Add(new[] { new Vector2D((int)s.x + step * w, (int)s.y), new Vector2D((int)s.x + step * w + step, (int)s.y) }); + shapes.Add(new[] { new Vector2D((float)Math.Round(s.x + step * w), (float)Math.Round(s.y)), + new Vector2D((float)Math.Round(s.x + step * w + step), (float)Math.Round(s.y)) }); } return shapes; } @@ -374,7 +375,8 @@ namespace CodeImp.DoomBuilder.BuilderModes int step = height / slicesV; for(int h = 0; h < slicesV; h++) { - shapes.Add(new[] {new Vector2D((int) s.x, (int) s.y + step * h), new Vector2D((int) s.x, (int) s.y + step * h + step)}); + shapes.Add(new[] { new Vector2D((float)Math.Round(s.x), (float)Math.Round(s.y + step * h)), + new Vector2D((float)Math.Round(s.x), (float)Math.Round(s.y + step * h + step)) }); } return shapes; } @@ -383,7 +385,7 @@ namespace CodeImp.DoomBuilder.BuilderModes return new List {new[] {s, e}}; } - // Create shape + // Create grid shape List rect = new List { s, new Vector2D((int)s.x, (int)e.y), e, new Vector2D((int)e.x, (int)s.y), s }; if(slicesH == 1 && slicesV == 1) { @@ -396,7 +398,7 @@ namespace CodeImp.DoomBuilder.BuilderModes RectangleF[,] blocks = new RectangleF[slicesH, slicesV]; for(int w = 0; w < slicesH; w++) { - for(int h = 0; h < slicesV; h++) + for(int h = 0; h < slicesV; h++) { float left = (float)Math.Round(InterpolationTools.Interpolate(s.x, e.x, (float)w / slicesH, horizontalinterpolation)); float top = (float)Math.Round(InterpolationTools.Interpolate(s.y, e.y, (float)h / slicesV, verticalinterpolation)); @@ -411,15 +413,15 @@ namespace CodeImp.DoomBuilder.BuilderModes { for(int w = 1; w < slicesH; w++) { - int px = (int) Math.Round(blocks[w, 0].X); - shapes.Add(new[] {new Vector2D(px, s.y), new Vector2D(px, e.y)}); + float px = (float)Math.Round(blocks[w, 0].X); + shapes.Add(new[] { new Vector2D(px, s.y), new Vector2D(px, e.y) }); } } if(slicesV > 1) { for(int h = 1; h < slicesV; h++) { - int py = (int) Math.Round(blocks[0, h].Y); + float py = (float)Math.Round(blocks[0, h].Y); shapes.Add(new[] { new Vector2D(s.x, py), new Vector2D(e.x, py) }); } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs index ec05ce2..3f0d17e 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs @@ -1653,8 +1653,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Thing t in selected) { int newangle = t.AngleDoom + increment; - if(General.Map.Config.DoomThingRotationAngles) newangle = (newangle + 22) / 45 * 45; - + if(General.Map.Config.DoomThingRotationAngles) newangle = newangle / 45 * 45; t.Rotate(General.ClampAngle(newangle)); }