![]() |
Crossfire Client, Trunk
|
#include "client.h"
#include <assert.h>
#include <stdbool.h>
#include "external.h"
#include "mapdata.h"
Go to the source code of this file.
Data Structures | |
struct | BigCell |
The struct BigCell describes a tile outside the view area. More... | |
Macros | |
#define | CURRENT_MAX_VIEW 33 |
#define | FOG_BORDER_MIN 128 |
After shifting the virtual map: new minimum distance of the view area to the new virtual map border. More... | |
#define | FOG_MAP_SIZE 512 |
Size of virtual map. More... | |
#define | MAX_FACE_SIZE 16 |
Maximum size of a big face image in tiles. More... | |
Functions | |
static void | clear_cells (int x, int y, int len_y) |
Clear cells the_map.cells[x][y..y+len_y-1]. More... | |
void | clear_move_to () |
static void | expand_clear_bigface (int x, int y, int w, int h, int layer, int set_need_update) |
Clear a face from bigfaces[]. More... | |
static void | expand_clear_bigface_from_layer (int x, int y, int layer, int set_need_update) |
Clear a face from bigfaces[]. More... | |
static void | expand_clear_face (int x, int y, int w, int h, int layer) |
Clear a face from the_map.cells[]. More... | |
static void | expand_clear_face_from_layer (int x, int y, int layer) |
Clear a face from the_map.cells[]. More... | |
static void | expand_need_update (int x, int y, int w, int h) |
Mark a face as "need_update". More... | |
static void | expand_need_update_from_layer (int x, int y, int layer) |
Mark a face as "need_update". More... | |
static void | expand_set_bigface (int x, int y, int layer, gint16 face, int clear) |
Update a face into bigfaces[]. More... | |
static void | expand_set_face (int x, int y, int layer, gint16 face, int clear) |
Update a face into the_map.cells[]. More... | |
bool | is_at_moveto () |
void | mapdata_add_label (int x, int y, int subtype, const char *label) |
static void | mapdata_alloc (struct Map *const map, const int width, const int height) |
Allocate and set up pointers for a map, with cells represented as a C-style multi-dimensional array. More... | |
void | mapdata_animation (void) |
gint16 | mapdata_bigface (int x, int y, int layer, int *ww, int *hh) |
Return the face number of a multi-square pixmap at the given map tile. More... | |
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 (const int x, const int y) |
Get the stored map cell at the given map coordinate. More... | |
void | mapdata_clear (int x, int y) |
Mark the given cell as cleared in response to a Map2 clear command. More... | |
void | mapdata_clear_label (int px, int py) |
void | mapdata_clear_old (int x, int y) |
Prepare a map cell, which may contain old fog of war data, for new visible map data. More... | |
void | mapdata_clear_space (int x, int y) |
bool | mapdata_contains (int x, int y) |
Determine whether the map data contains the given cell. More... | |
gint16 | mapdata_face (int x, int y, int layer) |
Return the face number of a single-square pixmap at the given map tile. More... | |
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. More... | |
void | mapdata_free (void) |
Deallocate map data. More... | |
static void | mapdata_get_image_size (int face, guint8 *w, guint8 *h) |
Return the size of a face in tiles. More... | |
static bool | mapdata_has_tile (int x, int y, int layer) |
Check if the given map tile is a valid slot in the map array. More... | |
static void | mapdata_init (void) |
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). More... | |
void | mapdata_newmap (void) |
Clears the map view. More... | |
void | mapdata_scroll (int dx, int dy) |
Scrolls the map view. More... | |
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) |
Initializes the module. More... | |
void | mapdata_set_smooth (int x, int y, guint8 smooth, int layer) |
void | mapdata_size (int *x, int *y) |
Determine the size of the internal fog-of-war map. More... | |
static void | mark_resmooth (int x, int y, int layer) |
void | pl_mpos (int *px, int *py) |
Compute player position in map coordinates. More... | |
static void | recenter_virtual_map_view (int diff_x, int diff_y) |
Check if current map position is out of bounds if shifted by (dx, dy). More... | |
void | run_move_to () |
static void | set_darkness (int x, int y, int darkness) |
Update darkness information. More... | |
void | set_move_to (int dx, int dy) |
Variables | |
static struct BigCell | bigfaces [MAX_VIEW][MAX_VIEW][MAXLAYERS] |
The variable bigfaces[] contains information about big faces (faces with a width or height >1). More... | |
static struct BigCell * | bigfaces_head |
Contains the head of a list of all currently active big faces outside the view area. More... | |
int | global_offset_x = 0 |
int | global_offset_y = 0 |
static int | height |
bool | move_to_attack = false |
int | move_to_x = 0 |
Move to coordinates on the current map. More... | |
int | move_to_y = 0 |
PlayerPosition | pl_pos |
Position of the player on the internal map. More... | |
PlayerPosition | script_pos |
Position of the player reported to client scripts. More... | |
static struct Map | the_map |
int | want_offset_x = 0 |
int | want_offset_y = 0 |
static int | width |
#define FOG_BORDER_MIN 128 |
#define MAX_FACE_SIZE 16 |
|
static |
Clear cells the_map.cells[x][y..y+len_y-1].
Definition at line 121 of file mapdata.c.
References MapCell::heads, mapdata_cell(), MAXLAYERS, MapCellLayer::size_x, and MapCellLayer::size_y.
Referenced by mapdata_init(), mapdata_newmap(), and recenter_virtual_map_view().
void clear_move_to | ( | ) |
Definition at line 1510 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().
|
static |
Clear a face from bigfaces[].
x, y, and layer are the coordinates and layer of the head relative to pl_pos.
w and h give the width and height of the face to clear.
If set_need_update is set, all affected tiles are marked as "need_update".
Definition at line 371 of file mapdata.c.
References bigfaces, MapCellLayer::face, MapCellTailLayer::face, BigCell::head, Map::height, height, mapdata_cell(), MAX_FACE_SIZE, MAX_VIEW, MAXLAYERS, MapCell::need_update, pl_pos, MapCellLayer::size_x, MapCellTailLayer::size_x, MapCellLayer::size_y, MapCellTailLayer::size_y, BigCell::tail, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by expand_clear_bigface_from_layer().
|
static |
Clear a face from bigfaces[].
x, y, and layer are the coordinates and layer of the head relative to pl_pos.
If set_need_update is set, all affected tiles are marked as "need_update".
Definition at line 425 of file mapdata.c.
References bigfaces, bigfaces_head, expand_clear_bigface(), MapCellLayer::face, BigCell::head, MAX_VIEW, MAXLAYERS, BigCell::next, BigCell::prev, MapCellLayer::size_x, and MapCellLayer::size_y.
Referenced by expand_set_bigface(), mapdata_newmap(), and mapdata_scroll().
|
static |
Clear a face from the_map.cells[].
x, y, and layer are the coordinates of the head and layer relative to pl_pos.
w and h give the width and height of the face to clear.
Definition at line 238 of file mapdata.c.
References MapCellLayer::animation, MapCellLayer::animation_left, MapCellLayer::animation_phase, MapCellLayer::animation_speed, MapCellLayer::face, MapCellTailLayer::face, MapCell::heads, Map::height, mapdata_cell(), mark_resmooth(), MAX_FACE_SIZE, MAXLAYERS, MapCell::need_resmooth, MapCell::need_update, MapCellLayer::size_x, MapCellTailLayer::size_x, MapCellLayer::size_y, MapCellTailLayer::size_y, MapCell::tails, the_map, and Map::width.
Referenced by expand_clear_face_from_layer().
|
static |
Clear a face from the_map.cells[].
x, y, and layer are the coordinates of the head and layer relative to pl_pos.
Definition at line 293 of file mapdata.c.
References expand_clear_face(), MapCell::heads, Map::height, mapdata_cell(), MAXLAYERS, MapCellLayer::size_x, MapCellLayer::size_y, the_map, and Map::width.
Referenced by expand_set_face(), mapdata_animation(), mapdata_bigface(), mapdata_clear_old(), mapdata_set_anim_layer(), and mapdata_set_face_layer().
|
static |
Mark a face as "need_update".
x and y are the coordinates of the head relative to pl_pos.
w and h is the size of the face.
Definition at line 536 of file mapdata.c.
References Map::height, mapdata_cell(), MAX_FACE_SIZE, MapCell::need_update, the_map, and Map::width.
Referenced by expand_need_update_from_layer().
|
static |
Mark a face as "need_update".
x, y, and layer are the coordinates and layer of the head relative to pl_pos.
Definition at line 564 of file mapdata.c.
References expand_need_update(), MapCellLayer::face, MapCell::heads, Map::height, mapdata_cell(), MAXLAYERS, MapCellLayer::size_x, MapCellLayer::size_y, the_map, and Map::width.
Referenced by mapdata_clear().
|
static |
Update a face into bigfaces[].
x, y, and layer are the coordinates and layer of the head relative to pl_pos.
face is the new face to set.
Definition at line 471 of file mapdata.c.
References bigfaces, bigfaces_head, expand_clear_bigface_from_layer(), MapCellLayer::face, MapCellTailLayer::face, BigCell::head, Map::height, height, mapdata_cell(), mapdata_get_image_size(), MAX_FACE_SIZE, MAX_VIEW, MAXLAYERS, MapCell::need_update, BigCell::next, pl_pos, BigCell::prev, MapCellLayer::size_x, MapCellTailLayer::size_x, MapCellLayer::size_y, MapCellTailLayer::size_y, BigCell::tail, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by mapdata_animation(), mapdata_clear_space(), mapdata_set_anim_layer(), and mapdata_set_face_layer().
|
static |
Update a face into the_map.cells[].
x, y, and layer are the coordinates and layer of the head relative to pl_pos.
face is the new face to set. if clear is set, clear this face. If not set, don't clear. the reason clear may not be set is because this is an animation update - animations must all be the same size, so when we set the data for the space, we will just overwrite the old data. Problem with clearing is that clobbers the animation data.
Definition at line 320 of file mapdata.c.
References expand_clear_face_from_layer(), MapCellLayer::face, MapCellTailLayer::face, MapCell::heads, Map::height, mapdata_cell(), mapdata_get_image_size(), mark_resmooth(), MAX_FACE_SIZE, MAXLAYERS, MapCell::need_update, MapCellLayer::size_x, MapCellTailLayer::size_x, MapCellLayer::size_y, MapCellTailLayer::size_y, MapCell::tails, the_map, and Map::width.
Referenced by mapdata_animation(), mapdata_set_anim_layer(), and mapdata_set_face_layer().
bool is_at_moveto | ( | ) |
Definition at line 1516 of file mapdata.c.
References move_to_x, move_to_y, and pl_mpos().
Referenced by draw_move_to(), and run_move_to().
void mapdata_add_label | ( | int | x, |
int | y, | ||
int | subtype, | ||
const char * | label | ||
) |
Definition at line 806 of file mapdata.c.
References Map::height, height, MapCell::label, MapLabel::label, mapdata_cell(), mapdata_clear_label(), MAX_VIEW, MapCell::need_update, pl_pos, MapLabel::subtype, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd().
|
static |
void mapdata_animation | ( | void | ) |
Definition at line 1400 of file mapdata.c.
References MapCellLayer::animation, MapCellLayer::animation_left, MapCellLayer::animation_phase, MapCellLayer::animation_speed, animations, bigfaces, CURRENT_MAX_VIEW, expand_clear_face_from_layer(), expand_set_bigface(), expand_set_face(), MapCellLayer::face, Animations::faces, BigCell::head, MapCell::heads, height, mapdata_cell(), MAXANIM, MAXLAYERS, MIN, Animations::num_animations, Animations::phase, pl_pos, Animations::speed_left, MapCell::state, VISIBLE, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by client_tick().
gint16 mapdata_bigface | ( | int | x, |
int | y, | ||
int | layer, | ||
int * | ww, | ||
int * | hh | ||
) |
Return the face number of a multi-square pixmap at the given map tile.
Returns the face to display at a given location.
x | X-coordinate of tile on-screen |
y | Y-coordinate of tile on-screen |
layer | |
ww | |
hh |
Definition at line 1113 of file mapdata.c.
References bigfaces, expand_clear_face_from_layer(), MapCellLayer::face, MapCellTailLayer::face, FOG, 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, MapCell::state, 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 1194 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 154 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 139 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(), map_draw_labels(), map_draw_layer(), mapcell_darkness(), mapdata_add_label(), mapdata_animation(), mapdata_bigface(), mapdata_can_smooth(), mapdata_clear(), mapdata_clear_label(), mapdata_clear_old(), 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 | ( | int | x, |
int | y | ||
) |
Mark the given cell as cleared in response to a Map2 clear command.
While the server shouldn't be clearing cells it didn't send, in practice we sometimes do clearing ourselves (e.g. when we scroll the map).
Definition at line 195 of file mapdata.c.
References EMPTY, expand_need_update_from_layer(), FOG, MapCell::heads, Map::height, mapdata_cell(), mapdata_clear_label(), MAXLAYERS, MapCell::need_update, pl_pos, MapCell::state, the_map, VISIBLE, Map::width, PlayerPosition::x, and PlayerPosition::y.
Referenced by mapdata_clear_space(), mapdata_scroll(), and mapdata_set_check_space().
void mapdata_clear_label | ( | int | px, |
int | py | ||
) |
Definition at line 830 of file mapdata.c.
References MapCell::label, MapLabel::label, mapdata_cell(), and MapLabel::next.
Referenced by Map2Cmd(), mapdata_add_label(), mapdata_clear(), and mapdata_clear_old().
void mapdata_clear_old | ( | int | x, |
int | y | ||
) |
Prepare a map cell, which may contain old fog of war data, for new visible map data.
Call this when Map2 is imminently going to provide an update for the given tile. A better name for this function would be mapdata_prepare().
Definition at line 844 of file mapdata.c.
References MapCell::darkness, expand_clear_face_from_layer(), FOG, Map::height, height, mapdata_cell(), mapdata_clear_label(), MAX_VIEW, MAXLAYERS, MapCell::need_update, pl_pos, MapCell::state, the_map, VISIBLE, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by Map2Cmd(), and mapdata_set_anim_layer().
void mapdata_clear_space | ( | int | x, |
int | y | ||
) |
Definition at line 674 of file mapdata.c.
References expand_set_bigface(), Map::height, height, mapdata_clear(), MAX_VIEW, MAXLAYERS, 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 146 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 | ||
) |
Return the face number of a single-square pixmap at the given map tile.
Returns the face to display at a given location.
x | X-coordinate of tile on-screen |
y | Y-coordinate of tile on-screen |
layer |
Definition at line 1079 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 1087 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 645 of file mapdata.c.
References Map::_cells, Map::height, the_map, and Map::width.
Referenced by mapdata_set_size(), and reset_vars_common().
|
static |
Return the size of a face in tiles.
The returned size is at between 1 and MAX_FACE_SIZE (inclusive).
Definition at line 1380 of file mapdata.c.
References MapCellLayer::face, get_map_image_size(), and MAX_FACE_SIZE.
Referenced by expand_set_bigface(), and expand_set_face().
|
static |
Check if the given map tile is a valid slot in the map array.
Definition at line 1062 of file mapdata.c.
References height, BigCell::layer, MAXLAYERS, width, BigCell::x, and BigCell::y.
Referenced by mapdata_bigface(), mapdata_bigface_head(), and mapdata_face().
|
static |
Definition at line 604 of file mapdata.c.
References bigfaces, bigfaces_head, clear_cells(), MapCellLayer::face, MapCellTailLayer::face, FOG_MAP_SIZE, global_offset_x, global_offset_y, BigCell::head, Map::height, height, BigCell::layer, mapdata_alloc(), MAX_VIEW, MAXLAYERS, BigCell::next, pl_pos, BigCell::prev, MapCellLayer::size_x, MapCellTailLayer::size_x, MapCellLayer::size_y, MapCellTailLayer::size_y, BigCell::tail, the_map, want_offset_x, want_offset_y, Map::width, width, BigCell::x, PlayerPosition::x, BigCell::y, and PlayerPosition::y.
Referenced by mapdata_set_size().
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 1028 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 955 of file mapdata.c.
References bigfaces_head, CONFIG_MAPSCROLL, display_mapscroll(), expand_clear_bigface_from_layer(), BigCell::head, height, BigCell::layer, mapdata_cell(), mapdata_clear(), 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 904 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, expand_clear_face_from_layer(), expand_set_bigface(), expand_set_face(), Animations::faces, MapCell::heads, Map::height, height, LOG(), LOG_WARNING, mapdata_cell(), mapdata_clear_old(), MAX_VIEW, 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 707 of file mapdata.c.
References MapCell::darkness, MapCellLayer::face, MapCellTailLayer::face, MapCell::heads, Map::height, height, mapdata_cell(), mapdata_clear(), MAX_VIEW, MAXLAYERS, 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 755 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 875 of file mapdata.c.
References 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 654 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 778 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 162 of file mapdata.c.
References Map::height, the_map, and Map::width.
Referenced by script_process_cmd().
|
static |
Definition at line 217 of file mapdata.c.
References Map::height, mapdata_cell(), MapCell::need_resmooth, MapCell::smooth, the_map, and Map::width.
Referenced by expand_clear_face(), and expand_set_face().
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 1487 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().
|
static |
Check if current map position is out of bounds if shifted by (dx, dy).
If so, shift the virtual map so that the map view is within bounds again.
Assures that [pl_pos.x-MAX_FACE_SIZE..pl_pos.x+MAX_VIEW+1] is within the bounds of the virtual map area. This covers the area a map1a command may affect plus a one tile border.
Definition at line 1223 of file mapdata.c.
References clear_cells(), FOG_BORDER_MIN, Map::height, height, mapdata_cell(), MAX_FACE_SIZE, MAX_VIEW, pl_pos, the_map, Map::width, width, PlayerPosition::x, and PlayerPosition::y.
Referenced by mapdata_scroll().
void run_move_to | ( | ) |
Definition at line 1526 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().
|
static |
Update darkness information.
This function is called whenever a map1a command from the server was received.
x and y are absolute coordinates into the_map.cells[].
darkness is the new darkness value.
Definition at line 180 of file mapdata.c.
References MapCell::darkness, mapdata_cell(), and MapCell::need_update.
Referenced by mapdata_set_darkness().
void set_move_to | ( | int | dx, |
int | dy | ||
) |
Definition at line 1494 of file mapdata.c.
References move_to_attack, move_to_x, move_to_y, and pl_mpos().
Referenced by map_button_event().
The variable bigfaces[] contains information about big faces (faces with a width or height >1).
The viewable area bigfaces[0..width-1][0..height-1] is unused.
Definition at line 114 of file mapdata.c.
Referenced by expand_clear_bigface(), expand_clear_bigface_from_layer(), expand_set_bigface(), mapdata_animation(), mapdata_bigface(), mapdata_bigface_head(), and mapdata_init().
|
static |
Contains the head of a list of all currently active big faces outside the view area.
All entries are part of bigfaces[].
Definition at line 107 of file mapdata.c.
Referenced by expand_clear_bigface_from_layer(), expand_set_bigface(), mapdata_init(), mapdata_newmap(), and mapdata_scroll().
int global_offset_x = 0 |
Definition at line 90 of file mapdata.c.
Referenced by gtk_map_redraw(), mapdata_init(), mapdata_newmap(), and update_global_offset().
int global_offset_y = 0 |
Definition at line 91 of file mapdata.c.
Referenced by gtk_map_redraw(), mapdata_init(), mapdata_newmap(), and update_global_offset().
|
static |
Definition at line 101 of file mapdata.c.
Referenced by client_mapsize(), create_and_rescale_image_from_data(), display_newpng(), expand_clear_bigface(), expand_set_bigface(), mapdata_add_label(), mapdata_alloc(), mapdata_animation(), mapdata_bigface(), mapdata_clear_old(), mapdata_clear_space(), mapdata_face_info(), mapdata_has_tile(), mapdata_init(), mapdata_is_inside(), mapdata_scroll(), mapdata_set_anim_layer(), mapdata_set_check_space(), mapdata_set_darkness(), mapdata_set_face_layer(), mapdata_set_size(), png_to_data(), recenter_virtual_map_view(), rescale_rgba_data(), rgba_to_cairo_surface(), and rgba_to_gdkpixbuf().
bool move_to_attack = false |
Definition at line 40 of file mapdata.c.
Referenced by clear_move_to(), draw_move_to(), run_move_to(), and set_move_to().
int move_to_x = 0 |
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(), draw_move_to(), is_at_moveto(), run_move_to(), and set_move_to().
int move_to_y = 0 |
Definition at line 39 of file mapdata.c.
Referenced by clear_move_to(), draw_move_to(), is_at_moveto(), run_move_to(), and set_move_to().
PlayerPosition pl_pos |
Position of the player on the internal map.
Internal to the client.
Definition at line 30 of file mapdata.c.
Referenced by expand_clear_bigface(), expand_set_bigface(), ExtSmooth(), gtk_map_redraw(), Map2Cmd(), mapdata_add_label(), mapdata_animation(), mapdata_bigface(), mapdata_clear(), mapdata_clear_old(), mapdata_clear_space(), mapdata_face(), mapdata_init(), mapdata_scroll(), mapdata_set_anim_layer(), mapdata_set_check_space(), mapdata_set_darkness(), mapdata_set_face_layer(), mapdata_set_size(), mapdata_set_smooth(), pl_mpos(), recenter_virtual_map_view(), and script_process_cmd().
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().
|
static |
Definition at line 116 of file mapdata.c.
Referenced by 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(), mapdata_add_label(), mapdata_cell(), mapdata_clear(), mapdata_clear_old(), mapdata_clear_space(), mapdata_contains(), mapdata_free(), mapdata_init(), mapdata_newmap(), mapdata_set_anim_layer(), mapdata_set_check_space(), mapdata_set_darkness(), mapdata_set_face_layer(), mapdata_set_size(), mapdata_set_smooth(), mapdata_size(), mark_resmooth(), and recenter_virtual_map_view().
int want_offset_x = 0 |
Definition at line 92 of file mapdata.c.
Referenced by mapdata_init(), mapdata_newmap(), predict_scroll(), and update_global_offset().
int want_offset_y = 0 |
Definition at line 93 of file mapdata.c.
Referenced by mapdata_init(), mapdata_newmap(), predict_scroll(), and update_global_offset().
|
static |
Definition at line 100 of file mapdata.c.
Referenced by client_mapsize(), create_and_rescale_image_from_data(), display_newpng(), expand_clear_bigface(), expand_set_bigface(), mapdata_add_label(), mapdata_alloc(), mapdata_animation(), mapdata_bigface(), mapdata_clear_old(), mapdata_clear_space(), mapdata_face_info(), mapdata_has_tile(), mapdata_init(), mapdata_scroll(), mapdata_set_anim_layer(), mapdata_set_check_space(), mapdata_set_darkness(), mapdata_set_face_layer(), mapdata_set_size(), on_spell_window_size_allocate(), png_to_data(), recenter_virtual_map_view(), rescale_rgba_data(), rgba_to_cairo_surface(), and rgba_to_gdkpixbuf().