root/src/map/path.h @ 10

Revision 1, 1.5 kB (checked in by jinshiro, 17 years ago)
Line 
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
11struct walkpath_data {
12        unsigned char path_len,path_pos;
13        unsigned char path[MAX_WALKPATH];
14};
15
16struct 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
23int path_blownpos(int m,int x0,int y0,int dx,int dy,int count);
24
25// tries to find a walkable path
26bool 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
29bool 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
33int 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
38unsigned 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_ */
Note: See TracBrowser for help on using the browser.