mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
@ work on (G)ZDoom Editing plugin
This commit is contained in:
parent
f2e16e0707
commit
358c28fc19
6 changed files with 50 additions and 10 deletions
|
@ -26,9 +26,10 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
public Sector3DFloor(SectorData controlsector, Linedef sourcelinedef)
|
||||
{
|
||||
linedef = sourcelinedef;
|
||||
int argtype = (sourcelinedef.Args[1] & 0x03);
|
||||
|
||||
// For non-vavoom types, we must switch the level types
|
||||
if((sourcelinedef.Args[1] & 0x03) != 0)
|
||||
if(argtype != 0)
|
||||
{
|
||||
floor = new SectorLevel(controlsector.Ceiling);
|
||||
ceiling = new SectorLevel(controlsector.Floor);
|
||||
|
@ -36,6 +37,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
floor.plane = floor.plane.GetInverted();
|
||||
ceiling.type = SectorLevelType.Ceiling;
|
||||
ceiling.plane = ceiling.plane.GetInverted();
|
||||
floor.alpha = sourcelinedef.Args[3];
|
||||
ceiling.alpha = sourcelinedef.Args[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -47,7 +50,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
floor.color = 0;
|
||||
|
||||
// Do not adjust light? (works only for non-vavoom types)
|
||||
if(((sourcelinedef.Args[2] & 1) != 0) && ((sourcelinedef.Args[1] & 0x03) != 0))
|
||||
if(((sourcelinedef.Args[2] & 1) != 0) && (argtype != 0))
|
||||
{
|
||||
floor.brightnessbelow = -1;
|
||||
floor.colorbelow = PixelColor.FromInt(0);
|
||||
|
|
|
@ -27,6 +27,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
// Plane in the sector
|
||||
public Plane plane;
|
||||
|
||||
// Alpha transparency
|
||||
public int alpha;
|
||||
|
||||
// Color of the plane (includes brightness)
|
||||
// When this is 0, it takes the color from the sector above
|
||||
public int color;
|
||||
|
@ -42,6 +45,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
this.sector = s;
|
||||
this.type = type;
|
||||
this.center = new Vector2D(s.BBox.Left + s.BBox.Width / 2, s.BBox.Top + s.BBox.Height / 2);
|
||||
this.alpha = 255;
|
||||
}
|
||||
|
||||
// Copy constructor
|
||||
|
@ -54,6 +58,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
this.color = source.color;
|
||||
this.brightnessbelow = source.brightnessbelow;
|
||||
this.colorbelow = source.colorbelow;
|
||||
this.alpha = 255;
|
||||
}
|
||||
|
||||
// Comparer
|
||||
|
|
|
@ -114,8 +114,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
for(int i = 0; i < triverts.Count; i++)
|
||||
{
|
||||
// Color shading
|
||||
verts[i].c = level.color;
|
||||
|
||||
PixelColor c = PixelColor.FromInt(level.color);
|
||||
verts[i].c = c.WithAlpha((byte)General.Clamp(level.alpha, 0, 255)).ToInt();
|
||||
|
||||
// Vertex coordinates
|
||||
verts[i].x = triverts[i].x;
|
||||
verts[i].y = triverts[i].y;
|
||||
|
@ -129,7 +130,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
verts[i].u = pos.x;
|
||||
verts[i].v = pos.y;
|
||||
}
|
||||
|
||||
|
||||
// The sector triangulation created clockwise triangles that
|
||||
// are right up for the floor. For the ceiling we must flip
|
||||
// the triangles upside down.
|
||||
|
@ -142,6 +143,12 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
verts[i + 1] = v;
|
||||
}
|
||||
|
||||
// Determine render pass
|
||||
if(level.alpha < 255)
|
||||
this.RenderPass = RenderPass.Alpha;
|
||||
else
|
||||
this.RenderPass = RenderPass.Solid;
|
||||
|
||||
// Apply vertices
|
||||
base.SetVertices(verts);
|
||||
return (verts.Length > 0);
|
||||
|
|
|
@ -113,8 +113,9 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
for(int i = 0; i < triverts.Count; i++)
|
||||
{
|
||||
// Color shading
|
||||
verts[i].c = level.color;
|
||||
|
||||
PixelColor c = PixelColor.FromInt(level.color);
|
||||
verts[i].c = c.WithAlpha((byte)General.Clamp(level.alpha, 0, 255)).ToInt();
|
||||
|
||||
// Vertex coordinates
|
||||
verts[i].x = triverts[i].x;
|
||||
verts[i].y = triverts[i].y;
|
||||
|
@ -129,6 +130,12 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
verts[i].v = pos.y;
|
||||
}
|
||||
|
||||
// Determine render pass
|
||||
if(level.alpha < 255)
|
||||
this.RenderPass = RenderPass.Alpha;
|
||||
else
|
||||
this.RenderPass = RenderPass.Solid;
|
||||
|
||||
// Apply vertices
|
||||
base.SetVertices(verts);
|
||||
return (verts.Length > 0);
|
||||
|
|
|
@ -186,6 +186,24 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
List<WorldVertex> verts = CreatePolygonVertices(poly, tp);
|
||||
if(verts.Count > 0)
|
||||
{
|
||||
if(extrafloor.floor.alpha < 255)
|
||||
{
|
||||
// Apply alpha to vertices
|
||||
for(int i = 0; i < verts.Count; i++)
|
||||
{
|
||||
WorldVertex v = verts[i];
|
||||
PixelColor c = PixelColor.FromInt(v.c);
|
||||
v.c = c.WithAlpha((byte)General.Clamp(extrafloor.floor.alpha, 0, 255)).ToInt();
|
||||
verts[i] = v;
|
||||
}
|
||||
|
||||
this.RenderPass = RenderPass.Alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RenderPass = RenderPass.Solid;
|
||||
}
|
||||
|
||||
base.SetVertices(verts);
|
||||
return true;
|
||||
}
|
||||
|
@ -201,15 +219,15 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
|||
// Return texture name
|
||||
public override string GetTextureName()
|
||||
{
|
||||
return this.Sidedef.MiddleTexture;
|
||||
return extrafloor.linedef.Front.MiddleTexture;
|
||||
}
|
||||
|
||||
// This changes the texture
|
||||
protected override void SetTexture(string texturename)
|
||||
{
|
||||
this.Sidedef.SetTextureMid(texturename);
|
||||
extrafloor.linedef.Front.SetTextureMid(texturename);
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
this.Setup();
|
||||
this.Sector.Rebuild();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue