mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-18 10:01:48 +00:00
Added, Visual mode: added support for ROLLCENTER sprite rendering flag, updated ROLLSPRITE implementation.
Fixed, DECORATE support: the editor was unable to determine actor sprite when the actor itself had no sprites defined and the actor it inherited from was only defined in the game configuration. Fixed, Drag geometry modes: linedefs without both sides were removed after dragging them when "Replace with Dragged Geometry" mode was active. Updated ZDoom_DECORATE.cfg.
This commit is contained in:
parent
ec9c3a71f9
commit
13068b1137
6 changed files with 145 additions and 107 deletions
|
@ -747,6 +747,12 @@ properties
|
||||||
|
|
||||||
constants
|
constants
|
||||||
{
|
{
|
||||||
|
//rendering
|
||||||
|
FLATSPRITE;
|
||||||
|
ROLLSPRITE;
|
||||||
|
WALLSPRITE;
|
||||||
|
DONTFLIP;
|
||||||
|
ROLLCENTER;
|
||||||
//pointers
|
//pointers
|
||||||
AAPTR_DEFAULT;
|
AAPTR_DEFAULT;
|
||||||
AAPTR_NULL;
|
AAPTR_NULL;
|
||||||
|
|
|
@ -89,6 +89,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
//mxd. GZDoom rendering properties
|
//mxd. GZDoom rendering properties
|
||||||
private ThingRenderMode rendermode;
|
private ThingRenderMode rendermode;
|
||||||
private bool rollsprite;
|
private bool rollsprite;
|
||||||
|
private bool rollcenter;
|
||||||
private bool dontflip;
|
private bool dontflip;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -129,6 +130,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
//mxd. GZDoom rendering properties
|
//mxd. GZDoom rendering properties
|
||||||
public ThingRenderMode RenderMode { get { return rendermode; } }
|
public ThingRenderMode RenderMode { get { return rendermode; } }
|
||||||
public bool RollSprite { get { return rollsprite; } }
|
public bool RollSprite { get { return rollsprite; } }
|
||||||
|
public bool RollCenter { get { return rollcenter; } }
|
||||||
public bool DontFlip { get { return dontflip; } }
|
public bool DontFlip { get { return dontflip; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -396,6 +398,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
this.rendermode = other.rendermode;
|
this.rendermode = other.rendermode;
|
||||||
this.dontflip = other.dontflip;
|
this.dontflip = other.dontflip;
|
||||||
this.rollsprite = other.rollsprite;
|
this.rollsprite = other.rollsprite;
|
||||||
|
this.rollcenter = other.rollcenter;
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
@ -460,13 +463,13 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
|
|
||||||
// Set sprite
|
// Set sprite
|
||||||
StateStructure.FrameInfo info = actor.FindSuitableSprite(); //mxd
|
StateStructure.FrameInfo info = actor.FindSuitableSprite(); //mxd
|
||||||
if(!locksprite && !string.IsNullOrEmpty(info.Sprite)) //mxd. Added locksprite property
|
if(!locksprite && info != null) //mxd. Added locksprite property
|
||||||
sprite = info.Sprite;
|
sprite = info.Sprite;
|
||||||
else if(string.IsNullOrEmpty(sprite))//mxd
|
else if(string.IsNullOrEmpty(sprite))//mxd
|
||||||
sprite = DataManager.INTERNAL_PREFIX + "unknownthing";
|
sprite = DataManager.INTERNAL_PREFIX + "unknownthing";
|
||||||
|
|
||||||
//mxd. Store dynamic light name
|
//mxd. Store dynamic light name
|
||||||
lightname = info.LightName;
|
lightname = (info != null ? info.LightName : string.Empty);
|
||||||
|
|
||||||
//mxd. Create sprite frame
|
//mxd. Create sprite frame
|
||||||
this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } };
|
this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } };
|
||||||
|
@ -514,7 +517,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. BRIGHT
|
//mxd. BRIGHT
|
||||||
this.bright = info.Bright || actor.GetFlagValue("bright", false);
|
this.bright = (info != null && info.Bright) || actor.GetFlagValue("bright", false);
|
||||||
|
|
||||||
// Safety
|
// Safety
|
||||||
if(this.radius < 4f || this.fixedsize) this.radius = THING_FIXED_SIZE;
|
if(this.radius < 4f || this.fixedsize) this.radius = THING_FIXED_SIZE;
|
||||||
|
@ -529,6 +532,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
|
|
||||||
//mxd. GZDoom rendering flags
|
//mxd. GZDoom rendering flags
|
||||||
rollsprite = actor.GetFlagValue("rollsprite", false);
|
rollsprite = actor.GetFlagValue("rollsprite", false);
|
||||||
|
if(rollsprite) rollcenter = actor.GetFlagValue("rollcenter", false);
|
||||||
if(actor.GetFlagValue("wallsprite", false)) rendermode = ThingRenderMode.WALLSPRITE;
|
if(actor.GetFlagValue("wallsprite", false)) rendermode = ThingRenderMode.WALLSPRITE;
|
||||||
if(actor.GetFlagValue("flatsprite", false))
|
if(actor.GetFlagValue("flatsprite", false))
|
||||||
{
|
{
|
||||||
|
|
|
@ -3079,14 +3079,9 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
foreach(Linedef l in alllines)
|
foreach(Linedef l in alllines)
|
||||||
{
|
{
|
||||||
// Remove line when it's start, center and end are inside a changed sector and neither side references it
|
// Remove line when it's start, center and end are inside a changed sector and neither side references it
|
||||||
if(l.Start != null && l.End != null)
|
if(l.Start != null && l.End != null
|
||||||
{
|
&& (l.Front == null || !changedsectors.Contains(l.Front.Sector))
|
||||||
if(l.Front == null && l.Back == null)
|
&& (l.Back == null || !changedsectors.Contains(l.Back.Sector)))
|
||||||
{
|
|
||||||
l.Dispose();
|
|
||||||
}
|
|
||||||
else if((l.Front == null || !changedsectors.Contains(l.Front.Sector)) &&
|
|
||||||
(l.Back == null || !changedsectors.Contains(l.Back.Sector)))
|
|
||||||
{
|
{
|
||||||
foreach(Sector s in changedsectors)
|
foreach(Sector s in changedsectors)
|
||||||
{
|
{
|
||||||
|
@ -3117,7 +3112,6 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
}
|
}
|
||||||
|
|
||||||
// This sets the vertices for the thing sprite
|
// This sets the vertices for the thing sprite
|
||||||
protected void SetVertices(WorldVertex[][] verts/*, Plane floor, Plane ceiling*/)
|
protected void SetVertices(WorldVertex[][] verts, Vector2D[] offsets/*, Plane floor, Plane ceiling*/)
|
||||||
{
|
{
|
||||||
// Copy vertices
|
// Copy vertices
|
||||||
vertices = new WorldVertex[verts.Length][];
|
vertices = new WorldVertex[verts.Length][];
|
||||||
|
@ -285,8 +285,23 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
for(int c = 0; c < vertices.Length; c++)
|
for(int c = 0; c < vertices.Length; c++)
|
||||||
{
|
{
|
||||||
if(triangles[c] < 2) continue;
|
if(triangles[c] < 2) continue;
|
||||||
float localcenterz = vertices[c][1].z * 0.5f;
|
|
||||||
Matrix transform, rotation;
|
Matrix transform, rotation;
|
||||||
|
float centerx, centerz;
|
||||||
|
|
||||||
|
// ROLLCENTER flag support
|
||||||
|
if(info.RollSprite && info.RollCenter && thing.Roll != 0)
|
||||||
|
{
|
||||||
|
// Rotate around sprite center
|
||||||
|
centerx = offsets[c].x;
|
||||||
|
centerz = vertices[c][1].z * 0.5f - offsets[c].y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Sprite center is already where it needs to be
|
||||||
|
centerx = 0f;
|
||||||
|
centerz = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
switch(thing.RenderMode)
|
switch(thing.RenderMode)
|
||||||
{
|
{
|
||||||
|
@ -296,9 +311,35 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
|
|
||||||
// Actor becomes a flat sprite which can be tilted with the use of the Pitch actor property.
|
// Actor becomes a flat sprite which can be tilted with the use of the Pitch actor property.
|
||||||
case ThingRenderMode.FLATSPRITE:
|
case ThingRenderMode.FLATSPRITE:
|
||||||
rotation = (info.RollSprite ? Matrix.RotationY(-thing.RollRad) * Matrix.RotationX(thing.PitchRad) : Matrix.RotationX(thing.PitchRad))
|
transform = Matrix.Identity;
|
||||||
* Matrix.RotationZ(thing.Angle);
|
|
||||||
transform = Matrix.Translation(0f, 0f, -localcenterz) * rotation * Matrix.Translation(0f, 0f, localcenterz);
|
// Apply roll
|
||||||
|
if(info.RollSprite && thing.Roll != 0)
|
||||||
|
{
|
||||||
|
if(info.RollCenter)
|
||||||
|
{
|
||||||
|
rotation = Matrix.RotationY(-thing.RollRad);
|
||||||
|
transform = Matrix.Translation(-centerx, -centerx, -centerz) * rotation * Matrix.Translation(centerx, centerx, centerz);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Sprite center is already where it needs to be
|
||||||
|
transform = Matrix.RotationY(-thing.RollRad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pitch should be performed from the center of the sprite regardless of ROLLCENTER flag...
|
||||||
|
if(thing.Pitch != 0)
|
||||||
|
{
|
||||||
|
float localcenterz = vertices[c][1].z * 0.5f;
|
||||||
|
rotation = Matrix.RotationX(-thing.PitchRad);
|
||||||
|
transform *= Matrix.Translation(0f, 0f, -localcenterz) * rotation * Matrix.Translation(0f, 0f, localcenterz);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add thing angle into the mix
|
||||||
|
transform *= Matrix.RotationZ(thing.Angle);
|
||||||
|
|
||||||
|
// Apply transform
|
||||||
for(int i = 0; i < vertices[c].Length; i++)
|
for(int i = 0; i < vertices[c].Length; i++)
|
||||||
{
|
{
|
||||||
Vector4 transformed = Vector3.Transform(new Vector3(vertices[c][i].x, vertices[c][i].y, vertices[c][i].z), transform);
|
Vector4 transformed = Vector3.Transform(new Vector3(vertices[c][i].x, vertices[c][i].y, vertices[c][i].z), transform);
|
||||||
|
@ -310,8 +351,21 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
|
|
||||||
// Similar to FLATSPRITE but is not affected by pitch.
|
// Similar to FLATSPRITE but is not affected by pitch.
|
||||||
case ThingRenderMode.WALLSPRITE:
|
case ThingRenderMode.WALLSPRITE:
|
||||||
rotation = (info.RollSprite ? Matrix.RotationY(-thing.RollRad) * Matrix.RotationZ(thing.Angle) : Matrix.RotationZ(thing.Angle));
|
// Apply sprite roll?
|
||||||
transform = Matrix.Translation(0f, 0f, -localcenterz) * rotation * Matrix.Translation(0f, 0f, localcenterz);
|
if(info.RollSprite && thing.Roll != 0)
|
||||||
|
{
|
||||||
|
rotation = Matrix.RotationY(-thing.RollRad) * Matrix.RotationZ(thing.Angle);
|
||||||
|
if(info.RollCenter)
|
||||||
|
transform = Matrix.Translation(-centerx, -centerx, -centerz) * rotation * Matrix.Translation(centerx, centerx, centerz);
|
||||||
|
else
|
||||||
|
transform = rotation; // Sprite center is already where it needs to be
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
transform = Matrix.RotationZ(thing.Angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply transform
|
||||||
for(int i = 0; i < vertices[c].Length; i++)
|
for(int i = 0; i < vertices[c].Length; i++)
|
||||||
{
|
{
|
||||||
Vector4 transformed = Vector3.Transform(new Vector3(vertices[c][i].x, vertices[c][i].y, vertices[c][i].z), transform);
|
Vector4 transformed = Vector3.Transform(new Vector3(vertices[c][i].x, vertices[c][i].y, vertices[c][i].z), transform);
|
||||||
|
@ -321,7 +375,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Some old GLOOME stuff
|
#region Some old GLOOME FLOOR_SPRITE/CEILING_SPRITE support code
|
||||||
/*case Thing.SpriteRenderMode.FLOOR_SPRITE:
|
/*case Thing.SpriteRenderMode.FLOOR_SPRITE:
|
||||||
Matrix floorrotation = Matrix.RotationZ(info.RollSprite ? Thing.RollRad : 0f)
|
Matrix floorrotation = Matrix.RotationZ(info.RollSprite ? Thing.RollRad : 0f)
|
||||||
* Matrix.RotationY(Thing.Angle)
|
* Matrix.RotationY(Thing.Angle)
|
||||||
|
@ -407,11 +461,18 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;*/
|
break;*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
case ThingRenderMode.NORMAL:
|
case ThingRenderMode.NORMAL:
|
||||||
if(info.RollSprite)
|
if(info.RollSprite && thing.Roll != 0)
|
||||||
{
|
{
|
||||||
transform = Matrix.Translation(0f, 0f, -localcenterz) * Matrix.RotationY(-thing.RollRad) * Matrix.Translation(0f, 0f, localcenterz);
|
rotation = Matrix.RotationY(-thing.RollRad);
|
||||||
|
if(info.RollCenter)
|
||||||
|
transform = Matrix.Translation(-centerx, -centerx, -centerz) * rotation * Matrix.Translation(centerx, centerx, centerz);
|
||||||
|
else
|
||||||
|
transform = rotation; // Sprite center is already where it needs to be
|
||||||
|
|
||||||
|
// Apply transform
|
||||||
for(int i = 0; i < vertices[c].Length; i++)
|
for(int i = 0; i < vertices[c].Length; i++)
|
||||||
{
|
{
|
||||||
Vector4 transformed = Vector3.Transform(new Vector3(vertices[c][i].x, vertices[c][i].y, vertices[c][i].z), transform);
|
Vector4 transformed = Vector3.Transform(new Vector3(vertices[c][i].x, vertices[c][i].y, vertices[c][i].z), transform);
|
||||||
|
@ -515,7 +576,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
if(Thing.IsDirectional)
|
if(Thing.IsDirectional)
|
||||||
{
|
{
|
||||||
Matrix transform = Matrix.Scaling(thing.Size, thing.Size, thing.Size)
|
Matrix transform = Matrix.Scaling(thing.Size, thing.Size, thing.Size)
|
||||||
* (Matrix.RotationY(-Thing.RollRad) * Matrix.RotationX(Thing.PitchRad) * Matrix.RotationZ(Thing.Angle))
|
* (Matrix.RotationY(-Thing.RollRad) * Matrix.RotationX(-Thing.PitchRad) * Matrix.RotationZ(Thing.Angle))
|
||||||
* (sizeless ? position : position * Matrix.Translation(0.0f, 0.0f, thingheight / 2f));
|
* (sizeless ? position : position * Matrix.Translation(0.0f, 0.0f, thingheight / 2f));
|
||||||
|
|
||||||
WorldVertex a0 = new WorldVertex(Vector3D.Transform(0.0f, 0.0f, 0.0f, transform)); //start
|
WorldVertex a0 = new WorldVertex(Vector3D.Transform(0.0f, 0.0f, 0.0f, transform)); //start
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
{
|
{
|
||||||
#region ================== Constants
|
#region ================== Constants
|
||||||
|
|
||||||
//private readonly string[] SPRITE_POSTFIXES = new[] {"2C8", "2D8", "2A8", "2B8", "1C1", "1D1", "1A1", "1B1", "A2", "A1", "A0", "2", "1", "0" };
|
private readonly string[] SPRITE_CHECK_STATES = { "idle", "see", "inactive", "spawn" }; //mxd
|
||||||
internal const string ACTOR_CLASS_SPECIAL_TOKENS = ":{}\n;,"; //mxd
|
internal const string ACTOR_CLASS_SPECIAL_TOKENS = ":{}\n;,"; //mxd
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -476,7 +476,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
{
|
{
|
||||||
//states
|
//states
|
||||||
if(states.Count == 0 && !string.IsNullOrEmpty(ti.Value.Sprite))
|
if(states.Count == 0 && !string.IsNullOrEmpty(ti.Value.Sprite))
|
||||||
states.Add("spawn", new StateStructure(ti.Value.Sprite.Substring(0, 4)));
|
states.Add("spawn", new StateStructure(ti.Value.Sprite.Substring(0, 5)));
|
||||||
|
|
||||||
//flags
|
//flags
|
||||||
if(ti.Value.Hangs && !flags.ContainsKey("spawnceiling"))
|
if(ti.Value.Hangs && !flags.ContainsKey("spawnceiling"))
|
||||||
|
@ -668,8 +668,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StateStructure.FrameInfo FindSuitableSprite()
|
public StateStructure.FrameInfo FindSuitableSprite()
|
||||||
{
|
{
|
||||||
StateStructure.FrameInfo result = new StateStructure.FrameInfo(); //mxd
|
// Info: actual sprites are resolved in ThingTypeInfo.SetupSpriteFrame() - mxd
|
||||||
|
|
||||||
// Sprite forced?
|
// Sprite forced?
|
||||||
if(HasPropertyWithValue("$sprite"))
|
if(HasPropertyWithValue("$sprite"))
|
||||||
{
|
{
|
||||||
|
@ -677,65 +676,32 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
|
|
||||||
//mxd. Valid when internal or exists
|
//mxd. Valid when internal or exists
|
||||||
if(sprite.StartsWith(DataManager.INTERNAL_PREFIX, StringComparison.OrdinalIgnoreCase) || General.Map.Data.GetSpriteExists(sprite))
|
if(sprite.StartsWith(DataManager.INTERNAL_PREFIX, StringComparison.OrdinalIgnoreCase) || General.Map.Data.GetSpriteExists(sprite))
|
||||||
{
|
return new StateStructure.FrameInfo { Sprite = sprite };
|
||||||
result.Sprite = sprite;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//mxd. Bitch and moan
|
//mxd. Bitch and moan
|
||||||
General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in " + classname + ":" + doomednum + ". The sprite \"" + sprite + "\" assigned by the \"$sprite\" property does not exist.");
|
General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in " + classname + ":" + doomednum + ". The sprite \"" + sprite + "\" assigned by the \"$sprite\" property does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try the idle state
|
//mxd. Try to get a suitable sprite from our hardcoded states list
|
||||||
if(HasState("idle"))
|
foreach(string state in SPRITE_CHECK_STATES)
|
||||||
{
|
{
|
||||||
StateStructure s = GetState("idle");
|
if(!HasState(state)) continue;
|
||||||
StateStructure.FrameInfo info = s.GetSprite(0);
|
|
||||||
if(!string.IsNullOrEmpty(info.Sprite)) result = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try the see state
|
StateStructure s = GetState(state);
|
||||||
if(string.IsNullOrEmpty(result.Sprite) && HasState("see"))
|
|
||||||
{
|
|
||||||
StateStructure s = GetState("see");
|
|
||||||
StateStructure.FrameInfo info = s.GetSprite(0);
|
StateStructure.FrameInfo info = s.GetSprite(0);
|
||||||
if(!string.IsNullOrEmpty(info.Sprite)) result = info;
|
if(!string.IsNullOrEmpty(info.Sprite)) return info;
|
||||||
}
|
|
||||||
|
|
||||||
// Try the inactive state
|
|
||||||
if(string.IsNullOrEmpty(result.Sprite) && HasState("inactive"))
|
|
||||||
{
|
|
||||||
StateStructure s = GetState("inactive");
|
|
||||||
StateStructure.FrameInfo info = s.GetSprite(0);
|
|
||||||
if(!string.IsNullOrEmpty(info.Sprite)) result = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try the spawn state
|
|
||||||
if(string.IsNullOrEmpty(result.Sprite) && HasState("spawn"))
|
|
||||||
{
|
|
||||||
StateStructure s = GetState("spawn");
|
|
||||||
StateStructure.FrameInfo info = s.GetSprite(0);
|
|
||||||
if(!string.IsNullOrEmpty(info.Sprite)) result = info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still no sprite found? then just pick the first we can find
|
// Still no sprite found? then just pick the first we can find
|
||||||
if(string.IsNullOrEmpty(result.Sprite))
|
|
||||||
{
|
|
||||||
Dictionary<string, StateStructure> list = GetAllStates();
|
Dictionary<string, StateStructure> list = GetAllStates();
|
||||||
foreach(StateStructure s in list.Values)
|
foreach(StateStructure s in list.Values)
|
||||||
{
|
{
|
||||||
StateStructure.FrameInfo info = s.GetSprite(0);
|
StateStructure.FrameInfo info = s.GetSprite(0);
|
||||||
if(!string.IsNullOrEmpty(info.Sprite))
|
if(!string.IsNullOrEmpty(info.Sprite)) return info;
|
||||||
{
|
|
||||||
result = info;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. We've found something. Or not...
|
//mxd. No dice...
|
||||||
//Info: actual sprites are resolved in ThingTypeInfo.SetupSpriteFrame()
|
return null;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -275,19 +275,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
//mxd. Create verts for all sprite angles
|
//mxd. Create verts for all sprite angles
|
||||||
WorldVertex[][] allverts = new WorldVertex[info.SpriteFrame.Length][];
|
WorldVertex[][] allverts = new WorldVertex[info.SpriteFrame.Length][];
|
||||||
|
Vector2D[] alloffsets = new Vector2D[info.SpriteFrame.Length];
|
||||||
base.textures = new ImageData[info.SpriteFrame.Length];
|
base.textures = new ImageData[info.SpriteFrame.Length];
|
||||||
isloaded = true;
|
isloaded = true;
|
||||||
|
|
||||||
for(int i = 0; i < sprites.Length; i++)
|
for(int i = 0; i < sprites.Length; i++)
|
||||||
{
|
{
|
||||||
|
Vector2D offsets = new Vector2D();
|
||||||
|
|
||||||
// Check if the texture is loaded
|
// Check if the texture is loaded
|
||||||
ImageData sprite = sprites[i];
|
ImageData sprite = sprites[i];
|
||||||
sprite.LoadImage();
|
sprite.LoadImage();
|
||||||
if(sprite.IsImageLoaded)
|
if(sprite.IsImageLoaded)
|
||||||
{
|
{
|
||||||
float offsetx = 0.0f;
|
|
||||||
float offsety = 0.0f;
|
|
||||||
|
|
||||||
base.textures[i] = sprite;
|
base.textures[i] = sprite;
|
||||||
|
|
||||||
// Determine sprite size and offset
|
// Determine sprite size and offset
|
||||||
|
@ -296,16 +296,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
ISpriteImage spriteimg = sprite as ISpriteImage;
|
ISpriteImage spriteimg = sprite as ISpriteImage;
|
||||||
if(spriteimg != null)
|
if(spriteimg != null)
|
||||||
{
|
{
|
||||||
offsetx = radius - spriteimg.OffsetX;
|
offsets.x = radius - spriteimg.OffsetX;
|
||||||
offsety = spriteimg.OffsetY - height;
|
offsets.y = spriteimg.OffsetY - height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale by thing type/actor scale
|
// Scale by thing type/actor scale
|
||||||
// We do this after the offset x/y determination above, because that is entirely in sprite pixels space
|
// We do this after the offset x/y determination above, because that is entirely in sprite pixels space
|
||||||
radius *= info.SpriteScale.Width;
|
radius *= info.SpriteScale.Width;
|
||||||
height *= info.SpriteScale.Height;
|
height *= info.SpriteScale.Height;
|
||||||
offsetx *= info.SpriteScale.Width;
|
offsets.x *= info.SpriteScale.Width;
|
||||||
offsety *= info.SpriteScale.Height;
|
offsets.y *= info.SpriteScale.Height;
|
||||||
|
|
||||||
// Make vertices
|
// Make vertices
|
||||||
WorldVertex[] verts = new WorldVertex[6];
|
WorldVertex[] verts = new WorldVertex[6];
|
||||||
|
@ -317,21 +317,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(sizeless) //mxd
|
if(sizeless) //mxd
|
||||||
{
|
{
|
||||||
float hh = height / 2;
|
float hh = height / 2;
|
||||||
verts[0] = new WorldVertex(-radius + offsetx, 0.0f, offsety - hh, sectorcolor, ul, 1.0f);
|
verts[0] = new WorldVertex(-radius + offsets.x, 0.0f, offsets.y - hh, sectorcolor, ul, 1.0f);
|
||||||
verts[1] = new WorldVertex(-radius + offsetx, 0.0f, hh + offsety, sectorcolor, ul, 0.0f);
|
verts[1] = new WorldVertex(-radius + offsets.x, 0.0f, hh + offsets.y, sectorcolor, ul, 0.0f);
|
||||||
verts[2] = new WorldVertex(+radius + offsetx, 0.0f, hh + offsety, sectorcolor, ur, 0.0f);
|
verts[2] = new WorldVertex(+radius + offsets.x, 0.0f, hh + offsets.y, sectorcolor, ur, 0.0f);
|
||||||
verts[3] = verts[0];
|
verts[3] = verts[0];
|
||||||
verts[4] = verts[2];
|
verts[4] = verts[2];
|
||||||
verts[5] = new WorldVertex(+radius + offsetx, 0.0f, offsety - hh, sectorcolor, ur, 1.0f);
|
verts[5] = new WorldVertex(+radius + offsets.x, 0.0f, offsets.y - hh, sectorcolor, ur, 1.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
verts[0] = new WorldVertex(-radius + offsetx, 0.0f, offsety, sectorcolor, ul, 1.0f);
|
verts[0] = new WorldVertex(-radius + offsets.x, 0.0f, offsets.y, sectorcolor, ul, 1.0f);
|
||||||
verts[1] = new WorldVertex(-radius + offsetx, 0.0f, height + offsety, sectorcolor, ul, 0.0f);
|
verts[1] = new WorldVertex(-radius + offsets.x, 0.0f, height + offsets.y, sectorcolor, ul, 0.0f);
|
||||||
verts[2] = new WorldVertex(+radius + offsetx, 0.0f, height + offsety, sectorcolor, ur, 0.0f);
|
verts[2] = new WorldVertex(+radius + offsets.x, 0.0f, height + offsets.y, sectorcolor, ur, 0.0f);
|
||||||
verts[3] = verts[0];
|
verts[3] = verts[0];
|
||||||
verts[4] = verts[2];
|
verts[4] = verts[2];
|
||||||
verts[5] = new WorldVertex(+radius + offsetx, 0.0f, offsety, sectorcolor, ur, 1.0f);
|
verts[5] = new WorldVertex(+radius + offsets.x, 0.0f, offsets.y, sectorcolor, ur, 1.0f);
|
||||||
}
|
}
|
||||||
allverts[i] = verts;
|
allverts[i] = verts;
|
||||||
}
|
}
|
||||||
|
@ -344,6 +344,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
float radius = Math.Min(thingradius, thingheight / 2f);
|
float radius = Math.Min(thingradius, thingheight / 2f);
|
||||||
float height = Math.Min(thingradius * 2f, thingheight);
|
float height = Math.Min(thingradius * 2f, thingheight);
|
||||||
|
|
||||||
|
//mxd. Determine sprite offsets
|
||||||
|
offsets.x = radius;
|
||||||
|
offsets.y = height / 2;
|
||||||
|
|
||||||
// Make vertices
|
// Make vertices
|
||||||
WorldVertex[] verts = new WorldVertex[6];
|
WorldVertex[] verts = new WorldVertex[6];
|
||||||
verts[0] = new WorldVertex(-radius, 0.0f, 0.0f, sectorcolor, 0.0f, 1.0f);
|
verts[0] = new WorldVertex(-radius, 0.0f, 0.0f, sectorcolor, 0.0f, 1.0f);
|
||||||
|
@ -354,10 +358,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
verts[5] = new WorldVertex(+radius, 0.0f, 0.0f, sectorcolor, 1.0f, 1.0f);
|
verts[5] = new WorldVertex(+radius, 0.0f, 0.0f, sectorcolor, 1.0f, 1.0f);
|
||||||
allverts[i] = verts;
|
allverts[i] = verts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mxd. Store offsets
|
||||||
|
alloffsets[i] = offsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
SetVertices(allverts/*, floor, ceiling*/);
|
SetVertices(allverts, alloffsets/*, floor, ceiling*/);
|
||||||
|
|
||||||
// Determine position
|
// Determine position
|
||||||
Vector3D pos = Thing.Position;
|
Vector3D pos = Thing.Position;
|
||||||
|
|
Loading…
Reference in a new issue