mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 20:02:48 +00:00
Scale thing float offset by thing's mobjscale + more object scale handling improvements
This commit is contained in:
parent
560d8fca57
commit
54f1b38fec
4 changed files with 22 additions and 10 deletions
|
@ -53,6 +53,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
// biwa
|
||||
private bool forceworldpanning;
|
||||
|
||||
// SRB2
|
||||
private float objectscale;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -84,6 +87,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
// biwa
|
||||
public bool ForceWorldPanning { get { return forceworldpanning; } internal set { forceworldpanning = value; isdefined = true; } }
|
||||
|
||||
// SRB2
|
||||
public float ObjectScale { get { return objectscale; } internal set { objectscale = value; isdefined = true; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor
|
||||
|
@ -96,6 +102,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
outsidefogdensity = 255;
|
||||
lightmode = GZDoomLightMode.UNDEFINED;
|
||||
pixelratio = DataManager.DOOM_PIXEL_RATIO;
|
||||
objectscale = 1.0f;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -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 GetScaledObjectSize(size); } }
|
||||
public float Size { get { return size * GetObjectScale(); } }
|
||||
public float RenderSize { get { return rendersize; } }
|
||||
public float Height { get { return GetScaledObjectSize(height); } } //mxd
|
||||
public float Height { get { return height * GetObjectScale(); } } //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,12 +761,12 @@ namespace CodeImp.DoomBuilder.Map
|
|||
map?.ChangeThingIndex(Index, newindex);
|
||||
}
|
||||
|
||||
public float GetScaledObjectSize(float value)
|
||||
public float GetObjectScale()
|
||||
{
|
||||
if (General.Map.Config.EngineName == "srb2")
|
||||
value *= (float)UniFields.GetFloat(this.Fields, "mobjscale", 1.0f);
|
||||
|
||||
return value;
|
||||
return (float)UniFields.GetFloat(this.Fields, "mobjscale", 1.0f) * General.Map.Data.MapInfo.ObjectScale;
|
||||
else
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -76,6 +76,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
case "skynum":
|
||||
mapinfo.Sky1 = "SKY" + tokens[1];
|
||||
break;
|
||||
case "objectscale":
|
||||
mapinfo.ObjectScale = 1.0f; // SRB2 todo: add proper conversion from FRACUNIT-based values to float
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -489,16 +489,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// SRB2 floating things hack
|
||||
// TODO: replace this with config-based parameter once SOC/Lua parsing exists
|
||||
// TODO: replace this with... something better
|
||||
int[] float16 = new int[] {558, 559, 560};
|
||||
int[] float24 = new int[] {300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 320, 321, 330, 331, 332, 333, 334, 335, 520, 1706, 1800};
|
||||
|
||||
int sign = Thing.IsFlipped ? -1 : 1;
|
||||
|
||||
if (Thing.Type == 322 && Thing.Args[1] == 0) // Emblems have float flag on args[1]
|
||||
pos.z = (Thing.IsFlipped) ? pos.z - 24 : pos.z + 24;
|
||||
pos.z += (24 * sign) * Thing.GetObjectScale();
|
||||
else if (float16.Contains(Thing.Type) && Thing.Args[0] == 0)
|
||||
pos.z = (Thing.IsFlipped) ? pos.z - 16 : pos.z + 16;
|
||||
pos.z += (16 * sign) * Thing.GetObjectScale();
|
||||
else if (float24.Contains(Thing.Type) && Thing.Args[0] == 0)
|
||||
pos.z = (Thing.IsFlipped) ? pos.z - 24 : pos.z + 24;
|
||||
pos.z += (24 * sign) * Thing.GetObjectScale();
|
||||
|
||||
//if (info.ZOffset != 0) pos.z += Thing.IsFlipped ? -info.ZOffset : info.ZOffset;
|
||||
|
||||
|
|
Loading…
Reference in a new issue