Defines |
|
#define | DEBUG_OLDFLAGS 1 |
Functions |
| static void | load_objects (mapstruct *m, FILE *fp, int mapflags) |
| static void | save_objects (mapstruct *m, FILE *fp, FILE *fp2) |
| static void | allocate_map (mapstruct *m) |
| static void | free_all_objects (mapstruct *m) |
| static mapstruct * | load_and_link_tiled_map (mapstruct *orig_map, int tile_num) |
| static int | relative_tile_position_rec (mapstruct *map1, mapstruct *map2, int *x, int *y, uint32 id, int level) |
| static int | relative_tile_position (mapstruct *map1, mapstruct *map2, int *x, int *y) |
| mapstruct * | has_been_loaded_sh (shstr *name) |
| char * | create_pathname (const char *name) |
| static char * | create_items_path (shstr *s) |
| int | check_path (const char *name, int prepend_dir) |
| char * | normalize_path (const char *src, const char *dst, char *path) |
| void | dump_map (mapstruct *m) |
| void | dump_all_maps () |
| int | wall (mapstruct *m, int x, int y) |
| int | blocks_view (mapstruct *m, int x, int y) |
| int | blocks_magic (mapstruct *m, int x, int y) |
| int | blocks_cleric (mapstruct *m, int x, int y) |
| int | blocked (object *op, mapstruct *m, int x, int y, int terrain) |
| int | blocked_link (object *op, int xoff, int yoff) |
| int | blocked_link_2 (object *op, mapstruct *map, int x, int y) |
| int | blocked_tile (object *op, mapstruct *m, int x, int y) |
| int | arch_blocked (archetype *at, object *op, mapstruct *m, int x, int y) |
| void | set_map_darkness (mapstruct *m, int value) |
| mapstruct * | get_linked_map () |
| mapstruct * | get_empty_map (int sizex, int sizey) |
| mapstruct * | load_original_map (const char *filename, int flags) |
| static mapstruct * | load_temporary_map (mapstruct *m) |
| static void | delete_unique_items (mapstruct *m) |
| static void | load_unique_objects (mapstruct *m) |
| int | new_save_map (mapstruct *m, int flag) |
| void | free_map (mapstruct *m, int flag) |
| void | delete_map (mapstruct *m) |
| mapstruct * | ready_map_name (const char *name, int flags) |
| void | clean_tmp_map (mapstruct *m) |
| void | free_all_maps () |
| void | update_position (mapstruct *m, int x, int y) |
| void | set_map_reset_time (mapstruct *map) |
| mapstruct * | get_map_from_coord (mapstruct *m, int *x, int *y) |
| mapstruct * | get_map_from_coord2 (mapstruct *m, int *x, int *y) |
| int | get_rangevector (object *op1, object *op2, rv_vector *retval, int flags) |
| int | get_rangevector_from_mapcoords (mapstruct *map1, int x1, int y1, mapstruct *map2, int x2, int y2, rv_vector *retval, int flags) |
| int | on_same_map (object *op1, object *op2) |
| int | players_on_map (mapstruct *m) |
| int | wall_blocked (mapstruct *m, int x, int y) |
| void | SockList_AddMapName (SockList *sl, object *pl, mapstruct *map, object *map_info) |
| void | SockList_AddMapMusic (SockList *sl, object *pl, mapstruct *map, object *map_info) |
| void | SockList_AddMapWeather (SockList *sl, object *pl, mapstruct *map, object *map_info) |
Variables |
| int | global_darkness_table [MAX_DARKNESS+1] |
| int | map_tiled_reverse [TILED_MAPS] |
Map related functions.
Definition in file map.c.
This is used by get_player to determine where the other creature is. get_rangevector takes into account map tiling, so you just can not look the the map coordinates and get the right value. distance_x/y are distance away, which can be negative. direction is the crossfire direction scheme that the creature should head. part is the part of the monster that is closest.
get_rangevector looks at op1 and op2, and fills in the structure for op1 to get to op2. We already trust that the caller has verified that the two objects are at least on adjacent maps. If not, results are not likely to be what is desired. if the objects are not on maps, results are also likely to be unexpected
Flags: 0x1 is don't translate for closest body part. 0x2 is do recursive search on adjacent tiles. + any flags accepted by get_rangevector_from_mapcoords() below.
Returns TRUE if successful, or FALSE otherwise.
- Todo:
- Document.
Definition at line 2760 of file map.c.
| int get_rangevector_from_mapcoords |
( |
mapstruct * |
map1, |
|
|
int |
x1, |
|
|
int |
y1, |
|
|
mapstruct * |
map2, |
|
|
int |
x2, |
|
|
int |
y2, |
|
|
rv_vector * |
retval, |
|
|
int |
flags |
|
) |
| |
This is the base for get_rangevector above, but can more generally compute the rangvector between any two points on any maps.
The part field of the rangevector is always set to NULL by this function. (Since we don't actually know about any objects)
If the function fails (because of the maps being separate), it will return FALSE and the vector is not otherwise touched. Otherwise it will return TRUE.
Calculates manhattan distance (dx+dy) per default. (fast)
- Flags: 0x4 - calculate euclidean (straight line) distance (slow) 0x8 - calculate diagonal (max(dx + dy)) distance (fast) 0x8|0x04 - don't calculate distance (or direction) (fastest)
- Todo:
- Document.
Definition at line 2821 of file map.c.
| char* normalize_path |
( |
const char * |
src, |
|
|
const char * |
dst, |
|
|
char * |
path |
|
) |
| |
Make path absolute and remove ".." and "." entries.
path will become a normalized (absolute) version of the path in dst, with all relative path references (".." and "." - parent directory and same directory) resolved (path will not contain any ".." or "." elements, even if dst did).
If dst was not already absolute, the directory part of src will be used as the base path and dst will be added to it.
- Parameters:
-
| src | Already normalized file name for finding absolute path. |
| dst | Path to normalize. Should be either an absolute path or a path relative to src. |
| path | Buffer for normalized path. |
- Returns:
- Pointer to path.
Definition at line 463 of file map.c.
| static int relative_tile_position |
( |
mapstruct * |
map1, |
|
|
mapstruct * |
map2, |
|
|
int * |
x, |
|
|
int * |
y |
|
) |
| [static] |
Find the distance between two map tiles on a tiled map.
The distance from the topleft (0, 0) corner of map1 to the topleft corner of map2 will be added to x and y.
This function does not work well with asymmetrically tiled maps.
It will also (naturally) perform bad on very large tilesets such as the world map as it may need to load all tiles into memory before finding a path between two tiles.
We probably want to handle the world map as a special case, considering that all tiles are of equal size, and that we might be able to parse their coordinates from their names...
- Parameters:
-
- Returns:
- 1 if the two tiles are part of the same map, 0 otherwise.
Definition at line 185 of file map.c.
Check if there is a wall on specified map at x, y.
Caller should check for P_PASS_THRU in the return value to see if it can cross here.
The P_PLAYER_ONLY flag here is analyzed without checking the caller type. That is possible because player movement related functions should always used blocked().
- Parameters:
-
| m | Map we're checking for. |
| x | X position where to check. |
| y | Y position where to check. |
- Returns:
- 1 if a wall is present at the given location.
Definition at line 584 of file map.c.