From 684f3bf90a9d24bd3179e485ef79e12b16c18b04 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Sat, 20 Jun 2026 09:09:01 +0900 Subject: [PATCH] Soften tactical map grid overlays --- scripts/scenes/battle_scene.gd | 69 ++++++++++++++++++++-------------- tools/smoke_visual_assets.gd | 4 ++ 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index a2692cc..2a30932 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -5712,7 +5712,7 @@ func _terrain_fill_color(cell: Vector2i, terrain_key: String, has_background: bo func _map_grid_color(has_background: bool) -> Color: var color := GRID_COLOR - color.a = 0.04 if has_background else 0.34 + color.a = 0.012 if has_background else 0.28 return color @@ -5807,6 +5807,35 @@ func _draw_terrain_feature(feature_key: String, rect: Rect2, modulate: Color = C return true +func _draw_tactical_tile_overlay(marker_key: String, rect: Rect2, fill_color: Color, border_color: Color, marker_alpha: float, fill_alpha_scale: float = 0.48, inset: float = 5.0) -> void: + var fill := fill_color + fill.a *= fill_alpha_scale + if fill.a > 0.0: + draw_rect(rect.grow(-inset), fill) + _draw_tile_marker(marker_key, rect, Color(1.0, 1.0, 1.0, marker_alpha), 0.0) + var line := border_color + line.a = minf(line.a, 0.68) + _draw_tactical_corner_brackets(rect.grow(-(inset + 2.0)), line, 8.0, 1.35) + + +func _draw_tactical_corner_brackets(rect: Rect2, color: Color, length: float = 8.0, width: float = 1.35) -> void: + if rect.size.x <= 0.0 or rect.size.y <= 0.0 or color.a <= 0.0: + return + var corner_length := minf(length, minf(rect.size.x, rect.size.y) * 0.36) + var left := rect.position.x + var top := rect.position.y + var right := rect.end.x + var bottom := rect.end.y + draw_line(Vector2(left, top), Vector2(left + corner_length, top), color, width) + draw_line(Vector2(left, top), Vector2(left, top + corner_length), color, width) + draw_line(Vector2(right, top), Vector2(right - corner_length, top), color, width) + draw_line(Vector2(right, top), Vector2(right, top + corner_length), color, width) + draw_line(Vector2(left, bottom), Vector2(left + corner_length, bottom), color, width) + draw_line(Vector2(left, bottom), Vector2(left, bottom - corner_length), color, width) + draw_line(Vector2(right, bottom), Vector2(right - corner_length, bottom), color, width) + draw_line(Vector2(right, bottom), Vector2(right, bottom - corner_length), color, width) + + func _terrain_texture_modulate(cell: Vector2i, terrain_key: String, has_background: bool) -> Color: var alpha := 0.26 if has_background else 0.58 if terrain_key == "W": @@ -6253,59 +6282,43 @@ func _draw_overlays() -> void: for cell in state.get_objective_cells(): var objective_rect := _rect_for_cell(cell) _draw_objective_seal_marker(objective_rect) - _draw_tile_marker("objective", objective_rect, Color(1.0, 1.0, 1.0, 0.58)) + _draw_tactical_tile_overlay("objective", objective_rect, OBJECTIVE_OVERLAY_COLOR, UI_SEAL_RED, 0.56, 0.30, 6.0) for cell in threat_cells: var threat_rect := _rect_for_cell(cell) - draw_rect(threat_rect, THREAT_OVERLAY_COLOR) - draw_rect(threat_rect.grow(-6.0), THREAT_BORDER_COLOR, false, 1.5) - _draw_tile_marker("attack", threat_rect, Color(1.0, 1.0, 1.0, 0.26)) + _draw_tactical_tile_overlay("attack", threat_rect, THREAT_OVERLAY_COLOR, THREAT_BORDER_COLOR, 0.30, 0.42, 6.0) for cell in move_cells: var move_rect := _rect_for_cell(cell) - draw_rect(move_rect, MOVE_OVERLAY_COLOR) - draw_rect(move_rect.grow(-8.0), MOVE_BORDER_COLOR, false, 1.2) - _draw_tile_marker("move", move_rect, Color(1.0, 1.0, 1.0, 0.30)) + _draw_tactical_tile_overlay("move", move_rect, MOVE_OVERLAY_COLOR, MOVE_BORDER_COLOR, 0.34, 0.42, 6.0) if _has_pending_move() and state.is_inside(pending_move_to_cell): var pending_rect := _rect_for_cell(pending_move_to_cell) - draw_rect(pending_rect.grow(-4.0), Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.34)) - draw_rect(pending_rect.grow(-7.0), Color(UI_SEAL_RED.r, UI_SEAL_RED.g, UI_SEAL_RED.b, 0.72), false, 2.0) - _draw_tile_marker("select", pending_rect, Color(1.0, 1.0, 1.0, 0.78)) + _draw_tactical_tile_overlay("select", pending_rect, Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.34), UI_SEAL_RED, 0.78, 0.58, 5.0) for cell in attack_cells: var attack_rect := _rect_for_cell(cell) - draw_rect(attack_rect, ATTACK_OVERLAY_COLOR) - draw_rect(attack_rect.grow(-7.0), ATTACK_BORDER_COLOR, false, 1.4) - _draw_tile_marker("attack", attack_rect, Color(1.0, 1.0, 1.0, 0.36)) + _draw_tactical_tile_overlay("attack", attack_rect, ATTACK_OVERLAY_COLOR, ATTACK_BORDER_COLOR, 0.40, 0.44, 6.0) for cell in skill_cells: var skill_rect := _rect_for_cell(cell) - draw_rect(skill_rect, SKILL_OVERLAY_COLOR) - draw_rect(skill_rect.grow(-8.0), Color(UI_MUTED_JADE.r, UI_MUTED_JADE.g, UI_MUTED_JADE.b, 0.54), false, 1.2) - _draw_tile_marker("recover", skill_rect, Color(1.0, 1.0, 1.0, 0.24)) + _draw_tactical_tile_overlay("recover", skill_rect, SKILL_OVERLAY_COLOR, Color(UI_MUTED_JADE.r, UI_MUTED_JADE.g, UI_MUTED_JADE.b, 0.54), 0.28, 0.40, 6.0) if not selected_skill_id.is_empty() and skill_cells.has(hover_cell): var area_selected := state.get_selected_unit() if not area_selected.is_empty(): for cell in state.get_skill_area_cells(area_selected["id"], selected_skill_id, hover_cell): var area_rect := _rect_for_cell(cell) - draw_rect(area_rect, SKILL_AREA_OVERLAY_COLOR) - draw_rect(area_rect.grow(-7.0), Color(UI_MUTED_JADE.r, UI_MUTED_JADE.g, UI_MUTED_JADE.b, 0.62), false, 1.5) - _draw_tile_marker("recover", area_rect, Color(1.0, 1.0, 1.0, 0.28)) + _draw_tactical_tile_overlay("recover", area_rect, SKILL_AREA_OVERLAY_COLOR, Color(UI_MUTED_JADE.r, UI_MUTED_JADE.g, UI_MUTED_JADE.b, 0.62), 0.32, 0.46, 5.0) for cell in item_cells: var item_rect := _rect_for_cell(cell) - draw_rect(item_rect, ITEM_OVERLAY_COLOR) - draw_rect(item_rect.grow(-8.0), ITEM_BORDER_COLOR, false, 1.2) - _draw_tile_marker("recover", item_rect, Color(1.0, 1.0, 1.0, 0.34)) + _draw_tactical_tile_overlay("recover", item_rect, ITEM_OVERLAY_COLOR, ITEM_BORDER_COLOR, 0.36, 0.42, 6.0) if formation_menu != null and formation_menu.visible: for cell in state.get_formation_cells(): var formation_rect := _rect_for_cell(cell) - draw_rect(formation_rect, FORMATION_OVERLAY_COLOR) - draw_rect(formation_rect.grow(-7.0), Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.58), false, 1.4) - _draw_tile_marker("select", formation_rect, Color(1.0, 1.0, 1.0, 0.34)) + _draw_tactical_tile_overlay("select", formation_rect, FORMATION_OVERLAY_COLOR, Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.58), 0.36, 0.42, 6.0) if state.is_inside(hover_cell): var hover_color := Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.42) @@ -6323,8 +6336,8 @@ func _draw_overlays() -> void: elif not hover_unit.is_empty() and not selected.is_empty() and hover_unit.get("team", "") != selected.get("team", ""): hover_color = Color(UI_SEAL_RED.r, UI_SEAL_RED.g, UI_SEAL_RED.b, 0.52) hover_marker = "target" - draw_rect(_rect_for_cell(hover_cell), hover_color, false, 3.0) - _draw_tile_marker(hover_marker, _rect_for_cell(hover_cell), Color(1.0, 1.0, 1.0, 0.42)) + var hover_rect := _rect_for_cell(hover_cell) + _draw_tactical_tile_overlay(hover_marker, hover_rect, hover_color, hover_color, 0.44, 0.22, 4.0) func _draw_units() -> void: diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index dabd072..3e7d75b 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -4792,6 +4792,10 @@ func _check_terrain_and_unit_presentation(failures: Array[String]) -> void: failures.append("background terrain texture should stay lighter than fallback terrain texture") if scene._map_grid_color(true).a >= scene._map_grid_color(false).a: failures.append("background grid should be lighter than fallback grid") + if scene._map_grid_color(true).a > 0.025: + failures.append("high-resolution battle backgrounds should not be covered by visible square grid lines: %.3f" % scene._map_grid_color(true).a) + if not scene.has_method("_draw_tactical_tile_overlay") or not scene.has_method("_draw_tactical_corner_brackets"): + failures.append("battlefield tactical overlays should use generated tile art with corner brackets instead of full square UI borders") if scene._terrain_edge_color("F", "G").a <= 0.0: failures.append("forest edge blend should be visible") if not scene._should_draw_terrain_edge("F", "G", Vector2i(1, 0)):