mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 05:41:45 +00:00
Improve mobjscale handling & show it in classic editing modes
This commit is contained in:
parent
ac74639453
commit
560d8fca57
3 changed files with 32 additions and 25 deletions
|
@ -113,9 +113,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
internal Dictionary<string, bool> Flags { get { return flags; } }
|
||||
public int Action { get { return action; } set { BeforePropsChange(); action = value; } }
|
||||
public int[] Args { get { return args; } }
|
||||
public float Size { get { return size; } }
|
||||
public float Size { get { return GetScaledObjectSize(size); } }
|
||||
public float RenderSize { get { return rendersize; } }
|
||||
public float Height { get { return height; } } //mxd
|
||||
public float Height { get { return GetScaledObjectSize(height); } } //mxd
|
||||
public PixelColor Color { get { return color; } }
|
||||
public bool FixedSize { get { return fixedsize; } }
|
||||
public int Tag { get { return tag; } set { BeforePropsChange(); tag = value; if((tag < General.Map.FormatInterface.MinTag) || (tag > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } }
|
||||
|
@ -761,6 +761,14 @@ namespace CodeImp.DoomBuilder.Map
|
|||
map?.ChangeThingIndex(Index, newindex);
|
||||
}
|
||||
|
||||
public float GetScaledObjectSize(float value)
|
||||
{
|
||||
if (General.Map.Config.EngineName == "srb2")
|
||||
value *= (float)UniFields.GetFloat(this.Fields, "mobjscale", 1.0f);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,36 +560,36 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Trash cage buffer
|
||||
if(cagebuffer != null) cagebuffer.Dispose();
|
||||
cagebuffer = null;
|
||||
float thingsize = thing.Size * (float)UniFields.GetFloat(Thing.Fields, "mobjscale", 1.0f);
|
||||
float thingheight = thing.Height * (float)UniFields.GetFloat(Thing.Fields, "mobjscale", 1.0f);
|
||||
//float thingsize = thing.Size * (float)UniFields.GetFloat(Thing.Fields, "mobjscale", 1.0f);
|
||||
//float thingheight = thing.Height * (float)UniFields.GetFloat(Thing.Fields, "mobjscale", 1.0f);
|
||||
|
||||
// Make a new cage
|
||||
List <WorldVertex> cageverts;
|
||||
if(sizeless)
|
||||
{
|
||||
WorldVertex v0 = new WorldVertex(-thingsize + position_v3.X, -thingsize + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v1 = new WorldVertex(thingsize + position_v3.X, thingsize + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v2 = new WorldVertex(thingsize + position_v3.X, -thingsize + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v3 = new WorldVertex(-thingsize + position_v3.X, thingsize + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v4 = new WorldVertex(position_v3.X, position_v3.Y, thingsize + position_v3.Z);
|
||||
WorldVertex v5 = new WorldVertex(position_v3.X, position_v3.Y, -thingsize + position_v3.Z);
|
||||
WorldVertex v0 = new WorldVertex(-thing.Size + position_v3.X, -thing.Size + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v1 = new WorldVertex(thing.Size + position_v3.X, thing.Size + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v2 = new WorldVertex(thing.Size + position_v3.X, -thing.Size + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v3 = new WorldVertex(-thing.Size + position_v3.X, thing.Size + position_v3.Y, position_v3.Z);
|
||||
WorldVertex v4 = new WorldVertex(position_v3.X, position_v3.Y, thing.Size + position_v3.Z);
|
||||
WorldVertex v5 = new WorldVertex(position_v3.X, position_v3.Y, -thing.Size + position_v3.Z);
|
||||
|
||||
cageverts = new List<WorldVertex>(new[] { v0, v1, v2, v3, v4, v5 });
|
||||
}
|
||||
else
|
||||
{
|
||||
float top = position_v3.Z + (info.CenterHitbox ? thingheight / 2 : thingheight);
|
||||
float bottom = position_v3.Z - (info.CenterHitbox ? thingheight / 2 : 0);
|
||||
float top = position_v3.Z + (info.CenterHitbox ? thing.Height / 2 : thing.Height);
|
||||
float bottom = position_v3.Z - (info.CenterHitbox ? thing.Height / 2 : 0);
|
||||
|
||||
WorldVertex v0 = new WorldVertex(-thingsize + position_v3.X, -thingsize + position_v3.Y, bottom);
|
||||
WorldVertex v1 = new WorldVertex(-thingsize + position_v3.X, thingsize + position_v3.Y, bottom);
|
||||
WorldVertex v2 = new WorldVertex(thingsize + position_v3.X, thingsize + position_v3.Y, bottom);
|
||||
WorldVertex v3 = new WorldVertex(thingsize + position_v3.X, -thingsize + position_v3.Y, bottom);
|
||||
WorldVertex v0 = new WorldVertex(-thing.Size + position_v3.X, -thing.Size + position_v3.Y, bottom);
|
||||
WorldVertex v1 = new WorldVertex(-thing.Size + position_v3.X, thing.Size + position_v3.Y, bottom);
|
||||
WorldVertex v2 = new WorldVertex(thing.Size + position_v3.X, thing.Size + position_v3.Y, bottom);
|
||||
WorldVertex v3 = new WorldVertex(thing.Size + position_v3.X, -thing.Size + position_v3.Y, bottom);
|
||||
|
||||
WorldVertex v4 = new WorldVertex(-thingsize + position_v3.X, -thingsize + position_v3.Y, top);
|
||||
WorldVertex v5 = new WorldVertex(-thingsize + position_v3.X, thingsize + position_v3.Y, top);
|
||||
WorldVertex v6 = new WorldVertex(thingsize + position_v3.X, thingsize + position_v3.Y, top);
|
||||
WorldVertex v7 = new WorldVertex(thingsize + position_v3.X, -thingsize + position_v3.Y, top);
|
||||
WorldVertex v4 = new WorldVertex(-thing.Size + position_v3.X, -thing.Size + position_v3.Y, top);
|
||||
WorldVertex v5 = new WorldVertex(-thing.Size + position_v3.X, thing.Size + position_v3.Y, top);
|
||||
WorldVertex v6 = new WorldVertex(thing.Size + position_v3.X, thing.Size + position_v3.Y, top);
|
||||
WorldVertex v7 = new WorldVertex(thing.Size + position_v3.X, -thing.Size + position_v3.Y, top);
|
||||
|
||||
cageverts = new List<WorldVertex>(new[] { v0, v1,
|
||||
v1, v2,
|
||||
|
@ -608,9 +608,9 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Make new arrow
|
||||
if(Thing.IsDirectional)
|
||||
{
|
||||
Matrix transform = Matrix.Scaling(thingsize, thingsize, thingsize)
|
||||
Matrix transform = Matrix.Scaling(thing.Size, thing.Size, thing.Size)
|
||||
* (Matrix.RotationY((float)-Thing.RollRad) * Matrix.RotationX((float)-Thing.PitchRad) * Matrix.RotationZ((float)Thing.Angle))
|
||||
* ((sizeless || info.CenterHitbox) ? position : position * Matrix.Translation(0.0f, 0.0f, thingheight / 2f));
|
||||
* ((sizeless || info.CenterHitbox) ? position : position * Matrix.Translation(0.0f, 0.0f, thing.Height / 2f));
|
||||
|
||||
WorldVertex a0 = new WorldVertex(Vector3D.Transform(0.0f, 0.0f, 0.0f, transform)); //start
|
||||
WorldVertex a1 = new WorldVertex(Vector3D.Transform(0.0f, -1.5f, 0.0f, transform)); //end
|
||||
|
|
|
@ -196,9 +196,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
fogfactor = 0f; //mxd
|
||||
|
||||
//mxd. Check thing size
|
||||
float mobjscale = (float)UniFields.GetFloat(Thing.Fields, "mobjscale", 1.0f);
|
||||
float thingradius = Thing.Size * mobjscale; // Thing.Size has ThingRadius arg override applied
|
||||
thingheight = Thing.Height * mobjscale; // Thing.Height has ThingHeight arg override applied
|
||||
float thingradius = Thing.Size; // Thing.Size has ThingRadius arg override applied
|
||||
thingheight = Thing.Height; // Thing.Height has ThingHeight arg override applied
|
||||
|
||||
if(thingradius < 0.1f || thingheight < 0.1f)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue