GetSectorCeilingZ

From ZDoom Wiki
Jump to navigation Jump to search

int GetSectorCeilingZ (int tag, int x, int y);

Usage

This returns the sector ceiling height at coordinates [x, y].

Parameters

  • tag: tag of the sector.
  • x, y: coordinates of the point (not fixed point value!).

Return value

Returns the sector ceiling height at coordinates [x, y] as a fixed point value. When used on sectors which share tags, it will return the ceiling height of the sector with the lowest sector number and the matching tag. If the sector is flat (ceiling is not sloped), this will just return the ceiling height no matter where the coordinates are specified, so [0, 0] is as good as anywhere. If the sector is sloped and the coordinates are specified in an area outside of the the sector, a projected height (the height the ceiling would be if the sector were extended to that area) is returned. If tag is 0, the function returns the ceiling height of whatever sector is found at [x, y].

Examples

This example will print the ceiling height in the sector of the specified tag at the coordinates of the specified tid.

script 1 (int tag, int tid)
{
  int x, y, z;
  x = GetActorX(tid) >> 16;
  y = GetActorY(tid) >> 16;
  z = GetSectorCeilingZ(tag, x, y);
  print(f:z);
}