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