Xonotic
debug.qc
Go to the documentation of this file.
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 #include <common/turrets/util.qh>
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(entity this)
26 {
27  pathlib_showpath(this);
28  this.nextthink = time + 1;
29 }
30 
31 void __showpath2_think(entity this)
32 {
33  #ifdef TURRET_DEBUG
34  mark_info(this.origin,1);
35  #endif
36  if(this.path_next)
37  {
38  setthink(this.path_next, __showpath2_think);
39  this.path_next.nextthink = time + 0.15;
40  }
41  else
42  {
43  setthink(this.owner, __showpath2_think);
44  this.owner.nextthink = time + 0.15;
45  }
46 }
47 
48 void pathlib_showpath2(entity path)
49 {
50  setthink(path, __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 pathlib_showsquare(vector where,float goodsquare,float _lifetime)
74 {
75  entity s;
76 
77  if(!_lifetime)
78  _lifetime = time + 30;
79  else
80  _lifetime += time;
81 
82  s = spawn();
83  s.alpha = 0.25;
84  setthink(s, SUB_Remove);
85  s.nextthink = _lifetime;
86  s.scale = pathlib_gridsize / 512.001;
87  s.solid = SOLID_NOT;
88 
89  setmodel(s, goodsquare ? MDL_SQUARE_GOOD : MDL_SQUARE_BAD);
90 
91  traceline(where + '0 0 32',where - '0 0 128',MOVE_WORLDONLY,s);
92 
93  s.angles = vectoangles(trace_plane_normal);
94  s.angles_x -= 90;
95  setorigin(s, where);
96 }
97 
98 void pathlib_showedge(vector where,float _lifetime,float rot)
99 {
100  entity e;
101 
102  if(!_lifetime)
103  _lifetime = time + 30;
104  else
105  _lifetime += time;
106 
107  e = spawn();
108  e.alpha = 0.25;
109  setthink(e, SUB_Remove);
110  e.nextthink = _lifetime;
111  e.scale = pathlib_gridsize / 512;
112  e.solid = SOLID_NOT;
113  setorigin(e, where);
114  setmodel(e, MDL_EDGE);
115  //traceline(where + '0 0 32',where - '0 0 128',MOVE_WORLDONLY,e);
116  //e.angles = vectoangles(trace_plane_normal);
117  e.angles_y = rot;
118  //e.angles_x += 90;
119 
120 }
121 
122 #endif
const float SOLID_NOT
Definition: csprogsdefs.qc:244
entity() spawn
origin
Definition: ent_cs.qc:114
entity path_next
Definition: pathlib.qh:8
entity owner
Definition: main.qh:73
#define setmodel(this, m)
Definition: model.qh:26
float pathlib_gridsize
Definition: pathlib.qh:50
float nextthink
Definition: csprogsdefs.qc:121
#define MODEL(name, path)
Definition: all.qh:8
vector(float skel, float bonenum) _skel_get_boneabs_hidden
setorigin(ent, v)
#define setthink(e, f)
vector trace_plane_normal
Definition: csprogsdefs.qc:38
float MOVE_WORLDONLY
float time
Definition: csprogsdefs.qc:16