L L4D2node

CTriggerCamera::FollowTarget

0x00b1b460 · 1058 bytes · __thiscall

_ZN14CTriggerCamera12FollowTargetEv

Decompiled

undefined (1 param)

/* CTriggerCamera::FollowTarget() */

void __thiscall CTriggerCamera::FollowTarget(CTriggerCamera *this)

{
  undefined4 *puVar1;
  uint uVar2;
  int *piVar3;
  int iVar4;
  CBaseAnimating *this_00;
  undefined *puVar5;
  uint uVar6;
  CBaseEntity *this_01;
  float local_40;
  float local_3c;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  uVar2 = *(uint *)(this + 0x440);
  if ((((uVar2 != 0xffffffff) &&
       (puVar5 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar5 + 8) == uVar2 >> 0xc)) && (*(int *)(puVar5 + 4) != 0)) {
    uVar2 = *(uint *)(this + 0x444);
    if (uVar2 != 0xffffffff) {
      uVar6 = uVar2 & 0xfff;
      if ((((undefined4 *)(g_pEntityList + uVar6 * 0x10 + 4) != (undefined4 *)0x0) &&
          (*(uint *)(g_pEntityList + uVar6 * 0x10 + 8) == uVar2 >> 0xc)) &&
         ((piVar3 = *(int **)(g_pEntityList + uVar6 * 0x10 + 4), piVar3 != (int *)0x0 &&
          ((((byte)this[0x148] & 8) != 0 ||
           (*(float *)(gpGlobals + 0xc) < *(float *)(this + 0x454) ||
            *(float *)(gpGlobals + 0xc) == *(float *)(this + 0x454))))))) {
        iVar4 = *(int *)(this + 0x48c);
        if (iVar4 == 0) {
          if (((byte)this[0x14d] & 8) == 0) {
            this_01 = *(CBaseEntity **)(g_pEntityList + uVar6 * 0x10 + 4);
          }
          else {
            this_01 = (CBaseEntity *)0x0;
            CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
            uVar2 = *(uint *)(this + 0x444);
            if (((uVar2 != 0xffffffff) &&
                (puVar1 = (undefined4 *)(g_pEntityList + (uVar2 & 0xfff) * 0x10 + 4),
                puVar1 != (undefined4 *)0x0)) && (puVar1[1] == uVar2 >> 0xc)) {
              this_01 = (CBaseEntity *)*puVar1;
            }
          }
          if (((byte)this_01[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(this_01);
          }
          local_28 = *(float *)(this_01 + 0x2e0) - *(float *)(this + 0x2e0);
          local_24 = *(float *)(this_01 + 0x2e4) - *(float *)(this + 0x2e4);
          local_20 = *(float *)(this_01 + 0x2e8);
        }
        else {
          this_00 = (CBaseAnimating *)(**(code **)(*piVar3 + 0xf0))(piVar3);
          CBaseAnimating::GetAttachment
                    (this_00,iVar4,(Vector *)&local_34,(Vector *)0x0,(Vector *)0x0,(Vector *)0x0);
          if (((byte)this[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          }
          local_28 = local_34 - *(float *)(this + 0x2e0);
          local_24 = local_30 - *(float *)(this + 0x2e4);
          local_20 = local_2c;
        }
        local_20 = local_20 - *(float *)(this + 0x2e8);
        VectorAngles((Vector *)&local_28,(QAngle *)&local_40);
        if (this[0x490] == (CTriggerCamera)0x0) {
          local_34 = *(float *)(this + 0x3a8);
          local_30 = *(float *)(this + 0x3ac);
          local_2c = *(float *)(this + 0x3b0);
          if (360.0 < local_30) {
            local_30 = local_30 - 360.0;
          }
          if (local_30 < 0.0) {
            local_30 = local_30 + 360.0;
          }
          CBaseEntity::SetLocalAngles((CBaseEntity *)this,(QAngle *)&local_34);
          local_40 = local_40 - *(float *)(this + 0x3a8);
          local_3c = local_3c - *(float *)(this + 0x3ac);
          if (local_40 < -180.0) {
            local_40 = local_40 + 360.0;
          }
          if (180.0 < local_40) {
            local_40 = local_40 - 360.0;
          }
          if (local_3c < -180.0) {
            local_3c = local_3c + 360.0;
          }
          if (180.0 < local_3c) {
            local_3c = local_3c - 360.0;
          }
          local_20 = *(float *)(this + 0x288);
          local_24 = *(float *)(gpGlobals + 0x10) * 40.0;
          local_28 = local_40 * local_24;
          local_24 = local_3c * local_24;
          CBaseEntity::SetLocalAngularVelocity((CBaseEntity *)this,(QAngle *)&local_28);
        }
        else {
          CBaseEntity::SetAbsAngles((CBaseEntity *)this,(QAngle *)&local_40);
          this[0x490] = (CTriggerCamera)0x0;
        }
        if (((byte)this[0x148] & 4) == 0) {
          if (((byte)this[0x14d] & 0x10) != 0) {
            CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
          }
          local_28 = *(float *)(this + 0x274) * 0.8;
          local_24 = *(float *)(this + 0x278) * 0.8;
          local_20 = *(float *)(this + 0x27c) * 0.8;
          CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&local_28);
          if (((byte)this[0x14d] & 0x10) != 0) {
            CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
          }
          if (SQRT(*(float *)(this + 0x278) * *(float *)(this + 0x278) +
                   *(float *)(this + 0x274) * *(float *)(this + 0x274) +
                   *(float *)(this + 0x27c) * *(float *)(this + 0x27c)) < 10.0) {
            CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&vec3_origin);
          }
        }
        CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc),(char *)0x0);
        Move(this);
        return;
      }
    }
    Disable(this);
    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)