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

RotateCuts() private method

private RotateCuts ( WorldRotation rot, WallCuts input, short x, short y ) : WallCuts
rot WorldRotation
input WallCuts
x short
y short
return WallCuts
        private WallCuts RotateCuts(WorldRotation rot, WallCuts input, short x, short y)
        {
            int rotN = (int)rot;
            var output = new WallCuts();
            switch (rotN)
            {
                case 0:
                    return input;
                case 1:
                    output.TRCut = input.TLCut;
                    if (y + 1 < blueprint.Height) output.TLCut = Cuts[(y + 1) * blueprint.Width + x].TRCut;

                    if (output.TLCut == WallCut.DownLeftUpRight) output.TLCut = WallCut.DownRightUpLeft; //flip cut
                    else if (output.TLCut == WallCut.DownRightUpLeft) output.TLCut = WallCut.DownLeftUpRight;

                    return output;
                case 2:
                    output.TRCut = input.TLCut;
                    if (y + 1 < blueprint.Height) output.TRCut = Cuts[(y + 1) * blueprint.Width + x].TRCut;
                    if (x + 1 < blueprint.Width) output.TLCut = Cuts[y * blueprint.Width + x + 1].TLCut;

                    if (output.TLCut == WallCut.DownLeftUpRight) output.TLCut = WallCut.DownRightUpLeft; //flip cuts
                    else if (output.TLCut == WallCut.DownRightUpLeft) output.TLCut = WallCut.DownLeftUpRight;
                    if (output.TRCut == WallCut.DownLeftUpRight) output.TRCut = WallCut.DownRightUpLeft;
                    else if (output.TRCut == WallCut.DownRightUpLeft) output.TRCut = WallCut.DownLeftUpRight;

                    return output;
                case 3:
                    output.TLCut = input.TRCut;
                    if (x + 1 < blueprint.Width) output.TRCut = Cuts[y * blueprint.Width + x+1].TLCut;

                    if (output.TRCut == WallCut.DownLeftUpRight) output.TRCut = WallCut.DownRightUpLeft; //flip cut
                    else if (output.TRCut == WallCut.DownRightUpLeft) output.TRCut = WallCut.DownLeftUpRight;

                    return output;
            }
            return output;
        }