Esempio n. 1
0
        private List <J3D> GetModelsFromObjectArc()
        {
            List <J3D> model_list = new List <J3D>();

            switch (AppearanceType)
            {
            case AppearanceTypeEnum.Earth_Temple_Normal:
                model_list.AddRange(WResourceManager.LoadActorResource("Earth Temple Door"));
                break;

            case AppearanceTypeEnum.Earth_Temple_Miniboss:
                model_list.AddRange(WResourceManager.LoadActorResource("Earth Temple Miniboss Door"));
                break;

            case AppearanceTypeEnum.Earth_Temple_Boss:
                model_list.AddRange(WResourceManager.LoadActorResource("Earth Temple Boss Door"));
                break;

            case AppearanceTypeEnum.Wind_Temple_Normal:
                model_list.AddRange(WResourceManager.LoadActorResource("Wind Temple Door"));
                break;

            case AppearanceTypeEnum.Wind_Temple_Miniboss:
                model_list.AddRange(WResourceManager.LoadActorResource("Wind Temple Miniboss Door"));
                break;

            case AppearanceTypeEnum.Wind_Temple_Boss:
                model_list.AddRange(WResourceManager.LoadActorResource("Wind Temple Boss Door"));
                break;
            }

            bool isLocked = false;

            if (BehaviorType == BehaviorTypeEnum.Boss_Locked || AppearanceType == AppearanceTypeEnum.Earth_Temple_Boss || AppearanceType == AppearanceTypeEnum.Wind_Temple_Boss)
            {
                model_list.AddRange(WResourceManager.LoadActorResource("Boss Key Lock"));
                isLocked = true;
            }
            else if (BehaviorType == BehaviorTypeEnum.Locked)
            {
                model_list.AddRange(WResourceManager.LoadActorResource("Small Key Lock"));
                isLocked = true;
            }

            WStage stage = World.Map.SceneList.First(x => x.GetType() == typeof(WStage)) as WStage;
            VirtualFilesystemDirectory stage_dir = stage.SourceDirectory;

            if (Switch2 != 255 || (!isLocked && Switch1 != 255))
            {
                if (stage_dir.GetFileAtPath("bdl/stop10.bdl") != null)
                {
                    model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/stop10.bdl"));
                }
            }

            return(model_list);
        }
Esempio n. 2
0
        private void UpdateModel()
        {
            // Loads the necessary information about which figurine model to load dynamically from the REL and the DOL.

            m_actorMeshes = WResourceManager.LoadActorResource("Figurine Stand");

            int modelFileID;
            int modelArcIndex;

            int figurineIndex = (int)WhichFigurine;

            string       figurine_rel_path = Path.Combine(WSettingsManager.GetSettings().RootDirectoryPath, "files", "rels/d_a_obj_figure.rel");
            MemoryStream figurine_rel_data = null;

            using (EndianBinaryReader reader = new EndianBinaryReader(File.ReadAllBytes(figurine_rel_path), Endian.Big))
            {
                figurine_rel_data = Yaz0.Decode(reader);
            }
            using (EndianBinaryReader reader = new EndianBinaryReader(figurine_rel_data, Endian.Big))
            {
                int l_figure_dat_entry_offset = l_figure_dat_tbl_offset + figurineIndex * 0xC;
                modelFileID   = reader.ReadInt32At(l_figure_dat_entry_offset + 0x00);
                modelArcIndex = reader.ReadInt32At(l_figure_dat_entry_offset + 0x08);
            }

            if (modelArcIndex == -1)
            {
                string main_dol_path = Path.Combine(WSettingsManager.GetSettings().RootDirectoryPath, "sys", "main.dol");
                using (FileStream strm = new FileStream(main_dol_path, FileMode.Open, FileAccess.Read))
                {
                    EndianBinaryReader reader      = new EndianBinaryReader(strm, Endian.Big);
                    long l_CharaData_entry_address = l_CharaData_address + figurineIndex * 0x12;
                    long l_CharaData_entry_offset  = DOL.AddressToOffset(l_CharaData_entry_address, reader);
                    modelArcIndex = reader.ReadByteAt(l_CharaData_entry_offset + 0x10);
                }
            }

            var    arc_name = l_arcname_tbl[modelArcIndex];
            string arc_path = Path.Combine(WSettingsManager.GetSettings().RootDirectoryPath, "files", "res/Object/", arc_name + ".arc");

            if (File.Exists(arc_path))
            {
                VirtualFilesystemDirectory model_arc = ArchiveUtilities.LoadArchive(arc_path);
                if (model_arc.FindByID((ushort)modelFileID) != null)
                {
                    var figurine_model = WResourceManager.LoadModelFromVFS(model_arc, fileID: (ushort)modelFileID);
                    figurine_model.SetOffsetTranslation(new Vector3(0, 100, 0));
                    m_actorMeshes.Add(figurine_model);
                }
            }
        }
Esempio n. 3
0
        private List <J3D> GetModelsFromStageDir()
        {
            List <J3D> model_list = new List <J3D>();

            WStage stage = World.Map.SceneList.First(x => x.GetType() == typeof(WStage)) as WStage;
            VirtualFilesystemDirectory stage_dir = stage.SourceDirectory;

            if (Type == TypeEnum.Boss)
            {
                if (stage_dir.GetFileAtPath("bdl/door20.bdl") != null)
                {
                    model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/door20.bdl"));
                }
                model_list.AddRange(WResourceManager.LoadActorResource("Boss Key Lock"));

                return(model_list);
            }

            if (stage_dir.GetFileAtPath("bdl/door10.bdl") != null)
            {
                model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/door10.bdl"));
            }

            if (Type == TypeEnum.Locked || Type == TypeEnum.Locked_and_barred)
            {
                model_list.AddRange(WResourceManager.LoadActorResource("Small Key Lock"));
            }

            if (Type == TypeEnum.Barred_until_all_enemies_dead || Type == TypeEnum.Locked_and_barred || (Type == TypeEnum.Normal && Switch1 < 255))
            {
                if (stage_dir.GetFileAtPath("bdl/stop10.bdl") != null)
                {
                    model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/stop10.bdl"));
                }
            }

            return(model_list);
        }
Esempio n. 4
0
        private List <J3D> GetModelFromStageDir()
        {
            List <J3D> model_list = new List <J3D>();

            VirtualFilesystemDirectory stage_dir = null;
            WDOMNode node = Parent;

            while (!(node is WStage))
            {
                node = node.Parent;
            }

            WStage stage_node = node as WStage;

            stage_dir = stage_node.SourceDirectory;

            if (DoorType == DoorType.Boss)
            {
                model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/door20.bdl"));
                model_list.AddRange(WResourceManager.LoadActorResource("Boss Key Lock"));

                return(model_list);
            }

            model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/door10.bdl"));

            if (DoorType == DoorType.Locked)
            {
                model_list.AddRange(WResourceManager.LoadActorResource("Small Key Lock"));
            }
            else if (DoorType == DoorType.Barred || SwitchBit < 255)
            {
                model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/stop10.bdl"));
            }

            return(model_list);
        }
Esempio n. 5
0
        private List <J3D> GetModelsFromStageDir()
        {
            List <J3D> model_list = new List <J3D>();

            WStage stage = World.Map.SceneList.First(x => x.GetType() == typeof(WStage)) as WStage;
            VirtualFilesystemDirectory stage_dir = stage.SourceDirectory;

            if (Type == TypeEnum.Boss)
            {
                if (stage_dir.GetFileAtPath("bdl/door20.bdl") != null)
                {
                    model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/door20.bdl"));
                }
            }
            else
            {
                if (stage_dir.GetFileAtPath("bdl/door10.bdl") != null)
                {
                    model_list.Add(WResourceManager.LoadModelFromVFS(stage_dir, "bdl/door10.bdl"));
                }
            }

            bool isLocked     = false;
            bool isBossLocked = false;

            if (Type == TypeEnum.Boss)
            {
                if (FrontSwitch != 255)
                {
                    model_list.AddRange(WResourceManager.LoadActorResource("Boss Key Lock"));
                    isLocked     = true;
                    isBossLocked = true;
                }
            }
            else if (Type == TypeEnum.Locked || Type == TypeEnum.Locked_and_barred)
            {
                model_list.AddRange(WResourceManager.LoadActorResource("Small Key Lock"));
                isLocked = true;
            }

            bool hasFrontBars = false;
            bool hasBackBars  = false;

            if (FrontSwitch != 255 && !isLocked)
            {
                hasFrontBars = true;
            }
            if (BackBarsSwitch != 255)
            {
                hasBackBars = true;
                if (FrontSwitch != 255 && isLocked && !isBossLocked)
                {
                    hasFrontBars = true;
                }
            }
            if (stage_dir.GetFileAtPath("bdl/stop10.bdl") != null)
            {
                if (hasFrontBars)
                {
                    var bars = WResourceManager.LoadModelFromVFS(stage_dir, "bdl/stop10.bdl");
                    model_list.Add(bars);
                }
                if (hasBackBars)
                {
                    var bars = WResourceManager.LoadModelFromVFS(stage_dir, "bdl/stop10.bdl");
                    bars.SetOffsetRotation(new OpenTK.Vector3(0, 180, 0));
                    model_list.Add(bars);
                }
            }

            return(model_list);
        }
Esempio n. 6
0
        private List <J3D> GetModelsFromObjectArc()
        {
            List <J3D> model_list = new List <J3D>();

            switch (AppearanceType)
            {
            case AppearanceTypeEnum.Earth_Temple_Normal:
                model_list.AddRange(WResourceManager.LoadActorResource("Earth Temple Door"));
                break;

            case AppearanceTypeEnum.Earth_Temple_Miniboss:
                model_list.AddRange(WResourceManager.LoadActorResource("Earth Temple Miniboss Door"));
                break;

            case AppearanceTypeEnum.Earth_Temple_Boss:
                model_list.AddRange(WResourceManager.LoadActorResource("Earth Temple Boss Door"));
                break;

            case AppearanceTypeEnum.Wind_Temple_Normal:
                model_list.AddRange(WResourceManager.LoadActorResource("Wind Temple Door"));
                break;

            case AppearanceTypeEnum.Wind_Temple_Miniboss:
                model_list.AddRange(WResourceManager.LoadActorResource("Wind Temple Miniboss Door"));
                break;

            case AppearanceTypeEnum.Wind_Temple_Boss:
                model_list.AddRange(WResourceManager.LoadActorResource("Wind Temple Boss Door"));
                break;
            }

            bool isLocked     = false;
            bool isBossLocked = false;

            if (BehaviorType == BehaviorTypeEnum.Boss_locked || AppearanceType == AppearanceTypeEnum.Earth_Temple_Boss || AppearanceType == AppearanceTypeEnum.Wind_Temple_Boss)
            {
                if (FrontSwitch != 255)
                {
                    model_list.AddRange(WResourceManager.LoadActorResource("Boss Key Lock"));
                    isLocked     = true;
                    isBossLocked = true;
                }
            }
            else if (BehaviorType == BehaviorTypeEnum.Locked)
            {
                model_list.AddRange(WResourceManager.LoadActorResource("Small Key Lock"));
                isLocked = true;
            }

            WStage stage = World.Map.SceneList.First(x => x.GetType() == typeof(WStage)) as WStage;
            VirtualFilesystemDirectory stage_dir = stage.SourceDirectory;

            bool hasFrontBars = false;
            bool hasBackBars  = false;

            if (FrontSwitch != 255 && !isLocked)
            {
                hasFrontBars = true;
            }
            if (BackBarsSwitch != 255)
            {
                hasBackBars = true;
                if (FrontSwitch != 255 && isLocked && !isBossLocked)
                {
                    hasFrontBars = true;
                }
            }
            if (stage_dir.GetFileAtPath("bdl/stop10.bdl") != null)
            {
                if (hasFrontBars)
                {
                    var bars = WResourceManager.LoadModelFromVFS(stage_dir, "bdl/stop10.bdl");
                    model_list.Add(bars);
                }
                if (hasBackBars)
                {
                    var bars = WResourceManager.LoadModelFromVFS(stage_dir, "bdl/stop10.bdl");
                    bars.SetOffsetRotation(new OpenTK.Vector3(0, 180, 0));
                    model_list.Add(bars);
                }
            }

            return(model_list);
        }