private static void InitializeEmptyFloor() { tiles = new DomainTileCombo[1536]; for (int i = 0; i < tiles.Length; i++) { tiles[i] = new DomainTileCombo(new Vector2(i % GridSize.x, (int)Math.Floor((double)i / GridSize.x)), 0x88); } }
public static void UpdateTile(Vector2 position, Tile.DomainTileTypeOld tileType) { Color tileColour = Tile.TileTypeColourOld[tileType]; //TODO: This needs to update the actual tile too, not just the displayed pixel DomainTileCombo selectedCombo = tiles.FirstOrDefault(o => o.leftTile.Position == position); Tile selectedTile = null; if (selectedCombo == null) { selectedCombo = tiles.FirstOrDefault(o => o.rightTile.Position == position); selectedTile = selectedCombo.rightTile; } else { selectedTile = selectedCombo.leftTile; } byte currentByteValue = selectedCombo.TileValueDec; if (selectedTile.Position.x % 2 == 0) { //we've got the left tile, meaning we need to set the right nibblet currentByteValue = (byte)((currentByteValue & 0xF0) | (byte)selectedTile.GetTileTypeBasedOnColour(tileColour)); } else { currentByteValue = (byte)((currentByteValue & 0x0F) | ((byte)selectedTile.GetTileTypeBasedOnColour(tileColour) << 0x04)); //With the right tile we need to edit the right nibblet } selectedCombo.TileValueDec = currentByteValue; selectedCombo.TileValueHex = currentByteValue.ToString("X2"); //byte b = 0x11; //var nibbleValue = 0x02; //b = (byte)((b & 0xF0) | nibbleValue); //b = (byte)((b & 0x0F) | (nibbleValue << 0x04)); for (int i = 0; i < tileSize; i++) { for (int j = 0; j < tileSize; j++) { //floorLayoutLayer.SetPixel((position.x * tileSize) + i, (position.y * tileSize) + j, tileColour); //floorLayoutLayer.SetPixel((position.x * tileSize) + i, (position.y * tileSize) + j, tileColour); floorLayoutLayer.SetPixel((position.x * tileSize) + i, (position.y * tileSize) + j, tileColour); } } DigimonWorld2ToolForm.EditorLayoutRenderTab.MapRenderLayer.Image = floorLayoutLayer; }