MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GetSectorPoint

Function GetSectorPoint

TombEngine/Game/collision/floordata.cpp:410–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 2

GetSurfaceTriangleIDMethod · 0.85
GetSurfaceHeightMethod · 0.85

Calls 1

Vector2iClass · 0.50

Tested by

no test coverage detected