L L4D2node

CPointAngleSensor::Think

0x007d8430 · 754 bytes · __thiscall

_ZN17CPointAngleSensor5ThinkEv

Decompiled

undefined (1 param)

/* CPointAngleSensor::Think() */

void __thiscall CPointAngleSensor::Think(CPointAngleSensor *this)

{
  uint uVar1;
  int *piVar2;
  int iVar3;
  char cVar4;
  undefined *puVar5;
  undefined *puVar6;
  CBaseEntity *pCVar7;
  float fVar8;
  float local_44;
  float local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  uVar1 = *(uint *)(this + 0x448);
  if ((((uVar1 != 0xffffffff) &&
       (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) &&
     (piVar2 = *(int **)(puVar6 + 4), piVar2 != (int *)0x0)) {
    (**(code **)(*piVar2 + 0x24c))(piVar2,&local_3c,0,0);
    *(undefined4 *)(this + 0x4a0) = 3;
    local_20 = 3;
    *(undefined4 *)(this + 0x490) = local_3c;
    local_30 = *(undefined4 *)(this + 0x490);
    *(undefined4 *)(this + 0x494) = local_38;
    *(undefined4 *)(this + 0x498) = local_34;
    local_2c = *(undefined4 *)(this + 0x494);
    local_28 = *(undefined4 *)(this + 0x498);
    local_24 = *(undefined4 *)(this + 0x49c);
    CBaseEntityOutput::FireOutput((CBaseEntityOutput *)(this + 0x490),&local_30,this,this,0);
    uVar1 = *(uint *)(this + 0x44c);
    if (((uVar1 != 0xffffffff) &&
        (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar6 + 8) == uVar1 >> 0xc &&
        (*(CBaseEntity **)(puVar6 + 4) != (CBaseEntity *)0x0)))) {
      uVar1 = *(uint *)(this + 0x448);
      pCVar7 = (CBaseEntity *)0x0;
      if (uVar1 != 0xffffffff) {
        puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
        if ((puVar5 == (undefined *)0xfffffffc) || (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) {
          pCVar7 = (CBaseEntity *)0x0;
        }
        else {
          pCVar7 = *(CBaseEntity **)(puVar5 + 4);
        }
      }
      cVar4 = IsFacingWithinTolerance
                        (this,pCVar7,*(CBaseEntity **)(puVar6 + 4),*(float *)(this + 0x454),
                         &local_44);
      iVar3 = gpGlobals;
      if (cVar4 == '\0') {
        if (this[0x45c] != (CPointAngleSensor)0x0) {
          this[0x45c] = (CPointAngleSensor)0x0;
        }
        *(undefined4 *)(this + 0x458) = 0;
      }
      else if (this[0x45c] == (CPointAngleSensor)0x0) {
        fVar8 = *(float *)(this + 0x458);
        if (fVar8 == 0.0) {
          fVar8 = *(float *)(gpGlobals + 0xc);
          *(float *)(this + 0x458) = fVar8;
        }
        if (fVar8 + *(float *)(this + 0x450) < *(float *)(iVar3 + 0xc) ||
            fVar8 + *(float *)(this + 0x450) == *(float *)(iVar3 + 0xc)) {
          COutputEvent::FireOutput
                    ((COutputEvent *)(this + 0x460),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
          this[0x45c] = (CPointAngleSensor)0x1;
        }
      }
      local_40 = *(float *)(this + 0x454);
      if (local_40 == 1.0) {
        local_40 = (float)((uint)local_40 & -(uint)(local_44 < 1.0));
      }
      else {
        local_40 = (local_44 - 1.0) / (local_40 - 1.0);
        if (1.0 <= local_40) {
          local_40 = 1.0;
        }
        if (local_40 <= 0.0) {
          local_40 = 0.0;
        }
        local_40 = 1.0 - local_40;
      }
      variant_t::Set((variant_t *)(this + 0x4a8),1,&local_40);
      local_30 = *(undefined4 *)(this + 0x4a8);
      local_2c = *(undefined4 *)(this + 0x4ac);
      local_28 = *(undefined4 *)(this + 0x4b0);
      local_24 = *(undefined4 *)(this + 0x4b4);
      local_20 = *(undefined4 *)(this + 0x4b8);
      CBaseEntityOutput::FireOutput((CBaseEntityOutput *)(this + 0x4a8),&local_30,this,this,0);
    }
    CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc),(char *)0x0);
    return;
  }
  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)