L L4D2node

TongueTargetScan<CTerrorPlayer>::operator()

0x00847220 · 2622 bytes · __thiscall

_ZN16TongueTargetScanI13CTerrorPlayerEclEPS0_

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* TongueTargetScan<CTerrorPlayer>::TEMPNAMEPLACEHOLDERVALUE(CTerrorPlayer*) */

undefined4 __thiscall
TongueTargetScan<CTerrorPlayer>::operator()
          (TongueTargetScan<CTerrorPlayer> *this,CTerrorPlayer *param_1)

{
  code *pcVar1;
  CTerrorPlayer *pCVar2;
  char cVar3;
  int iVar4;
  int iVar5;
  float *pfVar6;
  Vector *pVVar7;
  int *piVar8;
  longdouble lVar9;
  float fVar10;
  CTerrorPlayer *local_a0;
  int local_9c;
  int local_98;
  int local_94;
  int local_90;
  int local_88;
  int local_84;
  int local_80;
  int local_7c;
  int local_78;
  int local_74;
  float local_70;
  float local_6c;
  float local_68;
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  local_9c = 0;
  local_98 = 0;
  if (___atan2f_finite == 0) {
    local_80 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))();
    local_80 = ___atan2f_finite;
  }
  iVar5 = _DAT_0105db00;
  local_88 = local_9c;
  local_84 = local_98;
                    /* try { // try from 008472ea to 008472ee has its CatchHandler @ 00847c87 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar4 = ThreadGetCurrentId(), iVar5 == iVar4)) {
    if ((char *)*_DAT_0105d15c != "TargetScan()") {
                    /* try { // try from 008475d0 to 008475e1 has its CatchHandler @ 00847c87 */
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc21c72,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  if (this[0x4c] == (TongueTargetScan<CTerrorPlayer>)0x0) {
    piVar8 = (int *)&stack0xffffff04;
                    /* try { // try from 0084730b to 00847310 has its CatchHandler @ 00847cba */
    if ((*(CTerrorPlayer **)(this + 4) != param_1) &&
       (cVar3 = (**(code **)(*(int *)param_1 + 300))(), piVar8 = (int *)&stack0xffffff04,
       cVar3 != '\0')) {
                    /* try { // try from 008475f3 to 00847914 has its CatchHandler @ 00847cba */
      iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
      cVar3 = IsASurvivorTeam(iVar5);
      piVar8 = (int *)&stack0xffffff04;
      if ((cVar3 != '\0') &&
         ((cVar3 = (**(code **)(*(int *)this + 0xc))(), piVar8 = (int *)&stack0xffffff04,
          cVar3 != '\0' &&
          (pfVar6 = (float *)(**(code **)(*(int *)param_1 + 0x288))(),
          fVar10 = (*(float *)(this + 0x54) - pfVar6[1]) * (*(float *)(this + 0x54) - pfVar6[1]) +
                   (*(float *)(this + 0x58) - pfVar6[2]) * (*(float *)(this + 0x58) - pfVar6[2]) +
                   (*(float *)(this + 0x50) - *pfVar6) * (*(float *)(this + 0x50) - *pfVar6),
          piVar8 = (int *)&stack0xffffff04,
          fVar10 < *(float *)(this + 0x44) || fVar10 == *(float *)(this + 0x44))))) {
        pcVar1 = *(code **)(**(int **)(this + 4) + 0x3cc);
        (**(code **)(*(int *)param_1 + 0x288))();
        cVar3 = (*pcVar1)();
        piVar8 = (int *)&stack0xffffff04;
        if (cVar3 != '\0') {
          local_58 = *(float *)(this + 0x50);
          fVar10 = *(float *)(this + 0x20);
          local_54 = *(float *)(this + 0x54);
          local_50 = *(float *)(this + 0x58);
          local_48 = *(float *)(this + 0xc) * fVar10 + local_54;
          local_4c = fVar10 * *(float *)(this + 8) + local_58;
          local_44 = *(float *)(this + 0x10) * fVar10 + local_50;
          pVVar7 = (Vector *)(**(code **)(*(int *)param_1 + 0x288))();
          CalcClosestPointOnLine
                    (pVVar7,(Vector *)&local_58,(Vector *)&local_4c,(Vector *)&local_40,(float *)0x0
                    );
          if (1 < *(int *)(TongueDebug._28_4_ + 0x30)) {
            NDebugOverlay::Line((Vector *)&local_58,(Vector *)&local_4c,0,0,0xff,true,0.1);
            pVVar7 = (Vector *)(**(code **)(*(int *)param_1 + 0x288))();
            NDebugOverlay::Line(pVVar7,(Vector *)&local_40,0,0xff,0,true,0.1);
          }
          CCollisionProperty::CalcNearestPoint
                    ((CCollisionProperty *)(param_1 + 0x194),(Vector *)&local_40,(Vector *)&local_34
                    );
          if (1 < *(int *)(TongueDebug._28_4_ + 0x30)) {
            NDebugOverlay::Line((Vector *)&local_40,(Vector *)&local_34,0xff,0,0xff,true,0.1);
          }
          cVar3 = (**(code **)(*(int *)this + 8))();
          piVar8 = (int *)&stack0xffffff04;
          if (cVar3 != '\0') {
            local_28 = local_34 - *(float *)(this + 0x50);
            local_24 = local_30 - *(float *)(this + 0x54);
            local_20 = local_2c - *(float *)(this + 0x58);
            VectorNormalize((Vector *)&local_28);
            lVar9 = (longdouble)(**(code **)(*(int *)this + 4))();
            fVar10 = (float)lVar9;
            piVar8 = (int *)&stack0xffffff04;
            if (*(float *)(this + 0x18) <= fVar10) {
              if (0 < *(int *)(TongueDebug._28_4_ + 0x30)) {
                (**(code **)(*(int *)param_1 + 0xb8))();
                Msg();
              }
              piVar8 = (int *)&stack0xffffff04;
              if (*(float *)(this + 0x1c) <= fVar10 && fVar10 != *(float *)(this + 0x1c)) {
                *(CTerrorPlayer **)(this + 0x2c) = param_1;
                *(float *)(this + 0x1c) = fVar10;
                piVar8 = (int *)&stack0xffffff04;
              }
            }
          }
        }
      }
    }
  }
  else {
    local_a0 = param_1;
    local_94 = 0;
    local_90 = 0;
    if (___atan2f_finite == 0) {
      local_74 = 0;
    }
    else {
                    /* try { // try from 00847444 to 00847446 has its CatchHandler @ 00847cba */
      (**(code **)(___atan2f_finite + 0x50))();
      local_74 = ___atan2f_finite;
    }
    iVar5 = _DAT_0105db00;
    local_7c = local_94;
    local_78 = local_90;
                    /* try { // try from 0084747b to 008474c5 has its CatchHandler @ 00847c9f */
    if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
       (iVar4 = ThreadGetCurrentId(), iVar5 == iVar4)) {
      if ((char *)*_DAT_0105d15c != "TargetScan()") {
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc21c72,(char *)0x1,0xbfafa1);
      }
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
    piVar8 = (int *)&stack0xffffff04;
                    /* try { // try from 008474dd to 008474fe has its CatchHandler @ 00847cbe */
                    /* try { // try from 0084795f to 00847c70 has its CatchHandler @ 00847cbe */
    if ((((*(CTerrorPlayer **)(this + 4) != local_a0) &&
         (cVar3 = (**(code **)(*(int *)local_a0 + 300))(), piVar8 = (int *)&stack0xffffff04,
         cVar3 != '\0')) &&
        ((*(int *)(this + 0x14) == -1 ||
         (iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)local_a0),
         piVar8 = (int *)&stack0xffffff04, iVar5 == *(int *)(this + 0x14))))) &&
       (cVar3 = (**(code **)(*(int *)this + 0xc))(), piVar8 = (int *)&stack0xffffff04, cVar3 != '\0'
       )) {
      (**(code **)(**(int **)(this + 4) + 0x234))();
      fVar10 = *(float *)(this + 0x24);
      local_54 = *(float *)(this + 0xc) * fVar10 + local_60;
      local_50 = *(float *)(this + 0x10) * fVar10 + local_5c;
      local_58 = fVar10 * *(float *)(this + 8) + local_64;
      pVVar7 = (Vector *)(**(code **)(*(int *)local_a0 + 0x288))();
      CalcClosestPointOnLineSegment
                (pVVar7,(Vector *)&local_64,(Vector *)&local_58,(Vector *)&local_4c,(float *)0x0);
      pCVar2 = local_a0;
      if (((byte)*(CBaseEntity *)(local_a0 + 0x14d) & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)local_a0);
      }
      local_64 = *(float *)(pCVar2 + 0x2e0);
      local_60 = *(float *)(pCVar2 + 0x2e4);
      local_5c = *(float *)(pCVar2 + 0x2e8);
      local_58 = local_64;
      local_54 = local_60;
      local_50 = local_5c;
      iVar5 = (**(code **)(*(int *)(local_a0 + 0x194) + 8))();
      local_50 = local_50 + *(float *)(iVar5 + 8);
      CalcClosestPointOnLineSegment
                ((Vector *)&local_4c,(Vector *)&local_64,(Vector *)&local_58,(Vector *)&local_70,
                 (float *)0x0);
      if (this[0x28] != (TongueTargetScan<CTerrorPlayer>)0x0) {
        NDebugOverlay::Cross3D((Vector *)&local_70,1.0,0xff,0xff,0xff,true,-1.0);
        NDebugOverlay::Line((Vector *)&local_58,(Vector *)&local_64,0xff,0,0,true,-1.0);
      }
      (**(code **)(**(int **)(this + 4) + 0x234))();
      local_40 = local_70 - local_28;
      local_3c = local_6c - local_24;
      local_38 = local_68 - local_20;
      VectorNormalize((Vector *)&local_40);
      CCollisionProperty::CalcNearestPoint
                ((CCollisionProperty *)(*(int *)(this + 4) + 0x194),(Vector *)&local_70,
                 (Vector *)&local_34);
      CCollisionProperty::CalcNearestPoint
                ((CCollisionProperty *)(local_a0 + 0x194),(Vector *)&local_34,(Vector *)&local_28);
      fVar10 = SQRT((local_34 - local_28) * (local_34 - local_28) +
                    (local_30 - local_24) * (local_30 - local_24) +
                    (local_2c - local_20) * (local_2c - local_20));
      piVar8 = (int *)&stack0xfffffefc;
      if (fVar10 < *(float *)(this + 0x20) || fVar10 == *(float *)(this + 0x20)) {
        lVar9 = (longdouble)(**(code **)(*(int *)this + 4))();
        fVar10 = (float)lVar9;
        piVar8 = (int *)&stack0xfffffefc;
        if ((*(float *)(this + 0x18) <= fVar10 && fVar10 != *(float *)(this + 0x18)) &&
           (cVar3 = (**(code **)(*(int *)this + 8))(), piVar8 = (int *)&stack0xfffffefc,
           cVar3 != '\0')) {
          if (*(float *)(this + 0x1c) <= fVar10) {
            *(float *)(this + 0x1c) = fVar10;
            *(CTerrorPlayer **)(this + 0x2c) = local_a0;
          }
          CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::InsertBefore
                    ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)(this + 0x30),
                     *(int *)(this + 0x3c),&local_a0);
          piVar8 = (int *)&stack0xfffffefc;
        }
      }
    }
    iVar5 = _DAT_0105db00;
    if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
      piVar8[-1] = 0x84752e;
      iVar4 = ThreadGetCurrentId();
      if (iVar5 == iVar4) {
        *piVar8 = (int)_DAT_0105d15c;
        piVar8[-1] = 0x84753f;
        cVar3 = CVProfNode::ExitScope();
        if (cVar3 != '\0') {
          _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
        }
        DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
      }
    }
    if (local_74 != 0) {
      piVar8[5] = 0;
      piVar8[4] = 0;
      piVar8[3] = 0;
      *piVar8 = local_74;
      piVar8[1] = local_7c;
      piVar8[2] = local_78;
      pcVar1 = *(code **)(local_74 + 0x54);
      piVar8[-1] = 0x847593;
      (*pcVar1)();
    }
  }
  iVar5 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    piVar8[-1] = 0x84737b;
    iVar4 = ThreadGetCurrentId();
    if (iVar5 == iVar4) {
      *piVar8 = (int)_DAT_0105d15c;
      piVar8[-1] = 0x84738c;
      cVar3 = CVProfNode::ExitScope();
      if (cVar3 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  if (local_80 != 0) {
    piVar8[5] = 0;
    piVar8[4] = 0;
    piVar8[3] = 0;
    *piVar8 = local_80;
    piVar8[1] = local_88;
    piVar8[2] = local_84;
    pcVar1 = *(code **)(local_80 + 0x54);
    piVar8[-1] = 0x847361;
    (*pcVar1)();
  }
  return 1;
}

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)