fix(M01): correct ADT filename coordinate axes
Work-Package: M01-FND-COORD-TILE-AXIS-002 Agent: sindo-main-codex Tests: coordinate mapper, M00 calibration, baseline manifest, coordination and documentation gates passed Fidelity: Azeroth_31_49 raw MCNK origins and OpenRealm confirm filename X from world Y and filename Y from world X
This commit is contained in:
@@ -2,7 +2,7 @@ class_name AdtChunkCoordinate
|
||||
extends RefCounted
|
||||
|
||||
## Immutable MCNK chunk indices inside one ADT tile.
|
||||
## `chunk_x` grows south and `chunk_y` grows east, matching the canonical
|
||||
## `chunk_x` grows east and `chunk_y` grows south, matching the ADT header and
|
||||
## tile conversion contract rather than Godot's X/Z member names.
|
||||
|
||||
const MINIMUM_CHUNK_INDEX: int = 0
|
||||
|
||||
@@ -70,16 +70,16 @@ static func adt_placement_to_canonical(adt_position: AdtPlacementPosition) -> Ca
|
||||
## Exact south/east boundaries belong to the next tile by floor semantics.
|
||||
static func canonical_to_adt_tile(canonical_position: CanonicalWowWorldPosition) -> AdtTileCoordinate:
|
||||
return AdtTileCoordinate.new(
|
||||
int(floor(float(ADT_TILES_PER_MAP_AXIS) * 0.5 - canonical_position.x_yards / ADT_TILE_SIZE_YARDS)),
|
||||
int(floor(float(ADT_TILES_PER_MAP_AXIS) * 0.5 - canonical_position.y_yards / ADT_TILE_SIZE_YARDS))
|
||||
int(floor(float(ADT_TILES_PER_MAP_AXIS) * 0.5 - canonical_position.y_yards / ADT_TILE_SIZE_YARDS)),
|
||||
int(floor(float(ADT_TILES_PER_MAP_AXIS) * 0.5 - canonical_position.x_yards / ADT_TILE_SIZE_YARDS))
|
||||
)
|
||||
|
||||
|
||||
## Converts a canonical position to east/south offsets inside its ADT tile.
|
||||
static func canonical_to_adt_tile_local(canonical_position: CanonicalWowWorldPosition) -> AdtTileLocalPosition:
|
||||
var tile_coordinate := canonical_to_adt_tile(canonical_position)
|
||||
var tile_north_edge_x_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_x)) * ADT_TILE_SIZE_YARDS
|
||||
var tile_west_edge_y_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_y)) * ADT_TILE_SIZE_YARDS
|
||||
var tile_west_edge_y_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_x)) * ADT_TILE_SIZE_YARDS
|
||||
var tile_north_edge_x_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_y)) * ADT_TILE_SIZE_YARDS
|
||||
return AdtTileLocalPosition.new(
|
||||
tile_west_edge_y_yards - canonical_position.y_yards,
|
||||
canonical_position.z_yards,
|
||||
@@ -92,8 +92,8 @@ static func adt_tile_local_to_canonical(
|
||||
tile_coordinate: AdtTileCoordinate,
|
||||
local_position: AdtTileLocalPosition
|
||||
) -> CanonicalWowWorldPosition:
|
||||
var tile_north_edge_x_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_x)) * ADT_TILE_SIZE_YARDS
|
||||
var tile_west_edge_y_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_y)) * ADT_TILE_SIZE_YARDS
|
||||
var tile_west_edge_y_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_x)) * ADT_TILE_SIZE_YARDS
|
||||
var tile_north_edge_x_yards := (float(ADT_TILES_PER_MAP_AXIS) * 0.5 - float(tile_coordinate.tile_y)) * ADT_TILE_SIZE_YARDS
|
||||
return CanonicalWowWorldPosition.new(
|
||||
tile_north_edge_x_yards - local_position.south_yards,
|
||||
tile_west_edge_y_yards - local_position.east_yards,
|
||||
@@ -108,8 +108,8 @@ static func adt_tile_local_to_chunk(
|
||||
) -> AdtChunkCoordinate:
|
||||
return AdtChunkCoordinate.new(
|
||||
tile_coordinate,
|
||||
int(floor(local_position.south_yards / ADT_CHUNK_SIZE_YARDS)),
|
||||
int(floor(local_position.east_yards / ADT_CHUNK_SIZE_YARDS))
|
||||
int(floor(local_position.east_yards / ADT_CHUNK_SIZE_YARDS)),
|
||||
int(floor(local_position.south_yards / ADT_CHUNK_SIZE_YARDS))
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user