]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/pathlib/pathlib.qh
Turn #define'd constants into actual constants
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / pathlib / pathlib.qh
1 .entity pathlib_list;
2 .entity path_next;
3 .entity path_prev;
4
5 #define inwater(point) (pointcontents(point) == CONTENT_WATER)
6 #define medium spawnshieldtime
7
8 const vector PLIB_FORWARD = '0 1 0';
9 //#define PLIB_BACK    '0 -1 0'
10 const vector PLIB_RIGHT = '1 0 0';
11 //#define PLIB_LEFT    '-1 0 0'
12
13 #define DEBUGPATHING
14 #ifdef DEBUGPATHING
15 void pathlib_showpath(entity start);
16 void pathlib_showpath2(entity path);
17 #endif
18
19 entity openlist;
20 entity closedlist;
21
22 entity goal_node;
23 entity start_node;
24
25 .float is_path_node;
26 .float pathlib_node_g;
27 .float pathlib_node_h;
28 .float pathlib_node_f;
29 .float pathlib_node_c;
30
31 const float pathlib_node_edgeflag_unknown               = 0;
32 const float pathlib_node_edgeflag_left                  = 2;
33 const float pathlib_node_edgeflag_right                 = 4;
34 const float pathlib_node_edgeflag_forward               = 8;
35 const float pathlib_node_edgeflag_back                  = 16;
36 const float pathlib_node_edgeflag_backleft              = 32;
37 const float pathlib_node_edgeflag_backright     = 64;
38 const float pathlib_node_edgeflag_forwardleft   = 128;
39 const float pathlib_node_edgeflag_forwardright  = 256;
40 const float pathlib_node_edgeflag_none                  = 512;
41 .float pathlib_node_edgeflags;
42
43 float pathlib_open_cnt;
44 float pathlib_closed_cnt;
45 float pathlib_made_cnt;
46 float pathlib_merge_cnt;
47 float pathlib_searched_cnt;
48 float pathlib_bestopen_seached;
49 float pathlib_bestcash_hits;
50 float pathlib_bestcash_saved;
51 float pathlib_gridsize;
52 float pathlib_movecost;
53 float pathlib_movecost_diag;
54 float pathlib_movecost_waterfactor;
55 float pathlib_foundgoal;
56
57 float pathlib_starttime;
58 const float pathlib_maxtime = 60;
59
60 entity best_open_node;
61
62 vector tile_check_up;
63 vector tile_check_down;
64 float  tile_check_size;
65 float     tile_check_cross(vector where);
66 float     tile_check_plus(vector where);
67 float     tile_check_star(vector where);
68 var float tile_check(vector where);
69
70 float  movenode_stepsize;
71 vector movenode_stepup;
72 vector movenode_maxdrop;
73 vector movenode_boxup;
74 vector movenode_boxmax;
75 vector movenode_boxmin;
76 float  pathlib_movenode_goodnode;
77
78 vector     pathlib_wateroutnode(vector start, vector end, float doedge);
79 vector     pathlib_swimnode(vector start, vector end, float doedge);
80 vector     pathlib_flynode(vector start, vector end, float doedge);
81 vector     pathlib_walknode(vector start, vector end, float doedge);
82 var vector pathlib_movenode(vector start, vector end, float doedge);
83
84 float      pathlib_expandnode_star(entity node, vector start, vector goal);
85 float      pathlib_expandnode_box(entity node, vector start, vector goal);
86 float      pathlib_expandnode_octagon(entity node, vector start, vector goal);
87 var float  pathlib_expandnode(entity node, vector start, vector goal);
88
89 float      pathlib_g_static(entity parent, vector to, float static_cost);
90 float      pathlib_g_static_water(entity parent, vector to, float static_cost);
91 float      pathlib_g_euclidean(entity parent, vector to, float static_cost);
92 float      pathlib_g_euclidean_water(entity parent, vector to, float static_cost);
93 var float  pathlib_cost(entity parent, vector to, float static_cost);
94
95 float      pathlib_h_manhattan(vector a, vector b);
96 float      pathlib_h_diagonal(vector a, vector b);
97 float      pathlib_h_euclidean(vector a,vector b);
98 float      pathlib_h_diagonal2(vector a, vector b);
99 float      pathlib_h_diagonal3(vector a, vector b);
100 float      pathlib_h_diagonal2sdp(vector preprev, vector prev, vector point, vector end);
101 float      pathlib_h_none(vector preprev, vector prev) { return 0; }
102 var float  pathlib_heuristic(vector from, vector to);
103
104 var float  pathlib_makenode(entity parent,vector start, vector to, vector goal,float cost);
105 var float  buildpath_nodefilter(vector n,vector c,vector p);
106
107 var float  pathlib_wpp_waypointcallback(entity wp, entity wp_prev);
108
109 #ifdef DEBUGPATHING
110         #include "debug.qc"
111 #endif
112
113 #include "utility.qc"
114 #include "movenode.qc"
115 #include "costs.qc"
116 #include "expandnode.qc"
117 #include "main.qc"
118 #include "path_waypoint.qc"