Beispiel #1
0
        public GameOptions()
        {
            gameVersion = GameVersion.Version109;
            gameMode    = GameMode.Commercial;
            missionPack = MissionPack.Doom2;

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

            episode = 1;
            map     = 1;
            skill   = GameSkill.Medium;

            demoPlayback = false;
            netGame      = false;

            deathmatch      = 0;
            fastMonsters    = false;
            respawnMonsters = false;
            noMonsters      = false;

            intermissionInfo = new IntermissionInfo();

            random = new DoomRandom();

            video     = NullVideo.GetInstance();
            sound     = NullSound.GetInstance();
            music     = NullMusic.GetInstance();
            userInput = NullUserInput.GetInstance();
        }
Beispiel #2
0
        private void InitAnimatedBack()
        {
            if (options.GameMode == GameMode.Commercial)
            {
                return;
            }

            if (info.Episode > 2)
            {
                return;
            }

            if (animations == null)
            {
                animations = new Animation[AnimationInfo.Episodes[info.Episode].Count];
                for (var i = 0; i < animations.Length; i++)
                {
                    animations[i] = new Animation(this, AnimationInfo.Episodes[info.Episode][i], i);
                }

                random = new DoomRandom();
            }

            foreach (var animation in animations)
            {
                animation.Reset(bgCount);
            }
        }
Beispiel #3
0
        public DoomGame(CommonResource resource, GameOptions options)
        {
            this.resource = resource;
            this.options  = options;

            gameAction = GameAction.Nothing;

            gameTic = 0;
            random  = new DoomRandom();
        }
Beispiel #4
0
        public StatusBar(World world)
        {
            this.world = world;

            oldHealth       = -1;
            oldWeaponsOwned = new bool[DoomInfo.WeaponInfos.Length];
            Array.Copy(
                world.ConsolePlayer.WeaponOwned,
                oldWeaponsOwned,
                DoomInfo.WeaponInfos.Length);
            faceCount      = 0;
            faceIndex      = 0;
            randomNumber   = 0;
            priority       = 0;
            lastAttackDown = -1;
            lastPainOffset = 0;

            random = new DoomRandom();
        }
Beispiel #5
0
        public StatusBar(World world)
        {
            this.world = world;

            st_oldhealth    = -1;
            oldweaponsowned = new bool[DoomInfo.WeaponInfos.Length];
            st_facecount    = 0;
            st_faceindex    = 0;
            lastattackdown  = -1;
            priority        = 0;
            oldhealth       = -1;

            Array.Copy(
                world.Players[world.Options.ConsolePlayer].WeaponOwned,
                oldweaponsowned,
                DoomInfo.WeaponInfos.Length);

            random = new DoomRandom();
        }
Beispiel #6
0
 public QuitConfirm(DoomMenu menu, DoomApplication app) : base(menu)
 {
     this.app = app;
     random   = new DoomRandom(DateTime.Now.Millisecond);
     endCount = -1;
 }
Beispiel #7
0
        public World(CommonResource resorces, GameOptions options, DoomGame game)
        {
            this.options = options;
            this.game    = game;

            if (game != null)
            {
                random = game.Random;
            }
            else
            {
                random = new DoomRandom();
            }

            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);
        }
Beispiel #8
0
        public World(CommonResource resorces, GameOptions options, Player[] players)
        {
            Options = options;
            Players = players;

            map = new Map(resorces, this);

            random = options.Random;

            validCount = 0;

            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);

            totalKills              = 0;
            totalItems              = 0;
            totalSecrets            = 0;
            options.wminfo.maxFrags = 0;
            options.wminfo.ParTime  = 180;
            for (var i = 0; i < Player.MaxPlayerCount; i++)
            {
                players[i].KillCount   = 0;
                players[i].SecretCount = 0;
                players[i].ItemCount   = 0;
            }

            // Initial height of PointOfView
            // will be set by player think.
            players[consoleplayer].ViewZ = new Fixed(1);

            LoadThings();

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

            SpawnSpecials();
        }