Crossfire Client, Trunk  R20922
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 {
57  struct MapCellLayer heads[MAXLAYERS];
58  struct MapCellTailLayer tails[MAXLAYERS];
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 
154 #endif
gint16 mapdata_face_info(int mx, int my, int layer, int *dx, int *dy)
Definition: mapdata.c:1033
struct MapCell * mapdata_cell(int x, int y)
Definition: mapdata.c:116
guint8 have_darkness
Definition: mapdata.h:62
void mapdata_set_check_space(int x, int y)
Definition: mapdata.c:681
gint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:1059
int width
Definition: mapdata.h:70
guint8 smooth[MAXLAYERS]
Definition: mapdata.h:59
void mapdata_newmap(void)
Definition: mapdata.c:987
gint8 size_x
Definition: mapdata.h:38
gint16 animation
Definition: mapdata.h:30
gint8 size_x
Definition: mapdata.h:20
struct MapCell ** _cells
Definition: mapdata.h:69
int height
Definition: mapdata.h:71
void mapdata_scroll(int dx, int dy)
Definition: mapdata.c:914
guint8 cleared
Definition: mapdata.h:64
void mapdata_free(void)
Definition: mapdata.c:612
Definition: mapdata.h:67
gint8 size_y
Definition: mapdata.h:21
guint8 need_resmooth
Definition: mapdata.h:63
void mapdata_clear_old(int x, int y)
Definition: mapdata.c:793
gint16 face
Definition: mapdata.h:37
gint8 size_y
Definition: mapdata.h:39
void mapdata_set_size(int viewx, int viewy)
Definition: mapdata.c:619
gint16 mapdata_face(int x, int y, int layer) __attribute__((deprecated))
Definition: mapdata.c:1025
void mapdata_set_darkness(int x, int y, int darkness)
Definition: mapdata.c:736
bool mapdata_contains(int x, int y)
Definition: mapdata.c:123
guint8 animation_speed
Definition: mapdata.h:31
#define MAXLAYERS
Definition: mapdata.h:6
guint8 need_update
Definition: mapdata.h:61
void mapdata_set_smooth(int x, int y, guint8 smooth, int layer)
Definition: mapdata.c:759
void mapdata_animation(void)
Definition: mapdata.c:1346
void mapdata_clear_space(int x, int y)
Definition: mapdata.c:639
void mapdata_set_anim_layer(int x, int y, guint16 anim, guint8 anim_speed, int layer)
Definition: mapdata.c:852
int mapdata_is_inside(int x, int y)
Definition: mapdata.c:630
guint8 animation_phase
Definition: mapdata.h:33
gint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:1140
void mapdata_set_face_layer(int x, int y, gint16 face, int layer)
Definition: mapdata.c:821
gint16 face
Definition: mapdata.h:19
bool mapdata_can_smooth(int x, int y, int layer)
Definition: mapdata.c:131
guint8 animation_left
Definition: mapdata.h:32
guint8 darkness
Definition: mapdata.h:60
void mapdata_size(int *x, int *y)
Definition: mapdata.c:139