mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-25 21:33:06 +00:00
Fixed: alpha-based texture picking wasn't implemented for 3d floor inner sides.
Game configurations: added 2 secret Sector_Set3dFloor flags. Shhh! Don't tell anybody!
This commit is contained in:
parent
2a2780dc4f
commit
9cb14fc80b
2 changed files with 36 additions and 4 deletions
Build/Configurations/Includes
Source/Plugins/BuilderModes/VisualModes
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue