public static Color[,] recolor(int[,] geo) { Color[,] geolocal = new Color[geo.GetLength(0), geo.GetLength(1)]; Random rn = new Random(); for (int t1 = 0; t1 < geolocal.GetLength(0) / 20; t1++) { for (int t2 = 0; t2 < geolocal.GetLength(1) / 20; t2++) { // int currTheme = (rn.Next(3) * 11) + (rn.Next(2) * 38); // if (currTheme == 2 * 11 || currTheme == 11 + 38) // break; double hue = rn.Next(60) - 15; hue = (Math.Abs(hue * 360) + hue) % 360; for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { if (geo[i + (t1 * 20), j + (t2 * 20)] == gr) { geolocal[i + (t1 * 20), j + (t2 * 20)] = Chroma.RandomBlend(Color.White, Color.FromHsv(hue, rn.NextDouble() / 2.5 + 0.2, 0.8), 0.05, 0.2); } else if (geo[i + (t1 * 20), j + (t2 * 20)] != da) // && geo[i + (t1 * 20), j + (t2 * 20)] != 1187) { geolocal[i + (t1 * 20), j + (t2 * 20)] = Chroma.RandomBlend(Color.White, Color.FromHsv(hue, rn.NextDouble() / 2.5 + 0.2, 0.8), 0.15, 0.3); } } } } } return(geolocal); }
public void Show() { //Display.Clear(Color.FromArgb(32, 32, 32)); // (cursorY <= 10) (cursorY > mapHeight - 10) if cursorY <= 10, (vals < 20); //minVisibleY = (cursorY < 20) ? 0 : (cursorY > mapHeight - 10) ? mapHeight - 20 : cursorY - 20; //maxVisibleY = minVisibleY; for (int row = (Demo.cursorY < 20) ? 0 : (Demo.cursorY > mapHeightBound - 10) ? mapHeightBound - 20 : Demo.cursorY - 20; row <= mapHeightBound && row <= Demo.cursorY + 20; row++) { // maxVisibleY++; var pY = tileVIncrease * ((Demo.cursorY <= 10) ? row : (Demo.cursorY > mapHeightBound - 10) ? row - (mapHeightBound - 19) : row - (Demo.cursorY - 10)); var pX = tileHIncrease * (20 - 1 - ((Demo.cursorY <= 10) ? row : (Demo.cursorY > mapHeightBound - 10) ? row - (mapHeightBound - 19) : row - (Demo.cursorY - 10))); // //(cursorY > mapHeight - 10) ? mapHeight - (cursorY - 10) : cursorY - 10) // +tileHIncrease; //row - (cursorY - 10) //minVisibleX = (cursorX <= 10) ? 0 : (cursorX > mapWidth - 10) ? mapWidth - 19 : cursorX - 10; //maxVisibleX = minVisibleX; for (int col = (Demo.cursorX <= 10) ? 0 : (Demo.cursorX > mapWidthBound - 10) ? mapWidthBound - 19 : Demo.cursorX - 10; col <= mapWidthBound && (col < Demo.cursorX + 10 || col < 20); col++) { // maxVisibleX++; /* * if (visibleCells[col, row] <= 0 && seenCells[col, row] <= 0) * { * pX += tileVIncrease; * continue; * } * else if (visibleCells[col, row] <= 0 && seenCells[col, row] > 0) * { * var tile = map[row, col]; * Rectangle src; * * var dest = new Rectangle(pX, pY, tileWidth, tileHeight); * tileset.Color = Chroma.Blend(Color.Gray, mapColors[row, col], 0.2); * src = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight); * tileset.Draw(src, dest); * tileset.Color = Color.White; * pX += tileVIncrease; * continue; * * } */ if (map[row, col] == DungeonMap.gr) { //tileset.Color = mapColors[row, col]; tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - visibleCells[row, col]); if (Demo.highlightingOn) { if (highlightedTargetCells.ContainsKey(new Point(col, row))) { tileset.Color = Color.FromHsv(10.0, 0.7, 0.60 + (((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 3000 : (2000 - (Timing.TotalMilliseconds % 2000)) / 3000)); } else if (highlightedCells.ContainsKey(new Point(col, row)) && !doNotStopCells.ContainsKey(new Point(col, row))) { tileset.Color = Color.FromHsv(230.0, 0.7, 0.80 + (((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 6000 : (2000 - (Timing.TotalMilliseconds % 2000)) / 6000)); } else if (o_entities.ContainsKey(requestingMove)) // && o_entities[requestingMove].fov.sight[col, row] == 0) { tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - o_entities[requestingMove].fov.sight[row, col]); } } var dest = new Rectangle(pX, pY, tileWidth, tileHeight); var tile = map[row, col]; var src = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight); tileset.Draw(src, dest); tileset.Color = Color.White; } pX += tileVIncrease; } pX = tileHIncrease * (20 - 1 - ((Demo.cursorY <= 10) ? row : (Demo.cursorY > mapHeightBound - 10) ? row - (mapHeightBound - 19) : row - (Demo.cursorY - 10))); for (var col = (Demo.cursorX <= 10) ? 0 : (Demo.cursorX > mapWidthBound - 10) ? mapWidthBound - 19 : Demo.cursorX - 10; col <= mapWidthBound && (col < Demo.cursorX + 10 || col < 20); col++) { /*if (visibleCells[col, row] <= 0) * { * pX += tileVIncrease; * continue; * }*/ var dest = new Rectangle(pX, pY, tileWidth, tileHeight); var entity = checkPos(col, row); var fixture = checkFixture(col, row); if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState && !Demo.lockForAnimation) { if (Demo.lockState) { tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0); } int offset = 0; if (entity != null && entity.x == Demo.cursorX && entity.y == Demo.cursorY) { offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 40 : (2000 - (Timing.TotalMilliseconds % 2000)) / 40); } int cursorTile = 1442; if (entity != null) { cursorTile = 1441; } tileset.Draw(new Rectangle((cursorTile % 38) * tileWidth, (cursorTile / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight)); tileset.Color = Color.White; } var tile = map[row, col]; Rectangle src; if (tile != DungeonMap.gr) { //tileset.Color = mapColors[row, col]; tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - visibleCells[row, col]); if (Demo.highlightingOn && o_entities.ContainsKey(requestingMove)) // && !o_entities[requestingMove].fov.sightSet.Contains(new Point(col, row))) { tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - o_entities[requestingMove].fov.sight[row, col]); //tileset.Color = Chroma.Blend(Color.Gray, mapColors[row, col], 0.2); } src = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight); tileset.Draw(src, dest); tileset.Color = Color.White; } if (entity != null && visibleCells[row, col] > 0) { tile = entity.tile; src = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight); Color tsc; // = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 0.5, 1.0); if (Demo.lockState && entity.friendly && requestingMove.X == entity.o_pos.X && requestingMove.Y == entity.o_pos.Y) { //tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 0.5, 1.0); tileset.Draw(src, dest); tileset.Color = Color.White; } else { tileset.Draw(src, dest); } if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState && !Demo.lockForAnimation) { if (Demo.lockState) { tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0); } int offset = 0; if (entity.x == Demo.cursorX && entity.y == Demo.cursorY) { offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 40 : (2000 - (Timing.TotalMilliseconds % 2000)) / 40); } tileset.Draw(new Rectangle((1440 % 38) * tileWidth, (1440 / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight)); tileset.Color = Color.White; } if (entity.friendly) { src = new Rectangle((1443 % 38) * tileWidth, (1443 / 38) * tileHeight, tileWidth, tileHeight); tileset.Draw(src, dest); } if (Demo.showHealth) { if (entity.health < 10) { if (entity.friendly) { tsc = Color.DarkBlue; } else { tsc = Color.Black; //Color.FromHsv((Timing.TotalMilliseconds % 3600) / 5.0, 0.8, 1.0); } mandrillFont.Color = tsc; // mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1000.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1000; mandrillFont.DrawText(pX + 18, pY + 16, "" + entity.health); } if (entity.health >= 10 && entity.health < 100) { if (entity.friendly) { tsc = Color.DarkBlue; } else { tsc = Color.Black; //Color.FromHsv((Timing.TotalMilliseconds % 3600) / 5.0, 0.8, 1.0); } mandrillFont.Color = tsc; // mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1700.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1700; mandrillFont.DrawText(pX + 12, pY + 16, "" + entity.health); } } } else if (fixture != null) { int frontTile = 1437; int backTile = 1436; if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState) { if (Demo.lockState) { tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0); } int offset = 0; tileset.Draw(new Rectangle((backTile % 38) * tileWidth, (backTile / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight)); tileset.Color = Color.White; } tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - visibleCells[row, col]); tile = fixture.tile; src = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight); tileset.Draw(src, dest); tileset.Color = Color.White; if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState) { if (Demo.lockState) { tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0); } int offset = 0; tileset.Draw(new Rectangle((frontTile % 38) * tileWidth, (frontTile / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight)); tileset.Color = Color.White; } } // mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1000.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1000; // mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1700.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1700; foreach (Point cl in displayDamage.Keys) { if (cl.Y == row && cl.X == col) { if (displayDamage[cl] < 10) { int offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 50 : (2000 - (Timing.TotalMilliseconds % 2000)) / 50); mandrillFont.Color = (Timing.TotalMilliseconds % 100 < 50) ? Color.Black : Color.White; mandrillFont.DrawText(pX + 18, pY + 16 - offset, "" + displayDamage[cl]); mandrillFont.Color = Color.White; } else if (displayDamage[cl] >= 10 && displayDamage[cl] < 100) { int offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 40 : (2000 - (Timing.TotalMilliseconds % 2000)) / 40); mandrillFont.Color = (Timing.TotalMilliseconds % 100 < 50) ? Color.Black : Color.White; //Color.DarkRed; mandrillFont.DrawText(pX + 12, pY + 16 - offset, "" + displayDamage[cl]); mandrillFont.Color = Color.White; } } } foreach (Point cl in displayKills.Keys) { if (cl.Y == row && cl.X == col && displayKills[cl]) { int offset = (int)(((Timing.TotalMilliseconds % 4000) < 2000) ? (Timing.TotalMilliseconds % 4000) / 100 : (4000 - (Timing.TotalMilliseconds % 4000)) / 100); mandrillFont.Color = (Timing.TotalMilliseconds % 100 < 50) ? Color.Black : Color.White; mandrillFont.DrawText(pX, pY + 16 - offset, "DEAD"); mandrillFont.Color = Color.White; } } pX += tileVIncrease; } //pY += tileHIncrease; } /*ScreenBrowser.Show(); * if (Demo.hoverActor != null) * UnitInfo.ShowMobInfo(Demo.hoverActor); * else if (Demo.currentActor != null) * UnitInfo.ShowMobInfo(Demo.currentActor); * Display.FillRect(new Rectangle(0, Demo.mapDisplayHeight, Demo.mapDisplayWidth, 32), (Color.Black)); * DialogBrowser.Show(); * MessageBrowser.Show();*/ //mandrillFont.DrawText(32.0, 32.0, "FPS: " + (int)Display.FramesPerSecond); }