コード例 #1
0
        private void InitAnimatedBack()
        {
            if (DoomApplication.Instance.IWad == "doom2" ||
                DoomApplication.Instance.IWad == "freedoom2" ||
                DoomApplication.Instance.IWad == "plutonia" ||
                DoomApplication.Instance.IWad == "tnt")
            {
                return;
            }

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

            if (this.animations == null)
            {
                this.animations = new Animation[AnimationInfo.Episodes[this.info.Episode].Count];

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

                this.random = new DoomRandom();
            }

            foreach (var animation in this.animations)
            {
                animation.Reset(this.bgCount);
            }
        }
コード例 #2
0
 public QuitConfirm(DoomMenu menu, DoomApplication app)
     : base(menu)
 {
     this.app      = app;
     this.random   = new DoomRandom(DateTime.Now.Millisecond);
     this.endCount = -1;
 }
コード例 #3
0
        public World(CommonResource resorces, GameOptions options, DoomGame game)
        {
            this.WorldEntity = EntityInfo.Create(this, EntityInfo.OfType <DoomEngine.Game.Entities.World>());

            this.options = options;
            this.game    = game;
            this.random  = game != null ? game.Random : new DoomRandom();

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

            options.IntermissionInfo.ParTime = 180;

            options.Player.KillCount   = 0;
            options.Player.SecretCount = 0;
            options.Player.ItemCount   = 0;

            // Initial height of view will be set by player think.
            options.Player.ViewZ = Fixed.Epsilon;

            this.totalKills   = 0;
            this.totalItems   = 0;
            this.totalSecrets = 0;

            this.LoadThings();

            this.statusBar = new StatusBar(this);

            this.specials.SpawnSpecials();

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

            this.validCount = 0;

            options.Music.StartMusic(Map.GetMapBgm(options), true);
        }
コード例 #4
0
        public DoomGame(CommonResource resource, GameOptions options)
        {
            this.resource = resource;
            this.options  = options;

            this.gameAction = GameAction.Nothing;

            this.gameTic = 0;
            this.random  = new DoomRandom();
        }
コード例 #5
0
        public StatusBar(World world)
        {
            this.world = world;

            this.oldHealth = -1;
            this.oldWeaponsOwned.Clear();

            this.oldWeaponsOwned.AddRange(
                world.Options.Player.Entity.GetComponent <InventoryComponent>().Items.Where(item => item.GetComponent <WeaponComponent>() != null)
                );

            this.faceCount      = 0;
            this.faceIndex      = 0;
            this.randomNumber   = 0;
            this.priority       = 0;
            this.lastAttackDown = -1;
            this.lastPainOffset = 0;

            this.random = new DoomRandom();
        }
コード例 #6
0
        public SfmlSound(Config config, Wad wad)
        {
            try
            {
                Console.Write("Initialize sound: ");

                this.config = config;

                config.audio_soundvolume = Math.Clamp(config.audio_soundvolume, 0, MaxVolume);

                buffers    = new SoundBuffer[DoomInfo.SfxNames.Length];
                amplitudes = new float[DoomInfo.SfxNames.Length];

                if (config.audio_randompitch)
                {
                    random = new DoomRandom();
                }

                for (var i = 0; i < DoomInfo.SfxNames.Length; i++)
                {
                    var name = DoomInfo.SfxNames[i];
                    var lump = wad.GetLumpNumber(name);
                    if (lump == -1)
                    {
                        continue;
                    }

                    int sampleRate;
                    int sampleCount;
                    var samples = GetSamples(wad, name, out sampleRate, out sampleCount);
                    if (samples != null)
                    {
                        buffers[i]    = new SoundBuffer(samples, 1, (uint)sampleRate);
                        amplitudes[i] = GetAmplitude(samples, sampleRate, sampleCount);
                    }
                }

                channels = new Sound[channelCount];
                infos    = new ChannelInfo[channelCount];
                for (var i = 0; i < channels.Length; i++)
                {
                    channels[i] = new Sound();
                    infos[i]    = new ChannelInfo();
                }

                uiChannel  = new Sound();
                uiReserved = Sfx.NONE;

                masterVolumeDecay = (float)config.audio_soundvolume / MaxVolume;

                lastUpdate = DateTime.MinValue;

                Console.WriteLine("OK");
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed");
                Dispose();
                ExceptionDispatchInfo.Throw(e);
            }
        }
コード例 #7
0
ファイル: WipeEffect.cs プロジェクト: sinshu/managed-doom
 public WipeEffect(int width, int height)
 {
     y           = new short[width];
     this.height = height;
     random      = new DoomRandom(DateTime.Now.Millisecond);
 }
コード例 #8
0
        public SfmlSound(Config config)
        {
            try
            {
                Console.Write("Initialize sound: ");

                this.config = config;

                config.audio_soundvolume = Math.Clamp(config.audio_soundvolume, 0, this.MaxVolume);

                this.buffers    = new SoundBuffer[DoomInfo.SfxNames.Length];
                this.amplitudes = new float[DoomInfo.SfxNames.Length];

                if (config.audio_randompitch)
                {
                    this.random = new DoomRandom();
                }

                for (var i = 0; i < DoomInfo.SfxNames.Length; i++)
                {
                    var name = "DS" + DoomInfo.SfxNames[i];

                    if (!DoomApplication.Instance.FileSystem.Exists(name))
                    {
                        continue;
                    }

                    int sampleRate;
                    int sampleCount;
                    var samples = SfmlSound.GetSamples(name, out sampleRate, out sampleCount);

                    if (samples != null)
                    {
                        this.buffers[i]    = new SoundBuffer(samples, 1, (uint)sampleRate);
                        this.amplitudes[i] = SfmlSound.GetAmplitude(samples, sampleRate, sampleCount);
                    }
                }

                this.channels = new Sound[SfmlSound.channelCount];
                this.infos    = new ChannelInfo[SfmlSound.channelCount];

                for (var i = 0; i < this.channels.Length; i++)
                {
                    this.channels[i] = new Sound();
                    this.infos[i]    = new ChannelInfo();
                }

                this.uiChannel  = new Sound();
                this.uiReserved = Sfx.NONE;

                this.masterVolumeDecay = (float)config.audio_soundvolume / this.MaxVolume;

                this.lastUpdate = DateTime.MinValue;

                Console.WriteLine("OK");
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed");
                this.Dispose();
                ExceptionDispatchInfo.Throw(e);
            }
        }
コード例 #9
0
ファイル: World.cs プロジェクト: MSylvia/DoomEngine
        public World(CommonResource resorces, GameOptions options, DoomGame game)
        {
            this.options = options;
            this.game    = game;

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

            this.map = new Map(resorces, this);

            this.thinkers         = new Thinkers(this);
            this.specials         = new Specials(this);
            this.thingAllocation  = new ThingAllocation(this);
            this.thingMovement    = new ThingMovement(this);
            this.thingInteraction = new ThingInteraction(this);
            this.mapCollision     = new MapCollision(this);
            this.mapInteraction   = new MapInteraction(this);
            this.pathTraversal    = new PathTraversal(this);
            this.hitscan          = new Hitscan(this);
            this.visibilityCheck  = new VisibilityCheck(this);
            this.sectorAction     = new SectorAction(this);
            this.playerBehavior   = new PlayerBehavior(this);
            this.itemPickup       = new ItemPickup(this);
            this.weaponBehavior   = new WeaponBehavior(this);
            this.monsterBehavior  = new MonsterBehavior(this);
            this.lightingChange   = new LightingChange(this);
            this.autoMap          = new AutoMap(this);
            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;

            this.totalKills   = 0;
            this.totalItems   = 0;
            this.totalSecrets = 0;

            this.LoadThings();

            this.statusBar = new StatusBar(this);

            // 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;
                        this.thingAllocation.DeathMatchSpawnPlayer(i);
                    }
                }
            }

            this.specials.SpawnSpecials();

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

            this.validCount = 0;

            this.displayPlayer = options.ConsolePlayer;

            options.Music.StartMusic(Map.GetMapBgm(options), true);
        }