private unsafe Tile[] ReadLandBlock(int x, int y) { this.m_Map.Seek((long)((x * this.m_BlockHeight + y) * 196 + 4), SeekOrigin.Begin); Tile[] tileArray = new Tile[64]; fixed(Tile *tilePtr = &tileArray[0]) TileMatrix._lread(this.m_Map.Handle, (void *)tilePtr, 192); return(tileArray); }
private unsafe HuedTile[][][] ReadStaticBlock(int x, int y) { this.m_IndexReader.BaseStream.Seek((long)((x * this.m_BlockHeight + y) * 12), SeekOrigin.Begin); int num = this.m_IndexReader.ReadInt32(); int num1 = this.m_IndexReader.ReadInt32(); if (num < 0 || num1 <= 0) { return(this.m_EmptyStaticBlock); } int num2 = num1 / 7; this.m_Statics.Seek((long)num, SeekOrigin.Begin); fixed(StaticTile *staticTilePointer = &(new StaticTile[num2])[0]) { TileMatrix._lread(this.m_Statics.Handle, staticTilePointer, num1); if (TileMatrix.m_Lists == null) { TileMatrix.m_Lists = new HuedTileList[8][]; for (int i = 0; i < 8; i++) { TileMatrix.m_Lists[i] = new HuedTileList[8]; for (int j = 0; j < 8; j++) { TileMatrix.m_Lists[i][j] = new HuedTileList(); } } } HuedTileList[][] mLists = TileMatrix.m_Lists; StaticTile * staticTilePointer1 = staticTilePointer; StaticTile * staticTilePointer2 = staticTilePointer + num2 * sizeof(StaticTile); while (staticTilePointer1 < staticTilePointer2) { mLists[(*staticTilePointer1).m_X & 7][(*staticTilePointer1).m_Y & 7].Add((short)(((*staticTilePointer1).m_ID & 16383) + 16384), (*staticTilePointer1).m_Hue, (*staticTilePointer1).m_Z); staticTilePointer1 = staticTilePointer1 + sizeof(StaticTile); } HuedTile[][][] array = new HuedTile[8][][]; for (int k = 0; k < 8; k++) { array[k] = new HuedTile[8][]; for (int l = 0; l < 8; l++) { array[k][l] = mLists[k][l].ToArray(); } } return(array); } }
private unsafe HuedTile[][][] ReadStaticBlock(int x, int y) { this.m_IndexReader.BaseStream.Seek((long)((x * this.m_BlockHeight + y) * 12), SeekOrigin.Begin); int num = this.m_IndexReader.ReadInt32(); int wBytes = this.m_IndexReader.ReadInt32(); if (num < 0 || wBytes <= 0) { return(this.m_EmptyStaticBlock); } int length = wBytes / 7; this.m_Statics.Seek((long)num, SeekOrigin.Begin); fixed(StaticTile *staticTilePtr1 = &new StaticTile[length][0]) { TileMatrix._lread(this.m_Statics.Handle, (void *)staticTilePtr1, wBytes); if (TileMatrix.m_Lists == null) { TileMatrix.m_Lists = new HuedTileList[8][]; for (int index1 = 0; index1 < 8; ++index1) { TileMatrix.m_Lists[index1] = new HuedTileList[8]; for (int index2 = 0; index2 < 8; ++index2) { TileMatrix.m_Lists[index1][index2] = new HuedTileList(); } } } HuedTileList[][] huedTileListArray = TileMatrix.m_Lists; StaticTile * staticTilePtr2 = staticTilePtr1; for (StaticTile *staticTilePtr3 = staticTilePtr1 + length; staticTilePtr2 < staticTilePtr3; ++staticTilePtr2) { huedTileListArray[(int)staticTilePtr2->m_X & 7][(int)staticTilePtr2->m_Y & 7].Add((short)(((int)staticTilePtr2->m_ID & 16383) + 16384), staticTilePtr2->m_Hue, staticTilePtr2->m_Z); } HuedTile[][][] huedTileArray = new HuedTile[8][][]; for (int index1 = 0; index1 < 8; ++index1) { huedTileArray[index1] = new HuedTile[8][]; for (int index2 = 0; index2 < 8; ++index2) { huedTileArray[index1][index2] = huedTileListArray[index1][index2].ToArray(); } } return(huedTileArray); } }