Example #1
0
        private void spawnDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <IChunkType> plyrChunks = _data.GetChunksOfType(DZSChunkTypes.PLYR);

            _plyrChunk = (PlyrChunk)plyrChunks[spawnDropdown.SelectedIndex];
            UpdateUIControlsFromFile();
        }
Example #2
0
        private void LoadDZSForStage(ZeldaArc stage)
        {
            int srcOffset = 0;

            _data = new DZSFormat(stage.DZRs[0].FileEntry.GetFileData(), ref srcOffset);

            List <IChunkType> plyrChunks = _data.GetChunksOfType(DZSChunkTypes.PLYR);

            if (plyrChunks == null)
            {
                return;
            }

            for (int i = 0; i < plyrChunks.Count; i++)
            {
                PlyrChunk plyrChunk = (PlyrChunk)plyrChunks[i];
                spawnDropdown.Items.Add("[" + i + "] - " + plyrChunk.Name);
            }

            spawnDropdown.SelectedIndex = 0;
            _plyrChunk = (PlyrChunk)plyrChunks[spawnDropdown.SelectedIndex];
            UpdateUIControlsFromFile();
        }
Example #3
0
        public override void Load(byte[] data)
        {
            int offset = 0;
            FileHeader header = new FileHeader();
            header.Load(data, ref offset);

            _chunkList = new Dictionary<Type, List<BaseChunk>>();

            var chnkHeaders = new List<ChunkHeader>();
            for (int i = 0; i < header.ChunkCount; i++)
            {
                ChunkHeader chunkHeader = new ChunkHeader();
                chunkHeader.Load(data, ref offset);
                chnkHeaders.Add(chunkHeader);
            }

            var orderedList = chnkHeaders.OrderBy(kvp => kvp.ChunkOffset);

            foreach (ChunkHeader chunkHeader in orderedList)
            {
                for (int k = 0; k < chunkHeader.ElementCount; k++)
                {
                    BaseChunk chunk; 

                    switch (chunkHeader.Tag.Substring(0, 3).ToUpper())
                    {
                        case "ENV": chunk = new EnvrChunk(); break; 
                        case "COL": chunk = new ColoChunk(); break;
                        case "PAL": chunk = new PaleChunk(); break;
                        case "VIR": chunk = new VirtChunk(); break;
                        case "SCL": chunk = new SclsChunk(); break;
                        case "PLY": chunk = new PlyrChunk(); break;
                        case "RPA": chunk = new RPATChunk(); break;
                        case "PAT": chunk = new PathChunk(); break;
                        case "RPP": chunk = new RppnChunk(); break;
                        case "PPN": chunk = new PpntChunk(); break;
                        case "SON": chunk = new SondChunk(); break;
                        case "FIL": chunk = new FiliChunk(); break;
                        case "MEC": chunk = new MecoChunk(); break;
                        case "MEM": chunk = new MemaChunk(); break;
                        case "TRE": chunk = new TresChunk(); break;
                        case "SHI": chunk = new ShipChunk(); break;
                        case "MUL": chunk = new MultChunk(); break;
                        case "LGH": chunk = new LghtChunk(); break;
                        case "LGT": chunk = new LgtvChunk(); break;
                        case "RAR": chunk = new RaroChunk(); break;
                        case "ARO": chunk = new ArobChunk(); break;
                        case "EVN": chunk = new EvntChunk(); break;
                        case "TGO": chunk = new TgobChunk(); break;
                        case "ACT": 
                            chunk = new ActrChunk();
                            if (!chunkHeader.Tag.ToUpper().EndsWith("R"))
                            {
                                chunk.ChunkLayer = EditorHelpers.ConvertStringToLayerId(chunkHeader.Tag.ToUpper().Substring(3, 1));
                            }
                            break;
                        case "SCO": 
                            chunk = new ScobChunk();
                            if (!chunkHeader.Tag.EndsWith("B"))
                            {
                                chunk.ChunkLayer = EditorHelpers.ConvertStringToLayerId(chunkHeader.Tag.ToUpper().Substring(3, 1));
                            }
                            break;
                        case "STA": chunk = new StagChunk(); break;
                        case "RCA": chunk = new RcamChunk(); break;
                        case "CAM": chunk = new CamrChunk(); break;
                        case "FLO": chunk = new FlorChunk(); break;
                        case "TWO": chunk = new TwoDChunk(); break;
                        case "2DM": chunk = new TwoDMAChunk(); break;
                        case "DMA": chunk = new DMAPChunk(); break;
                        case "LBN": chunk = new LbnkChunk(); break;
                        case "TGD": chunk = new TgdrChunk(); break;
                        case "RTB": chunk = new RTBLChunk(); break;
                        
                        default:
                            Console.WriteLine("Unsupported Chunk Tag: " + chunkHeader.Tag + " Chunk will not be saved!");
                            chunk = null;
                            break;
                    }

                    if(chunk == null)
                        continue;

                    //Console.WriteLine(chunkHeader.Tag + " offset: " + chunkHeader.ChunkOffset);
                    chunk.ChunkName = chunkHeader.Tag;
                    chunk.LoadData(data, ref chunkHeader.ChunkOffset);
                    AddChunk(chunk);
                }
            }

        }
Example #4
0
 private void spawnDropdown_SelectedIndexChanged(object sender, EventArgs e)
 {
     List<IChunkType> plyrChunks = _data.GetChunksOfType(DZSChunkTypes.PLYR);
     _plyrChunk = (PlyrChunk)plyrChunks[spawnDropdown.SelectedIndex];
     UpdateUIControlsFromFile();
 }
Example #5
0
        private void LoadDZSForStage(ZeldaArc stage)
        {
            int srcOffset = 0;
            _data = new DZSFormat(stage.DZRs[0].FileEntry.GetFileData(), ref srcOffset);

            List<IChunkType> plyrChunks = _data.GetChunksOfType(DZSChunkTypes.PLYR);
            if (plyrChunks == null)
                return;

            for (int i = 0; i < plyrChunks.Count; i++)
            {
                PlyrChunk plyrChunk = (PlyrChunk)plyrChunks[i];
                spawnDropdown.Items.Add("[" + i + "] - " + plyrChunk.Name);
            }

            spawnDropdown.SelectedIndex = 0;
            _plyrChunk = (PlyrChunk)plyrChunks[spawnDropdown.SelectedIndex];
            UpdateUIControlsFromFile();
        }