1 | // Copyright (c) Athena Dev Teams - Licensed under GNU GPL |
---|
2 | // For more information, see LICENCE in the main folder |
---|
3 | |
---|
4 | #ifndef _PATH_H_ |
---|
5 | #define _PATH_H_ |
---|
6 | |
---|
7 | #include "map.h" // enum cell_chk |
---|
8 | |
---|
9 | #define MAX_WALKPATH 32 |
---|
10 | |
---|
11 | struct walkpath_data { |
---|
12 | unsigned char path_len,path_pos; |
---|
13 | unsigned char path[MAX_WALKPATH]; |
---|
14 | }; |
---|
15 | |
---|
16 | struct shootpath_data { |
---|
17 | int rx,ry,len; |
---|
18 | int x[MAX_WALKPATH]; |
---|
19 | int y[MAX_WALKPATH]; |
---|
20 | }; |
---|
21 | |
---|
22 | // calculates destination cell for knockback |
---|
23 | int path_blownpos(int m,int x0,int y0,int dx,int dy,int count); |
---|
24 | |
---|
25 | // tries to find a walkable path |
---|
26 | bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int flag,cell_chk cell); |
---|
27 | |
---|
28 | // tries to find a shootable path |
---|
29 | bool path_search_long(struct shootpath_data *spd,int m,int x0,int y0,int x1,int y1,cell_chk cell); |
---|
30 | |
---|
31 | |
---|
32 | // distance related functions |
---|
33 | int check_distance(int dx, int dy, int distance); |
---|
34 | #define check_distance_bl(bl1, bl2, distance) check_distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y, distance) |
---|
35 | #define check_distance_blxy(bl, x1, y1, distance) check_distance((bl)->x-(x1), (bl)->y-(y1), distance) |
---|
36 | #define check_distance_xy(x0, y0, x1, y1, distance) check_distance((x0)-(x1), (y0)-(y1), distance) |
---|
37 | |
---|
38 | unsigned int distance(int dx, int dy); |
---|
39 | #define distance_bl(bl1, bl2) distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y) |
---|
40 | #define distance_blxy(bl, x1, y1) distance((bl)->x-(x1), (bl)->y-(y1)) |
---|
41 | #define distance_xy(x0, y0, x1, y1) distance((x0)-(x1), (y0)-(y1)) |
---|
42 | |
---|
43 | #endif /* _PATH_H_ */ |
---|