Beispiel #1
0
        public void InitBlueprint(Blueprint blueprint)
        {
            this.Blueprint = blueprint;
            _2DWorld.Init(blueprint);
            _3DWorld.Init(blueprint);

            HasInitBlueprint = true;
            HasInit = HasInitGPU & HasInitBlueprint;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        public Blueprint LoadFromXML(XmlHouseData model)
        {
            this.Blueprint = new Blueprint(model.Size, model.Size);
            VM.Context.Blueprint = Blueprint;
            VM.Context.Architecture = new VMArchitecture(model.Size, model.Size, Blueprint, VM.Context);

            var arch = VM.Context.Architecture;

            foreach (var floor in model.World.Floors){
                arch.SetFloor(floor.X, floor.Y, (sbyte)(floor.Level+1), new FloorTile { Pattern = (ushort)floor.Value }, true);
            }

            foreach (var wall in model.World.Walls)
            {
                arch.SetWall((short)wall.X, (short)wall.Y, (sbyte)(wall.Level+1), new WallTile() //todo: these should read out in their intended formats - a cast shouldn't be necessary
                {
                    Segments = wall.Segments,
                    TopLeftPattern = (ushort)wall.TopLeftPattern,
                    TopRightPattern = (ushort)wall.TopRightPattern,
                    BottomLeftPattern = (ushort)wall.BottomLeftPattern,
                    BottomRightPattern = (ushort)wall.BottomRightPattern,
                    TopLeftStyle = (ushort)wall.LeftStyle,
                    TopRightStyle = (ushort)wall.RightStyle
                });
            }
            arch.RegenRoomMap();
            VM.Context.RegeneratePortalInfo();

            foreach (var obj in model.Objects)
            {
                //if (obj.Level == 0) continue;
                //if (obj.GUID == "0xE9CEB12F") obj.GUID = "0x01A0FD79"; //replace onlinejobs door with a normal one
                //if (obj.GUID == "0x346FE2BC") obj.GUID = "0x98E0F8BD"; //replace kitchen door with a normal one
                CreateObject(obj);
            }

            foreach (var obj in model.Sounds) {
                VM.Context.Ambience.SetAmbience(VM.Context.Ambience.GetAmbienceFromGUID(obj.ID), (obj.On == 1));
            }

            var testObject = new XmlHouseDataObject(); //test npc controller, not normally present on a job lot.
            testObject.GUID = "0x70F69082";
            testObject.X = 0;
            testObject.Y = 0;
            testObject.Level = 1;
            testObject.Dir = 0;
            CreateObject(testObject);

            Blueprint.Terrain = CreateTerrain(model);
            World.State.WorldSize = model.Size;

            arch.Tick();
            return this.Blueprint;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        public Blueprint LoadFromXML(XmlHouseData model)
        {
            this.Blueprint = new Blueprint(model.Size, model.Size);
            foreach (var obj in model.Objects.Where(x => x.Level == 1)){
                CreateObject(obj);
            }
            foreach (var floor in model.World.Floors.Where(x => x.Level == 0)){
                Blueprint.SetFloor(floor.X, floor.Y, new FloorComponent() { FloorID = (ushort)floor.Value });
            }

            Blueprint.Terrain = CreateTerrain(model);
            World.State.WorldSize = model.Size;
            return this.Blueprint;
        }
        public VMArchitecture(int width, int height, Blueprint blueprint, VMContext context)
        {
            this.Context = context;
            this.Width = width;
            this.Height = height;

            var numTiles = width * height;
            this.WallsAt = new List<int>[Stories];
            this.Walls = new WallTile[Stories][];
            this.VisWalls = new WallTile[Stories][];

            this.Floors = new FloorTile[Stories][];
            this.VisFloors = new FloorTile[Stories][];

            this.ObjectSupport = new bool[Stories][]; //true if there's an object support in the specified position
            this.Supported = new bool[Stories-1][]; //no supported array for bottom floor. true if this tile is supported.
            blueprint.Supported = Supported;

            this.Rooms = new RoomMap[Stories];

            for (int i = 0; i < Stories; i++)
            {
                this.WallsAt[i] = new List<int>();
                this.Walls[i] = new WallTile[numTiles];
                this.VisWalls[i] = new WallTile[numTiles];

                this.Floors[i] = new FloorTile[numTiles];
                this.VisFloors[i] = new FloorTile[numTiles];
                this.ObjectSupport[i] = new bool[numTiles];

                if (i<Stories-1) this.Supported[i] = new bool[numTiles];

                this.Rooms[i] = new RoomMap();
            }

            this.RoomData = new List<BlueprintRoom>();
            this.WorldUI = blueprint;

            this.Commands = new List<VMArchitectureCommand>();
            this.Commands = new List<VMArchitectureCommand>();

            WallsDirty = true;
            FloorsDirty = true;
            RealMode = true;
            Redraw = true;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        public Blueprint LoadFromXML(XmlHouseData model)
        {
            this.Blueprint = new Blueprint(model.Size, model.Size);
            foreach (var obj in model.Objects.Where(x => x.Level == 1)){
                CreateObject(obj);
            }
            foreach (var floor in model.World.Floors.Where(x => x.Level == 0)){
                Blueprint.SetFloor(floor.X, floor.Y, new FloorComponent() { FloorID = (ushort)floor.Value });
            }

            var testAquarium = new XmlHouseDataObject(); //used to create an aquarium to test with on the lot. remove this before final! (cant be giving out free aquariums!!)
            testAquarium.GUID = "0x98E0F8BD";
            testAquarium.X = 32;
            testAquarium.Y = 53;
            testAquarium.Level = 1;
            testAquarium.Dir = 4;
            CreateObject(testAquarium);

            Blueprint.Terrain = CreateTerrain(model);
            World.State.WorldSize = model.Size;
            return this.Blueprint;
        }
Beispiel #6
0
 public void Init(Blueprint blueprint)
 {
     this.Blueprint = blueprint;
 }
 private bool OffsetValid(Vector3 off, Blueprint blueprint)
 {
     return off.X >= 0 && off.Y >= 0 && off.X < blueprint.Width && off.Y < blueprint.Height;
 }
Beispiel #8
0
 public void Init(Blueprint blueprint)
 {
     this.Blueprint = blueprint;
     //this.TileInfo = new WorldTileRenderingInfo[blueprint.Width * blueprint.Height];
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        public Blueprint LoadFromXML(XmlHouseData model)
        {
            this.Blueprint = new Blueprint(model.Size, model.Size);
            VM.Context.Blueprint = Blueprint;

            foreach (var floor in model.World.Floors.Where(x => x.Level == 0)){
                Blueprint.SetFloor(floor.X, floor.Y, new FloorComponent() { FloorID = (ushort)floor.Value });
            }

            foreach (var wall in model.World.Walls.Where(x => x.Level == 0))
            {
                Blueprint.SetWall((short)wall.X, (short)wall.Y, new WallTile()
                {
                    Segments = wall.Segments,
                    TopLeftPattern = (ushort)wall.TopLeftPattern,
                    TopRightPattern = (ushort)wall.TopRightPattern,
                    BottomLeftPattern = (ushort)wall.BottomLeftPattern,
                    BottomRightPattern = (ushort)wall.BottomRightPattern,
                    TopLeftStyle = (ushort)wall.LeftStyle,
                    TopRightStyle = (ushort)wall.RightStyle
                });
            }
            Blueprint.RegenRoomMap();
            VM.Context.RegeneratePortalInfo();

            foreach (var obj in model.Objects.Where(x => x.Level == 1))
            {
                if (obj.GUID == "0xE3ABB5F3") obj.GUID = "0x01A0FD79"; //replace onlinejobs door with a normal one
                if (obj.GUID == "0x346FE2BC") obj.GUID = "0x98E0F8BD"; //replace kitchen door with a normal one
                CreateObject(obj);
            }

            foreach (var obj in model.Sounds) {
                VM.Context.Ambience.SetAmbience(VM.Context.Ambience.GetAmbienceFromGUID(obj.ID), (obj.On == 1));
            }

            var testAquarium = new XmlHouseDataObject(); //used to create an aquarium to test with on the lot. remove this before final! (cant be giving out free aquariums!!)
            testAquarium.GUID = "0x98E0F8BD";
            testAquarium.X = 33;
            testAquarium.Y = 57;
            testAquarium.Level = 1;
            testAquarium.Dir = 4;
            CreateObject(testAquarium);

            testAquarium = new XmlHouseDataObject(); //test stove
            testAquarium.GUID = "0xE542C148";
            testAquarium.X = 46;
            testAquarium.Y = 35;
            testAquarium.Level = 1;
            testAquarium.Dir = 1;
            CreateObject(testAquarium);

            testAquarium = new XmlHouseDataObject(); //parrot
            testAquarium.GUID = "0x03BB9D8A";
            testAquarium.X = 33;
            testAquarium.Y = 59;
            testAquarium.Level = 1;
            testAquarium.Dir = 4;
            CreateObject(testAquarium);

            var testCounter = new XmlHouseDataObject(); //test fridge
            testCounter.GUID = "0x675C18AF";
            testCounter.X = 34;
            testCounter.Y = 53;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test hat rack
            testCounter.GUID = "0x01DACE5C";
            testCounter.X = 36;
            testCounter.Y = 53;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test tp1
            testCounter.GUID = "0x96a776ce";
            testCounter.X = 40;
            testCounter.Y = 53;
            testCounter.Level = 1;
            testCounter.Dir = 0;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test Pet Gym
            testCounter.GUID = "0x3360D50A";
            testCounter.X = 10;
            testCounter.Y = 53;
            testCounter.Level = 1;
            testCounter.Dir = 0;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test tp2
            testCounter.GUID = "0x96a776ce";
            testCounter.X = 20;
            testCounter.Y = 53;
            testCounter.Level = 1;
            testCounter.Dir = 0;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test piano
            testCounter.GUID = "0x379EE047";
            testCounter.X = 20;
            testCounter.Y = 20;
            testCounter.Level = 1;
            testCounter.Dir = 2;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test limo
            testCounter.GUID = "0x9750EA9D";
            testCounter.X = 30;
            testCounter.Y = 30;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test Fountain
            testCounter.GUID = "0x3565E02A";
            testCounter.X = 20;
            testCounter.Y = 30;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test Aqu2
            testCounter.GUID = "0x2FC9B87D";
            testCounter.X = 35;
            testCounter.Y = 36;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            //tv arrangement

            testCounter = new XmlHouseDataObject(); //test tv
            testCounter.GUID = "0x5FA381C1";
            testCounter.X = 15;
            testCounter.Y = 45;
            testCounter.Level = 1;
            testCounter.Dir = 0;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test tv
            testCounter.GUID = "0x5FA381C1";
            testCounter.X = 16;
            testCounter.Y = 46;
            testCounter.Level = 1;
            testCounter.Dir = 2;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test tv
            testCounter.GUID = "0x5FA381C1";
            testCounter.X = 15;
            testCounter.Y = 47;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test tv
            testCounter.GUID = "0x5FA381C1";
            testCounter.X = 14;
            testCounter.Y = 46;
            testCounter.Level = 1;
            testCounter.Dir = 6;
            CreateObject(testCounter);

            //sofa
            //0x87D00ADC

            testCounter = new XmlHouseDataObject(); //test tv
            testCounter.GUID = "0x87D00ADC";
            testCounter.X = 20;
            testCounter.Y = 47;
            testCounter.Level = 1;
            testCounter.Dir = 6;
            CreateObject(testCounter);

            //end tv arrangement

            testCounter = new XmlHouseDataObject(); //test bed
            testCounter.GUID = "0x17579980";
            testCounter.X = 35;
            testCounter.Y = 45;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test mech bull
            testCounter.GUID = "0x5E8B157A";
            testCounter.X = 25;
            testCounter.Y = 40;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test hot tub
            testCounter.GUID = "0x8FED54C2";
            testCounter.X = 15;
            testCounter.Y = 40;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test pinball
            testCounter.GUID = "0x481A74EC";
            testCounter.X = 25;
            testCounter.Y = 45;
            testCounter.Level = 1;
            testCounter.Dir = 4;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test npc control
            testCounter.GUID = "0x70F69082";
            testCounter.X = 0;
            testCounter.Y = 0;
            testCounter.Level = 1;
            testCounter.Dir = 0;
            CreateObject(testCounter);

            testCounter = new XmlHouseDataObject(); //test pet carrier
            testCounter.GUID = "0x3278BD34";
            testCounter.X = 26;
            testCounter.Y = 41;
            testCounter.Level = 1;
            testCounter.Dir = 0;
            var objPet = CreateObject(testCounter);
            objPet.SetAttribute(1, 1); //open container

            /*var fsc = HIT.HITVM.Get().PlayFSC(TSO.Content.Content.Get().GetPath("sounddata\\ambience\\daybirds\\daybirds.fsc"));
            fsc = HIT.HITVM.Get().PlayFSC(TSO.Content.Content.Get().GetPath("sounddata\\ambience\\explosions\\explosions.fsc"));
            fsc = HIT.HITVM.Get().PlayFSC(TSO.Content.Content.Get().GetPath("sounddata\\ambience\\dog\\dog.fsc"));*/

            Blueprint.Terrain = CreateTerrain(model);
            World.State.WorldSize = model.Size;

            var rooms = new RoomMap();
            rooms.GenerateMap(Blueprint.Walls, Blueprint.Width, Blueprint.Height, 1);
            //rooms.PrintRoomMap();

            return this.Blueprint;
        }
Beispiel #10
0
 private void SetWallStyle(int side, Blueprint blueprint, ushort value)
 {
     //0=top right, 1=bottom right, 2=bottom left, 3 = top left
     WallTile targ;
     switch (side)
     {
         case 0:
             targ = blueprint.GetWall(WorldUI.TileX, WorldUI.TileY);
             targ.ObjSetTRStyle = value;
             if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & VMEntityFlags2.ArchitectualDoor) > 0) targ.TopRightDoor = true;
             blueprint.SetWall(WorldUI.TileX, WorldUI.TileY, 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;
             /*targ = blueprint.GetWall((short)(WorldUI.TileX+1), WorldUI.TileY);
             targ.ObjSetTLStyle = value;
             blueprint.SetWall((short)(WorldUI.TileX + 1), WorldUI.TileY, targ);
             break;*/
         case 2:
             return;
         case 3:
             targ = blueprint.GetWall(WorldUI.TileX, WorldUI.TileY);
             targ.ObjSetTLStyle = value;
             if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & VMEntityFlags2.ArchitectualDoor) > 0) targ.TopLeftDoor = true;
             blueprint.SetWall(WorldUI.TileX, WorldUI.TileY, targ);
             break;
     }
 }