]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/bot/default/waypoints.qh
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 const float WAYPOINT_VERSION = 1.04;
10 float waypoint_version_loaded;
11 string waypoint_time;
12
13 // fields you can query using prvm_global server to get some statistics about waypoint linking culling
14 float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled;
15
16 float botframe_waypointeditorlightningtime;
17 float botframe_loadedforcedlinks;
18 float botframe_cachedwaypointlinks;
19
20 // waypoint wp links to waypoint wp.wpXX (OUTGOING link)
21 // links are sorted by their cost (wpXXmincost)
22 .entity wp00, wp01, wp02, wp03, wp04, wp05, wp06, wp07, wp08, wp09, wp10, wp11, wp12, wp13, wp14, wp15;
23 .entity wp16, wp17, wp18, wp19, wp20, wp21, wp22, wp23, wp24, wp25, wp26, wp27, wp28, wp29, wp30, wp31;
24
25 // used by jumppads to store original destination wp, used in case it gets changed in the editor
26 .entity wp00_original;
27
28 .float wp00mincost, wp01mincost, wp02mincost, wp03mincost, wp04mincost, wp05mincost, wp06mincost, wp07mincost;
29 .float wp08mincost, wp09mincost, wp10mincost, wp11mincost, wp12mincost, wp13mincost, wp14mincost, wp15mincost;
30 .float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
31 .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
32
33 // hardwired links are saved to the .wpXX fields among normal links
34 // AND to the supporting .wphwXX fields to allow identifying them precisely
35 // these links are not sorted, unlike normal links
36 .entity wphw00, wphw01, wphw02, wphw03, wphw04, wphw05, wphw06, wphw07;
37
38 .float wpcost;
39 .int wpfire, wpconsidered, wpisbox, wplinked;
40 .int wpflags;
41 .entity wp_aimed;
42 .entity wp_locked;
43
44 .vector wpnearestpoint;
45
46 // holds reference to the support waypoint, if any
47 .entity goalentity;
48 #define SUPPORT_WP goalentity
49
50 /*
51  * Functions
52  */
53
54 spawnfunc(waypoint);
55
56 bool waypoint_has_hardwiredlinks(entity wp);
57 bool waypoint_is_hardwiredlink(entity wp_from, entity wp_to);
58 void waypoint_mark_hardwiredlink(entity wp_from, entity wp_to);
59 void waypoint_unmark_hardwiredlink(entity wp_from, entity wp_to);
60
61 void waypoint_removelink(entity from, entity to);
62 int waypoint_getlinknum(entity from, entity to);
63 bool waypoint_islinked(entity from, entity to);
64 void waypoint_addlink_customcost(entity from, entity to, float c);
65 void waypoint_addlink(entity from, entity to);
66 void waypoint_think(entity this);
67 void waypoint_clearlinks(entity wp);
68 void waypoint_schedulerelink(entity wp);
69
70 float waypoint_getlinkcost(entity from, entity to);
71 float waypoint_gettravelcost(vector from, vector to, entity from_ent, entity to_ent);
72 float waypoint_getlinearcost(float dist);
73 void waypoint_updatecost_foralllinks();
74
75 void waypoint_remove_fromeditor(entity pl);
76 void waypoint_remove(entity wp);
77 void waypoint_schedulerelinkall();
78 void waypoint_save_links();
79 void waypoint_saveall();
80
81 void waypoint_spawnforitem_force(entity e, vector org);
82 void waypoint_spawnforitem(entity e);
83 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
84 void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent);
85 void botframe_showwaypointlinks();
86
87 float waypoint_loadall();
88 bool waypoint_load_links();
89 void waypoint_load_hardwiredlinks();
90
91 void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bool is_crouch_wp, bool is_support_wp);
92 entity waypoint_spawn(vector m1, vector m2, float f);
93 entity waypoint_spawnpersonal(entity this, vector position);
94
95 void waypoint_unreachable(entity pl);
96
97 vector waypoint_fixorigin_down_dir(vector position, entity tracetest_ent, vector down_dir);
98
99 void botframe_autowaypoints();