示例#1
0
        public static void Load(DoomGame game, string path)
        {
            var options = game.Options;

            game.InitNew(options.Skill, options.Episode, options.Map);

            var lg = new LoadGame(DoomApplication.Instance.FileSystem.Read(path));

            lg.Load(game);
        }
示例#2
0
            public void Load(DoomGame game)
            {
                var options = game.World.Options;

                options.Skill   = (GameSkill)this.reader.ReadByte();
                options.Episode = this.reader.ReadByte();
                options.Map     = this.reader.ReadByte();

                game.InitNew(options.Skill, options.Episode, options.Map);

                var levelTime = this.reader.ReadInt32();

                game.World.WorldEntity = Entity.Deserialize(game.World, this.reader);

                var numEntities = this.reader.ReadInt32();

                for (var i = 0; i < numEntities; i++)
                {
                    game.World.Entities.Add(Entity.Deserialize(game.World, this.reader));
                }

                this.UnArchivePlayers(game.World);
                this.UnArchiveWorld(game.World);
                this.UnArchiveThinkers(game.World);
                this.UnArchiveSpecials(game.World);

                var test = this.reader.ReadByte();

                this.reader.BaseStream.Position--;

                if (test != 0x1d)
                {
                    throw new Exception("Bad savegame!");
                }

                game.World.LevelTime = levelTime;

                options.Sound.SetListener(game.World.Options.Player.Mobj);
            }
示例#3
0
            public void Load(DoomGame game)
            {
                var options = game.World.Options;

                options.Skill   = (GameSkill)this.reader.ReadByte();
                options.Episode = this.reader.ReadByte();
                options.Map     = this.reader.ReadByte();

                for (var i = 0; i < Player.MaxPlayerCount; i++)
                {
                    options.Players[i].InGame = this.reader.ReadByte() != 0;
                }

                game.InitNew(options.Skill, options.Episode, options.Map);

                var a         = this.reader.ReadByte();
                var b         = this.reader.ReadByte();
                var c         = this.reader.ReadByte();
                var levelTime = (a << 16) + (b << 8) + c;

                this.UnArchivePlayers(game.World);
                this.UnArchiveWorld(game.World);
                this.UnArchiveThinkers(game.World);
                this.UnArchiveSpecials(game.World);

                var test = this.reader.ReadByte();

                this.reader.BaseStream.Position--;

                if (test != 0x1d)
                {
                    throw new Exception("Bad savegame!");
                }

                game.World.LevelTime = levelTime;

                options.Sound.SetListener(game.World.ConsolePlayer.Mobj);
            }