| 408 | } |
| 409 | |
| 410 | Vector2i GetSectorPoint(int x, int z) |
| 411 | { |
| 412 | constexpr auto HALF_BLOCK = (int)BLOCK(0.5f); |
| 413 | |
| 414 | // Normalize x and z to [0, BLOCK_SIZE] before subtracting HALF_BLOCK. |
| 415 | int localX = ((x % BLOCK(1)) + BLOCK(1)) % BLOCK(1) - HALF_BLOCK; |
| 416 | int localZ = ((z % BLOCK(1)) + BLOCK(1)) % BLOCK(1) - HALF_BLOCK; |
| 417 | |
| 418 | // Return relative 2D point in range [0, BLOCK(1)]. |
| 419 | return Vector2i(localX, localZ); |
| 420 | } |
| 421 | |
| 422 | Vector2i GetRoomGridCoord(int roomNumber, int x, int z, bool clampToBounds) |
| 423 | { |
no test coverage detected