Пример #1
0
 public void Add(lwModelObjInfo model, string filename)
 {
     models.Add(model);
     modelsoriginpath.Add(filename);
 }
Пример #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            foreach (object obj in listBoxExport.SelectedItems)
            {
                ExportGroup group    = new ExportGroup();
                string      listItem = (string)obj;

                int indexstart = listItem.LastIndexOf('[');
                int indexend   = listItem.LastIndexOf(']');

                string indexstring = listItem.Substring(indexstart + 1, indexend - indexstart - 1);
                int    index       = int.Parse(indexstring);

                if (listItem.StartsWith("[lgo]"))
                {
                    string filename = parentForm.lgofiles[index];

                    lwGeomObjInfo geom = new lwGeomObjInfo();
                    if (geom.Load(filename) == 0)
                    {
                        group.Add(geom, filename);
                    }
                }
                if (listItem.StartsWith("[lmo]"))
                {
                    string filename = parentForm.lmofiles[index];

                    lwModelObjInfo model = new lwModelObjInfo();
                    if (model.Load(filename) == 0)
                    {
                        group.Add(model, filename);
                    }
                }
                if (listItem.StartsWith("[char]"))
                {
                    CChaRecord character = parentForm.chainfo[index];

                    for (int i = 0; i < 5; i++)
                    {
                        if (character.sSkinInfo[i] != 0)
                        {
                            if (character.chModalType == 1)
                            {
                                CItemRecord rec = parentForm.iteminfo[parentForm.iteminfokeys[character.sSkinInfo[i]]];

                                char[] mdl = new char[19];
                                Array.Copy(rec.chModule, (character.sModel + 1) * 19, mdl, 0, 19);

                                lwGeomObjInfo geom          = new lwGeomObjInfo();
                                string        filenameModel = parentForm.textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                {
                                    group.Add(geom, filenameModel);
                                }
                            }
                            if (character.chModalType == 2)
                            {
                                CItemRecord rec = parentForm.iteminfo[parentForm.iteminfokeys[character.sSkinInfo[i]]];

                                char[] mdl = new char[19];
                                Array.Copy(rec.chModule, 0, mdl, 0, 19);

                                lwGeomObjInfo geom          = new lwGeomObjInfo();
                                string        filenameModel = parentForm.textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                {
                                    group.Add(geom, filenameModel);
                                }
                            }
                            if (character.chModalType == 4)
                            {
                                lwGeomObjInfo geom          = new lwGeomObjInfo();
                                string        filenameModel = parentForm.textBox1.Text + "model\\character\\" + (i + 10000 * (character.sSuitID + 100 * character.sModel)).ToString("0000000000") + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                {
                                    group.Add(geom, filenameModel);
                                }
                            }
                        }
                    }
                }
                if (listItem.StartsWith("[item]"))
                {
                    CItemRecord item = parentForm.iteminfo[index];

                    for (int i = 0; i < 5; i++)
                    {
                        char[] mdl = new char[19];
                        Array.Copy(item.chModule, i * 19, mdl, 0, 19);
                        lwGeomObjInfo geom          = new lwGeomObjInfo();
                        string        filenameModel = parentForm.textBox1.Text + "model\\item\\" + CutString(mdl) + ".lgo";
                        if (item.sType >= 19 && item.sType <= 25)
                        {
                            filenameModel = parentForm.textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";
                        }

                        if (geom.Load(filenameModel) == 0)
                        {
                            group.Add(geom, filenameModel);
                        }
                    }
                }

                Export(group);
            }

            button4_Click(sender, e);
        }
Пример #3
0
 public void Add(lwModelObjInfo model, string filename)
 {
     models.Add(model);
     modelsoriginpath.Add(filename);
 }
Пример #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            foreach (object obj in listBoxExport.SelectedItems)
            {
                ExportGroup group = new ExportGroup();
                string listItem = (string)obj;

                int indexstart = listItem.LastIndexOf('[');
                int indexend = listItem.LastIndexOf(']');

                string indexstring = listItem.Substring(indexstart + 1, indexend - indexstart - 1);
                int index = int.Parse(indexstring);

                if (listItem.StartsWith("[lgo]"))
                {
                    string filename = parentForm.lgofiles[index];

                    lwGeomObjInfo geom = new lwGeomObjInfo();
                    if (geom.Load(filename) == 0)
                        group.Add(geom, filename);
                }
                if (listItem.StartsWith("[lmo]"))
                {
                    string filename = parentForm.lmofiles[index];

                    lwModelObjInfo model = new lwModelObjInfo();
                    if (model.Load(filename) == 0)
                        group.Add(model, filename);
                }
                if (listItem.StartsWith("[char]"))
                {
                    CChaRecord character = parentForm.chainfo[index];

                    for (int i = 0; i < 5; i++)
                    {
                        if (character.sSkinInfo[i] != 0)
                        {
                            if (character.chModalType == 1)
                            {
                                CItemRecord rec = parentForm.iteminfo[parentForm.iteminfokeys[character.sSkinInfo[i]]];

                                char[] mdl = new char[19];
                                Array.Copy(rec.chModule, (character.sModel + 1) * 19, mdl, 0, 19);

                                lwGeomObjInfo geom = new lwGeomObjInfo();
                                string filenameModel = parentForm.textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                    group.Add(geom, filenameModel);
                            }
                            if (character.chModalType == 2)
                            {
                                CItemRecord rec = parentForm.iteminfo[parentForm.iteminfokeys[character.sSkinInfo[i]]];

                                char[] mdl = new char[19];
                                Array.Copy(rec.chModule, 0, mdl, 0, 19);

                                lwGeomObjInfo geom = new lwGeomObjInfo();
                                string filenameModel = parentForm.textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                    group.Add(geom, filenameModel);
                            }
                            if (character.chModalType == 4)
                            {
                                lwGeomObjInfo geom = new lwGeomObjInfo();
                                string filenameModel = parentForm.textBox1.Text + "model\\character\\" + (i + 10000 * (character.sSuitID + 100 * character.sModel)).ToString("0000000000") + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                    group.Add(geom, filenameModel);
                            }
                        }
                    }
                }
                if (listItem.StartsWith("[item]"))
                {
                    CItemRecord item = parentForm.iteminfo[index];

                    for (int i = 0; i < 5; i++)
                    {
                        char[] mdl = new char[19];
                        Array.Copy(item.chModule, i * 19, mdl, 0, 19);
                        lwGeomObjInfo geom = new lwGeomObjInfo();
                        string filenameModel = parentForm.textBox1.Text + "model\\item\\" + CutString(mdl) + ".lgo";
                        if (item.sType >= 19 && item.sType <= 25) filenameModel = parentForm.textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";

                        if (geom.Load(filenameModel) == 0)
                            group.Add(geom, filenameModel);
                    }
                }

                Export(group);
            }

            button4_Click(sender, e);
        }
Пример #5
0
        private void treeOfFiles_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Level == 1)
            {
                string name = e.Node.Text;
                int index = e.Node.Index;
                int parentindex = e.Node.Parent.Index;
                pictureBox1.Visible = false;

                #region lab loading
                if (parentindex == 0)
                {
                    lwAnimDataBone bone = new lwAnimDataBone();
                    if (bone.Load(labfiles[index]) != 0) { bone = null; return; }

                    drawNum = 1;
                    drawObject[0] = bone;
                    drawObjectType[0] = DrawObjectType.lab;

                    glControl1.Refresh();

                    string info = labfiles[index] + "\n";
                    info += "\nbones: " + bone._header.bone_num;
                    info += "\nframes: " + bone._header.frame_num;
                    info += "\ndummys: " + bone._header.dummy_num;
                    info += "\nkey type: " + bone._header.key_type;

                    for (int i = 0; i < bone._header.bone_num; i++)
                    {
                        string bonename = new string(bone._base_seq[i].name);
                        if (bonename.IndexOf('\0') > 0)
                        {
                            bonename = bonename.Substring(0, bonename.IndexOf('\0'));
                            info += "\n bone " + bonename + " [" + bone._base_seq[i].id + " - " + bone._base_seq[i].parent_id + "]";
                        }
                    }
                    for (int i = 0; i < bone._header.dummy_num; i++)
                        info += "\n dummy " + bone._dummy_seq[i].id + " [" + bone._dummy_seq[i].parent_bone_id + "]";

                    richTextBox1.Text = info;
                    EnableAnimation((int)bone._header.frame_num);
                }
                #endregion

                #region lgo loading
                else if (parentindex == 1)
                {
                    totaltextures = 0;
                    lwGeomObjInfo geom = new lwGeomObjInfo();
                    if (geom.Load(lgofiles[index]) != 0) { geom = null; return; }

                    drawNum = 1;
                    drawObject[0] = geom;
                    drawObjectType[0] = DrawObjectType.lgo;

                    DisableAnimation();
                    DeleteAllTextures();
                    LoadTexturesToGeom(ref geom, lgofiles[index]);

                    if (geom.anim_data != null)
                    {
                        if (geom.anim_data.anim_bone != null)
                            EnableAnimation((int)geom.anim_data.anim_bone._header.frame_num);
                        if(geom.anim_data.anim_mat!=null)
                            EnableAnimation((int)geom.anim_data.anim_mat._frame_num);
                    }

                    string info = lgofiles[index] + "\n";
                    info += "\nmaterials:" + geom.mtl_num;
                    for (int i = 0; i < geom.mtl_num; i++)
                    {
                        info += "\n    mtl" + i + " textures:" + geom.mtl_seq[i].tex_seq.Length;
                        for (int j = 0; j < geom.mtl_seq[i].tex_seq.Length; j++)
                        {
                            if (geom.mtl_seq[i].tex_seq[j] != null && geom.mtl_seq[i].tex_seq[j].file_name != null)
                            {
                                int length = 0;
                                while (geom.mtl_seq[i].tex_seq[j].file_name[length] != '\0' && length < geom.mtl_seq[i].tex_seq[j].file_name.Length) length++;
                                string filename = new string(geom.mtl_seq[i].tex_seq[j].file_name, 0, length);
                                info += "\n        " + j + ":" + filename;
                            }
                        }
                    }
                    info += "\nmesh vertex num:" + geom.mesh.header.vertex_num;
                    info += "\nmesh index num:" + geom.mesh.header.index_num;

                    richTextBox1.Text = info;

                    glControl1.Refresh();
                }
                #endregion

                #region lmo loading
                else if (parentindex == 2)
                {
                    totaltextures = 0;
                    lwModelObjInfo model = new lwModelObjInfo();
                    if (model.Load(lmofiles[index]) != 0) { model = null; return; }

                    drawNum = 1;
                    drawObject[0] = model;
                    drawObjectType[0] = DrawObjectType.lmo;

                    string info = lmofiles[index] + "\n";
                    info += "\nmodels: " + model.geom_obj_num;

                    DisableAnimation();
                    DeleteAllTextures();

                    for (int q = 0; q < model.geom_obj_num; q++)
                    {
                        lwGeomObjInfo geom = model.geom_obj_seq[q];
                        LoadTexturesToGeom(ref model.geom_obj_seq[q], lmofiles[index]);
                        if (geom.anim_data != null)
                        {
                            if (geom.anim_data.anim_bone != null)
                                EnableAnimation((int)geom.anim_data.anim_bone._header.frame_num);
                            if (geom.anim_data.anim_mat != null)
                                EnableAnimation((int)geom.anim_data.anim_mat._frame_num);
                        }

                        info += "\n\n---model #" + q;
                        info += "\nmaterials:" + geom.mtl_num;
                        for (int i = 0; i < geom.mtl_num; i++)
                        {
                            info += "\n    mtl" + i + " textures:" + geom.mtl_seq[i].tex_seq.Length;
                            for (int j = 0; j < geom.mtl_seq[i].tex_seq.Length; j++)
                            {
                                if (geom.mtl_seq[i].tex_seq[j] != null && geom.mtl_seq[i].tex_seq[j].file_name != null)
                                {
                                    string filename = CutString(geom.mtl_seq[i].tex_seq[j].file_name);
                                    info += "\n        " + j + ":" + filename;
                                }
                            }
                        }
                        info += "\nmesh vertex num:" + geom.mesh.header.vertex_num;
                        info += "\nmesh index num:" + geom.mesh.header.index_num;
                    }

                    richTextBox1.Text = info;

                    glControl1.Refresh();
                }
                #endregion

                #region lxo loading
                else if (parentindex == 3)
                {
                    lwModelInfo modelinfo = new lwModelInfo();
                    modelinfo.Load(lxofiles[index]);
                    if (modelinfo.Load(name) != 0) { modelinfo = null; return; }

                    drawNum = 1;
                    drawObject[0] = modelinfo;
                    drawObjectType[0] = DrawObjectType.lxo;

                    DisableAnimation();
                    glControl1.Refresh();

                    richTextBox1.Text = "Not active in this version";
                }
                #endregion

                #region character loading
                else if (parentindex == 4)
                {
                    CChaRecord character = chainfo[index];
                    drawNum = 0;

                    DisableAnimation();

                    string info = CutString(character.szDataName) + "\n";
                    info += "\nheight " + character.fHeight + "\n";
                    info += "width " + character.fWidth + "\n";
                    info += "length " + character.fLengh + "\n\n";
                    info += "items (";
                    for (int i = 0; i < character.lItem.Length; i++)
                    {
                        if (i != 0) info += ",";
                        info += character.lItem[i];
                    }
                    info += ")\n\n";
                    info += "script " + character.lScript + "\n";
                    info += "ID " + character.nID + "\n";
                    info += "index " + character.nIndex + "\n";
                    info += "actionId " + character.sActionID + "\n";
                    info += "bornEffect " + character.sBornEff + "\n";
                    info += "dieEffect " + character.sDieEff + "\n";
                    info += "effectId " + character.sEeffID + "\n";
                    info += "effectActionId (";
                    for (int i = 0; i < character.sEffectActionID.Length; i++)
                    {
                        if (i != 0) info += ",";
                        info += character.sEffectActionID[i];
                    }
                    info += ")\nmodel " + character.sModel + "\n";
                    info += "scinInfo (";
                    for (int i = 0; i < character.sSkinInfo.Length; i++)
                    {
                        if (i != 0) info += ",";
                        info += character.sSkinInfo[i];
                    }
                    info += ")\nsuitId " + character.sSuitID + "\n";
                    info += "modalType " + (byte)character.chModalType + "\n";
                    info += "suitNum " + character.sSuitNum + "\n\n";
                    info += "guild: " + CutString(character.szGuild) + "\n";
                    info += "iconName: " + CutString(character.szIconName) + "\n";
                    info += "job: " + CutString(character.szJob) + "\n";
                    info += "name: " + CutString(character.szName) + "\n";
                    info += "title: " + CutString(character.szTitle) + "\n";

                    trackBar1.Enabled = false;
                    numericUpDown1.Enabled = false;
                    button1.Enabled = false;
                    enableAnimation = false;
                    pictureBox1.Visible = false;

                    if (character.chModalType == 1)
                    {
                        lwAnimDataBone bone = new lwAnimDataBone();
                        if (bone.Load(textBox1.Text + "animation\\" + character.sModel.ToString("0000") + ".lab") == 0)
                        {
                            drawObject[drawNum] = bone;
                            drawObjectType[drawNum] = DrawObjectType.lab;
                            drawNum++;

                            EnableAnimation((int)bone._header.frame_num);
                        }

                        info += "\nanimation: " + character.sModel.ToString("0000") + ".lab\n";

                        foreach (uint tex in textures)
                            GL.DeleteTexture(tex);
                        totaltextures = 0;

                        for (int i = 0; i < 5; i++)
                        {
                            if (character.sSkinInfo[i] != 0)
                            {
                                CItemRecord rec = iteminfo[iteminfokeys[character.sSkinInfo[i]]];

                                char[] mdl = new char[19];
                                Array.Copy(rec.chModule, (character.sModel + 1) * 19, mdl, 0, 19);

                                lwGeomObjInfo geom = new lwGeomObjInfo();
                                string filenameModel = textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                {
                                    LoadTexturesToGeom(ref geom, filenameModel);
                                    drawObject[drawNum] = geom;
                                    drawObjectType[drawNum] = DrawObjectType.lgo;
                                    drawNum++;
                                }

                                info += "model: " + CutString(mdl) + ".lgo\n";
                            }
                        }
                    }
                    if (character.chModalType == 2)
                    {
                        info += "\nanimation: ?? \n";

                        for (int i = 0; i < 5; i++)
                        {
                            if (character.sSkinInfo[i] != 0)
                            {
                                CItemRecord rec = iteminfo[iteminfokeys[character.sSkinInfo[i]]];

                                char[] mdl = new char[19];
                                Array.Copy(rec.chModule, 0, mdl, 0, 19);

                                lwGeomObjInfo geom = new lwGeomObjInfo();
                                string filenameModel = textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                {
                                    if (geom.anim_data != null && geom.anim_data.anim_mat != null)
                                    {
                                        EnableAnimation((int)geom.anim_data.anim_mat._frame_num);
                                    }
                                    LoadTexturesToGeom(ref geom, filenameModel);
                                    drawObject[drawNum] = geom;
                                    drawObjectType[drawNum] = DrawObjectType.ship;
                                    drawNum++;
                                }

                                info += "model: " + CutString(mdl) + ".lgo\n";
                            }
                        }
                    }
                    if (character.chModalType == 4)
                    {
                        lwAnimDataBone bone = new lwAnimDataBone();
                        if (bone.Load(textBox1.Text + "animation\\" + character.sModel.ToString("0000") + ".lab") == 0)
                        {
                            drawObject[drawNum] = bone;
                            drawObjectType[drawNum] = DrawObjectType.lab;
                            drawNum++;

                            EnableAnimation((int)bone._header.frame_num);
                        }

                        info += "\nanimation: " + character.sModel.ToString("0000") + ".lab\n";

                        foreach (uint tex in textures)
                            GL.DeleteTexture(tex);
                        totaltextures = 0;

                        for (int i = 0; i < 5; i++)
                        {
                            if (character.sSkinInfo[i] != 0)
                            {
                                lwGeomObjInfo geom = new lwGeomObjInfo();
                                string filenameModel = textBox1.Text + "model\\character\\" + (i + 10000 * (character.sSuitID + 100 * character.sModel)).ToString("0000000000") + ".lgo";
                                if (geom.Load(filenameModel) == 0)
                                {
                                    LoadTexturesToGeom(ref geom, filenameModel);
                                    drawObject[drawNum] = geom;
                                    drawObjectType[drawNum] = DrawObjectType.lgo;
                                    drawNum++;
                                }

                                info += "model: " + (i + 10000 * (character.sSuitID + 100 * character.sModel)).ToString("0000000000") + ".lgo\n";
                            }
                        }
                    }

                    richTextBox1.Text = info;

                    glControl1.Refresh();
                }
                #endregion

                #region items loading
                if (parentindex == 5)
                {
                    CItemRecord item = iteminfo[index];
                    drawNum = 0;
                    DeleteAllTextures();
                    //drawObject[0] = item;
                    //drawObjectType[0] = DrawObjectType.item;

                    string info = CutString(item.szDataName) + "\n\n";
                    //info += "able link: " + CutString(item.szAbleLink) + "\n";
                    info += "attr effect: " + CutString(item.szAttrEffect) + "\n";
                    info += "descriptor: " + CutString(item.szDescriptor) + "\n";
                    info += "icon: " + CutString(item.szICON) + "\n";
                    info += "name: " + CutString(item.szName) + "\n\n";
                    info += "id: " + item.lID + "\n";
                    info += "modules: \n";
                    for (int i = 0; i < 5; i++)
                    {
                        char[] mdl = new char[19];
                        Array.Copy(item.chModule, i * 19, mdl, 0, 19);
                        if (i == 0) info += "on drop:    " + CutString(mdl) + "\n";
                        else if (i == 1) info += "on Lance:   " + CutString(mdl) + "\n";
                        else if (i == 2) info += "on Carsise: " + CutString(mdl) + "\n";
                        else if (i == 3) info += "on Phyllis: " + CutString(mdl) + "\n";
                        else if (i == 4) info += "on Ami:     " + CutString(mdl) + "\n";

                        lwGeomObjInfo geom = new lwGeomObjInfo();
                        string filenameModel = textBox1.Text + "model\\item\\" + CutString(mdl) + ".lgo";
                        if (item.sType >= 19 && item.sType <= 25) filenameModel = textBox1.Text + "model\\character\\" + CutString(mdl) + ".lgo";

                        if (geom.Load(filenameModel) == 0)
                        {
                            LoadTexturesToGeom(ref geom, filenameModel);
                            drawObject[drawNum] = geom;
                            drawObjectType[drawNum] = DrawObjectType.item;
                            drawNum++;
                        }
                    }

                    info += "\nforge lvl: " + (byte)item.chForgeLv + "\n";
                    info += "forge ready: " + (byte)item.chForgeSteady + "\n";
                    info += "instance: " + (byte)item.chInstance + "\n";
                    info += "pick to: " + (byte)item.chPickTo + "\n";
                    info += "price: " + item.lPrice + "\n";
                    info += "index: " + item.nIndex + "\n";
                    info += "l hand value: " + item.sLHandValu + "\n";
                    info += "need lvl: " + item.sNeedLv + "\n";
                    info += "type: " + (EItemType)item.sType + "\n";

                    Bitmap bmp = LoadBitmaByTextureName(textBox1.Text + "texture\\icon\\" + CutString(item.szICON) + ".bmp");
                    pictureBox1.Image = bmp;
                    pictureBox1.Visible = true;

                    DisableAnimation();
                    glControl1.Refresh();

                    richTextBox1.Text = info;
                }
                #endregion
            }
        }