SurvivorTeamSituation::GetPathToFriend
0x00966c60 · 3501 bytes · __thiscall
_ZNK21SurvivorTeamSituation15GetPathToFriendEP13CTerrorPlayer
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SurvivorTeamSituation::GetPathToFriend(CTerrorPlayer*) const */
INextBot * __thiscall
SurvivorTeamSituation::GetPathToFriend(SurvivorTeamSituation *this,CTerrorPlayer *param_1)
{
uint *puVar1;
CNavArea CVar2;
char cVar3;
bool bVar4;
int iVar5;
int *piVar6;
int iVar7;
CBaseEntity *pCVar8;
float *pfVar9;
undefined4 *puVar10;
Vector *pVVar11;
int *piVar12;
CNavArea *pCVar13;
CNavArea *pCVar14;
Path *this_00;
int iVar15;
INextBot *pIVar16;
SurvivorTeamSituation *pSVar17;
INextBot *pIVar18;
INextBot *pIVar19;
longdouble lVar20;
CNavArea *local_a4;
CNavArea *local_a0;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_94;
undefined4 local_90;
undefined4 local_8c;
undefined4 local_88;
undefined4 local_80;
undefined4 local_7c;
int local_78;
undefined4 local_74;
undefined4 local_70;
int local_6c;
undefined4 local_68;
undefined4 local_64;
undefined4 local_60;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
int local_48;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
undefined4 local_38;
undefined4 local_34;
undefined4 local_30;
undefined **local_2c;
int *local_28;
undefined4 local_24;
undefined1 local_20;
undefined1 local_1f;
local_9c = 0;
local_98 = 0;
if (_towlower == 0) {
local_78 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_9c,0,0,0,0,
"/data/src/game/server/terror/survivorbot/survivorteamsituation.cpp",0x1d1,
&GetPathToFriend(CTerrorPlayer*)::tm_fmt,"(%s)%s","NextBot",
"SurvivorTeamSituation::GetPathToFriend");
local_78 = _towlower;
}
iVar7 = _DAT_0105db00;
local_80 = local_9c;
local_7c = local_98;
/* try { // try from 00966de6 to 00966e46 has its CatchHandler @ 00967a79 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar5 = ThreadGetCurrentId(), iVar7 == iVar5)) {
if ((char *)*_DAT_0105d15c != "SurvivorTeamSituation::GetPathToFriend") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd0d3a0,(char *)0x0,0xca8906);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 00966d34 to 00966d39 has its CatchHandler @ 00967a65 */
/* try { // try from 00966e63 to 00967088 has its CatchHandler @ 00967a65 */
if (((param_1 == (CTerrorPlayer *)0x0) ||
(cVar3 = (**(code **)(*(int *)param_1 + 300))(param_1), cVar3 == '\0')) ||
(cVar3 = SurvivorBot::IsReachable(*(SurvivorBot **)(this + 4),param_1), cVar3 == '\0')) {
LAB_00966d42:
pIVar19 = (INextBot *)0x0;
goto LAB_00966d44;
}
local_2c = &PTR_operator___00d09770;
piVar12 = (int *)0x0;
if (*(int *)(this + 4) != 0) {
piVar12 = (int *)(*(int *)(this + 4) + 0x4028);
}
local_28 = piVar12;
local_24 = (**(code **)(*piVar12 + 0xc0))(piVar12);
piVar6 = (int *)(**(code **)(*piVar12 + 200))(piVar12);
iVar7 = (**(code **)(*piVar6 + 0xb8))(piVar6,piVar12);
local_20 = iVar7 != 0;
local_1f = 0;
iVar7 = *(int *)(this + 0xd6d0);
if (0 < iVar7) {
iVar5 = 0;
pIVar19 = (INextBot *)(this + 200);
do {
pCVar8 = (CBaseEntity *)(**(code **)(*(int *)pIVar19 + 0x1c))(pIVar19);
if (pCVar8 != (CBaseEntity *)0x0) {
if (*(int *)(pCVar8 + 0x30) == 0) {
iVar15 = 0;
iVar7 = *(int *)(param_1 + 0x30);
if (iVar7 != 0) goto LAB_00966ef5;
LAB_00966f40:
if (iVar15 != 0) goto LAB_00966f05;
}
else {
iVar15 = *(int *)(pCVar8 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
iVar7 = *(int *)(param_1 + 0x30);
if (iVar7 == 0) goto LAB_00966f40;
LAB_00966ef5:
if (iVar15 != iVar7 - *(int *)(gpGlobals + 0x58) >> 4) goto LAB_00966f05;
}
lVar20 = (longdouble)(**(code **)(*(int *)(this + iVar5 * 0x4758 + 200) + 0x28))(pIVar19);
if ((float)lVar20 <= 1.0) goto LAB_00966d44;
if (((byte)pCVar8[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar8);
}
pfVar9 = (float *)(**(code **)(*(int *)(this + iVar5 * 0x4758 + 200) + 0x18))(pIVar19);
if ((pfVar9[2] - *(float *)(pCVar8 + 0x2e8)) * (pfVar9[2] - *(float *)(pCVar8 + 0x2e8)) +
(pfVar9[1] - *(float *)(pCVar8 + 0x2e4)) * (pfVar9[1] - *(float *)(pCVar8 + 0x2e4)) +
(*pfVar9 - *(float *)(pCVar8 + 0x2e0)) * (*pfVar9 - *(float *)(pCVar8 + 0x2e0)) <=
10000.0) goto LAB_00966d44;
local_94 = 0;
local_90 = 0;
pIVar16 = (INextBot *)(*(int *)(this + 4) + 0x4028);
if (*(int *)(this + 4) == 0) {
pIVar16 = (INextBot *)0x0;
}
if (_towlower == 0) {
local_6c = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_94,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",
0x9c,&Path::
Compute<SurvivorBotPathCost>(INextBot*,CBaseCombatCharacter*,SurvivorBotPathCost&,float)
::tm_fmt,"(%s)%s","NextBot","Path::Compute(subject)");
local_6c = _towlower;
}
iVar7 = _DAT_0105db00;
local_74 = local_94;
local_70 = local_90;
/* try { // try from 009670bd to 009670c1 has its CatchHandler @ 00967a39 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar5 = ThreadGetCurrentId(), iVar7 == iVar5)) {
if ((char *)*_DAT_0105d15c != "Path::Compute(subject)") {
/* try { // try from 009679da to 009679fd has its CatchHandler @ 00967a39 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1d8,(char *)0x0,0xca8906);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 009670cf to 009672b1 has its CatchHandler @ 00967a69 */
(**(code **)(*(int *)pIVar19 + 0x48))(pIVar19);
puVar10 = (undefined4 *)(**(code **)(*(int *)pCVar8 + 0xc))(pCVar8);
*(undefined4 *)(pIVar19 + 0x4450) = *puVar10;
pVVar11 = (Vector *)(**(code **)(*(int *)pIVar16 + 0xd4))(pIVar16);
piVar12 = (int *)(**(code **)(*(int *)pIVar16 + 0xb4))(pIVar16);
pCVar13 = (CNavArea *)(**(code **)(*piVar12 + 0x52c))(piVar12);
if ((pCVar13 == (CNavArea *)0x0) ||
(pCVar14 = (CNavArea *)(**(code **)(*(int *)pCVar8 + 0x52c))(pCVar8),
pCVar14 == (CNavArea *)0x0)) goto LAB_0096782f;
if (((byte)pCVar8[0x14d] & 8) != 0) {
/* try { // try from 00967982 to 009679a4 has its CatchHandler @ 00967a69 */
CBaseEntity::CalcAbsolutePosition(pCVar8);
}
local_68 = *(undefined4 *)(pCVar8 + 0x2e0);
local_64 = *(undefined4 *)(pCVar8 + 0x2e4);
local_60 = *(undefined4 *)(pCVar8 + 0x2e8);
if (pCVar13 == pCVar14) goto LAB_0096798c;
pCVar8 = (CBaseEntity *)(**(code **)(*(int *)pIVar16 + 0xb4))(pIVar16);
if (((byte)pCVar8[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar8);
}
local_a4 = (CNavArea *)0x0;
local_5c = *(undefined4 *)(pCVar8 + 0x2e0);
local_58 = *(undefined4 *)(pCVar8 + 0x2e4);
local_54 = *(undefined4 *)(pCVar8 + 0x2e8);
pCVar8 = (CBaseEntity *)(**(code **)(*(int *)pIVar16 + 0xb4))(pIVar16);
iVar7 = CBaseEntity::GetTeamNumber(pCVar8);
bVar4 = NavAreaBuildPath<SurvivorBotPathCost>
(pCVar13,pCVar14,(Vector *)&local_5c,(Vector *)&local_68,
(SurvivorBotPathCost *)&local_2c,&local_a4,1500.0,iVar7,false);
if (local_a4 == (CNavArea *)0x0) goto LAB_009672b2;
if (pCVar13 == local_a4) goto LAB_0096798c;
iVar7 = 1;
pCVar14 = local_a4;
goto LAB_00967247;
}
LAB_00966f05:
iVar5 = iVar5 + 1;
pIVar19 = pIVar19 + 0x4758;
iVar7 = *(int *)(this + 0xd6d0);
} while (iVar5 < iVar7);
if (iVar7 == 3) goto LAB_00966d42;
}
local_8c = 0;
local_88 = 0;
pIVar19 = (INextBot *)0x0;
if (*(int *)(this + 4) != 0) {
pIVar19 = (INextBot *)(*(int *)(this + 4) + 0x4028);
}
iVar7 = iVar7 * 0x4758;
this_00 = (Path *)(this + iVar7 + 200);
if (_towlower == 0) {
local_48 = 0;
}
else {
/* try { // try from 009673ce to 009673d0 has its CatchHandler @ 00967a65 */
(**(code **)(_towlower + 0x50))
(_towlower,&local_8c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x9c,
&Path::
Compute<SurvivorBotPathCost>(INextBot*,CBaseCombatCharacter*,SurvivorBotPathCost&,float)
::tm_fmt,"(%s)%s","NextBot","Path::Compute(subject)");
local_48 = _towlower;
}
iVar5 = _DAT_0105db00;
local_50 = local_8c;
local_4c = local_88;
/* try { // try from 00967405 to 00967409 has its CatchHandler @ 00967a98 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar15 = ThreadGetCurrentId(), iVar5 == iVar15)) {
if ((char *)*_DAT_0105d15c != "Path::Compute(subject)") {
/* try { // try from 00967944 to 00967967 has its CatchHandler @ 00967a98 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1d8,(char *)0x0,0xca8906);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 00967424 to 009676b0 has its CatchHandler @ 00967a7d */
(**(code **)(*(int *)(this + iVar7 + 200) + 0x48))(this_00);
puVar10 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
*(undefined4 *)(this + iVar7 + 0x4518) = *puVar10;
pVVar11 = (Vector *)(**(code **)(*(int *)pIVar19 + 0xd4))(pIVar19);
piVar12 = (int *)(**(code **)(*(int *)pIVar19 + 0xb4))(pIVar19);
pCVar13 = (CNavArea *)(**(code **)(*piVar12 + 0x52c))(piVar12);
if ((pCVar13 == (CNavArea *)0x0) ||
(pCVar14 = (CNavArea *)(**(code **)(*(int *)param_1 + 0x52c))(param_1),
pCVar14 == (CNavArea *)0x0)) {
(**(code **)(*(int *)(this + iVar7 + 200) + 100))(this_00,pIVar19,2);
}
else {
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
}
local_44 = *(undefined4 *)(param_1 + 0x2e0);
local_40 = *(undefined4 *)(param_1 + 0x2e4);
local_3c = *(undefined4 *)(param_1 + 0x2e8);
if (pCVar13 == pCVar14) {
LAB_009678c7:
Path::BuildTrivialPath(this_00,pIVar19,(Vector *)&local_44);
}
else {
pCVar8 = (CBaseEntity *)(**(code **)(*(int *)pIVar19 + 0xb4))(pIVar19);
if (((byte)pCVar8[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar8);
}
local_a0 = (CNavArea *)0x0;
local_38 = *(undefined4 *)(pCVar8 + 0x2e0);
local_34 = *(undefined4 *)(pCVar8 + 0x2e4);
local_30 = *(undefined4 *)(pCVar8 + 0x2e8);
pCVar8 = (CBaseEntity *)(**(code **)(*(int *)pIVar19 + 0xb4))(pIVar19);
iVar5 = CBaseEntity::GetTeamNumber(pCVar8);
bVar4 = NavAreaBuildPath<SurvivorBotPathCost>
(pCVar13,pCVar14,(Vector *)&local_38,(Vector *)&local_44,
(SurvivorBotPathCost *)&local_2c,&local_a0,1500.0,iVar5,false);
if (local_a0 != (CNavArea *)0x0) {
if (pCVar13 == local_a0) goto LAB_009678c7;
iVar5 = 1;
pCVar14 = local_a0;
do {
pCVar14 = *(CNavArea **)(pCVar14 + 0x78);
if (pCVar14 == (CNavArea *)0x0) break;
iVar5 = iVar5 + 1;
} while (pCVar13 != pCVar14);
if (iVar5 < 0x100) {
if (iVar5 == 1) goto LAB_009678c7;
}
else {
iVar5 = 0xff;
}
*(int *)(this + iVar7 + 0x44cc) = iVar5;
pCVar13 = local_a0;
iVar15 = iVar5;
pSVar17 = this + (iVar5 + -1) * 0x44 + iVar7 + 0xcc;
do {
*(CNavArea **)pSVar17 = pCVar13;
iVar15 = iVar15 + -1;
CVar2 = pCVar13[0x7c];
*(undefined4 *)(pSVar17 + 0x18) = 0;
*(uint *)(pSVar17 + 4) = (byte)CVar2 & 0xf;
pCVar13 = *(CNavArea **)(pCVar13 + 0x78);
if (pCVar13 == (CNavArea *)0x0) break;
pSVar17 = pSVar17 + -0x44;
} while (iVar15 != 0);
*(undefined4 *)(this_00 + iVar5 * 0x44 + 0xc) = local_44;
*(CNavArea **)(this_00 + iVar5 * 0x44 + 4) = local_a0;
*(undefined4 *)(this_00 + iVar5 * 0x44 + 0x10) = local_40;
*(undefined4 *)(this_00 + iVar5 * 0x44 + 0x14) = local_3c;
iVar5 = *(int *)(this + iVar7 + 0x44cc);
*(undefined4 *)(this_00 + iVar5 * 0x44 + 0x18) = 0;
*(undefined4 *)(this_00 + iVar5 * 0x44 + 8) = 9;
*(undefined4 *)(this_00 + iVar5 * 0x44 + 0x1c) = 0;
*(int *)(this + iVar7 + 0x44cc) = iVar5 + 1;
cVar3 = Path::ComputePathDetails(this_00,pIVar19,pVVar11);
if (cVar3 == '\0') {
(**(code **)(*(int *)(this + iVar7 + 200) + 0x48))(this_00);
(**(code **)(*(int *)(this + iVar7 + 200) + 100))(this_00,pIVar19,2);
}
else {
/* try { // try from 0096785b to 009678df has its CatchHandler @ 00967a7d */
Path::Optimize((INextBot *)this_00);
Path::PostProcess(this_00);
(**(code **)(*(int *)(this + iVar7 + 200) + 100))(this_00,pIVar19,!bVar4);
}
}
}
}
iVar7 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar7 == iVar5)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_48 != 0) {
(**(code **)(local_48 + 0x54))(local_48,local_50,local_4c,0,0,0);
}
iVar7 = *(int *)(this + 0xd6d0);
*(int *)(this + 0xd6d0) = iVar7 + 1;
pIVar19 = (INextBot *)(this + iVar7 * 0x4758 + 200);
goto LAB_00966d44;
while (iVar7 = iVar7 + 1, pCVar13 != pCVar14) {
LAB_00967247:
pCVar14 = *(CNavArea **)(pCVar14 + 0x78);
if (pCVar14 == (CNavArea *)0x0) break;
}
if (iVar7 < 0x100) {
if (iVar7 != 1) {
*(int *)(pIVar19 + 0x4404) = iVar7;
goto LAB_00967755;
}
LAB_0096798c:
Path::BuildTrivialPath((Path *)pIVar19,pIVar16,(Vector *)&local_68);
}
else {
*(undefined4 *)(pIVar19 + 0x4404) = 0xff;
iVar7 = 0xff;
LAB_00967755:
pCVar13 = local_a4;
iVar5 = iVar7;
pIVar18 = pIVar19 + (iVar7 + -1) * 0x44 + 4;
do {
*(CNavArea **)pIVar18 = pCVar13;
iVar5 = iVar5 + -1;
CVar2 = pCVar13[0x7c];
*(undefined4 *)(pIVar18 + 0x18) = 0;
*(uint *)(pIVar18 + 4) = (byte)CVar2 & 0xf;
pCVar13 = *(CNavArea **)(pCVar13 + 0x78);
if (pCVar13 == (CNavArea *)0x0) break;
pIVar18 = pIVar18 + -0x44;
} while (iVar5 != 0);
*(undefined4 *)(pIVar19 + iVar7 * 0x44 + 0xc) = local_68;
*(CNavArea **)(pIVar19 + iVar7 * 0x44 + 4) = local_a4;
*(undefined4 *)(pIVar19 + iVar7 * 0x44 + 0x10) = local_64;
*(undefined4 *)(pIVar19 + iVar7 * 0x44 + 0x14) = local_60;
iVar7 = *(int *)(pIVar19 + 0x4404);
*(undefined4 *)(pIVar19 + iVar7 * 0x44 + 0x18) = 0;
*(undefined4 *)(pIVar19 + iVar7 * 0x44 + 8) = 9;
*(undefined4 *)(pIVar19 + iVar7 * 0x44 + 0x1c) = 0;
*(int *)(pIVar19 + 0x4404) = iVar7 + 1;
/* try { // try from 0096781a to 00967848 has its CatchHandler @ 00967a69 */
cVar3 = Path::ComputePathDetails((Path *)pIVar19,pIVar16,pVVar11);
if (cVar3 == '\0') {
(**(code **)(*(int *)pIVar19 + 0x48))(pIVar19);
LAB_0096782f:
(**(code **)(*(int *)pIVar19 + 100))(pIVar19,pIVar16,2);
}
else {
Path::Optimize(pIVar19);
Path::PostProcess((Path *)pIVar19);
(**(code **)(*(int *)pIVar19 + 100))(pIVar19,pIVar16,!bVar4);
}
}
LAB_009672b2:
iVar7 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar7 == iVar5)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_6c != 0) {
(**(code **)(local_6c + 0x54))(local_6c,local_74,local_70,0,0,0);
}
LAB_00966d44:
iVar7 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar7 == iVar5)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_78 != 0) {
(**(code **)(local_78 + 0x54))(local_78,local_80,local_7c,0,0,0);
}
return pIVar19;
}
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.