looking good

This commit is contained in:
Boki 2026-02-13 15:37:11 -05:00
parent d8c9f8e11a
commit 20ef4d6fa7
3 changed files with 59 additions and 9 deletions

View file

@ -241,7 +241,16 @@ public class WorldMap : IDisposable
dstRoi.Set(row, col, (byte)MapCell.Explored); // lost confidence → demote
}
// Mark explored area: circle around player, only overwrite Unknown
// Mark fog on canvas: only overwrite Unknown (fog is soft data)
for (var row = 0; row < h; row++)
for (var col = 0; col < w; col++)
{
if (srcRoi.At<byte>(row, col) != (byte)MapCell.Fog) continue;
if (dstRoi.At<byte>(row, col) == (byte)MapCell.Unknown)
dstRoi.Set(row, col, (byte)MapCell.Fog);
}
// Mark explored area: circle around player, overwrite Unknown and Fog
var pcx = (int)Math.Round(position.X);
var pcy = (int)Math.Round(position.Y);
var r = _config.ExploredRadius;
@ -258,7 +267,8 @@ public class WorldMap : IDisposable
var dx = x - pcx;
var dy = y - pcy;
if (dx * dx + dy * dy > r2) continue;
if (_canvas.At<byte>(y, x) == (byte)MapCell.Unknown)
var cell = _canvas.At<byte>(y, x);
if (cell == (byte)MapCell.Unknown || cell == (byte)MapCell.Fog)
_canvas.Set(y, x, (byte)MapCell.Explored);
}
}
@ -329,7 +339,10 @@ public class WorldMap : IDisposable
if (sx < 0 || sx >= _config.CanvasSize || sy < 0 || sy >= _config.CanvasSize)
continue;
if (_canvas.At<byte>(sy, sx) == (byte)MapCell.Unknown)
var cell = _canvas.At<byte>(sy, sx);
if (cell == (byte)MapCell.Fog)
score += 2; // prefer visible fog (we know there's unexplored area)
else if (cell == (byte)MapCell.Unknown)
score++;
}
}
@ -379,6 +392,8 @@ public class WorldMap : IDisposable
colored.Set(r, c, new Vec3b(104, 64, 31));
else if (v == (byte)MapCell.Wall)
colored.Set(r, c, new Vec3b(26, 45, 61));
else if (v == (byte)MapCell.Fog)
colored.Set(r, c, new Vec3b(180, 140, 70)); // light blue
}
var px = cx - x0;