From 5317ef1dc99c4bbd84c6e445afa3374467f47d8d Mon Sep 17 00:00:00 2001 From: codeimp Date: Fri, 3 Sep 2010 15:12:07 +0000 Subject: [PATCH] @ work on (G)ZDoom Editing plugin --- Documents/colorbrightnesslogic.png | Bin 0 -> 27947 bytes .../VisualModes/BaseVisualMode.cs | 2 +- .../VisualModes/BaseVisualSector.cs | 14 +- .../GZDoomEditing/VisualModes/SectorData.cs | 199 +++++++++++++----- .../GZDoomEditing/VisualModes/SectorLevel.cs | 35 ++- 5 files changed, 194 insertions(+), 56 deletions(-) create mode 100644 Documents/colorbrightnesslogic.png diff --git a/Documents/colorbrightnesslogic.png b/Documents/colorbrightnesslogic.png new file mode 100644 index 0000000000000000000000000000000000000000..a580035d7424f749921e82ff9efa9286c657ea07 GIT binary patch literal 27947 zcmeFZWmFv9x-|+UgakSvxI+TL-CaAlyL<594Z$G+n&81*8h3XM5FmI5P4M6n-2E2G z`|iEJv(IKFLV2Bz_{0Fu^eU^bw<9DZ=Q@bFj3CN#Yab7c@15&yj7dp1}9>MRg3`>L%O$ zTFZ5}N=|r0Xgd!{zq8NSKK9nwt6%5c7GS>mu|DmxHST;`J*9KjG^x|>UG7=hI>P+) zk^j_rqA#+~W`YlGX+ZKxccAGl{W_u6`)Bl@jgG!OK$g*$RB31GC&7p55)G(q#O@x_m$nmA4)glT0Zq{=&PX8%A%kTamR3syTI`7ke zH!HZ=Uk1fV{M{d4OvJiasfgn5X44^Nnq8=azxzv*?&Z&fhZAw9J9It?B6j*ZGk;pw z^^E^lN%in_rKx0{cJsTvw(G-zsdB@NG%)Q?aXfv<=?{xYdhSEs-G=3gPw3q9ZWQVo z!;Vg2$h^h0zq?l5Ft-(-b)B(wSedpd5A@bMgM-o2d@eU7i5(x39WupRA||K*!!O%G%Qc523k1&#)fv01vQ^{dV0)6JGmHp=vy zhk4hD5kgqaEe&)_plZP5bV!ytSZ-LK*bW zS$VL>)OK!SCQchG9;|Ga>3|J2Ni1plRW(o%(|kr+gozm% z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mz1A$Q~ zv$z?e^kHIE-Ls1Njk_Mj@~8@Dc5`W@@rs3`*qbxjXhvdxeG4*o9~QJ)nufR)QZ1zx zEHX%n$3E`4XUGlc+*KFG)Of;D(;%OQH^AEU0W?L*r?U+kQK%o)XC8iZs}j#)^BQhpWqEW%r8PG9~@;c_Jp` zSvrvRwvK=nSx0psz@e9Vns@+Yh-3xrT`PIQVvvvKn^FN8 z@3)s&!BsSOT>Pe{z*RIA)q`S=-7ju`ntQafIs;7AcK3cRSG%(@H!Z$?HYm0KBY)a! zb^852aYg!E!!lxS2i5B-l?#UJ}i=+{oTBj$Kjb?XnWgC9~&{7 zV0Nh`JfJ52(&G?yvjIQ=?t`L4ES9R5p&LG-Y2bF6xH5?ZYB8tP?V=_h+r^D;`XFpk zLG5$KKZdBrbi~+k1g8~%NenyH*vxb zKd$#M#l&9_m12L1F|XC ze^&c&qFcA+hy(Qd@Lp<8fF&BaJR%*=Z*EYURDB70DSYB;&Iy;M{vtV(;_t|LK@e(MnzS$caj8W30y0;#7m-94# z6VMYHP`mHq-1MDCVELuBKo9X}5ai@3UmyiZB~^xeL*9O*_wDEFwmZcKx-{B#y6YD* zRZi}KIZ_pQfH1D(=1!Y7X=$ELNJFBpi6UEm&-3lz9H>GBPsO>Fe`fjs6@K#`X+Mg1 zM(q#+yd!_7h{8*je`YTqRPEZIX*Wb7Bm*42e^2|M==4IM{8uU9|f%fr| chaVl+rs>ip20tkPmzJGTl2gBrkTnna54Z sides; @@ -56,7 +57,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing #endregion #region ================== Properties - + + public SectorData Data { get { return data; } } public VisualFloor Floor { get { return floor; } } public VisualCeiling Ceiling { get { return ceiling; } } public bool Changed { get { return changed; } set { changed |= value; } } @@ -140,16 +142,20 @@ namespace CodeImp.DoomBuilder.GZDoomEditing // Forget old geometry base.ClearGeometry(); + // Get sector data + data = mode.GetSectorData(this.Sector); + if(!data.Built) data.BuildLevels(); + // Create floor if(floor == null) floor = new VisualFloor(mode, this); floor.Setup(); base.AddGeometry(floor); - + // Create ceiling if(ceiling == null) ceiling = new VisualCeiling(mode, this); ceiling.Setup(); base.AddGeometry(ceiling); - + // Go for all sidedefs Dictionary oldsides = sides ?? new Dictionary(1); sides = new Dictionary(base.Sector.Sidedefs.Count); diff --git a/Source/Plugins/GZDoomEditing/VisualModes/SectorData.cs b/Source/Plugins/GZDoomEditing/VisualModes/SectorData.cs index 2c4ffbb9..98b0d07c 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/SectorData.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/SectorData.cs @@ -16,91 +16,194 @@ namespace CodeImp.DoomBuilder.GZDoomEditing internal class SectorData { #region ================== Variables - + // Sector for which this data is private Sector sector; - + // Levels have been built? private bool built; - // First level is the sector's absolute ceiling - // Last level is the sector's absolute floor + // This is to prevent recursion when sectors need each other to build + private bool isbuilding; + + // Levels sorted by height private List levels; - + + // Original floor and ceiling levels + private SectorLevel floor; + private SectorLevel ceiling; + // Linedefs and Things of interest when building the levels // See RebuildSectorData() in BaseVisualMode.cs for the logic which selects interesting elements private List linedefs; private List things; - + #endregion - + #region ================== Properties - + public Sector Sector { get { return sector; } } public bool Built { get { return built; } } public List Levels { get { return levels; } } - + public SectorLevel Floor { get { return floor; } } + public SectorLevel Ceiling { get { return ceiling; } } + #endregion - + #region ================== Constructor / Destructor - + // Constructor - public SectorData(Sector s) + public SectorData(BaseVisualMode mode, Sector s) { + int color = -1, flight = s.Brightness, clight = s.Brightness; + bool fabs = true, cabs = true; + // Initialize this.sector = s; this.built = false; this.levels = new List(2); this.linedefs = new List(1); this.things = new List(1); - } - - #endregion - - #region ================== Public Methods - - // This adds a linedef that of interest to this sector, because it modifies the sector - public void AddLinedef(Linedef l) { linedefs.Add(l); } - - // This adds a thing that of interest to this sector, because it modifies the sector - public void AddThing(Thing t) { things.Add(t); } - - // This creates the levels with the things and linedefs of interest - public void BuildLevels(BaseVisualMode mode) - { - int color = -1, light = sector.Brightness; - bool absolute = true; - // Create floor - SectorLevel fl = new SectorLevel(); - fl.type = SectorLevelType.Floor; - fl.plane = new Plane(new Vector3D(0, 0, 1), sector.FloorHeight); - fl.color = -1; - levels.Add(fl); + // Create floor and ceiling planes + floor = new SectorLevel(s, SectorLevelType.Floor); + ceiling = new SectorLevel(s, SectorLevelType.Ceiling); + floor.plane = new Plane(new Vector3D(0, 0, 1), sector.FloorHeight); + ceiling.plane = new Plane(new Vector3D(0, 0, -1), sector.CeilHeight); - // Create ceiling - SectorLevel cl = new SectorLevel(); - cl.type = SectorLevelType.Ceiling; - cl.plane = new Plane(new Vector3D(0, 0, -1), sector.CeilHeight); + // Determine colors try { // Fetch ZDoom fields color = sector.Fields.ContainsKey("lightcolor") ? (int)sector.Fields["lightcolor"].Value : -1; - light = sector.Fields.ContainsKey("lightfloor") ? (int)sector.Fields["lightfloor"].Value : 0; - absolute = sector.Fields.ContainsKey("lightfloorabsolute") ? (bool)sector.Fields["lightfloorabsolute"].Value : false; + flight = sector.Fields.ContainsKey("lightfloor") ? (int)sector.Fields["lightfloor"].Value : 0; + fabs = sector.Fields.ContainsKey("lightfloorabsolute") ? (bool)sector.Fields["lightfloorabsolute"].Value : false; + clight = sector.Fields.ContainsKey("lightceiling") ? (int)sector.Fields["lightceiling"].Value : 0; + cabs = sector.Fields.ContainsKey("lightceilingabsolute") ? (bool)sector.Fields["lightceilingabsolute"].Value : false; } catch(Exception) { } - if(!absolute) light = sector.Brightness + light; PixelColor lightcolor = PixelColor.FromInt(color); - PixelColor brightness = PixelColor.FromInt(mode.CalculateBrightness(light)); - PixelColor finalcolor = PixelColor.Modulate(lightcolor, brightness); - cl.color = finalcolor.WithAlpha(255).ToInt(); - levels.Add(cl); - + if(!fabs) flight = sector.Brightness + flight; + if(!cabs) clight = sector.Brightness + clight; + PixelColor floorbrightness = PixelColor.FromInt(mode.CalculateBrightness(flight)); + PixelColor ceilingbrightness = PixelColor.FromInt(mode.CalculateBrightness(clight)); + PixelColor floorcolor = PixelColor.Modulate(lightcolor, floorbrightness); + PixelColor ceilingcolor = PixelColor.Modulate(lightcolor, ceilingbrightness); + floor.color = floorcolor.WithAlpha(255).ToInt(); + ceiling.color = ceilingcolor.WithAlpha(255).ToInt(); + ceiling.brightnessbelow = sector.Brightness; + ceiling.colorbelow = lightcolor; + + // Add ceiling and floor + levels.Add(floor); + levels.Add(ceiling); + } + + #endregion + + #region ================== Public Methods + + // This adds a linedef that of interest to this sector, because it modifies the sector + public void AddLinedef(Linedef l) { linedefs.Add(l); } + + // This adds a thing that of interest to this sector, because it modifies the sector + public void AddThing(Thing t) { things.Add(t); } + + // This creates additional levels from things and linedefs + public void BuildLevels(BaseVisualMode mode) + { + // Begin + if(isbuilding) return; + isbuilding = true; + + foreach(Linedef l in linedefs) + { + // Plane Align (see http://zdoom.org/wiki/Plane_Align) + if(l.Action == 181) + { + // Find the vertex furthest from the line + Vertex foundv = null; + float founddist = -1.0f; + foreach(Sidedef sd in sector.Sidedefs) + { + Vertex v = sd.IsFront ? sd.Line.Start : sd.Line.End; + float d = l.DistanceToSq(v.Position, false); + if(d > founddist) + { + foundv = v; + founddist = d; + } + } + + // Align floor with back of line + if((l.Args[0] == 1) && (l.Front.Sector == sector) && (l.Back != null)) + { + Vector3D v1 = new Vector3D(foundv.Position.x, foundv.Position.y, sector.FloorHeight); + Vector3D v2 = new Vector3D(l.Start.Position.x, l.Start.Position.y, l.Back.Sector.FloorHeight); + Vector3D v3 = new Vector3D(l.End.Position.x, l.End.Position.y, l.Back.Sector.FloorHeight); + floor.plane = new Plane(v1, v2, v3); + } + // Align floor with front of line + else if((l.Args[0] == 2) && (l.Back.Sector == sector) && (l.Front != null)) + { + Vector3D v1 = new Vector3D(foundv.Position.x, foundv.Position.y, sector.FloorHeight); + Vector3D v2 = new Vector3D(l.Start.Position.x, l.Start.Position.y, l.Front.Sector.FloorHeight); + Vector3D v3 = new Vector3D(l.End.Position.x, l.End.Position.y, l.Front.Sector.FloorHeight); + floor.plane = new Plane(v1, v2, v3); + } + + // Align ceiling with back of line + if((l.Args[1] == 1) && (l.Front.Sector == sector) && (l.Back != null)) + { + Vector3D v1 = new Vector3D(foundv.Position.x, foundv.Position.y, sector.CeilHeight); + Vector3D v2 = new Vector3D(l.Start.Position.x, l.Start.Position.y, l.Back.Sector.CeilHeight); + Vector3D v3 = new Vector3D(l.End.Position.x, l.End.Position.y, l.Back.Sector.CeilHeight); + ceiling.plane = new Plane(v1, v2, v3); + } + // Align ceiling with front of line + else if((l.Args[1] == 2) && (l.Back.Sector == sector) && (l.Front != null)) + { + Vector3D v1 = new Vector3D(foundv.Position.x, foundv.Position.y, sector.CeilHeight); + Vector3D v2 = new Vector3D(l.Start.Position.x, l.Start.Position.y, l.Front.Sector.CeilHeight); + Vector3D v3 = new Vector3D(l.End.Position.x, l.End.Position.y, l.Front.Sector.CeilHeight); + ceiling.plane = new Plane(v1, v2, v3); + } + } + } + + foreach(Thing t in things) + { + // Copy floor slope + if(t.Type == 9510) + { + // Find tagged sector + Sector ts = null; + foreach(Sector s in General.Map.Map.Sectors) + { + if(s.Tag == t.Args[0]) + { + ts = s; + break; + } + } + + if(ts != null) + { + SectorData tsd = mode.GetSectorData(ts); + if(!tsd.Built) tsd.BuildLevels(mode); + floor.plane = tsd.floor.plane; + } + } + } + + // Sort the levels + levels.Sort(); + // Done built = true; + isbuilding = false; } - + #endregion } } diff --git a/Source/Plugins/GZDoomEditing/VisualModes/SectorLevel.cs b/Source/Plugins/GZDoomEditing/VisualModes/SectorLevel.cs index 617dc008..357edf7e 100644 --- a/Source/Plugins/GZDoomEditing/VisualModes/SectorLevel.cs +++ b/Source/Plugins/GZDoomEditing/VisualModes/SectorLevel.cs @@ -6,20 +6,49 @@ using System.Collections.Generic; using System.Globalization; using System.Text; using CodeImp.DoomBuilder.Geometry; +using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Rendering; #endregion namespace CodeImp.DoomBuilder.GZDoomEditing { - internal struct SectorLevel + internal class SectorLevel : IComparable { + // Center of sector to use for plane comparison + public Vector3D center; + // Type of level public SectorLevelType type; // Plane in the sector public Plane plane; - - // Color below the plane (includes brightness) + + // Color of the plane (includes brightness) public int color; + + // Color and brightness below the plane + public int brightnessbelow; + public PixelColor colorbelow; + + // Constructor + public SectorLevel(Sector s, SectorLevelType type) + { + this.type = type; + this.center = new Vector3D(s.BBox.Left + s.BBox.Width / 2, s.BBox.Top + s.BBox.Height / 2, (s.FloorHeight + s.CeilHeight) / 2); + } + + // Comparer + public int CompareTo(SectorLevel other) + { + float delta = this.plane.ClosestOnPlane(center).z - other.plane.ClosestOnPlane(center).z; + + if(delta > 0.0f) + return 1; + else if(delta < 0.0f) + return -1; + else + return 0; + } } }