SurvivorLegsRetreat::Update
0x00959ad0 · 2259 bytes · __thiscall
_ZN19SurvivorLegsRetreat6UpdateEP11SurvivorBotf
Decompiled
undefined (3 params)
/* SurvivorLegsRetreat::Update(SurvivorBot*, float) */
SurvivorLegsRetreat * __thiscall
SurvivorLegsRetreat::Update(SurvivorLegsRetreat *this,SurvivorBot *param_1,float param_2)
{
uint uVar1;
int *piVar2;
uint *puVar3;
code *pcVar4;
char cVar5;
int *piVar6;
int iVar7;
undefined4 *puVar8;
CBaseEntity *pCVar9;
undefined4 uVar10;
undefined *puVar11;
int iVar12;
CBaseEntity *this_00;
int in_GS_OFFSET;
longdouble lVar13;
float fVar14;
float fVar15;
float fVar16;
undefined4 local_154;
PathFollower *local_148;
INextBot *local_144;
CAI_Concept local_134 [8];
CFmtStrN<256> local_12c;
undefined1 local_12b;
undefined1 local_12a;
undefined1 local_129;
undefined1 local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9ac))(param_2);
uVar1 = *(uint *)(param_1 + 0x4820);
if ((((uVar1 == 0xffffffff) ||
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar11 + 8) != uVar1 >> 0xc)) ||
((piVar2 = *(int **)(puVar11 + 4), piVar2 == (int *)0x0 ||
(cVar5 = (**(code **)(*piVar2 + 300))(piVar2), cVar5 == '\0')))) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Threat is gone";
goto LAB_00959b4a;
}
pCVar9 = (CBaseEntity *)0x0;
uVar1 = *(uint *)(param_1 + 0x4820);
if ((uVar1 != 0xffffffff) &&
((puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)))) {
pCVar9 = *(CBaseEntity **)(puVar11 + 4);
}
this_00 = (CBaseEntity *)0x0;
lVar13 = (longdouble)SurvivorBot::GetAvoidRange((SurvivorBot *)param_2,pCVar9);
uVar1 = *(uint *)(param_1 + 0x4820);
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
this_00 = *(CBaseEntity **)(puVar11 + 4);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if ((*(byte *)((int)param_2 + 0x14d) & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
}
fVar16 = *(float *)((int)param_2 + 0x2e4) - *(float *)(this_00 + 0x2e4);
fVar14 = *(float *)((int)param_2 + 0x2e8) - *(float *)(this_00 + 0x2e8);
fVar15 = *(float *)((int)param_2 + 0x2e0) - *(float *)(this_00 + 0x2e0);
if ((float)lVar13 * 1.5 * (float)lVar13 * 1.5 <
fVar14 * fVar14 + fVar16 * fVar16 + fVar15 * fVar15) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Retreated a safe distance";
goto LAB_00959b4a;
}
uVar10 = 0;
uVar1 = *(uint *)(param_1 + 0x4820);
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
uVar10 = *(undefined4 *)(puVar11 + 4);
}
cVar5 = (**(code **)(*piVar6 + 0xd0))(piVar6,uVar10,1,0);
if (cVar5 == '\0') {
lVar13 = (longdouble)IntervalTimer::Now();
if (1.0 < (float)lVar13 - *(float *)(param_1 + 0x4828)) {
uVar1 = *(uint *)(param_1 + 0x4820);
if (((uVar1 == 0xffffffff) ||
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar11 + 8) != uVar1 >> 0xc)) {
pCVar9 = (CBaseEntity *)0x0;
}
else {
pCVar9 = *(CBaseEntity **)(puVar11 + 4);
}
uVar10 = DescribeSubject(pCVar9);
CFmtStrN<256>::CFmtStrN(&local_12c,"Subject:%s",uVar10);
pcVar4 = *(code **)(*(int *)param_2 + 0x7b4);
CAI_Concept::CAI_Concept(local_134,"SurvivorBotRetreatedOutOfSight");
(*pcVar4)(param_2,local_134,1,local_127,0,0,0);
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Retreated out of sight of threat";
goto LAB_00959b4a;
}
}
else {
lVar13 = (longdouble)IntervalTimer::Now();
if ((float)lVar13 != *(float *)(param_1 + 0x4828)) {
(**(code **)(*(int *)(param_1 + 0x4824) + 4))(param_1 + 0x4824,param_1 + 0x4828);
*(float *)(param_1 + 0x4828) = (float)lVar13;
}
}
iVar7 = (**(code **)(*(int *)param_2 + 0x9a8))(param_2);
if (0 < *(int *)(iVar7 + 0x70)) {
puVar3 = *(uint **)(iVar7 + 100);
uVar1 = *puVar3;
if ((((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar11 + 4) != 0)) {
iVar7 = *(int *)(*(int *)(puVar11 + 4) + 0x30);
if (iVar7 == 0) {
iVar7 = 0;
}
else {
iVar7 = iVar7 - *(int *)(gpGlobals + 0x58) >> 4;
}
local_148 = (PathFollower *)0x0;
uVar1 = *(uint *)(param_1 + 0x4820);
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
local_148 = *(PathFollower **)(puVar11 + 4);
}
if (*(int *)((int)local_148 + 0x30) == 0) {
iVar12 = 0;
}
else {
iVar12 = *(int *)((int)local_148 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
if (iVar7 != iVar12) {
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a8))(param_2);
local_148 = (PathFollower *)0x0;
uVar1 = *puVar3;
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
local_148 = *(PathFollower **)(puVar11 + 4);
}
local_154 = 0;
uVar1 = *(uint *)(param_1 + 0x4820);
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
local_154 = *(undefined4 *)(puVar11 + 4);
}
iVar7 = 0;
iVar12 = (**(code **)(*piVar6 + 0xcc))
(piVar6,(INextBot *)((int)param_2 + 0x4028),param_2,local_154,local_148);
uVar1 = *puVar3;
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
iVar7 = *(int *)(puVar11 + 4);
}
if (iVar12 == iVar7) {
cVar5 = INextBot::IsDebugging((INextBot *)((int)param_2 + 0x4028),1);
if (cVar5 != '\0') {
uVar10 = (**(code **)(*(int *)param_2 + 0xb8))(param_2);
local_12c = (CFmtStrN<256>)0xff;
local_12b = 0xff;
local_12a = 0;
local_129 = 0xff;
ConColorMsg(&local_12c,"%3.2f: %s: Changing retreat threat to more dangerous one\n",
(double)*(float *)(gpGlobals + 0xc),uVar10);
}
uVar1 = *puVar3;
if (((uVar1 == 0xffffffff) ||
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)
) || ((*(uint *)(puVar11 + 8) != uVar1 >> 0xc ||
(piVar6 = *(int **)(puVar11 + 4), piVar6 == (int *)0x0)))) {
*(undefined4 *)(param_1 + 0x4820) = 0xffffffff;
}
else {
puVar8 = (undefined4 *)(**(code **)(*piVar6 + 0xc))(piVar6);
*(undefined4 *)(param_1 + 0x4820) = *puVar8;
}
PathFollower::Invalidate((PathFollower *)(param_1 + 0x34));
}
}
}
}
local_144 = (INextBot *)((int)param_2 + 0x4028);
local_148 = (PathFollower *)(param_1 + 0x34);
if (*(int *)(param_1 + 0x4438) < 1) {
LAB_0095a030:
ComputePath((SurvivorLegsRetreat *)param_1,(SurvivorBot *)param_2);
uVar1 = *(uint *)(param_1 + 0x4820);
pCVar9 = (CBaseEntity *)0x0;
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
pCVar9 = *(CBaseEntity **)(puVar11 + 4);
}
if (((byte)pCVar9[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar9);
}
*(undefined4 *)(param_1 + 0x4814) = *(undefined4 *)(pCVar9 + 0x2e0);
*(undefined4 *)(param_1 + 0x4818) = *(undefined4 *)(pCVar9 + 0x2e4);
*(undefined4 *)(param_1 + 0x481c) = *(undefined4 *)(pCVar9 + 0x2e8);
}
else {
pCVar9 = (CBaseEntity *)0x0;
uVar1 = *(uint *)(param_1 + 0x4820);
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
pCVar9 = *(CBaseEntity **)(puVar11 + 4);
}
if (((byte)pCVar9[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar9);
}
if (2500.0 < (*(float *)(pCVar9 + 0x2e4) - *(float *)(param_1 + 0x4818)) *
(*(float *)(pCVar9 + 0x2e4) - *(float *)(param_1 + 0x4818)) +
(*(float *)(pCVar9 + 0x2e0) - *(float *)(param_1 + 0x4814)) *
(*(float *)(pCVar9 + 0x2e0) - *(float *)(param_1 + 0x4814)) +
(*(float *)(pCVar9 + 0x2e8) - *(float *)(param_1 + 0x481c)) *
(*(float *)(pCVar9 + 0x2e8) - *(float *)(param_1 + 0x481c))) goto LAB_0095a030;
}
PathFollower::Update(local_148,local_144);
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
LAB_00959b4a:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return this;
}
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.