]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/pathlib/debug.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / pathlib / debug.qc
1 #include "debug.qh"
2
3 #if DEBUGPATHING
4
5 MODEL(SQUARE,       "models/pathlib/square.md3");
6 MODEL(SQUARE_GOOD,  "models/pathlib/goodsquare.md3");
7 MODEL(SQUARE_BAD,   "models/pathlib/badsquare.md3");
8 MODEL(EDGE,         "models/pathlib/edge.md3");
9
10 #ifdef TURRET_DEBUG
11 void mark_error(vector where, float lifetime);
12 void mark_info(vector where, float lifetime);
13 entity mark_misc(vector where, float lifetime);
14 #endif
15
16 void pathlib_showpath(entity start)
17 {
18         entity e;
19         e = start;
20         while (e.path_next) {
21                 te_lightning1(e, e.origin, e.path_next.origin);
22                 e = e.path_next;
23         }
24 }
25
26 void path_dbg_think(entity this)
27 {
28         pathlib_showpath(this);
29         this.nextthink = time + 1;
30 }
31
32 void __showpath2_think(entity this)
33 {
34 #ifdef TURRET_DEBUG
35         mark_info(this.origin, 1);
36 #endif
37         if (this.path_next) {
38                 setthink(this.path_next, __showpath2_think);
39                 this.path_next.nextthink = time + 0.15;
40         } else {
41                 setthink(this.owner, __showpath2_think);
42                 this.owner.nextthink = time + 0.15;
43         }
44 }
45
46 void pathlib_showpath2(entity path)
47 {
48         setthink(path, __showpath2_think);
49         path.nextthink = time;
50 }
51
52 void pathlib_showsquare2(entity node, vector ncolor, float align)
53 {
54         node.alpha     = 0.25;
55         node.scale     = pathlib_gridsize / 512.001;
56         node.solid     = SOLID_NOT;
57
58         setmodel(node, MDL_SQUARE);
59         setorigin(node, node.origin);
60         node.colormod = ncolor;
61
62         if (align) {
63                 traceline(node.origin + '0 0 32', node.origin - '0 0 128', MOVE_WORLDONLY, node);
64                 node.angles = vectoangles(trace_plane_normal);
65                 node.angles_x -= 90;
66         }
67 }
68
69 void pathlib_showsquare(vector where, float goodsquare, float _lifetime)
70 {
71         entity s;
72
73         if (!_lifetime) {
74                 _lifetime = time + 30;
75         } else {
76                 _lifetime += time;
77         }
78
79         s           = spawn();
80         s.alpha     = 0.25;
81         setthink(s, SUB_Remove);
82         s.nextthink = _lifetime;
83         s.scale     = pathlib_gridsize / 512.001;
84         s.solid     = SOLID_NOT;
85
86         setmodel(s, goodsquare ? MDL_SQUARE_GOOD : MDL_SQUARE_BAD);
87
88         traceline(where + '0 0 32', where - '0 0 128', MOVE_WORLDONLY, s);
89
90         s.angles = vectoangles(trace_plane_normal);
91         s.angles_x -= 90;
92         setorigin(s, where);
93 }
94
95 void pathlib_showedge(vector where, float _lifetime, float rot)
96 {
97         entity e;
98
99         if (!_lifetime) {
100                 _lifetime = time + 30;
101         } else {
102                 _lifetime += time;
103         }
104
105         e           = spawn();
106         e.alpha     = 0.25;
107         setthink(e, SUB_Remove);
108         e.nextthink = _lifetime;
109         e.scale     = pathlib_gridsize / 512;
110         e.solid     = SOLID_NOT;
111         setorigin(e, where);
112         setmodel(e, MDL_EDGE);
113         // traceline(where + '0 0 32',where - '0 0 128',MOVE_WORLDONLY,e);
114         // e.angles = vectoangles(trace_plane_normal);
115         e.angles_y = rot;
116         // e.angles_x += 90;
117 }
118
119 #endif