Tiles and paths

Functions


get_tile_fid

int get_tile_fid(int tileData)
  • Returns FID information about the square under the given tile at elevation 0
  • Pass elevation as 4-bit number in bits 25-28 to access other elevations
  • Pass result mode in bits 29-32: 0 - ground FID, 1 - roof FID, 2 - raw data.

get_tile_ground_fid

sfall.h

int get_tile_ground_fid(int tileNum, int elevation)

Returns FID of a ground tile at the given tile number and elevation.


get_tile_roof_fid

sfall.h

int get_tile_roof_fid(int tileNum, int elevation)

Returns FID of a roof tile at the given tile number and elevation. Note that FID of 1 is used when there is no actual roof.


obj_blocking_line

ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType)

Returns the first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h).

  • If path is clear (no blocker was encountered by selected function) - returns 0.
  • objFrom is always excluded from calculations, but is required to be a valid object.

obj_blocking_tile

ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType)

Returns the first object blocking the given tile using the given blocking function, or 0 if the tile is clear.


path_find_to

array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType)

Returns the shortest path to a given tile using the given blocking function as an array of tile directions (0..5) to move on each step.

  • Array length equals to a number of steps.
  • Empty array means that specified target cannot be reached.

tile_by_position

sfall.h

int tile_by_position(int x, int y)
  • returns the tile number at the x, y position relative to the top-left corner of the screen
  • if the position is outside of the range of tiles, it will return -1

tile_get_objs

array tile_get_objs(int tileNum, int elevation)

Returns an array of all objects at the given tile.

  • It will include any hidden, dead or system objects (like cursor), so make sure to check properly when iterating.

tile_light

int tile_light(int elevation, int tileNum)

Returns light intensity at the given tile in the range of 0 to 65536.


tile_refresh_display

void tile_refresh_display

Redraws the game scene (tiles, walls, objects, etc.).


tile_under_cursor

int tile_under_cursor

This site uses Just the Docs, a documentation theme for Jekyll.