示例#1
0
        public DoomGame(GameContent content, GameOptions options)
        {
            this.content = content;
            this.options = options;

            gameAction = GameAction.Nothing;

            gameTic = 0;
        }
示例#2
0
        public static GameContent CreateDummy(params string[] wadPaths)
        {
            var gc = new GameContent();

            gc.wad       = new Wad(wadPaths);
            gc.palette   = new Palette(gc.wad);
            gc.colorMap  = new ColorMap(gc.wad);
            gc.textures  = new DummyTextureLookup(gc.wad);
            gc.flats     = new DummyFlatLookup(gc.wad);
            gc.sprites   = new DummySpriteLookup(gc.wad);
            gc.animation = new TextureAnimation(gc.textures, gc.flats);

            return(gc);
        }
示例#3
0
        public OpeningSequence(GameContent content, GameOptions options)
        {
            this.content = content;
            this.options = options;

            cmds = new TicCmd[Player.MaxPlayerCount];
            for (var i = 0; i < Player.MaxPlayerCount; i++)
            {
                cmds[i] = new TicCmd();
            }

            currentStage = 0;
            nextStage    = 0;

            reset = false;

            StartTitleScreen();
        }
示例#4
0
        public DemoPlayback(GameContent content, GameOptions options, string demoName)
        {
            if (File.Exists(demoName))
            {
                demo = new Demo(demoName);
            }
            else if (File.Exists(demoName + ".lmp"))
            {
                demo = new Demo(demoName + ".lmp");
            }
            else
            {
                var lumpName = demoName.ToUpper();
                if (content.Wad.GetLumpNumber(lumpName) == -1)
                {
                    throw new Exception("Demo '" + demoName + "' was not found!");
                }
                demo = new Demo(content.Wad.ReadLump(lumpName));
            }

            demo.Options.GameVersion = options.GameVersion;
            demo.Options.GameMode    = options.GameMode;
            demo.Options.MissionPack = options.MissionPack;
            demo.Options.Video       = options.Video;
            demo.Options.Sound       = options.Sound;
            demo.Options.Music       = options.Music;

            cmds = new TicCmd[Player.MaxPlayerCount];
            for (var i = 0; i < Player.MaxPlayerCount; i++)
            {
                cmds[i] = new TicCmd();
            }

            game = new DoomGame(content, demo.Options);
            game.DeferedInitNew();

            stopwatch = new Stopwatch();
        }
示例#5
0
 public Map(GameContent resorces, World world)
     : this(resorces.Wad, resorces.Textures, resorces.Flats, resorces.Animation, world)
 {
 }
示例#6
0
        public Doom(CommandLineArgs args, Config config, GameContent content, IVideo video, ISound sound, IMusic music, IUserInput userInput)
        {
            video     = video ?? NullVideo.GetInstance();
            sound     = sound ?? NullSound.GetInstance();
            music     = music ?? NullMusic.GetInstance();
            userInput = userInput ?? NullUserInput.GetInstance();

            this.args      = args;
            this.config    = config;
            this.content   = content;
            this.video     = video;
            this.sound     = sound;
            this.music     = music;
            this.userInput = userInput;

            if (args.deh.Present)
            {
                DeHackEd.ReadFiles(args.deh.Value);
            }

            if (!args.nodeh.Present)
            {
                DeHackEd.ReadDeHackEdLump(content.Wad);
            }

            events = new List <DoomEvent>();

            options             = new GameOptions();
            options.GameVersion = content.Wad.GameVersion;
            options.GameMode    = content.Wad.GameMode;
            options.MissionPack = content.Wad.MissionPack;
            options.Video       = video;
            options.Sound       = sound;
            options.Music       = music;
            options.UserInput   = userInput;

            menu = new DoomMenu(this);

            opening = new OpeningSequence(content, options);

            cmds = new TicCmd[Player.MaxPlayerCount];
            for (var i = 0; i < Player.MaxPlayerCount; i++)
            {
                cmds[i] = new TicCmd();
            }
            game = new DoomGame(content, options);

            wipeEffect = new WipeEffect(video.WipeBandCount, video.WipeHeight);
            wiping     = false;

            currentState = DoomState.None;
            nextState    = DoomState.Opening;
            needWipe     = false;

            sendPause = false;

            quit        = false;
            quitMessage = null;

            mouseGrabbed = false;

            CheckGameArgs();
        }
示例#7
0
        public World(GameContent resorces, GameOptions options, DoomGame game)
        {
            this.options = options;
            this.game    = game;
            this.random  = options.Random;

            map = new Map(resorces, this);

            thinkers         = new Thinkers(this);
            specials         = new Specials(this);
            thingAllocation  = new ThingAllocation(this);
            thingMovement    = new ThingMovement(this);
            thingInteraction = new ThingInteraction(this);
            mapCollision     = new MapCollision(this);
            mapInteraction   = new MapInteraction(this);
            pathTraversal    = new PathTraversal(this);
            hitscan          = new Hitscan(this);
            visibilityCheck  = new VisibilityCheck(this);
            sectorAction     = new SectorAction(this);
            playerBehavior   = new PlayerBehavior(this);
            itemPickup       = new ItemPickup(this);
            weaponBehavior   = new WeaponBehavior(this);
            monsterBehavior  = new MonsterBehavior(this);
            lightingChange   = new LightingChange(this);
            statusBar        = new StatusBar(this);
            autoMap          = new AutoMap(this);
            cheat            = new Cheat(this);

            options.IntermissionInfo.TotalFrags = 0;
            options.IntermissionInfo.ParTime    = 180;

            for (var i = 0; i < Player.MaxPlayerCount; i++)
            {
                options.Players[i].KillCount   = 0;
                options.Players[i].SecretCount = 0;
                options.Players[i].ItemCount   = 0;
            }

            // Initial height of view will be set by player think.
            options.Players[options.ConsolePlayer].ViewZ = Fixed.Epsilon;

            totalKills   = 0;
            totalItems   = 0;
            totalSecrets = 0;

            LoadThings();

            // If deathmatch, randomly spawn the active players.
            if (options.Deathmatch != 0)
            {
                for (var i = 0; i < Player.MaxPlayerCount; i++)
                {
                    if (options.Players[i].InGame)
                    {
                        options.Players[i].Mobj = null;
                        thingAllocation.DeathMatchSpawnPlayer(i);
                    }
                }
            }

            specials.SpawnSpecials();

            levelTime    = 0;
            doneFirstTic = false;
            secretExit   = false;
            completed    = false;

            validCount = 0;

            displayPlayer = options.ConsolePlayer;

            dummy = new Mobj(this);

            options.Music.StartMusic(Map.GetMapBgm(options), true);
        }
示例#8
0
 public World(GameContent resorces, GameOptions options) : this(resorces, options, null)
 {
 }