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

View file

@ -87,7 +87,7 @@ namespace CodeImp.DoomBuilder.Controls
// Determine z info to show // Determine z info to show
t.DetermineSector(); t.DetermineSector();
string zinfo; 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 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) if(initialSector != t.Sector && General.Map.FormatInterface.HasThingHeight)
{ {
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type); 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) if(ti.Hangs && initialSector.CeilHeight != t.Sector.CeilHeight)
{ {
@ -2229,7 +2229,7 @@ namespace CodeImp.DoomBuilder.Geometry
public static int GetThingAbsoluteZ(Thing t, ThingTypeInfo ti) public static int GetThingAbsoluteZ(Thing t, ThingTypeInfo ti)
{ {
// Determine z info // 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) if(t.Sector != null)
{ {

View file

@ -354,7 +354,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
Vector3D pos = thing.Thing.Position; Vector3D pos = thing.Thing.Position;
double thingheight = thing.Thing.Height; 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; bool hangs = thing.Info.Hangs;
if(absolute && hangs) if(absolute && hangs)
@ -450,7 +450,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
Vector3D pos = thing.Thing.Position; Vector3D pos = thing.Thing.Position;
double thingheight = thing.Thing.Height; 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; bool hangs = thing.Info.Hangs;
if(absolute && hangs) if(absolute && hangs)
@ -577,7 +577,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(info != null) if(info != null)
{ {
if(info.AbsoluteZ && info.Hangs) return t.Position.z; // Not sure what to do here... 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 // Transform to floor-aligned position
SectorData nsd = mode.GetSectorData(t.Sector); 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; 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 // Absolute Z position
pos.z = Thing.Position.z; pos.z = Thing.Position.z;