public Color GetColor(int index) { return(Hues.HueToColor(Colors[index])); }
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); }
private unsafe short[] RenderBlock(int x, int y, bool drawStatics) { int mID; HuedTile[][][] staticBlock; short[] numArray = new short[64]; Tile[] landBlock = this.m_Tiles.GetLandBlock(x, y); fixed(short *mColors = &Map.m_Colors[0]) { fixed(int *heightTable = &TileData.HeightTable[0]) { fixed(Tile *tilePointer = &landBlock[0]) { Tile *tilePointer1 = tilePointer; fixed(short *numPointer = &numArray[0]) { short *numPointer1 = numPointer; if (!drawStatics) { Tile *tilePointer2 = tilePointer1 + 64 * sizeof(Tile); while (tilePointer1 < tilePointer2) { short *mID1 = numPointer1; numPointer1 = mID1 + 2; Tile *tilePointer3 = tilePointer1; tilePointer1 = tilePointer3 + sizeof(Tile); *mID1 = (short)(*(mColors + (void *)(*tilePointer3).m_ID * 2)); } } else { if (drawStatics) { staticBlock = this.m_Tiles.GetStaticBlock(x, y); } else { staticBlock = null; } HuedTile[][][] huedTileArray = staticBlock; int num = 0; int num1 = 0; while (num < 8) { for (int i = 0; i < 8; i++) { int num2 = -255; int num3 = -255; int mID2 = 0; int mHue = 0; HuedTile[] huedTileArray1 = huedTileArray[i][num]; if ((int)huedTileArray1.Length > 0) { fixed(HuedTile *huedTilePointer = &huedTileArray1[0]) { HuedTile *huedTilePointer1 = huedTilePointer; HuedTile *length = huedTilePointer1 + (int)huedTileArray1.Length * sizeof(HuedTile); while (huedTilePointer1 < length) { int mZ = (*huedTilePointer1).m_Z; mID = mZ + *(heightTable + ((*huedTilePointer1).m_ID & 16383) * 4); if (mID > num2 || mZ > num3 && mID >= num2) { num2 = mID; num3 = mZ; mID2 = (*huedTilePointer1).m_ID; mHue = (*huedTilePointer1).m_Hue; } huedTilePointer1 = huedTilePointer1 + sizeof(HuedTile); } } } mID = (*tilePointer1).m_Z; if (mID > num2) { mID2 = (*tilePointer1).m_ID; mHue = 0; } if (mHue != 0) { short *colors = numPointer1; numPointer1 = colors + 2; *colors = Hues.GetHue(mHue - 1).Colors[*(mColors + mID2 * 2) >> 10 & 31]; } else { short *numPointer2 = numPointer1; numPointer1 = numPointer2 + 2; *numPointer2 = *(mColors + mID2 * 2); } tilePointer1 = tilePointer1 + sizeof(Tile); } num++; num1 = num1 + 8; } } } } } } return(numArray); }
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); }
public static Map Trammel(RadarCol radarCol, TileData tileData, Hues hues, Files files, Art art) { return(new Map(0, 1, 6144, 4096, radarCol, tileData, hues, files, art)); }
public static Map Ilshenar(RadarCol radarCol, TileData tileData, Hues hues, Files files, Art art) { return(new Map(2, 2, 2304, 1600, radarCol, tileData, hues, files, art)); }
public Map(string path, int fileIndex, int mapID, int width, int height, RadarCol radarCol, TileData tileData, Hues hues, Files files, Art art) { m_FileIndex = fileIndex; m_MapID = mapID; m_Width = width; m_Height = height; this._RadarCol = radarCol; this._TileData = tileData; this._Hues = hues; m_path = path; _files = files; _Art = art; }
public static Map Felucca(RadarCol radarCol, TileData tileData, Hues hues, Files files, Art art) { return(new Map(0, 0, 6144, 4096, radarCol, tileData, hues, files, art)); }
public static Map TerMur(RadarCol radarCol, TileData tileData, Hues hues, Files files, Art art) { return(new Map(5, 5, 1280, 4096, radarCol, tileData, hues, files, art)); }
public static Map Tokuno(RadarCol radarCol, TileData tileData, Hues hues, Files files, Art art) { return(new Map(4, 4, 1448, 1448, radarCol, tileData, hues, files, art)); }
public static Map Malas(RadarCol radarCol, TileData tileData, Hues hues, Files files, Art art) { return(new Map(3, 3, 2560, 2048, radarCol, tileData, hues, files, art)); }
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); }
private unsafe short[] RenderBlock(int x, int y, bool drawStatics) { short[] numArray = new short[64]; Tile[] landBlock = this.m_Tiles.GetLandBlock(x, y); fixed(short *numPtr1 = &Map.m_Colors[0]) fixed(int *numPtr2 = &TileData.HeightTable[0]) fixed(Tile * tilePtr1 = &landBlock[0]) { Tile *tilePtr2 = tilePtr1; fixed(short *numPtr3 = &numArray[0]) { short *numPtr4 = numPtr3; if (drawStatics) { HuedTile[][][] huedTileArray1 = drawStatics ? this.m_Tiles.GetStaticBlock(x, y) : (HuedTile[][][])null; int index1 = 0; int num1 = 0; while (index1 < 8) { for (int index2 = 0; index2 < 8; ++index2) { int num2 = -255; int num3 = -255; int index3 = 0; int num4 = 0; HuedTile[] huedTileArray2 = huedTileArray1[index2][index1]; if (huedTileArray2.Length > 0) { fixed(HuedTile *huedTilePtr1 = &huedTileArray2[0]) { HuedTile *huedTilePtr2 = huedTilePtr1; for (HuedTile *huedTilePtr3 = huedTilePtr2 + huedTileArray2.Length; huedTilePtr2 < huedTilePtr3; ++huedTilePtr2) { int num5 = (int)huedTilePtr2->m_Z; int num6 = num5 + numPtr2[(int)huedTilePtr2->m_ID & 16383]; if (num6 > num2 || num5 > num3 && num6 >= num2) { num2 = num6; num3 = num5; index3 = (int)huedTilePtr2->m_ID; num4 = (int)huedTilePtr2->m_Hue; } } } } if ((int)tilePtr2->m_Z > num2) { index3 = (int)tilePtr2->m_ID; num4 = 0; } *numPtr4++ = num4 != 0 ? Hues.GetHue(num4 - 1).Colors[(int)numPtr1[index3] >> 10 & 31] : numPtr1[index3]; ++tilePtr2; } ++index1; num1 += 8; } } else { Tile *tilePtr3 = tilePtr2 + 64; while (tilePtr2 < tilePtr3) { *numPtr4++ = numPtr1[tilePtr2++->m_ID]; } } } } return(numArray); }