コード例 #1
0
        private static bool DrawCoastCorners(ref Bytemap output, Direction land)
        {
            if (!Resources.Exists("SP299"))
            {
                return(false);
            }

            Bytemap pic = Resources["SP299"].Bitmap;

            if (land.And(South | East) && land.Not(North | West | SouthWest | NorthEast))
            {
                output.AddLayer(pic[224, 100, 16, 16]);
            }
            else if (land.And(North | West) && land.Not(South | East | NorthEast | SouthWest))
            {
                output.AddLayer(pic[240, 100, 16, 16]);
            }
            else if (land.And(North | East) && land.Not(South | West | NorthWest | SouthEast))
            {
                output.AddLayer(pic[256, 100, 16, 16]);
            }
            else if (land.And(South | West) && land.Not(North | East | SouthEast | NorthWest))
            {
                output.AddLayer(pic[272, 100, 16, 16]);
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #2
0
        private static void DrawRiverMouths(ref Bytemap output, Direction rivers)
        {
            if (!Resources.Exists("TER257"))
            {
                return;
            }

            Bytemap pic = Resources["TER257"].Bitmap;

            if (rivers.And(North))
            {
                output.AddLayer(pic[128, 176, 16, 16]);
            }
            if (rivers.And(East))
            {
                output.AddLayer(pic[144, 176, 16, 16]);
            }
            if (rivers.And(South))
            {
                output.AddLayer(pic[160, 176, 16, 16]);
            }
            if (rivers.And(West))
            {
                output.AddLayer(pic[176, 176, 16, 16]);
            }
        }
コード例 #3
0
        private static void DrawCoastDiagonal(ref Bytemap output, Direction land)
        {
            if (!Resources.Exists("TER257"))
            {
                return;
            }

            Bytemap pic = Resources["TER257"].Bitmap;

            if (land.And(NorthWest) && land.Not(North | West))
            {
                output.AddLayer(pic[32, 176, 8, 8], 0, 0);
            }
            if (land.And(NorthEast) && land.Not(North | East))
            {
                output.AddLayer(pic[40, 176, 8, 8], 8, 0);
            }
            if (land.And(SouthWest) && land.Not(South | West))
            {
                output.AddLayer(pic[32, 184, 8, 8], 0, 8);
            }
            if (land.And(SouthEast) && land.Not(South | East))
            {
                output.AddLayer(pic[40, 184, 8, 8], 8, 8);
            }
        }
コード例 #4
0
ファイル: Free.cs プロジェクト: ybug/CivOne
        public Bytemap Fog(Direction direction)
        {
            Bytemap output = new Bytemap(16, 16);

            switch (direction)
            {
            case Direction.West:
                output.AddLayer(new Bytemap(3, 16).FromByteArray(GenerateNoise(0, 28, 29, 30, 31).Take(3 * 16).ToArray()), 0, 0);
                break;

            case Direction.South:
                output.AddLayer(new Bytemap(16, 3).FromByteArray(GenerateNoise(28, 0, 29, 30, 31).Take(16 * 3).ToArray()), 0, 13);
                break;

            case Direction.East:
                output.AddLayer(new Bytemap(3, 16).FromByteArray(GenerateNoise(28, 29, 0, 30, 31).Take(3 * 16).ToArray()), 13, 0);
                break;

            case Direction.North:
                output.AddLayer(new Bytemap(16, 3).FromByteArray(GenerateNoise(28, 29, 30, 0, 31).Take(16 * 3).ToArray()), 0, 0);
                break;
            }
            return(output);
        }
コード例 #5
0
        private static void DrawCoastSegments(ref Bytemap output, Direction land)
        {
            if (!Resources.Exists("TER257"))
            {
                return;
            }

            Bytemap pic = Resources["TER257"].Bitmap;

            if (land.And(North))
            {
                int xw = land.And(West) ? 80 : land.And(NorthWest) ? 96 : 64;
                int xe = land.And(East) ? 88 : land.And(NorthEast) ? 56 : 24;

                output.AddLayer(pic[xw, 176, 8, 8], 0, 0);
                output.AddLayer(pic[xe, 176, 8, 8], 8, 0);
            }
            if (land.And(East))
            {
                int xn = land.And(North) ? 88 : land.And(NorthEast) ? 104 : 72;
                int xs = land.And(South) ? 88 : land.And(SouthEast) ? 56 : 24;

                output.AddLayer(pic[xn, 176, 8, 8], 8, 0);
                output.AddLayer(pic[xs, 184, 8, 8], 8, 8);
            }
            if (land.And(South))
            {
                int xw = land.And(West) ? 80 : land.And(SouthWest) ? 48 : 16;
                int xe = land.And(East) ? 88 : land.And(SouthEast) ? 104 : 72;

                output.AddLayer(pic[xw, 184, 8, 8], 0, 8);
                output.AddLayer(pic[xe, 184, 8, 8], 8, 8);
            }
            if (land.And(West))
            {
                int xn = land.And(North) ? 80 : land.And(NorthWest) ? 48 : 16;
                int xs = land.And(South) ? 80 : land.And(SouthWest) ? 96 : 64;

                output.AddLayer(pic[xn, 176, 8, 8], 0, 0);
                output.AddLayer(pic[xs, 184, 8, 8], 0, 8);
            }
        }
コード例 #6
0
ファイル: Free.cs プロジェクト: ybug/CivOne
        public Bytemap GetUnit(UnitType type)
        {
            Bytemap output = new Bytemap(16, 16).FromByteArray(GenerateUnit().ToArray());
            char    text   = ' ';

            switch (type)
            {
            case UnitType.Settlers:
                output.AddLayer(new Bytemap(10, 10).FromByteArray(
                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    0, 5, 5, 5, 5, 5, 5, 5, 0, 0,
                                    5, 15, 15, 8, 15, 15, 8, 7, 5, 0,
                                    5, 15, 15, 8, 15, 15, 8, 7, 5, 0,
                                    5, 15, 15, 15, 15, 15, 8, 7, 5, 0,
                                    0, 5, 6, 6, 15, 15, 6, 6, 5, 0,
                                    0, 6, 8, 0, 6, 6, 8, 0, 6, 0,
                                    0, 6, 0, 0, 6, 6, 0, 0, 6, 0,
                                    0, 0, 6, 6, 0, 0, 6, 6, 0, 0,
                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                                    ), 3, 3);
                break;

            case UnitType.Militia:
                output.AddLayer(new Bytemap(10, 10).FromByteArray(
                                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    0, 0, 0, 4, 4, 4, 0, 0, 0, 0,
                                    0, 0, 4, 4, 4, 4, 4, 0, 0, 0,
                                    0, 0, 4, 14, 14, 14, 4, 0, 7, 0,
                                    0, 0, 14, 14, 14, 14, 14, 0, 7, 7,
                                    0, 0, 14, 9, 14, 9, 14, 0, 7, 7,
                                    0, 0, 14, 14, 14, 14, 14, 0, 0, 7,
                                    0, 0, 14, 8, 8, 8, 14, 0, 6, 6,
                                    0, 0, 5, 14, 14, 14, 5, 0, 5, 5,
                                    0, 5, 5, 5, 5, 5, 5, 5, 5, 0
                                    ), 3, 3);
                break;

            case UnitType.Phalanx:
                output.AddLayer(new Bytemap(10, 10).FromByteArray(
                                    0, 0, 0, 0, 8, 8, 0, 0, 0, 0,
                                    0, 0, 0, 8, 8, 8, 8, 0, 0, 0,
                                    0, 0, 8, 14, 14, 14, 7, 8, 0, 0,
                                    0, 0, 5, 5, 5, 14, 7, 7, 0, 0,
                                    0, 5, 15, 8, 8, 5, 7, 6, 0, 0,
                                    0, 5, 15, 7, 8, 5, 6, 0, 0, 0,
                                    0, 5, 15, 7, 8, 5, 6, 0, 0, 0,
                                    0, 5, 15, 7, 8, 5, 6, 0, 0, 0,
                                    0, 0, 5, 15, 5, 0, 6, 0, 0, 0,
                                    0, 0, 0, 5, 0, 0, 0, 0, 0, 0
                                    ), 3, 3);
                break;

            case UnitType.Legion: text = 'L'; break;

            case UnitType.Musketeers: text = 'M'; break;

            case UnitType.Riflemen: text = 'R'; break;

            case UnitType.Cavalry: text = 'c'; break;

            case UnitType.Knights: text = 'K'; break;

            case UnitType.Catapult: text = 'C'; break;

            case UnitType.Cannon: text = 'X'; break;

            case UnitType.Chariot: text = 'W'; break;

            case UnitType.Armor: text = 'a'; break;

            case UnitType.MechInf: text = 'I'; break;

            case UnitType.Artillery: text = 'A'; break;

            case UnitType.Fighter: text = 'F'; break;

            case UnitType.Bomber: text = 'B'; break;

            case UnitType.Trireme: text = 'T'; break;

            case UnitType.Sail: text = 's'; break;

            case UnitType.Frigate: text = 'f'; break;

            case UnitType.Ironclad: text = 'i'; break;

            case UnitType.Cruiser: text = 'Y'; break;

            case UnitType.Battleship: text = 'Z'; break;

            case UnitType.Submarine: text = 'U'; break;

            case UnitType.Carrier: text = 'G'; break;

            case UnitType.Transport: text = 'H'; break;

            case UnitType.Nuclear: text = 'N'; break;

            case UnitType.Diplomat: text = 'D'; break;

            case UnitType.Caravan: text = 't'; break;
            }
            if (text != ' ')
            {
                output.AddLayer(
                    new Picture(16, 16)
                    .DrawText(text.ToString(), 0, 8, 8, 5, TextAlign.Center)
                    .DrawText(text.ToString(), 0, 7, 8, 4, TextAlign.Center)
                    .Bitmap);
            }
            return(output);
        }