L L4D2node

CTerrorPlayerAnimState::HandleActivity_Pummeling

0x00517740 · 2818 bytes · __thiscall

_ZN22CTerrorPlayerAnimState24HandleActivity_PummelingEv

Decompiled

undefined (1 param)

/* CTerrorPlayerAnimState::HandleActivity_Pummeling() */

int __thiscall CTerrorPlayerAnimState::HandleActivity_Pummeling(CTerrorPlayerAnimState *this)

{
  undefined4 uVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  uint uVar4;
  char cVar5;
  int iVar6;
  int iVar7;
  undefined4 *puVar8;
  int iVar9;
  undefined *puVar10;
  int *piVar11;
  CBaseEntity *this_00;
  undefined *puVar12;
  float fVar13;
  float local_178;
  int local_170;
  int local_16c;
  float local_168;
  float local_164;
  float local_160;
  uint local_15c;
  uint local_158;
  uint local_154;
  CTraceFilterSimple local_150 [16];
  CTraceFilterSimple local_140 [16];
  int *local_130;
  undefined4 local_12c;
  undefined4 local_128;
  int local_124;
  int *local_120;
  float local_11c;
  float local_118;
  float local_114;
  float local_10c;
  float local_108;
  float local_104;
  undefined4 local_fc;
  undefined4 local_f8;
  undefined4 local_f4;
  undefined4 local_ec;
  undefined4 local_e8;
  undefined4 local_e4;
  undefined4 local_dc;
  undefined1 local_d8;
  undefined1 local_d7;
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  Vector local_64 [32];
  float local_44;
  
  if (this[0x169] == (CTerrorPlayerAnimState)0x0) {
    if (this[0x16a] == (CTerrorPlayerAnimState)0x0) {
      iVar6 = -1;
    }
    else {
      uVar4 = *(uint *)(*(int *)(this + 0x118) + 0x3e44);
      if ((((uVar4 != 0xffffffff) &&
           (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
          && (*(uint *)(puVar10 + 8) == uVar4 >> 0xc)) && (*(int *)(puVar10 + 4) != 0)) {
        iVar7 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
        local_170 = 0;
        uVar4 = *(uint *)(*(int *)(this + 0x118) + 0x3e44);
        if (((uVar4 != 0xffffffff) &&
            (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar10 + 8) == uVar4 >> 0xc)) {
          local_170 = *(int *)(puVar10 + 4);
        }
        if (*(int *)(local_170 + 0x2ba0) == 1) {
          local_16c = 0x21b;
        }
        else {
          local_16c = (*(int *)(local_170 + 0x2ba0) != 2) + 0x21c;
        }
        if (iVar7 - 0x219U < 5) {
          if (*(float *)(*(int *)(this + 0x118) + 0x490) <= 0.99) {
            return iVar7;
          }
          piVar11 = (int *)0x0;
          if (((uVar4 != 0xffffffff) &&
              (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)
              ) && (*(uint *)(puVar10 + 8) == uVar4 >> 0xc)) {
            piVar11 = *(int **)(puVar10 + 4);
          }
          cVar5 = (**(code **)(*piVar11 + 0x7e8))(piVar11);
          if (cVar5 == '\0') {
            local_130 = (int *)0x0;
            local_12c = 0;
            local_128 = 0;
            local_124 = 0;
            local_120 = (int *)0x0;
                    /* try { // try from 005179f6 to 00517e5a has its CatchHandler @ 0051823f */
            CUtlVector<Activity,CUtlMemory<Activity,int>>::InsertBefore
                      ((CUtlVector<Activity,CUtlMemory<Activity,int>> *)&local_130,0,
                       (Activity *)&local_16c);
            puVar8 = (undefined4 *)
                     (**(code **)(**(int **)(this + 0x118) + 0x288))(*(int **)(this + 0x118));
            this_00 = *(CBaseEntity **)(this + 0x118);
            uVar1 = *puVar8;
            uVar2 = puVar8[1];
            uVar3 = puVar8[2];
            if (((byte)this_00[0x14d] & 8) == 0) {
              local_10c = 0.0;
              local_114 = *(float *)(this_00 + 0x2e8);
              fVar13 = 0.0;
              local_108 = 0.0;
              local_118 = *(float *)(this_00 + 0x2e4);
              local_178 = local_114 + 158.0;
              local_11c = *(float *)(this_00 + 0x2e0);
            }
            else {
                    /* try { // try from 00518143 to 0051822f has its CatchHandler @ 0051823f */
              CBaseEntity::CalcAbsolutePosition(this_00);
              local_10c = *(float *)(this_00 + 0x2e0);
              local_108 = *(float *)(this_00 + 0x2e4);
              local_178 = *(float *)(this_00 + 0x2e8) + 158.0;
              this_00 = *(CBaseEntity **)(this + 0x118);
              if (((byte)this_00[0x14d] & 8) == 0) {
                local_11c = *(float *)(this_00 + 0x2e0);
                local_118 = *(float *)(this_00 + 0x2e4);
                local_10c = local_10c - local_11c;
                local_114 = *(float *)(this_00 + 0x2e8);
                local_108 = local_108 - local_118;
                fVar13 = local_108 * local_108 + local_10c * local_10c;
              }
              else {
                CBaseEntity::CalcAbsolutePosition(this_00);
                local_11c = *(float *)(this_00 + 0x2e0);
                local_118 = *(float *)(this_00 + 0x2e4);
                local_10c = local_10c - local_11c;
                local_114 = *(float *)(this_00 + 0x2e8);
                local_108 = local_108 - local_118;
                fVar13 = local_10c * local_10c + local_108 * local_108;
              }
            }
            local_104 = local_178 - local_114;
            local_e4 = 0;
            local_e8 = 0;
            local_ec = 0;
            local_dc = 0;
            local_d8 = 1;
            local_d7 = local_104 * local_104 + fVar13 != 0.0;
            local_f4 = 0;
            local_f8 = 0;
            local_fc = 0;
            CTraceFilterSimple::CTraceFilterSimple
                      (local_150,(IHandleEntity *)this_00,0,(_func_bool_IHandleEntity_ptr_int *)0x0)
            ;
            (**(code **)(*enginetrace + 0x14))(enginetrace,&local_11c,0x46004003,local_150,local_70)
            ;
            if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
              DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
            }
            if (((local_44 < 1.0) && (148.0 <= local_44 * 158.0)) && (local_44 * 158.0 <= 158.0)) {
              local_cc = 0x21a;
              CUtlVector<Activity,CUtlMemory<Activity,int>>::InsertBefore
                        ((CUtlVector<Activity,CUtlMemory<Activity,int>> *)&local_130,local_124,
                         (Activity *)&local_cc);
            }
            (**(code **)(**(int **)(this + 0x118) + 0x24c))
                      (*(int **)(this + 0x118),&local_168,&local_15c,0);
            local_94 = 0;
            local_98 = 0;
            local_15c = local_15c ^ 0x80000000;
            local_bc = local_168 * 62.0;
            local_88 = 1;
            local_158 = local_158 ^ 0x80000000;
            local_9c = 0;
            local_154 = local_154 ^ 0x80000000;
            local_b8 = local_164 * 62.0;
            local_8c = 0;
            local_b4 = local_160 * 62.0;
            local_a4 = 0;
            local_a8 = 0;
            local_ac = 0;
            local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
            local_cc = uVar1;
            local_c8 = uVar2;
            local_c4 = uVar3;
            CTraceFilterSimple::CTraceFilterSimple
                      (local_140,*(IHandleEntity **)(this + 0x118),0,
                       (_func_bool_IHandleEntity_ptr_int *)0x0);
            (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x46004003,local_140,local_70);
            if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
              DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
            }
            if (((local_44 < 1.0) && (50.0 <= local_44 * 62.0)) && (local_44 * 62.0 <= 62.0)) {
              local_cc = 0x219;
                    /* try { // try from 00517faf to 0051800d has its CatchHandler @ 0051823f */
              CUtlVector<Activity,CUtlMemory<Activity,int>>::InsertBefore
                        ((CUtlVector<Activity,CUtlMemory<Activity,int>> *)&local_130,local_124,
                         (Activity *)&local_cc);
            }
            (**(code **)(*(int *)this + 0x38))(this);
            iVar6 = local_124;
            if (((1 < local_124) && (iVar9 = RandomInt(1,100), iVar6 = local_124, iVar9 < 0x33)) &&
               (0 < local_124)) {
              iVar6 = 0;
              piVar11 = local_130;
              if (iVar7 == *local_130) {
                iVar6 = 0;
              }
              else {
                do {
                  piVar11 = piVar11 + 1;
                  iVar6 = iVar6 + 1;
                  if (iVar6 == local_124) goto LAB_00517e48;
                } while (iVar7 != *piVar11);
              }
              iVar7 = (local_124 - iVar6) + -1;
              if (0 < iVar7) {
                _V_memmove(piVar11,local_130 + iVar6 + 1,iVar7 * 4);
              }
              local_124 = local_124 + -1;
              iVar6 = local_124;
            }
LAB_00517e48:
            iVar7 = RandomInt(0,iVar6 + -1);
            iVar7 = local_130[iVar7];
            local_124 = 0;
            CUtlMemory<Activity,int>::Purge((CUtlMemory<Activity,int> *)&local_130);
            local_120 = local_130;
            CUtlMemory<Activity,int>::Purge((CUtlMemory<Activity,int> *)&local_130);
            return iVar7;
          }
        }
        (**(code **)(*(int *)this + 0x38))(this);
        return local_16c;
      }
      this[0x16a] = (CTerrorPlayerAnimState)0x0;
      iVar6 = -1;
    }
  }
  else {
    iVar7 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
    if ((iVar7 != 0x217) || (*(float *)(*(int *)(this + 0x118) + 0x490) <= 0.99)) {
      iVar7 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
      if (iVar7 != 0x217) {
        (**(code **)(*(int *)this + 0x38))(this);
      }
      puVar10 = g_pEntityList;
      iVar7 = *(int *)(this + 0x118);
      iVar6 = 0x217;
      if (((((0.2 < *(float *)(iVar7 + 0x490)) && (this[0x15c] == (CTerrorPlayerAnimState)0x0)) &&
           (uVar4 = *(uint *)(iVar7 + 0x3e44), uVar4 != 0xffffffff)) &&
          ((puVar12 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc &&
           (*(uint *)(puVar12 + 8) == uVar4 >> 0xc)))) && (*(int *)(puVar12 + 4) != 0)) {
        this[0x15c] = (CTerrorPlayerAnimState)0x1;
        uVar4 = *(uint *)(iVar7 + 0x3e44);
        if (((uVar4 == 0xffffffff) ||
            (puVar10 = puVar10 + (uVar4 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
           (*(uint *)(puVar10 + 8) != uVar4 >> 0xc)) {
          piVar11 = (int *)0x0;
        }
        else {
          piVar11 = *(int **)(puVar10 + 4);
        }
        (**(code **)(*piVar11 + 0x7fc))(piVar11,0x4d,0);
        iVar6 = 0x217;
      }
    }
    else {
      uVar4 = *(uint *)(*(int *)(this + 0x118) + 0x3e44);
      if ((((uVar4 == 0xffffffff) ||
           (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc))
          || (*(uint *)(puVar10 + 8) != uVar4 >> 0xc)) || (*(int *)(puVar10 + 4) == 0)) {
        this[0x169] = (CTerrorPlayerAnimState)0x0;
        iVar6 = -1;
      }
      else {
        (**(code **)(*(int *)this + 4))(this,0x4a,0);
        uVar4 = *(uint *)(*(int *)(this + 0x118) + 0x3e44);
        piVar11 = (int *)0x0;
        if (((uVar4 != 0xffffffff) &&
            (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar10 + 8) == uVar4 >> 0xc)) {
          piVar11 = *(int **)(puVar10 + 4);
        }
        (**(code **)(*piVar11 + 0x7fc))(piVar11,0x4e,0);
        (**(code **)(*(int *)this + 0x38))(this);
        iVar7 = 0;
        uVar4 = *(uint *)(*(int *)(this + 0x118) + 0x3e44);
        if (((uVar4 != 0xffffffff) &&
            (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar10 + 8) == uVar4 >> 0xc)) {
          iVar7 = *(int *)(puVar10 + 4);
        }
        iVar6 = 0x21b;
        if (*(int *)(iVar7 + 0x2ba0) != 1) {
          return (*(int *)(iVar7 + 0x2ba0) != 2) + 0x21c;
        }
      }
    }
  }
  return iVar6;
}

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)