fix: complete Task 5 visual HUD validation

This commit is contained in:
goose
2026-10-08 21:45:46 -04:00
parent 9921e02de3
commit 122fdac97c
7 changed files with 155 additions and 6 deletions
+6 -4
View File
@@ -154,10 +154,12 @@ def is_visible(pixel: tuple[int, int, int]) -> bool:
def is_explored(pixel: tuple[int, int, int]) -> bool:
# Tile texture remains visible under a blue-black fog overlay. This is the
# dominant fog-modulated floor texel; keeping the detector exact avoids HUD
# colors and visible terrain satisfying it.
return pixel == (19, 29, 39)
# Texture-preserving explored terrain is rendered under a blue-black fog
# overlay. GPU blend rounding and the authored floor texture produce a
# 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
def measure(path: Path) -> None:
+8
View File
@@ -309,6 +309,9 @@ func _get_capture_mode() -> String:
func _capture_visual_check(capture_mode: String) -> void:
if capture_mode == "exit":
_prepare_exit_capture_state()
# Camera2D applies its scroll during the frame cycle. Force it before the
# deterministic capture so the world is framed around the capture state.
camera.force_update_scroll()
await get_tree().process_frame
await get_tree().process_frame
await RenderingServer.frame_post_draw
@@ -326,6 +329,11 @@ func _prepare_exit_capture_state() -> void:
game_state.map.set_cell(Vector2i(36, 7), GridMapStateType.CellKind.FLOOR)
game_state.player.cell = game_state.floor_state.exit
game_state.update_exploration()
# Keep a nearby floor tile as remembered terrain. The entrance is outside
# the exit camera crop, so it cannot prove the explored-fog render contract.
var remembered_cell := game_state.floor_state.exit + Vector2i(-2, 0)
game_state.explored_cells[remembered_cell] = true
game_state.visible_cells.erase(remembered_cell)
_sync_map_renderer_visibility()
_sync_minimap()
player_view.refresh()
+30 -1
View File
@@ -13,6 +13,7 @@ const QUEST_BOARD_PROMPT := "Espace — Lire le tableau des quêtes"
const REFERENCE_VIEWPORT := Vector2(1920.0, 1080.0)
const MIN_LAYOUT_SCALE := 0.66
const MIN_FONT_SCALE := 0.66
@onready var player_health_label: Label = $PlayerHealthLabel
@onready var player_focus_label: Label = $PlayerFocusLabel
@@ -75,10 +76,11 @@ func apply_viewport_layout(viewport_size: Vector2) -> void:
_set_rect($ResponsiveLayout/PromptPanel, origin + Vector2(525, 976) * scale, Vector2(600, 34) * scale)
_set_rect($ResponsiveLayout/HelpPanel, origin + Vector2(1125, 976) * scale, Vector2(775, 82) * scale)
_set_rect($ResponsiveLayout/QuickSlotStrip, origin + Vector2(20, 976) * scale, Vector2(490, 82) * scale)
_apply_text_scale(scale)
_set_rect($AchievementToast, origin + Vector2(420, 16) * scale, Vector2(1080, 28) * scale)
_set_rect($TitleLabel, origin + Vector2(420, 47) * scale, Vector2(1080, 30) * scale)
_set_rect($HeaderValuesLabel, origin + Vector2(420, 78) * scale, Vector2(1080, 24) * scale)
_set_rect($HeaderValuesLabel, origin + Vector2(420, 75) * scale, Vector2(1080, 24) * scale)
_set_rect($ResponsiveLayout/HeaderOrnament, origin + Vector2(560, 12) * scale, Vector2(800, 54) * scale)
_set_rect($ResponsiveLayout/PortraitIllustration, origin + Vector2(45, 145) * scale, Vector2(127, 140) * scale)
@@ -108,6 +110,33 @@ func _set_rect(control: Control, position: Vector2, control_size: Vector2) -> vo
control.position = position
control.size = control_size
func _apply_text_scale(layout_scale: float) -> void:
var font_scale := clampf(layout_scale, MIN_FONT_SCALE, 1.0)
for control: Control in [
$AchievementToast,
$TitleLabel,
$HeaderValuesLabel,
$ResponsiveLayout/QuickSlotHint,
$PlayerHealthLabel,
$PlayerFocusLabel,
$ExperienceLabel,
$CharacterStatusLabel,
$GoldLabel,
$QuestTrackerLabel,
$SpellLabel,
$EnemyHealthLabel,
$CombatSummaryLabel,
$DeadlineLabel,
$EventLog,
$ContextPromptLabel,
$HelpLabel,
]:
var base_size: int = control.get_meta(&"base_font_size", 0)
if base_size == 0:
base_size = control.get_theme_font_size(&"font_size")
control.set_meta(&"base_font_size", base_size)
control.add_theme_font_size_override(&"font_size", roundi(base_size * font_scale))
func _layout_expanded_log(origin: Vector2, scale: float) -> void:
_set_rect(log_panel, origin + Vector2(1580, 122) * scale, Vector2(320, 826) * scale)
_set_rect(event_log, origin + Vector2(1600, 145) * scale, Vector2(280, 775) * scale)