FSO.LotView.Components.WallComponent.GetWallSprite C# (CSharp) Method

GetWallSprite() private method

private GetWallSprite ( Wall pattern, WallStyle style, int rotation, bool down, WorldState world ) : _2DSprite
pattern FSO.Content.Model.Wall
style FSO.Content.Model.WallStyle
rotation int
down bool
world WorldState
return FSO.LotView.Utils._2DSprite
        private _2DSprite GetWallSprite(Wall pattern, WallStyle style, int rotation, bool down, WorldState world)
        {
            var _Sprite = world._2D.NewSprite(_2DBatchRenderMode.WALL);
            SPR sprite = null;
            SPR mask = null;
            switch (world.Zoom)
            {
                case WorldZoom.Far:
                    sprite = pattern.Far;
                    if (style != null) mask = (down) ? style.WallsDownFar : style.WallsUpFar;
                    _Sprite.DestRect = DESTINATION_FAR[rotation];
                    _Sprite.Depth = WallZBuffers[rotation+8];
                    break;
                case WorldZoom.Medium:
                    sprite = pattern.Medium;
                    if (style != null) mask = (down) ? style.WallsDownMedium : style.WallsUpMedium;
                    _Sprite.DestRect = DESTINATION_MED[rotation];
                    _Sprite.Depth = WallZBuffers[rotation+4];
                    break;
                case WorldZoom.Near:
                    sprite = pattern.Near;
                    if (style != null) mask = (down) ? style.WallsDownNear : style.WallsUpNear;
                    _Sprite.DestRect = DESTINATION_NEAR[rotation];
                    _Sprite.Depth = WallZBuffers[rotation];
                    break;
                }
            if (sprite != null)
            {
                if (mask == null) mask = sprite;
                _Sprite.Pixel = world._2D.GetTexture(sprite.Frames[rotation]);
                _Sprite.Mask = world._2D.GetTexture(mask.Frames[rotation]);
                _Sprite.SrcRect = new Microsoft.Xna.Framework.Rectangle(0, 0, _Sprite.Pixel.Width, _Sprite.Pixel.Height);
            }

            _Sprite.Room = (ushort)TileRoom;

            return _Sprite;
        }