public EntireMapsIndex clone() { EntireMapsIndex ans = new EntireMapsIndex(); ans.data = this.data.Clone() as int[][]; return(ans); }
public EntireMapsIndex generateMapIndex(int mapIndex, loader tileObj, maps mapObj) { int x = mapObj.mapX[mapIndex]; int y = mapObj.mapY[mapIndex]; int tileW = tileObj.tileWidth; int tileH = tileObj.tileHeight; EntireMapsIndex ans = new EntireMapsIndex(); ans.data = new int[y][]; for (int i = 0; i < y; i++) { ans.data[i] = new int[x]; } //Bitmap mapImage = new Bitmap(x * tileW, y * tileH); //Image tempImg = mapImage; for (int i = 0; i < x * y; i++) //y-1 to skip last row { int currPos = i; int currRow = 0; int typeIndex = mapObj.mapData[mapIndex][i]; int tileIndex = mapObj.mapDataIndices[mapIndex][i]; //True img is the index of tiles directly from the file.dat (but stored inside an array) int trueImgIndex = mapObj.DTileIndices[typeIndex][tileIndex]; while (currPos >= x) //x-1 to skip last column { currPos -= x; currRow += 1; } ans.data[currRow][currPos] = trueImgIndex; /*g.DrawImage(tileObj.tiles[trueImgIndex], new Rectangle(currPos * tileW, currRow * tileH, tileW, tileH), // destination rectangle * 0, // source rectangle x * 0, // source rectangle y * tileW, // source rectangle width * tileH, // source rectangle height * GraphicsUnit.Pixel);*/ } return(ans); }