Simplify names, remove unused usings, remove redundant casts.
This commit is contained in:
@@ -122,25 +122,25 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
|
||||
try
|
||||
{
|
||||
Start = LoadField<int>(d, "Start", 0);
|
||||
ShadowStart = LoadField<int>(d, "ShadowStart", -1);
|
||||
ShadowZOffset = LoadField<WDist>(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Length;
|
||||
ZOffset = LoadField<WDist>(d, "ZOffset", WDist.Zero).Length;
|
||||
Tick = LoadField<int>(d, "Tick", 40);
|
||||
transpose = LoadField<bool>(d, "Transpose", false);
|
||||
Start = LoadField(d, "Start", 0);
|
||||
ShadowStart = LoadField(d, "ShadowStart", -1);
|
||||
ShadowZOffset = LoadField(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Length;
|
||||
ZOffset = LoadField(d, "ZOffset", WDist.Zero).Length;
|
||||
Tick = LoadField(d, "Tick", 40);
|
||||
transpose = LoadField(d, "Transpose", false);
|
||||
Frames = LoadField<int[]>(d, "Frames", null);
|
||||
var flipX = LoadField<bool>(d, "FlipX", false);
|
||||
var flipY = LoadField<bool>(d, "FlipY", false);
|
||||
var flipX = LoadField(d, "FlipX", false);
|
||||
var flipY = LoadField(d, "FlipY", false);
|
||||
|
||||
Facings = LoadField<int>(d, "Facings", 1);
|
||||
Facings = LoadField(d, "Facings", 1);
|
||||
if (Facings < 0)
|
||||
{
|
||||
reverseFacings = true;
|
||||
Facings = -Facings;
|
||||
}
|
||||
|
||||
var offset = LoadField<float2>(d, "Offset", float2.Zero);
|
||||
var blendMode = LoadField<BlendMode>(d, "BlendMode", BlendMode.Alpha);
|
||||
var offset = LoadField(d, "Offset", float2.Zero);
|
||||
var blendMode = LoadField(d, "BlendMode", BlendMode.Alpha);
|
||||
|
||||
MiniYaml combine;
|
||||
if (d.TryGetValue("Combine", out combine))
|
||||
@@ -151,10 +151,10 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
var sd = sub.Value.ToDictionary();
|
||||
|
||||
// Allow per-sprite offset, start, and length
|
||||
var subStart = LoadField<int>(sd, "Start", 0);
|
||||
var subOffset = LoadField<float2>(sd, "Offset", float2.Zero);
|
||||
var subFlipX = LoadField<bool>(sd, "FlipX", false);
|
||||
var subFlipY = LoadField<bool>(sd, "FlipY", false);
|
||||
var subStart = LoadField(sd, "Start", 0);
|
||||
var subOffset = LoadField(sd, "Offset", float2.Zero);
|
||||
var subFlipX = LoadField(sd, "FlipX", false);
|
||||
var subFlipY = LoadField(sd, "FlipY", false);
|
||||
|
||||
var subSrc = GetSpriteSrc(modData, tileSet, sequence, animation, sub.Key, sd);
|
||||
var subSprites = cache[subSrc].Select(
|
||||
@@ -165,7 +165,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
if (sd.TryGetValue("Length", out subLengthYaml) && subLengthYaml.Value == "*")
|
||||
subLength = subSprites.Count() - subStart;
|
||||
else
|
||||
subLength = LoadField<int>(sd, "Length", 1);
|
||||
subLength = LoadField(sd, "Length", 1);
|
||||
|
||||
combined = combined.Concat(subSprites.Skip(subStart).Take(subLength));
|
||||
}
|
||||
@@ -185,17 +185,17 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
if (d.TryGetValue("Length", out length) && length.Value == "*")
|
||||
Length = sprites.Length - Start;
|
||||
else
|
||||
Length = LoadField<int>(d, "Length", 1);
|
||||
Length = LoadField(d, "Length", 1);
|
||||
|
||||
// Plays the animation forwards, and then in reverse
|
||||
if (LoadField<bool>(d, "Reverses", false))
|
||||
if (LoadField(d, "Reverses", false))
|
||||
{
|
||||
var frames = Frames ?? Exts.MakeArray(Length, i => Start + i);
|
||||
Frames = frames.Concat(frames.Skip(1).Take(frames.Length - 2).Reverse()).ToArray();
|
||||
Length = 2 * Length - 2;
|
||||
}
|
||||
|
||||
Stride = LoadField<int>(d, "Stride", Length);
|
||||
Stride = LoadField(d, "Stride", Length);
|
||||
|
||||
if (Length > Stride)
|
||||
throw new InvalidOperationException(
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.centerPosition = centerPosition;
|
||||
this.radius = radius;
|
||||
this.zOffset = zOffset;
|
||||
this.trailCount = lineTrails;
|
||||
trailCount = lineTrails;
|
||||
this.trailSeparation = trailSeparation;
|
||||
this.trailAngle = trailAngle;
|
||||
this.color = color;
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
var wcr = Game.Renderer.WorldRgbaColorRenderer;
|
||||
var offset = new WVec(radius.Length, 0, 0);
|
||||
for (var i = 0; i < RangeCircleRenderable.RangeCircleSegments; i++)
|
||||
for (var i = 0; i < RangeCircleSegments; i++)
|
||||
{
|
||||
var a = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleRenderable.RangeCircleStartRotations[i]));
|
||||
var b = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleRenderable.RangeCircleEndRotations[i]));
|
||||
var a = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleStartRotations[i]));
|
||||
var b = wr.ScreenPosition(centerPosition + offset.Rotate(RangeCircleEndRotations[i]));
|
||||
|
||||
if (contrastWidth > 0)
|
||||
wcr.DrawLine(a, b, contrastWidth / wr.Viewport.Zoom, contrastColor);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
@@ -69,16 +67,16 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
|
||||
var spriteName = sprite ?? sequence;
|
||||
|
||||
if (LoadField<bool>(d, "UseTilesetCode", false))
|
||||
if (LoadField(d, "UseTilesetCode", false))
|
||||
{
|
||||
string code;
|
||||
if (loader.TilesetCodes.TryGetValue(ResolveTilesetId(tileSet, d), out code))
|
||||
spriteName = spriteName.Substring(0, 1) + code + spriteName.Substring(2, spriteName.Length - 2);
|
||||
}
|
||||
|
||||
if (LoadField<bool>(d, "AddExtension", true))
|
||||
if (LoadField(d, "AddExtension", true))
|
||||
{
|
||||
var useTilesetExtension = LoadField<bool>(d, "UseTilesetExtension", false);
|
||||
var useTilesetExtension = LoadField(d, "UseTilesetExtension", false);
|
||||
|
||||
string tilesetExtension;
|
||||
if (useTilesetExtension && loader.TilesetExtensions.TryGetValue(ResolveTilesetId(tileSet, d), out tilesetExtension))
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
@@ -52,8 +51,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, WPos pos)
|
||||
{
|
||||
yield return new VoxelRenderable(components, pos + offset, zOffset, camera, this.scale,
|
||||
lightSource, this.lightAmbientColor, this.lightDiffuseColor,
|
||||
yield return new VoxelRenderable(components, pos + offset, zOffset, camera, scale,
|
||||
lightSource, lightAmbientColor, lightDiffuseColor,
|
||||
colorPalette, normalsPalette, shadowPalette);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.lightSource = lightSource;
|
||||
this.lightAmbientColor = lightAmbientColor;
|
||||
this.lightDiffuseColor = lightDiffuseColor;
|
||||
this.palette = color;
|
||||
this.normalsPalette = normals;
|
||||
this.shadowPalette = shadow;
|
||||
palette = color;
|
||||
normalsPalette = normals;
|
||||
shadowPalette = shadow;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
var draw = voxel.voxels.Where(v => v.DisableFunc == null || !v.DisableFunc());
|
||||
|
||||
renderProxy = Game.Renderer.WorldVoxelRenderer.RenderAsync(
|
||||
wr, draw, voxel.camera, voxel.scale, VoxelRenderable.GroundNormal, voxel.lightSource,
|
||||
wr, draw, voxel.camera, voxel.scale, GroundNormal, voxel.lightSource,
|
||||
voxel.lightAmbientColor, voxel.lightDiffuseColor,
|
||||
voxel.palette, voxel.normalsPalette, voxel.shadowPalette);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user