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 
44  EMPTY, //< No data from server, and no fog data
45  VISIBLE, //< Data from server
46  FOG //< No longer visible, but saved as fog of war data
47 };
48 
62 struct MapCell
63 {
66  guint8 smooth[MAXLAYERS];
67  guint8 darkness; /* darkness: 0=fully illuminated, 255=pitch black */
68  guint8 need_update:1; /* set if tile should be redrawn */
69  guint8 need_resmooth:1; /* same has need update but for smoothing only */
71 };
72 
73 struct Map
74 {
75  struct MapCell **_cells; //< data, access via mapdata_cells()
76  int width; //< width of cells array
77  int height; //< height of cells array
78 };
79 
80 struct MapCell *mapdata_cell(int x, int y);
81 bool mapdata_contains(int x, int y);
82 void mapdata_size(int *x, int *y);
83 bool mapdata_can_smooth(int x, int y, int layer);
84 
90 void mapdata_set_size(int viewx, int viewy);
91 
96 void mapdata_free(void);
97 
102 void mapdata_scroll(int dx, int dy);
103 
108 void mapdata_newmap(void);
109 
114 int mapdata_is_inside(int x, int y);
115 
120 gint16 mapdata_face(int x, int y, int layer) __attribute__((deprecated));
121 
134 gint16 mapdata_face_info(int mx, int my, int layer, int *dx, int *dy);
135 
148 gint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh);
149 
150 void mapdata_clear_space(int x, int y);
151 void mapdata_set_check_space(int x, int y);
152 void mapdata_set_darkness(int x, int y, int darkness);
153 void mapdata_set_smooth(int x, int y, guint8 smooth, int layer);
154 void mapdata_clear_old(int x, int y);
155 void mapdata_set_face_layer(int x, int y, gint16 face, int layer);
156 void mapdata_set_anim_layer(int x, int y, guint16 anim, guint8 anim_speed, int layer);
157 gint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh);
158 void mapdata_animation(void);
159 int relative_direction(int dx, int dy);
160 
162 
163 void pl_mpos(int *px, int *py);
164 void set_move_to(int dx, int dy);
165 void clear_move_to(void);
166 bool is_at_moveto(void);
167 void run_move_to(void);
168 
169 extern int move_to_x, move_to_y;
170 extern bool move_to_attack;
173 
174 #endif
mapdata_bigface_head
gint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:1157
relative_direction
int relative_direction(int dx, int dy)
Definition: map.c:511
want_offset_x
int want_offset_x
Definition: mapdata.h:171
MapCellState
MapCellState
A map cell can be in one of three states:
Definition: mapdata.h:43
mapdata_face_info
gint16 mapdata_face_info(int mx, int my, int layer, int *dx, int *dy)
Definition: mapdata.c:1050
script_pos
PlayerPosition script_pos
Definition: mapdata.c:36
mapdata_newmap
void mapdata_newmap(void)
Definition: mapdata.c:991
Map::_cells
struct MapCell ** _cells
Definition: mapdata.h:75
VISIBLE
@ VISIBLE
Definition: mapdata.h:45
mapdata_bigface
gint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:1076
MapCellTailLayer::face
gint16 face
Definition: mapdata.h:37
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:704
move_to_attack
bool move_to_attack
Definition: mapdata.c:40
Map::height
int height
Definition: mapdata.h:77
MapCellTailLayer::size_x
gint8 size_x
Definition: mapdata.h:38
MapCellTailLayer
Definition: mapdata.h:36
MapCellLayer::animation_left
guint8 animation_left
Definition: mapdata.h:32
is_at_moveto
bool is_at_moveto(void)
Definition: mapdata.c:1479
MapCellLayer::animation_speed
guint8 animation_speed
Definition: mapdata.h:31
MapCell::smooth
guint8 smooth[MAXLAYERS]
Definition: mapdata.h:66
mapdata_clear_old
void mapdata_clear_old(int x, int y)
Definition: mapdata.c:808
want_offset_y
int want_offset_y
Definition: mapdata.h:172
MapCellTailLayer::size_y
gint8 size_y
Definition: mapdata.h:39
run_move_to
void run_move_to(void)
Definition: mapdata.c:1489
mapdata_free
void mapdata_free(void)
Definition: mapdata.c:642
mapdata_scroll
void mapdata_scroll(int dx, int dy)
Definition: mapdata.c:918
Map::width
int width
Definition: mapdata.h:76
MapCell::heads
struct MapCellLayer heads[MAXLAYERS]
Definition: mapdata.h:64
Map
Definition: mapdata.h:73
mapdata_set_size
void mapdata_set_size(int viewx, int viewy)
Definition: mapdata.c:651
move_to_y
int move_to_y
Definition: mapdata.h:169
PlayerPosition
Definition: client.h:524
MapCell::tails
struct MapCellTailLayer tails[MAXLAYERS]
Definition: mapdata.h:65
mapdata_set_darkness
void mapdata_set_darkness(int x, int y, int darkness)
Definition: mapdata.c:752
MapCellLayer::animation_phase
guint8 animation_phase
Definition: mapdata.h:33
mapdata_animation
void mapdata_animation(void)
Definition: mapdata.c:1363
MapCell::need_resmooth
guint8 need_resmooth
Definition: mapdata.h:69
MapCellLayer::face
gint16 face
Definition: mapdata.h:19
pl_mpos
void pl_mpos(int *px, int *py)
Definition: mapdata.c:1450
FOG
@ FOG
Definition: mapdata.h:46
MapCellLayer::size_y
gint8 size_y
Definition: mapdata.h:21
mapdata_is_inside
int mapdata_is_inside(int x, int y)
Definition: mapdata.c:662
mapdata_contains
bool mapdata_contains(int x, int y)
Definition: mapdata.c:144
MapCellLayer::size_x
gint8 size_x
Definition: mapdata.h:20
mapdata_clear_space
void mapdata_clear_space(int x, int y)
Definition: mapdata.c:671
EMPTY
@ EMPTY
Definition: mapdata.h:44
set_move_to
void set_move_to(int dx, int dy)
Definition: mapdata.c:1457
MapCellLayer::animation
gint16 animation
Definition: mapdata.h:30
mapdata_can_smooth
bool mapdata_can_smooth(int x, int y, int layer)
Definition: mapdata.c:152
mapdata_face
gint16 mapdata_face(int x, int y, int layer) __attribute__((deprecated))
Definition: mapdata.c:1042
MapCell
Definition: mapdata.h:62
mapdata_set_face_layer
void mapdata_set_face_layer(int x, int y, gint16 face, int layer)
Definition: mapdata.c:838
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
MapCellLayer
Definition: mapdata.h:18
MapCell::need_update
guint8 need_update
Definition: mapdata.h:68
mapdata_set_smooth
void mapdata_set_smooth(int x, int y, guint8 smooth, int layer)
Definition: mapdata.c:775
MapCell::darkness
guint8 darkness
Definition: mapdata.h:67
mapdata_size
void mapdata_size(int *x, int *y)
Definition: mapdata.c:160
mapdata_cell
struct MapCell * mapdata_cell(int x, int y)
Definition: mapdata.c:137
MapCell::state
enum MapCellState state
Definition: mapdata.h:70
mapdata_set_anim_layer
void mapdata_set_anim_layer(int x, int y, guint16 anim, guint8 anim_speed, int layer)
Definition: mapdata.c:867
clear_move_to
void clear_move_to(void)
Definition: mapdata.c:1473