BossZombiePlayerBot::ChooseVictim
0x00a790c0 · 1910 bytes · __thiscall
_ZN19BossZombiePlayerBot12ChooseVictimEP13CTerrorPlayeriP20CBaseCombatCharacter
Decompiled
undefined (4 params)
/* BossZombiePlayerBot::ChooseVictim(CTerrorPlayer*, int, CBaseCombatCharacter*) */
CTerrorPlayer * __thiscall
BossZombiePlayerBot::ChooseVictim
(BossZombiePlayerBot *this,CTerrorPlayer *param_1,int param_2,
CBaseCombatCharacter *param_3)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
int iVar7;
uint uVar8;
char cVar9;
bool bVar10;
char cVar11;
int *piVar12;
undefined4 *puVar13;
undefined4 uVar14;
Vector *pVVar15;
CTerrorPlayer *this_00;
CTerrorPlayer *pCVar16;
undefined *puVar17;
byte bVar18;
INextBot *this_01;
longdouble lVar19;
AllHumanSurvivorsAreIncapacitatedScan local_39;
undefined4 local_38;
undefined4 local_34;
undefined4 local_30;
CTerrorPlayer *local_2c;
undefined4 local_28;
CBaseCombatCharacter *local_24;
byte local_20;
undefined1 local_1f;
iVar7 = *(int *)(NextBotBlind._28_4_ + 0x30);
piVar12 = (int *)(**(code **)(*(int *)this + 0x9a0))(this);
if (((piVar12 != (int *)0x0) && (cVar9 = (**(code **)(*piVar12 + 0x16c))(piVar12), cVar9 != '\0'))
&& ((*(byte *)(piVar12 + 0x1001) & 1) != 0)) {
return (CTerrorPlayer *)0x0;
}
if (iVar7 != 0) {
return (CTerrorPlayer *)0x0;
}
if (this[0x4014] != (BossZombiePlayerBot)0x0) {
return (CTerrorPlayer *)0x0;
}
if ((0.0 < *(float *)(this + 0x4310)) &&
(lVar19 = (longdouble)CountdownTimer::Now(), (float)lVar19 < *(float *)(this + 0x4310))) {
return param_1;
}
lVar19 = (longdouble)CountdownTimer::Now();
if ((float)lVar19 + 0.3 != *(float *)(this + 0x4310)) {
(**(code **)(*(int *)(this + 0x4308) + 4))(this + 0x4308,this + 0x4310);
*(float *)(this + 0x4310) = (float)lVar19 + 0.3;
}
if (*(float *)(this + 0x430c) != 0.3) {
(**(code **)(*(int *)(this + 0x4308) + 4))(this + 0x4308,this + 0x430c);
*(undefined4 *)(this + 0x430c) = 0x3e99999a;
}
bVar10 = ForEachSurvivor<AllHumanSurvivorsAreIncapacitatedScan>(&local_39);
if ((param_2 & 1U) == 0) {
bVar18 = 1;
if (!bVar10) {
bVar18 = (byte)((uint)param_2 >> 2) & 1;
}
puVar13 = (undefined4 *)(**(code **)(*(int *)(this + 0x4028) + 0xd4))(this + 0x4028);
local_38 = *puVar13;
local_34 = puVar13[1];
local_30 = puVar13[2];
local_2c = (CTerrorPlayer *)0x0;
local_28 = 0x4cbebc20;
local_1f = 1;
local_24 = param_3;
local_20 = bVar18;
cVar9 = IsInCommentaryMode();
if (cVar9 == '\0') {
ForEachSurvivor<ClosestVisibleSurvivorScan>((ClosestVisibleSurvivorScan *)&local_38);
}
else {
ForEachSurvivorBot<ClosestVisibleSurvivorScan>((ClosestVisibleSurvivorScan *)&local_38);
}
}
else {
puVar13 = (undefined4 *)(**(code **)(*(int *)(this + 0x4028) + 0xd4))(this + 0x4028);
local_38 = *puVar13;
local_34 = puVar13[1];
local_30 = puVar13[2];
local_2c = (CTerrorPlayer *)0x0;
local_28 = 0x4cbebc20;
local_1f = 1;
local_24 = param_3;
local_20 = bVar10;
cVar9 = IsInCommentaryMode();
if (cVar9 == '\0') {
ForEachSurvivor<ClosestVisibleHelplessSurvivorScan>
((ClosestVisibleHelplessSurvivorScan *)&local_38);
}
else {
ForEachSurvivorBot<ClosestVisibleHelplessSurvivorScan>
((ClosestVisibleHelplessSurvivorScan *)&local_38);
}
}
this_01 = (INextBot *)(this + 0x4028);
pCVar16 = local_2c;
if (local_2c == (CTerrorPlayer *)0x0) {
cVar9 = IsInCommentaryMode();
if (cVar9 != '\0') {
return (CTerrorPlayer *)0x0;
}
if ((param_2 & 2U) != 0) {
return (CTerrorPlayer *)0x0;
}
pVVar15 = (Vector *)(**(code **)(*(int *)(this + 0x4028) + 0xd4))(this_01);
pCVar16 = (CTerrorPlayer *)
CDirectorTacticalServices::GetClosestSurvivor
(*(CDirectorTacticalServices **)(TheDirector + 0x628),pVVar15,false,false);
if (pCVar16 != (CTerrorPlayer *)0x0) goto LAB_00a7921b;
}
else {
LAB_00a7921b:
cVar9 = (**(code **)(*(int *)(this + 0x4028) + 0x11c))(this_01,pCVar16);
this_00 = pCVar16;
if (cVar9 == '\0') goto LAB_00a7924c;
}
if ((param_2 & 4U) == 0) {
pVVar15 = (Vector *)(**(code **)(*(int *)(this + 0x4028) + 0xd4))(this_01);
this_00 = (CTerrorPlayer *)
CDirectorTacticalServices::GetClosestSurvivor
(*(CDirectorTacticalServices **)(TheDirector + 0x628),pVVar15,true,false);
if ((this_00 != (CTerrorPlayer *)0x0) &&
((cVar9 = (**(code **)(*(int *)this_00 + 0x778))(this_00), cVar9 != '\0' || (!bVar10))))
goto LAB_00a7924c;
}
this_00 = pCVar16;
if (pCVar16 == (CTerrorPlayer *)0x0) {
return (CTerrorPlayer *)0x0;
}
LAB_00a7924c:
if ((param_1 != (CTerrorPlayer *)0x0) &&
(cVar9 = (**(code **)(*(int *)param_1 + 300))(param_1), cVar9 != '\0')) {
cVar9 = (**(code **)(*(int *)param_1 + 0x550))(param_1);
if ((cVar9 == '\0') && (param_1 != this_00)) {
cVar11 = (**(code **)(*(int *)param_1 + 0x7e8))(param_1);
cVar9 = '\x01';
if ((cVar11 == '\0') &&
((((uVar8 = *(uint *)(param_1 + 0x3e68), uVar8 == 0xffffffff ||
(puVar17 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar17 == (undefined *)0xfffffffc))
|| (*(uint *)(puVar17 + 8) != uVar8 >> 0xc)) || (*(int *)(puVar17 + 4) == 0)))) {
cVar11 = CTerrorPlayer::IsTongueVictim(param_1);
cVar9 = '\x01';
if ((cVar11 == '\0') && (cVar11 = CTerrorPlayer::IsPummelVictim(param_1), cVar11 == '\0')) {
cVar9 = CTerrorPlayer::IsJockeyVictim(param_1);
}
}
cVar11 = (**(code **)(*(int *)this_00 + 0x7e8))(this_00);
if ((cVar11 == '\0') &&
((((uVar8 = *(uint *)(this_00 + 0x3e68), uVar8 == 0xffffffff ||
(puVar17 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar17 == (undefined *)0xfffffffc))
|| ((*(uint *)(puVar17 + 8) != uVar8 >> 0xc || (*(int *)(puVar17 + 4) == 0)))) &&
((((cVar11 = CTerrorPlayer::IsTongueVictim(this_00), cVar11 == '\0' &&
(cVar11 = CTerrorPlayer::IsPummelVictim(this_00), cVar11 == '\0')) &&
(cVar11 = CTerrorPlayer::IsJockeyVictim(this_00), cVar11 == '\0')) &&
((cVar9 != '\0' &&
(cVar9 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar9 != '\0')))))))) {
cVar9 = INextBot::IsDebugging(this_01,1);
if (cVar9 == '\0') {
return this_00;
}
uVar14 = (**(code **)(*(int *)this + 0x9a4))(this);
DevMsg("%3.2f: %s switching to mobile victim\n",(double)*(float *)(gpGlobals + 0xc),uVar14);
param_1 = this_00;
}
else {
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_00);
}
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
fVar1 = *(float *)(this + 0x2e4);
fVar2 = *(float *)(this + 0x2e8);
fVar3 = *(float *)(this_00 + 0x2e4);
fVar4 = *(float *)(this_00 + 0x2e8);
fVar5 = *(float *)(this + 0x2e0);
fVar6 = *(float *)(this_00 + 0x2e0);
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
}
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
if (200.0 < SQRT((*(float *)(this + 0x2e0) - *(float *)(param_1 + 0x2e0)) *
(*(float *)(this + 0x2e0) - *(float *)(param_1 + 0x2e0)) +
(*(float *)(this + 0x2e8) - *(float *)(param_1 + 0x2e8)) *
(*(float *)(this + 0x2e8) - *(float *)(param_1 + 0x2e8)) +
(*(float *)(this + 0x2e4) - *(float *)(param_1 + 0x2e4)) *
(*(float *)(this + 0x2e4) - *(float *)(param_1 + 0x2e4))) -
SQRT((fVar2 - fVar4) * (fVar2 - fVar4) + (fVar1 - fVar3) * (fVar1 - fVar3) +
(fVar5 - fVar6) * (fVar5 - fVar6))) {
piVar12 = (int *)(**(code **)(*(int *)(this + 0x4028) + 0xcc))(this_01);
cVar9 = (**(code **)(*piVar12 + 0xd0))(piVar12,this_00,1,0);
if (cVar9 != '\0') {
cVar9 = INextBot::IsDebugging(this_01,1);
if (cVar9 != '\0') {
uVar14 = (**(code **)(*(int *)this + 0x9a4))(this);
DevMsg("%3.2f: %s switching to closer victim\n",(double)*(float *)(gpGlobals + 0xc),
uVar14);
return this_00;
}
return this_00;
}
}
piVar12 = (int *)(**(code **)(*(int *)(this + 0x4028) + 0xcc))(this_01);
cVar9 = (**(code **)(*piVar12 + 0xd0))(piVar12,this_00,1,0);
if (cVar9 != '\0') {
piVar12 = (int *)(**(code **)(*(int *)(this + 0x4028) + 0xcc))(this_01);
cVar9 = (**(code **)(*piVar12 + 0xd0))(piVar12,param_1,1,0);
if (cVar9 == '\0') {
cVar9 = INextBot::IsDebugging(this_01,1);
if (cVar9 == '\0') {
return this_00;
}
uVar14 = (**(code **)(*(int *)this + 0x9a4))(this);
DevMsg("%3.2f: %s switching to directly visible victim\n",
(double)*(float *)(gpGlobals + 0xc),uVar14);
param_1 = this_00;
}
}
}
}
return param_1;
}
return this_00;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.