Xonotic
pathlib.qh
Go to the documentation of this file.
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 
20 
23 
29 
41 
55 
57 const float pathlib_maxtime = 60;
58 
60 
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 
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_starf(entity node, vector start, vector goal);
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 
96 float pathlib_h_diagonal(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 bool pathlib_makenode(entity parent,vector start, vector to, vector goal,float cost);
105 var bool buildpath_nodefilter(vector n,vector c,vector p);
106 
107 var float pathlib_wpp_waypointcallback(entity wp, entity wp_prev);
108 
110 STATIC_INIT(g_pathlib_nodes) { g_pathlib_nodes = IL_NEW(); }
entity closedlist
Definition: pathlib.qh:19
float pathlib_g_static_water(entity parent, vector to, float static_cost)
Definition: costs.qc:8
vector pathlib_wateroutnode(entity this, vector start, vector end, float doedge)
Definition: movenode.qc:11
var float pathlib_cost(entity parent, vector to, float static_cost)
entity start_node
Definition: pathlib.qh:22
IntrusiveList g_pathlib_nodes
Definition: pathlib.qh:109
float pathlib_g_euclidean_water(entity parent, vector to, float static_cost)
Definition: costs.qc:21
float pathlib_h_diagonal3(vector a, vector b)
Definition: costs.qc:122
bool tile_check_cross(entity this, vector where)
Definition: utility.qc:43
float pathlib_expandnode_box(entity node, vector start, vector goal)
Definition: expandnode.qc:224
vector pathlib_walknode(entity this, vector start, vector end, float doedge)
Definition: movenode.qc:88
#define IL_NEW()
entity parent
Definition: animhost.qc:7
float pathlib_node_h
Definition: pathlib.qh:26
entity() spawn
prev
Definition: all.qh:66
float pathlib_foundgoal
Definition: pathlib.qh:54
vector movenode_maxdrop
Definition: pathlib.qh:71
float pathlib_expandnode_star(entity node, vector start, vector goal)
Definition: expandnode.qc:96
float pathlib_h_manhattan(vector a, vector b)
Manhattan heuristic means we expect to move up, down left or right No diagonal moves expected...
Definition: costs.qc:34
float pathlib_h_euclidean(vector a, vector b)
This heuristic only considers the straight line distance.
Definition: costs.qc:65
const float pathlib_node_edgeflag_backright
Definition: pathlib.qh:36
entity to
Definition: self.qh:96
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
entity path_next
Definition: pathlib.qh:8
float pathlib_closed_cnt
Definition: pathlib.qh:43
float pathlib_node_g
Definition: pathlib.qh:25
vector tile_check_down
Definition: pathlib.qh:62
var vector pathlib_movenode(entity this, vector start, vector end, float doedge)
const float pathlib_maxtime
Definition: pathlib.qh:57
vector movenode_boxup
Definition: pathlib.qh:72
entity path_prev
Definition: pathlib.qh:9
entity pathlib_list
Definition: pathlib.qh:7
var float pathlib_expandnode(entity node, vector start, vector goal)
float pathlib_bestcash_saved
Definition: pathlib.qh:49
float pathlib_starttime
Definition: pathlib.qh:56
float pathlib_node_c
Definition: pathlib.qh:28
const float pathlib_node_edgeflag_forwardleft
Definition: pathlib.qh:37
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
float pathlib_bestopen_searched
Definition: pathlib.qh:47
float pathlib_searched_cnt
Definition: pathlib.qh:46
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: costs.qc:74
vector pathlib_swimnode(entity this, vector start, vector end, float doedge)
Definition: movenode.qc:45
vector tile_check_up
Definition: pathlib.qh:61
const vector PLIB_FORWARD
Definition: pathlib.qh:13
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: costs.qc:98
const float pathlib_node_edgeflag_left
Definition: pathlib.qh:31
float pathlib_movecost
Definition: pathlib.qh:51
float pathlib_g_static(entity parent, vector to, float static_cost)
Definition: costs.qc:3
float pathlib_movecost_waterfactor
Definition: pathlib.qh:53
float pathlib_gridsize
Definition: pathlib.qh:50
bool tile_check_star(entity this, vector where)
Definition: utility.qc:206
float pathlib_open_cnt
Definition: pathlib.qh:42
var float pathlib_wpp_waypointcallback(entity wp, entity wp_prev)
vector pathlib_flynode(entity this, vector start, vector end, float doedge)
Definition: movenode.qc:65
var bool pathlib_makenode(entity parent, vector start, vector to, vector goal, float cost)
var bool buildpath_nodefilter(vector n, vector c, vector p)
float movenode_stepsize
Definition: pathlib.qh:69
const float pathlib_node_edgeflag_back
Definition: pathlib.qh:34
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float pathlib_merge_cnt
Definition: pathlib.qh:45
vector movenode_boxmin
Definition: pathlib.qh:74
vector movenode_stepup
Definition: pathlib.qh:70
float pathlib_bestcash_hits
Definition: pathlib.qh:48
const float pathlib_node_edgeflag_backleft
Definition: pathlib.qh:35
bool tile_check_plus(entity this, vector where)
Definition: utility.qc:77
STATIC_INIT(g_pathlib_nodes)
Definition: pathlib.qh:110
const float pathlib_node_edgeflag_none
Definition: pathlib.qh:39
const vector PLIB_RIGHT
Definition: pathlib.qh:15
bool pathlib_movenode_goodnode
Definition: pathlib.qh:75
float pathlib_movecost_diag
Definition: pathlib.qh:52
float tile_check_size
Definition: pathlib.qh:63
const float pathlib_node_edgeflag_forward
Definition: pathlib.qh:33
vector movenode_boxmax
Definition: pathlib.qh:73
float pathlib_g_euclidean(entity parent, vector to, float static_cost)
Definition: costs.qc:16
float pathlib_h_none(vector preprev, vector prev)
Definition: pathlib.qh:101
entity goal_node
Definition: pathlib.qh:21
var bool tile_check(entity this, vector where)
entity openlist
Definition: pathlib.qh:18
float pathlib_made_cnt
Definition: pathlib.qh:44
const float pathlib_node_edgeflag_right
Definition: pathlib.qh:32
entity best_open_node
Definition: pathlib.qh:59
const float pathlib_node_edgeflag_forwardright
Definition: pathlib.qh:38
float pathlib_node_edgeflags
Definition: pathlib.qh:40
const float pathlib_node_edgeflag_unknown
Definition: pathlib.qh:30
bool is_path_node
Definition: pathlib.qh:24
float pathlib_h_diagonal(vector a, vector b)
This heuristic consider both straight and diagonal moves to have the same cost.
Definition: costs.qc:49
var float pathlib_heuristic(vector from, vector to)
float pathlib_node_f
Definition: pathlib.qh:27