Atrinik Client  4.0
map.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
30 #ifndef MAP_H
31 #define MAP_H
32 
34 #define MAP_TILE_POS_YOFF 23
35 
37 #define MAP_TILE_POS_YOFF2 12
38 
40 #define MAP_TILE_POS_XOFF 48
41 
43 #define MAP_TILE_POS_XOFF2 24
44 
46 #define MAP_TILE_XOFF 12
47 
49 #define MAP_TILE_YOFF 24
50 
56 #define LAYER_SYS 0
57 
58 #define LAYER_FLOOR 1
59 
60 #define LAYER_FMASK 2
61 
62 #define LAYER_ITEM 3
63 
64 #define LAYER_ITEM2 4
65 
66 #define LAYER_WALL 5
67 
68 #define LAYER_LIVING 6
69 
70 #define LAYER_EFFECT 7
71 
76 #define NUM_LAYERS 7
77 
80 #define NUM_SUB_LAYERS 7
81 
84 #define NUM_REAL_LAYERS (NUM_LAYERS * NUM_SUB_LAYERS)
85 
86 #define GET_MAP_LAYER(_layer, _sub_layer) \
87  (NUM_LAYERS * (_sub_layer) + (_layer) - 1)
88 
90 typedef struct _multi_part_tile {
92  int xoff;
93 
95  int yoff;
97 
105 typedef struct _multi_part_obj {
107  int xlen;
108 
110  int ylen;
111 
115 
117 typedef struct _mapdata {
119  char name[HUGE_BUF];
120 
122  char name_new[HUGE_BUF];
123 
125  char region_name[MAX_BUF];
126 
129 
131  char region_longname[MAX_BUF];
132 
134  char map_path[HUGE_BUF];
135 
136  uint32_t name_fadeout_start;
137 
139  int xlen;
140 
142  int ylen;
143 
145  int posx;
146 
148  int posy;
149 
154  int height_diff : 1;
155 
159  int in_building : 1;
160 
165 
170 } _mapdata;
171 
175 typedef struct MapCell {
178 
180  char pcolor[NUM_REAL_LAYERS][COLOR_BUF];
181 
184 
187 
190 
193 
196 
199 
202 
205 
208 
211 
214 
217 
220 
223 
228 
233 
234  uint8_t anim_last[NUM_REAL_LAYERS];
235 
236  uint8_t anim_speed[NUM_REAL_LAYERS];
237 
238  uint8_t anim_facing[NUM_REAL_LAYERS];
239 
240  uint8_t anim_state[NUM_REAL_LAYERS];
241 
242  uint8_t anim_flags[NUM_SUB_LAYERS];
243 
247  uint8_t fow;
248 
249  uint8_t priority[NUM_SUB_LAYERS];
250 
251  uint8_t secondpass[NUM_SUB_LAYERS];
252 
253  char glow[NUM_REAL_LAYERS][COLOR_BUF];
254  uint8_t glow_speed[NUM_REAL_LAYERS];
255  uint8_t glow_state[NUM_REAL_LAYERS];
256 } MapCell;
257 
258 #define MAP_STARTX map_width * (MAP_FOW_SIZE / 2)
259 #define MAP_STARTY map_height * (MAP_FOW_SIZE / 2)
260 #define MAP_WIDTH map_width
261 #define MAP_HEIGHT map_height
262 
263 #define MAP_CELL_GET(_x, _y) (&cells[(_y) * (map_width * MAP_FOW_SIZE) + (_x)])
264 #define MAP_CELL_GET_MIDDLE(_x, _y) \
265  (&cells[((_y) + map_height * (MAP_FOW_SIZE / 2)) * \
266  (map_width * MAP_FOW_SIZE) + (_x) + map_width * (MAP_FOW_SIZE / 2)])
267 
268 typedef struct map_target_struct {
269  uint32_t count;
270  int x;
271  int y;
273 
275 #define MAP_NAME_FONT FONT_SERIF14
276 
278 #define MAP_NAME_FADEOUT 500
279 
289 #define HEIGHT_MAX_RENDER 50
290 
296 #define ANIM_DAMAGE 1
297 
298 #define ANIM_KILL 2
299 
304 typedef struct map_anim {
305  struct map_anim *next;
306  struct map_anim *prev;
307 
308  int type;
309  int sub_layer;
310  int value;
311  int mapx;
312  int mapy;
313 
314  double xoff;
315  double yoff;
316 
317  uint32_t start_tick;
318  uint32_t last_tick;
319 } map_anim_t;
320 
321 #endif
char map_path[HUGE_BUF]
Definition: map.h:134
struct map_anim * prev
Previous animation.
Definition: map.h:306
int16_t zoom_x[NUM_REAL_LAYERS]
Definition: map.h:207
Definition: map.h:175
char pcolor[NUM_REAL_LAYERS][COLOR_BUF]
Definition: map.h:180
int value
This is the number to display.
Definition: map.h:310
char name_new[HUGE_BUF]
Definition: map.h:122
Definition: map.h:304
uint8_t quick_pos[NUM_REAL_LAYERS]
Definition: map.h:183
int mapx
Map position X.
Definition: map.h:311
uint8_t flags[NUM_REAL_LAYERS]
Definition: map.h:192
int16_t align[NUM_REAL_LAYERS]
Definition: map.h:213
_multi_part_tile part[16]
Definition: map.h:113
struct region_map * region_map
Definition: map.h:169
double xoff
Movement in X per tick.
Definition: map.h:314
uint8_t alpha[NUM_REAL_LAYERS]
Definition: map.h:198
struct _mapdata _mapdata
double yoff
Movement in Y per tick.
Definition: map.h:315
struct _multi_part_tile _multi_part_tile
uint8_t fow
Definition: map.h:247
int xlen
Definition: map.h:139
struct _multi_part_obj _multi_part_obj
int32_t stretch[NUM_SUB_LAYERS]
Definition: map.h:222
struct map_anim * next
Next animation.
Definition: map.h:305
char region_name[MAX_BUF]
Definition: map.h:125
uint8_t target_is_friend[NUM_REAL_LAYERS]
Definition: map.h:232
uint8_t player_sub_layer
Definition: map.h:164
int height_diff
Definition: map.h:154
int xlen
Definition: map.h:107
struct map_anim map_anim_t
int type
Type of the animation, one of Animation types.
Definition: map.h:308
int yoff
Definition: map.h:95
int ylen
Definition: map.h:142
uint32_t last_tick
This is the end-tick.
Definition: map.h:318
int posx
Definition: map.h:145
int16_t height[NUM_REAL_LAYERS]
Definition: map.h:204
uint8_t infravision[NUM_REAL_LAYERS]
Definition: map.h:219
int in_building
Definition: map.h:159
int xoff
Definition: map.h:92
char pname[NUM_REAL_LAYERS][64]
Definition: map.h:177
int16_t rotate[NUM_REAL_LAYERS]
Definition: map.h:216
uint8_t darkness[NUM_SUB_LAYERS]
Definition: map.h:189
struct MapCell MapCell
#define NUM_SUB_LAYERS
Definition: map.h:80
int16_t zoom_y[NUM_REAL_LAYERS]
Definition: map.h:210
int sub_layer
Sub-layer the damage is happening on.
Definition: map.h:309
bool region_has_map
Definition: map.h:128
#define NUM_REAL_LAYERS
Definition: map.h:84
int ylen
Definition: map.h:110
uint8_t probe[NUM_REAL_LAYERS]
Definition: map.h:186
uint32_t start_tick
The time we started this anim.
Definition: map.h:317
int posy
Definition: map.h:148
int16_t faces[NUM_REAL_LAYERS]
Definition: map.h:201
Definition: map.h:117
char region_longname[MAX_BUF]
Definition: map.h:131
uint32_t target_object_count[NUM_REAL_LAYERS]
Definition: map.h:227
uint8_t draw_double[NUM_REAL_LAYERS]
Definition: map.h:195
int mapy
Map position Y.
Definition: map.h:312
char name[HUGE_BUF]
Definition: map.h:119