fix: frame edge camera states inside play area

This commit is contained in:
goose
2026-10-09 01:20:29 -04:00
parent f8d4d932c3
commit 65d35b5102
4 changed files with 61 additions and 20 deletions
+5 -5
View File
@@ -20,9 +20,9 @@ EXPECTED_DIMENSIONS = {
"visual-check-exit.png": (REFERENCE_WIDTH, REFERENCE_HEIGHT),
"visual-check-compact.png": (1280, 720),
}
# Central dungeon measurement region in the reference 1920×1080 artboard.
# It excludes the anchored HUD panels and is scaled for the real 720p capture.
REFERENCE_VIEWPORT = (384, 60, 1536, 1017)
# The unmasked PlayAreaFrame in the reference 1920×1080 artboard.
# This is scaled for the real 720p capture.
PLAY_AREA_REFERENCE = (498, 125, 1422, 955)
UNKNOWN = (1, 2, 5)
# Captured explored tiles are texture modulated, so classify their blue-black
# pixels by palette range rather than expecting one flat overlay color.
@@ -170,13 +170,13 @@ def is_explored(pixel: tuple[int, int, int]) -> bool:
# palette rather than one portable exact RGB value; accept only its dark,
# blue-shifted range so HUD chrome and visible brown terrain cannot match.
red, green, blue = pixel
return 4 <= red <= 14 and 8 <= green <= 22 and 17 <= blue <= 32 and blue >= green + 4 and green >= red + 3
return 4 <= red <= 14 and 7 <= green <= 22 and 16 <= blue <= 32 and blue >= green + 4 and green >= red + 3
def viewport_for(width: int, height: int) -> tuple[int, int, int, int]:
scale_x = width / REFERENCE_WIDTH
scale_y = height / REFERENCE_HEIGHT
return tuple(round(coordinate * (scale_x if index % 2 == 0 else scale_y)) for index, coordinate in enumerate(REFERENCE_VIEWPORT))
return tuple(round(coordinate * (scale_x if index % 2 == 0 else scale_y)) for index, coordinate in enumerate(PLAY_AREA_REFERENCE))
def measure(path: Path) -> None: