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. if (blueprint != null) { blueprint.Supported = Supported; } this.Rooms = new VMRoomMap[Stories]; this.Terrain = new VMArchitectureTerrain(width, height); 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 VMRoomMap(); } this.RoomData = new List <VMRoom>(); this.WorldUI = blueprint; this.Commands = new List <VMArchitectureCommand>(); this.Commands = new List <VMArchitectureCommand>(); WallsDirty = true; FloorsDirty = true; RealMode = true; Redraw = true; }
public virtual void Load(VMArchitectureMarshal input) { Width = input.Width; Height = input.Height; Stories = input.Stories; Terrain = input.Terrain; Walls = input.Walls; Floors = input.Floors; RoofPitch = input.RoofPitch; RoofStyle = input.RoofStyle; RegenWallsAt(); SignalTerrainRedraw(); }
public void Deserialize(BinaryReader reader) { Width = reader.ReadInt32(); Height = reader.ReadInt32(); Stories = reader.ReadInt32(); Terrain = new VMArchitectureTerrain(Width, Height); Terrain.Version = Version; if (Version > 6) { Terrain.Deserialize(reader); } var size = Width * Height; Walls = new WallTile[Stories][]; for (int l = 0; l < Stories; l++) { Walls[l] = new WallTile[size]; for (int i = 0; i < size; i++) { Walls[l][i] = WallTileSerializer.Deserialize(reader); } } Floors = new FloorTile[Stories][]; for (int l = 0; l < Stories; l++) { Floors[l] = new FloorTile[size]; for (int i = 0; i < size; i++) { Floors[l][i] = new FloorTile { Pattern = reader.ReadUInt16() } } ; } WallsDirty = reader.ReadBoolean(); FloorsDirty = reader.ReadBoolean(); if (Version > 13) { RoofStyle = reader.ReadUInt32(); RoofPitch = reader.ReadSingle(); } }
public virtual void Load(VMArchitectureMarshal input) { Width = input.Width; Height = input.Height; Stories = input.Stories; Terrain = input.Terrain; Walls = input.Walls; Floors = input.Floors; FineBuildableArea = input.FineBuildableArea; if (VM.UseWorld) { WorldUI.FineArea = FineBuildableArea; } RoofPitch = input.RoofPitch; RoofStyle = input.RoofStyle; BuildBuyEnabled = input.BuildBuyEnabled; RegenWallsAt(); SignalTerrainRedraw(); }
public void Deserialize(BinaryReader reader) { Width = reader.ReadInt32(); Height = reader.ReadInt32(); Stories = reader.ReadInt32(); Terrain = new VMArchitectureTerrain(Width, Height); Terrain.Version = Version; if (Version > 6) { Terrain.Deserialize(reader); } var size = Width * Height; Walls = new WallTile[Stories][]; for (int l = 0; l < Stories; l++) { Walls[l] = new WallTile[size]; for (int i = 0; i < size; i++) { Walls[l][i] = WallTileSerializer.Deserialize(reader); } } Floors = new FloorTile[Stories][]; for (int l = 0; l < Stories; l++) { Floors[l] = new FloorTile[size]; for (int i = 0; i < size; i++) { Floors[l][i] = new FloorTile { Pattern = reader.ReadUInt16() } } ; } WallsDirty = reader.ReadBoolean(); FloorsDirty = reader.ReadBoolean(); if (Version > 13) { RoofStyle = reader.ReadUInt32(); RoofPitch = reader.ReadSingle(); } if (Version > 21) { var hasIDMap = reader.ReadBoolean(); if (hasIDMap) { IDMap = new VMResourceIDMarshal(); IDMap.Deserialize(reader); } } if (Version > 22) { var hasFineBuild = reader.ReadBoolean(); if (hasFineBuild) { FineBuildableArea = reader.ReadBytes(size).Select(x => x > 0).ToArray(); } } if (Version > 25) { BuildBuyEnabled = reader.ReadBoolean(); } }