diff --git a/Build/Configurations/Includes/ZDoom_linedefs.cfg b/Build/Configurations/Includes/ZDoom_linedefs.cfg index 7d28f6b..ebb169b 100644 --- a/Build/Configurations/Includes/ZDoom_linedefs.cfg +++ b/Build/Configurations/Includes/ZDoom_linedefs.cfg @@ -3339,7 +3339,7 @@ zdoom } 160 { - title = "Sector 3D Floor (OpenGL only)"; + title = "Sector Set 3D Floor"; id = "Sector_Set3dFloor"; requiresactivation = false; @@ -3372,11 +3372,13 @@ zdoom { 1 = "Disable light effects"; 2 = "Restrict light inside"; - 4 = "Fog effect"; + 4 = "Fog effect (GZDoom) / Fade effect (ZDoom)"; 8 = "Ignore bottom height"; 16 = "Use upper texture"; 32 = "Use lower texture"; 64 = "Additive transluency"; + 512 = "Fade effect (no view blend)"; + 1024 = "Reset light effects"; } } arg3 diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs index d5e9113..2e96cf3 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleBack.cs @@ -318,8 +318,38 @@ namespace CodeImp.DoomBuilder.BuilderModes else base.UpdateAfterTextureOffsetChange(); } - // Return texture name - public override string GetTextureName() + // Alpha based picking + public override bool PickAccurate(Vector3D from, Vector3D to, Vector3D dir, ref float u_ray) + { + if(!Texture.IsImageLoaded || (!Texture.IsTranslucent && !Texture.IsMasked)) return base.PickAccurate(from, to, dir, ref u_ray); + + float u; + Sidedef sourceside = extrafloor.Linedef.Front; + new Line2D(from, to).GetIntersection(Sidedef.Line.Line, out u); + if(Sidedef != Sidedef.Line.Front) u = 1.0f - u; + + // Get correct offset to texture space... + float texoffsetx = Sidedef.OffsetX + sourceside.OffsetX + UniFields.GetFloat(Sidedef.Fields, "offsetx_mid") + UniFields.GetFloat(sourceside.Fields, "offsetx_mid"); + int ox = (int)Math.Floor((u * Sidedef.Line.Length * UniFields.GetFloat(sourceside.Fields, "scalex_mid", 1.0f) / Texture.Scale.x + texoffsetx) % Texture.Width); + + float texoffsety = Sidedef.OffsetY + sourceside.OffsetY + UniFields.GetFloat(Sidedef.Fields, "offsety_mid") + UniFields.GetFloat(sourceside.Fields, "offsety_mid"); + int oy = (int)Math.Ceiling(((pickintersect.z - sourceside.Sector.CeilHeight) * UniFields.GetFloat(sourceside.Fields, "scaley_mid", 1.0f) / Texture.Scale.y - texoffsety) % Texture.Height); + + // Make sure offsets are inside of texture dimensions... + if(ox < 0) ox += Texture.Width; + if(oy < 0) oy += Texture.Height; + + // Check pixel alpha + if(Texture.GetBitmap().GetPixel(General.Clamp(ox, 0, Texture.Width - 1), General.Clamp(Texture.Height - oy, 0, Texture.Height - 1)).A > 0) + { + return base.PickAccurate(from, to, dir, ref u_ray); + } + + return false; + } + + // Return texture name + public override string GetTextureName() { //mxd if((extrafloor.Linedef.Args[2] & (int)Effect3DFloor.Flags.UseUpperTexture) != 0)