mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
Fixed, Classic modes: thing sprite should always be rendered when it's size is affected by "Fixed Things Scale" option or FixedSize setting.
MAPINFO parser: removed a misleading warning.
This commit is contained in:
parent
f6b444a4f1
commit
6cb9f96a46
2 changed files with 38 additions and 18 deletions
|
@ -188,11 +188,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
if(mapinfo.OutsideFogDensity > 0 && (mapinfo.OutsideFogColor.Red > 0 || mapinfo.OutsideFogColor.Green > 0 || mapinfo.OutsideFogColor.Blue > 0))
|
||||
mapinfo.HasOutsideFogColor = true;
|
||||
|
||||
if(!string.IsNullOrEmpty(mapinfo.Sky2) && !mapinfo.DoubleSky)
|
||||
{
|
||||
LogWarning("\"Sky2\" is defined without \"doublesky\" flag. It won't be shown ingame");
|
||||
}
|
||||
else if(string.IsNullOrEmpty(mapinfo.Sky2) && mapinfo.DoubleSky)
|
||||
if(string.IsNullOrEmpty(mapinfo.Sky2) && mapinfo.DoubleSky)
|
||||
{
|
||||
LogWarning("\"doublesky\" flag is defined without \"Sky2\" property.");
|
||||
mapinfo.DoubleSky = false;
|
||||
|
|
|
@ -1205,6 +1205,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
foreach(KeyValuePair<int, List<Thing>> group in thingsByType)
|
||||
{
|
||||
// Skip when all things of this type will be rendered as models
|
||||
if(group.Value[0].IsModel && (General.Settings.GZDrawModelsMode == ModelRenderMode.ALL)) continue;
|
||||
|
||||
// Find thing information
|
||||
ThingTypeInfo info = General.Map.Data.GetThingInfo(group.Key);
|
||||
|
||||
|
@ -1231,31 +1234,52 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
buffercount = 0;
|
||||
totalcount = 0;
|
||||
|
||||
float spriteWidth, spriteHeight;
|
||||
float fixedscaler = (group.Value[0].FixedSize ? 1.0f : 2.0f);
|
||||
float spriteScale = ((group.Value[0].FixedSize || General.Settings.FixedThingsScale) && (scale > fixedscaler)) ? fixedscaler : scale;
|
||||
bool forcespriterendering;
|
||||
float spritewidth, spriteheight, spritescale;
|
||||
float fixedscaler = (group.Value[0].FixedSize ? 1.0f : 2.0f); // Make sure thing size stays at 2x scale when FixedThingsScale is enabled
|
||||
|
||||
if(sprite.Width > sprite.Height)
|
||||
// Apply FixedSize setting?
|
||||
if((group.Value[0].FixedSize || General.Settings.FixedThingsScale) && (scale > fixedscaler))
|
||||
{
|
||||
spriteWidth = info.Radius * spriteScale - THING_SPRITE_SHRINK * spriteScale;
|
||||
spriteHeight = spriteWidth * ((float)sprite.Height / sprite.Width);
|
||||
}
|
||||
else if(sprite.Width < sprite.Height)
|
||||
{
|
||||
spriteHeight = info.Radius * spriteScale - THING_SPRITE_SHRINK * spriteScale;
|
||||
spriteWidth = spriteHeight * ((float)sprite.Width / sprite.Height);
|
||||
spritescale = fixedscaler;
|
||||
forcespriterendering = true; // Always render sprite when thing size is affected by FixedSize or FixedThingsScale settings
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteWidth = info.Radius * spriteScale - THING_SPRITE_SHRINK * spriteScale;
|
||||
spriteHeight = spriteWidth;
|
||||
spritescale = scale;
|
||||
forcespriterendering = false;
|
||||
}
|
||||
|
||||
// Calculate scaled sprite size
|
||||
if(sprite.Width > sprite.Height)
|
||||
{
|
||||
spritewidth = (info.Radius - THING_SPRITE_SHRINK) * spritescale;
|
||||
spriteheight = spritewidth * ((float)sprite.Height / sprite.Width);
|
||||
}
|
||||
else if(sprite.Width < sprite.Height)
|
||||
{
|
||||
spriteheight = (info.Radius - THING_SPRITE_SHRINK) * spritescale;
|
||||
spritewidth = spriteheight * ((float)sprite.Width / sprite.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
spritewidth = (info.Radius - THING_SPRITE_SHRINK) * spritescale;
|
||||
spriteheight = spritewidth;
|
||||
}
|
||||
|
||||
// Apply radius and height Thing Argument overrides?
|
||||
if(!group.Value[0].FixedSize)
|
||||
{
|
||||
float sizeoverridescaler = group.Value[0].Size / info.Radius;
|
||||
spritewidth *= sizeoverridescaler;
|
||||
spriteheight *= sizeoverridescaler;
|
||||
}
|
||||
float spritesize = Math.Max(spritewidth, spriteheight);
|
||||
|
||||
foreach(Thing t in group.Value)
|
||||
{
|
||||
if(t.IsModel && (General.Settings.GZDrawModelsMode == ModelRenderMode.ALL || (General.Settings.GZDrawModelsMode == ModelRenderMode.SELECTION && t.Selected) || (General.Settings.GZDrawModelsMode == ModelRenderMode.ACTIVE_THINGS_FILTER && alpha == 1.0f))) continue;
|
||||
float scaler = t.Size / info.Radius;
|
||||
if(Math.Max(spriteWidth, spriteHeight) * scaler < MINIMUM_SPRITE_RADIUS)
|
||||
if(t.IsModel && ((General.Settings.GZDrawModelsMode == ModelRenderMode.SELECTION && t.Selected) || (General.Settings.GZDrawModelsMode == ModelRenderMode.ACTIVE_THINGS_FILTER && alpha == 1.0f))) continue;
|
||||
if(!forcespriterendering && spritesize < MINIMUM_SPRITE_RADIUS)
|
||||
{
|
||||
// Hackish way to tell arrow rendering code to draw bigger arrow...
|
||||
Vector3D v = thingsByPosition[t];
|
||||
|
@ -1266,7 +1290,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
continue;
|
||||
}
|
||||
|
||||
CreateThingSpriteVerts(thingsByPosition[t], spriteWidth * scaler, spriteHeight * scaler, ref verts, buffercount * 6, t.Selected ? selectionColor : 0xFFFFFF);
|
||||
CreateThingSpriteVerts(thingsByPosition[t], spritewidth, spriteheight, ref verts, buffercount * 6, (t.Selected ? selectionColor : 0xFFFFFF));
|
||||
buffercount++;
|
||||
totalcount++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue