mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-04-20 13:35:43 +00:00
Fix Path_NearestNodeNotCrossPlanes.
Also fix pathlocal_t struct.
This commit is contained in:
parent
6461aa85d3
commit
f0ffd59c58
@ -223,20 +223,23 @@ namespace ai
|
|||||||
{
|
{
|
||||||
int result; // eax
|
int result; // eax
|
||||||
int returnCount = 0; // [esp+2Ch] [ebp-304h] BYREF
|
int returnCount = 0; // [esp+2Ch] [ebp-304h] BYREF
|
||||||
//game::pathsort_t nodes[64] = {}; // [esp+30h] [ebp-300h] BYREF
|
|
||||||
|
|
||||||
std::unique_ptr<game::pathsort_t[], void (*)(game::pathsort_t*)> nodes(new game::pathsort_t[64], [](game::pathsort_t* ptr) { delete[] ptr; });
|
std::unique_ptr<game::pathsort_t[], void (*)(game::pathsort_t*)> nodes(new game::pathsort_t[64], [](game::pathsort_t* ptr) { delete[] ptr; });
|
||||||
|
const int maxNodes = 64;
|
||||||
|
|
||||||
const float maxHeightSq = 8.0f * 8.0f;
|
game::pathnode_t* pNodeTo = game::Path_NearestNodeNotCrossPlanes(-2, maxNodes, vGoalPos, nodes.get(), 192.0f, 0.0f, 0.0f, 0.0f, &returnCount, game::NEAREST_NODE_DO_HEIGHT_CHECK);
|
||||||
|
if (!pNodeTo)
|
||||||
//printf("Path_FindPath_stub() \n");
|
{
|
||||||
|
printf("Couldn't find the node to\n");
|
||||||
game::pathnode_t* pNodeTo = game::Path_NearestNodeNotCrossPlanes(NAN, maxHeightSq, vGoalPos, nodes.get(), 192.0, 0, 0, 0, &returnCount, 0);
|
}
|
||||||
game::pathnode_t* pNodeFrom = game::Path_NearestNodeNotCrossPlanes(NAN, maxHeightSq, vStartPos, nodes.get(), 192.0, 0, 0, 0, &returnCount, 0);
|
game::pathnode_t* pNodeFrom = game::Path_NearestNodeNotCrossPlanes(-2, maxNodes, vStartPos, nodes.get(), 192.0f, 0.0f, 0.0f, 0.0f, &returnCount, game::NEAREST_NODE_DO_HEIGHT_CHECK);
|
||||||
if (pNodeTo && pNodeFrom != 0)
|
if (pNodeTo && pNodeFrom)
|
||||||
result = Path_FindPathFromTo_custom(vStartPos, pNodeTo, pPath, eTeam, pNodeFrom, vGoalPos, bAllowNegotiationLinks, 0);
|
{
|
||||||
|
result = game::Path_FindPathFromTo(vStartPos, pNodeTo, pPath, eTeam, pNodeFrom, vGoalPos, bAllowNegotiationLinks, 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
result = 0;
|
result = 0;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ namespace game
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
pathnode_t* Path_NearestNodeNotCrossPlanes(float maxDistSq, float maxHeightSq, float* vOrigin, pathsort_t* nodes, float a5, int a6, int a7, int a8, int* returnCount, int a10)
|
pathnode_t* Path_NearestNodeNotCrossPlanes(int typeFlags, int maxNodes, float* vOrigin, pathsort_t* nodes, float fMaxDist, float a6, float a7, int iPlaneCount, int* returnCount, nearestNodeHeightCheck heightCheck)
|
||||||
{
|
{
|
||||||
static const auto call_addr = SELECT(0x0, 0x55C210);
|
static const auto call_addr = SELECT(0x0, 0x55C210);
|
||||||
|
|
||||||
@ -449,16 +449,16 @@ namespace game
|
|||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push a10;
|
push heightCheck;
|
||||||
push returnCount;
|
push returnCount;
|
||||||
push a8;
|
push iPlaneCount;
|
||||||
push a7;
|
push a7;
|
||||||
push a6;
|
push a6;
|
||||||
push a5;
|
push fMaxDist;
|
||||||
push nodes;
|
push nodes;
|
||||||
push vOrigin;
|
push vOrigin;
|
||||||
movss xmm0, maxHeightSq;
|
mov ecx, maxNodes;
|
||||||
movss xmm1, maxDistSq;
|
mov edx, typeFlags;
|
||||||
call call_addr;
|
call call_addr;
|
||||||
add esp, 0x20;
|
add esp, 0x20;
|
||||||
mov answer, eax;
|
mov answer, eax;
|
||||||
|
@ -57,7 +57,7 @@ namespace game
|
|||||||
const char* SL_ConvertToString(scriptInstance_t inst, int id);
|
const char* SL_ConvertToString(scriptInstance_t inst, int id);
|
||||||
|
|
||||||
int Path_FindPath(path_t* pPath, team_t eTeam, float* vStartPos, float* vGoalPos, int bAllowNegotiationLinks);
|
int Path_FindPath(path_t* pPath, team_t eTeam, float* vStartPos, float* vGoalPos, int bAllowNegotiationLinks);
|
||||||
pathnode_t* Path_NearestNodeNotCrossPlanes(float maxDistSq, float maxHeightSq, float* vOrigin, pathsort_t* nodes, float a5, int a6, int a7, int a8, int* returnCount, int a10);
|
pathnode_t* Path_NearestNodeNotCrossPlanes(int typeFlags, int maxNodes, float* vOrigin, pathsort_t* nodes, float fMaxDist, float a6, float a7, int iPlaneCount, int* returnCount, nearestNodeHeightCheck heightCheck);
|
||||||
int Path_FindPathFromTo(float* startPos, pathnode_t* pNodeTo, path_t* pPath, team_t eTeam, pathnode_t* pNodeFrom, float* vGoalPos, int bAllowNegotiationLinks, int bIgnoreBadplaces);
|
int Path_FindPathFromTo(float* startPos, pathnode_t* pNodeTo, path_t* pPath, team_t eTeam, pathnode_t* pNodeFrom, float* vGoalPos, int bAllowNegotiationLinks, int bIgnoreBadplaces);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -1572,12 +1572,12 @@ namespace game
|
|||||||
float origin[3];
|
float origin[3];
|
||||||
float maxDist;
|
float maxDist;
|
||||||
float maxDistSq;
|
float maxDistSq;
|
||||||
float maxHeight;
|
|
||||||
float maxHeightSq;
|
float maxHeightSq;
|
||||||
int typeFlags;
|
int typeFlags;
|
||||||
pathsort_t* nodes;
|
pathsort_t* nodes;
|
||||||
int maxNodes;
|
int maxNodes;
|
||||||
int nodeCount;
|
int nodeCount;
|
||||||
|
float maxHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __declspec(align(128)) pathlocal_t
|
struct __declspec(align(128)) pathlocal_t
|
||||||
@ -1585,9 +1585,9 @@ namespace game
|
|||||||
PathLinkInfo pathLinkInfoArray[2048];
|
PathLinkInfo pathLinkInfoArray[2048];
|
||||||
int pathLinkInfoArrayInited;
|
int pathLinkInfoArrayInited;
|
||||||
unsigned int actualNodeCount;
|
unsigned int actualNodeCount;
|
||||||
|
pathlocal_t_circle circle;
|
||||||
unsigned int extraNodes;
|
unsigned int extraNodes;
|
||||||
unsigned int originErrors;
|
unsigned int originErrors;
|
||||||
pathlocal_t_circle circle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CustomSearchInfo_FindPath
|
struct CustomSearchInfo_FindPath
|
||||||
@ -1597,6 +1597,11 @@ namespace game
|
|||||||
float negotiationOverlapCost;
|
float negotiationOverlapCost;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum nearestNodeHeightCheck
|
||||||
|
{
|
||||||
|
NEAREST_NODE_DO_HEIGHT_CHECK = 0x0,
|
||||||
|
NEAREST_NODE_DONT_DO_HEIGHT_CHECK = 0x1,
|
||||||
|
};
|
||||||
|
|
||||||
enum VariableType
|
enum VariableType
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user