L L4D2node

CTerrorPlayerAnimState::ComputePoseParam_AimYaw

0x005104e0 · 2237 bytes · __thiscall

_ZN22CTerrorPlayerAnimState23ComputePoseParam_AimYawEP10CStudioHdr

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CTerrorPlayerAnimState::ComputePoseParam_AimYaw(CStudioHdr*) */

void __thiscall
CTerrorPlayerAnimState::ComputePoseParam_AimYaw(CTerrorPlayerAnimState *this,CStudioHdr *param_1)

{
  int *piVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  undefined4 *puVar5;
  uint uVar6;
  undefined *puVar7;
  CBaseEntity *this_00;
  CTerrorPlayer *this_01;
  CBaseEntity *this_02;
  longdouble lVar8;
  longdouble lVar9;
  longdouble lVar10;
  uint uVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_40;
  undefined4 local_3c;
  int local_38;
  float local_34;
  float local_30;
  float local_2c;
  QAngle local_28 [4];
  undefined4 local_24;
  
  local_4c = 0;
  local_48 = 0;
  if (___atan2f_finite == 0) {
    local_38 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_4c,0,0,0,0,
               "/data/src/game/server/../../game/shared/terror/terrorplayeranimstate.cpp",0xab6,
               &ComputePoseParam_AimYaw(CStudioHdr*)::tm_fmt,"(%s)%s","Unaccounted",
               "CTerrorPlayerAnimState::ComputePoseParam_AimYaw");
    local_38 = ___atan2f_finite;
  }
  iVar4 = _DAT_0105db00;
  local_40 = local_4c;
  local_3c = local_48;
                    /* try { // try from 005107ce to 0051081c has its CatchHandler @ 00510e05 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar3 = ThreadGetCurrentId(), iVar4 == iVar3)) {
    if ((char *)*_DAT_0105d15c != "CTerrorPlayerAnimState::ComputePoseParam_AimYaw") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc2c9a0,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 0051059c to 0051076a has its CatchHandler @ 00510de4 */
  cVar2 = CTerrorGameRules::IsInIntro(g_pGameRules);
  this_00 = *(CBaseEntity **)(this + 0x118);
  if (cVar2 != '\0') {
    if (((byte)*(CTerrorPlayer *)(this_00 + 0x14d) & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_00);
    }
    *(undefined4 *)(this + 0xe4) = *(undefined4 *)(this_00 + 0x380);
    goto LAB_005105cc;
  }
  if ((*(CTerrorPlayer *)(this_00 + 0x39f1) == (CTerrorPlayer)0x0) && (*(int *)(this + 0x174) == -1)
     ) {
    if (*(CTerrorPlayer *)(this_00 + 0x186) == (CTerrorPlayer)0x9) {
      local_34 = vec3_origin - *(float *)(this_00 + 0x2000);
      local_30 = DAT_01053d4c - *(float *)(this_00 + 0x2004);
      local_2c = DAT_01053d50 - *(float *)(this_00 + 0x2008);
    }
    else {
      uVar11 = *(uint *)(this_00 + 0x33c0);
      if (uVar11 != 0xffffffff) {
        uVar6 = uVar11 & 0xfff;
        puVar5 = (undefined4 *)(g_pEntityList + uVar6 * 0x10 + 4);
        if (((puVar5 != (undefined4 *)0x0) &&
            (*(uint *)(g_pEntityList + uVar6 * 0x10 + 8) == uVar11 >> 0xc)) &&
           (*(int *)(g_pEntityList + uVar6 * 0x10 + 4) != 0)) {
          if (((byte)*(CTerrorPlayer *)(this_00 + 0x14d) & 8) == 0) {
LAB_00510b28:
            if (puVar5[1] == uVar11 >> 0xc) {
              this_02 = (CBaseEntity *)*puVar5;
            }
            else {
              this_02 = (CBaseEntity *)0x0;
            }
          }
          else {
            CBaseEntity::CalcAbsolutePosition(this_00);
            this_02 = (CBaseEntity *)0x0;
            uVar11 = *(uint *)(*(int *)(this + 0x118) + 0x33c0);
            if ((uVar11 != 0xffffffff) &&
               (puVar5 = (undefined4 *)(g_pEntityList + (uVar11 & 0xfff) * 0x10 + 4),
               puVar5 != (undefined4 *)0x0)) goto LAB_00510b28;
          }
          if (((byte)this_02[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(this_02);
          }
          local_34 = *(float *)(this_02 + 0x2e0) - *(float *)(this_00 + 0x2e0);
          local_30 = *(float *)(this_02 + 0x2e4) - *(float *)(this_00 + 0x2e4);
          local_2c = *(float *)(this_02 + 0x2e8) - *(float *)(this_00 + 0x2e8);
          goto LAB_005108bf;
        }
      }
      uVar11 = *(uint *)(this_00 + 0x33c4);
      if ((((uVar11 == 0xffffffff) ||
           (puVar7 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
          (*(uint *)(puVar7 + 8) != uVar11 >> 0xc)) ||
         (this_01 = *(CTerrorPlayer **)(puVar7 + 4), this_01 == (CTerrorPlayer *)0x0)) {
        if (((this[0x165] == (CTerrorPlayerAnimState)0x0) ||
            (uVar11 = *(uint *)(this_00 + 0x3edc), uVar11 == 0xffffffff)) ||
           ((puVar7 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc ||
            ((*(uint *)(puVar7 + 8) != uVar11 >> 0xc || (*(int *)(puVar7 + 4) == 0)))))) {
          if ((((this[0x161] == (CTerrorPlayerAnimState)0x0) ||
               (((uVar11 = *(uint *)(this_00 + 0x3e68), uVar11 == 0xffffffff ||
                 (puVar7 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
                 puVar7 == (undefined *)0xfffffffc)) || (*(uint *)(puVar7 + 8) != uVar11 >> 0xc))))
              || (iVar4 = *(int *)(puVar7 + 4), iVar4 == 0)) &&
             (((((this[0x159] == (CTerrorPlayerAnimState)0x0 &&
                 (this[0x15d] == (CTerrorPlayerAnimState)0x0)) ||
                ((uVar11 = *(uint *)(this_00 + 0x3e48), uVar11 == 0xffffffff ||
                 ((puVar7 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
                  puVar7 == (undefined *)0xfffffffc || (*(uint *)(puVar7 + 8) != uVar11 >> 0xc))))))
               || (iVar4 = *(int *)(puVar7 + 4), iVar4 == 0)) &&
              ((((uVar11 = *(uint *)(this_00 + 0x2a4c), uVar11 == 0xffffffff ||
                 (puVar7 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
                 puVar7 == (undefined *)0xfffffffc)) || (*(uint *)(puVar7 + 8) != uVar11 >> 0xc)) ||
               (iVar4 = *(int *)(puVar7 + 4), iVar4 == 0)))))) {
            cVar2 = CTerrorPlayer::IsPerformingActionOnSomeoneElse((CTerrorPlayer *)this_00,0);
            if (cVar2 == '\0') {
              this_01 = *(CTerrorPlayer **)(this + 0x118);
              cVar2 = CTerrorPlayer::IsRevivingSomeone(this_01);
              if (cVar2 == '\0') {
                cVar2 = CTerrorPlayer::IsBeingRevived(this_01);
                if (cVar2 == '\0') goto LAB_005105cc;
                if (((byte)this_01[0x14d] & 8) != 0) {
                  CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_01);
                }
                uVar11 = *(uint *)(*(int *)(this + 0x118) + 0x2e24);
              }
              else {
                if (((byte)this_01[0x14d] & 8) != 0) {
                  CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_01);
                }
                uVar11 = *(uint *)(*(int *)(this + 0x118) + 0x2e28);
              }
              if (((uVar11 == 0xffffffff) ||
                  (puVar7 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
                  puVar7 == (undefined *)0xfffffffc)) || (*(uint *)(puVar7 + 8) != uVar11 >> 0xc)) {
                this_00 = (CBaseEntity *)0x0;
              }
              else {
                this_00 = *(CBaseEntity **)(puVar7 + 4);
              }
            }
            else {
              this_00 = (CBaseEntity *)
                        CTerrorPlayer::GetEntityIAmPerformingActionOn
                                  (*(CTerrorPlayer **)(this + 0x118));
              if (this_00 == (CBaseEntity *)0x0) goto LAB_005105cc;
              this_01 = *(CTerrorPlayer **)(this + 0x118);
              if (((byte)*(CBaseEntity *)(this_01 + 0x14d) & 8) != 0) {
                CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_01);
              }
            }
            goto LAB_00510aa0;
          }
          lVar8 = (longdouble)
                  (**(code **)(**(int **)(iVar4 + 0x2910) + 0x80))(*(int **)(iVar4 + 0x2910));
          lVar8 = (longdouble)AngleNormalize((float)lVar8 + 180.0);
        }
        else {
          piVar1 = *(int **)(*(int *)(puVar7 + 4) + 0x2910);
          lVar8 = (longdouble)(**(code **)(*piVar1 + 0x80))(piVar1);
          lVar8 = (longdouble)AngleNormalize((float)lVar8);
        }
        *(float *)(this + 0xe4) = (float)lVar8;
        goto LAB_005105cc;
      }
      if (((byte)*(CBaseEntity *)(this_01 + 0x14d) & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_01);
        this_00 = *(CBaseEntity **)(this + 0x118);
      }
LAB_00510aa0:
      if (((byte)this_00[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(this_00);
      }
      local_34 = *(float *)(this_00 + 0x2e0) - *(float *)(this_01 + 0x2e0);
      local_30 = *(float *)(this_00 + 0x2e4) - *(float *)(this_01 + 0x2e4);
      local_2c = *(float *)(this_00 + 0x2e8) - *(float *)(this_01 + 0x2e8);
    }
  }
  else {
    local_34 = vec3_origin - *(float *)(this_00 + 0x3a20);
    local_30 = DAT_01053d4c - *(float *)(this_00 + 0x3a24);
    local_2c = DAT_01053d50 - *(float *)(this_00 + 0x3a28);
  }
LAB_005108bf:
                    /* try { // try from 005108d1 to 00510de1 has its CatchHandler @ 00510de4 */
  VectorAngles((Vector *)&local_34,local_28);
  *(undefined4 *)(this + 0xe4) = local_24;
LAB_005105cc:
  lVar8 = (longdouble)
          CBaseAnimating::GetPoseParameter(*(CBaseAnimating **)(this + 0x1c),*(int *)(this + 0x44));
  lVar9 = (longdouble)
          CBaseAnimating::GetPoseParameter(*(CBaseAnimating **)(this + 0x1c),*(int *)(this + 0x4c));
  lVar10 = (longdouble)AngleNormalize(*(float *)(this + 0xe4) - *(float *)(this + 0xf0));
  local_50 = (float)lVar10;
  if (*(char *)(*(int *)(this + 0x118) + 0x33bd) == '\0') {
    if (local_50 <= 90.0) {
      if (local_50 < -90.0) {
        local_50 = -180.0 - local_50;
      }
    }
    else {
      local_50 = 180.0 - local_50;
    }
  }
  lVar10 = (longdouble)CMultiPlayerAnimState::GetOuterXYSpeed((CMultiPlayerAnimState *)this);
  fVar14 = local_50 - (float)lVar9;
  fVar12 = *(float *)(this + 0x13c) * *(float *)(this + 0x148) * *(float *)(gpGlobals + 0x10) *
           fVar14 * (float)(~-(uint)(0.5 < (float)lVar10) & 0x40400000 |
                           -(uint)(0.5 < (float)lVar10) & 0x40a00000);
  uVar11 = -(uint)(ABS(fVar14) < ABS(fVar12));
  fVar14 = (float)(~uVar11 & (uint)fVar12 | (uint)fVar14 & uVar11) + (float)lVar9;
  fVar13 = (local_50 - fVar14) - (float)lVar8;
  fVar12 = *(float *)(this + 0x138) * *(float *)(gpGlobals + 0x10) * *(float *)(this + 0x148) *
           fVar13;
  uVar11 = -(uint)(ABS(fVar13) < ABS(fVar12));
  CBaseAnimating::SetPoseParameter
            (*(CBaseAnimating **)(this + 0x1c),param_1,*(int *)(this + 0x44),
             (float)(~uVar11 & (uint)fVar12 | (uint)fVar13 & uVar11) + (float)lVar8);
  CBaseAnimating::SetPoseParameter
            (*(CBaseAnimating **)(this + 0x1c),param_1,*(int *)(this + 0x4c),fVar14);
  iVar4 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar3 = ThreadGetCurrentId(), iVar4 == iVar3)) {
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_38 != 0) {
    (**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
  }
  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)