Exemple #1
0
        public MIM ReadMIMFile(MemoryStream stream)
        {
            MIM mim = new MIM();

            reader       = new BinaryReader(stream);
            mim.Clut     = ReadCLUT();
            mim.Textures = ReadTextures();
            reader.Close();
            return(mim);
        }
Exemple #2
0
        private void OpenDatFile()
        {
            MemoryStream fieldStream;
            FieldReader  fieldReader;
            MemoryStream mimStream;
            MIMReader    mimReader;

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DialogId  = 0;
                EntityId  = 0;
                ScriptId  = 0;
                AkaoId    = 0;
                PaletteId = 0;
                string fieldFilename = openFileDialog1.FileName;
                string mimFileName   = Path.Combine(Path.GetDirectoryName(fieldFilename), Path.GetFileNameWithoutExtension(fieldFilename) + ".MIM");
                fieldStream            = LZS.unLZS(fieldFilename);
                fieldReader            = new FieldReader();
                field                  = fieldReader.ReadFieldFile(fieldStream);
                this.txtName.Text      = field.Script.Name;
                this.txtCreator.Text   = field.Script.Creator;
                this.lblNbDialogs.Text = "/" + field.Script.NbDialogs.ToString();
                this.lblNbAKAO.Text    = "/" + field.Script.NbAkaoOffsets.ToString();
                this.lstEntities.Items.Clear();
                for (int i = 0; i < field.Script.NbEntities; i++)
                {
                    this.lstEntities.Items.Add(field.Script.Entities[i]);
                }
                this.txtDescription.Text = "";
                RefreshDialog();
                RefreshAKAO();
                RefreshWalkmesh();
                if (field.Script.NbEntities > 0)
                {
                    this.lstEntities.SelectedItem = this.lstEntities.Items[0];
                    RefreshScript();
                }
                else
                {
                    btnPrevScript.Enabled = false;
                    btnNextScript.Enabled = false;
                }
                if (File.Exists(mimFileName))
                {
                    mimStream = LZS.unLZS(mimFileName);
                    mimReader = new MIMReader();
                    mim       = mimReader.ReadMIMFile(mimStream);
                    RefreshMIMTexture();
                    RefreshTileMap();
                }
            }
        }