Пример #1
0
        internal void SetWallStyle(int side,VMArchitecture arch,ushort value)
        {
            //0=top right, 1=bottom right, 2=bottom left, 3 = top left
            WallTile targ;

            switch (side)
            {
            case 0:
                targ = arch.GetWall(Position.TileX,Position.TileY,Position.Level);
                targ.ObjSetTRStyle = value;
                if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & VMEntityFlags2.ArchitectualDoor) > 0)
                {
                    targ.TopRightDoor = value != 0;
                }
                arch.SetWall(Position.TileX,Position.TileY,Position.Level,targ);
                break;

            case 1:
                //this seems to be the rule... only set if wall is top left/right. Fixes multitile windows (like really long ones)
                return;

            case 2:
                return;

            case 3:
                targ = arch.GetWall(Position.TileX,Position.TileY,Position.Level);
                targ.ObjSetTLStyle = value;
                if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & VMEntityFlags2.ArchitectualDoor) > 0)
                {
                    targ.TopLeftDoor = value != 0;
                }
                arch.SetWall(Position.TileX,Position.TileY,Position.Level,targ);
                break;
            }
        }
Пример #2
0
        internal void SetWallUse(VMArchitecture arch,bool set)
        {
            var wall = arch.GetWall(Position.TileX,Position.TileY,Position.Level);

            var  placeFlags = (WallPlacementFlags)ObjectData[(int)VMStackObjectVariable.WallPlacementFlags];
            int  rotate     = (8 - (DirectionToWallOff(Direction) + 1)) % 4;
            byte rotPart    = (byte)RotateWallSegs((WallSegments)((int)placeFlags % 15),rotate);

            SetValue(VMStackObjectVariable.WallAdjacencyFlags,(short)RotateWallSegs(wall.Segments,rotate));

            if (rotPart == 0)
            {
                return;
            }

            if (set)
            {
                wall.OccupiedWalls |= (WallSegments)rotPart;
            }
            else
            {
                wall.OccupiedWalls &= (WallSegments) ~rotPart;
            }

            arch.SetWall(Position.TileX,Position.TileY,Position.Level,wall);
        }
Пример #3
0
        private void WallsChanged(VMArchitecture caller)
        {
            RegeneratePortalInfo();

            //TODO: this could get very slow! find a way to make this quicker.
            foreach (var obj in VM.Entities)
            {
                if (obj is VMAvatar && obj.Thread != null)
                {
                    foreach (var frame in obj.Thread.Stack)
                    {
                        if (frame is VMRoutingFrame)
                        {
                            ((VMRoutingFrame)frame).InvalidateRoomRoute();
                        }
                    }
                }
            }
        }
Пример #4
0
        public virtual void Load(VMContextMarshal input)
        {
            Blueprint    = new Blueprint(input.Architecture.Width, input.Architecture.Height);
            Architecture = new VMArchitecture(input.Architecture, this, Blueprint);
            Clock        = new VMClock(input.Clock);

            if (VM.UseWorld)
            {
                foreach (var active in input.Ambience.ActiveSounds)
                {
                    Ambience.SetAmbience(active, true);
                }

                World.State.WorldSize = input.Architecture.Width;
                Blueprint.Terrain     = new TerrainComponent(new Rectangle(1, 1, input.Architecture.Width - 2, input.Architecture.Height - 2));
                Blueprint.Terrain.Initialize(this.World.State.Device, this.World.State);

                World.InitBlueprint(Blueprint);
            }

            RandomSeed = input.RandomSeed;
        }
Пример #5
0
        private void WallsChanged(VMArchitecture caller)
        {
            RegeneratePortalInfo();

            //TODO: this could get very slow! find a way to make this quicker.
            foreach (var obj in VM.Entities)
            {
                if (obj is VMAvatar)
                {
                    foreach (var frame in obj.Thread.Stack)
                    {
                        if (frame is VMRoutingFrame)
                        {
                            ((VMRoutingFrame)frame).InvalidateRoomRoute();
                        }
                    }
                }
            }
        }
Пример #6
0
        public virtual void Load(VMContextMarshal input)
        {
            Blueprint = new Blueprint(input.Architecture.Width, input.Architecture.Height);
            Architecture = new VMArchitecture(input.Architecture, this, Blueprint);
            Clock = new VMClock(input.Clock);

            if (VM.UseWorld)
            {
                foreach (var active in input.Ambience.ActiveSounds) Ambience.SetAmbience(active, true);

                World.State.WorldSize = input.Architecture.Width;
                Blueprint.Terrain = new TerrainComponent(new Rectangle(1, 1, input.Architecture.Width - 2, input.Architecture.Height - 2));
                Blueprint.Terrain.Initialize(this.World.State.Device, this.World.State);

                World.InitBlueprint(Blueprint);
            }

            RandomSeed = input.RandomSeed;
        }
Пример #7
0
        internal void SetWallUse(VMArchitecture arch, bool set)
        {
            var wall = arch.GetWall(Position.TileX, Position.TileY, Position.Level);

            var placeFlags = (WallPlacementFlags)ObjectData[(int)VMStackObjectVariable.WallPlacementFlags];
            int rotate = (8-(DirectionToWallOff(Direction) + 1)) % 4;
            byte rotPart = (byte)RotateWallSegs((WallSegments)((int)placeFlags%15), rotate);

            if (set) wall.OccupiedWalls |= (WallSegments)rotPart;
            else wall.OccupiedWalls &= (WallSegments)~rotPart;

            arch.SetWall(Position.TileX, Position.TileY, Position.Level, wall);
        }
Пример #8
0
 internal void SetWallStyle(int side, VMArchitecture arch, ushort value)
 {
     //0=top right, 1=bottom right, 2=bottom left, 3 = top left
     WallTile targ;
     switch (side)
     {
         case 0:
             targ = arch.GetWall(Position.TileX, Position.TileY, Position.Level);
             targ.ObjSetTRStyle = value;
             if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & VMEntityFlags2.ArchitectualDoor) > 0) targ.TopRightDoor = value != 0;
             arch.SetWall(Position.TileX, Position.TileY, Position.Level, targ);
             break;
         case 1:
             //this seems to be the rule... only set if wall is top left/right. Fixes multitile windows (like really long ones)
             return;
         case 2:
             return;
         case 3:
             targ = arch.GetWall(Position.TileX, Position.TileY, Position.Level);
             targ.ObjSetTLStyle = value;
             if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & VMEntityFlags2.ArchitectualDoor) > 0) targ.TopLeftDoor = value != 0;
             arch.SetWall(Position.TileX, Position.TileY, Position.Level, targ);
             break;
     }
 }
Пример #9
0
        internal void SetWallUse(VMArchitecture arch, bool set)
        {
            var wall = arch.GetWall(Position.TileX, Position.TileY, Position.Level);

            var placeFlags = (WallPlacementFlags)ObjectData[(int)VMStackObjectVariable.WallPlacementFlags];
            int rotate = (8-(DirectionToWallOff(Direction) + 1)) % 4;
            byte rotPart = (byte)RotateWallSegs((WallSegments)((int)placeFlags%15), rotate);
            SetValue(VMStackObjectVariable.WallAdjacencyFlags, (short)RotateWallSegs(wall.Segments, rotate));

            if (rotPart == 0) return;

            if (UseWorld) ((ObjectComponent)WorldUI).AdjacentWall = (WallSegments)rotPart;

            if (set) wall.OccupiedWalls |= (WallSegments)rotPart;
            else wall.OccupiedWalls &= (WallSegments)~rotPart;

            arch.SetWall(Position.TileX, Position.TileY, Position.Level, wall);
        }