SurvivorBehavior::OnSpokeConcept
0x009284f0 · 2743 bytes · __thiscall
_ZN16SurvivorBehavior14OnSpokeConceptEP11SurvivorBotP20CBaseCombatCharacter11CAI_ConceptP11AI_Response
Decompiled
undefined (5 params)
/* SurvivorBehavior::OnSpokeConcept(SurvivorBot*, CBaseCombatCharacter*, CAI_Concept, AI_Response*)
*/
void __thiscall
SurvivorBehavior::OnSpokeConcept
(SurvivorBehavior *this,int param_1,SurvivorBot *param_2,CBaseEntity *param_4,
CAI_Concept *param_5)
{
int iVar1;
char cVar2;
char *pcVar3;
int iVar4;
uint uVar5;
CBaseEntity *pCVar6;
CBaseCombatCharacter *pCVar7;
SurvivorIntention *this_00;
int *piVar8;
int iVar9;
int *piVar10;
undefined4 uVar11;
undefined4 *puVar12;
code *pcVar13;
int in_GS_OFFSET;
longdouble lVar14;
float fVar15;
int *local_15c;
float local_148;
CAI_Concept local_134 [8];
CFmtStrN<256> local_12c [5];
undefined1 local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5);
if ((pcVar3 == "PlayerAskReady") || (iVar4 = _V_stricmp(pcVar3,"PlayerAskReady"), iVar4 == 0)) {
DescribeSubject(param_4);
CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s");
pcVar13 = *(code **)(*(int *)param_2 + 0x7b4);
pcVar3 = "SurvivorBotYesReady";
LAB_0092858e:
CAI_Concept::CAI_Concept(local_134,pcVar3);
(*pcVar13)(param_2,local_134,1,local_127,0,0,0);
}
else {
pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5);
if ((pcVar3 == "PlayerHurrah") || (iVar4 = _V_stricmp(pcVar3,"PlayerHurrah"), iVar4 == 0)) {
DescribeSubject(param_4);
CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s");
pcVar13 = *(code **)(*(int *)param_2 + 0x7b4);
pcVar3 = "SurvivorBotHurrahAlso";
goto LAB_0092858e;
}
pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5);
if ((pcVar3 == "PlayerWarnWitch") || (iVar4 = _V_stricmp(pcVar3,"PlayerWarnWitch"), iVar4 == 0))
{
if (((byte)param_2[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
}
iVar4 = TheNextBots();
uVar5 = (uint)*(ushort *)(iVar4 + 0x10);
if (uVar5 != 0xffff) {
local_15c = (int *)0x0;
iVar9 = *(int *)(iVar4 + 4);
local_148 = 3.4028235e+38;
do {
while( true ) {
iVar1 = uVar5 * 8;
piVar10 = *(int **)(iVar9 + uVar5 * 8);
pCVar6 = (CBaseEntity *)(**(code **)(*piVar10 + 0xb4))(piVar10);
if (((byte)pCVar6[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar6);
}
fVar15 = (*(float *)(pCVar6 + 0x2e4) - *(float *)(param_2 + 0x2e4)) *
(*(float *)(pCVar6 + 0x2e4) - *(float *)(param_2 + 0x2e4)) +
(*(float *)(pCVar6 + 0x2e8) - *(float *)(param_2 + 0x2e8)) *
(*(float *)(pCVar6 + 0x2e8) - *(float *)(param_2 + 0x2e8)) +
(*(float *)(pCVar6 + 0x2e0) - *(float *)(param_2 + 0x2e0)) *
(*(float *)(pCVar6 + 0x2e0) - *(float *)(param_2 + 0x2e0));
if (fVar15 < local_148) break;
LAB_00928c41:
iVar9 = *(int *)(iVar4 + 4);
uVar5 = (uint)*(ushort *)(iVar1 + iVar9 + 6);
if (uVar5 == 0xffff) goto LAB_00928d50;
}
piVar10 = *(int **)(*(int *)(iVar4 + 4) + iVar1);
piVar8 = (int *)(**(code **)(*piVar10 + 0xb4))(piVar10);
iVar9 = (**(code **)(*piVar8 + 0x144))(piVar8);
if (iVar9 == 0) goto LAB_00928c41;
piVar10 = (int *)(**(code **)(*piVar10 + 0xb4))(piVar10);
pCVar6 = (CBaseEntity *)(**(code **)(*piVar10 + 0x144))(piVar10);
iVar9 = CBaseEntity::GetTeamNumber(pCVar6);
if ((iVar9 != 3) || (iVar9 = (**(code **)(*(int *)pCVar6 + 0x544))(pCVar6), iVar9 != 7))
goto LAB_00928c41;
iVar9 = *(int *)(iVar4 + 4);
local_15c = *(int **)(iVar1 + iVar9);
uVar5 = (uint)*(ushort *)((int)(iVar1 + iVar9) + 6);
local_148 = fVar15;
} while (uVar5 != 0xffff);
LAB_00928d50:
if (local_15c != (int *)0x0) {
LAB_00928d5e:
pCVar7 = (CBaseCombatCharacter *)(**(code **)(*local_15c + 0xb4))(local_15c);
this_00 = (SurvivorIntention *)(**(code **)(*(int *)param_2 + 0x9a8))(param_2);
SurvivorIntention::AddThreat(this_00,pCVar7);
goto LAB_009285cf;
}
}
cVar2 = INextBot::IsDebugging((INextBot *)(param_2 + 0x4028),0x100);
if (cVar2 != '\0') {
uVar11 = (**(code **)(*(int *)param_2 + 0x9b8))(param_2);
DevMsg("%3.2f: %s: Someone called out \'witch\', but there is no Witch!\n",
(double)*(float *)(gpGlobals + 0xc),uVar11);
}
}
else {
pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5);
if ((pcVar3 == "PlayerWarnTank") || (iVar4 = _V_stricmp(pcVar3,"PlayerWarnTank"), iVar4 == 0))
{
if (((byte)param_2[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
}
iVar4 = TheNextBots();
uVar5 = (uint)*(ushort *)(iVar4 + 0x10);
if (uVar5 != 0xffff) {
local_15c = (int *)0x0;
iVar9 = *(int *)(iVar4 + 4);
local_148 = 3.4028235e+38;
do {
iVar1 = uVar5 * 8;
piVar10 = *(int **)(iVar9 + uVar5 * 8);
pCVar6 = (CBaseEntity *)(**(code **)(*piVar10 + 0xb4))(piVar10);
if (((byte)pCVar6[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar6);
}
fVar15 = (*(float *)(pCVar6 + 0x2e8) - *(float *)(param_2 + 0x2e8)) *
(*(float *)(pCVar6 + 0x2e8) - *(float *)(param_2 + 0x2e8)) +
(*(float *)(pCVar6 + 0x2e0) - *(float *)(param_2 + 0x2e0)) *
(*(float *)(pCVar6 + 0x2e0) - *(float *)(param_2 + 0x2e0)) +
(*(float *)(pCVar6 + 0x2e4) - *(float *)(param_2 + 0x2e4)) *
(*(float *)(pCVar6 + 0x2e4) - *(float *)(param_2 + 0x2e4));
if (fVar15 < local_148) {
piVar10 = *(int **)(*(int *)(iVar4 + 4) + iVar1);
piVar8 = (int *)(**(code **)(*piVar10 + 0xb4))(piVar10);
iVar9 = (**(code **)(*piVar8 + 0x144))(piVar8);
if (iVar9 == 0) goto LAB_00928a9d;
piVar10 = (int *)(**(code **)(*piVar10 + 0xb4))(piVar10);
pCVar6 = (CBaseEntity *)(**(code **)(*piVar10 + 0x144))(piVar10);
iVar9 = CBaseEntity::GetTeamNumber(pCVar6);
if ((iVar9 != 3) ||
(iVar9 = (**(code **)(*(int *)pCVar6 + 0x544))(pCVar6), iVar9 != 8))
goto LAB_00928a9d;
iVar9 = *(int *)(iVar4 + 4);
puVar12 = (undefined4 *)(iVar1 + iVar9);
local_15c = (int *)*puVar12;
local_148 = fVar15;
}
else {
LAB_00928a9d:
iVar9 = *(int *)(iVar4 + 4);
puVar12 = (undefined4 *)(iVar1 + iVar9);
}
uVar5 = (uint)*(ushort *)((int)puVar12 + 6);
} while (uVar5 != 0xffff);
if (local_15c != (int *)0x0) goto LAB_00928d5e;
}
cVar2 = INextBot::IsDebugging((INextBot *)(param_2 + 0x4028),0x100);
if (cVar2 != '\0') {
uVar11 = (**(code **)(*(int *)param_2 + 0x9b8))(param_2);
DevMsg("%3.2f: %s: Someone called out \'tank\', but there is no Tank!\n",
(double)*(float *)(gpGlobals + 0xc),uVar11);
}
}
}
}
LAB_009285cf:
pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5);
if (((((pcVar3 != "PlayerMoveOn") && (iVar4 = _V_stricmp(pcVar3,"PlayerMoveOn"), iVar4 != 0)) &&
(pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5), pcVar3 != "PlayerHurryUp")) &&
((iVar4 = _V_stricmp(pcVar3,"PlayerHurryUp"), iVar4 != 0 &&
(pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5), pcVar3 != "PlayerStayTogether"))))
&& ((iVar4 = _V_stricmp(pcVar3,"PlayerStayTogether"), iVar4 != 0 &&
((pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5), pcVar3 != "PlayerFollowMe" &&
(iVar4 = _V_stricmp(pcVar3,"PlayerFollowMe"), iVar4 != 0)))))) goto LAB_00928727;
DescribeSubject(param_4);
CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s");
if (((byte)param_4[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_4);
}
if (((byte)param_2[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
}
if ((*(float *)(param_2 + 0x2e4) - *(float *)(param_4 + 0x2e4)) *
(*(float *)(param_2 + 0x2e4) - *(float *)(param_4 + 0x2e4)) +
(*(float *)(param_2 + 0x2e8) - *(float *)(param_4 + 0x2e8)) *
(*(float *)(param_2 + 0x2e8) - *(float *)(param_4 + 0x2e8)) +
(*(float *)(param_2 + 0x2e0) - *(float *)(param_4 + 0x2e0)) *
(*(float *)(param_2 + 0x2e0) - *(float *)(param_4 + 0x2e0)) < 160000.0) {
pcVar13 = *(code **)(*(int *)param_2 + 0x7b4);
pcVar3 = "SurvivorBotReassureNearby";
LAB_00928b40:
CAI_Concept::CAI_Concept(local_134,pcVar3);
(*pcVar13)(param_2,local_134,1,local_127,0,0,0);
}
else {
cVar2 = SurvivorBot::IsAvailable(param_2);
if (cVar2 != '\0') {
pcVar13 = *(code **)(*(int *)param_2 + 0x7b4);
pcVar3 = "SurvivorBotReassureComing";
goto LAB_00928b40;
}
}
lVar14 = (longdouble)RandomFloat(0x41200000,0x41a00000);
fVar15 = (float)lVar14;
lVar14 = (longdouble)CountdownTimer::Now();
if ((float)lVar14 + fVar15 != *(float *)(param_1 + 0x68)) {
(**(code **)(*(int *)(param_1 + 0x60) + 4))(param_1 + 0x60,param_1 + 0x68);
*(float *)(param_1 + 0x68) = (float)lVar14 + fVar15;
}
if (fVar15 != *(float *)(param_1 + 100)) {
(**(code **)(*(int *)(param_1 + 0x60) + 4))(param_1 + 0x60,param_1 + 100);
*(float *)(param_1 + 100) = fVar15;
}
LAB_00928727:
pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5);
if (((pcVar3 == "PlayerThanks") || (iVar4 = _V_stricmp(pcVar3,"PlayerThanks"), iVar4 == 0)) &&
(param_4 != (CBaseEntity *)0x0)) {
iVar4 = CBaseEntity::GetTeamNumber(param_4);
cVar2 = IsASurvivorTeam(iVar4);
if (((cVar2 != '\0') && (*(uint *)(param_4 + 0x2ba0) < 8)) &&
((iVar4 = *(uint *)(param_4 + 0x2ba0) * 0xc, 0.0 < *(float *)(param_2 + iVar4 + 0x1ab18) &&
(lVar14 = (longdouble)CountdownTimer::Now(),
(float)lVar14 < *(float *)(param_2 + iVar4 + 0x1ab18))))) {
DescribeSubject(param_4);
CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s");
pcVar13 = *(code **)(*(int *)param_2 + 0x7b4);
CAI_Concept::CAI_Concept(local_134,"SurvivorBotYouAreWelcome");
(*pcVar13)(param_2,local_134,1,local_127,0,0,0);
}
}
pcVar3 = (char *)CAI_Concept::GetStringConcept(param_5);
if ((pcVar3 == "PlayerKillThatLight") ||
(iVar4 = _V_stricmp(pcVar3,"PlayerKillThatLight"), iVar4 == 0)) {
lVar14 = (longdouble)RandomFloat(0x41f00000,0x42340000);
SurvivorBot::InhibitFlashlight(param_2,(float)lVar14);
DescribeSubject(param_4);
CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s");
pcVar13 = *(code **)(*(int *)param_2 + 0x7b4);
CAI_Concept::CAI_Concept(local_134,"SurvivorBotYesFlashlightOff");
(*pcVar13)(param_2,local_134,1,local_127,0,0,0);
}
iVar4 = *(int *)(in_GS_OFFSET + 0x14);
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
*(undefined4 *)(this + 0xc) = 1;
if (local_20 != iVar4) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
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.