L L4D2node

FindPhysicsObjectByName

0x0077d7b0 · 474 bytes · __cdecl

_Z23FindPhysicsObjectByNamePKcP11CBaseEntity

Decompiled

undefined (2 params)

/* FindPhysicsObjectByName(char const*, CBaseEntity*) */

int FindPhysicsObjectByName(char *param_1,CBaseEntity *param_2)

{
  int iVar1;
  CBaseEntity *pCVar2;
  int iVar3;
  char *pcVar4;
  undefined1 *puVar5;
  CBaseEntity *pCVar6;
  int in_GS_OFFSET;
  CFmtStrN<256> local_12c [5];
  undefined1 local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pCVar2 = (CBaseEntity *)0x0;
  if ((param_1 == (char *)0x0) || (*param_1 == '\0')) {
    iVar3 = 0;
  }
  else {
    iVar1 = 0;
    do {
      iVar3 = iVar1;
      pCVar2 = (CBaseEntity *)
               CGlobalEntityList::FindEntityByName
                         ((CGlobalEntityList *)gEntList,pCVar2,param_1,(CBaseEntity *)0x0,
                          (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
      if (pCVar2 == (CBaseEntity *)0x0) goto LAB_0077d946;
      iVar1 = iVar3;
    } while ((*(int *)(pCVar2 + 0x238) == 0) || (iVar1 = *(int *)(pCVar2 + 0x238), iVar3 == 0));
    if (param_2 == (CBaseEntity *)0x0) {
      pcVar4 = "Unknown";
      pCVar6 = (CBaseEntity *)&vec3_origin;
    }
    else {
      pcVar4 = *(char **)(param_2 + 0x7c);
      if (pcVar4 == (char *)0x0) {
        pcVar4 = "";
      }
      if (((byte)param_2[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(param_2);
      }
      pCVar6 = param_2 + 0x2e0;
    }
    CFmtStrN<256>::CFmtStrN
              (local_12c,"(%f, %f, %f)",(double)*(float *)pCVar6,(double)*(float *)(pCVar6 + 4),
               (double)*(float *)(pCVar6 + 8));
    DevWarning("entity %s at %s has physics attachment to more than one entity with the name %s!!!\n"
               ,pcVar4,local_127);
    while (pCVar2 = (CBaseEntity *)
                    CGlobalEntityList::FindEntityByName
                              ((CGlobalEntityList *)gEntList,pCVar2,param_1,(CBaseEntity *)0x0,
                               (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0),
          pCVar2 != (CBaseEntity *)0x0) {
      puVar5 = *(undefined1 **)(pCVar2 + 0x7c);
      if (puVar5 == (undefined1 *)0x0) {
        puVar5 = &DAT_00d539c2;
      }
      DevWarning("Found %s\n",puVar5);
    }
  }
LAB_0077d946:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return iVar3;
}

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)