mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fixed writing of: - Path nodes - Node links - Path clusters - Cluster links The previous globals 'g_pppAiNodeClusters' and 'g_pppAiNodeClusterLinks' were of type CUtlVector. These have been retyped and renamed accordingly. Also mapped the CAI_Cluster class out slightly more. Rebuild of path clusters and cluster links are still not correct; parsing a file in from r2, results in a different file on the disk, at the very offset the clusters are being written in (one field is off, this will be investigated soon).
141 lines
4.0 KiB
C++
141 lines
4.0 KiB
C++
//=============================================================================//
|
|
//
|
|
// Purpose:
|
|
//
|
|
//=============================================================================//
|
|
#pragma once
|
|
#include "mathlib/vector.h"
|
|
constexpr int MAX_HULLS = 5;
|
|
|
|
constexpr int NOT_CACHED = -2; // Returned if data not in cache
|
|
constexpr int NO_NODE = -1; // Returned when no node meets the qualification
|
|
|
|
#pragma pack(push, 1)
|
|
//=============================================================================
|
|
// >> CAI_NodeLink
|
|
//=============================================================================
|
|
struct CAI_NodeLink
|
|
{
|
|
short m_iSrcID;
|
|
short m_iDestID;
|
|
bool m_bHulls[MAX_HULLS];
|
|
char unk0;
|
|
char unk1; // maps => unk0 on disk
|
|
char unk2[5];
|
|
int64_t m_nFlags;
|
|
};
|
|
|
|
//=============================================================================
|
|
// >> CAI_NodeLinkDisk
|
|
//=============================================================================
|
|
struct CAI_NodeLinkDisk
|
|
{
|
|
short m_iSrcID;
|
|
short m_iDestID;
|
|
char unk0;
|
|
bool m_bHulls[MAX_HULLS];
|
|
};
|
|
|
|
//=============================================================================
|
|
// >> CAI_Node
|
|
//=============================================================================
|
|
struct CAI_Node
|
|
{
|
|
int m_nIndex; // Not present on disk
|
|
Vector3D m_vOrigin;
|
|
float m_fHulls[MAX_HULLS];
|
|
float m_flYaw;
|
|
|
|
int unk0; // Always 2 in buildainfile, maps directly to unk0 in disk struct
|
|
int unk1; // Maps directly to unk1 in disk struct
|
|
int unk2[MAX_HULLS]; // Maps directly to unk2 in disk struct, despite being ints rather than shorts
|
|
|
|
// View server.dll+393672 for context
|
|
char unk3[MAX_HULLS]; // Should map to unk3 on disk
|
|
char pad[3]; // Aligns next bytes
|
|
float unk4[MAX_HULLS]; // I have no clue, calculated using some kind float function magic
|
|
|
|
CAI_NodeLink** links;
|
|
char unk5[16];
|
|
int m_nNumLinks;
|
|
int unk11; // Bad name lmao
|
|
short unk6; // Should match up to unk4 on disk
|
|
char unk7[16]; // Padding until next bit
|
|
short unk8; // Should match up to unk5 on disk
|
|
char unk9[8]; // Padding until next bit
|
|
char unk10[8]; // Should match up to unk6 on disk
|
|
};
|
|
|
|
//=============================================================================
|
|
// >> CAI_NodeDisk
|
|
//=============================================================================
|
|
struct CAI_NodeDisk // The way CAI_Nodes are represented in on-disk ain files
|
|
{
|
|
Vector3D m_vOrigin;
|
|
|
|
float m_flYaw;
|
|
float hulls[MAX_HULLS];
|
|
|
|
char unk0;
|
|
int unk1;
|
|
short unk2[MAX_HULLS];
|
|
char unk3[MAX_HULLS];
|
|
short unk4;
|
|
short unk5;
|
|
char unk6[8];
|
|
};
|
|
static_assert(sizeof(CAI_NodeDisk) == 68);
|
|
|
|
//=============================================================================
|
|
// >> CAI_ScriptNode
|
|
//=============================================================================
|
|
struct CAI_ScriptNode
|
|
{
|
|
Vector3D m_vOrigin;
|
|
uint64_t scriptdata;
|
|
};
|
|
#pragma pack(pop)
|
|
|
|
//=============================================================================
|
|
// >> CAI_Cluster
|
|
//=============================================================================
|
|
struct CAI_Cluster
|
|
{
|
|
int m_nIndex;
|
|
char unk0;
|
|
char unk1; // Maps to unk1 on disk
|
|
|
|
Vector3D m_vOrigin;
|
|
char unkC; // idk, might be a 4 bytes type or just padding.
|
|
|
|
// These are utlvectors in engine, but its
|
|
// unknown what they do yet.
|
|
CUtlVector<int> unkVec0;
|
|
CUtlVector<int> unkVec1;
|
|
|
|
// This is an array of floats that is indexed
|
|
// into by teamNum at [r5apex_ds.exe + EC84DC];
|
|
// Seems to be used along with the cvar:
|
|
// 'ai_path_dangerous_cluster_min_time'.
|
|
float clusterTime[MAX_TEAMS];
|
|
|
|
float field_0250;
|
|
float field_0254;
|
|
float field_0258;
|
|
char unk5;
|
|
};
|
|
static_assert(sizeof(CAI_Cluster) == 608);
|
|
|
|
//=============================================================================
|
|
// >> CAI_ClusterLink
|
|
//=============================================================================
|
|
struct CAI_ClusterLink
|
|
{
|
|
short prevIndex_MAYBE;
|
|
short nextIndex_MAYBE;
|
|
int unk2;
|
|
char flags;
|
|
char unk4;
|
|
char unk5;
|
|
};
|
|
static_assert(sizeof(CAI_ClusterLink) == 12); |