예제 #1
0
        public static TES5.Group convert(string file)
        {
            TES3.ESM.open(file);
            TES5.Group cell_grup = new TES5.Group("CELL");

            while (TES3.ESM.find("CELL"))
            {
                TES3.CELL cell3 = new TES3.CELL();
                cell3.read();

                if (!cell3.interior)
                {
                    continue;
                }

                if (cell3.references.Count == 0)
                {
                    continue;
                }


                Log.info(cell3.cell_name);

                TES5.CELL cell5 = new TES5.CELL(cell3.cell_name);

                cell5.editor_id = cell3.cell_name;
                cell5.full_name = cell3.cell_name;

                cell5.Interior = true;
                if (cell3.HasWater)
                {
                    // Calculate cell bounds
                    foreach (TES3.REFR mw_ref in cell3.references)
                    {
                        cell5.update_bounds(mw_ref.x, mw_ref.y);
                    }
                    // add water planes
                    cell5.addWater(cell3.water_height);
                }

                cell5.add_ambient_light(LGTM.get(CellTYPE.getInstance().get_class(cell3.cell_name)));

                cell5.addToGroup(cell_grup);
                cell5.pack();
            }

            TES3.ESM.close();
            return(cell_grup);
        }
예제 #2
0
        public static void doit()
        {
            TES3.ESM.open(Config.Paths.mw_esm);
            TES5.Group cell_grup = new TES5.Group("CELL");

            while (TES3.ESM.find("CELL"))
            {
                TES3.CELL morrowind_cell = new TES3.CELL();
                morrowind_cell.read();

                //Utility.Log.info(morrowind_cell.cell_name);
                foreach (TES3.REFR morrowind_reference in morrowind_cell.references)
                {
                }
            }
        }
예제 #3
0
        public static void add_references(string filename, List <TES5.Group> interiors, List <TES5.Group> exteriors)
        {
            make_indices(interiors, exteriors);

            TES3.ESM.open(filename);

            while (TES3.ESM.find("CELL"))
            {
                TES3.CELL cell = new TES3.CELL();
                cell.read();

                // TODO: Remove after testing
                if (!cell.interior)
                {
                    continue;
                }

                Lighting_Module.Shadow shadower = new Lighting_Module.Shadow();
                shadower.mark_shadow_lights(cell.references);

                foreach (TES3.REFR refr in cell.references)
                {
                    string refr_id = refr.editor_id;
                    uint   formid  = TES5.FormID.get(refr_id);
                    if (formid == 0)
                    {
                        continue;   // Reference Base not converted, so skip
                    }


                    Log.info("Adding Reference: " + refr_id);

                    TES5.REFR skyrim_reference;

                    if (refr.isPortal)
                    {
                        TES5.REFR exit = make_exit(refr);
                        skyrim_reference = new TES5.REFR(formid, refr.x, refr.y, refr.z, refr.xR, refr.yR, refr.zR, refr.scale);

                        exit.attach_portal(skyrim_reference);
                        skyrim_reference.attach_portal(exit);
                    }
                    else
                    {
                        skyrim_reference = new TES5.REFR(formid, refr.x, refr.y, refr.z, refr.xR, refr.yR, refr.zR, refr.scale);

                        if (TypeIndex.getInstance().get(refr.editor_id) == TypeIndex.TYPE.LIGH)
                        {
                            skyrim_reference.configure_light();
                        }
                    }

                    handle_owner(refr.owner, skyrim_reference);

                    if (cell.interior)
                    {
                        if (Addon_Rules.addon_defined(skyrim_reference.base_id))
                        {
                            TES5.REFR addon = Addon_Rules.get_addon(skyrim_reference);
                            add_interior_references(addon, Text.editor_id_string(cell.cell_name));
                        }

                        add_interior_references(skyrim_reference, Text.editor_id_string(cell.cell_name));
                    }

                    if (!cell.interior)
                    {
                        add_exterior_references(skyrim_reference);

                        if (Addon_Rules.addon_defined(skyrim_reference.base_id))
                        {
                            TES5.REFR addon = Addon_Rules.get_addon(skyrim_reference);
                            add_exterior_references(addon);
                        }
                    }
                }
            }
        }