Crossfire Client, Trunk  R20612
mapdata.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Map
 
struct  MapCell
 
struct  MapCellLayer
 

Macros

#define MAP1_LAYERS   3
 
#define MAX_VIEW   64
 
#define MAXLAYERS   10
 

Functions

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 MapCellmapdata_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_init (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, int smooth, int layer)
 
void mapdata_size (int *x, int *y)
 

Macro Definition Documentation

#define MAP1_LAYERS   3

Definition at line 16 of file mapdata.h.

Function Documentation

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.

Parameters
xX-coordinate of tile on-screen
yY-coordinate of tile on-screen
layer
ww
hh
Returns
Pixmap face number, or zero if the tile does not exist

Definition at line 1053 of file mapdata.c.

References bigfaces, Map::cells, MapCell::cleared, expand_clear_face_from_layer(), MapCellLayer::face, BigCell::head, MapCell::heads, height, mapdata_has_tile(), MAX_FACE_SIZE, pl_pos, MapCellLayer::size_x, MapCellLayer::size_y, BigCell::tail, MapCell::tails, the_map, width, PlayerPosition::x, and PlayerPosition::y.

+ Here is the call graph for this function:

gint16 mapdata_bigface_head ( int  x,
int  y,
int  layer,
int *  ww,
int *  hh 
)

Definition at line 1134 of file mapdata.c.

References bigfaces, MapCellLayer::face, BigCell::head, mapdata_has_tile(), MapCellLayer::size_x, and MapCellLayer::size_y.

+ Here is the call graph for this function:

bool mapdata_can_smooth ( int  x,
int  y,
int  layer 
)

Definition at line 134 of file mapdata.c.

References MapCell::heads, mapdata_cell(), and MapCell::smooth.

Referenced by drawsmooth().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_clear_old ( int  x,
int  y 
)

Definition at line 787 of file mapdata.c.

References MapCell::cleared, MapCell::darkness, expand_clear_face_from_layer(), FOG_MAP_SIZE, MapCell::have_darkness, height, mapdata_cell(), MAX_VIEW, MAXLAYERS, pl_pos, width, PlayerPosition::x, and PlayerPosition::y.

Referenced by Map2Cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_clear_space ( int  x,
int  y 
)

Definition at line 633 of file mapdata.c.

References MapCell::cleared, expand_need_update_from_layer(), expand_set_bigface(), FOG_MAP_SIZE, MapCell::heads, height, mapdata_cell(), MAX_VIEW, MAXLAYERS, MapCell::need_update, pl_pos, width, PlayerPosition::x, and PlayerPosition::y.

Referenced by Map2Cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool mapdata_contains ( int  x,
int  y 
)

Determine whether the map data contains the given cell.

Definition at line 126 of file mapdata.c.

References the_map, Map::x, and Map::y.

Referenced by drawsmooth(), ExtSmooth(), and send_map().

+ Here is the caller graph for this function:

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.

Parameters
xX-coordinate of tile on-screen
yY-coordinate of tile on-screen
layer
Returns
Pixmap face number, or zero if the tile does not exist

Definition at line 1019 of file mapdata.c.

References Map::cells, MapCellLayer::face, MapCell::heads, BigCell::layer, mapdata_has_tile(), pl_pos, the_map, BigCell::x, PlayerPosition::x, BigCell::y, and PlayerPosition::y.

+ Here is the call graph for this function:

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.

Parameters
mxVirtual map x-coordinate
myVirtual map y-coordinate
layerMap layer number
dxPointer to store x-offset
dyPointer to store y-offset
Returns
Pixmap face number, zero if the tile does not exist

Definition at line 1027 of file mapdata.c.

References Map::cells, MapCellLayer::face, MapCell::heads, height, MapCellLayer::size_x, MapCellLayer::size_y, MapCell::tails, the_map, and width.

Referenced by map_draw_layer().

+ Here is the caller graph for this function:

void mapdata_init ( void  )

Initializes the module. Allocates memory for the_map. This functions must be called before any other function is used.

Definition at line 556 of file mapdata.c.

References bigfaces, Map::cells, clear_cells(), MapCellLayer::face, FOG_MAP_SIZE, BigCell::head, height, BigCell::layer, LOG(), LOG_ERROR, MAX_VIEW, MAXLAYERS, BigCell::next, pl_pos, BigCell::prev, MapCellLayer::size_x, MapCellLayer::size_y, BigCell::tail, the_map, width, Map::x, BigCell::x, PlayerPosition::x, Map::y, BigCell::y, and PlayerPosition::y.

Referenced by config_check(), mapdata_set_size(), and reset_vars_common().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int mapdata_is_inside ( int  x,
int  y 
)

Checks whether the given coordinates are within the current display size (as set by mapdata_set_size).

Definition at line 624 of file mapdata.c.

References height.

void mapdata_newmap ( void  )

Clears the map view. Must be called whenever a newmap command was received from the server.

Definition at line 981 of file mapdata.c.

References clear_cells(), expand_clear_bigface_from_layer(), FOG_MAP_SIZE, BigCell::layer, mapdata_cell(), MapCell::need_update, BigCell::x, and BigCell::y.

Referenced by NewmapCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 908 of file mapdata.c.

References Map::cells, MapCell::cleared, CONFIG_MAPSCROLL, display_mapscroll(), expand_clear_bigface_from_layer(), BigCell::head, height, BigCell::layer, MapCell::need_update, BigCell::next, pl_pos, recenter_virtual_map_view(), MapCellLayer::size_x, MapCellLayer::size_y, the_map, want_config, width, BigCell::x, PlayerPosition::x, BigCell::y, and PlayerPosition::y.

Referenced by Map2Cmd(), and map_scrollCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_set_check_space ( int  x,
int  y 
)

Definition at line 675 of file mapdata.c.

References MapCell::cleared, expand_need_update_from_layer(), MapCellLayer::face, FOG_MAP_SIZE, MapCell::have_darkness, MapCell::heads, height, mapdata_cell(), MAX_VIEW, MAXLAYERS, MapCell::need_update, pl_pos, MapCell::tails, width, PlayerPosition::x, and PlayerPosition::y.

Referenced by Map2Cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_set_darkness ( int  x,
int  y,
int  darkness 
)

Definition at line 730 of file mapdata.c.

References FOG_MAP_SIZE, height, MAX_VIEW, pl_pos, set_darkness(), width, PlayerPosition::x, and PlayerPosition::y.

Referenced by Map2Cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_set_face_layer ( int  x,
int  y,
gint16  face,
int  layer 
)

Definition at line 815 of file mapdata.c.

References MapCell::cleared, expand_clear_face_from_layer(), expand_set_bigface(), expand_set_face(), FOG_MAP_SIZE, height, mapdata_cell(), MAX_VIEW, MapCell::need_update, pl_pos, width, PlayerPosition::x, and PlayerPosition::y.

Referenced by Map2Cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_set_size ( int  viewx,
int  viewy 
)

Sets the current display size. Must be called whenever a new display size was negotiated with the server.

Definition at line 614 of file mapdata.c.

References FOG_MAP_SIZE, height, mapdata_init(), pl_pos, width, PlayerPosition::x, and PlayerPosition::y.

Referenced by client_mapsize(), and SetupCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_set_smooth ( int  x,
int  y,
int  smooth,
int  layer 
)

Definition at line 753 of file mapdata.c.

References Map::cells, FOG_MAP_SIZE, mapdata_cell(), MAX_VIEW, MapCell::need_resmooth, pl_pos, MapCell::smooth, the_map, Map::x, PlayerPosition::x, Map::y, and PlayerPosition::y.

Referenced by Map2Cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mapdata_size ( int *  x,
int *  y 
)

Determine the size of the internal fog-of-war map.

Definition at line 142 of file mapdata.c.

References the_map, Map::x, and Map::y.

Referenced by script_process_cmd().

+ Here is the caller graph for this function: