Ejemplo 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);
        }
Ejemplo n.º 2
0
        private WStage GetStage()
        {
            WStage stage = null;

            for (int i = 0; i < MainWorld.Map.SceneList.Count; i++)
            {
                WStage castTest = MainWorld.Map.SceneList[i] as WStage;
                if (castTest != null)
                {
                    stage = castTest;
                    break;
                }
            }

            return(stage);
        }
Ejemplo n.º 3
0
        private void ImportVisualMeshToStage(View.VisualMeshImportWindow importWindow)
        {
            WStage stage = GetStage();

            if (importWindow.SlotNumber == 4)
            {
                ImportVisualMeshToSkybox(importWindow, stage);
            }
            else
            {
                CategoryDOMNode meshCategory = stage.GetChildrenOfType <CategoryDOMNode>().Find(x => x.Name == "Models");
                string          meshName     = "";

                switch (importWindow.SlotNumber)
                {
                case 0:
                    meshName = "vr_sky";
                    break;

                case 4:
                    meshName = "door10";
                    break;

                case 5:
                    meshName = "door20";
                    break;

                case 6:
                    meshName = "key10";
                    break;

                case 7:
                    meshName = "stop10";
                    break;
                }

                ImportVisualMeshToCategory(importWindow, meshCategory, meshName);
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public void LoadFromDirectory(string inPath, string sourcePath)
        {
            if (!Directory.Exists(inPath))
            {
                throw new ArgumentException("Cannot load map from non-existant directory", "filePath");
            }


            m_mapName  = Path.GetFileName(inPath);
            m_savePath = Path.GetFullPath(sourcePath);

            Console.WriteLine("Loading map {0}...", m_mapName);

            // Sort them alphabetically so we always load the Stage last.
            List <string> sortedScenes = new List <string>(Directory.GetDirectories(inPath));

            sortedScenes.Sort();

            WStage stage = null;

            foreach (var sceneFolder in sortedScenes)
            {
                string sceneName = Path.GetFileName(sceneFolder);
                WScene scene     = null;

                if (sceneName.ToLower().StartsWith("room")) //
                {
                    string roomNumberStr = sceneName.Substring(4);
                    int    roomNumber;

                    if (int.TryParse(roomNumberStr, out roomNumber))
                    {
                        scene = new WRoom(m_world, roomNumber);
                    }
                    else
                    {
                        Console.WriteLine("Unknown Room Number for Room: \"{0}\", Skipping!", sceneName);
                    }
                }
                else if (string.Compare(sceneName, "Stage", true) == 0)
                {
                    stage = new WStage(m_world);
                    scene = stage;
                }
                else
                {
                    Console.WriteLine("Unknown Map Folder: {0}", sceneFolder);
                }

                if (scene != null)
                {
                    m_sceneList.Add(scene);
                    scene.Load(sceneFolder);
                }
            }

            // Now that we've loaded all of the data, we'll do some post processing.
            if (stage != null)
            {
                List <WRoom> allRooms = new List <WRoom>();
                foreach (var scene in m_sceneList)
                {
                    if (scene is WRoom)
                    {
                        allRooms.Add((WRoom)scene);
                    }
                }

                stage.PostLoadProcessing(inPath, allRooms);
            }

            if (m_sceneList.Count > 0)
            {
                FocusedScene = m_sceneList[m_sceneList.Count - 1];
            }
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public void LoadFromDirectory(string inPath, string sourcePath)
        {
            if (!Directory.Exists(inPath))
            {
                throw new ArgumentException("Cannot load map from non-existant directory", "filePath");
            }

            m_mapName  = Path.GetFileName(inPath);
            m_savePath = Path.GetFullPath(sourcePath);

            Console.WriteLine("Loading map {0}...", m_mapName);

            // Sort them alphabetically to guarantee rooms are in order, then move the Stage folder to the start of the list so we always load it first.
            List <string> sortedScenes = new List <string>(Directory.GetDirectories(inPath));

            sortedScenes.Sort();
            var stageFolder = sortedScenes[sortedScenes.Count - 1];

            sortedScenes.RemoveAt(sortedScenes.Count - 1);
            sortedScenes.Insert(0, stageFolder);

            WStage stage = null;

            foreach (var sceneFolder in sortedScenes)
            {
                string sceneName = Path.GetFileName(sceneFolder);

                VirtualFilesystemDirectory src_dir = new VirtualFilesystemDirectory(sceneFolder);
                src_dir.ImportFromDisk(sceneFolder);

                WScene scene = null;

                if (sceneName.ToLower().StartsWith("room")) //
                {
                    string roomNumberStr = sceneName.Substring(4);
                    int    roomNumber;

                    if (int.TryParse(roomNumberStr, out roomNumber))
                    {
                        scene = new WRoom(m_world, roomNumber);
                        scene.SourceDirectory = src_dir;
                    }
                    else
                    {
                        Console.WriteLine("Unknown Room Number for Room: \"{0}\", Skipping!", sceneName);
                    }
                }
                else if (string.Compare(sceneName, "Stage", true) == 0)
                {
                    stage = new WStage(m_world);
                    scene = stage;
                    scene.SourceDirectory = src_dir;
                }
                else
                {
                    Console.WriteLine("Unknown Map Folder: {0}", sceneFolder);
                }

                if (scene != null)
                {
                    m_sceneList.Add(scene);
                    scene.Load(sceneFolder);
                }
            }

            // Now that we've loaded all of the data, we'll do some post processing.
            if (stage != null)
            {
                List <WRoom> allRooms = new List <WRoom>();
                foreach (var scene in m_sceneList)
                {
                    if (scene is WRoom)
                    {
                        allRooms.Add((WRoom)scene);
                    }
                }

                stage.PostLoadProcessing(inPath, allRooms);
            }

            if (m_sceneList.Count > 1)
            {
                // Default to selecting the second item in the list, which will be the lowest-numbered room.
                FocusedScene = m_sceneList[1];
            }
            else if (m_sceneList.Count > 0)
            {
                // If no rooms are loaded, select the stage by default instead.
                FocusedScene = m_sceneList[0];
            }
        }
Ejemplo n.º 9
0
 private void ImportVisualMeshToSkybox(View.VisualMeshImportWindow importWindow, WStage stage)
 {
 }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        private void GetRoomAndSpawnID(WScene scene, out int room, out int spawn)
        {
            room  = 0;
            spawn = 0;

            Selection <WDOMNode> selected = null;

            if (scene.World.CurrentMode is ActorMode)
            {
                ActorMode mode = scene.World.CurrentMode as ActorMode;
                selected = mode.EditorSelection;
            }

            room = GetRoomNumberFromSceneName(scene.Name);
            if (selected != null && selected.PrimarySelectedObject is SpawnPoint)
            {
                // If the user has a spawn point selected, spawn the player at that spawn point.
                SpawnPoint spawn_pt = (SpawnPoint)selected.PrimarySelectedObject;

                room  = spawn_pt.Room;
                spawn = spawn_pt.SpawnID;
            }
            else if (selected != null && selected.PrimarySelectedObject != null)
            {
                // If the user has something besides a spawn point selected, spawn the player at the first spawn point in the room that the selected object is in.
                WDOMNode cur_object = selected.PrimarySelectedObject;
                while (cur_object.Parent != null)
                {
                    cur_object = cur_object.Parent;
                }
                WRoom room_node;
                if (cur_object is WRoom)
                {
                    room_node = cur_object as WRoom;
                }
                else
                {
                    // A stage entity is selected. Use whatever spawn point is physically closest to the selected entity, regardless of what scene that spawn is in.
                    List <SpawnPoint> allSpawnPts = new List <SpawnPoint>();
                    foreach (WScene scn in scene.World.Map.SceneList)
                    {
                        allSpawnPts.AddRange(scn.GetChildrenOfType <SpawnPoint>());
                    }

                    SpawnPoint closestSpawnPt = allSpawnPts.OrderBy(spawnPt => (spawnPt.Transform.Position - selected.PrimarySelectedObject.Transform.Position).Length).First();
                    room  = closestSpawnPt.Room;
                    spawn = closestSpawnPt.SpawnID;
                    return;
                }

                SpawnPoint spawn_pt = room_node.GetChildrenOfType <SpawnPoint>().FirstOrDefault();
                if (spawn_pt != null)
                {
                    room  = spawn_pt.Room;
                    spawn = spawn_pt.SpawnID;
                }
                else
                {
                    WStage stage = room_node.World.Map.SceneList.First(x => x.GetType() == typeof(WStage)) as WStage;
                    spawn_pt = stage.GetChildrenOfType <SpawnPoint>().FirstOrDefault(x => x.Room == room_node.RoomIndex);
                    if (spawn_pt != null)
                    {
                        room  = spawn_pt.Room;
                        spawn = spawn_pt.SpawnID;
                    }
                }
            }
        }