L L4D2node

CGlobalEntityList::FindEntityProcedural

0x0067c170 · 998 bytes · __thiscall

_ZN17CGlobalEntityList20FindEntityProceduralEPKcP11CBaseEntityS3_S3_

Decompiled

undefined (5 params)

/* WARNING: Type propagation algorithm not settling */
/* CGlobalEntityList::FindEntityProcedural(char const*, CBaseEntity*, CBaseEntity*, CBaseEntity*) */

CBaseEntity * __thiscall
CGlobalEntityList::FindEntityProcedural
          (CGlobalEntityList *this,char *param_1,CBaseEntity *param_2,CBaseEntity *param_3,
          CBaseEntity *param_4)

{
  char *pcVar1;
  byte bVar2;
  uint uVar3;
  byte *pbVar4;
  CBaseEntity *pCVar5;
  int iVar6;
  CBasePlayer *pCVar7;
  byte *pbVar8;
  
  if (*param_1 == '!') {
    pcVar1 = param_1 + 1;
    if ((pcVar1 == "player") || (iVar6 = _V_stricmp(pcVar1,"player"), iVar6 == 0)) {
LAB_0067c490:
      pCVar5 = (CBaseEntity *)UTIL_PlayerByIndex(1);
      return pCVar5;
    }
    if ((pcVar1 != "pvsplayer") && (iVar6 = _V_stricmp(pcVar1,"pvsplayer"), iVar6 != 0)) {
      if (pcVar1 == "activator") {
        return param_3;
      }
      iVar6 = _V_stricmp(pcVar1,"activator");
      if (iVar6 == 0) {
        return param_3;
      }
      if (pcVar1 == "caller") {
        return param_4;
      }
      iVar6 = _V_stricmp(pcVar1,"caller");
      if (iVar6 != 0) {
        if ((pcVar1 == "picker") || (iVar6 = _V_stricmp(pcVar1,"picker"), iVar6 == 0)) {
          pCVar7 = (CBasePlayer *)UTIL_PlayerByIndex(1);
          pCVar5 = (CBaseEntity *)FindPickerEntity(pCVar7);
          return pCVar5;
        }
        if (pcVar1 == "self") {
          return param_2;
        }
        iVar6 = _V_stricmp(pcVar1,"self");
        if (iVar6 != 0) {
          if (((((pcVar1 != "nick") && (iVar6 = _V_stricmp(pcVar1,"nick"), iVar6 != 0)) &&
               (pcVar1 != "rochelle")) &&
              ((((iVar6 = _V_stricmp(pcVar1,"rochelle"), iVar6 != 0 && (pcVar1 != "ellis")) &&
                ((iVar6 = _V_stricmp(pcVar1,"ellis"), iVar6 != 0 &&
                 ((pcVar1 != "coach" && (iVar6 = _V_stricmp(pcVar1,"coach"), iVar6 != 0)))))) &&
               (pcVar1 != "bill")))) &&
             (((((iVar6 = _V_stricmp(pcVar1,"bill"), iVar6 != 0 && (pcVar1 != "zoey")) &&
                (iVar6 = _V_stricmp(pcVar1,"zoey"), iVar6 != 0)) &&
               ((pcVar1 != "louis" && (iVar6 = _V_stricmp(pcVar1,"louis"), iVar6 != 0)))) &&
              ((pcVar1 != "francis" && (iVar6 = _V_stricmp(pcVar1,"francis"), iVar6 != 0)))))) {
            Warning("Invalid entity search name %s\n",param_1);
            return (CBaseEntity *)0x0;
          }
          GetCharacterFromName(pcVar1);
          pCVar5 = (CBaseEntity *)CTerrorPlayer::GetPlayerByCharacter();
          return pCVar5;
        }
        return param_2;
      }
      return param_4;
    }
    if (param_2 == (CBaseEntity *)0x0) {
      if (param_3 == (CBaseEntity *)0x0) goto LAB_0067c490;
      pbVar4 = (byte *)UTIL_FindClientInPVS(*(edict_t **)(param_3 + 0x30));
    }
    else {
      pbVar4 = (byte *)UTIL_FindClientInPVS(*(edict_t **)(param_2 + 0x30));
    }
    if (pbVar4 != (byte *)0x0) goto LAB_0067c1e3;
    pbVar4 = *(byte **)(gpGlobals + 0x58);
    if (pbVar4 == (byte *)0x0) {
      return (CBaseEntity *)0x0;
    }
    bVar2 = *pbVar4;
  }
  else {
    if (*param_1 != '#') {
      return (CBaseEntity *)0x0;
    }
    uVar3 = strtol(param_1 + 1,(char **)0x0,10);
    if (uVar3 == 0) {
      Warning("Invalid entity index %s\n",param_1);
      return (CBaseEntity *)0x0;
    }
    if (uVar3 < 0x800) {
      pbVar8 = *(byte **)(gpGlobals + 0x58);
      if (pbVar8 == (byte *)0x0) {
        return (CBaseEntity *)0x0;
      }
      pbVar4 = pbVar8 + uVar3 * 0x10;
      if ((*pbVar4 & 2) == 0) goto LAB_0067c1e3;
    }
    else {
      pbVar8 = *(byte **)(gpGlobals + 0x58);
      if (pbVar8 == (byte *)0x0) {
        return (CBaseEntity *)0x0;
      }
    }
    bVar2 = *pbVar8;
    pbVar4 = pbVar8;
  }
  if ((bVar2 & 2) != 0) {
    return (CBaseEntity *)0x0;
  }
LAB_0067c1e3:
  if (*(int **)(pbVar4 + 0xc) == (int *)0x0) {
    return (CBaseEntity *)0x0;
  }
                    /* WARNING: Could not recover jumptable at 0x0067c1fd. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  pCVar5 = (CBaseEntity *)(**(code **)(**(int **)(pbVar4 + 0xc) + 0x18))();
  return pCVar5;
}

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)