Crossfire Client, Trunk
mapdata.h
Go to the documentation of this file.
1 #ifndef MAP_H
2 #define MAP_H
3 
6 #define MAXLAYERS 10
7 
11 #define MAX_VIEW 64
12 
13 /* Map1 only used 3 layers. Trying to use 10 seems to cause
14  * problems for that code.
15  */
16 #define MAP1_LAYERS 3
17 
18 struct MapCellLayer {
19  gint16 face;
20  gint8 size_x;
21  gint8 size_y;
22 
23  /* Link into animation information.
24  * animation is provided to us from the server in the map2 command.
25  * animation_speed is also provided.
26  * animation_left is how many ticks until animation changes - generated
27  * by client.
28  * animation_phase is current phase.
29  */
30  gint16 animation;
34 };
35 
37  gint16 face;
38  gint8 size_x;
39  gint8 size_y;
40 };
41 
55 struct MapCell
56 {
59  guint8 smooth[MAXLAYERS];
60  guint8 darkness; /* darkness: 0=fully illuminated, 255=pitch black */
61  guint8 need_update:1; /* set if tile should be redrawn */
62  guint8 have_darkness:1; /* set if darkness information was set */
63  guint8 need_resmooth:1; /* same has need update but for smoothing only */
64  guint8 cleared:1; /* If set, this is a fog cell. */
65 };
66 
67 struct Map
68 {
69  struct MapCell **_cells; //< data, access via mapdata_cells()
70  int width; //< width of cells array
71  int height; //< height of cells array
72 };
73 
74 struct MapCell *mapdata_cell(int x, int y);
75 bool mapdata_contains(int x, int y);
76 void mapdata_size(int *x, int *y);
77 bool mapdata_can_smooth(int x, int y, int layer);
78 
84 void mapdata_set_size(int viewx, int viewy);
85 
90 void mapdata_free(void);
91 
96 void mapdata_scroll(int dx, int dy);
97 
102 void mapdata_newmap(void);
103 
108 int mapdata_is_inside(int x, int y);
109 
114 gint16 mapdata_face(int x, int y, int layer) __attribute__((deprecated));
115 
128 gint16 mapdata_face_info(int mx, int my, int layer, int *dx, int *dy);
129 
142 gint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh);
143 
144 void mapdata_clear_space(int x, int y);
145 void mapdata_set_check_space(int x, int y);
146 void mapdata_set_darkness(int x, int y, int darkness);
147 void mapdata_set_smooth(int x, int y, guint8 smooth, int layer);
148 void mapdata_clear_old(int x, int y);
149 void mapdata_set_face_layer(int x, int y, gint16 face, int layer);
150 void mapdata_set_anim_layer(int x, int y, guint16 anim, guint8 anim_speed, int layer);
151 gint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh);
152 void mapdata_animation(void);
153 int relative_direction(int dx, int dy);
154 
156 
157 void pl_mpos(int *px, int *py);
158 void set_move_to(int dx, int dy);
159 void clear_move_to(void);
160 bool is_at_moveto(void);
161 void run_move_to(void);
162 
163 extern int move_to_x, move_to_y;
164 extern bool move_to_attack;
167 
168 #endif
Map::height
int height
Definition: mapdata.h:71
mapdata_bigface_head
gint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:1162
MapCellTailLayer::size_x
gint8 size_x
Definition: mapdata.h:38
relative_direction
int relative_direction(int dx, int dy)
Definition: map.c:511
want_offset_x
int want_offset_x
Definition: mapdata.h:165
Map
Definition: mapdata.h:67
mapdata_face_info
gint16 mapdata_face_info(int mx, int my, int layer, int *dx, int *dy)
Definition: mapdata.c:1055
MapCell::cleared
guint8 cleared
Definition: mapdata.h:64
script_pos
PlayerPosition script_pos
Definition: mapdata.c:36
mapdata_newmap
void mapdata_newmap(void)
Definition: mapdata.c:996
mapdata_bigface
gint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:1081
move_to_x
int move_to_x
Definition: mapdata.c:39
mapdata_set_check_space
void mapdata_set_check_space(int x, int y)
Definition: mapdata.c:686
move_to_attack
bool move_to_attack
Definition: mapdata.c:40
MapCellTailLayer::face
gint16 face
Definition: mapdata.h:37
is_at_moveto
bool is_at_moveto(void)
Definition: mapdata.c:1484
mapdata_clear_old
void mapdata_clear_old(int x, int y)
Definition: mapdata.c:798
want_offset_y
int want_offset_y
Definition: mapdata.h:166
run_move_to
void run_move_to(void)
Definition: mapdata.c:1494
MapCellLayer::face
gint16 face
Definition: mapdata.h:19
mapdata_free
void mapdata_free(void)
Definition: mapdata.c:615
mapdata_scroll
void mapdata_scroll(int dx, int dy)
Definition: mapdata.c:919
MapCellTailLayer::size_y
gint8 size_y
Definition: mapdata.h:39
MapCell::heads
struct MapCellLayer heads[MAXLAYERS]
Definition: mapdata.h:57
mapdata_set_size
void mapdata_set_size(int viewx, int viewy)
Definition: mapdata.c:624
MapCellLayer::animation_phase
guint8 animation_phase
Definition: mapdata.h:33
Map::_cells
struct MapCell ** _cells
Definition: mapdata.h:69
move_to_y
int move_to_y
Definition: mapdata.h:163
mapdata_set_darkness
void mapdata_set_darkness(int x, int y, int darkness)
Definition: mapdata.c:741
MapCell::smooth
guint8 smooth[MAXLAYERS]
Definition: mapdata.h:59
MapCell::darkness
guint8 darkness
Definition: mapdata.h:60
mapdata_animation
void mapdata_animation(void)
Definition: mapdata.c:1368
MapCell
Definition: mapdata.h:55
Map::width
int width
Definition: mapdata.h:70
MapCell::have_darkness
guint8 have_darkness
Definition: mapdata.h:62
pl_mpos
void pl_mpos(int *px, int *py)
Definition: mapdata.c:1455
MapCell::need_resmooth
guint8 need_resmooth
Definition: mapdata.h:63
MapCellTailLayer
Definition: mapdata.h:36
MapCell::tails
struct MapCellTailLayer tails[MAXLAYERS]
Definition: mapdata.h:58
mapdata_is_inside
int mapdata_is_inside(int x, int y)
Definition: mapdata.c:635
mapdata_contains
bool mapdata_contains(int x, int y)
Definition: mapdata.c:142
MapCellLayer
Definition: mapdata.h:18
mapdata_clear_space
void mapdata_clear_space(int x, int y)
Definition: mapdata.c:644
set_move_to
void set_move_to(int dx, int dy)
Definition: mapdata.c:1462
mapdata_can_smooth
bool mapdata_can_smooth(int x, int y, int layer)
Definition: mapdata.c:150
MapCellLayer::size_x
gint8 size_x
Definition: mapdata.h:20
mapdata_face
gint16 mapdata_face(int x, int y, int layer) __attribute__((deprecated))
Definition: mapdata.c:1047
MapCellLayer::animation_left
guint8 animation_left
Definition: mapdata.h:32
MapCellLayer::size_y
gint8 size_y
Definition: mapdata.h:21
PlayerPosition
Definition: client.h:524
mapdata_set_face_layer
void mapdata_set_face_layer(int x, int y, gint16 face, int layer)
Definition: mapdata.c:826
global_offset_x
int global_offset_x
Definition: mapdata.c:90
MAXLAYERS
#define MAXLAYERS
Definition: mapdata.h:6
global_offset_y
int global_offset_y
Definition: mapdata.c:91
mapdata_set_smooth
void mapdata_set_smooth(int x, int y, guint8 smooth, int layer)
Definition: mapdata.c:764
mapdata_size
void mapdata_size(int *x, int *y)
Definition: mapdata.c:158
MapCellLayer::animation_speed
guint8 animation_speed
Definition: mapdata.h:31
MapCell::need_update
guint8 need_update
Definition: mapdata.h:61
MapCellLayer::animation
gint16 animation
Definition: mapdata.h:30
mapdata_cell
struct MapCell * mapdata_cell(int x, int y)
Definition: mapdata.c:135
mapdata_set_anim_layer
void mapdata_set_anim_layer(int x, int y, guint16 anim, guint8 anim_speed, int layer)
Definition: mapdata.c:857
clear_move_to
void clear_move_to(void)
Definition: mapdata.c:1478