Crossfire Client, Trunk
|
Go to the source code of this file.
Data Structures | |
struct | Map |
struct | MapCell |
struct | MapCellLayer |
struct | MapCellTailLayer |
Macros | |
#define | MAP1_LAYERS 3 |
#define | MAX_VIEW 64 |
#define | MAXLAYERS 10 |
Functions | |
void | clear_move_to (void) |
bool | is_at_moveto (void) |
void | mapdata_animation (void) |
gint16 | mapdata_bigface (int x, int y, int layer, int *ww, int *hh) |
gint16 | mapdata_bigface_head (int x, int y, int layer, int *ww, int *hh) |
bool | mapdata_can_smooth (int x, int y, int layer) |
struct MapCell * | mapdata_cell (int x, int y) |
void | mapdata_clear_old (int x, int y) |
void | mapdata_clear_space (int x, int y) |
bool | mapdata_contains (int x, int y) |
gint16 | mapdata_face (int x, int y, int layer) __attribute__((deprecated)) |
gint16 | mapdata_face_info (int mx, int my, int layer, int *dx, int *dy) |
void | mapdata_free (void) |
int | mapdata_is_inside (int x, int y) |
void | mapdata_newmap (void) |
void | mapdata_scroll (int dx, int dy) |
void | mapdata_set_anim_layer (int x, int y, guint16 anim, guint8 anim_speed, int layer) |
void | mapdata_set_check_space (int x, int y) |
void | mapdata_set_darkness (int x, int y, int darkness) |
void | mapdata_set_face_layer (int x, int y, gint16 face, int layer) |
void | mapdata_set_size (int viewx, int viewy) |
void | mapdata_set_smooth (int x, int y, guint8 smooth, int layer) |
void | mapdata_size (int *x, int *y) |
void | pl_mpos (int *px, int *py) |
int | relative_direction (int dx, int dy) |
void | run_move_to (void) |
void | set_move_to (int dx, int dy) |
Variables | |
int | global_offset_x |
int | global_offset_y |
bool | move_to_attack |
int | move_to_x |
int | move_to_y |
PlayerPosition | script_pos |
int | want_offset_x |
int | want_offset_y |
#define MAX_VIEW 64 |
#define MAXLAYERS 10 |
void clear_move_to | ( | void | ) |
Definition at line 1478 of file mapdata.c.
References move_to_attack, move_to_x, and move_to_y.
Referenced by mapdata_newmap(), run_move_to(), and send_command().
bool is_at_moveto | ( | void | ) |
Definition at line 1484 of file mapdata.c.
References move_to_x, move_to_y, and pl_mpos().
Referenced by gtk_map_redraw(), and run_move_to().
void mapdata_animation | ( | void | ) |
Definition at line 1368 of file mapdata.c.
References MapCellLayer::animation, MapCellLayer::animation_left, MapCellLayer::animation_phase, MapCellLayer::animation_speed, animations, bigfaces, MapCell::cleared, CURRENT_MAX_VIEW, expand_clear_face_from_layer(), expand_set_bigface(), expand_set_face(), MapCellLayer::face, Animations::faces, BigCell::head, MapCell::heads, mapdata_cell(), MAXANIM, MAXLAYERS, Animations::num_animations, Animations::phase, pl_pos, Animations::speed_left, PlayerPosition::x, and PlayerPosition::y.
Referenced by client_tick().
gint16 mapdata_bigface | ( | int | x, |
int | y, | ||
int | layer, | ||
int * | ww, | ||
int * | hh | ||
) |
Returns the face to display at a given location. This function returns the "tail" information, i.e. big faces expanded by the client.
*ww and *hh return the offset of the current tile relative to the head; 0 <= *ww < (width of face), 0 <= *hh < (height of face).
When drawing the map view, this function must be used instead than a direct access to the_map.cells[]. This is because the_map.cells[] eventually still contains obsolete (fog of war) big face information; this function detects and clears such faces.
Return the face number of a multi-square pixmap at the given map tile.
x | X-coordinate of tile on-screen |
y | Y-coordinate of tile on-screen |
layer | |
ww | |
hh |
Definition at line 1081 of file mapdata.c.
References bigfaces, MapCell::cleared, expand_clear_face_from_layer(), MapCellLayer::face, MapCellTailLayer::face, BigCell::head, MapCell::heads, height, mapdata_cell(), mapdata_has_tile(), MAX_FACE_SIZE, pl_pos, MapCellLayer::size_x, MapCellTailLayer::size_x, MapCellLayer::size_y, MapCellTailLayer::size_y, BigCell::tail, MapCell::tails, width, PlayerPosition::x, and PlayerPosition::y.
gint16 mapdata_bigface_head | ( | int | x, |
int | y, | ||
int | layer, | ||
int * | ww, | ||
int * | hh | ||
) |
Definition at line 1162 of file mapdata.c.
References bigfaces, MapCellLayer::face, BigCell::head, mapdata_has_tile(), MapCellLayer::size_x, and MapCellLayer::size_y.
bool mapdata_can_smooth | ( | int | x, |
int | y, | ||
int | layer | ||
) |
Definition at line 150 of file mapdata.c.
References MapCell::heads, mapdata_cell(), and MapCell::smooth.
Referenced by drawsmooth().
|
inline |
Get the stored map cell at the given map coordinate.
Definition at line 135 of file mapdata.c.
References Map::_cells, and the_map.
Referenced by clear_cells(), drawsmooth(), expand_clear_bigface(), expand_clear_face(), expand_clear_face_from_layer(), expand_need_update(), expand_need_update_from_layer(), expand_set_bigface(), expand_set_face(), ExtSmooth(), gtk_map_redraw(), map_draw_layer(), mapcell_darkness(), mapdata_animation(), mapdata_bigface(), mapdata_can_smooth(), mapdata_clear_old(), mapdata_clear_space(), mapdata_face(), mapdata_face_info(), mapdata_newmap(), mapdata_scroll(), mapdata_set_anim_layer(), mapdata_set_check_space(), mapdata_set_face_layer(), mapdata_set_smooth(), mark_resmooth(), recenter_virtual_map_view(), send_map(), and set_darkness().
void mapdata_clear_old | ( | int | x, |
int | y | ||
) |
Definition at line 798 of file mapdata.c.
References MapCell::cleared, MapCell::darkness, expand_clear_face_from_layer(), MapCell::have_darkness, Map::height, height, mapdata_cell(), MAX_VIEW, MAXLAYERS, pl_pos, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
void mapdata_clear_space | ( | int | x, |
int | y | ||
) |
Definition at line 644 of file mapdata.c.
References MapCell::cleared, expand_need_update_from_layer(), expand_set_bigface(), MapCell::heads, Map::height, height, mapdata_cell(), MAX_VIEW, MAXLAYERS, MapCell::need_update, pl_pos, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
bool mapdata_contains | ( | int | x, |
int | y | ||
) |
Determine whether the map data contains the given cell.
Definition at line 142 of file mapdata.c.
References Map::height, the_map, and Map::width.
Referenced by drawsmooth(), ExtSmooth(), and send_map().
gint16 mapdata_face | ( | int | x, |
int | y, | ||
int | layer | ||
) |
Returns the face to display at a given location. This function returns the "head" information, i.e. the face information sent by the server.
Return the face number of a single-square pixmap at the given map tile.
x | X-coordinate of tile on-screen |
y | Y-coordinate of tile on-screen |
layer |
Definition at line 1047 of file mapdata.c.
References MapCellLayer::face, MapCell::heads, BigCell::layer, mapdata_cell(), mapdata_has_tile(), pl_pos, BigCell::x, PlayerPosition::x, BigCell::y, and PlayerPosition::y.
gint16 mapdata_face_info | ( | int | mx, |
int | my, | ||
int | layer, | ||
int * | dx, | ||
int * | dy | ||
) |
Return the face number of the pixmap in the given map cell and set the offset pointers to indicate where to correctly draw the face. Offsets are zero for single-tile maps and negative for multi-tile maps. This provides a consistent way to draw tiles no matter single or multi part.
mx | Virtual map x-coordinate |
my | Virtual map y-coordinate |
layer | Map layer number |
dx | Pointer to store x-offset |
dy | Pointer to store y-offset |
Definition at line 1055 of file mapdata.c.
References MapCellLayer::face, MapCellTailLayer::face, MapCell::heads, height, mapdata_cell(), MapCellLayer::size_x, MapCellTailLayer::size_x, MapCellLayer::size_y, MapCellTailLayer::size_y, MapCell::tails, and width.
Referenced by map_draw_layer().
void mapdata_free | ( | void | ) |
Deallocate map data. Do not call functions other than mapdata_set_size() after calling mapdata_free().
Definition at line 615 of file mapdata.c.
References Map::_cells, Map::height, the_map, and Map::width.
Referenced by mapdata_set_size(), and reset_vars_common().
int mapdata_is_inside | ( | int | x, |
int | y | ||
) |
void mapdata_newmap | ( | void | ) |
Clears the map view. Must be called whenever a newmap command was received from the server.
Definition at line 996 of file mapdata.c.
References bigfaces_head, clear_cells(), clear_move_to(), csocket, ClientSocket::dir, expand_clear_bigface_from_layer(), global_offset_x, global_offset_y, Map::height, BigCell::layer, mapdata_cell(), MapCell::need_update, script_pos, the_map, want_offset_x, want_offset_y, Map::width, BigCell::x, PlayerPosition::x, BigCell::y, and PlayerPosition::y.
Referenced by NewmapCmd().
void mapdata_scroll | ( | int | dx, |
int | dy | ||
) |
Scrolls the map view. Must be called whenever a map_scroll command was received from the server.
Definition at line 919 of file mapdata.c.
References bigfaces_head, MapCell::cleared, CONFIG_MAPSCROLL, display_mapscroll(), expand_clear_bigface_from_layer(), BigCell::head, height, BigCell::layer, mapdata_cell(), MapCell::need_update, BigCell::next, pl_pos, recenter_virtual_map_view(), run_move_to(), script_pos, MapCellLayer::size_x, MapCellLayer::size_y, want_config, width, BigCell::x, PlayerPosition::x, BigCell::y, and PlayerPosition::y.
Referenced by Map2Cmd(), and map_scrollCmd().
void mapdata_set_anim_layer | ( | int | x, |
int | y, | ||
guint16 | anim, | ||
guint8 | anim_speed, | ||
int | layer | ||
) |
Definition at line 857 of file mapdata.c.
References ANIM_FLAGS_MASK, ANIM_MASK, ANIM_RANDOM, ANIM_SYNC, MapCellLayer::animation, MapCellLayer::animation_left, MapCellLayer::animation_phase, MapCellLayer::animation_speed, animations, MapCell::cleared, MapCell::darkness, expand_clear_face_from_layer(), expand_set_bigface(), expand_set_face(), Animations::faces, MapCell::have_darkness, MapCell::heads, Map::height, height, LOG(), LOG_WARNING, mapdata_cell(), MAX_VIEW, MAXLAYERS, MapCell::need_update, Animations::num_animations, Animations::phase, pl_pos, Animations::speed, Animations::speed_left, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
void mapdata_set_check_space | ( | int | x, |
int | y | ||
) |
Definition at line 686 of file mapdata.c.
References MapCell::cleared, expand_need_update_from_layer(), MapCellLayer::face, MapCellTailLayer::face, MapCell::have_darkness, MapCell::heads, Map::height, height, mapdata_cell(), MAX_VIEW, MAXLAYERS, MapCell::need_update, pl_pos, MapCell::tails, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
void mapdata_set_darkness | ( | int | x, |
int | y, | ||
int | darkness | ||
) |
Definition at line 741 of file mapdata.c.
References MapCell::darkness, Map::height, height, MAX_VIEW, pl_pos, set_darkness(), the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
void mapdata_set_face_layer | ( | int | x, |
int | y, | ||
gint16 | face, | ||
int | layer | ||
) |
Definition at line 826 of file mapdata.c.
References MapCell::cleared, expand_clear_face_from_layer(), expand_set_bigface(), expand_set_face(), Map::height, height, mapdata_cell(), MAX_VIEW, MapCell::need_update, pl_pos, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
void mapdata_set_size | ( | int | viewx, |
int | viewy | ||
) |
Initializes the module. Allocates memory for the_map. This functions must be called before any other function is used, and whenever a new display size was negotiated with the server.
Definition at line 624 of file mapdata.c.
References Map::height, height, mapdata_free(), mapdata_init(), pl_pos, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by SetupCmd().
void mapdata_set_smooth | ( | int | x, |
int | y, | ||
guint8 | smooth, | ||
int | layer | ||
) |
Definition at line 764 of file mapdata.c.
References Map::height, mapdata_cell(), MAX_VIEW, MapCell::need_resmooth, pl_pos, MapCell::smooth, the_map, Map::width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
void mapdata_size | ( | int * | x, |
int * | y | ||
) |
Determine the size of the internal fog-of-war map.
Definition at line 158 of file mapdata.c.
References Map::height, the_map, and Map::width.
Referenced by script_process_cmd().
void pl_mpos | ( | int * | px, |
int * | py | ||
) |
Compute player position in map coordinates. Unlike pl_pos.x and pl_pos.y which store the top left corner of the virtual map, this returns the actual position of the player.
Definition at line 1455 of file mapdata.c.
References CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, pl_pos, use_config, PlayerPosition::x, and PlayerPosition::y.
Referenced by is_at_moveto(), run_move_to(), and set_move_to().
int relative_direction | ( | int | dx, |
int | dy | ||
) |
Given a relative tile coordinate, determine its compass direction.
dx | Relative 'x' coordinate |
dy | Relative 'y' coordinate |
Definition at line 511 of file map.c.
Referenced by map_button_event(), and run_move_to().
void run_move_to | ( | void | ) |
Definition at line 1494 of file mapdata.c.
References clear_move_to(), is_at_moveto(), move_to_attack, move_to_x, move_to_y, pl_mpos(), relative_direction(), run_dir(), stop_run(), and walk_dir().
Referenced by map_button_event(), and mapdata_scroll().
void set_move_to | ( | int | dx, |
int | dy | ||
) |
Definition at line 1462 of file mapdata.c.
References move_to_attack, move_to_x, move_to_y, and pl_mpos().
Referenced by map_button_event().
int global_offset_x |
Definition at line 90 of file mapdata.c.
Referenced by draw_darkness(), draw_pixmap(), draw_smooth_pixmap(), gtk_map_redraw(), mapdata_init(), mapdata_newmap(), and update_global_offset().
int global_offset_y |
Definition at line 91 of file mapdata.c.
Referenced by draw_darkness(), draw_pixmap(), draw_smooth_pixmap(), gtk_map_redraw(), mapdata_init(), mapdata_newmap(), and update_global_offset().
bool move_to_attack |
Definition at line 40 of file mapdata.c.
Referenced by clear_move_to(), gtk_map_redraw(), run_move_to(), and set_move_to().
int move_to_x |
Move to coordinates on the current map. (0, 0) means no destination.
Definition at line 39 of file mapdata.c.
Referenced by clear_move_to(), gtk_map_redraw(), is_at_moveto(), run_move_to(), and set_move_to().
PlayerPosition script_pos |
Position of the player reported to client scripts. It resets to (0, 0) after a 'newmap' command.
Definition at line 36 of file mapdata.c.
Referenced by mapdata_newmap(), mapdata_scroll(), and script_process_cmd().