L L4D2node

CTongue::UpdateAirChoke

0x00843490 · 1532 bytes · __thiscall

_ZN7CTongue14UpdateAirChokeEv

Decompiled

undefined (1 param)

/* CTongue::UpdateAirChoke() */

void __thiscall CTongue::UpdateAirChoke(CTongue *this)

{
  uint uVar1;
  CBaseEntity *this_00;
  CBaseEdict *this_01;
  int iVar2;
  int iVar3;
  undefined *puVar4;
  float fVar5;
  CTongue *pCVar6;
  undefined4 uVar7;
  float local_f0;
  float local_e8;
  float local_e4;
  float local_e0;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  float local_ac;
  float local_a8;
  float local_a4;
  float local_9c;
  float local_98;
  float local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  float local_70;
  float local_6c;
  float local_68;
  Vector local_64 [32];
  float local_44;
  
  uVar1 = *(uint *)(this + 0x44c);
  if (uVar1 == 0xffffffff) {
    return;
  }
  puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
  if (puVar4 == (undefined *)0xfffffffc) {
    return;
  }
  if (*(uint *)(puVar4 + 8) != uVar1 >> 0xc) {
    return;
  }
  if (*(int *)(puVar4 + 4) == 0) {
    return;
  }
  uVar1 = *(uint *)(*(int *)(puVar4 + 4) + 0x33c0);
  if (uVar1 == 0xffffffff) {
    return;
  }
  puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
  if (puVar4 == (undefined *)0xfffffffc) {
    return;
  }
  if (*(uint *)(puVar4 + 8) != uVar1 >> 0xc) {
    return;
  }
  this_00 = *(CBaseEntity **)(puVar4 + 4);
  if (this_00 == (CBaseEntity *)0x0) {
    return;
  }
  iVar2 = CBaseEntity::GetGroundEntity(this_00);
  if ((iVar2 != 0) && (fVar5 = *(float *)(gpGlobals + 0xc), fVar5 != *(float *)(this + 0x478))) {
    if (this[0x6c] == (CTongue)0x0) {
      this_01 = *(CBaseEdict **)(this + 0x30);
      if (this_01 != (CBaseEdict *)0x0) {
        *(uint *)this_01 = *(uint *)this_01 | 0x101;
        iVar2 = CBaseEdict::GetChangeAccessor(this_01);
        *(undefined2 *)(iVar2 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTongue)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x478) = fVar5;
  }
  uVar7 = 0;
  pCVar6 = this;
  GetTonguePullDestination(SUB41((Vector *)&local_70,0));
  if (((byte)this_00[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(this_00);
  }
  local_e8 = *(float *)(this_00 + 0x2e0) - local_70;
  local_e4 = *(float *)(this_00 + 0x2e4) - local_6c;
  local_e0 = *(float *)(this_00 + 0x2e8) - local_68;
  if (2500.0 < local_e8 * local_e8 + local_e4 * local_e4) {
    if (((byte)this_00[0x14d] & 0x10) != 0) {
      CBaseEntity::CalcAbsoluteVelocity(this_00);
    }
    if (*(float *)(this_00 + 0x274) <= -0.01) {
      return;
    }
    if (0.01 <= *(float *)(this_00 + 0x274)) {
      return;
    }
    if (*(float *)(this_00 + 0x278) <= -0.01) {
      return;
    }
    if (0.01 <= *(float *)(this_00 + 0x278)) {
      return;
    }
    if (*(float *)(this_00 + 0x27c) <= -0.01) {
      return;
    }
    if (0.01 <= *(float *)(this_00 + 0x27c)) {
      return;
    }
  }
  VectorNormalize((Vector *)&local_e8);
  if (-local_e0 < *(float *)(TongueVerticalChokeDot._28_4_ + 0x2c)) {
    return;
  }
  fVar5 = *(float *)(gpGlobals + 0xc) - *(float *)(this + 0x478);
  if (fVar5 < *(float *)(TongueVerticalChokeTimeOffGround._28_4_ + 0x2c) ||
      fVar5 == *(float *)(TongueVerticalChokeTimeOffGround._28_4_ + 0x2c)) {
    iVar2 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules,pCVar6,uVar7);
    iVar3 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    local_f0 = *(float *)(TongueVerticalChokeHeight._28_4_ + 0x2c);
    if (((byte)this_00[0x14d] & 8) == 0) {
      local_c4 = *(float *)(this_00 + 0x2e8);
      local_f0 = local_c4 - local_f0;
      local_b8 = 0.0;
      local_bc = 0.0;
      fVar5 = 0.0;
      local_cc = *(float *)(this_00 + 0x2e0);
      local_c8 = *(float *)(this_00 + 0x2e4);
    }
    else {
      CBaseEntity::CalcAbsolutePosition(this_00);
      local_c4 = *(float *)(this_00 + 0x2e8);
      local_f0 = local_c4 - local_f0;
      local_cc = *(float *)(this_00 + 0x2e0);
      local_c8 = *(float *)(this_00 + 0x2e4);
      if (((byte)this_00[0x14d] & 8) == 0) {
        local_bc = 0.0;
        local_b8 = 0.0;
        fVar5 = local_bc;
      }
      else {
        CBaseEntity::CalcAbsolutePosition(this_00);
        local_bc = local_cc - *(float *)(this_00 + 0x2e0);
        local_c4 = *(float *)(this_00 + 0x2e8);
        local_b8 = local_c8 - *(float *)(this_00 + 0x2e4);
        fVar5 = local_bc * local_bc + local_b8 * local_b8;
        local_cc = *(float *)(this_00 + 0x2e0);
        local_c8 = *(float *)(this_00 + 0x2e4);
      }
    }
    local_8c = 0;
    local_b4 = local_f0 - local_c4;
    local_87 = local_b4 * local_b4 + fVar5 != 0.0;
    local_9c = (*(float *)(iVar2 + 0x18) - *(float *)(iVar3 + 0xc)) * 0.5;
    local_98 = (*(float *)(iVar2 + 0x1c) - *(float *)(iVar3 + 0x10)) * 0.5;
    local_94 = (*(float *)(iVar2 + 0x20) - *(float *)(iVar3 + 0x14)) * 0.5;
    local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
    local_ac = (*(float *)(iVar2 + 0x18) + *(float *)(iVar3 + 0xc)) * 0.5;
    local_cc = local_cc + local_ac;
    local_ac = -local_ac;
    local_a8 = (*(float *)(iVar2 + 0x1c) + *(float *)(iVar3 + 0x10)) * 0.5;
    local_c8 = local_c8 + local_a8;
    local_a8 = -local_a8;
    local_a4 = (*(float *)(iVar2 + 0x20) + *(float *)(iVar3 + 0x14)) * 0.5;
    local_c4 = local_c4 + local_a4;
    local_a4 = -local_a4;
    CTraceFilterSimple::CTraceFilterSimple
              (local_dc,(IHandleEntity *)this_00,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
    (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x400b,local_dc,(Vector *)&local_70);
    if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
      DebugDrawLine((Vector *)&local_70,local_64,0xff,0xff,0,true,-1.0);
    }
    if ((this_00[0x39f1] == (CBaseEntity)0x0) && (1.0 <= local_44)) goto LAB_0084398b;
  }
  else if (this_00[0x39f1] == (CBaseEntity)0x0) {
LAB_0084398b:
    CTerrorPlayer::OnStartHangingFromTongue((CTerrorPlayer *)this_00,1);
    *(undefined4 *)(this + 0x570) = *(undefined4 *)(this_00 + 0x2ba0);
    return;
  }
  CTerrorPlayer::OnStopHangingFromTongue((CTerrorPlayer *)this_00,1);
  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)