1#include "debug.qh" 2 3#if DEBUGPATHING 4 5MODEL(SQUARE, "models/pathlib/square.md3"); 6MODEL(SQUARE_GOOD, "models/pathlib/goodsquare.md3"); 7MODEL(SQUARE_BAD, "models/pathlib/badsquare.md3"); 8MODEL(EDGE, "models/pathlib/edge.md3"); 9 10#ifdef TURRET_DEBUG 11void mark_error(vector where,float lifetime); 12void mark_info(vector where,float lifetime); 13entity mark_misc(vector where,float lifetime); 14#endif 15 16void pathlib_showpath(entity start) 17{ 18 entity e; 19 e = start; 20 while(e.path_next) 21 { 22 te_lightning1(e,e.origin,e.path_next.origin); 23 e = e.path_next; 24 } 25} 26 27void path_dbg_think(entity this) 28{ 29 pathlib_showpath(this); 30 this.nextthink = time + 1; 31} 32 33void __showpath2_think(entity this) 34{ 35 #ifdef TURRET_DEBUG 36 mark_info(this.origin,1); 37 #endif 38 if(this.path_next) 39 { 40 setthink(this.path_next, __showpath2_think); 41 this.path_next.nextthink = time + 0.15; 42 } 43 else 44 { 45 setthink(this.owner, __showpath2_think); 46 this.owner.nextthink = time + 0.15; 47 } 48} 49 50void pathlib_showpath2(entity path) 51{ 52 setthink(path, __showpath2_think); 53 path.nextthink = time; 54} 55 56void pathlib_showsquare2(entity node ,vector ncolor,float align) 57{ 58 59 node.alpha = 0.25; 60 node.scale = pathlib_gridsize / 512.001; 61 node.solid = SOLID_NOT; 62 63 setmodel(node, MDL_SQUARE); 64 setorigin(node, node.origin); 65 node.colormod = ncolor; 66 67 if(align) 68 { 69 traceline(node.origin + '0 0 32', node.origin - '0 0 128', MOVE_WORLDONLY, node); 70 node.angles = vectoangles(trace_plane_normal); 71 node.angles_x -= 90; 72 } 73} 74 75void 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 setthink(s, 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 100void 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 setthink(e, 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} 123 124#endif 125