Implement absolutez flag for things

This commit is contained in:
spherallic 2023-06-10 03:00:20 +02:00
parent ba4fca0861
commit 073798166a
5 changed files with 10 additions and 8 deletions

View file

@ -126,6 +126,7 @@ sectorflagscategories
thingflags_udmf
{
flip = "Flip";
absolutez = "Absolute Z height";
}
// Thing flags UDMF translation table
@ -137,6 +138,7 @@ thingflagstranslation
2 = "flip";
4 = "special";
8 = "ambush";
16 = "absolutez";
}
// DEFAULT SECTOR BRIGHTNESS LEVELS

View file

@ -87,7 +87,7 @@ namespace CodeImp.DoomBuilder.Controls
// Determine z info to show
t.DetermineSector();
string zinfo;
if(ti.AbsoluteZ || t.Sector == null)
if(ti.AbsoluteZ || t.IsFlagSet(General.Map.UDMF ? "absolutez" : "16") || t.Sector == null)
{
zinfo = t.Position.z.ToString(CultureInfo.InvariantCulture) + " (abs.)"; //mxd
}

View file

@ -2213,7 +2213,7 @@ namespace CodeImp.DoomBuilder.Geometry
if(initialSector != t.Sector && General.Map.FormatInterface.HasThingHeight)
{
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
if(ti.AbsoluteZ) return;
if(ti.AbsoluteZ || t.IsFlagSet(General.Map.UDMF ? "absolutez" : "16")) return;
if(ti.Hangs && initialSector.CeilHeight != t.Sector.CeilHeight)
{
@ -2226,10 +2226,10 @@ namespace CodeImp.DoomBuilder.Geometry
}
}
public static int GetThingAbsoluteZ(Thing t, ThingTypeInfo ti)
public static int GetThingAbsoluteZ(Thing t, ThingTypeInfo ti)
{
// Determine z info
if(ti.AbsoluteZ) return (int)t.Position.z;
if(ti.AbsoluteZ || t.IsFlagSet(General.Map.UDMF ? "absolutez" : "16")) return (int)t.Position.z;
if(t.Sector != null)
{

View file

@ -354,7 +354,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
Vector3D pos = thing.Thing.Position;
double thingheight = thing.Thing.Height;
bool absolute = thing.Info.AbsoluteZ;
bool absolute = thing.Info.AbsoluteZ || thing.Thing.IsFlagSet(General.Map.UDMF ? "absolutez" : "16");
bool hangs = thing.Info.Hangs;
if(absolute && hangs)
@ -450,7 +450,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
Vector3D pos = thing.Thing.Position;
double thingheight = thing.Thing.Height;
bool absolute = thing.Info.AbsoluteZ;
bool absolute = thing.Info.AbsoluteZ || thing.Thing.IsFlagSet(General.Map.UDMF ? "absolutez" : "16"); ;
bool hangs = thing.Info.Hangs;
if(absolute && hangs)
@ -577,7 +577,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(info != null)
{
if(info.AbsoluteZ && info.Hangs) return t.Position.z; // Not sure what to do here...
if(info.AbsoluteZ)
if(info.AbsoluteZ || t.IsFlagSet(General.Map.UDMF ? "absolutez" : "16"))
{
// Transform to floor-aligned position
SectorData nsd = mode.GetSectorData(t.Sector);

View file

@ -434,7 +434,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
pos.z = (Thing.Args[0] == 0) ? sd.Floor.sector.FloorHeight + Thing.Position.z : Thing.Position.z;
}
}
else if(info.AbsoluteZ)
else if(info.AbsoluteZ || Thing.IsFlagSet(General.Map.UDMF ? "absolutez" : "16"))
{
// Absolute Z position
pos.z = Thing.Position.z;