Beispiel #1
0
        private void MakeVoxPaletteMapping(ShapeDataFile shapeData, int panel, int shape, Dictionary <byte, byte> paletteMapping)
        {
            string voxFullName = string.Format(@"D:\Temp\FDII\Shapes\Shape_{0}_{1}.vox", panel, shape);

            byte[,] targetmatrix = new byte[24, 24];
            using (FileStream streamData = new FileStream(voxFullName, FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader reader = new BinaryReader(streamData))
                {
                    reader.Skip(0x3C);
                    for (byte y = 0; y < 24; y++)
                    {
                        for (byte x = 0; x < 24; x++)
                        {
                            byte xx = reader.ReadByte();
                            byte yy = reader.ReadByte();
                            reader.ReadByte();

                            byte cIndex = reader.ReadByte();
                            targetmatrix[xx, yy] = cIndex;
                        }
                    }
                }
            }

            // Reading Palette
            FDImage image = shapeData.GetPanel(panel).Shapes[shape].Image;

            for (byte y = 0; y < 24; y++)
            {
                for (byte x = 0; x < 24; x++)
                {
                    byte color  = image.GetPixelColorIndex(x, y);
                    byte target = targetmatrix[x, 23 - y];

                    if (paletteMapping.ContainsKey(color) && paletteMapping[color] != target)
                    {
                        // Something wrong here
                        int error = 1;
                    }

                    paletteMapping[color] = target;
                }
            }
        }
Beispiel #2
0
        private void ExportDatoData()
        {
            // Reading Palette
            FDPalette palette = new FDPalette(@".\color");

            DatoDataFile datoData = new DatoDataFile(@".\DATO.DAT");

            datoData.LoadData();

            for (int index = 0; index < datoData.DatoImages.Count; index++)
            {
                for (int f = 0; f < 4; f++)
                {
                    FDImage           image    = datoData.DatoImages[index][f];
                    ImageDataExporter exporter = new ImageDataExporter(image.GenerateBitmap(palette));
                    exporter.ExportToPng(string.Format(@"D:\Temp\FDII\Dato_{0}_{1}.png", index, f));
                }
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="image"></param>
        /// <param name="voxFullName"></param>
        /// <param name="palette"></param>
        private void GenerateShapeVoxFile(FDImage image, string voxFullName,
                                          byte[] header, byte[] footer, Dictionary <byte, byte> paletteMapping)
        {
            using (FileStream streamData = new FileStream(voxFullName, FileMode.OpenOrCreate, FileAccess.Write))
            {
                using (BinaryWriter writer = new BinaryWriter(streamData, Encoding.UTF8))
                {
                    writer.Write(header);
                    writer.Write('X');
                    writer.Write('Y');
                    writer.Write('Z');
                    writer.Write('I');
                    writer.Write((Int64)0x904);
                    writer.Write((int)0x240);

                    for (byte y = 0; y < 24; y++)
                    {
                        for (byte x = 0; x < 24; x++)
                        {
                            byte convertedX = x;
                            byte convertedY = (byte)(23 - y);
                            byte cIndex     = image.GetPixelColorIndex(convertedX, convertedY);
                            writer.Write(x);
                            writer.Write(y);
                            writer.Write((byte)23);
                            if (paletteMapping.ContainsKey(cIndex))
                            {
                                writer.Write(paletteMapping[cIndex]);
                            }
                            else
                            {
                                writer.Write(cIndex);
                            }
                        }
                    }

                    writer.Write(footer);
                }
            }
        }
Beispiel #4
0
        public static void Initialize(IMainForm mainForm)
        {
            Icons.mainForm = mainForm;

            imageList                  = new ImageList();
            imageList.ColorDepth       = ColorDepth.Depth32Bit;
            imageList.ImageSize        = new Size(16, 16);
            imageList.TransparentColor = Color.Transparent;

            XmlFile             = Get("Icons.XmlFile.png");
            HiddenFolder        = Get("Icons.HiddenFolder.png");
            HiddenFile          = Get(156);
            Project             = Get(110);
            Classpath           = Get(27);
            Font                = Get(97);
            ImageResource       = Get("Icons.ImageResource.png");
            ActionScript        = Get("Icons.ActionscriptFile.png");
            SwfFile             = Get("Icons.SwfMovie.png");
            SwfFileHidden       = Get("Icons.SwfMovieHidden.png");
            Folder              = Get("Icons.Folder.png"); //Get(84);
            FolderCompile       = Get("Icons.FolderCompile.png");
            TextFile            = Get("Icons.TextFile.png");
            ActionScriptCompile = Get("Icons.ActionscriptCompile.png");
            HtmlFile            = Get("Icons.HtmlFile.png");
            AddFile             = Get("Icons.AddFile.png");
            OpenFile            = Get(1);
            EditFile            = Get(7);
            Cut        = Get(3);
            Copy       = Get(4);
            Paste      = Get(5);
            Delete     = Get(29);
            Options    = Get(132);
            NewProject = Get(111);
            GreenCheck = Get(21);
            Gear       = Get(66);
            Class      = Get("Icons.Class.png");
            Refresh    = Get(10);
            Debug      = Get(51);
        }
Beispiel #5
0
		public static void Initialize(IMainForm mainForm)
		{
			Icons.mainForm = mainForm;

			imageList = new ImageList();
			imageList.ColorDepth = ColorDepth.Depth32Bit;
			imageList.ImageSize = new Size(16, 16);
			imageList.TransparentColor = Color.Transparent;

			XmlFile = Get("Icons.XmlFile.png");
			HiddenFolder = Get("Icons.HiddenFolder.png");
			HiddenFile = Get(156);
			Project = Get(110);
			Classpath = Get(27);
			Font = Get(97);
			ImageResource = Get("Icons.ImageResource.png");
			ActionScript = Get("Icons.ActionscriptFile.png");
			SwfFile = Get("Icons.SwfMovie.png");
			SwfFileHidden = Get("Icons.SwfMovieHidden.png");
			Folder = Get("Icons.Folder.png"); //Get(84);
			FolderCompile = Get("Icons.FolderCompile.png");
			TextFile = Get("Icons.TextFile.png");
			ActionScriptCompile = Get("Icons.ActionscriptCompile.png");
			HtmlFile = Get("Icons.HtmlFile.png");
			AddFile = Get("Icons.AddFile.png");
			OpenFile = Get(1);
			EditFile = Get(7);
			Cut = Get(3);
			Copy = Get(4);
			Paste = Get(5);
			Delete = Get(29);
			Options = Get(132);
			NewProject = Get(111);
			GreenCheck = Get(21);
			Gear = Get(66);
			Class = Get("Icons.Class.png");
			Refresh = Get(10);
			Debug = Get(51);
		}