Merge branch 'master' into terencehill/bot_waypoints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / waypoints.qh
1 #pragma once
2 /*
3  * Globals and Fields
4  */
5
6 // increase by 0.01 when changes require only waypoint relinking
7 // increase by 1 when changes require to manually edit waypoints
8 // max 2 decimal places, always specified
9 #define WAYPOINT_VERSION 1.00
10
11 // fields you can query using prvm_global server to get some statistics about waypoint linking culling
12 float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled;
13
14 float botframe_waypointeditorlightningtime;
15 float botframe_loadedforcedlinks;
16 float botframe_cachedwaypointlinks;
17
18 // waypoint wp links to waypoint wp.wpXX (OUTGOING link)
19 // links are sorted by their cost (wpXXmincost)
20 .entity wp00, wp01, wp02, wp03, wp04, wp05, wp06, wp07, wp08, wp09, wp10, wp11, wp12, wp13, wp14, wp15;
21 .entity wp16, wp17, wp18, wp19, wp20, wp21, wp22, wp23, wp24, wp25, wp26, wp27, wp28, wp29, wp30, wp31;
22
23 .float wp00mincost, wp01mincost, wp02mincost, wp03mincost, wp04mincost, wp05mincost, wp06mincost, wp07mincost;
24 .float wp08mincost, wp09mincost, wp10mincost, wp11mincost, wp12mincost, wp13mincost, wp14mincost, wp15mincost;
25 .float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
26 .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
27
28 .float wpfire, wpcost, wpconsidered, wpisbox, wplinked, wphardwired;
29 .int wpflags;
30
31 .vector wpnearestpoint;
32
33 /*
34  * Functions
35  */
36
37 spawnfunc(waypoint);
38 void waypoint_removelink(entity from, entity to);
39 bool waypoint_islinked(entity from, entity to);
40 void waypoint_addlink_customcost(entity from, entity to, float c);
41 void waypoint_addlink(entity from, entity to);
42 void waypoint_think(entity this);
43 void waypoint_clearlinks(entity wp);
44 void waypoint_schedulerelink(entity wp);
45
46 float waypoint_getlinkcost(entity from, entity to);
47 float waypoint_gettravelcost(vector from, vector to, entity from_ent, entity to_ent);
48 float waypoint_getlinearcost(float dist);
49 void waypoint_updatecost_foralllinks();
50
51 void waypoint_remove_fromeditor(entity pl);
52 void waypoint_remove(entity wp);
53 void waypoint_schedulerelinkall();
54 void waypoint_save_links();
55 void waypoint_saveall();
56
57 void waypoint_spawnforitem_force(entity e, vector org);
58 void waypoint_spawnforitem(entity e);
59 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
60 void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent);
61 void botframe_showwaypointlinks();
62
63 float waypoint_loadall();
64 bool waypoint_load_links();
65 #define waypoint_load_links_hardwired() waypoint_load_or_remove_links_hardwired(false)
66 #define waypoint_remove_links_hardwired() waypoint_load_or_remove_links_hardwired(true)
67 void waypoint_load_or_remove_links_hardwired(bool removal_mode);
68
69 void waypoint_spawn_fromeditor(entity pl);
70 entity waypoint_spawn(vector m1, vector m2, float f);
71 entity waypoint_spawnpersonal(entity this, vector position);
72
73 void waypoint_unreachable(entity pl);
74
75 vector waypoint_fixorigin_down_dir(vector position, entity tracetest_ent, vector down_dir);
76
77 void botframe_autowaypoints();