1
0
Fork 0
forked from fte/fteqw

export waypoint radius to the route-data passed onto QC, this will change nodeslist_t

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5797 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Eukara 2021-01-02 10:13:59 +00:00
parent a98bd4eaf6
commit 9925427ac9
2 changed files with 5 additions and 0 deletions

View file

@ -11149,6 +11149,7 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
"typedef struct\n{\n" \ "typedef struct\n{\n" \
"\tvector dest;\n" \ "\tvector dest;\n" \
"\tint linkflags;\n"\ "\tint linkflags;\n"\
"\tfloat radius;\n"\
"} nodeslist_t;\n" "} nodeslist_t;\n"
{"route_calculate", PF_route_calculate,0, 0, 0, 0, D(qcnodeslist "void(entity ent, vector dest, int denylinkflags, void(entity ent, vector dest, int numnodes, nodeslist_t *nodelist) callback)", "Begin calculating a route. The callback function will be called once the route has finished being calculated. The route must be memfreed once it is no longer needed. The route must be followed in reverse order (ie: the first node that must be reached is at index numnodes-1). If no route is available then the callback will be called with no nodes.")}, {"route_calculate", PF_route_calculate,0, 0, 0, 0, D(qcnodeslist "void(entity ent, vector dest, int denylinkflags, void(entity ent, vector dest, int numnodes, nodeslist_t *nodelist) callback)", "Begin calculating a route. The callback function will be called once the route has finished being calculated. The route must be memfreed once it is no longer needed. The route must be followed in reverse order (ie: the first node that must be reached is at index numnodes-1). If no route is available then the callback will be called with no nodes.")},
#endif #endif

View file

@ -647,6 +647,7 @@ struct waypointnetwork_s
{ {
vec3_t pos; vec3_t pos;
int linkflags; int linkflags;
float radius;
} *displaynode; } *displaynode;
size_t displaynodes; size_t displaynodes;
@ -884,6 +885,7 @@ static qboolean Route_Completed(struct routecalc_s *r, nodefrom_t *nodecamefrom)
//target point is first. yay. //target point is first. yay.
VectorCopy(r->end, r->resultnodes[0].pos); VectorCopy(r->end, r->resultnodes[0].pos);
r->resultnodes[0].linkflags = LF_DESTINATION; r->resultnodes[0].linkflags = LF_DESTINATION;
r->resultnodes[0].radius = 32;
r->numresultnodes++; r->numresultnodes++;
u = r->endn; u = r->endn;
@ -891,6 +893,7 @@ static qboolean Route_Completed(struct routecalc_s *r, nodefrom_t *nodecamefrom)
{ {
VectorCopy(n->waypoints[u].org, r->resultnodes[r->numresultnodes].pos); VectorCopy(n->waypoints[u].org, r->resultnodes[r->numresultnodes].pos);
r->resultnodes[r->numresultnodes].linkflags = nodecamefrom[u].flags; r->resultnodes[r->numresultnodes].linkflags = nodecamefrom[u].flags;
r->resultnodes[r->numresultnodes].radius = n->waypoints[u].radius;
r->numresultnodes++; r->numresultnodes++;
if (u == r->startn) if (u == r->startn)
break; break;
@ -900,6 +903,7 @@ static qboolean Route_Completed(struct routecalc_s *r, nodefrom_t *nodecamefrom)
//and include the start point, because we can //and include the start point, because we can
VectorCopy(r->start, r->resultnodes[r->numresultnodes].pos); VectorCopy(r->start, r->resultnodes[r->numresultnodes].pos);
r->resultnodes[r->numresultnodes].linkflags = 0; r->resultnodes[r->numresultnodes].linkflags = 0;
r->resultnodes[r->numresultnodes].radius = 32;
r->numresultnodes++; r->numresultnodes++;
return true; return true;
} }