public void putMap() { display.erase(); boolean overlapping; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { overlapping = (!monsters.isEmpty() && monsters.containsPosition(Coord.get(i, j))) || (!monsters.isEmpty() && player.gridX == i && player.gridY == j); // if we see it now, we remember the cell and show a lit cell based on the fovmap value // (between 0.0 // and 1.0), with 1.0 being almost pure white at +215 lightness and 0.0 being rather dark at // -105. if (fovmap[i][j] > 0.0) { seen[i][j] = true; display.put( i * 2, j, (overlapping) ? ' ' : lineDungeon[i * 2][j], fgCenter.filter(colors[i * 2][j]), bgCenter.filter(bgColors[i * 2][j]), lights[i][j] + (int) (-105 + 320 * fovmap[i][j])); display.put( i * 2 + 1, j, (overlapping) ? ' ' : lineDungeon[i * 2 + 1][j], fgCenter.filter(colors[i * 2][j]), bgCenter.filter(bgColors[i * 2][j]), lights[i][j] + (int) (-105 + 320 * fovmap[i][j])); // if we don't see it now, but did earlier, use a very dark background, but lighter than // black. } else if (seen[i][j]) { display.put( i * 2, j, lineDungeon[i * 2][j], fgCenter.filter(colors[i * 2][j]), bgCenter.filter(bgColors[i * 2][j]), -140); display.put( i * 2 + 1, j, lineDungeon[i * 2 + 1][j], fgCenter.filter(colors[i * 2][j]), bgCenter.filter(bgColors[i * 2][j]), -140); } } } for (Coord pt : toCursor) { // use a brighter light to trace the path to the cursor, from 170 max lightness to 0 min. display.highlight(pt.x * 2, pt.y, lights[pt.x][pt.y] + (int) (170 * fovmap[pt.x][pt.y])); display.highlight(pt.x * 2 + 1, pt.y, lights[pt.x][pt.y] + (int) (170 * fovmap[pt.x][pt.y])); } }