Пример #1
0
        private void addGimmicksToMapList(String lgbGroupName, LgbGimmickEntry gim)
        {
            SgbFile thisFile = gim.Gimmick;

            LgbGimmickEntry.HeaderData hdr = gim.Header;
            foreach (var iGroup in thisFile.Data)
            {
                SgbGroup eGroup = iGroup as SgbGroup;
                foreach (var iEntry in eGroup.Entries)
                {
                    SgbModelEntry eEntry = iEntry as SgbModelEntry;
                    if (eEntry != null)
                    {
                        TransformedModel mdl = eEntry.Model;
                        TransformedModel newMdl;

                        Vector3 pos = new Vector3();
                        Vector3 rot = new Vector3();
                        //Scale is not added or multiplied

                        pos.X = mdl.Translation.X + hdr.Translation.X;
                        pos.Y = mdl.Translation.Y + hdr.Translation.Y;
                        pos.Z = mdl.Translation.Z + hdr.Translation.Z;
                        rot.X = mdl.Rotation.X + hdr.Rotation.X;
                        rot.Y = mdl.Rotation.Y + hdr.Rotation.Y;
                        rot.Z = mdl.Rotation.Z + hdr.Rotation.Z;

                        newMdl = new TransformedModel(mdl.Model, pos, rot, mdl.Scale);

                        addToMapList(lgbGroupName, newMdl);
                    }
                }
            }
        }
Пример #2
0
        void ExportSgbFile(String lgbGroup, SgbFile sgbFile, int depth, Vector3 translation, Vector3 rotation, Vector3 scale)
        {
            if (sgbFile == null)
            {
                return;
            }

            bool onec = false;

            addToFileList(sgbFile.File.Path);

            foreach (var sgbGroup in sgbFile.Data.OfType <SgbGroup>())
            {
                //Entry is model
                foreach (var mdl in sgbGroup.Entries.OfType <SgbModelEntry>())
                {
                    addToFileList(mdl.Model.Model.File.Path);

                    TransformedModel tMdl = mdl.Model;
                    TransformedModel newMdl;

                    Vector3 pos = new Vector3();
                    Vector3 rot = new Vector3();

                    pos.X = tMdl.Translation.X + translation.X;
                    pos.Y = tMdl.Translation.Y + translation.Y;
                    pos.Z = tMdl.Translation.Z + translation.Z;
                    rot.X = tMdl.Rotation.X + rotation.X;
                    rot.Y = tMdl.Rotation.Y + rotation.Y;
                    rot.Z = tMdl.Rotation.Z + rotation.Z;

                    newMdl = new TransformedModel(tMdl.Model, pos, rot, tMdl.Scale);

                    addToMapList(lgbGroup, newMdl);
                }

                //Entry is another Sgb
                foreach (var gimmickEntry in sgbGroup.Entries.OfType <SaintCoinach.Graphics.Sgb.SgbGimmickEntry>())
                {
                    addGimmickInfoToMapList(gimmickEntry, depth);
                    ExportSgbFile(lgbGroup, gimmickEntry.Gimmick, depth + 1, gimmickEntry.Header.Translation,
                                  gimmickEntry.Header.Rotation, gimmickEntry.Header.Scale);
                    addHeaderToMapList("GimmickEnd", depth);
                }

                //Entry is Sgb1C
                foreach (var sgb1c in sgbGroup.Entries.OfType <SgbGroup1CEntry>())
                {
                    if (!onec)
                    {
                        addHeaderToMapList("Gimmick1C", depth);
                        ExportSgbFile(lgbGroup, sgb1c.Gimmick, depth + 1, translation,
                                      rotation, scale);
                        addHeaderToMapList("GimmickEnd", depth);
                        onec = true;
                    }
                }
            }
        }
Пример #3
0
        //Adds gimmick info in the form of a header to the maplist, accepts LgbGimmicks
        private void addGimmickInfoToMapList(LgbGimmickEntry gim)
        {
            StringBuilder sb = new StringBuilder();

            Vector3 pos  = gim.Header.Translation;
            Vector3 rot  = gim.Header.Rotation;
            Vector3 scal = gim.Header.Scale;

            sb.AppendFormat("{0},{1},{2},", pos.X, pos.Y, pos.Z);
            sb.AppendFormat("{0},{1},{2},", rot.X, rot.Y, rot.Z);
            sb.AppendFormat("{0},{1},{2}", scal.X, scal.Y, scal.Z);

            addHeaderToMapList("Gimmick," + sb.ToString());
        }
Пример #4
0
        private void ExportSgbFileUHousing(String desiredHouseID, String lgbGroup, SgbFile sgbFile, int depth, Vector3 translation, Vector3 rotation, Vector3 scale)
        {
            if (sgbFile == null)
            {
                return;
            }

            String housingPattern  = @"bg/ffxiv/(est_e1|sea_s1|fst_f1|wil_w1)/hou/dyna/(.*?)/(0000)/asset/(e1h0|s1h0|f1h0|w1h0)_(.*?)(0000)(\w?).sgb";
            String housingPattern2 = @"bgcommon/hou/dyna/(e1h0|s1h0|f1h0|w1h0)/(.*?)/(0000)/asset/(e1h0|s1h0|f1h0|w1h0)_(.*?)(0000)(\w?).sgb";
            String housingPattern3 = @"bgcommon/hou/dyna/opt/(.*?)/(0000)/asset/opt_(.*?)(0000).sgb";

            //bool onec = false;

            foreach (var sgbGroup in sgbFile.Data.OfType <SgbGroup>())
            {
                //Entry is model
                foreach (var mdl in sgbGroup.Entries.OfType <SgbModelEntry>())
                {
                    addToFileList(mdl.Model.Model.File.Path);

                    TransformedModel tMdl = mdl.Model;
                    TransformedModel newMdl;

                    Vector3 pos = new Vector3();
                    Vector3 rot = new Vector3();

                    pos.X = tMdl.Translation.X + translation.X;
                    pos.Y = tMdl.Translation.Y + translation.Y;
                    pos.Z = tMdl.Translation.Z + translation.Z;
                    rot.X = tMdl.Rotation.X + rotation.X;
                    rot.Y = tMdl.Rotation.Y + rotation.Y;
                    rot.Z = tMdl.Rotation.Z + rotation.Z;

                    newMdl = new TransformedModel(tMdl.Model, pos, rot, tMdl.Scale);

                    addToMapList(lgbGroup, newMdl);
                }

                //Entry is another Sgb
                foreach (var gimmickEntry in sgbGroup.Entries.OfType <SgbGimmickEntry>())
                {
                    //Check against each pattern to turn it into the appropriate path
                    String gimmickFileName = gimmickEntry.Gimmick.File.Path;
                    addToFileList(gimmickFileName);
                    if (Regex.IsMatch(gimmickFileName, housingPattern))
                    {
                        String newGimmickPath = CreateUnitedHouseString(desiredHouseID,
                                                                        Regex.Match(gimmickFileName, housingPattern));
                        SgbFile newGim = null;
                        if (realm.Packs.FileExists(newGimmickPath))
                        {
                            newGim = new SgbFile(realm.Packs.GetFile(newGimmickPath));
                        }
                        if (newGim != null)
                        {
                            ExportSgbFile(lgbGroup, newGim, depth + 1, gimmickEntry.Header.Translation,
                                          gimmickEntry.Header.Rotation, gimmickEntry.Header.Scale);
                        }
                    }
                    else if (Regex.IsMatch(gimmickFileName, housingPattern2))
                    {
                        String newGimmickPath = CreateUnitedHouseString(desiredHouseID,
                                                                        Regex.Match(gimmickFileName, housingPattern2));
                        SgbFile newGim = null;
                        if (realm.Packs.FileExists(newGimmickPath))
                        {
                            newGim = new SgbFile(realm.Packs.GetFile(newGimmickPath));
                        }
                        if (newGim != null)
                        {
                            ExportSgbFile(lgbGroup, newGim, depth + 1, gimmickEntry.Header.Translation,
                                          gimmickEntry.Header.Rotation, gimmickEntry.Header.Scale);
                        }
                    }
                    else if (Regex.IsMatch(gimmickFileName, housingPattern3))
                    {
                        String newGimmickPath = CreateUnitedHouseString(desiredHouseID,
                                                                        Regex.Match(gimmickFileName, housingPattern3));
                        SgbFile newGim = null;
                        if (realm.Packs.FileExists(newGimmickPath))
                        {
                            newGim = new SgbFile(realm.Packs.GetFile(newGimmickPath));
                        }
                        if (newGim != null)
                        {
                            ExportSgbFile(lgbGroup, newGim, depth + 1, gimmickEntry.Header.Translation,
                                          gimmickEntry.Header.Rotation, gimmickEntry.Header.Scale);
                        }
                    }
                    else
                    {
                        addGimmickInfoToMapList(gimmickEntry, depth);
                        ExportSgbFileUHousing(desiredHouseID, lgbGroup, gimmickEntry.Gimmick, depth + 1, gimmickEntry.Header.Translation,
                                              gimmickEntry.Header.Rotation, gimmickEntry.Header.Scale);
                        addHeaderToMapList("GimmickEnd", depth);
                    }
                }

                //Entry is Sgb1C
//                foreach (var sgb1c in sgbGroup.Entries.OfType<SgbGroup1CEntry>())
//                {
//                    if (!onec)
//                    {
//                        addHeaderToMapList("Gimmick1C", depth);
//                        ExportSgbFile(lgbGroup, sgb1c.Gimmick, depth + 1, translation,
//                            rotation, scale);
//                        addHeaderToMapList("GimmickEnd", depth);
//                        onec = true;
//                    }
//                }
            }
        }