|
libtcod
|
Field-of-view functions for C. More...
Classes | |
| struct | TCOD_MapCell |
| Private map cell struct. More... | |
| struct | TCOD_Map |
| Private map struct. More... | |
Macros | |
| #define | FOV_PERMISSIVE(x) |
Typedefs | |
| typedef struct TCOD_Map | TCOD_Map |
| Private map struct. | |
| typedef TCOD_Map * | TCOD_map_t |
Enumerations | |
| enum | TCOD_fov_algorithm_t { FOV_BASIC , FOV_DIAMOND , FOV_SHADOW , FOV_PERMISSIVE_0 , FOV_PERMISSIVE_1 , FOV_PERMISSIVE_2 , FOV_PERMISSIVE_3 , FOV_PERMISSIVE_4 , FOV_PERMISSIVE_5 , FOV_PERMISSIVE_6 , FOV_PERMISSIVE_7 , FOV_PERMISSIVE_8 , FOV_RESTRICTIVE , FOV_SYMMETRIC_SHADOWCAST , NB_FOV_ALGORITHMS } |
Functions | |
| TCOD_Map * | TCOD_map_new (int width, int height) |
| Return a new TCOD_Map with width and height. | |
| void | TCOD_map_clear (TCOD_Map *map, bool transparent, bool walkable) |
| Set all cell values on map to the given parameters. | |
| TCOD_Error | TCOD_map_copy (const TCOD_Map *source, TCOD_Map *dest) |
| Clone map data from source to dest. | |
| void | TCOD_map_set_properties (TCOD_Map *map, int x, int y, bool is_transparent, bool is_walkable) |
| Change the properties of a single cell. | |
| void | TCOD_map_delete (TCOD_Map *map) |
| Free a TCOD_Map object. | |
| TCOD_Error | TCOD_map_compute_fov (TCOD_Map *map, int pov_x, int pov_y, int max_radius, bool light_walls, TCOD_fov_algorithm_t algo) |
| Calculate the field-of-view. | |
| bool | TCOD_map_is_in_fov (const TCOD_Map *map, int x, int y) |
| Return true if this cell was touched by the current field-of-view. | |
| void | TCOD_map_set_in_fov (TCOD_Map *map, int x, int y, bool fov) |
| Set the fov flag on a specific cell. | |
| bool | TCOD_map_is_transparent (const TCOD_Map *map, int x, int y) |
| Return true if this cell is transparent. | |
| bool | TCOD_map_is_walkable (TCOD_Map *map, int x, int y) |
| Return true if this cell is walkable. | |
| int | TCOD_map_get_width (const TCOD_Map *map) |
| Return the width of map. | |
| int | TCOD_map_get_height (const TCOD_Map *map) |
| Return the height of map. | |
| int | TCOD_map_get_nb_cells (const TCOD_Map *map) |
| Return the total number of cells in map. | |
Field-of-view functions for C.
| #define FOV_PERMISSIVE | ( | x | ) |
| enum TCOD_fov_algorithm_t |
embed:rst:leading-asterisk Field-of-view options for TCOD_map_compute_fov.
| Enumerator | |
|---|---|
| FOV_BASIC | Trace multiple Bresenham lines along the perimeter. Based on: http://www.roguebasin.com/index.php?title=Ray_casting |
| FOV_DIAMOND | Cast Bresenham line shadows on a per-tile basis. |
| FOV_SHADOW | Recursive Shadowcast. Based on: http://www.roguebasin.com/index.php?title=FOV_using_recursive_shadowcasting |
| FOV_PERMISSIVE_0 | Precise Permissive Field of View. Based on: http://www.roguebasin.com/index.php?title=Precise_Permissive_Field_of_View |
| FOV_RESTRICTIVE | Mingos' Restrictive Precise Angle Shadowcasting (contribution by Mingos). Based on: http://www.roguebasin.com/index.php?title=Restrictive_Precise_Angle_Shadowcasting |
| FOV_SYMMETRIC_SHADOWCAST | Symmetric Shadowcast. Based on: https://www.albertford.com/shadowcasting/ embed:rst:leading-asterisk .. versionadded :: 1.16 |
| void TCOD_map_clear | ( | TCOD_Map * | map, |
| bool | transparent, | ||
| bool | walkable ) |
Set all cell values on map to the given parameters.
This call also zeroes out the field-of-view attribute.
| TCOD_Error TCOD_map_compute_fov | ( | TCOD_Map * | map, |
| int | pov_x, | ||
| int | pov_y, | ||
| int | max_radius, | ||
| bool | light_walls, | ||
| TCOD_fov_algorithm_t | algo ) |
Calculate the field-of-view.
embed:rst:leading-asterisk `pov_x` and `pov_y` are the used as the field-of-view source. These coordinates must be within the map. `max_radius` is the maximum distance for the field-of-view algorithm. If `light_walls` is false then only transparent cells will be touched by the field-of-view. `algo` is one of the TCOD_fov_algorithm_t algorithms. After this call you may check if a cell is within the field-of-view by calling TCOD_map_is_in_fov. Returns an error code on failure. See TCOD_get_error for details.
| TCOD_Error TCOD_map_copy | ( | const TCOD_Map * | source, |
| TCOD_Map * | dest ) |
Clone map data from source to dest.
dest will be resized to match source if necessary.