local float ignorehazards;
local float swimming;
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
+ {
debugresetnodes();
debugnode(start);
- #endif
+ }
move = end - start;
move_z = 0;
if (trace_startsolid)
{
// Bad start
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnodestatus(start, DEBUG_NODE_FAIL);
- #endif
+
//print("tracewalk: ", vtos(start), " is a bad start\n");
return FALSE;
}
if (boxesoverlap(end, end, org + m1 + '-1 -1 -1', org + m2 + '1 1 1'))
{
// Succeeded
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnodestatus(org, DEBUG_NODE_SUCCESS);
- #endif
+
//print("tracewalk: ", vtos(start), " can reach ", vtos(end), "\n");
return TRUE;
}
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnode(org);
- #endif
if (dist <= 0)
break;
if (trace_dpstartcontents & (DPCONTENTS_SLIME | DPCONTENTS_LAVA))
{
// hazards blocking path
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnodestatus(org, DEBUG_NODE_FAIL);
- #endif
+
//print("tracewalk: ", vtos(start), " hits a hazard when trying to reach ", vtos(end), "\n");
return FALSE;
}
move = normalize(end - org);
tracebox(org, m1, m2, org + move * stepdist, movemode, e);
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnode(trace_endpos);
- #endif
if (trace_fraction < 1)
{
org = trace_endpos - normalize(org - trace_endpos) * stepdist;
for(; org_z < end_z + self.maxs_z; org_z += stepdist)
{
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnode(org);
- #endif
+
if(pointcontents(org) == CONTENT_EMPTY)
break;
}
if not (pointcontents(org + '0 0 1') == CONTENT_EMPTY)
{
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnodestatus(org, DEBUG_NODE_FAIL);
- #endif
+
return FALSE;
//print("tracewalk: ", vtos(start), " failed under water\n");
}
move = dir * stepdist + org;
tracebox(org, m1, m2, move, movemode, e);
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnode(trace_endpos);
- #endif
// hit something
if (trace_fraction < 1)
tracebox(org + stepheightvec, m1, m2, move + stepheightvec, movemode, e);
if (trace_fraction < 1 || trace_startsolid)
{
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnodestatus(trace_endpos, DEBUG_NODE_WARNING);
- #endif
// check for doors
traceline( org, move, movemode, e);
}
else
{
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnodestatus(trace_endpos, DEBUG_NODE_FAIL);
- #endif
+
//print("tracewalk: ", vtos(start), " hit something when trying to reach ", vtos(end), "\n");
//te_explosion(trace_endpos);
//print(ftos(e.dphitcontentsmask), "\n");
//print("tracewalk: ", vtos(start), " did not arrive at ", vtos(end), " but at ", vtos(org), "\n");
// moved but didn't arrive at the intended destination
- #ifdef DEBUG_TRACEWALK
+ if(autocvar_bot_debug_tracewalk)
debugnodestatus(org, DEBUG_NODE_FAIL);
- #endif
return FALSE;
};
}
};
-#ifdef DEBUG_TRACEWALK
-
void debugresetnodes()
{
debuglastnode = '0 0 0';
void debugnodestatus(vector position, float status)
{
- vector color;
+ vector c;
switch (status)
{
case DEBUG_NODE_SUCCESS:
- color = '0 15 0';
+ c = '0 15 0';
break;
case DEBUG_NODE_WARNING:
- color = '15 15 0';
+ c = '15 15 0';
break;
case DEBUG_NODE_FAIL:
- color = '15 0 0';
+ c = '15 0 0';
break;
default:
- color = '15 15 15';
+ c = '15 15 15';
}
- te_customflash(position, 40, 2, color);
+ te_customflash(position, 40, 2, c);
}
-#endif
-
#ifdef DEBUG_BOT_GOALSTACK
.float goalcounter;