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