L L4D2node

CSceneEntity::FindNamedActor

0x00818820 · 489 bytes · __thiscall

_ZN12CSceneEntity14FindNamedActorEi

Decompiled

undefined (2 params)

/* CSceneEntity::FindNamedActor(int) */

int * __thiscall CSceneEntity::FindNamedActor(CSceneEntity *this,int param_1)

{
  uint uVar1;
  code *pcVar2;
  CBaseEdict *pCVar3;
  char cVar4;
  undefined *puVar5;
  CChoreoActor *this_00;
  undefined4 uVar6;
  int *piVar7;
  undefined4 *puVar8;
  int iVar9;
  undefined4 uVar10;
  int iVar11;
  
  iVar9 = *(int *)(this + 0x4d0);
  if (iVar9 == 0) {
    iVar9 = CChoreoScene::GetNumActors(*(CChoreoScene **)(this + 0x4f0));
    *(undefined4 *)(this + 0x4d0) = 0;
    if (iVar9 != 0) {
      CUtlVector<CHandle<CBaseFlex>,CUtlMemory<CHandle<CBaseFlex>,int>>::GrowVector
                ((CUtlVector<CHandle<CBaseFlex>,CUtlMemory<CHandle<CBaseFlex>,int>> *)(this + 0x4c4)
                 ,iVar9);
      CUtlVector<CHandle<CBaseFlex>,CUtlMemory<CHandle<CBaseFlex>,int>>::ShiftElementsRight
                ((CUtlVector<CHandle<CBaseFlex>,CUtlMemory<CHandle<CBaseFlex>,int>> *)(this + 0x4c4)
                 ,0,iVar9);
      if (0 < iVar9) {
        iVar11 = 0;
        do {
          puVar8 = (undefined4 *)(*(int *)(this + 0x4c4) + iVar11 * 4);
          if (puVar8 != (undefined4 *)0x0) {
            *puVar8 = 0xffffffff;
          }
          iVar11 = iVar11 + 1;
        } while (iVar11 != iVar9);
      }
    }
    pCVar3 = *(CBaseEdict **)(this + 0x30);
    if (pCVar3 != (CBaseEdict *)0x0) {
      *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
      iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
      *(undefined2 *)(iVar9 + 2) = 0;
    }
    iVar9 = *(int *)(this + 0x4d0);
  }
  if ((param_1 < 0) || (iVar9 <= param_1)) {
    uVar6 = CChoreoScene::GetNumActors(*(CChoreoScene **)(this + 0x4f0));
    uVar10 = CChoreoScene::GetFilename(*(CChoreoScene **)(this + 0x4f0));
    DevWarning("Scene %s has %d actors, but scene entity only has %d actors\n",uVar10,uVar6,iVar9);
  }
  else {
    uVar1 = *(uint *)(*(int *)(this + 0x4c4) + param_1 * 4);
    if ((((uVar1 != 0xffffffff) &&
         (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)) &&
       ((piVar7 = *(int **)(puVar5 + 4), piVar7 != (int *)0x0 &&
        (cVar4 = (**(code **)(*piVar7 + 300))(piVar7), cVar4 != '\0')))) {
      return piVar7;
    }
    this_00 = (CChoreoActor *)CChoreoScene::GetActor(*(CChoreoScene **)(this + 0x4f0),param_1);
    if (this_00 != (CChoreoActor *)0x0) {
      pcVar2 = *(code **)(*(int *)this + 0x3e4);
      uVar6 = CChoreoActor::GetName(this_00);
      piVar7 = (int *)(*pcVar2)(this,uVar6);
      if (piVar7 != (int *)0x0) {
        iVar9 = *(int *)(this + 0x4c4);
        puVar8 = (undefined4 *)(**(code **)(*piVar7 + 0xc))(piVar7);
        *(undefined4 *)(param_1 * 4 + iVar9) = *puVar8;
        pCVar3 = *(CBaseEdict **)(this + 0x30);
        if (pCVar3 == (CBaseEdict *)0x0) {
          return piVar7;
        }
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
        return piVar7;
      }
    }
  }
  return (int *)0x0;
}

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)