diff --git a/README.md b/README.md index 456868a..cc8a773 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Godot 4 tactical RPG prototype inspired by classic turn-based Romance of the Thr - Victory and defeat result overlay. - Dialogue portrait slot stays fixed across speaker and narration lines, with officer default image paths, optional per-line overrides, and speaker-initial or record fallback. - Initial AI-generated photorealistic officer portraits for Cao Cao, Xiahou Dun, Xiahou Yuan, Cao Ren, Dian Wei, Guo Jia, and Zhang He. -- AI-generated scenario battlefield backgrounds, opening story panels, terrain textures, transparent class units, transparent generic-enemy units, item icons, toolbar UI icons, generated UI panel frames, and generated button surfaces live under `art/backgrounds`, `art/story`, `art/terrain`, `art/units`, `art/items`, `art/ui/icons`, `art/ui/panels`, and `art/ui/buttons`. +- AI-generated scenario battlefield backgrounds, opening story panels, terrain textures, transparent class units, transparent generic-enemy units, item icons, toolbar UI icons, generated UI panel frames, generated button surfaces, and tactical tile markers live under `art/backgrounds`, `art/story`, `art/terrain`, `art/units`, `art/items`, `art/ui/icons`, `art/ui/panels`, `art/ui/buttons`, and `art/ui/tiles`. - Battle HUD portrait thumbnails show the selected unit, or a hovered unit when nothing is selected. - Selected and hovered unit focus text shows combat role, movement type, current terrain move cost, terrain bonuses, core stats, and status effects. - Dialogue lines can mark speaking side for text alignment inside a fixed visual-novel-style dialogue panel with stable portrait, progress, and previous-line controls. diff --git a/art/ui/tiles/tile_marker_attack.png b/art/ui/tiles/tile_marker_attack.png new file mode 100644 index 0000000..9f69a9d Binary files /dev/null and b/art/ui/tiles/tile_marker_attack.png differ diff --git a/art/ui/tiles/tile_marker_move.png b/art/ui/tiles/tile_marker_move.png new file mode 100644 index 0000000..2f54e54 Binary files /dev/null and b/art/ui/tiles/tile_marker_move.png differ diff --git a/art/ui/tiles/tile_marker_objective.png b/art/ui/tiles/tile_marker_objective.png new file mode 100644 index 0000000..e813870 Binary files /dev/null and b/art/ui/tiles/tile_marker_objective.png differ diff --git a/art/ui/tiles/tile_marker_recover.png b/art/ui/tiles/tile_marker_recover.png new file mode 100644 index 0000000..2425007 Binary files /dev/null and b/art/ui/tiles/tile_marker_recover.png differ diff --git a/art/ui/tiles/tile_marker_select.png b/art/ui/tiles/tile_marker_select.png new file mode 100644 index 0000000..f3bface Binary files /dev/null and b/art/ui/tiles/tile_marker_select.png differ diff --git a/art/ui/tiles/tile_marker_target.png b/art/ui/tiles/tile_marker_target.png new file mode 100644 index 0000000..b748929 Binary files /dev/null and b/art/ui/tiles/tile_marker_target.png differ diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 40f4485..cfae6c3 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -62,7 +62,7 @@ Joined officers gate whether `requires_joined` player deployments are loaded at Inventory and campaign flags are copied from `CampaignState` into `BattleState` when a scenario starts. The pre-battle Chapters overview reads `CampaignState` chapter progress and can load completed or current battles without mutating the save. Briefings preview first-clear rewards, can expose `briefing.camp_conversations` through a selectable Talk menu with `briefing.camp_dialogue` as a fallback, can filter those conversations by saved campaign flags, can claim saved one-time camp conversation supply effects through `CampaignState` and refresh the loaded battle inventory copy, and show completed replay rewards as already claimed. The pre-battle Save menu can write the current campaign state to `user://campaign_manual_save.json`, and loading that checkpoint restores it into `user://campaign_save.json` before re-entering the same pending-choice, completion, or current-briefing branch as startup. Pre-battle shop stock comes from the loaded scenario's `shop.items` list plus matching `shop.conditional_items` blocks, with optional finite limits from item entries or `stock` maps, and `shop.merchant` lines are presentation-only camp flavor. Shop purchases and 50% sell-back are campaign transactions: they update saved gold, unequipped inventory, and finite-stock purchase counts immediately, write the save file, and refresh the already-loaded battle inventory before the player begins the battle. Camp conversation supply claims are also campaign transactions: they save a per-scenario conversation claim ledger and inventory immediately, then refresh the already-loaded battle inventory. Pre-battle Armory equipment changes use the same equipment rules as battle HUD equipment changes, then immediately save merged roster equipment/stat snapshots and inventory stock. Pre-battle Roster uses scenario `roster.max_units`, `roster.required_officers`, and `roster.required_units` to mark optional player deployments as sortie or reserve; reserve units remain in the candidate list but are excluded from board occupancy, drawing, selection, AI targeting, and living-unit victory checks. Non-controllable player units can act as protected escort targets: enemies can attack them and conditions can reference them, but they are skipped by player selection, Armory, Formation, counterattacks, and campaign roster progression snapshots when `persist_progression` is false. Scenario `ai_target_priority` nudges enemy movement and damage-skill scoring toward important targets such as envoys without overriding defeat bonuses or range checks, and `set_ai_target_priority` events can retune that battle-only pressure after an ambush, gate closure, or escort exposure. Pre-battle Formation uses the loaded scenario's `formation.cells` and only mutates current battle unit positions before battle-begin events fire. Destination victory cells from `unit_reaches_tile` conditions are exposed to the scene for objective overlays and tile info, and can be expressed as one `pos` or a multi-cell `cells` list; gated victory conditions can also expose the `unit_reaches_tile` event that unlocks them as the next visible objective marker. Rewarding movement events that grant items or gold can expose optional battlefield side markers and Korean tile-info labels through `when.label`, without being treated as victory objectives. Movement-triggered `unit_reaches_tile` events receive the unit that just moved, so ambushes and pickup events fire on entry rather than from units already standing on a marker; `unit_defeated` events receive the fallen unit before final victory/defeat checks, allowing named-officer reactions and last-moment reinforcements. Briefing data can append matching `briefing.conditional_lines`, and scenario events can use `when.campaign_flags` to branch dialogue, objective changes, item and gold pickups, AI target-priority shifts, and reinforcements from saved campaign choices or `when.after_event` to wait for earlier scenario beats. Consumable use can restore HP or MP, cure matching poison/seal/snare/disarm statuses, or cleanse negative stat debuffs, and in-battle item use, event pickup grants, event gold pickups, plus equipment swaps mutate only the battle copy until victory; defeats and restarts do not spend saved items, keep picked-up items or gold, or preserve in-battle gear changes. Post-battle choices write campaign `flags` only after the result-panel button is pressed; if the player reloads after rewards are saved but before selecting, the pending scenario id restores the victory choice panel without replaying rewards. The next battle button stays locked until the campaign choice save succeeds. Equipment rewards share the same `item_id -> count` inventory stock, cover weapon, armor, and accessory slots, can be equipped from the side HUD before the selected unit moves or acts, and do not appear in the consumable action menu. Named equipment currently uses the same stock model with a presentation-only rarity tag rather than unique item instances. Already completed scenarios can be replayed without granting duplicate rewards, choices, replay inventory consumption, event gold pickups, save writes, current-scenario advancement, finite-stock purchases, or camp conversation supply claims; pre-battle Shop, Armory, Roster, Formation, and Save are disabled on completed-scenario replays to avoid side effects. -The battle scene owns presentation feedback: briefing and result states use menu BGM, briefing headers combine `CampaignState` chapter ranges, campaign order, and title data with `BattleState` briefing, objective text, condition-progress text, and defeat-risk text, active battles use battle BGM and show an objective/progress/risk panel fed by `BattleState`, objective-update signals show a short HUD notice and refresh the objective panel immediately, core panels prefer generated lacquer, scroll, jade, and command-seal `StyleBoxTexture` frames with flat ink/wood/jade styles as fallbacks, core buttons prefer generated lacquer, jade-hover, cinnabar-pressed, and disabled-ink `StyleBoxTexture` surfaces with flat styles as fallbacks, dialogue lines can show optional cached portrait textures or speaker-initial fallback panels in an expanded visual-novel-style panel, keep the portrait slot fixed even for narration lines, mark speaking side through text alignment, and expose progress plus previous-line controls while a sequence is open, the side HUD reuses cached officer portrait textures or class sprites for the selected unit or hovered unit and formats focus text with role, movement type, facing, current terrain move cost, defense/avoid bonuses, core stats, status effects, guard-zone AI hints, and gear, board maps can draw a scenario background texture under translucent terrain overlays, generated terrain texture tiles, connected road segments, terrain detail patterns, shoreline/castle/forest/hill edge blends, compact recovery markers for healing terrain, compact side-event markers for visible item/gold pickups, and move-attack target badges for enemies that can be struck after movement, board units render class sprite tokens or generic-enemy transparent class cutouts, team rings, facing markers, generic-enemy marks, officer pins, low-HP warning rings, HP bar color states, active support/debuff/poison/seal/snare/disarm status pips, and a scene-clocked idle stance whose intensity reacts to selected, acted, and low-HP unit state, item buttons can show optional cached item icons, hover previews are rendered as target badges from existing `BattleState` forecast APIs and include compact side/rear attack bonuses when facing matters, equipment option menus show stat/range/effect deltas, result and inventory summaries show named equipment with compact rarity tags, selected area tactics highlight their affected cells, the Threat toggle overlays enemy physical and hostile tactic reach while tile info names threat sources, estimates physical damage, and summarizes hostile tactic damage or status effects against occupied cells, log/result hooks trigger placeholder SFX, support, debuff, poison, seal, snare, disarm, objective updates, AI target-focus changes, and item/gold pickup effects use distinct feedback, `BattleState.unit_motion_requested` asks the scene to interpolate a unit's draw position during movement, `BattleState.unit_action_motion_requested` keeps its rules-facing signal shape while the scene maps attacker class ids to infantry, archer, cavalry, command, and heavy attack presentation profiles, and `BattleState.combat_feedback_requested` asks the scene to draw transient floating combat text without changing battle rules. +The battle scene owns presentation feedback: briefing and result states use menu BGM, briefing headers combine `CampaignState` chapter ranges, campaign order, and title data with `BattleState` briefing, objective text, condition-progress text, and defeat-risk text, active battles use battle BGM and show an objective/progress/risk panel fed by `BattleState`, objective-update signals show a short HUD notice and refresh the objective panel immediately, core panels prefer generated lacquer, scroll, jade, and command-seal `StyleBoxTexture` frames with flat ink/wood/jade styles as fallbacks, core buttons prefer generated lacquer, jade-hover, cinnabar-pressed, and disabled-ink `StyleBoxTexture` surfaces with flat styles as fallbacks, dialogue lines can show optional cached portrait textures or speaker-initial fallback panels in an expanded visual-novel-style panel, keep the portrait slot fixed even for narration lines, mark speaking side through text alignment, and expose progress plus previous-line controls while a sequence is open, the side HUD reuses cached officer portrait textures or class sprites for the selected unit or hovered unit and formats focus text with role, movement type, facing, current terrain move cost, defense/avoid bonuses, core stats, status effects, guard-zone AI hints, and gear, board maps can draw a scenario background texture under translucent terrain overlays, generated terrain texture tiles, generated tactical tile markers for move, attack, selection, target, objective, and recovery overlays, connected road segments, terrain detail patterns, shoreline/castle/forest/hill edge blends, compact recovery markers for healing terrain, compact side-event markers for visible item/gold pickups, and move-attack target badges for enemies that can be struck after movement, board units render class sprite tokens or generic-enemy transparent class cutouts, team rings, facing markers, generic-enemy marks, officer pins, low-HP warning rings, HP bar color states, active support/debuff/poison/seal/snare/disarm status pips, and a scene-clocked idle stance whose intensity reacts to selected, acted, and low-HP unit state, item buttons can show optional cached item icons, hover previews are rendered as target badges from existing `BattleState` forecast APIs and include compact side/rear attack bonuses when facing matters, equipment option menus show stat/range/effect deltas, result and inventory summaries show named equipment with compact rarity tags, selected area tactics highlight their affected cells, the Threat toggle overlays enemy physical and hostile tactic reach while tile info names threat sources, estimates physical damage, and summarizes hostile tactic damage or status effects against occupied cells, log/result hooks trigger placeholder SFX, support, debuff, poison, seal, snare, disarm, objective updates, AI target-focus changes, and item/gold pickup effects use distinct feedback, `BattleState.unit_motion_requested` asks the scene to interpolate a unit's draw position during movement, `BattleState.unit_action_motion_requested` keeps its rules-facing signal shape while the scene maps attacker class ids to infantry, archer, cavalry, command, and heavy attack presentation profiles, and `BattleState.combat_feedback_requested` asks the scene to draw transient floating combat text without changing battle rules. Large tactical maps are presented through a fixed visible map window rather than by shrinking the whole board, including the opening chapter-one battle. `BattleScene` keeps a clamped `board_scroll_offset`, scrolls the board while the mouse is near or slightly outside the visible map edge, brightens the scrollable frame edge under the cursor, ignores board clicks outside the visible map window, and draws a small minimap plate only when the board actually exceeds the visible map view; the minimap shows terrain, unit dots, objective seals, and side-event markers, and clicking or dragging it recenters the tactical viewport, while compact maps keep the lower-right tiles unobstructed. Board-attached command panels are repositioned after map scrolling so post-move choices stay beside the moved unit. Battle start focuses the board on the deployed player group, pre-battle Formation can focus the board on the selected unit even before the battle opens, and action feedback can focus the board on off-screen cells before motion or combat effects play. diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index 52880d7..e23a8c7 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -31,6 +31,7 @@ const TITLE_PORTRAIT_PATH := "res://art/portraits/cao_cao.png" const TOOLBAR_ICON_PATH_TEMPLATE := "res://art/ui/icons/toolbar_%s.png" const PANEL_TEXTURE_PATH_TEMPLATE := "res://art/ui/panels/panel_%s.png" const BUTTON_TEXTURE_PATH_TEMPLATE := "res://art/ui/buttons/button_%s.png" +const TILE_MARKER_TEXTURE_PATH_TEMPLATE := "res://art/ui/tiles/tile_marker_%s.png" const TERRAIN_TEXTURE_PATH_TEMPLATE := "res://art/terrain/terrain_%s.png" const OPENING_PROLOGUE_REBELLION_PATH := "res://art/story/opening/yellow_turban_rebellion.png" const OPENING_PROLOGUE_RESOLVE_PATH := "res://art/story/opening/cao_cao_resolves.png" @@ -40,8 +41,8 @@ const SETTINGS_PATH := "user://heros_settings.json" const SETTINGS_SAVE_VERSION := 1 const OPENING_PROLOGUE_PAGES := [ { - "title": "낙양의 그늘", - "body": "젊은 조조는 재주와 결단으로 이름을 얻었지만, 조정 안팎의 권세와 부패를 가까이 보며 법만으로는 세상을 붙들기 어렵다는 것을 알았다.", + "title": "황건의 난", + "body": "누런 머릿수건을 맨 무리가 고을을 불태우고 길을 끊었다. 젊은 조조는 무너지는 질서와 굶주린 백성을 보며 더는 관망할 수 없음을 깨달았다.", "image": OPENING_PROLOGUE_REBELLION_PATH }, { @@ -56,7 +57,7 @@ const OPENING_PROLOGUE_PAGES := [ }, { "title": "영천으로", - "body": "황건의 깃발이 영천 들판에 섰다. 마을과 성채를 기대어 버티는 잔당을 꺾고, 백성이 빠져나갈 길을 열어야 한다.", + "body": "영천 들판에서 조조와 하후돈은 황건적의 깃발을 마주했다. 마을과 성채를 기대어 버티는 적을 꺾고, 백성이 빠져나갈 길을 열어야 한다.", "image": OPENING_PROLOGUE_YINGCHUAN_PATH } ] @@ -4866,6 +4867,24 @@ func _load_terrain_texture(terrain_key: String) -> Texture2D: return _load_art_texture(TERRAIN_TEXTURE_PATH_TEMPLATE % normalized_key) +func _load_tile_marker_texture(marker_key: String) -> Texture2D: + var normalized_key := marker_key.strip_edges().to_lower() + if normalized_key.is_empty(): + return null + return _load_art_texture(TILE_MARKER_TEXTURE_PATH_TEMPLATE % normalized_key) + + +func _draw_tile_marker(marker_key: String, rect: Rect2, modulate: Color = Color.WHITE, inset: float = 0.0) -> bool: + var texture := _load_tile_marker_texture(marker_key) + if texture == null: + return false + var target_rect := rect.grow(-inset) + if target_rect.size.x <= 0.0 or target_rect.size.y <= 0.0: + return false + draw_texture_rect(texture, target_rect, false, modulate) + return true + + func _terrain_texture_modulate(cell: Vector2i, terrain_key: String, has_background: bool) -> Color: var alpha := 0.17 if has_background else 0.58 if terrain_key == "W": @@ -5235,32 +5254,39 @@ func _draw_objective_corner(origin: Vector2, x_dir: Vector2, y_dir: Vector2, len func _draw_overlays() -> void: for cell in state.get_objective_cells(): - _draw_objective_seal_marker(_rect_for_cell(cell)) + 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)) 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)) 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)) 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)) 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)) 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)) if not selected_skill_id.is_empty() and skill_cells.has(hover_cell): var area_selected := state.get_selected_unit() @@ -5269,31 +5295,39 @@ func _draw_overlays() -> void: 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)) 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)) 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)) if state.is_inside(hover_cell): var hover_color := Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.42) + var hover_marker := "select" var hover_unit := state.get_unit_at(hover_cell) var selected := state.get_selected_unit() if formation_menu != null and formation_menu.visible and state.is_formation_cell(hover_cell): hover_color = Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.66) elif not selected_skill_id.is_empty() and skill_cells.has(hover_cell): hover_color = Color(UI_MUTED_JADE.r, UI_MUTED_JADE.g, UI_MUTED_JADE.b, 0.58) + hover_marker = "recover" elif not selected_item_id.is_empty() and item_cells.has(hover_cell): hover_color = Color(0.52, 0.70, 0.30, 0.54) + hover_marker = "recover" 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)) func _draw_units() -> void: @@ -5308,6 +5342,10 @@ func _draw_units() -> void: var team_color := PLAYER_COLOR if unit.get("team", "") == BattleState.TEAM_PLAYER else ENEMY_COLOR var acted := bool(unit.get("acted", false)) var sprite_modulate := _unit_sprite_modulate(unit, acted) + var selected_unit: bool = str(unit.get("id", "")) == state.selected_unit_id + var selection_frame_drawn := false + if selected_unit: + selection_frame_drawn = _draw_tile_marker("select", rect.grow(2.0), Color(1.0, 1.0, 1.0, 0.82)) draw_circle(center + Vector2(0, 18), 22, Color(0.0, 0.0, 0.0, 0.28)) _draw_unit_class_emblem(rect, center, unit, team_color) @@ -5323,8 +5361,8 @@ func _draw_units() -> void: draw_rect(hp_front, _unit_hp_color(hp_ratio)) _draw_unit_status_markers(center, hp_ratio, unit) - if unit.get("id", "") == state.selected_unit_id: - draw_arc(center, 29, 0.0, TAU, 48, Color(1.0, 0.92, 0.25), 3.0) + if selected_unit and not selection_frame_drawn: + draw_arc(center, 29, 0.0, TAU, 48, Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.92), 3.0) _draw_unit_nameplate(rect, _short_name(String(unit["name"]))) @@ -5344,6 +5382,7 @@ func _draw_target_selection_markers() -> void: _draw_auto_attack_origin_marker(marker, color, font) draw_rect(rect.grow(-3.0), Color(color.r, color.g, color.b, 0.18)) draw_rect(rect.grow(-6.0), color, false, 2.2) + _draw_tile_marker("target", rect, Color(1.0, 1.0, 1.0, 0.72)) draw_rect(marker_rect, Color(0.025, 0.028, 0.034, 0.88)) draw_rect(marker_rect, color, false, 1.4) _draw_ink_text(font, marker_rect.position + Vector2(0, 13), str(marker.get("text", "표")), HORIZONTAL_ALIGNMENT_CENTER, marker_rect.size.x, 12, color) @@ -5374,6 +5413,7 @@ func _draw_auto_attack_origin_marker(marker: Dictionary, target_color: Color, fo var marker_rect := _auto_attack_origin_marker_rect(origin) draw_rect(origin_rect.grow(-8.0), Color(move_color.r, move_color.g, move_color.b, 0.17)) draw_rect(origin_rect.grow(-10.0), move_color, false, 1.8) + _draw_tile_marker("move", origin_rect, Color(1.0, 1.0, 1.0, 0.56)) draw_rect(marker_rect, Color(0.025, 0.028, 0.034, 0.86)) draw_rect(marker_rect, move_color, false, 1.2) _draw_ink_text(font, marker_rect.position + Vector2(0, 13), "진", HORIZONTAL_ALIGNMENT_CENTER, marker_rect.size.x, 12, move_color) diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index a09a230..6006e19 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -94,6 +94,7 @@ func _init() -> void: _check_generated_toolbar_icons(failures) _check_generated_panel_textures(failures) _check_generated_button_textures(failures) + _check_generated_tile_marker_textures(failures) _check_generated_terrain_textures(failures) _check_scene_texture_loading(failures) _check_hud_focus_text(failures) @@ -2991,6 +2992,12 @@ func _check_generated_button_textures(failures: Array[String]) -> void: _check_button_texture_path(failures, "res://art/ui/buttons/button_%s.png" % button_key, "button texture %s" % button_key) +func _check_generated_tile_marker_textures(failures: Array[String]) -> void: + var marker_keys := ["move", "attack", "select", "target", "objective", "recover"] + for marker_key in marker_keys: + _check_tile_marker_texture_path(failures, "res://art/ui/tiles/tile_marker_%s.png" % marker_key, "tile marker %s" % marker_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: @@ -3011,6 +3018,8 @@ func _check_scene_texture_loading(failures: Array[String]) -> void: var panacea: Dictionary = scene.state.get_item_def("panacea") if scene._load_art_texture(str(panacea.get("icon", ""))) == null: failures.append("battle scene should load panacea icon texture") + if scene._load_tile_marker_texture("move") == null or scene._load_tile_marker_texture("target") == null: + failures.append("battle scene should load generated tactical tile marker 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", []) @@ -5035,6 +5044,61 @@ func _check_button_texture_path(failures: Array[String], path: String, context: failures.append("%s should contain visible material contrast: %s" % [context, path]) +func _check_tile_marker_texture_path(failures: Array[String], path: String, context: String) -> void: + if path.is_empty(): + failures.append("%s has an empty marker 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 tile marker texture: %s" % [context, path]) + return + var image := Image.new() + var err := image.load(path) + if err != OK: + failures.append("%s references unreadable tile marker 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 a square tactical marker: %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.g > 0.80 and pixel.r < 0.18 and pixel.b < 0.18: + 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.50): + failures.append("%s should keep the map visible through transparent center space: %s (%d/%d sampled pixels)" % [context, path, transparent_samples, total_samples]) + if opaque_samples < int(total_samples * 0.16): + failures.append("%s should contain readable generated marker 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)