Link Search Menu Expand Document

Tiles and paths



int get_tile_fid(int tile)


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

Returns 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.


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

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


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

Returns the shortest path to a given tile using 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.



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


array tile_get_objs(int tileNum, int elevation)

Returns an array of all objects at given tile. It will include any hidden, dead or system objects (like cursor), so make sure to check properly when iterating.


int tile_light(int elevation, int tileNum)

Returns light intensity at the given tile in range from 0 to 65535.


void tile_refresh_display()

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


int tile_under_cursor