L L4D2node

CAI_ExpresserWithFollowup::SpeakDispatchResponse

0x005b1fb0 · 1430 bytes · __thiscall

_ZN25CAI_ExpresserWithFollowup21SpeakDispatchResponseER11CAI_ConceptP11AI_ResponseP14AI_CriteriaSetP16IRecipientFilter

Decompiled

undefined (5 params)

/* CAI_ExpresserWithFollowup::SpeakDispatchResponse(CAI_Concept&, AI_Response*, AI_CriteriaSet*,
   IRecipientFilter*) */

undefined4 __thiscall
CAI_ExpresserWithFollowup::SpeakDispatchResponse
          (CAI_ExpresserWithFollowup *this,CAI_Concept *param_1,AI_Response *param_2,
          AI_CriteriaSet *param_3,IRecipientFilter *param_4)

{
  AI_Response AVar1;
  int *piVar2;
  uint uVar3;
  char *pcVar4;
  bool bVar5;
  bool bVar6;
  char cVar7;
  int iVar8;
  undefined4 *puVar9;
  undefined *puVar10;
  undefined4 uVar11;
  CBaseEntity *pCVar12;
  int in_GS_OFFSET;
  float fVar13;
  float fVar14;
  CBaseEntity *local_16c;
  CBaseEntity *local_164;
  undefined4 local_150;
  undefined4 local_14c;
  undefined4 local_148;
  undefined4 local_144;
  undefined4 local_140;
  float local_13c;
  undefined4 local_134;
  undefined4 local_130;
  char local_120 [256];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)(param_1 + 4) == -1) {
    uVar3 = *(uint *)(this + 0x40);
    if ((((uVar3 == 0xffffffff) ||
         (puVar10 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar10 + 8) != uVar3 >> 0xc)) ||
       (piVar2 = *(int **)(puVar10 + 4), piVar2 == (int *)0x0)) {
      *(undefined4 *)(param_1 + 4) = 0xffffffff;
    }
    else {
      puVar9 = (undefined4 *)(**(code **)(*piVar2 + 0xc))(piVar2);
      *(undefined4 *)(param_1 + 4) = *puVar9;
    }
  }
  cVar7 = CAI_Expresser::SpeakDispatchResponse
                    ((CAI_Expresser *)this,param_1,param_2,param_3,param_4);
  if (cVar7 == '\0') {
    uVar11 = 0;
    goto LAB_005b21ba;
  }
  piVar2 = *(int **)(param_2 + 0x9d);
  if (piVar2 == (int *)0x0) {
LAB_005b21a0:
    bVar6 = false;
    if (*(int *)(param_2 + 0xa1) == 0) {
      uVar11 = 1;
      goto LAB_005b21ba;
    }
LAB_005b214b:
    bVar5 = bVar6;
    fVar13 = *(float *)(param_2 + 0xa9);
  }
  else {
    if ((((char *)piVar2[4] != (char *)0x0) && (piVar2[5] != 0)) &&
       (param_3 != (AI_CriteriaSet *)0x0)) {
      iVar8 = CGlobalEntityList::FindEntityByName
                        ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,(char *)piVar2[4],
                         (CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
                         (IEntityFindFilter *)0x0);
      if (iVar8 != 0) {
        uVar3 = *(uint *)(this + 0x40);
        if (((uVar3 == 0xffffffff) ||
            (puVar10 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc))
           || (*(uint *)(puVar10 + 8) != uVar3 >> 0xc)) {
          uVar11 = 0;
        }
        else {
          uVar11 = *(undefined4 *)(puVar10 + 4);
        }
        local_140 = 0;
        local_134 = 0xffffffff;
        local_130 = 0;
        CEventQueue::AddEvent
                  ((CEventQueue *)g_EventQueue,iVar8,piVar2[5],&local_140,piVar2[6],uVar11,uVar11,0)
        ;
      }
    }
    if ((*piVar2 == 0) || (piVar2[1] == 0)) goto LAB_005b21a0;
    bVar5 = true;
    bVar6 = true;
    if (*(int *)(param_2 + 0xa1) != 0) goto LAB_005b214b;
    fVar13 = (float)piVar2[2];
  }
  if (fVar13 < 0.0) {
    local_16c = (CBaseEntity *)ABS(fVar13);
  }
  else {
    AVar1 = *param_2;
    if (AVar1 == (AI_Response)0x3) {
      AI_Response::GetResponse(param_2,local_120,0x100);
      cVar7 = (**(code **)(*scenefilecache + 0x1c))(scenefilecache,local_120,&local_140);
      fVar14 = -1.0;
      if (cVar7 != '\0') {
        fVar14 = local_13c;
      }
    }
    else {
      fVar14 = 0.0;
      if (AVar1 != (AI_Response)0x6) {
        if ((bVar5) && (AVar1 == (AI_Response)0x5)) {
          local_16c = (CBaseEntity *)0x0;
          uVar3 = *(uint *)(this + 0x40);
          if ((uVar3 != 0xffffffff) &&
             ((puVar10 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc
              && (*(uint *)(puVar10 + 8) == uVar3 >> 0xc)))) {
            local_16c = *(CBaseEntity **)(puVar10 + 4);
          }
          fVar13 = (float)piVar2[2];
          if ((AI_Response *)piVar2[3] == (AI_Response *)0x0) {
            local_148 = 3;
            local_144 = 0xffffffff;
          }
          else {
            ResolveFollowupTargetToEntity
                      ((CAI_Concept *)&local_148,(AI_CriteriaSet *)param_1,(char *)param_3,
                       (AI_Response *)piVar2[3]);
          }
          pcVar4 = (char *)piVar2[1];
          CAI_Concept::CAI_Concept((CAI_Concept *)&local_140,(char *)*piVar2);
          DispatchFollowupThroughQueue
                    ((CAI_Concept *)&local_140,pcVar4,(CFollowupTargetSpec_t *)&local_148,fVar13,
                     local_16c);
          uVar11 = 1;
        }
        else {
          Warning("Response %s has a followup with unsupported response type %d",param_2 + 1,AVar1);
          uVar11 = 0;
        }
        goto LAB_005b21ba;
      }
    }
    local_16c = (CBaseEntity *)(fVar14 + fVar13);
  }
  if (bVar5) {
    AI_CriteriaSet::AI_CriteriaSet((AI_CriteriaSet *)&local_140);
    if (param_3 == (AI_CriteriaSet *)0x0) {
      param_3 = (AI_CriteriaSet *)&local_140;
    }
    local_164 = (CBaseEntity *)0x0;
    uVar3 = *(uint *)(this + 0x40);
    if (((uVar3 != 0xffffffff) &&
        (puVar10 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar10 + 8) == uVar3 >> 0xc)) {
      local_164 = *(CBaseEntity **)(puVar10 + 4);
    }
    if ((AI_Response *)piVar2[3] == (AI_Response *)0x0) {
      local_150 = 3;
      local_14c = 0xffffffff;
    }
    else {
                    /* try { // try from 005b23ed to 005b2442 has its CatchHandler @ 005b257a */
      ResolveFollowupTargetToEntity
                ((CAI_Concept *)&local_150,(AI_CriteriaSet *)param_1,(char *)param_3,
                 (AI_Response *)piVar2[3]);
    }
    pcVar4 = (char *)piVar2[1];
    CAI_Concept::CAI_Concept((CAI_Concept *)&local_148,(char *)*piVar2);
    DispatchFollowupThroughQueue
              ((CAI_Concept *)&local_148,pcVar4,(CFollowupTargetSpec_t *)&local_150,(float)local_16c
               ,local_164);
    AI_CriteriaSet::~AI_CriteriaSet((AI_CriteriaSet *)&local_140);
    uVar11 = 1;
  }
  else {
    pCVar12 = (CBaseEntity *)0x0;
    uVar3 = *(uint *)(this + 0x40);
    if (((uVar3 != 0xffffffff) &&
        (puVar10 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar10 + 8) == uVar3 >> 0xc)) {
      pCVar12 = *(CBaseEntity **)(puVar10 + 4);
    }
    DispatchScriptFollowupThroughQueue
              (*(HSCRIPT__ **)(param_2 + 0xa1),*(HSCRIPT__ **)(param_2 + 0xa5),(float)local_16c,
               pCVar12,param_3);
    uVar11 = 1;
  }
LAB_005b21ba:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar11;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)