Crossfire Server, Trunk
R22010
|
Go to the source code of this file.
Data Structures | |
struct | mapdef |
struct | MapSpace |
struct | regiondef |
struct | rv_vector |
struct | shopitem |
Macros | |
#define | AB_NO_PASS 0x04 |
#define | GET_MAP_FACE_OBJ(M, X, Y, L) ((M)->spaces[(X)+(M)->width*(Y)].faces_obj[L]) |
#define | GET_MAP_FACE_OBJS(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].faces_obj) |
#define | GET_MAP_FLAGS(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].flags) |
#define | GET_MAP_LIGHT(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].light) |
#define | GET_MAP_MOVE_BLOCK(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_block) |
#define | GET_MAP_MOVE_OFF(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_off) |
#define | GET_MAP_MOVE_ON(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_on) |
#define | GET_MAP_MOVE_SLOW(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_slow) |
#define | GET_MAP_OB(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].bottom) |
#define | GET_MAP_PLAYER(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].pl) |
#define | GET_MAP_TOP(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].top) |
#define | MAGIC_MAP_HALF MAGIC_MAP_SIZE/2 |
#define | MAGIC_MAP_SIZE 50 |
#define | MAP_DARKNESS(m) (m)->darkness |
#define | MAP_DIFFICULTY(m) ((m)->difficulty) |
#define | MAP_ENTER_X(m) (m)->enter_x |
#define | MAP_ENTER_Y(m) (m)->enter_y |
#define | MAP_FLUSH 0x1 |
#define | MAP_HEIGHT(m) (m)->height |
#define | MAP_IN_MEMORY 1 |
#define | MAP_LAYER_FLOOR 0 |
#define | MAP_LAYER_FLY1 8 |
#define | MAP_LAYER_FLY2 9 |
#define | MAP_LAYER_ITEM1 3 |
#define | MAP_LAYER_ITEM2 4 |
#define | MAP_LAYER_ITEM3 5 |
#define | MAP_LAYER_LIVING1 6 |
#define | MAP_LAYER_LIVING2 7 |
#define | MAP_LAYER_NO_PICK1 1 |
#define | MAP_LAYER_NO_PICK2 2 |
#define | MAP_LAYERS 10 |
#define | MAP_LOADING 3 |
#define | MAP_NOSMOOTH(m) (m)->nosmooth |
#define | MAP_OUTDOORS(m) ((m)->outdoor) |
#define | MAP_OVERLAY 0x10 |
#define | MAP_PLAYER_UNIQUE 0x2 |
#define | MAP_RESET_TIMEOUT(m) ((m)->reset_timeout) |
#define | MAP_SAVING 4 |
#define | MAP_SIZE(m) map_size(m) |
#define | MAP_STYLE 0x8 |
#define | MAP_SWAP_TIME(m) ((m)->swap_time) |
#define | MAP_SWAPPED 2 |
#define | MAP_TIMEOUT(m) ((m)->timeout) |
#define | MAP_TYPE_CHOICE 3 |
#define | MAP_TYPE_DEFAULT 2 |
#define | MAP_TYPE_LEGACY 1 |
#define | MAP_WHEN_RESET(m) ((m)->reset_time) |
#define | MAP_WIDTH(m) (m)->width |
#define | OUT_OF_REAL_MAP(M, X, Y) ((X) < 0 || (Y) < 0 || (X) >= (M)->width || (Y) >= (M)->height) |
#define | P_BLOCKSVIEW 0x01 |
#define | P_IS_ALIVE 0x10 |
#define | P_NEED_UPDATE 0x40 |
#define | P_NEW_MAP 0x200 |
#define | P_NO_CLERIC 0x20 |
#define | P_NO_ERROR 0x80 |
#define | P_NO_MAGIC 0x02 |
#define | P_OUT_OF_MAP 0x100 |
#define | P_PLAYER 0x08 |
#define | SAVE_ERROR_CLOSE -6 |
#define | SAVE_ERROR_NO_PATH -4 |
#define | SAVE_ERROR_NOT_IN_MEMORY -10 |
#define | SAVE_ERROR_OK 0 |
#define | SAVE_ERROR_PLAYER -11 |
#define | SAVE_ERROR_RCREATION -1 |
#define | SAVE_ERROR_RRENAME -7 |
#define | SAVE_ERROR_UCREATION -2 |
#define | SAVE_ERROR_URENAME -5 |
#define | SAVE_ERROR_WRITE -3 |
#define | SAVE_FLAG_NO_REMOVE 2 |
#define | SAVE_FLAG_SAVE_UNPAID 1 |
#define | SAVE_MODE_INPLACE 1 |
#define | SAVE_MODE_NORMAL 0 |
#define | SAVE_MODE_OVERLAY 2 |
#define | SET_MAP_FACE_OBJ(M, X, Y, C, L) ((M)->spaces[(X)+(M)->width*(Y)].faces_obj[L] = C) |
#define | SET_MAP_FLAGS(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].flags = C) |
#define | SET_MAP_LIGHT(M, X, Y, L) ((M)->spaces[(X)+(M)->width*(Y)].light = L) |
#define | SET_MAP_MOVE_BLOCK(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_block = C) |
#define | SET_MAP_MOVE_OFF(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_off = C) |
#define | SET_MAP_MOVE_ON(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_on = C) |
#define | SET_MAP_MOVE_SLOW(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_slow = C) |
#define | SET_MAP_OB(M, X, Y, tmp) ((M)->spaces[(X)+(M)->width*(Y)].bottom = (tmp)) |
#define | SET_MAP_PLAYER(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].pl = C) |
#define | SET_MAP_TOP(M, X, Y, tmp) ((M)->spaces[(X)+(M)->width*(Y)].top = (tmp)) |
Typedefs | |
typedef struct MapSpace | MapSpace |
typedef struct mapdef | mapstruct |
typedef struct regiondef | region |
typedef struct rv_vector | rv_vector |
typedef struct shopitem | shopitems |
Functions | |
uint32_t | map_size (mapstruct *m) |
Variables | |
const char *const | map_layer_name [MAP_LAYERS] |
This file contains basic map-related structures and macros.
Definition in file map.h.
#define GET_MAP_FACE_OBJ | ( | M, | |
X, | |||
Y, | |||
L | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].faces_obj[L]) |
Gets the layer face of specified square. Not multitile aware.
Definition at line 184 of file map.h.
Referenced by draw_client_map2(), magic_mapping_mark(), and magic_mapping_mark_recursive().
#define GET_MAP_FACE_OBJS | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].faces_obj) |
Returns the layers array so update_position can just copy the entire array over.
Definition at line 189 of file map.h.
Referenced by update_position().
#define GET_MAP_FLAGS | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].flags) |
Gets map flags. Not multitile aware.
Definition at line 161 of file map.h.
Referenced by find_closest_monster(), find_monster_in_room_recursive(), object_update(), and update_position().
#define GET_MAP_LIGHT | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].light) |
Gets map light. Not multitile aware.
Definition at line 165 of file map.h.
Referenced by expand_lighted_sight(), and monster_stand_in_light().
#define GET_MAP_MOVE_BLOCK | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_block) |
Gets the blocking state of a square. Not multitile aware.
Definition at line 192 of file map.h.
Referenced by alchemy(), animate_weapon(), attempt_jump(), blocked_link(), cast_cause_disease(), cast_cone(), cast_create_obj(), cast_earth_to_dust(), cast_light(), cast_polymorph(), check_bullet(), common_process_projectile(), create_bomb(), dimension_door(), do_throw(), fire_arch_from_position(), fire_bolt(), fire_bow(), forklightning(), get_pointed_target(), magic_wall(), map_find_dir(), monster_use_bow(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_missile(), ob_blocked(), object_check_move_on(), object_free(), object_update(), ok_to_put_more(), path_to_player(), pets_move(), pick_arrow_target(), roll_ob(), skill_attack(), stand_near_hostile(), steal(), surround_flag3(), teleport(), and wall_blocked().
#define GET_MAP_MOVE_OFF | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_off) |
Gets the move_off state of a square. Not multitile aware.
Definition at line 207 of file map.h.
Referenced by object_update().
#define GET_MAP_MOVE_ON | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_on) |
Gets the move_on state of a square. Not multitile aware.
Definition at line 202 of file map.h.
Referenced by object_check_move_on(), and object_update().
#define GET_MAP_MOVE_SLOW | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_slow) |
Gets the slowing state of a square. Not multitile aware.
Definition at line 197 of file map.h.
Referenced by object_check_move_on(), and object_update().
#define GET_MAP_OB | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].bottom) |
Gets the bottom object on a map. Not multitile aware.
Definition at line 172 of file map.h.
Referenced by apply_auto_fix(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_map_builder(), cast_polymorph(), cfapi_map_get_object_at(), check_hp(), check_spell_knockback(), do_harvest(), do_mood_floor(), esrv_draw_look(), find_target_for_friendly_spell(), free_all_objects(), is_legal_2ways_exit(), look_at(), make_map_floor(), map_find_by_flag(), move_detector(), move_marker(), move_player_attack(), move_to(), object_check_move_on(), object_insert_in_map(), object_remove(), pick_lock(), pick_random_object(), put_floor(), remove_monsters(), shop_inventory_type_apply(), spell_find_dir(), START_TEST(), steal(), and teardown().
#define GET_MAP_PLAYER | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].pl) |
Definition at line 168 of file map.h.
Referenced by object_update().
#define GET_MAP_TOP | ( | M, | |
X, | |||
Y | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].top) |
Gets the top object on a map. Not multitile aware.
Definition at line 174 of file map.h.
Referenced by find_insert_pos(), and identify().
#define MAGIC_MAP_HALF MAGIC_MAP_SIZE/2 |
Definition at line 25 of file map.h.
Referenced by draw_magic_map(), magic_mapping_mark(), and magic_mapping_mark_recursive().
#define MAGIC_MAP_SIZE 50 |
Definition at line 24 of file map.h.
Referenced by draw_magic_map(), magic_mapping_mark(), and magic_mapping_mark_recursive().
#define MAP_DARKNESS | ( | m | ) | (m)->darkness |
Map darkness used to enforce the MAX_DARKNESS value. but IMO, if it is beyond max value, that should be fixed on the map or in the code.
Definition at line 75 of file map.h.
Referenced by expand_lighted_sight(), expand_sight(), object_insert_in_map(), and object_insert_in_ob().
#define MAP_DIFFICULTY | ( | m | ) | ((m)->difficulty) |
Definition at line 65 of file map.h.
Referenced by calculate_difficulty(), and mapfile_load().
#define MAP_ENTER_X | ( | m | ) | (m)->enter_x |
Default X coordinate for map enter.
Definition at line 85 of file map.h.
Referenced by current_map_info(), dump_map(), enter_exit(), enter_map(), enter_player_maplevel(), enter_random_map(), enter_random_template_map(), get_linked_map(), and place_exits().
#define MAP_ENTER_Y | ( | m | ) | (m)->enter_y |
Default Y coordinate for map enter.
Definition at line 87 of file map.h.
Referenced by current_map_info(), dump_map(), enter_exit(), enter_map(), enter_player_maplevel(), enter_random_map(), enter_random_template_map(), get_linked_map(), and place_exits().
#define MAP_HEIGHT | ( | m | ) | (m)->height |
Map height.
Definition at line 80 of file map.h.
Referenced by add_exits_to_map(), adjacent_map(), apply_auto_fix(), apply_map_builder(), calculate_difficulty(), command_style_map_info(), current_map_info(), decay_objects(), delete_unique_items(), do_auto_apply(), do_exit_map(), dump_map(), enter_map(), find_spot_for_submap(), fix_walls(), free_all_objects(), generate_monster(), get_linked_map(), get_map_from_coord(), include_map_in_map(), link_multipart_objects(), load_objects(), object_find_multi_free_spot_around(), object_update(), out_of_map(), pick_random_object(), place_fountain_with_specials(), place_monsters(), place_special_exit(), place_specials_in_map(), CREMapInformationManager::process(), process_map(), save_objects(), shop_inventory_type_apply(), teardown(), and update_all_los().
#define MAP_LAYERS 10 |
Definition at line 32 of file map.h.
Referenced by check_space_for_heads(), draw_client_map2(), magic_mapping_mark(), magic_mapping_mark_recursive(), map2_add_ob(), and update_position().
#define MAP_NOSMOOTH | ( | m | ) | (m)->nosmooth |
Definition at line 89 of file map.h.
Referenced by map2_add_ob().
#define MAP_RESET_TIMEOUT | ( | m | ) | ((m)->reset_timeout) |
Definition at line 64 of file map.h.
Referenced by get_linked_map(), and set_map_reset_time().
#define MAP_SIZE | ( | m | ) | map_size(m) |
#define MAP_SWAP_TIME | ( | m | ) | ((m)->swap_time) |
Definition at line 67 of file map.h.
Referenced by apply_savebed().
#define MAP_TIMEOUT | ( | m | ) | ((m)->timeout) |
Definition at line 66 of file map.h.
Referenced by apply_savebed(), command_kick2(), current_map_info(), get_linked_map(), leave(), and set_map_timeout().
#define MAP_TYPE_CHOICE 3 |
Choice of maps presented to player
Definition at line 59 of file map.h.
Referenced by create_player_cmd(), and do_map_info().
#define MAP_TYPE_DEFAULT 2 |
If no map is specified, where character starts
Definition at line 58 of file map.h.
Referenced by create_player_cmd().
#define MAP_TYPE_LEGACY 1 |
These are map subtypes. With new character creation code, additional types are needed.For old character creation method
Definition at line 57 of file map.h.
Referenced by do_dynamic().
#define MAP_WHEN_RESET | ( | m | ) | ((m)->reset_time) |
This is when the map will reset
Definition at line 62 of file map.h.
Referenced by map_info(), and set_map_reset_time().
#define MAP_WIDTH | ( | m | ) | (m)->width |
Map width.
Definition at line 78 of file map.h.
Referenced by add_exits_to_map(), adjacent_map(), apply_auto_fix(), apply_map_builder(), calculate_difficulty(), command_style_map_info(), current_map_info(), decay_objects(), delete_unique_items(), do_auto_apply(), do_exit_map(), dump_map(), enter_map(), find_spot_for_submap(), fix_walls(), free_all_objects(), generate_monster(), get_linked_map(), get_map_from_coord(), include_map_in_map(), link_multipart_objects(), load_objects(), object_find_multi_free_spot_around(), object_update(), out_of_map(), pick_random_object(), place_fountain_with_specials(), place_monsters(), place_special_exit(), place_specials_in_map(), CREMapInformationManager::process(), process_map(), save_objects(), shop_inventory_type_apply(), teardown(), and update_all_los().
#define OUT_OF_REAL_MAP | ( | M, | |
X, | |||
Y | |||
) | ((X) < 0 || (Y) < 0 || (X) >= (M)->width || (Y) >= (M)->height) |
Checks if a square is out of the map. You should really know what you are doing before using this - you should almost always be using out_of_map() instead, which takes into account map tiling.
Definition at line 217 of file map.h.
Referenced by apply_builder_floor(), apply_builder_wall(), attack_message(), blocked_link(), get_map_from_coord(), map_find_by_archetype(), map_find_by_type(), monster_compute_path(), move_player_attack(), object_insert_in_map(), pick_lock(), reflwall(), teleport(), and wall_blocked().
#define SET_MAP_FACE_OBJ | ( | M, | |
X, | |||
Y, | |||
C, | |||
L | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].faces_obj[L] = C) |
#define SET_MAP_FLAGS | ( | M, | |
X, | |||
Y, | |||
C | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].flags = C) |
Sets map flags. Not multitile aware.
Definition at line 163 of file map.h.
Referenced by cfapi_object_set_property(), do_turn(), object_insert_in_ob(), object_remove(), object_update(), and update_position().
#define SET_MAP_LIGHT | ( | M, | |
X, | |||
Y, | |||
L | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].light = L) |
Sets map light. Not multitile aware.
Definition at line 167 of file map.h.
Referenced by update_position().
#define SET_MAP_MOVE_BLOCK | ( | M, | |
X, | |||
Y, | |||
C | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_block = C) |
Sets the blocking state of a square. Not multitile aware.
Definition at line 194 of file map.h.
Referenced by update_position().
#define SET_MAP_MOVE_OFF | ( | M, | |
X, | |||
Y, | |||
C | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_off = C) |
Sets the move_off state of a square. Not multitile aware.
Definition at line 209 of file map.h.
Referenced by update_position().
#define SET_MAP_MOVE_ON | ( | M, | |
X, | |||
Y, | |||
C | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_on = C) |
Sets the move_on state of a square. Not multitile aware.
Definition at line 204 of file map.h.
Referenced by update_position().
#define SET_MAP_MOVE_SLOW | ( | M, | |
X, | |||
Y, | |||
C | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].move_slow = C) |
Sets the slowing state of a square. Not multitile aware.
Definition at line 199 of file map.h.
Referenced by update_position().
#define SET_MAP_OB | ( | M, | |
X, | |||
Y, | |||
tmp | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].bottom = (tmp)) |
Sets the bottom object on a map. Not multitile aware.
Definition at line 177 of file map.h.
Referenced by object_insert_in_map(), and object_remove().
#define SET_MAP_PLAYER | ( | M, | |
X, | |||
Y, | |||
C | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].pl = C) |
Definition at line 169 of file map.h.
Referenced by update_position().
#define SET_MAP_TOP | ( | M, | |
X, | |||
Y, | |||
tmp | |||
) | ((M)->spaces[(X)+(M)->width*(Y)].top = (tmp)) |
Sets the top object on a map. Not multitile aware.
Definition at line 179 of file map.h.
Referenced by object_insert_in_map(), and object_remove().
This is a game-map.
In general, code should always use the macros above (or functions in map.c) to access many of the values in the map structure. Failure to do this will almost certainly break various features. You may think it is safe to look at width and height values directly (or even through the macros), but doing so will completely break map tiling.
This is a game region. Each map is in a given region of the game world and links to a region definiton, so they have to appear here in the headers, before the mapdef
This is used by get_rangevector 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 righte 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. Note: distance should be always >=0. I changed it to UINT. MT
Shop-related information for a map. This is one item type the shop will deal in, and the price-chance.
Calculate map size without intermediate sign extension.
Definition at line 825 of file map.c.
References mapdef::height, and mapdef::width.
Referenced by allocate_map(), command_style_map_info(), and malloc_info().
const char* const map_layer_name[MAP_LAYERS] |
These correspond to the layer names in map.h - since some of the types can be on multiple layers, names are duplicated to correspond to that layer.
Definition at line 54 of file map.c.
Referenced by get_ob_diff().