Exemplo n.º 1
0
        public void RequiemDemo1_Final2()
        {
            using (var content = GameContent.CreateDummy(WadPath.Doom2, WadPath.Requiem))
            {
                var demo = new Demo(content.Wad.ReadLump("DEMO1"));
                demo.Options.GameVersion = GameVersion.Final2;
                var cmds = Enumerable.Range(0, Player.MaxPlayerCount).Select(i => new TicCmd()).ToArray();
                var game = new DoomGame(content, demo.Options);
                game.DeferedInitNew();

                var lastMobjHash   = 0;
                var aggMobjHash    = 0;
                var lastSectorHash = 0;
                var aggSectorHash  = 0;

                while (true)
                {
                    demo.ReadCmd(cmds);
                    game.Update(cmds);
                    lastMobjHash   = DoomDebug.GetMobjHash(game.World);
                    aggMobjHash    = DoomDebug.CombineHash(aggMobjHash, lastMobjHash);
                    lastSectorHash = DoomDebug.GetSectorHash(game.World);
                    aggSectorHash  = DoomDebug.CombineHash(aggSectorHash, lastSectorHash);

                    if (game.World.LevelTime == 18003)
                    {
                        break;
                    }
                }

                Assert.AreEqual(0x62d5d8f5u, (uint)lastMobjHash);
                Assert.AreEqual(0x05ce9c00u, (uint)aggMobjHash);
                Assert.AreEqual(0x94015cdau, (uint)lastSectorHash);
                Assert.AreEqual(0x1ae3ca8eu, (uint)aggSectorHash);
            }
        }
Exemplo n.º 2
0
        public void RequiemDemo2()
        {
            using (var content = GameContent.CreateDummy(WadPath.Doom2, WadPath.Requiem))
            {
                var demo = new Demo(content.Wad.ReadLump("DEMO2"));
                demo.Options.Players[0].PlayerState = PlayerState.Reborn;
                var cmds = Enumerable.Range(0, Player.MaxPlayerCount).Select(i => new TicCmd()).ToArray();
                var game = new DoomGame(content, demo.Options);
                game.DeferedInitNew();

                var lastMobjHash   = 0;
                var aggMobjHash    = 0;
                var lastSectorHash = 0;
                var aggSectorHash  = 0;

                while (true)
                {
                    demo.ReadCmd(cmds);
                    game.Update(cmds);
                    lastMobjHash   = DoomDebug.GetMobjHash(game.World);
                    aggMobjHash    = DoomDebug.CombineHash(aggMobjHash, lastMobjHash);
                    lastSectorHash = DoomDebug.GetSectorHash(game.World);
                    aggSectorHash  = DoomDebug.CombineHash(aggSectorHash, lastSectorHash);

                    if (game.World.LevelTime == 24659)
                    {
                        break;
                    }
                }

                Assert.AreEqual(0x083125a6u, (uint)lastMobjHash);
                Assert.AreEqual(0x50237ab4u, (uint)aggMobjHash);
                Assert.AreEqual(0x732a5645u, (uint)lastSectorHash);
                Assert.AreEqual(0x36f64dd0u, (uint)aggSectorHash);
            }
        }
Exemplo n.º 3
0
        public void Map11Nomonsters()
        {
            using (var resource = CommonResource.CreateDummy(WadPath.Doom2))
            {
                var options = new GameOptions();
                options.Skill      = GameSkill.Medium;
                options.Map        = 11;
                options.NoMonsters = true;

                var players = new Player[Player.MaxPlayerCount];
                for (var i = 0; i < Player.MaxPlayerCount; i++)
                {
                    players[i]             = new Player(i);
                    players[i].PlayerState = PlayerState.Reborn;
                }
                players[0].InGame = true;

                var world = new World(resource, options, players);

                var tics = 350;

                var aggMobjHash   = 0;
                var aggSectorHash = 0;
                for (var i = 0; i < tics; i++)
                {
                    world.Update();
                    aggMobjHash   = DoomDebug.CombineHash(aggMobjHash, DoomDebug.GetMobjHash(world));
                    aggSectorHash = DoomDebug.CombineHash(aggSectorHash, DoomDebug.GetSectorHash(world));
                }

                Assert.AreEqual(0x21187a94u, (uint)DoomDebug.GetMobjHash(world));
                Assert.AreEqual(0x55752988u, (uint)aggMobjHash);
                Assert.AreEqual(0xead9e45bu, (uint)DoomDebug.GetSectorHash(world));
                Assert.AreEqual(0x1397c7cbu, (uint)aggSectorHash);
            }
        }