00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00034
00035
00036
00037
00038
00039 #ifndef MAP_H
00040 #define MAP_H
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #define MAGIC_MAP_SIZE 50
00053 #define MAGIC_MAP_HALF MAGIC_MAP_SIZE/2
00054
00055
00056
00057
00058
00059
00060 #define MAP_LAYERS 10
00061
00062 extern const char *map_layer_name[MAP_LAYERS];
00063
00068 #define MAP_LAYER_FLOOR 0
00069 #define MAP_LAYER_NO_PICK1 1
00070 #define MAP_LAYER_NO_PICK2 2
00071 #define MAP_LAYER_ITEM1 3
00072 #define MAP_LAYER_ITEM2 4
00073 #define MAP_LAYER_ITEM3 5
00074 #define MAP_LAYER_LIVING1 6
00075 #define MAP_LAYER_LIVING2 7
00076 #define MAP_LAYER_FLY1 8
00077 #define MAP_LAYER_FLY2 9
00079
00080
00081 #define MAP_WHEN_RESET(m) ((m)->reset_time)
00082
00083 #define MAP_RESET_TIMEOUT(m) ((m)->reset_timeout)
00084 #define MAP_DIFFICULTY(m) ((m)->difficulty)
00085 #define MAP_TIMEOUT(m) ((m)->timeout)
00086 #define MAP_SWAP_TIME(m) ((m)->swap_time)
00087 #define MAP_OUTDOORS(m) ((m)->outdoor)
00088
00094 #define MAP_DARKNESS(m) (m)->darkness
00095
00097 #define MAP_WIDTH(m) (m)->width
00098
00099 #define MAP_HEIGHT(m) (m)->height
00100
00101 #define MAP_SIZE(m) ((m)->width*(m)->height)
00102
00104 #define MAP_ENTER_X(m) (m)->enter_x
00105
00106 #define MAP_ENTER_Y(m) (m)->enter_y
00107
00108 #define MAP_NOSMOOTH(m) (m)->nosmooth
00109
00116 #define MAP_FLUSH 0x1
00117 #define MAP_PLAYER_UNIQUE 0x2
00118 #define MAP_BLOCK 0x4
00119 #define MAP_STYLE 0x8
00120 #define MAP_OVERLAY 0x10
00122
00123
00131 #define SAVE_FLAG_SAVE_UNPAID 1
00132 #define SAVE_FLAG_NO_REMOVE 2
00134
00135
00141 #define SAVE_MODE_NORMAL 0
00142 #define SAVE_MODE_INPLACE 1
00143 #define SAVE_MODE_OVERLAY 2
00145
00146
00151 #define MAP_IN_MEMORY 1
00152 #define MAP_SWAPPED 2
00153 #define MAP_LOADING 3
00154 #define MAP_SAVING 4
00156
00157
00164 #define SAVE_ERROR_OK 0
00165 #define SAVE_ERROR_RCREATION -1
00166 #define SAVE_ERROR_UCREATION -2
00167 #define SAVE_ERROR_WRITE -3
00168 #define SAVE_ERROR_NO_PATH -4
00169 #define SAVE_ERROR_URENAME -5
00170 #define SAVE_ERROR_CLOSE -6
00171 #define SAVE_ERROR_RRENAME -7
00172 #define SAVE_ERROR_NOT_IN_MEMORY -10
00173 #define SAVE_ERROR_PLAYER -11
00175
00176
00177
00178
00179
00180
00182 #define GET_MAP_FLAGS(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].flags)
00183
00184 #define SET_MAP_FLAGS(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].flags = C)
00185
00186 #define GET_MAP_LIGHT(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].light)
00187
00188 #define SET_MAP_LIGHT(M, X, Y, L) ((M)->spaces[(X)+(M)->width*(Y)].light = L)
00189 #define GET_MAP_PLAYER(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].pl)
00190 #define SET_MAP_PLAYER(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].pl = C)
00191
00193 #define GET_MAP_OB(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].bottom)
00194
00195 #define GET_MAP_TOP(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].top)
00196
00198 #define SET_MAP_OB(M, X, Y, tmp) ((M)->spaces[(X)+(M)->width*(Y)].bottom = (tmp))
00199
00200 #define SET_MAP_TOP(M, X, Y, tmp) ((M)->spaces[(X)+(M)->width*(Y)].top = (tmp))
00201
00203 #define SET_MAP_FACE_OBJ(M, X, Y, C, L) ((M)->spaces[(X)+(M)->width*(Y)].faces_obj[L] = C)
00204
00205 #define GET_MAP_FACE_OBJ(M, X, Y, L) ((M)->spaces[(X)+(M)->width*(Y)].faces_obj[L])
00206
00210 #define GET_MAP_FACE_OBJS(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].faces_obj)
00211
00213 #define GET_MAP_MOVE_BLOCK(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_block)
00214
00215 #define SET_MAP_MOVE_BLOCK(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_block = C)
00216
00218 #define GET_MAP_MOVE_SLOW(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_slow)
00219
00220 #define SET_MAP_MOVE_SLOW(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_slow = C)
00221
00223 #define GET_MAP_MOVE_ON(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_on)
00224
00225 #define SET_MAP_MOVE_ON(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_on = C)
00226
00228 #define GET_MAP_MOVE_OFF(M, X, Y) ((M)->spaces[(X)+(M)->width*(Y)].move_off)
00229
00230 #define SET_MAP_MOVE_OFF(M, X, Y, C) ((M)->spaces[(X)+(M)->width*(Y)].move_off = C)
00231
00238 #define OUT_OF_REAL_MAP(M, X, Y) ((X) < 0 || (Y) < 0 || (X) >= (M)->width || (Y) >= (M)->height)
00239
00247 #define P_BLOCKSVIEW 0x01
00248 #define P_NO_MAGIC 0x02
00250
00251
00252
00253
00254
00255
00256 #define AB_NO_PASS 0x04
00257 #define P_PLAYER 0x08
00258 #define P_IS_ALIVE 0x10
00259 #define P_NO_CLERIC 0x20
00260 #define P_NEED_UPDATE 0x40
00261 #define P_NO_ERROR 0x80
00264
00265
00266
00267
00268
00269
00270 #define P_OUT_OF_MAP 0x100
00271 #define P_NEW_MAP 0x200
00273
00274
00277 typedef struct MapSpace {
00278 object *bottom;
00279 object *top;
00280 object *faces_obj[MAP_LAYERS];
00281 uint8 flags;
00282 sint8 light;
00283 MoveType move_block;
00284 MoveType move_slow;
00285 MoveType move_on;
00286 MoveType move_off;
00287 object *pl;
00288 } MapSpace;
00289
00295 typedef struct regiondef {
00296 struct regiondef *next;
00297 const char *name;
00298 const char *parent_name;
00305 struct regiondef *parent;
00310 const char *longname;
00312 const char *msg;
00313 uint32 counter;
00314 sint8 fallback;
00316 char *jailmap;
00317 sint16 jailx, jaily;
00318 } region;
00319
00324 typedef struct shopitem {
00325 const char *name;
00326 const char *name_pl;
00327 int typenum;
00328 sint8 strength;
00330 int index;
00331 } shopitems;
00332
00344 typedef struct mapdef {
00345 struct mapdef *next;
00346 char *tmpname;
00347 char *name;
00348 struct regiondef *region;
00351 uint32 reset_time;
00352 uint32 reset_timeout;
00354 uint32 fixed_resettime:1;
00356 uint32 unique:1;
00357 uint32 is_template:1;
00358 uint32 nosmooth:1;
00359 uint32 outdoor:1;
00360 sint32 timeout;
00361 sint32 swap_time;
00362 uint16 difficulty;
00363 sint16 players;
00364 uint32 in_memory;
00365 uint8 compressed;
00367 uint8 darkness;
00368 uint16 width, height;
00369 uint16 enter_x;
00370 uint16 enter_y;
00371 oblinkpt *buttons;
00372 MapSpace *spaces;
00373 struct shopitem *shopitems;
00374 char *shoprace;
00375 double shopgreed;
00376 uint64 shopmin;
00377 uint64 shopmax;
00378 char *msg;
00379 char *maplore;
00380 char *tile_path[4];
00381 struct mapdef *tile_map[4];
00382 char path[HUGE_BUF];
00383 struct timeval last_reset_time;
00384 char *background_music;
00385 } mapstruct;
00386
00397 typedef struct rv_vector {
00398 unsigned int distance;
00399 int distance_x;
00400 int distance_y;
00401 int direction;
00402 object *part;
00403 } rv_vector;
00404
00405 #endif