Add generated map badge icons

This commit is contained in:
2026-06-20 04:04:18 +09:00
parent 6debe968e2
commit cd8f3b6926
10 changed files with 123 additions and 12 deletions

View File

@@ -96,6 +96,7 @@ func _init() -> void:
_check_generated_button_textures(failures)
_check_generated_tile_marker_textures(failures)
_check_generated_class_icon_textures(failures)
_check_generated_map_badge_textures(failures)
_check_generated_terrain_textures(failures)
_check_scene_texture_loading(failures)
_check_hud_focus_text(failures)
@@ -3005,6 +3006,12 @@ func _check_generated_class_icon_textures(failures: Array[String]) -> void:
_check_class_icon_texture_path(failures, "res://art/ui/class_icons/class_%s.png" % icon_key, "class icon %s" % icon_key)
func _check_generated_map_badge_textures(failures: Array[String]) -> void:
var badge_keys := ["objective", "supply", "gold", "tactic", "recover", "event"]
for badge_key in badge_keys:
_check_map_badge_texture_path(failures, "res://art/ui/map_badges/map_badge_%s.png" % badge_key, "map badge %s" % badge_key)
func _check_generated_terrain_textures(failures: Array[String]) -> void:
var terrain_keys := ["g", "f", "h", "d", "r", "w", "t", "c"]
for terrain_key in terrain_keys:
@@ -3029,6 +3036,8 @@ func _check_scene_texture_loading(failures: Array[String]) -> void:
failures.append("battle scene should load generated tactical tile marker textures")
if scene._load_class_icon_texture("infantry") == null or scene._load_class_icon_texture("tactic") == null:
failures.append("battle scene should load generated class icon textures")
if scene._load_map_badge_texture("objective") == null or scene._load_map_badge_texture("recover") == null:
failures.append("battle scene should load generated map badge textures")
var conversations: Array = scene.state.get_briefing().get("camp_conversations", [])
if not conversations.is_empty():
var first_lines: Array = (conversations[0] as Dictionary).get("lines", [])
@@ -4382,6 +4391,16 @@ func _check_terrain_and_unit_presentation(failures: Array[String]) -> void:
failures.append("Tactic lure marker should use a compact lure glyph")
if scene._event_marker_color("tactic") == scene._event_marker_color("supply"):
failures.append("Tactic marker should be visually distinct from supply markers")
if scene._event_marker_badge_kind("마을 보급", "supply") != "supply":
failures.append("Supply event markers should use the generated supply badge")
if scene._event_marker_badge_kind("군자금", "gold") != "gold":
failures.append("Gold event markers should use the generated gold badge")
if scene._event_marker_badge_kind("유인선", "tactic") != "tactic":
failures.append("Tactic event markers should use the generated tactic badge")
if scene._event_marker_badge_kind("군자금", "") != "gold":
failures.append("Event marker labels should infer generated badge kind when kind is absent")
if scene._event_marker_badge_kind("", "") != "event":
failures.append("Unknown event markers should use the generated event badge")
var background_fill: Color = scene._terrain_fill_color(Vector2i(0, 0), "G", true)
var fallback_fill: Color = scene._terrain_fill_color(Vector2i(0, 0), "G", false)
if background_fill.a >= 0.20:
@@ -5165,6 +5184,61 @@ func _check_class_icon_texture_path(failures: Array[String], path: String, conte
failures.append("%s should contain visible generated material contrast: %s" % [context, path])
func _check_map_badge_texture_path(failures: Array[String], path: String, context: String) -> void:
if path.is_empty():
failures.append("%s has an empty badge path" % context)
return
if not path.begins_with("res://"):
failures.append("%s must use a res:// path: %s" % [context, path])
return
if not FileAccess.file_exists(path):
failures.append("%s references missing map badge texture: %s" % [context, path])
return
var image := Image.new()
var err := image.load(path)
if err != OK:
failures.append("%s references unreadable map badge texture: %s" % [context, path])
return
if image.get_width() < 512 or image.get_height() < 512:
failures.append("%s should keep high-resolution source pixels: %s (%dx%d)" % [context, path, image.get_width(), image.get_height()])
return
if image.get_width() != image.get_height():
failures.append("%s should be square: %s (%dx%d)" % [context, path, image.get_width(), image.get_height()])
return
for corner in [Vector2i(0, 0), Vector2i(image.get_width() - 1, 0), Vector2i(0, image.get_height() - 1), Vector2i(image.get_width() - 1, image.get_height() - 1)]:
if image.get_pixelv(corner).a > 0.01:
failures.append("%s should have transparent corners: %s" % [context, path])
return
var opaque_samples := 0
var transparent_samples := 0
var green_fringe_samples := 0
var luma_min := 999.0
var luma_max := -999.0
var total_samples := 0
for y in range(0, image.get_height(), 8):
for x in range(0, image.get_width(), 8):
total_samples += 1
var pixel := image.get_pixel(x, y)
if pixel.a <= 0.01:
transparent_samples += 1
continue
if pixel.a >= 0.80:
opaque_samples += 1
if pixel.a > 0.05 and pixel.g > 0.92 and pixel.r < 0.08 and pixel.b < 0.08:
green_fringe_samples += 1
var luma := pixel.r * 0.299 + pixel.g * 0.587 + pixel.b * 0.114
luma_min = minf(luma_min, luma)
luma_max = maxf(luma_max, luma)
if transparent_samples < int(total_samples * 0.44):
failures.append("%s should keep transparent padding for map readability: %s (%d/%d sampled pixels)" % [context, path, transparent_samples, total_samples])
if opaque_samples < int(total_samples * 0.18):
failures.append("%s should contain readable generated badge artwork: %s (%d/%d sampled pixels)" % [context, path, opaque_samples, total_samples])
if green_fringe_samples > 0:
failures.append("%s should not keep chroma-key green pixels: %s (%d sampled)" % [context, path, green_fringe_samples])
if luma_max - luma_min < 0.08:
failures.append("%s should contain visible generated material contrast: %s" % [context, path])
func _check_terrain_texture_path(failures: Array[String], path: String, context: String) -> void:
if path.is_empty():
failures.append("%s has an empty texture path" % context)