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