fix(iso): fog of war — skip unexplored + distance-fade explored

Iso revealed the WHOLE map from move 0: unexplored (dark) cells fell back to the floor tile
(_tileUrl(dark) -> tiles.floor) and rendered as floor. Now skip dark cells entirely (unexplored =
void), and dim explored tiles by the lightGrid brightness (globalAlpha, floor to 0.16) so the
remembered area fades to black with distance — parity with the 2D modes and 3D (which already
skips dark + uses THREE distance fog).
This commit is contained in:
jwinterm
2026-07-16 04:09:18 -04:00
parent 175effd6fa
commit 0a98e297c2
+8 -2
View File
@@ -321,6 +321,9 @@
for (i = 0; i < items.length; i++) {
var it = items[i];
if (it.type === 'tile') {
// FOG OF WAR: never render unexplored cells. Without this they fell back to the floor
// tile (`_tileUrl('dark')` → tiles.floor) and revealed the ENTIRE map from move 0.
if (it.kind === 'dark') continue;
var tileKind = PROP[it.kind] ? 'floor' : it.kind;
if (WALLISH[tileKind]) tileKind = this._wallVariant(scene, it.x, it.y, tileKind);
else tileKind = this._floorVariant(tileKind, it.x, it.y);
@@ -332,9 +335,12 @@
it.x >= this._plx && it.y >= this._ply &&
(it.x + it.y) > (this._plx + this._ply) &&
((it.x - this._plx) + (it.y - this._ply)) <= 3;
if (cut) ctx.globalAlpha = 0.28;
// Fog fade: dim explored-but-distant tiles toward the (near-black) background so the
// remembered area melts into the dark with distance — parity with the 2D modes.
var lb = (scene.lightGrid && scene.lightGrid[it.y] && scene.lightGrid[it.y][it.x] != null) ? scene.lightGrid[it.y][it.x] : 1;
ctx.globalAlpha = cut ? 0.28 : Math.max(0.16, lb);
if (rec && rec.ready) this._drawImage(rec.img, it.sx, it.sy + this.tileH, this.imageW, this.imageH);
else if (it.kind !== 'dark') this._diamond(it.sx, it.sy + this.tileH * 0.5, (legend[it.kind] && legend[it.kind].color) || '#3a4048');
else this._diamond(it.sx, it.sy + this.tileH * 0.5, (legend[it.kind] && legend[it.kind].color) || '#3a4048');
ctx.globalAlpha = 1;
} else if (it.type === 'prop') {
this._contactShadow(it.sx, it.sy + this.tileH * 1.4, 22, 9);