L L4D2node

CAI_Expresser::FindResponse

0x005d1f90 · 1517 bytes · __thiscall

_ZN13CAI_Expresser12FindResponseER11AI_ResponseR11CAI_ConceptP14AI_CriteriaSet

Decompiled

undefined (4 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CAI_Expresser::FindResponse(AI_Response&, CAI_Concept&, AI_CriteriaSet*) */

bool __thiscall
CAI_Expresser::FindResponse
          (CAI_Expresser *this,AI_Response *param_1,CAI_Concept *param_2,AI_CriteriaSet *param_3)

{
  byte *pbVar1;
  char cVar2;
  char cVar3;
  int *piVar4;
  int iVar5;
  CBaseEntity *pCVar6;
  int iVar7;
  uint uVar8;
  undefined4 uVar9;
  undefined4 uVar10;
  undefined *puVar11;
  AI_CriteriaSet *this_00;
  int in_GS_OFFSET;
  bool bVar12;
  int local_18c;
  AI_CriteriaSet *local_180;
  undefined4 local_174;
  undefined4 local_170;
  undefined4 local_16c;
  undefined4 local_168;
  AI_CriteriaSet *local_164;
  AI_CriteriaSet local_160 [32];
  AI_CriteriaSet local_140 [32];
  char local_120 [256];
  int local_20;
  
  local_174 = 0;
  local_170 = 0;
  local_180 = param_3;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (___atan2f_finite == (AI_CriteriaSet *)0x0) {
    local_164 = (AI_CriteriaSet *)0x0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_174,0,0,0,0,"/data/src/game/server/ai_speech.cpp",0x20c,
               &FindResponse(AI_Response&,CAI_Concept&,AI_CriteriaSet*)::tm_fmt,"(%s)%s",
               "Unaccounted","CAI_Expresser::FindResponse");
    local_164 = ___atan2f_finite;
  }
  iVar7 = _DAT_0105db00;
  local_16c = local_174;
  local_168 = local_170;
                    /* try { // try from 005d21c6 to 005d2214 has its CatchHandler @ 005d25e0 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar5 = ThreadGetCurrentId(), iVar7 == iVar5)) {
    if (*(char **)_DAT_0105d15c != "CAI_Expresser::FindResponse") {
      _DAT_0105d15c =
           (AI_CriteriaSet *)
           CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc58908,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  uVar8 = *(uint *)(this + 0x40);
  this_00 = (AI_CriteriaSet *)0x0;
  if (((uVar8 != 0xffffffff) &&
      (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) {
    this_00 = *(AI_CriteriaSet **)(puVar11 + 4);
  }
                    /* try { // try from 005d20ba to 005d2100 has its CatchHandler @ 005d25bc */
  piVar4 = (int *)(**(code **)(*(int *)this_00 + 0xf8))(this_00);
  if (piVar4 != (int *)0x0) {
    uVar8 = *(uint *)(this + 0x40);
    this_00 = (AI_CriteriaSet *)0x0;
    if (((uVar8 != 0xffffffff) &&
        (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) {
      this_00 = *(AI_CriteriaSet **)(puVar11 + 4);
    }
    cVar2 = (**(code **)(*(int *)this_00 + 300))(this_00);
    if (cVar2 != '\0') {
                    /* try { // try from 005d2231 to 005d2235 has its CatchHandler @ 005d25bc */
      AI_CriteriaSet::AI_CriteriaSet(local_160);
      if (param_3 == (AI_CriteriaSet *)0x0) {
                    /* try { // try from 005d252f to 005d2533 has its CatchHandler @ 005d25fe */
        GatherCriteria(this,local_160,param_2,(char *)0x0);
        local_180 = local_160;
      }
                    /* try { // try from 005d224d to 005d2251 has its CatchHandler @ 005d25fe */
      AI_CriteriaSet::AI_CriteriaSet(local_140);
                    /* try { // try from 005d225f to 005d2502 has its CatchHandler @ 005d25e4 */
      AI_CriteriaSet::InterceptWorldSetContexts(local_180,local_140);
      cVar2 = (**(code **)(*piVar4 + 8))(piVar4,local_180,param_1,this);
      if (*(int *)(rr_debugresponses._28_4_ + 0x30) == 4) {
        iVar7 = CBaseEntity::MyNPCPointer();
        if (iVar7 == 0) {
          uVar8 = *(uint *)(this + 0x40);
LAB_005d23f1:
          piVar4 = (int *)0x0;
          if (((uVar8 != 0xffffffff) &&
              (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)
              ) && (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) {
            piVar4 = *(int **)(puVar11 + 4);
          }
          cVar3 = (**(code **)(*piVar4 + 0x16c))(piVar4);
          if (cVar3 == '\0') goto LAB_005d2299;
          uVar8 = *(uint *)(this + 0x40);
        }
        else {
          local_18c = 0;
          uVar8 = *(uint *)(this + 0x40);
          if (((uVar8 != 0xffffffff) &&
              (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)
              ) && (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) {
            local_18c = *(int *)(puVar11 + 4);
          }
          if ((*(byte *)(local_18c + 0x111) & 0x10) == 0) goto LAB_005d23f1;
        }
        piVar4 = (int *)0x0;
        if (((uVar8 != 0xffffffff) &&
            (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) {
          piVar4 = *(int **)(puVar11 + 4);
        }
        cVar3 = (**(code **)(*piVar4 + 0x16c))(piVar4);
        uVar8 = *(uint *)(this + 0x40);
        if (cVar3 == '\0') {
          pCVar6 = (CBaseEntity *)0x0;
          if (((uVar8 != 0xffffffff) &&
              (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)
              ) && (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) {
            pCVar6 = *(CBaseEntity **)(puVar11 + 4);
          }
                    /* try { // try from 005d256e to 005d2572 has its CatchHandler @ 005d25e4 */
          uVar9 = CBaseEntity::GetDebugName(pCVar6);
        }
        else {
          piVar4 = (int *)0x0;
          if (((uVar8 != 0xffffffff) &&
              (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)
              ) && (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) {
            piVar4 = *(int **)(puVar11 + 4);
          }
          uVar9 = (**(code **)(*piVar4 + 0xb8))(piVar4);
        }
        if (cVar2 == '\0') {
          uVar10 = CAI_Concept::GetStringConcept((CAI_Concept *)param_2);
          Warning("RESPONSERULES: %s spoke \'%s\'. Found no matching response.\n",uVar9,uVar10);
          goto LAB_005d235a;
        }
        AI_Response::GetResponse(param_1,local_120,0x100);
        uVar10 = CAI_Concept::GetStringConcept((CAI_Concept *)param_2);
        Warning("RESPONSERULES: %s spoke \'%s\'. Found response \'%s\'.\n",uVar9,uVar10,local_120);
LAB_005d22a6:
        pbVar1 = *(byte **)(gpGlobals + 0x58);
        if (((pbVar1 == (byte *)0x0) || ((*pbVar1 & 2) != 0)) ||
           (piVar4 = *(int **)(pbVar1 + 0xc), piVar4 == (int *)0x0)) {
          pCVar6 = (CBaseEntity *)0x0;
        }
        else {
          pCVar6 = (CBaseEntity *)(**(code **)(*piVar4 + 0x18))(piVar4);
        }
        AI_CriteriaSet::WriteToEntity(local_140,pCVar6);
        bVar12 = param_1[1] != (AI_Response)0x0;
      }
      else {
LAB_005d2299:
        if (cVar2 != '\0') goto LAB_005d22a6;
LAB_005d235a:
        bVar12 = false;
      }
      AI_CriteriaSet::~AI_CriteriaSet(local_140);
      this_00 = local_160;
      AI_CriteriaSet::~AI_CriteriaSet(this_00);
      goto LAB_005d210b;
    }
  }
  bVar12 = false;
LAB_005d210b:
  iVar7 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar5 = ThreadGetCurrentId(), iVar7 == iVar5)) {
    this_00 = _DAT_0105d15c;
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = *(AI_CriteriaSet **)(_DAT_0105d15c + 100);
    }
    DAT_0105d158 = _DAT_0105d15c == (AI_CriteriaSet *)0x105d160;
  }
  if (local_164 != (AI_CriteriaSet *)0x0) {
    this_00 = local_164;
    (**(code **)(local_164 + 0x54))(local_164,local_16c,local_168,0,0,0);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return bVar12;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(this_00);
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)