mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-10 04:27:10 +03:00
Added badPlaceTeam
This commit is contained in:
parent
64a3b04181
commit
dc1be17b2a
2 changed files with 103 additions and 106 deletions
|
@ -492,6 +492,10 @@ void PathNode::ArchiveStatic(Archiver& arc)
|
|||
|
||||
if (arc.Loading()) {
|
||||
Child[i].numBlockers = 0;
|
||||
|
||||
for (int j = 0; j < ARRAY_LEN(Child[i].badPlaceTeam); j++) {
|
||||
Child[i].badPlaceTeam[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1086,6 +1090,7 @@ PathNode *PathSearch::DebugNearestStartNode(float *pos, Entity *ent)
|
|||
vec3_t deltas[128];
|
||||
vec3_t start;
|
||||
vec3_t end;
|
||||
int node_count;
|
||||
|
||||
cell = GetNodesInCell(pos);
|
||||
|
||||
|
@ -1093,7 +1098,7 @@ PathNode *PathSearch::DebugNearestStartNode(float *pos, Entity *ent)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int node_count = NearestNodeSetup(pos, cell, nodes, deltas);
|
||||
node_count = NearestNodeSetup(pos, cell, nodes, deltas);
|
||||
|
||||
if (!node_count) {
|
||||
return NULL;
|
||||
|
@ -1108,13 +1113,16 @@ PathNode *PathSearch::DebugNearestStartNode(float *pos, Entity *ent)
|
|||
VectorCopy(start, end);
|
||||
VectorAdd(end, deltas[nodes[i]], end);
|
||||
|
||||
Vector vStart = start;
|
||||
Vector vMins = Vector(-15, -15, 0);
|
||||
Vector vMaxs = Vector(15, 15, 62);
|
||||
Vector vEnd = end;
|
||||
|
||||
if (G_SightTrace(
|
||||
vStart, vMins, vMaxs, vEnd, ent, NULL, MASK_TARGETPATH, qtrue, "PathSearch::DebugNearestStartNode"
|
||||
start,
|
||||
Vector(-15, -15, 0),
|
||||
Vector(15, 15, 62),
|
||||
end,
|
||||
ent,
|
||||
NULL,
|
||||
MASK_TARGETPATH,
|
||||
qtrue,
|
||||
"PathSearch::DebugNearestStartNode"
|
||||
)) {
|
||||
return node;
|
||||
}
|
||||
|
@ -1132,6 +1140,7 @@ PathNode *PathSearch::NearestStartNode(float *pos, SimpleActor *ent)
|
|||
vec3_t deltas[128];
|
||||
vec3_t start;
|
||||
vec3_t end;
|
||||
int node_count;
|
||||
|
||||
cell = GetNodesInCell(pos);
|
||||
|
||||
|
@ -1139,60 +1148,54 @@ PathNode *PathSearch::NearestStartNode(float *pos, SimpleActor *ent)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int node_count = NearestNodeSetup(pos, cell, nodes, deltas);
|
||||
int n = 0;
|
||||
int j = 0;
|
||||
node_count = NearestNodeSetup(pos, cell, nodes, deltas);
|
||||
|
||||
VectorCopy(pos, start);
|
||||
start[2] += 32.0f;
|
||||
|
||||
Vector vMins = Vector(-15, -15, 0);
|
||||
Vector vMaxs = Vector(15, 15, 62);
|
||||
|
||||
for (i = 0; i < node_count; i++) {
|
||||
node = pathnodes[cell->nodes[nodes[i]]];
|
||||
|
||||
VectorAdd(start, deltas[nodes[i]], end);
|
||||
|
||||
Vector vStart = start;
|
||||
Vector vEnd = end;
|
||||
|
||||
if (G_SightTrace(
|
||||
vStart,
|
||||
vMins,
|
||||
vMaxs,
|
||||
vEnd,
|
||||
(gentity_t *)NULL,
|
||||
(gentity_t *)NULL,
|
||||
1107437825, //FIXME: macro
|
||||
start,
|
||||
Vector(-15, -15, 0),
|
||||
Vector(15, 15, 62),
|
||||
end,
|
||||
ent,
|
||||
NULL,
|
||||
MASK_PATHSOLID,
|
||||
qtrue,
|
||||
"PathSearch::NearestStartNode 1"
|
||||
)) {
|
||||
ent->m_NearestNode = node;
|
||||
ent->m_vNearestNodePos = end;
|
||||
VectorCopy(end, ent->m_vNearestNodePos);
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ent->m_NearestNode
|
||||
&& (G_SightTrace(
|
||||
Vector(start),
|
||||
vMins,
|
||||
vMaxs,
|
||||
if (ent->m_NearestNode) {
|
||||
if (G_SightTrace(
|
||||
start,
|
||||
Vector(-15, -15, 0),
|
||||
Vector(15, 15, 62),
|
||||
ent->m_vNearestNodePos,
|
||||
ent->edict,
|
||||
(gentity_t *)NULL,
|
||||
1073883393, //FIXME: macro
|
||||
ent,
|
||||
NULL,
|
||||
MASK_TARGETPATH,
|
||||
qtrue,
|
||||
"PathSearch::NearestStartNode 2"
|
||||
)))
|
||||
|| node_count <= 0) {
|
||||
node = ent->m_NearestNode;
|
||||
} else {
|
||||
node = pathnodes[cell->nodes[nodes[0]]];
|
||||
)) {
|
||||
return ent->m_NearestNode;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
if (node_count <= 0) {
|
||||
return ent->m_NearestNode;
|
||||
}
|
||||
|
||||
return pathnodes[cell->nodes[nodes[0]]];
|
||||
}
|
||||
|
||||
PathNode *PathSearch::NearestEndNode(float *pos)
|
||||
|
@ -1204,6 +1207,7 @@ PathNode *PathSearch::NearestEndNode(float *pos)
|
|||
vec3_t deltas[128];
|
||||
vec3_t start;
|
||||
vec3_t end;
|
||||
int node_count;
|
||||
|
||||
cell = GetNodesInCell(pos);
|
||||
|
||||
|
@ -1211,9 +1215,7 @@ PathNode *PathSearch::NearestEndNode(float *pos)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int node_count = NearestNodeSetup(pos, cell, nodes, deltas);
|
||||
int n = 0;
|
||||
int j = 0;
|
||||
node_count = NearestNodeSetup(pos, cell, nodes, deltas);
|
||||
|
||||
if (!node_count) {
|
||||
return NULL;
|
||||
|
@ -1227,18 +1229,13 @@ PathNode *PathSearch::NearestEndNode(float *pos)
|
|||
|
||||
VectorAdd(start, deltas[nodes[i]], end);
|
||||
|
||||
Vector vStart = start;
|
||||
Vector vMins = Vector(-15, -15, 0);
|
||||
Vector vMaxs = Vector(15, 15, 62);
|
||||
Vector vEnd = end;
|
||||
|
||||
if (G_SightTrace(
|
||||
vStart,
|
||||
vMins,
|
||||
vMaxs,
|
||||
vEnd,
|
||||
(gentity_t *)NULL,
|
||||
(gentity_t *)NULL,
|
||||
start,
|
||||
Vector(-15, -15, 0),
|
||||
Vector(15, 15, 62),
|
||||
end,
|
||||
(Entity *)nullptr,
|
||||
(Entity *)nullptr,
|
||||
MASK_TARGETPATH,
|
||||
qtrue,
|
||||
"PathSearch::NearestEndNode"
|
||||
|
@ -1872,8 +1869,8 @@ void PathSearch::UpdatePathwaysForBadPlace(const Vector& origin, float radius, i
|
|||
pathway_t& pathway = node->Child[j - 1];
|
||||
if (PointToSegmentDistanceSquared(origin, pathway.pos1, pathway.pos2) < radiusSqr) {
|
||||
for (k = 0; k < 2; k++) {
|
||||
if ((1 << i) & team) {
|
||||
pathway.numBlockers += dir;
|
||||
if ((1 << k) & team) {
|
||||
pathway.badPlaceTeam[k] += dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2122,10 +2119,10 @@ int PathSearch::FindPath(
|
|||
return 0;
|
||||
}
|
||||
|
||||
total_dist = 1e+12;
|
||||
total_dist = 1e+12f;
|
||||
|
||||
if (!maxPath) {
|
||||
maxPath = 1e+12;
|
||||
maxPath = 1e+12f;
|
||||
}
|
||||
|
||||
findFrame++;
|
||||
|
@ -2194,8 +2191,7 @@ int PathSearch::FindPath(
|
|||
|
||||
if (prev) {
|
||||
prev->NextNode = next;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
open = next;
|
||||
}
|
||||
}
|
||||
|
@ -2624,9 +2620,9 @@ int node_compare(const void *pe1, const void *pe2)
|
|||
PathNode *PathSearch::FindCornerNodeForWall(float *start, float *end, SimpleActor *ent, float maxPath, float *plane)
|
||||
{
|
||||
int i, g;
|
||||
PathNode* NewNode;
|
||||
pathway_t* pathway;
|
||||
PathNode* prev, * next;
|
||||
PathNode *NewNode;
|
||||
pathway_t *pathway;
|
||||
PathNode *prev, *next;
|
||||
int f;
|
||||
vec2_t delta;
|
||||
|
||||
|
@ -2778,7 +2774,7 @@ PathNode *PathSearch::FindCornerNodeForWall(float *start, float *end, SimpleActo
|
|||
|
||||
prev = open;
|
||||
|
||||
PathNode* pNextOpenNode;
|
||||
PathNode *pNextOpenNode;
|
||||
for (pNextOpenNode = open->NextNode; pNextOpenNode; pNextOpenNode = pNextOpenNode->NextNode) {
|
||||
if (pNextOpenNode->f >= f) {
|
||||
break;
|
||||
|
@ -2874,9 +2870,9 @@ int PathSearch::FindPotentialCover(
|
|||
int nNodes = 0;
|
||||
int i;
|
||||
Vector delta;
|
||||
PathNode* node;
|
||||
PathNode *node;
|
||||
|
||||
Actor* pActor = static_cast<Actor*>(pEnt);
|
||||
Actor *pActor = static_cast<Actor *>(pEnt);
|
||||
|
||||
for (i = 0; i < nodecount; i++) {
|
||||
node = pathnodes[i];
|
||||
|
@ -2888,7 +2884,7 @@ int PathSearch::FindPotentialCover(
|
|||
continue;
|
||||
}
|
||||
|
||||
if (node->IsClaimedByOther(static_cast<Entity*>(pEnt))) {
|
||||
if (node->IsClaimedByOther(static_cast<Entity *>(pEnt))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3038,7 +3034,7 @@ int PathSearch::NearestNodeSetup(vec3_t pos, MapCell *cell, int *nodes, vec3_t *
|
|||
continue;
|
||||
}
|
||||
|
||||
if (node->origin[2] > pos[2] + 94.0f) {
|
||||
if (pos[2] + 94.0f < node->origin[2]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
|
||||
typedef struct {
|
||||
byte numBlockers;
|
||||
byte badPlaceTeam[2];
|
||||
short int node;
|
||||
short int fallheight;
|
||||
float dist;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue