L L4D2node

CPointScriptUseTarget::UpdateUseModelEntity

0x00902760 · 585 bytes · __thiscall

_ZN21CPointScriptUseTarget20UpdateUseModelEntityEv

Decompiled

undefined (1 param)

/* CPointScriptUseTarget::UpdateUseModelEntity() */

void __thiscall CPointScriptUseTarget::UpdateUseModelEntity(CPointScriptUseTarget *this)

{
  uint uVar1;
  CBaseEdict *this_00;
  int *piVar2;
  uint *puVar3;
  char *pcVar4;
  int iVar5;
  undefined4 uVar6;
  int iVar7;
  undefined4 *puVar8;
  undefined *puVar9;
  CBaseEntity *pCVar10;
  undefined1 *puVar11;
  undefined1 *local_28 [2];
  undefined2 local_20;
  ushort local_1e;
  
  pcVar4 = "";
  if (*(char **)(this + 0x45c) != (char *)0x0) {
    pcVar4 = *(char **)(this + 0x45c);
  }
  piVar2 = (int *)CGlobalEntityList::FindEntityByName
                            ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar4,
                             (CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
                             (IEntityFindFilter *)0x0);
  if (piVar2 == (int *)0x0) {
    *(undefined4 *)(this + 0x460) = 0xffffffff;
    pCVar10 = (CBaseEntity *)0x0;
  }
  else {
    puVar3 = (uint *)(**(code **)(*piVar2 + 0xc))(piVar2);
    puVar9 = g_pEntityList;
    uVar1 = *puVar3;
    *(uint *)(this + 0x460) = uVar1;
    if (((uVar1 == 0xffffffff) ||
        (puVar9 = puVar9 + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar9 + 8) != uVar1 >> 0xc)) {
      pCVar10 = (CBaseEntity *)0x0;
    }
    else {
      pCVar10 = *(CBaseEntity **)(puVar9 + 4);
    }
  }
  pcVar4 = *(char **)(this + 0x45c);
  if (pcVar4 == (char *)0x0) {
    pcVar4 = "";
  }
  iVar5 = CGlobalEntityList::FindEntityByName
                    ((CGlobalEntityList *)gEntList,pCVar10,pcVar4,(CBaseEntity *)0x0,
                     (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
  if (iVar5 != 0) {
    pcVar4 = (char *)CBaseEntity::GetDebugName((CBaseEntity *)this);
    puVar11 = &DAT_00d539c2;
    if (*(undefined1 **)(this + 0x45c) != (undefined1 *)0x0) {
      puVar11 = *(undefined1 **)(this + 0x45c);
    }
    Warning("Level design error: Two entities with the name \'%s\' found. point_script_use_target named \'%s\' may not be finding the correct use entity."
            ,puVar11,pcVar4);
  }
  local_28[0] = *(undefined1 **)(this + 0x460);
  if (((local_28[0] == &DAT_ffffffff) ||
      (puVar9 = g_pEntityList + ((uint)local_28[0] & 0xfff) * 0x10,
      puVar9 == (undefined *)0xfffffffc)) ||
     ((*(uint *)(puVar9 + 8) != (uint)local_28[0] >> 0xc ||
      (iVar5 = *(int *)(puVar9 + 4), iVar5 == 0)))) {
    uVar6 = CBaseEntity::GetDebugName((CBaseEntity *)this);
    Warning("Level design error: point_script_use_target \'%s\' has an invalid use model.\n",uVar6,
            pcVar4);
    local_28[0] = *(undefined1 **)(this + 0x460);
  }
  else {
    uVar1 = *(uint *)(iVar5 + 0x118);
    if (((uVar1 == 0xffffffff) ||
        (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar9 + 8) != uVar1 >> 0xc || (this != *(CPointScriptUseTarget **)(puVar9 + 4)))
       )) {
      if (*(char *)(iVar5 + 0x6c) == '\0') {
        this_00 = *(CBaseEdict **)(iVar5 + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar7 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar7 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar5 + 0x70) = *(byte *)(iVar5 + 0x70) | 1;
      }
      puVar8 = (undefined4 *)(**(code **)(*(int *)this + 0xc))(this);
      *(undefined4 *)(iVar5 + 0x118) = *puVar8;
      local_28[0] = *(undefined1 **)(this + 0x460);
    }
  }
  local_20 = 0xd;
  local_1e = 0;
                    /* try { // try from 009028f5 to 009028f7 has its CatchHandler @ 009029cb */
  (**(code **)(*g_pScriptVM + 0x78))
            (g_pScriptVM,*(undefined4 *)(this + 1000),"UseModelEntity",local_28);
  if ((local_1e & 1) != 0) {
    free(local_28[0]);
  }
  return;
}

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)