2022-02-27 03:15:00 +01:00
|
|
|
#pragma once
|
2022-03-21 00:28:14 +01:00
|
|
|
#include "game/server/ai_node.h"
|
2022-02-27 03:15:00 +01:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// CAI_Network
|
|
|
|
//
|
|
|
|
// Purpose: Stores a node graph through which an AI may pathfind
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class CAI_Network
|
|
|
|
{
|
2022-04-03 03:10:48 +02:00
|
|
|
public:
|
|
|
|
static void DebugConnectMsg(int node1, int node2, const char* pszFormat, ...);
|
|
|
|
void* GetVTable(void) const;
|
2023-08-28 20:01:45 +02:00
|
|
|
int NumLinks(void) const;
|
|
|
|
int NumZones(void) const;
|
|
|
|
int NumHints(void) const;
|
|
|
|
int NumScriptNodes(void) const;
|
|
|
|
int NumPathNodes(void) const;
|
2022-04-03 03:10:48 +02:00
|
|
|
|
|
|
|
short GetHint(int nIndex) const;
|
|
|
|
CAI_ScriptNode* GetScriptNodes(void) const;
|
2023-08-24 23:44:57 +02:00
|
|
|
|
|
|
|
CAI_Node* AddPathNode(const Vector3D* origin, const float jaw);
|
2023-08-28 20:01:45 +02:00
|
|
|
CAI_Node* GetPathNode(int id) const;
|
2022-04-03 03:10:48 +02:00
|
|
|
|
2023-08-24 23:44:57 +02:00
|
|
|
CAI_NodeLink* CreateNodeLink(int srcID, int destID);
|
|
|
|
|
2022-02-27 03:15:00 +01:00
|
|
|
public:
|
2022-03-21 13:48:34 +01:00
|
|
|
void* m_pVTable; // <-- 'this'.
|
2022-02-27 03:15:00 +01:00
|
|
|
|
2022-03-21 13:48:34 +01:00
|
|
|
int m_iNumLinks; // +0x0008
|
2023-08-28 23:17:03 +02:00
|
|
|
int m_nUnk0;
|
|
|
|
|
|
|
|
CAI_HullData m_HullData[MAX_HULLS];
|
|
|
|
|
2022-03-21 13:48:34 +01:00
|
|
|
int m_iNumZones; // +0x0088
|
2023-08-28 23:17:03 +02:00
|
|
|
int m_iUnkCount0;
|
|
|
|
int m_iUnkCount1;
|
|
|
|
int m_iUnkCount2;
|
|
|
|
int m_iUnkCount4;
|
2022-02-27 03:15:00 +01:00
|
|
|
|
|
|
|
// unk8 on disk
|
2022-03-21 13:48:34 +01:00
|
|
|
int unk5; // +0x009C
|
|
|
|
char unk6[0x4]; // +0x00A0
|
|
|
|
int m_iNumHints; // +0x00A4
|
2022-02-27 03:15:00 +01:00
|
|
|
|
2022-03-21 13:48:34 +01:00
|
|
|
short m_Hints[0x7D0]; // +0x00A8 <-- '2000' hints.
|
|
|
|
CAI_ScriptNode* m_ScriptNode; // +0x1048 <-- '[r5apex_ds.exe + 0xc6fd39]'.
|
|
|
|
int m_iNumScriptNodes; // +0x1050
|
2022-03-20 17:03:46 +01:00
|
|
|
|
2022-03-21 13:48:34 +01:00
|
|
|
char pad0[0x14]; // +0x1054 <-- !TODO
|
|
|
|
|
2022-06-24 16:56:28 +02:00
|
|
|
int m_iNumNodes; // +0x1070
|
2022-03-21 13:48:34 +01:00
|
|
|
CAI_Node** m_pAInode; // +0x1078
|
|
|
|
};
|
2022-07-11 12:00:08 +02:00
|
|
|
inline CAI_Network** g_pAINetwork = nullptr;
|
2022-04-03 03:10:48 +02:00
|
|
|
|
2023-08-24 23:44:57 +02:00
|
|
|
inline CMemory p_CAI_Network__AddPathNode;
|
|
|
|
inline CAI_Node*(*v_CAI_Network__AddPathNode)(CAI_Network* pNetwork, const Vector3D* origin, float yaw);
|
|
|
|
|
|
|
|
inline CMemory p_CAI_Network__CreateNodeLink;
|
|
|
|
inline CAI_NodeLink* (*v_CAI_Network__CreateNodeLink)(CAI_Network* pNetwork, int srcID, int destID);
|
|
|
|
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_CAI_Network__DebugConnectMsg;
|
2023-07-02 23:01:29 +02:00
|
|
|
inline void(*v_CAI_Network__DebugConnectMsg)(int node1, int node2, const char* pszformat, ...);
|
2022-04-03 03:10:48 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VAI_Network : public IDetour
|
2022-04-03 03:10:48 +02:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2022-04-03 03:10:48 +02:00
|
|
|
{
|
2023-08-24 23:44:57 +02:00
|
|
|
LogFunAdr("CAI_Network::AddPathNode", p_CAI_Network__AddPathNode.GetPtr());
|
|
|
|
LogFunAdr("CAI_Network::CreateNodeLink", p_CAI_Network__CreateNodeLink.GetPtr());
|
2023-01-25 02:26:52 +01:00
|
|
|
LogFunAdr("CAI_Network::DebugConnectMsg", p_CAI_Network__DebugConnectMsg.GetPtr());
|
|
|
|
LogVarAdr("g_pAINetwork", reinterpret_cast<uintptr_t>(g_pAINetwork));
|
2022-04-03 03:10:48 +02:00
|
|
|
}
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2023-08-24 23:44:57 +02:00
|
|
|
p_CAI_Network__AddPathNode = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 30 48 8B B9 ?? ?? ?? ?? 48 8B F2 0F 29 74 24 ??");
|
|
|
|
v_CAI_Network__AddPathNode = p_CAI_Network__AddPathNode.RCast<CAI_Node*(*)(CAI_Network*, const Vector3D*, float)>();
|
|
|
|
|
|
|
|
p_CAI_Network__CreateNodeLink = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 57 41 56 48 83 EC 20 49 63 E8");
|
|
|
|
v_CAI_Network__CreateNodeLink = p_CAI_Network__CreateNodeLink.RCast<CAI_NodeLink* (*)(CAI_Network*, int, int)>();
|
|
|
|
|
2022-12-01 22:44:55 +01:00
|
|
|
p_CAI_Network__DebugConnectMsg = g_GameDll.FindPatternSIMD("4C 89 4C 24 ?? 48 83 EC 18");
|
2023-08-24 23:44:57 +02:00
|
|
|
v_CAI_Network__DebugConnectMsg = p_CAI_Network__DebugConnectMsg.RCast<void (*)(int, int, const char*, ...)>();
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
2022-07-11 12:00:08 +02:00
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
2022-12-01 22:44:55 +01:00
|
|
|
g_pAINetwork = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 4C 63 91 ?? ?? ?? ??").FindPatternSelf("48 8B").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CAI_Network**>();
|
2022-07-11 12:00:08 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
2023-11-26 13:21:20 +01:00
|
|
|
virtual void Detour(const bool bAttach) const;
|
2022-04-03 03:10:48 +02:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|