public GetPendingStatics ( int blockx, int blocky ) : Ultima.StaticTile[] | ||
blockx | int | |
blocky | int | |
return | Ultima.StaticTile[] |
private unsafe short[] RenderBlock(int x, int y, bool drawStatics, bool diff) { var data = new short[64]; Tile[] tiles = m_Tiles.GetLandBlock(x, y, diff); fixed(short *pColors = RadarCol.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, diff) : 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; bool highstatic = false; 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->ID]; if (top > highTop || (z > highZ && top >= highTop)) { highTop = top; highZ = z; highID = pStatics->ID; highHue = pStatics->Hue; highstatic = true; } ++pStatics; } } } StaticTile[] pending = m_Tiles.GetPendingStatics(x, y); if (pending != null) { foreach (StaticTile penS in pending) { if (penS.m_X == p) { if (penS.m_Y == k) { z = penS.m_Z; top = z + pHeight[penS.m_ID]; if (top > highTop || (z > highZ && top >= highTop)) { highTop = top; highZ = z; highID = penS.m_ID; highHue = penS.m_Hue; highstatic = true; } } } } } top = pTiles->m_Z; if (top > highTop) { highID = pTiles->m_ID; highHue = 0; highstatic = false; } if (highHue == 0) { try { if (highstatic) { *pvData++ = pColors[highID + 0x4000]; } else { *pvData++ = pColors[highID]; } } catch { } } else { *pvData++ = Hues.GetHue(highHue - 1).Colors[(pColors[highID + 0x4000] >> 10) & 0x1F]; } ++pTiles; } } } else { Tile *pEnd = pTiles + 64; while (pTiles < pEnd) { *pvData++ = pColors[(pTiles++)->m_ID]; } } } } } } return(data); }
private unsafe short[] RenderBlock(int x, int y, bool drawStatics, bool diff) { var data = new short[64]; Tile[] tiles = _tiles.GetLandBlock(x, y, diff); fixed(short *pColors = RadarCol.Colors) { fixed(int *pHeight = TileData.HeightTable) fixed(Tile * ptTiles = tiles) { Tile *pTiles = ptTiles; fixed(short *pData = data) { short *pvData = pData; if (drawStatics) { HuedTile[][][] statics = _tiles.GetStaticBlock(x, y, diff); for (int k = 0; k < 8; ++k) { for (int p = 0; p < 8; ++p) { int highTop = -255; int highZ = -255; int highId = 0; int highHue = 0; int z, top; bool highStatic = false; 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->Z; top = z + pHeight[pStatics->Id]; if (top > highTop || (z > highZ && top >= highTop)) { highTop = top; highZ = z; highId = pStatics->Id; highHue = pStatics->Hue; highStatic = true; } ++pStatics; } } } StaticTile[] pending = _tiles.GetPendingStatics(x, y); if (pending != null) { foreach (StaticTile penS in pending) { if (penS.X != p || penS.Y != k) { continue; } z = penS.Z; top = z + pHeight[penS.Id]; if (top <= highTop && (z <= highZ || top < highTop)) { continue; } highTop = top; highZ = z; highId = penS.Id; highHue = penS.Hue; highStatic = true; } } top = pTiles->Z; if (top > highTop) { highId = pTiles->Id; highHue = 0; highStatic = false; } if (highHue == 0) { try { if (highStatic) { *pvData++ = pColors[highId + 0x4000]; } else { *pvData++ = pColors[highId]; } } catch { // TODO: ignored? // ignored } } else { *pvData++ = Hues.GetHue(highHue - 1) .Colors[(pColors[highId + 0x4000] >> 10) & 0x1F]; } ++pTiles; } } } else { Tile *pEnd = pTiles + 64; while (pTiles < pEnd) { *pvData++ = pColors[(pTiles++)->Id]; } } } } } return(data); }