protected static void drawRoom(ByteChunk chunk, Room[][][] rooms, int floor, boolean topFloor, int x, int z, 
			int roomOffsetX, int roomOffsetZ, int baseY, byte matFloor, byte matWall, byte matRoof) {
		//TODO I think this function suffers from the North = West problem
		// which room?
		Room room = rooms[floor][x][z];
		boolean northRoom = x != 0;
		boolean eastRoom = z != 0;
		
		// is there really something here?
		if (!room.Missing) {
			int x1 = roomOffsetX - (northRoom ? 0 : room.SizeX);
			int x2 = roomOffsetX + (northRoom ? room.SizeX : 0);
			int z1 = roomOffsetZ - (eastRoom ? 0 : room.SizeZ);
			int z2 = roomOffsetZ + (eastRoom ? room.SizeZ : 0);
			int y1 = baseY + floor * Generator.floorHeight;
			int y2 = y1 + Generator.floorHeight - 1;

			// draw the walls
			chunk.setBlocks(x1, x1 + 1, y1, y2, z1, z2 + 1, matWall);
			chunk.setBlocks(x2, x2 + 1, y1, y2, z1, z2 + 1, matWall);
			chunk.setBlocks(x1, x2 + 1, y1, y2, z1, z1 + 1, matWall);
			chunk.setBlocks(x1, x2 + 1, y1, y2, z2, z2 + 1, matWall);
			
			// add rug and roof
			chunk.setBlocks(x1, x2 + 1, y1 - 1, y1, z1, z2 + 1, matFloor);
			if (!topFloor) {
				chunk.setBlocks(x1, x2 + 1, y2, y2 + 1, z1, z2 + 1, matRoof);
				chunk.setBlocks(x1 + 1, x2 + 1 - 1, y2, y2 + 1, z1 + 1, z2 + 1 - 1, matRoof);
			} else
				chunk.setBlocks(x1 - 1, x2 + 2, y2, y2 + 1, z1 - 1, z2 + 2, matRoof);
			
			if (northRoom) {
				if (eastRoom) {
					chunk.setBlocks(x1 + 2, y1, 	y2 - 1, z1, 	byteAir); // west
					chunk.setBlocks(x1, 	y1, 	y2 - 1, z1 + 2, byteAir); // south
					chunk.setBlocks(x1 + 2, x2 - 1, y1 + 1, y2 - 1, z2, 	z2 + 1, byteGlass); // east
					chunk.setBlocks(x2, 	x2 + 1, y1 + 1, y2 - 1, z1 + 2, z2 - 1, byteGlass); // north
				} else {
					chunk.setBlocks(x1 + 2, y1, 	y2 - 1, z2, 	byteAir); // east
					chunk.setBlocks(x1, 	y1, 	y2 - 1, z2 - 2, byteAir); // south
					chunk.setBlocks(x1 + 2, x2 - 1, y1 + 1, y2 - 1, z1, 	z1 + 1, byteGlass); // west
					chunk.setBlocks(x2, 	x2 + 1,	y1 + 1, y2 - 1, z1 + 2, z2 - 1, byteGlass); // north
				}
			} else {
				if (eastRoom) {
					chunk.setBlocks(x2 - 2, y1, 	y2 - 1, z1, 	byteAir); // west
					chunk.setBlocks(x2, 	y1, 	y2 - 1, z1 + 2, byteAir); // north
					chunk.setBlocks(x1 + 2, x2 - 1, y1 + 1, y2 - 1, z2, 	z2 + 1, byteGlass); // east
					chunk.setBlocks(x1, 	x1 + 1, y1 + 1, y2 - 1, z1 + 2, z2 - 1, byteGlass); // south
				} else {
					chunk.setBlocks(x2 - 2, y1, 	y2 - 1, z2, 	byteAir); // east
					chunk.setBlocks(x2, 	y1, 	y2 - 1, z2 - 2, byteAir); // north
					chunk.setBlocks(x1 + 2, x2 - 1, y1 + 1, y2 - 1, z1, 	z1 + 1, byteGlass); // west
					chunk.setBlocks(x1, 	x1 + 1, y1 + 1, y2 - 1, z1 + 2, z2 - 1, byteGlass); // south
				}
			}
		}
	}