Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
pathlib.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUGPATHING   0
#define inwater(point)

Functions

var bool buildpath_nodefilter (vector n, vector c, vector p)
var float pathlib_cost (entity parent, vector to, float static_cost)
var float pathlib_expandnode (entity node, vector start, vector goal)
float pathlib_expandnode_box (entity node, vector start, vector goal)
float pathlib_expandnode_star (entity node, vector start, vector goal)
vector pathlib_flynode (entity this, vector start, vector end, float doedge)
float pathlib_g_euclidean (entity parent, vector to, float static_cost)
float pathlib_g_euclidean_water (entity parent, vector to, float static_cost)
float pathlib_g_static (entity parent, vector to, float static_cost)
float pathlib_g_static_water (entity parent, vector to, float static_cost)
float pathlib_h_diagonal (vector a, vector b)
 This heuristic consider both straight and diagonal moves to have the same cost.
float pathlib_h_diagonal2 (vector a, vector b)
 This heuristic consider both straight and diagonal moves, but has a separate cost for diagonal moves.
float pathlib_h_diagonal2sdp (vector preprev, vector prev, vector point, vector end)
 This heuristic consider both straight and diagonal moves, But has a separate cost for diagonal moves.
float pathlib_h_diagonal3 (vector a, vector b)
float pathlib_h_euclidean (vector a, vector b)
 This heuristic only considers the straight line distance.
float pathlib_h_manhattan (vector a, vector b)
 Manhattan heuristic means we expect to move up, down left or right No diagonal moves expected.
float pathlib_h_none (vector preprev, vector prev)
var float pathlib_heuristic (vector from, vector to)
var bool pathlib_makenode (entity parent, vector start, vector to, vector goal, float cost)
var vector pathlib_movenode (entity this, vector start, vector end, float doedge)
vector pathlib_swimnode (entity this, vector start, vector end, float doedge)
vector pathlib_walknode (entity this, vector start, vector end, float doedge)
vector pathlib_wateroutnode (entity this, vector start, vector end, float doedge)
var float pathlib_wpp_waypointcallback (entity wp, entity wp_prev)
 STATIC_INIT (g_pathlib_nodes)
var bool tile_check (entity this, vector where)
bool tile_check_cross (entity this, vector where)
bool tile_check_plus (entity this, vector where)
bool tile_check_star (entity this, vector where)

Variables

entity best_open_node
entity closedlist
IntrusiveList g_pathlib_nodes
entity goal_node
bool is_path_node
vector movenode_boxmax
vector movenode_boxmin
vector movenode_boxup
vector movenode_maxdrop
float movenode_stepsize
vector movenode_stepup
entity openlist
entity path_next
entity path_prev
float pathlib_bestcash_hits
float pathlib_bestcash_saved
float pathlib_bestopen_searched
float pathlib_closed_cnt
float pathlib_foundgoal
float pathlib_gridsize
entity pathlib_list
float pathlib_made_cnt
const float pathlib_maxtime = 60
float pathlib_merge_cnt
float pathlib_movecost
float pathlib_movecost_diag
float pathlib_movecost_waterfactor
bool pathlib_movenode_goodnode
float pathlib_node_c
const float pathlib_node_edgeflag_back = BIT(4)
const float pathlib_node_edgeflag_backleft = BIT(5)
const float pathlib_node_edgeflag_backright = BIT(6)
const float pathlib_node_edgeflag_forward = BIT(3)
const float pathlib_node_edgeflag_forwardleft = BIT(7)
const float pathlib_node_edgeflag_forwardright = BIT(8)
const float pathlib_node_edgeflag_left = BIT(1)
const float pathlib_node_edgeflag_none = BIT(9)
const float pathlib_node_edgeflag_right = BIT(2)
const float pathlib_node_edgeflag_unknown = 0
float pathlib_node_edgeflags
float pathlib_node_f
float pathlib_node_g
float pathlib_node_h
float pathlib_open_cnt
float pathlib_searched_cnt
float pathlib_starttime
const vector PLIB_FORWARD = '0 1 0'
const vector PLIB_RIGHT = '1 0 0'
entity start_node
vector tile_check_down
float tile_check_size
vector tile_check_up

Macro Definition Documentation

◆ DEBUGPATHING

#define DEBUGPATHING   0

Definition at line 4 of file pathlib.qh.

◆ inwater

#define inwater ( point)
Value:
(pointcontents(point) == CONTENT_WATER)
const float CONTENT_WATER

Definition at line 11 of file pathlib.qh.

Referenced by pathlib_astar(), pathlib_g_euclidean_water(), pathlib_g_static_water(), and pathlib_makenode_adaptive().

Function Documentation

◆ buildpath_nodefilter()

var bool buildpath_nodefilter ( vector n,
vector c,
vector p )

◆ pathlib_cost()

var float pathlib_cost ( entity parent,
vector to,
float static_cost )

References entity(), parent, prev, and vector.

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ pathlib_expandnode()

var float pathlib_expandnode ( entity node,
vector start,
vector goal )

References entity(), parent, and vector.

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ pathlib_expandnode_box()

float pathlib_expandnode_box ( entity node,
vector start,
vector goal )

Definition at line 224 of file expandnode.qc.

225{
226 vector v;
227
228 for(v.z = node.origin.z - pathlib_gridsize; v.z <= node.origin.z + pathlib_gridsize; v.z += pathlib_gridsize)
229 for(v.y = node.origin.y - pathlib_gridsize; v.y <= node.origin.y + pathlib_gridsize; v.y += pathlib_gridsize)
230 for(v.x = node.origin.x - pathlib_gridsize; v.x <= node.origin.x + pathlib_gridsize; v.x += pathlib_gridsize)
231 {
232 //if(vlen(v - node.origin))
233 pathlib_makenode(node,start,v,goal,pathlib_movecost);
234 }
235
236 return pathlib_open_cnt;
237}
var bool pathlib_makenode(entity parent, vector start, vector to, vector goal, float cost)
float pathlib_open_cnt
Definition pathlib.qh:42
float pathlib_movecost
Definition pathlib.qh:51
float pathlib_gridsize
Definition pathlib.qh:50
vector
Definition self.qh:92

References entity(), pathlib_gridsize, pathlib_makenode(), pathlib_movecost, pathlib_open_cnt, and vector.

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ pathlib_expandnode_star()

float pathlib_expandnode_star ( entity node,
vector start,
vector goal )

Definition at line 96 of file expandnode.qc.

97{
98 vector point;
99
100 vector where = node.origin;
101
104
105 if (node.pathlib_node_edgeflags == pathlib_node_edgeflag_unknown)
106 node.pathlib_node_edgeflags = tile_check_plus2(node, node.origin);
107
108 if(node.pathlib_node_edgeflags == pathlib_node_edgeflag_none)
109 {
110 LOG_TRACE("Node at ", vtos(node.origin), " not expanable");
111 return pathlib_open_cnt;
112 }
113
114 // Forward
115 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_forward)
116 {
117 point = where + f;
118 pathlib_makenode(node, start, point, goal, pathlib_movecost);
119 }
120
121 // Back
122 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_back)
123 {
124 point = where - f;
125 pathlib_makenode(node, start, point, goal, pathlib_movecost);
126 }
127
128 // Right
129 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_right)
130 {
131 point = where + r;
132 pathlib_makenode(node, start, point, goal, pathlib_movecost);
133 }
134
135 // Left
136 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_left)
137 {
138 point = where - r;
139 pathlib_makenode(node, start, point, goal, pathlib_movecost);
140
141 }
142
143 // Forward-right
144 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_forwardright)
145 {
146 point = where + f + r;
147 pathlib_makenode(node, start, point, goal, pathlib_movecost_diag);
148 }
149
150 // Forward-left
151 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_forwardleft)
152 {
153 point = where + f - r;
154 pathlib_makenode(node, start, point, goal, pathlib_movecost_diag);
155
156 }
157
158 // Back-right
159 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_backright)
160 {
161 point = where - f + r;
162 pathlib_makenode(node, start, point, goal, pathlib_movecost_diag);
163 }
164
165 // Back-left
166 if (node.pathlib_node_edgeflags & pathlib_node_edgeflag_backleft)
167 {
168 point = where - f - r;
169 pathlib_makenode(node, start, point, goal, pathlib_movecost_diag);
170 }
171
172 return pathlib_open_cnt;
173}
#define LOG_TRACE(...)
Definition log.qh:76
string vtos(vector v)
const float pathlib_node_edgeflag_forwardright
Definition pathlib.qh:38
float pathlib_movecost_diag
Definition pathlib.qh:52
const vector PLIB_FORWARD
Definition pathlib.qh:13
const float pathlib_node_edgeflag_backright
Definition pathlib.qh:36
const float pathlib_node_edgeflag_forward
Definition pathlib.qh:33
const float pathlib_node_edgeflag_left
Definition pathlib.qh:31
const float pathlib_node_edgeflag_forwardleft
Definition pathlib.qh:37
const float pathlib_node_edgeflag_right
Definition pathlib.qh:32
const float pathlib_node_edgeflag_unknown
Definition pathlib.qh:30
const float pathlib_node_edgeflag_backleft
Definition pathlib.qh:35
const vector PLIB_RIGHT
Definition pathlib.qh:15
const float pathlib_node_edgeflag_back
Definition pathlib.qh:34
const float pathlib_node_edgeflag_none
Definition pathlib.qh:39
float tile_check_plus2(entity this, vector where)
Definition utility.qc:112

References entity(), LOG_TRACE, pathlib_gridsize, pathlib_makenode(), pathlib_movecost, pathlib_movecost_diag, pathlib_node_edgeflag_back, pathlib_node_edgeflag_backleft, pathlib_node_edgeflag_backright, pathlib_node_edgeflag_forward, pathlib_node_edgeflag_forwardleft, pathlib_node_edgeflag_forwardright, pathlib_node_edgeflag_left, pathlib_node_edgeflag_none, pathlib_node_edgeflag_right, pathlib_node_edgeflag_unknown, pathlib_open_cnt, PLIB_FORWARD, PLIB_RIGHT, tile_check_plus2(), vector, and vtos().

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ pathlib_flynode()

vector pathlib_flynode ( entity this,
vector start,
vector end,
float doedge )

Definition at line 65 of file movenode.qc.

66{
68
69 end.x = fsnap(end.x, pathlib_gridsize);
70 end.y = fsnap(end.y, pathlib_gridsize);
71
72 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, this);
73 if(trace_fraction == 1)
75
76 return end;
77}
float MOVE_WORLDONLY
float trace_fraction
ERASEABLE float fsnap(float val, float fsize)
Definition math.qh:54
bool pathlib_movenode_goodnode
Definition pathlib.qh:75
vector movenode_boxmin
Definition pathlib.qh:74
vector movenode_boxmax
Definition pathlib.qh:73

References entity(), fsnap(), MOVE_WORLDONLY, movenode_boxmax, movenode_boxmin, pathlib_gridsize, pathlib_movenode_goodnode, trace_fraction, and vector.

◆ pathlib_g_euclidean()

float pathlib_g_euclidean ( entity parent,
vector to,
float static_cost )

Definition at line 16 of file costs.qc.

17{
18 return parent.pathlib_node_g + vlen(parent.origin - to);
19}
entity parent
Definition animhost.qc:7
float vlen(vector v)

References entity(), parent, vector, and vlen().

◆ pathlib_g_euclidean_water()

float pathlib_g_euclidean_water ( entity parent,
vector to,
float static_cost )

Definition at line 21 of file costs.qc.

22{
23 if(inwater(to))
24 return parent.pathlib_node_g + vlen(parent.origin - to) * pathlib_movecost_waterfactor;
25 else
26 return parent.pathlib_node_g + vlen(parent.origin - to);
27}
#define inwater(point)
Definition pathlib.qh:11
float pathlib_movecost_waterfactor
Definition pathlib.qh:53

References entity(), inwater, parent, pathlib_movecost_waterfactor, vector, and vlen().

Referenced by pathlib_astar().

◆ pathlib_g_static()

float pathlib_g_static ( entity parent,
vector to,
float static_cost )

Definition at line 3 of file costs.qc.

4{
5 return parent.pathlib_node_g + static_cost;
6}

References entity(), parent, and vector.

◆ pathlib_g_static_water()

float pathlib_g_static_water ( entity parent,
vector to,
float static_cost )

Definition at line 8 of file costs.qc.

9{
10 if(inwater(to))
11 return parent.pathlib_node_g + static_cost * pathlib_movecost_waterfactor;
12 else
13 return parent.pathlib_node_g + static_cost;
14}

References entity(), inwater, parent, pathlib_movecost_waterfactor, and vector.

◆ pathlib_h_diagonal()

float pathlib_h_diagonal ( vector a,
vector b )

This heuristic consider both straight and diagonal moves to have the same cost.

Definition at line 49 of file costs.qc.

50{
51 //h(n) = D * max(abs(n.x-goal.x), abs(n.y-goal.y))
52
53 float hx = fabs(a.x - b.x);
54 float hy = fabs(a.y - b.y);
55 float h = pathlib_movecost * max(hx, hy);
56
57 return h;
58}
float fabs(float f)
float max(float f,...)

References fabs(), max(), pathlib_movecost, and vector.

Referenced by pathlib_astar().

◆ pathlib_h_diagonal2()

float pathlib_h_diagonal2 ( vector a,
vector b )

This heuristic consider both straight and diagonal moves, but has a separate cost for diagonal moves.

Definition at line 74 of file costs.qc.

75{
76 /*
77 h_diagonal(n) = min(abs(n.x-goal.x), abs(n.y-goal.y))
78 h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y))
79 h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
80 */
81
82 float hx = fabs(a.x - b.x);
83 float hy = fabs(a.y - b.y);
84
85 float h_diag = min(hx,hy);
86 float h_str = hx + hy;
87
88 float h = pathlib_movecost_diag * h_diag;
89 h += pathlib_movecost * (h_str - 2 * h_diag);
90
91 return h;
92}
float min(float f,...)

References fabs(), min(), pathlib_movecost, pathlib_movecost_diag, and vector.

◆ pathlib_h_diagonal2sdp()

float pathlib_h_diagonal2sdp ( vector preprev,
vector prev,
vector point,
vector end )

This heuristic consider both straight and diagonal moves, But has a separate cost for diagonal moves.

Definition at line 98 of file costs.qc.

99{
100 //h_diagonal(n) = min(abs(n.x-goal.x), abs(n.y-goal.y))
101 //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y))
102 //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
103
104 float hx = fabs(point.x - end.x);
105 float hy = fabs(point.y - end.y);
106 float hz = fabs(point.z - end.z);
107
108 float h_diag = min3(hx,hy,hz);
109 float h_str = hx + hy + hz;
110
111 float h = pathlib_movecost_diag * h_diag;
112 h += pathlib_movecost * (h_str - 2 * h_diag);
113
114 vector d1 = normalize(preprev - point);
115 vector d2 = normalize(prev - point);
116 float m = vlen(d1 - d2);
117
118 return h * m;
119}
prev
Definition all.qh:71
vector normalize(vector v)

References fabs(), normalize(), pathlib_movecost, pathlib_movecost_diag, prev, vector, and vlen().

◆ pathlib_h_diagonal3()

float pathlib_h_diagonal3 ( vector a,
vector b )

Definition at line 122 of file costs.qc.

123{
124 float hx = fabs(a.x - b.x);
125 float hy = fabs(a.y - b.y);
126 float hz = fabs(a.z - b.z);
127
128 float h_diag = min3(hx,hy,hz);
129 float h_str = hx + hy + hz;
130
131 float h = pathlib_movecost_diag * h_diag;
132 h += pathlib_movecost * (h_str - 2 * h_diag);
133
134 return h;
135}

References fabs(), pathlib_movecost, pathlib_movecost_diag, and vector.

◆ pathlib_h_euclidean()

float pathlib_h_euclidean ( vector a,
vector b )

This heuristic only considers the straight line distance.

Usually means a lower H then G, resulting in A* spreading more (and running slower).

Definition at line 65 of file costs.qc.

66{
67 return vlen(a - b);
68}

References vector, and vlen().

◆ pathlib_h_manhattan()

float pathlib_h_manhattan ( vector a,
vector b )

Manhattan heuristic means we expect to move up, down left or right No diagonal moves expected.

(like moving between city blocks)

Definition at line 34 of file costs.qc.

35{
36 //h(n) = D * (abs(n.x-goal.x) + abs(n.y-goal.y))
37
38 float h = fabs(a.x - b.x);
39 h += fabs(a.y - b.y);
41
42 return h;
43}

References fabs(), pathlib_gridsize, and vector.

◆ pathlib_h_none()

float pathlib_h_none ( vector preprev,
vector prev )

Definition at line 101 of file pathlib.qh.

101{ return 0; }

References prev, and vector.

Referenced by pathlib_waypointpath().

◆ pathlib_heuristic()

◆ pathlib_makenode()

var bool pathlib_makenode ( entity parent,
vector start,
vector to,
vector goal,
float cost )

◆ pathlib_movenode()

var vector pathlib_movenode ( entity this,
vector start,
vector end,
float doedge )

References entity(), and vector.

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ pathlib_swimnode()

vector pathlib_swimnode ( entity this,
vector start,
vector end,
float doedge )

Definition at line 45 of file movenode.qc.

46{
48
49 if(pointcontents(start) != CONTENT_WATER)
50 return end;
51
52 end.x = fsnap(end.x, pathlib_gridsize);
53 end.y = fsnap(end.y, pathlib_gridsize);
54
55 if(pointcontents(end) == CONTENT_EMPTY)
56 return pathlib_wateroutnode(this, start, end, doedge);
57
58 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, this);
59 if(trace_fraction == 1)
61
62 return end;
63}
const float CONTENT_EMPTY
vector pathlib_wateroutnode(entity this, vector start, vector end, float doedge)
Definition movenode.qc:11

References CONTENT_EMPTY, CONTENT_WATER, entity(), fsnap(), MOVE_WORLDONLY, movenode_boxmax, movenode_boxmin, pathlib_gridsize, pathlib_movenode_goodnode, pathlib_wateroutnode(), trace_fraction, and vector.

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ pathlib_walknode()

vector pathlib_walknode ( entity this,
vector start,
vector end,
float doedge )

Definition at line 88 of file movenode.qc.

89{
90 vector point;
91
92 LOG_DEBUG("Walking node from ", vtos(start), " to ", vtos(end));
93
95
96 end.x = fsnap(end.x,pathlib_gridsize);
97 end.y = fsnap(end.y,pathlib_gridsize);
98 start.x = fsnap(start.x,pathlib_gridsize);
99 start.y = fsnap(start.y,pathlib_gridsize);
100
101 // Find the floor
102 traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, this);
103 if(trace_fraction == 1.0)
104 {
105 entity a;
106 a = spawn();
107 setthink(a, a_think);
108 a.nextthink = time;
109 setorigin(a, start + movenode_stepup);
110 a.pos1 = trace_endpos;
111 //start - movenode_maxdrop
112 a.cnt = time + 10;
113
114 LOG_TRACE("I cant walk on air!");
115 return trace_endpos;
116 }
117
118 start = trace_endpos;
119
120 // Find the direcion, without Z
121 vector s = start;
122 vector e = end;
123 //e_z = 0; s_z = 0;
124 vector direction = normalize(e - s);
125
126 float distance = vlen(start - end);
127 int steps = rint(distance / movenode_stepsize);
128
129 vector last_point = start;
130 for(int i = 1; i < steps; ++i)
131 {
132 point = last_point + (direction * movenode_stepsize);
133 traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,this);
134 if(trace_fraction == 1.0)
135 return trace_endpos;
136
137 last_point = trace_endpos;
138 }
139
140 point = last_point + (direction * movenode_stepsize);
141 point.x = fsnap(point.x,pathlib_gridsize);
142 point.y = fsnap(point.y,pathlib_gridsize);
143
144 //dprint("end_x: ",ftos(end_x), " end_y: ",ftos(end_y),"\n");
145 //dprint("point_x:",ftos(point_x)," point_y:",ftos(point_y),"\n\n");
146
147 traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,this);
148 if(trace_fraction == 1.0)
149 return trace_endpos;
150
151 last_point = trace_endpos;
152
153 tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, this);
154 if(trace_fraction != 1.0)
155 return trace_endpos;
156
158 return last_point;
159}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float time
vector trace_endpos
#define spawn
#define LOG_DEBUG(...)
Definition log.qh:80
float rint(float f)
void a_think(entity this)
Definition movenode.qc:79
vector movenode_boxup
Definition pathlib.qh:72
vector movenode_maxdrop
Definition pathlib.qh:71
vector movenode_stepup
Definition pathlib.qh:70
float movenode_stepsize
Definition pathlib.qh:69
#define setthink(e, f)

References a_think(), entity(), fsnap(), LOG_DEBUG, LOG_TRACE, MOVE_WORLDONLY, movenode_boxmax, movenode_boxmin, movenode_boxup, movenode_maxdrop, movenode_stepsize, movenode_stepup, normalize(), pathlib_gridsize, pathlib_movenode_goodnode, rint(), setthink, spawn, time, trace_endpos, trace_fraction, vector, vlen(), and vtos().

Referenced by buildpath_nodefilter_moveskip(), pathlib_astar(), pathlib_close_node(), and pathlib_makenode_adaptive().

◆ pathlib_wateroutnode()

vector pathlib_wateroutnode ( entity this,
vector start,
vector end,
float doedge )

Definition at line 11 of file movenode.qc.

12{
13 vector surface;
14
16
17 end.x = fsnap(end.x, pathlib_gridsize);
18 end.y = fsnap(end.y, pathlib_gridsize);
19
20 traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,this);
21 end = trace_endpos;
22
23 if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID))
24 return end;
25
26 for(surface = start ; surface.z < (end.z + 32); ++surface.z)
27 {
28 if(pointcontents(surface) == CONTENT_EMPTY)
29 break;
30 }
31
32 if(pointcontents(surface + '0 0 1') != CONTENT_EMPTY)
33 return end;
34
35 tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, this);
36 if(trace_fraction == 1)
38
39 if(fabs(surface.z - end.z) > 32)
41
42 return end;
43}
const float CONTENT_SOLID

References CONTENT_EMPTY, CONTENT_SOLID, entity(), fabs(), fsnap(), MOVE_WORLDONLY, movenode_boxmax, movenode_boxmin, pathlib_gridsize, pathlib_movenode_goodnode, trace_endpos, trace_fraction, and vector.

Referenced by pathlib_swimnode().

◆ pathlib_wpp_waypointcallback()

var float pathlib_wpp_waypointcallback ( entity wp,
entity wp_prev )

References entity().

Referenced by pathlib_waypointpath(), and pathlib_wpp_opencb().

◆ STATIC_INIT()

STATIC_INIT ( g_pathlib_nodes )

Definition at line 110 of file pathlib.qh.

110{ g_pathlib_nodes = IL_NEW(); }
#define IL_NEW()
IntrusiveList g_pathlib_nodes
Definition pathlib.qh:109

References g_pathlib_nodes, and IL_NEW.

◆ tile_check()

var bool tile_check ( entity this,
vector where )

References entity(), and vector.

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ tile_check_cross()

bool tile_check_cross ( entity this,
vector where )

Definition at line 43 of file utility.qc.

44{
45 vector p;
48
49
50 // forward-right
51 p = where + f + r;
52 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
53 if (!location_isok(trace_endpos, 1, 0))
54 return false;
55
56 // Forward-left
57 p = where + f - r;
58 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
59 if (!location_isok(trace_endpos, 1, 0))
60 return false;
61
62 // Back-right
63 p = where - f + r;
64 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
65 if (!location_isok(trace_endpos, 1 ,0))
66 return false;
67
68 //Back-left
69 p = where - f - r;
70 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
71 if (!location_isok(trace_endpos, 1, 0))
72 return false;
73
74 return true;
75}
vector tile_check_up
Definition pathlib.qh:61
float tile_check_size
Definition pathlib.qh:63
vector tile_check_down
Definition pathlib.qh:62
bool location_isok(vector point, bool waterok, bool air_isok)
Definition utility.qc:7

References entity(), location_isok(), MOVE_WORLDONLY, PLIB_FORWARD, PLIB_RIGHT, tile_check_down, tile_check_size, tile_check_up, trace_endpos, and vector.

Referenced by pathlib_astar(), and tile_check_star().

◆ tile_check_plus()

bool tile_check_plus ( entity this,
vector where )

Definition at line 77 of file utility.qc.

78{
79 vector p;
80
83
84 // forward
85 p = where + f;
88 return false;
89
90
91 //left
92 p = where - r;
95 return false;
96
97 // Right
98 p = where + r;
100 if (!location_isok(trace_endpos,1,0))
101 return false;
102
103 //Back
104 p = where - f;
105 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
106 if (!location_isok(trace_endpos,1,0))
107 return false;
108
109 return true;
110}

References entity(), location_isok(), MOVE_WORLDONLY, PLIB_FORWARD, PLIB_RIGHT, tile_check_down, tile_check_size, tile_check_up, trace_endpos, and vector.

Referenced by tile_check_star().

◆ tile_check_star()

bool tile_check_star ( entity this,
vector where )

Definition at line 206 of file utility.qc.

207{
208 if(tile_check_plus(this, where))
209 return tile_check_cross(this, where);
210
211 return false;
212}
bool tile_check_cross(entity this, vector where)
Definition utility.qc:43
bool tile_check_plus(entity this, vector where)
Definition utility.qc:77

References entity(), tile_check_cross(), tile_check_plus(), and vector.

Variable Documentation

◆ best_open_node

◆ closedlist

◆ g_pathlib_nodes

IntrusiveList g_pathlib_nodes

◆ goal_node

◆ is_path_node

bool is_path_node

Definition at line 24 of file pathlib.qh.

◆ movenode_boxmax

vector movenode_boxmax

◆ movenode_boxmin

vector movenode_boxmin

◆ movenode_boxup

vector movenode_boxup

Definition at line 72 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_walknode().

◆ movenode_maxdrop

vector movenode_maxdrop

Definition at line 71 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_walknode().

◆ movenode_stepsize

float movenode_stepsize

Definition at line 69 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_walknode().

◆ movenode_stepup

vector movenode_stepup

Definition at line 70 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_walknode().

◆ openlist

◆ path_next

entity path_next

Definition at line 8 of file pathlib.qh.

◆ path_prev

entity path_prev

Definition at line 9 of file pathlib.qh.

◆ pathlib_bestcash_hits

float pathlib_bestcash_hits

Definition at line 48 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_getbestopen().

◆ pathlib_bestcash_saved

float pathlib_bestcash_saved

Definition at line 49 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_getbestopen().

◆ pathlib_bestopen_searched

float pathlib_bestopen_searched

Definition at line 47 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_getbestopen().

◆ pathlib_closed_cnt

float pathlib_closed_cnt

◆ pathlib_foundgoal

◆ pathlib_gridsize

◆ pathlib_list

entity pathlib_list

Definition at line 7 of file pathlib.qh.

Referenced by pathlib_wpp_bestopen().

◆ pathlib_made_cnt

float pathlib_made_cnt

Definition at line 44 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_mknode().

◆ pathlib_maxtime

const float pathlib_maxtime = 60

Definition at line 57 of file pathlib.qh.

Referenced by pathlib_astar().

◆ pathlib_merge_cnt

float pathlib_merge_cnt

Definition at line 45 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_makenode_adaptive().

◆ pathlib_movecost

◆ pathlib_movecost_diag

◆ pathlib_movecost_waterfactor

float pathlib_movecost_waterfactor

Definition at line 53 of file pathlib.qh.

Referenced by pathlib_astar(), pathlib_g_euclidean_water(), and pathlib_g_static_water().

◆ pathlib_movenode_goodnode

◆ pathlib_node_c

float pathlib_node_c

Definition at line 28 of file pathlib.qh.

◆ pathlib_node_edgeflag_back

const float pathlib_node_edgeflag_back = BIT(4)

Definition at line 34 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_backleft

const float pathlib_node_edgeflag_backleft = BIT(5)

Definition at line 35 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_backright

const float pathlib_node_edgeflag_backright = BIT(6)

Definition at line 36 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_forward

const float pathlib_node_edgeflag_forward = BIT(3)

Definition at line 33 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_forwardleft

const float pathlib_node_edgeflag_forwardleft = BIT(7)

Definition at line 37 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_forwardright

const float pathlib_node_edgeflag_forwardright = BIT(8)

Definition at line 38 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_left

const float pathlib_node_edgeflag_left = BIT(1)

Definition at line 31 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_none

const float pathlib_node_edgeflag_none = BIT(9)

Definition at line 39 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_right

const float pathlib_node_edgeflag_right = BIT(2)

Definition at line 32 of file pathlib.qh.

Referenced by pathlib_expandnode_star(), and tile_check_plus2().

◆ pathlib_node_edgeflag_unknown

const float pathlib_node_edgeflag_unknown = 0

Definition at line 30 of file pathlib.qh.

Referenced by pathlib_expandnode_star().

◆ pathlib_node_edgeflags

float pathlib_node_edgeflags

Definition at line 40 of file pathlib.qh.

◆ pathlib_node_f

float pathlib_node_f

Definition at line 27 of file pathlib.qh.

◆ pathlib_node_g

float pathlib_node_g

Definition at line 25 of file pathlib.qh.

◆ pathlib_node_h

float pathlib_node_h

Definition at line 26 of file pathlib.qh.

◆ pathlib_open_cnt

◆ pathlib_searched_cnt

float pathlib_searched_cnt

◆ pathlib_starttime

float pathlib_starttime

Definition at line 56 of file pathlib.qh.

Referenced by pathlib_astar(), and pathlib_waypointpath().

◆ PLIB_FORWARD

const vector PLIB_FORWARD = '0 1 0'

◆ PLIB_RIGHT

const vector PLIB_RIGHT = '1 0 0'

◆ start_node

entity start_node

Definition at line 22 of file pathlib.qh.

Referenced by pathlib_waypointpath(), and pathlib_waypointpath_step().

◆ tile_check_down

vector tile_check_down

Definition at line 62 of file pathlib.qh.

Referenced by pathlib_astar(), tile_check_cross(), tile_check_plus(), and tile_check_plus2().

◆ tile_check_size

float tile_check_size

Definition at line 63 of file pathlib.qh.

Referenced by pathlib_astar(), tile_check_cross(), and tile_check_plus().

◆ tile_check_up

vector tile_check_up

Definition at line 61 of file pathlib.qh.

Referenced by pathlib_astar(), tile_check_cross(), tile_check_plus(), and tile_check_plus2().