private unsafe short[] RenderBlock(int x, int y, bool drawStatics) { short[] data = new short[64]; Tile[] tiles = m_Tiles.GetLandBlock(x, y); fixed(short *pColors = m_Colors) { fixed(int *pHeight = TileData.HeightTable) { fixed(Tile *ptTiles = tiles) { Tile *pTiles = ptTiles; fixed(short *pData = data) { short *pvData = pData; if (drawStatics) { HuedTile[][][] statics = drawStatics ? m_Tiles.GetStaticBlock(x, y) : null; for (int k = 0, v = 0; k < 8; ++k, v += 8) { for (int p = 0; p < 8; ++p) { int highTop = -255; int highZ = -255; int highID = 0; int highHue = 0; int z, top; HuedTile[] curStatics = statics[p][k]; if (curStatics.Length > 0) { fixed(HuedTile *phtStatics = curStatics) { HuedTile *pStatics = phtStatics; HuedTile *pStaticsEnd = pStatics + curStatics.Length; while (pStatics < pStaticsEnd) { z = pStatics->m_Z; top = z + pHeight[pStatics->m_ID & 0x3FFF]; if (top > highTop || (z > highZ && top >= highTop)) { highTop = top; highZ = z; highID = pStatics->m_ID; highHue = pStatics->m_Hue; } ++pStatics; } } } top = pTiles->m_Z; if (top > highTop) { highID = pTiles->m_ID; highHue = 0; } if (highHue == 0) { *pvData++ = pColors[highID]; } else { *pvData++ = Hues.GetHue(highHue - 1).Colors[(pColors[highID] >> 10) & 0x1F]; } ++pTiles; } } } else { Tile *pEnd = pTiles + 64; while (pTiles < pEnd) { *pvData++ = pColors[(pTiles++)->m_ID]; } } } } } } return(data); }