Improve chapter one map controls

This commit is contained in:
2026-06-19 16:59:58 +09:00
parent a851eef72b
commit e70a4da0a6
2 changed files with 44 additions and 5 deletions

View File

@@ -109,6 +109,7 @@ func _check_edge_scroll_velocity_curve(scene, view_rect: Rect2, failures: Array[
"_edge_scroll_axis_velocity",
"_edge_scroll_pressure",
"_edge_scroll_speed_for_pressure",
"_edge_scroll_activation_rect",
"_edge_scroll_next_offset"
]:
if not scene.has_method(method_name):
@@ -139,9 +140,20 @@ func _check_edge_scroll_velocity_curve(scene, view_rect: Rect2, failures: Array[
if top_left.length() > max_edge_speed + 0.01:
failures.append("corner edge scroll should cap diagonal speed: %.2f > %.2f" % [top_left.length(), max_edge_speed])
var outside_velocity: Vector2 = scene._edge_scroll_velocity_for_position(view_rect.position - Vector2(4.0, 4.0), view_rect)
if outside_velocity != Vector2.ZERO:
failures.append("edge scroll should ignore mouse positions outside the map view: %s" % str(outside_velocity))
var near_outside_left: Vector2 = scene._edge_scroll_velocity_for_position(view_rect.position - Vector2(4.0, 0.0), view_rect)
if near_outside_left.x <= 0.0:
failures.append("edge scroll should continue when the mouse slightly crosses the left map edge: %s" % str(near_outside_left))
var near_outside_right: Vector2 = scene._edge_scroll_velocity_for_position(Vector2(view_rect.end.x + 4.0, view_rect.get_center().y), view_rect)
if near_outside_right.x >= 0.0:
failures.append("edge scroll should continue when the mouse slightly crosses the right map edge: %s" % str(near_outside_right))
var near_outside_corner: Vector2 = scene._edge_scroll_velocity_for_position(view_rect.position - Vector2(4.0, 4.0), view_rect)
if near_outside_corner.x <= 0.0 or near_outside_corner.y <= 0.0:
failures.append("edge scroll should keep diagonal movement just outside the map corner: %s" % str(near_outside_corner))
if near_outside_corner.length() > max_edge_speed + 0.01:
failures.append("near-outside corner edge scroll should cap diagonal speed: %.2f > %.2f" % [near_outside_corner.length(), max_edge_speed])
var far_outside_velocity: Vector2 = scene._edge_scroll_velocity_for_position(view_rect.position - Vector2(scene.EDGE_SCROLL_OUTER_MARGIN + 8.0, scene.EDGE_SCROLL_OUTER_MARGIN + 8.0), view_rect)
if far_outside_velocity != Vector2.ZERO:
failures.append("edge scroll should ignore mouse positions far outside the map view: %s" % str(far_outside_velocity))
var hard_right_position := Vector2(view_rect.end.x - 2.0, view_rect.get_center().y)
var moved_right: Vector2 = scene._edge_scroll_next_offset(Vector2.ZERO, hard_right_position, view_rect, 0.25)
@@ -1194,11 +1206,16 @@ func _check_pixel_unit_helpers(failures: Array[String]) -> void:
"_draw_pixel_archer",
"_draw_pixel_cavalry",
"_draw_pixel_strategist",
"_draw_pixel_heavy"
"_draw_pixel_heavy",
"_draw_unit_class_emblem",
"_draw_unit_class_badge",
"_draw_unit_identity_marks",
"_unit_class_abbrev"
]:
if not scene.has_method(method_name):
failures.append("missing pixel-map unit helper: %s" % method_name)
_check_pixel_unit_profiles(scene, failures)
_check_pixel_unit_class_labels(scene, failures)
scene.free()
@@ -1244,3 +1261,17 @@ func _check_pixel_unit_profiles(scene, failures: Array[String]) -> void:
failures.append("ranged pixel profile should keep an explicit bow silhouette")
if str((profiles["infantry"] as Dictionary).get("weapon", "")) != "shield_spear":
failures.append("infantry pixel profile should keep shield and spear silhouette")
func _check_pixel_unit_class_labels(scene, failures: Array[String]) -> void:
var expected_labels := {
"infantry": "",
"archer": "",
"cavalry": "",
"strategist": "",
"bandit": ""
}
for class_id in expected_labels.keys():
var label := str(scene._unit_class_abbrev({"class_id": class_id}))
if label != str(expected_labels[class_id]):
failures.append("pixel unit class badge should use Hangul label for %s: %s" % [class_id, label])