Add more path structs.

Add getlinkednodes method for a node. getnodenumber method. getnodebynumber function. generatepath function.
This commit is contained in:
JezuzLizard
2023-03-25 19:06:45 -07:00
parent ffdf2c48ba
commit bb8233cf86
5 changed files with 143 additions and 13 deletions

View File

@ -282,11 +282,8 @@ namespace game
void Scr_AddPathnode(scriptInstance_t inst, pathnode_t* node)
{
printf("Scr_AddPathnode Targetname %s\n", SL_ConvertToString(game::SCRIPTINSTANCE_SERVER, node->constant.targetname));
int entnum = node - (*gameWorldCurrent)->path.nodes;
printf("1 entnum: %d\n", entnum);
int entid = Scr_GetEntityId(inst, entnum, CLASS_NUM_PATHNODE, 0);
printf("2 entid: %d\n", entid);
Scr_AddEntityNum(inst, entid);
}
@ -380,6 +377,26 @@ namespace game
return Dvar_RegisterVariant(name, game::DVAR_TYPE_STRING, flags, dvar_value, limits, desc);
}
int Path_FindPath(path_t* pPath, team_t eTeam, float* vStartPos, float* vGoalPos, int bAllowNegotiationLinks)
{
static const auto call_addr = SELECT(0x0, 0x4CF280);
int answer;
__asm
{
push bAllowNegotiationLinks;
push vGoalPos;
push vStartPos;
mov edx, eTeam;
mov ecx, pPath;
call call_addr;
mov answer, eax;
}
return answer;
}
namespace plutonium
{
}

View File

@ -51,6 +51,8 @@ namespace game
void Scr_AddArrayStringIndexed(scriptInstance_t inst, unsigned short id); //testing
const char* SL_ConvertToString(scriptInstance_t inst, int id); //testing
int Path_FindPath(path_t* pPath, team_t eTeam, float* vStartPos, float* vGoalPos, int bAllowNegotiationLinks);
template <typename T>
class symbol
{

View File

@ -1417,7 +1417,7 @@ namespace game
float fOrientLerp;
};
enum nodeType : __int32
enum nodeType
{
NODE_BADNODE = 0x0,
NODE_PATHNODE = 0x1,
@ -1550,4 +1550,41 @@ namespace game
PathData path;
};
struct PathLinkInfo
{
unsigned __int16 from;
unsigned __int16 to;
unsigned __int16 prev;
unsigned __int16 next;
};
struct pathsort_t
{
pathnode_t* node;
float metric;
float distMetric;
};
struct pathlocal_t_circle
{
float origin[3];
float maxDist;
float maxDistSq;
float maxHeight;
float maxHeightSq;
int typeFlags;
pathsort_t* nodes;
int maxNodes;
int nodeCount;
};
struct __declspec(align(128)) pathlocal_t
{
PathLinkInfo pathLinkInfoArray[2048];
int pathLinkInfoArrayInited;
unsigned int actualNodeCount;
unsigned int extraNodes;
unsigned int originErrors;
pathlocal_t_circle circle;
};
}

View File

@ -19,6 +19,8 @@ namespace game
WEAK symbol<GameWorldSp*> gameWorldCurrent{ 0x0, 0x8E1D80 };
WEAK symbol<pathlocal_t> g_path{ 0x0, 0x1F2F700 };
WEAK symbol<gentity_s> g_entities{ 0x0, 0x176C6F0 };
namespace plutonium