Example #1
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);
        }
 public void OnSectorChanged(SectorAction action, int iSectorX, int iSectorY)
 {
     TerrainVisibilityZoneShape zone = GetZone(iSectorX, iSectorY);
       if (zone == null)
     return;
       switch (action)
       {
     case SectorAction.Reloaded:
       zone.CurrentStatus = action;
       zone.UpdateSectorBoundingBox();
       break;
     case SectorAction.Unloaded:
       zone.CurrentStatus = action;
       break;
     case SectorAction.Modified:
       zone.ViewBitmapDirty = true;
       break;
       }
 }
Example #3
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);
        }
Example #4
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();
        }