L L4D2node

CGlobalEntityList::FindEntityByModel

0x0067c740 · 211 bytes · __thiscall

_ZN17CGlobalEntityList17FindEntityByModelEP11CBaseEntityPKc

Decompiled

undefined (3 params)

/* CGlobalEntityList::FindEntityByModel(CBaseEntity*, char const*) */

int * __thiscall
CGlobalEntityList::FindEntityByModel(CGlobalEntityList *this,CBaseEntity *param_1,char *param_2)

{
  int *piVar1;
  code *pcVar2;
  CBaseEntity **ppCVar3;
  uint *puVar4;
  char *pcVar5;
  int iVar6;
  int *piVar7;
  int *piVar8;
  CBaseEntity *local_2c [3];
  char *local_20 [4];
  
  if (param_1 == (CBaseEntity *)0x0) {
    piVar8 = *(int **)(this + 0x10004);
  }
  else {
    local_2c[0] = param_1;
    puVar4 = (uint *)(**(code **)(*(int *)param_1 + 0xc))();
    piVar8 = *(int **)(this + (*puVar4 & 0xfff) * 0x10 + 0x10);
  }
  ppCVar3 = local_2c;
  do {
    while( true ) {
      if (piVar8 == (int *)0x0) {
        return (int *)0x0;
      }
      piVar1 = (int *)*piVar8;
      if (piVar1 != (int *)0x0) break;
      *ppCVar3 = (CBaseEntity *)"NULL entity in global entity list!\n";
      ppCVar3[-1] = (CBaseEntity *)0x67c7fc;
      DevWarning((char *)*ppCVar3);
      piVar8 = (int *)piVar8[3];
    }
    piVar7 = (int *)ppCVar3;
    if (piVar1[0xc] != 0) {
      iVar6 = *piVar1;
      ppCVar3[1] = (CBaseEntity *)piVar1;
      *ppCVar3 = (CBaseEntity *)local_20;
      pcVar2 = *(code **)(iVar6 + 0x20);
      ppCVar3[-1] = (CBaseEntity *)0x67c7a5;
      (*pcVar2)();
      piVar7 = (int *)(ppCVar3 + -1);
      if (local_20[0] != (char *)0x0) {
        iVar6 = *piVar1;
        *ppCVar3 = (CBaseEntity *)piVar1;
        ppCVar3[-1] = (CBaseEntity *)local_20;
        pcVar2 = *(code **)(iVar6 + 0x20);
        ppCVar3[-2] = (CBaseEntity *)0x67c7bb;
        (*pcVar2)();
        piVar7 = (int *)(ppCVar3 + -2);
        pcVar5 = local_20[0];
        if (local_20[0] == (char *)0x0) {
          pcVar5 = "";
        }
        if (param_2 == pcVar5) {
          return piVar1;
        }
        ppCVar3[-2] = (CBaseEntity *)pcVar5;
        ppCVar3[-1] = (CBaseEntity *)param_2;
        ppCVar3[-3] = (CBaseEntity *)0x67c7df;
        iVar6 = _V_stricmp((char *)ppCVar3[-2],(char *)ppCVar3[-1]);
        if (iVar6 == 0) {
          return piVar1;
        }
      }
    }
    piVar8 = (int *)piVar8[3];
    ppCVar3 = (CBaseEntity **)piVar7;
  } while( true );
}

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)