예제 #1
0
        static TSA_Image MakeTextBubble(int longestLine, Pointer tilesetAddress, Pointer paletteAddress)
        {
            Palette palette = Core.ReadPalette(paletteAddress, Palette.LENGTH);

            Tileset tileset = new Tileset(Core.ReadData(tilesetAddress, 0));

            TSA_Array tsa = new TSA_Array(30, 8);

            for (int y = 0; y < 8; y++)
            {
                for (int x = 0; x < 30; x++)
                {
                    tsa.SetTile(x, y, 0xF);
                }
            }

            int length = 2;

            if (longestLine / 8 > length)
            {
                length = longestLine / 8;
                if (longestLine % 8 != 0)
                {
                    length++;
                }
            }

            tsa.SetTile(0, 0, 0x0);
            for (int i = 1; i <= length; i++)
            {
                tsa.SetTile(i, 0, 0x1);
            }
            tsa.SetTile(0, 1, 0x2);
            tsa.SetTile(0, 2, 0x2);
            tsa.SetTile(0, 3, 0x2);
            tsa.SetTile(0, 4, 0x2);
            tsa.SetTile(0, 5, 0x0); tsa.SetFlipV(0, 5, true);
            for (int i = 2; i <= length; i++)
            {
                tsa.SetTile(i, 5, 0x1);
                tsa.SetFlipV(i, 5, true);
            }
            tsa.SetTile(1, 5, 0x4);
            tsa.SetTile(2, 5, 0x4); tsa.SetFlipH(2, 5, true); tsa.SetFlipV(2, 5, false);
            tsa.SetTile(1, 6, 0x6); tsa.SetFlipH(1, 6, true);
            tsa.SetTile(2, 6, 0x5); tsa.SetFlipH(2, 6, true);
            tsa.SetTile(1 + length, 0, 0x0); tsa.SetFlipH(1 + length, 0, true);
            tsa.SetTile(1 + length, 1, 0x2); tsa.SetFlipH(1 + length, 1, true);
            tsa.SetTile(1 + length, 2, 0x2); tsa.SetFlipH(1 + length, 2, true);
            tsa.SetTile(1 + length, 3, 0x2); tsa.SetFlipH(1 + length, 3, true);
            tsa.SetTile(1 + length, 4, 0x2); tsa.SetFlipH(1 + length, 4, true);
            tsa.SetTile(1 + length, 5, 0x0); tsa.SetFlipH(1 + length, 5, true); tsa.SetFlipV(1 + length, 5, true);
            for (int y = 1; y <= 4; y++)
            {
                for (int x = 1; x <= length; x++)
                {
                    tsa.SetTile(x, y, 0x3);
                }
            }

            return(new TSA_Image(palette, tileset, tsa));
        }
예제 #2
0
        /// <summary>
        /// Makes the battle screen frame into a readible nicely formatted image
        /// </summary>
        public static TSA_Array GetReadibleTSA(TSA_Array tsa_array)
        {
            TSA_Array result = new TSA_Array(WIDTH, HEIGHT);

            tsa_array.Width = 15;
            // top left
            for (int y = 0; y < NAME_HEIGHT; y++)
            {
                for (int x = 0; x < 15; x++)
                {
                    result[1 + x, y] = tsa_array[x, y];
                }
            }
            // bottom left
            for (int y = 0; y < WEAPON_HEIGHT; y++)
            {
                for (int x = 0; x < 15; x++)
                {
                    result[1 + x, NAME_HEIGHT + y] = tsa_array[x, NAME_HEIGHT * 2 + y];
                }
            }
            // top right
            for (int y = 0; y < NAME_HEIGHT; y++)
            {
                for (int x = 0; x < 15; x++)
                {
                    result[HALFWIDTH + x, y] = tsa_array[x, NAME_HEIGHT + y];
                }
            }
            // bottom right
            tsa_array.Width = 16;
            for (int y = 0; y < WEAPON_HEIGHT; y++)
            {
                for (int x = 0; x < 2; x++)
                {
                    result[HALFWIDTH + x, NAME_HEIGHT + y] = tsa_array[14 + x, 17 + y];
                }
            }
            for (int y = 0; y < WEAPON_HEIGHT; y++)
            {
                for (int x = 0; x < 14; x++)
                {
                    result[HALFWIDTH + 2 + x, NAME_HEIGHT + y] = tsa_array[x, 18 + y];
                }
            }
            if (Core.CurrentROM is FE8)
            {
                for (int i = 0; i < WEAPON_HEIGHT; i++)
                {
                    result[0, NAME_HEIGHT + i] = result[WIDTH - 1, NAME_HEIGHT + i];
                    result.SetPalette(0, NAME_HEIGHT + i, 1);
                    result.SetFlipH(0, NAME_HEIGHT + i, true);
                }
            }
            else
            {
                int offset = 398;
                for (int i = 0; i < NAME_HEIGHT; i++)
                {
                    result[0, i]         = tsa_array.Tiles[offset + i * 2 + 1];
                    result[WIDTH - 1, i] = tsa_array.Tiles[offset + i * 2];
                }
                offset += (NAME_HEIGHT + 7) * 2;
                for (int i = 0; i < WEAPON_HEIGHT; i++)
                {
                    result[0, NAME_HEIGHT + i] = tsa_array.Tiles[offset + i * 2];
                    result.SetPalette(0, NAME_HEIGHT + i, 1);
                    result.SetFlipH(0, NAME_HEIGHT + i, false);
                }
            }
            return(result);
        }