CNavArea::ConnectTo
0x006fcdb0 · 858 bytes · __thiscall
_ZN8CNavArea9ConnectToEPS_10NavDirType
Decompiled
undefined (3 params)
/* CNavArea::ConnectTo(CNavArea*, NavDirType) */
void __thiscall CNavArea::ConnectTo(CNavArea *this,CNavArea *param_1,uint param_3)
{
size_t __size;
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
int iVar7;
int iVar8;
int *piVar9;
void *pvVar10;
undefined4 *puVar11;
int iVar12;
longdouble lVar13;
longdouble lVar14;
int local_30;
float local_2c;
undefined1 local_28 [24];
if (param_1 != this) {
iVar12 = param_3 * 4;
piVar9 = *(int **)(this + iVar12 + 0x58);
if (*piVar9 < 1) {
LAB_006fcdf9:
lVar13 = (longdouble)GetZDeltaAtEdgeToArea(this,param_1);
lVar14 = (longdouble)GetZDeltaAtEdgeToArea(param_1,this);
if (((float)lVar14 < -180.0) || (180.0 < (float)lVar13)) {
Warning(
"Error: Nav areas are too far apart vertically to connect! Max climb distance is 180!\n"
);
return;
}
ComputePortal(this,param_1,param_3,local_28,&local_2c);
if (local_2c < 1.0) {
DevWarning("Tried to connect a bad corner connection.. get Brian!\n");
}
else {
fVar1 = *(float *)(param_1 + 0x2c);
fVar2 = *(float *)(param_1 + 0x30);
fVar3 = *(float *)(this + 0x2c);
fVar4 = *(float *)(this + 0x30);
fVar5 = *(float *)(param_1 + 0x34);
piVar9 = *(int **)(this + iVar12 + 0x58);
fVar6 = *(float *)(this + 0x34);
iVar7 = *piVar9;
if ((CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData == '\0') &&
(iVar8 = __cxa_guard_acquire(&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData), iVar8 != 0)) {
__cxa_guard_release(&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData);
}
if (piVar9 == &CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData) {
puVar11 = malloc((iVar7 + 1) * 8 + 4);
*(undefined4 **)(this + iVar12 + 0x58) = puVar11;
*puVar11 = 0;
pvVar10 = *(void **)(this + iVar12 + 0x58);
}
else {
__size = (iVar7 + 1) * 8 + 4;
iVar8 = malloc_usable_size(*(undefined4 *)(this + iVar12 + 0x58));
if (iVar8 < (int)__size) {
pvVar10 = realloc(*(void **)(this + iVar12 + 0x58),__size);
*(void **)(this + iVar12 + 0x58) = pvVar10;
}
else {
pvVar10 = *(void **)(this + iVar12 + 0x58);
}
}
*(CNavArea **)((int)pvVar10 + iVar7 * 8 + 4) = param_1;
*(float *)((int)pvVar10 + iVar7 * 8 + 8) =
SQRT((fVar1 - fVar3) * (fVar1 - fVar3) + (fVar2 - fVar4) * (fVar2 - fVar4) +
(fVar5 - fVar6) * (fVar5 - fVar6));
**(int **)(this + iVar12 + 0x58) = **(int **)(this + iVar12 + 0x58) + 1;
iVar12 = param_3 * 4;
piVar9 = *(int **)(this + iVar12 + 0x114);
iVar7 = *piVar9;
if (0 < iVar7) {
if (param_1 == (CNavArea *)piVar9[1]) {
local_30 = 0;
}
else {
local_30 = 0;
do {
local_30 = local_30 + 1;
if (local_30 == iVar7) goto LAB_006fcf59;
} while (param_1 != (CNavArea *)piVar9[local_30 * 2 + 1]);
}
iVar8 = (iVar7 - local_30) + -1;
if (0 < iVar8) {
_V_memmove(piVar9 + local_30 * 2 + 1,piVar9 + local_30 * 2 + 3,iVar8 * 8);
piVar9 = *(int **)(this + iVar12 + 0x114);
iVar7 = *piVar9;
}
*piVar9 = iVar7 + -1;
if (**(int **)(this + iVar12 + 0x114) == 0) {
free(*(int **)(this + iVar12 + 0x114));
if ((CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData == '\0') &&
(iVar7 = __cxa_guard_acquire(&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData), iVar7 != 0)) {
__cxa_guard_release(&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData);
}
*(undefined4 **)(this + iVar12 + 0x114) =
&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData;
}
}
LAB_006fcf59:
if (param_3 < 4) {
iVar12 = (&CSWTCH_1821)[param_3];
}
else {
iVar12 = 0;
}
piVar9 = *(int **)(param_1 + iVar12 * 4 + 0x58);
if (0 < *piVar9) {
if (this == (CNavArea *)piVar9[1]) {
return;
}
iVar7 = 0;
do {
iVar7 = iVar7 + 1;
if (iVar7 == *piVar9) goto LAB_006fcf91;
} while (this != (CNavArea *)piVar9[iVar7 * 2 + 1]);
if (iVar7 != -1) {
return;
}
}
LAB_006fcf91:
AddIncomingConnection(param_1,this,iVar12);
}
}
else if (param_1 != (CNavArea *)piVar9[1]) {
iVar7 = 0;
do {
iVar7 = iVar7 + 1;
if (iVar7 == *piVar9) goto LAB_006fcdf9;
} while (param_1 != (CNavArea *)piVar9[iVar7 * 2 + 1]);
}
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.