L L4D2node

CTongue::UpdateGroundChoke

0x00843ab0 · 1116 bytes · __thiscall

_ZN7CTongue17UpdateGroundChokeEv

Decompiled

undefined (1 param)

/* CTongue::UpdateGroundChoke() */

CBaseEntity __thiscall CTongue::UpdateGroundChoke(CTongue *this)

{
  float fVar1;
  float fVar2;
  uint uVar3;
  CBaseEntity *this_00;
  CBaseEntity *this_01;
  CBaseEdict *pCVar4;
  CBaseEntity *this_02;
  int iVar5;
  undefined *puVar6;
  longdouble lVar7;
  float fVar8;
  float fVar9;
  
  uVar3 = *(uint *)(this + 0x44c);
  if (uVar3 == 0xffffffff) {
    return (CBaseEntity)0x0;
  }
  puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10;
  if (puVar6 == (undefined *)0xfffffffc) {
    return (CBaseEntity)0x0;
  }
  if (*(uint *)(puVar6 + 8) != uVar3 >> 0xc) {
    return (CBaseEntity)0x0;
  }
  this_00 = *(CBaseEntity **)(puVar6 + 4);
  if (this_00 == (CBaseEntity *)0x0) {
    return (CBaseEntity)0x0;
  }
  uVar3 = *(uint *)(this_00 + 0x33c0);
  if (uVar3 == 0xffffffff) {
    return (CBaseEntity)0x0;
  }
  puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10;
  if (puVar6 == (undefined *)0xfffffffc) {
    return (CBaseEntity)0x0;
  }
  if (*(uint *)(puVar6 + 8) != uVar3 >> 0xc) {
    return (CBaseEntity)0x0;
  }
  this_01 = *(CBaseEntity **)(puVar6 + 4);
  if (this_01 == (CBaseEntity *)0x0) {
    return (CBaseEntity)0x0;
  }
  if (this_01[0x33dd] != (CBaseEntity)0x0) {
    return this_01[0x33dd];
  }
  if (this_01[0x39f1] == (CBaseEntity)0x0) {
    if (0 < *(int *)(this + 0x534)) {
      GetTonguePullDestination(true);
    }
    fVar1 = *(float *)(TongueNoProgressChokeTime._28_4_ + 0x2c);
    if (((byte)this_01[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_01);
    }
    fVar8 = *(float *)(this_01 + 0x2e0);
    fVar9 = *(float *)(this_01 + 0x2e4);
    fVar2 = *(float *)(this_01 + 0x2e8);
    if (((byte)this_00[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_00);
    }
    fVar8 = SQRT((fVar9 - *(float *)(this_00 + 0x2e4)) * (fVar9 - *(float *)(this_00 + 0x2e4)) +
                 (fVar8 - *(float *)(this_00 + 0x2e0)) * (fVar8 - *(float *)(this_00 + 0x2e0)) +
                 (fVar2 - *(float *)(this_00 + 0x2e8)) * (fVar2 - *(float *)(this_00 + 0x2e8)));
    fVar9 = *(float *)(this + 0x470) - fVar8;
    if (*(float *)(TongueNoProgressTolerance._28_4_ + 0x2c) <= fVar9 &&
        fVar9 != *(float *)(TongueNoProgressTolerance._28_4_ + 0x2c)) {
      if (*(float *)(this + 0x470) != fVar8) {
        if (this[0x6c] == (CTongue)0x0) {
          pCVar4 = *(CBaseEdict **)(this + 0x30);
          if (pCVar4 != (CBaseEdict *)0x0) {
            *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
            iVar5 = CBaseEdict::GetChangeAccessor(pCVar4);
            *(undefined2 *)(iVar5 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CTongue)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x470) = fVar8;
      }
      fVar1 = *(float *)(gpGlobals + 0xc);
      if (fVar1 != *(float *)(this + 0x474)) {
        if (this[0x6c] == (CTongue)0x0) {
          pCVar4 = *(CBaseEdict **)(this + 0x30);
          if (pCVar4 != (CBaseEdict *)0x0) {
            *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
            iVar5 = CBaseEdict::GetChangeAccessor(pCVar4);
            *(undefined2 *)(iVar5 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CTongue)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x474) = fVar1;
      }
    }
    else if ((fVar1 < *(float *)(gpGlobals + 0xc) - *(float *)(this + 0x474)) &&
            ((((this_01[0x33dc] != (CBaseEntity)0x0 ||
               (*(float *)(this_01 + 0x291c) <= *(float *)(gpGlobals + 0xc) - 2.0)) ||
              (uVar3 = *(uint *)(this_01 + 0x2954), uVar3 == 0xffffffff)) ||
             (((puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc
               || (*(uint *)(puVar6 + 8) != uVar3 >> 0xc)) ||
              ((this_02 = *(CBaseEntity **)(puVar6 + 4), this_02 == (CBaseEntity *)0x0 ||
               ((iVar5 = CBaseEntity::GetTeamNumber(this_02), iVar5 != 3 || (this_00 == this_02)))))
              ))))) {
      if (*(float *)(this + 0x494) <= 0.0) {
        lVar7 = (longdouble)IntervalTimer::Now();
        if ((float)lVar7 != *(float *)(this + 0x494)) {
          (**(code **)(*(int *)(this + 0x490) + 4))(this + 0x490,this + 0x494);
          *(float *)(this + 0x494) = (float)lVar7;
        }
      }
      iVar5 = CBaseEntity::GetGroundEntity(this_01);
      if (iVar5 != 0) {
        if (*(float *)(this + 0x494) <= 0.0) {
          return (CBaseEntity)0x1;
        }
        lVar7 = (longdouble)IntervalTimer::Now();
        if (*(float *)(TongueNoProgressDamageInterval._28_4_ + 0x2c) <=
            (float)lVar7 - *(float *)(this + 0x494) &&
            (float)lVar7 - *(float *)(this + 0x494) !=
            *(float *)(TongueNoProgressDamageInterval._28_4_ + 0x2c)) {
          CTerrorPlayer::OnStartHangingFromTongue((CTerrorPlayer *)this_01,2);
          return (CBaseEntity)0x1;
        }
        return (CBaseEntity)0x1;
      }
      goto LAB_00843d3d;
    }
  }
  if (*(float *)(this + 0x494) != -1.0) {
    (**(code **)(*(int *)(this + 0x490) + 4))(this + 0x490,this + 0x494);
    *(undefined4 *)(this + 0x494) = 0xbf800000;
  }
  iVar5 = CBaseEntity::GetGroundEntity(this_01);
  if (iVar5 != 0) {
    CTerrorPlayer::OnStopHangingFromTongue((CTerrorPlayer *)this_01,2);
    return (CBaseEntity)0x1;
  }
LAB_00843d3d:
  if (((this_01[0x33dc] == (CBaseEntity)0x0) && (0.0 < *(float *)(this + 0x494))) &&
     (lVar7 = (longdouble)IntervalTimer::Now(),
     *(float *)(TongueNoProgressBreakInterval._28_4_ + 0x2c) <=
     (float)lVar7 - *(float *)(this + 0x494) &&
     (float)lVar7 - *(float *)(this + 0x494) !=
     *(float *)(TongueNoProgressBreakInterval._28_4_ + 0x2c))) {
    return (CBaseEntity)0x0;
  }
  return (CBaseEntity)0x1;
}

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)