Show objectives on minimap

This commit is contained in:
2026-06-19 20:32:59 +09:00
parent 761b7f729e
commit ce2c1889bf
3 changed files with 89 additions and 2 deletions

View File

@@ -2926,6 +2926,9 @@ func _draw_minimap() -> void:
terrain_color.a = 0.76
draw_rect(_minimap_cell_rect(cell), terrain_color)
_draw_minimap_event_markers()
_draw_minimap_objective_markers()
for unit in state.get_living_units():
var cell: Vector2i = unit.get("pos", Vector2i(-1, -1))
if not state.is_inside(cell):
@@ -2943,6 +2946,61 @@ func _draw_minimap() -> void:
draw_rect(map_rect, Color(UI_BRUSH_RULE.r, UI_BRUSH_RULE.g, UI_BRUSH_RULE.b, 0.90), false, 1.5)
func _draw_minimap_objective_markers() -> void:
for cell in state.get_objective_cells():
if not state.is_inside(cell):
continue
var marker_rect := _minimap_marker_rect(cell, 1.36, 5.8, 9.0)
var center := marker_rect.get_center()
var diamond := PackedVector2Array([
Vector2(center.x, marker_rect.position.y),
Vector2(marker_rect.end.x, center.y),
Vector2(center.x, marker_rect.end.y),
Vector2(marker_rect.position.x, center.y)
])
var outline := PackedVector2Array([diamond[0], diamond[1], diamond[2], diamond[3], diamond[0]])
draw_colored_polygon(diamond, _minimap_objective_marker_fill_color())
draw_polyline(outline, _minimap_marker_outline_color(), 1.1)
func _draw_minimap_event_markers() -> void:
for marker in state.get_event_markers():
var cells = marker.get("cells", [])
if typeof(cells) != TYPE_ARRAY:
continue
var kind := str(marker.get("kind", "event"))
for cell in cells:
if typeof(cell) != TYPE_VECTOR2I or not state.is_inside(cell):
continue
var marker_rect := _minimap_marker_rect(cell, 1.05, 4.8, 7.0)
draw_rect(marker_rect, Color(0.020, 0.014, 0.010, 0.84))
draw_rect(marker_rect.grow(-1.0), _minimap_event_marker_fill_color(kind))
draw_rect(marker_rect, _minimap_marker_outline_color(), false, 1.0)
func _minimap_marker_rect(cell: Vector2i, scale: float = 1.0, min_size: float = 4.0, max_size: float = 8.0) -> Rect2:
var cell_rect := _minimap_cell_rect(cell)
var size := clampf(minf(cell_rect.size.x, cell_rect.size.y) * scale, min_size, max_size)
var map_rect := _minimap_map_rect()
var position := cell_rect.get_center() - Vector2(size * 0.5, size * 0.5)
position.x = clampf(position.x, map_rect.position.x, maxf(map_rect.position.x, map_rect.end.x - size))
position.y = clampf(position.y, map_rect.position.y, maxf(map_rect.position.y, map_rect.end.y - size))
return Rect2(position, Vector2(size, size))
func _minimap_objective_marker_fill_color() -> Color:
return Color(UI_SEAL_RED.r, UI_SEAL_RED.g, UI_SEAL_RED.b, 0.92)
func _minimap_event_marker_fill_color(kind: String) -> Color:
var color := _event_marker_color(kind)
return Color(color.r, color.g, color.b, 0.90)
func _minimap_marker_outline_color() -> Color:
return Color(UI_PARCHMENT_TEXT.r, UI_PARCHMENT_TEXT.g, UI_PARCHMENT_TEXT.b, 0.88)
func _current_battle_background_texture() -> Texture2D:
var next_path := state.get_map_background_path()
if next_path.is_empty():