Esempio n. 1
0
        public void Process(ResourceID id)
        {
            reader = Burntime.Platform.IO.FileSystem.GetFile(id.File).GetSubFile(0, -1);

            charInfo = new Dictionary <char, CharInfo>();

            chars = new CharInfo[98];
            for (int i = 0; i < 98; i++)
            {
                chars[i].pos   = reader.ReadUShort();
                chars[i].width = reader.ReadUShort();

                charInfo.Add((char)(' ' + i), chars[i]);
            }

            for (int i = 0; i < 98; i++)
            {
                reader.Seek(chars[i].pos, Burntime.Platform.IO.SeekPosition.Begin);

                int unknown1 = reader.ReadUShort();
                int unknown2 = reader.ReadUShort();

                chars[i].imgWidth  = 4 * (unknown1 + 1);
                chars[i].imgHeight = unknown2;
            }
        }
Esempio n. 2
0
        int DrawChar(ByteBuffer input, char ch, int offsetx, int offsety, PixelColor fore, PixelColor back)
        {
            CharInfo info = chars[translateChar(ch)];

            reader.Seek(info.pos, Burntime.Platform.IO.SeekPosition.Begin);

            int w     = 1;
            int h     = 8;
            int round = 0;
            int pos   = 0;

            int unknown1 = reader.ReadUShort();
            int unknown2 = reader.ReadUShort();

            w = 4 * (unknown1 + 1);
            h = unknown2;

            while (!reader.IsEOF && round != 4)
            {
                int data = reader.ReadByte();

                PixelColor c;
                if (back != PixelColor.Black)
                {
                    c = (data == 0x01) ? back : fore;
                }
                else
                {
                    c = (data == 0x01) ? PixelColor.Black : PixelColor.White;
                }

                int x = pos % w;
                int y = (pos - x) / w;

                if (data != 0)
                {
                    input.DrawPixel(x + offsetx, y + offsety, c.r, c.g, c.b);
                }

                pos += 4;
                if (pos >= w * h)
                {
                    pos -= w * h;
                    pos++;
                    round++;
                }
            }

            return(info.width);
        }
Esempio n. 3
0
        public bool Export(String File)
        {
            Burntime.Platform.IO.File file = new Burntime.Platform.IO.File(new FileStream(File, FileMode.Open, FileAccess.ReadWrite));
            Burntime.Data.BurnGfx.Map map  = new Burntime.Data.BurnGfx.Map(file);

            map.width  = Size.Width;
            map.height = Size.Height;
            // check size
            map.data = new ushort[Size.Width * Size.Height];

            for (int y = 0; y < Size.Height; y++)
            {
                for (int x = 0; x < Size.Width; x++)
                {
                    map.data[x + y * Size.Width] = (ushort)(tiles[x, y].SubSet + (((ushort)tiles[x, y].ID) << 8));
                }
            }

            // check door count
            if (map.Doors.Count != entrances.Count)
            {
                MessageBox.Show("Entrance count must be the same as the original.", "Export", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            for (int i = 0; i < map.Doors.Count; i++)
            {
                map.Doors[i].Area = new Burntime.Platform.Rect(entrances[i].Rect.Left, entrances[i].Rect.Top, entrances[i].Rect.Width, entrances[i].Rect.Height);
            }

            file.Seek(0, Burntime.Platform.IO.SeekPosition.Begin);
            map.SaveToRaw(file);

            file.Flush();
            file.Close();

            return(true);
        }