示例#1
0
        /// <summary>
        /// Creates an in-memory model of the scene header
        /// </summary>
        /// <param name="br">Binary reader containing the scene or room file</param>
        /// <param name="seek">offset to the start of the scene header</param>
        public void Load(BinaryReader br, long seek)
        {
            bool KeepReading = true;
            long seekBackTop;

            Offset = seek;

            seekBackTop            = br.BaseStream.Position;
            br.BaseStream.Position = seek;

            while (KeepReading)
            {
                SceneWord command = new SceneWord();
                br.Read(command, 0, 8);

                SetCommand(command, br.BaseStream.Position - 8);
                if ((HeaderCommands)command.Code == HeaderCommands.End)
                {
                    KeepReading = false;
                }
            }
            br.BaseStream.Position = seekBackTop;

            if (HasAlternateHeaders())
            {
                Alternate.HeaderListEndAddress = AltHeaderEnd();
                Alternate.Initialize(br);
            }
        }
示例#2
0
        public void SetCommand(SceneWord sceneWord, long HeaderOffset)
        {
            SceneCommand command;

            switch ((HeaderCommands)sceneWord.Code)
            {
            case HeaderCommands.PositionList:           //0x00
                command = new PositionListCommand(Game);
                break;

            case HeaderCommands.ActorList:              //0x01
                command = new ActorListCommand(Game);
                break;

            case HeaderCommands.Collision:              //0x03
                command = new CollisionCommand();
                break;

            case HeaderCommands.RoomList:               //0x04
                command = new RoomListCommand();
                break;

            case HeaderCommands.WindSettings:           //0x05
                command = new WindSettingsCommand();
                break;

            case HeaderCommands.EntranceDefs:           //0x06
                command = new EntranceDefinitionsCommand();
                break;

            case HeaderCommands.SpecialObject:          //0x07
                command = new SpecialObjectCommand();
                break;

            case HeaderCommands.RoomBehavior:           //0x08
                command = new RoomBehaviorCommand();
                break;

            case HeaderCommands.RoomMesh:               //0x0A
                command = new RoomMeshCommand();
                break;

            case HeaderCommands.ObjectList:             //0x0B
                command = new ObjectListCommand();
                break;

            case HeaderCommands.PathList:               //0x0D
                command = new PathListCommand();
                break;

            case HeaderCommands.TransitionActorList:    //0x0E
                command = new TransitionActorListCommand(Game);
                break;

            case HeaderCommands.EnvironmentSettings:    //0x0F
                command = new EnvironmentSettingsCommand();
                break;

            case HeaderCommands.TimeSettings:           //0x10
                command = new TimeSettingsCommand();
                break;

            case HeaderCommands.SkyboxSettings:         //0x11
                command = new SkyboxSettingsCommand();
                break;

            case HeaderCommands.SkyboxModifier:         //0x12
                command = new SkyboxModifierCommand();
                break;

            case HeaderCommands.ExitList:               //0x13
                command = new ExitListCommand();
                break;

            case HeaderCommands.End:                    //0x14
                command = new EndCommand();
                break;

            case HeaderCommands.SoundSettings:          //0x15
                command = new SoundSettingsCommand();
                break;

            case HeaderCommands.SoundSettingsEcho:      //0x16
                command = new SoundSettingsEchoCommand();
                break;

            case HeaderCommands.Cutscene:               //0x17
                command = new CutsceneCommand();
                break;

            case HeaderCommands.AlternateHeaders:       //0x18
                command = new AlternateHeadersCommand(Game);
                break;

            case HeaderCommands.JpegBackground:         //0x19
                command = new JpegBackgroundCommand();
                break;

            default: command = new SceneCommand();
                break;
            }

            command.SetCommand(sceneWord);
            command.OffsetFromFile = HeaderOffset;
            cmds.Add(command);
        }
示例#3
0
 public override void SetCommand(SceneWord command)
 {
     base.SetCommand(command);
     Entries        = Command.Data1;
     SegmentAddress = command.Data2;
 }
示例#4
0
        public void SetCommand(SceneWord sceneWord, long HeaderOffset)
        {
            SceneCommand command;

            switch ((HeaderCommands)sceneWord.Code)
            {
            case HeaderCommands.PositionList:           //0x00
                command = new ActorSpawnCommand(Game);
                break;

            case HeaderCommands.ActorList:              //0x01
                command = new ActorSpawnCommand(Game);
                break;

            case HeaderCommands.Collision:              //0x03
                command = new CollisionCommand();
                break;

            case HeaderCommands.RoomList:               //0x04
                command = new RoomListCommand();
                break;

            case HeaderCommands.WindSettings:           //0x05
                command = new SettingsCommand();
                break;

            case HeaderCommands.EntranceDefs:           //0x06
                command = new EntranceDefinitionsCommand();
                break;

            case HeaderCommands.SpecialObject:          //0x07
                command = new SettingsCommand();
                break;

            case HeaderCommands.RoomBehavior:           //0x08
                command = new RoomBehaviorCommand(Game);
                break;

            case HeaderCommands.RoomMesh:               //0x0A
                command = new RoomMeshCommand();
                break;

            case HeaderCommands.ObjectList:             //0x0B
                command = new ObjectListCommand();
                break;

            case HeaderCommands.PathList:               //0x0D
                command = new PathListCommand();
                break;

            case HeaderCommands.TransitionActorList:    //0x0E
                command = new TransitionActorListCommand(Game);
                break;

            case HeaderCommands.EnvironmentSettings:    //0x0F
                command = new EnvironmentSettingsCommand();
                break;

            case HeaderCommands.TimeSettings:           //0x10
                command = new SettingsCommand();
                break;

            case HeaderCommands.SkyboxSettings:         //0x11
                command = new SettingsCommand();
                break;

            case HeaderCommands.SkyboxModifier:         //0x12
                command = new SettingsCommand();
                break;

            case HeaderCommands.ExitList:               //0x13
                command = new ExitListCommand();
                break;

            case HeaderCommands.End:                    //0x14
                command = new EndCommand();
                break;

            case HeaderCommands.SoundSettings:          //0x15
                command = new SettingsCommand();
                break;

            case HeaderCommands.SoundSettingsEcho:      //0x16
                command = new SettingsCommand();
                break;

            case HeaderCommands.Cutscene:               //0x17
                command = new CutsceneCommand(Game);
                break;

            case HeaderCommands.AlternateHeaders:       //0x18
                command = new AlternateHeadersCommand(Game);
                break;

            case HeaderCommands.CameraAndWorldMap:      //0x19
                command = new SettingsCommand();
                break;

            case HeaderCommands.Textures:               //0x1A
                if (Game == Game.MajorasMask)
                {
                    command = new TexturesCommand();
                    break;
                }
                goto default;

            case HeaderCommands._0x1B:                  //0x1B
                if (Game == Game.MajorasMask)
                {
                    command = new _0x1BCommand();
                    break;
                }
                goto default;

            case HeaderCommands.Minimap:
                if (Game == Game.MajorasMask)
                {
                    command = new MinimapCommand();
                    break;
                }
                goto default;

            case HeaderCommands.MinimapChests:
                if (Game == Game.MajorasMask)
                {
                    command = new MinimapChestsCommand();
                    break;
                }
                goto default;

            default: command = new SceneCommand();
                break;
            }

            command.SetCommand(sceneWord);
            command.OffsetFromFile = HeaderOffset;
            cmds.Add(command);
        }