L L4D2node

CGrabController::UpdateObject

0x004ed4b0 · 3500 bytes · __thiscall

_ZN15CGrabController12UpdateObjectEP11CBasePlayerf

Decompiled

undefined (3 params)

/* WARNING: Removing unreachable block (ram,0x004eda3e) */
/* WARNING: Removing unreachable block (ram,0x004ed9f6) */
/* WARNING: Removing unreachable block (ram,0x004ee281) */
/* WARNING: Removing unreachable block (ram,0x004ee27a) */
/* CGrabController::UpdateObject(CBasePlayer*, float) */

char __thiscall
CGrabController::UpdateObject(CGrabController *this,CBasePlayer *param_1,float param_2)

{
  uint uVar1;
  CBaseEntity *this_00;
  int *piVar2;
  code *pcVar3;
  char cVar4;
  CBaseEntity *pCVar5;
  float *pfVar6;
  int iVar7;
  matrix3x4_t *pmVar8;
  Vector *pVVar9;
  int iVar10;
  undefined *puVar11;
  int *piVar12;
  longdouble lVar13;
  float fVar14;
  float fVar15;
  int *local_1c0;
  float local_1b8;
  float local_1b4;
  float local_1b0;
  Vector local_1ac [12];
  Vector local_1a0 [12];
  float local_194;
  float local_190;
  float local_18c;
  float local_188;
  float local_184;
  float local_180;
  float local_17c;
  float local_178;
  float local_174;
  float local_170;
  float local_16c;
  float local_168;
  Vector local_164 [8];
  float local_15c;
  Vector local_158 [8];
  float local_150;
  float local_14c;
  float local_148;
  float local_144;
  float local_140;
  float local_13c;
  float local_138;
  float local_134;
  float local_130;
  float local_12c;
  float local_128;
  float local_124;
  float local_120;
  float local_11c;
  float local_118;
  float local_114;
  CTraceFilterSkipTwoEntities local_110 [20];
  float local_fc;
  float local_f8;
  float local_f4;
  float local_cc;
  float local_c8;
  float 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;
  float local_70;
  float local_6c;
  float local_68;
  float local_44;
  
  uVar1 = *(uint *)(this + 0x2068);
  if ((((uVar1 == 0xffffffff) ||
       (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar11 + 8) != uVar1 >> 0xc)) ||
     (((this_00 = *(CBaseEntity **)(puVar11 + 4), this_00 == (CBaseEntity *)0x0 ||
       (lVar13 = (longdouble)ComputeError(this), param_2 < (float)lVar13)) ||
      ((pCVar5 = (CBaseEntity *)CBaseEntity::GetGroundEntity((CBaseEntity *)param_1),
       pCVar5 == this_00 || (piVar2 = *(int **)(this_00 + 0x238), piVar2 == (int *)0x0)))))) {
    cVar4 = '\0';
  }
  else {
    cVar4 = (**(code **)(*piVar2 + 0x2c))();
    if ((cVar4 != '\0') && (*(int *)(this + 0x2080) != *(int *)(gpGlobals + 4))) {
      *(int *)(this + 0x2080) = *(int *)(gpGlobals + 4);
      pfVar6 = (float *)(**(code **)(*(int *)param_1 + 0x238))();
      local_194 = *pfVar6;
      local_190 = pfVar6[1];
      local_18c = pfVar6[2];
      lVar13 = (longdouble)AngleDistance(local_194,0.0);
      local_194 = (float)lVar13;
      if (local_194 <= -75.0) {
        local_194 = -75.0;
      }
      if (75.0 <= local_194) {
        local_194 = 75.0;
      }
      AngleVectors((QAngle *)&local_194,(Vector *)&local_1b8,local_1ac,local_1a0);
      local_68 = -local_1b0;
      local_6c = -local_1b4;
      local_70 = -local_1b8;
      pcVar3 = *(code **)(*physcollision + 0x5c);
      if (((byte)this_00[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(this_00);
      }
      (**(code **)(*piVar2 + 300))();
      (*pcVar3)();
      pfVar6 = (float *)(**(code **)(*(int *)(param_1 + 0x194) + 8))();
      fVar14 = ABS(local_184 * local_1b4 + local_188 * local_1b8 + local_180 * local_1b0) +
               SQRT(*pfVar6 * *pfVar6 + pfVar6[1] * pfVar6[1]);
      fVar15 = fVar14 + fVar14 + 24.0;
      (**(code **)(*(int *)param_1 + 0x478))();
      piVar12 = (int *)&stack0xfffffdfc;
      local_16c = local_1b4 * fVar15 + local_178;
      local_168 = local_1b0 * fVar15 + local_174;
      local_170 = fVar15 * local_1b8 + local_17c;
      CTraceFilterSkipTwoEntities::CTraceFilterSkipTwoEntities
                (local_110,(IHandleEntity *)param_1,(IHandleEntity *)this_00,0);
      local_88 = 1;
      local_cc = local_17c;
      local_c8 = local_178;
      local_bc = local_170 - local_17c;
      local_94 = 0;
      local_b8 = local_16c - local_178;
      local_98 = 0;
      local_c4 = local_174;
      local_b4 = local_168 - local_174;
      local_9c = 0;
      local_8c = 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;
      (**(code **)(*enginetrace + 0x14))();
      if (0.5 <= local_44) {
        if (local_44 <= 1.0) {
          fVar15 = fVar15 - fVar14;
          local_16c = local_1b4 * fVar15 + local_178;
          local_168 = local_1b0 * fVar15 + local_174;
          local_170 = fVar15 * local_1b8 + local_17c;
        }
      }
      else {
        fVar15 = fVar14 * 0.5;
        local_16c = local_1b4 * fVar15 + local_178;
        local_168 = local_1b0 * fVar15 + local_174;
        local_170 = fVar15 * local_1b8 + local_17c;
      }
      CCollisionProperty::CollisionAABBToWorldAABB
                ((CCollisionProperty *)(param_1 + 0x194),(Vector *)(param_1 + 0x19c),
                 (Vector *)(param_1 + 0x1a8),local_164,local_158);
      if ((AllocTempVector()::s_vecTemp == '\0') && (iVar7 = __cxa_guard_acquire(), iVar7 != 0)) {
        __cxa_guard_release();
      }
      if ((AllocTempVector()::s_nIndex == '\0') && (iVar7 = __cxa_guard_acquire(), iVar7 != 0)) {
        AllocTempVector()::s_nIndex = 0;
        __cxa_guard_release();
      }
      AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
      LOCK();
      UNLOCK();
      iVar7 = AllocTempVector()::s_nIndex * 0xc;
      if ((AllocTempVector()::s_vecTemp == '\0') && (iVar10 = __cxa_guard_acquire(), iVar10 != 0)) {
        __cxa_guard_release();
      }
      if ((AllocTempVector()::s_nIndex == '\0') && (iVar10 = __cxa_guard_acquire(), iVar10 != 0)) {
        AllocTempVector()::s_nIndex = 0;
        __cxa_guard_release();
      }
      AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
      LOCK();
      UNLOCK();
      iVar10 = AllocTempVector()::s_nIndex * 0xc;
      *(float *)(AllocTempVector()::s_vecTemp + iVar10) =
           (*(float *)(param_1 + 0x1a8) - *(float *)(param_1 + 0x19c)) * 0.5 +
           *(float *)(param_1 + 0x19c);
      *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 4) =
           (*(float *)(param_1 + 0x1ac) - *(float *)(param_1 + 0x1a0)) * 0.5 +
           *(float *)(param_1 + 0x1a0);
      *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 8) =
           (*(float *)(param_1 + 0x1b0) - *(float *)(param_1 + 0x1a4)) * 0.5 +
           *(float *)(param_1 + 0x1a4);
      if (((((byte)param_1[0x1b4] & 0x40) == 0) && (((byte)param_1[0x1b6] & 0xfd) != 0)) &&
         ((pfVar6 = (float *)(**(code **)(*(int *)(param_1 + 0x194) + 0x24))(),
          vec3_angle != *pfVar6 || ((DAT_01053d40 != pfVar6[1] || (DAT_01053d44 != pfVar6[2])))))) {
        pmVar8 = (matrix3x4_t *)(**(code **)(*(int *)(param_1 + 0x194) + 0x28))();
        VectorTransform((float *)(AllocTempVector()::s_vecTemp + iVar10),pmVar8,
                        (float *)(AllocTempVector()::s_vecTemp + iVar7));
        local_114 = *(float *)(AllocTempVector()::s_vecTemp + iVar7 + 8);
        local_118 = *(float *)(AllocTempVector()::s_vecTemp + iVar7 + 4);
        local_11c = *(float *)(AllocTempVector()::s_vecTemp + iVar7);
      }
      else {
        pfVar6 = (float *)(**(code **)(*(int *)(param_1 + 0x194) + 0x20))();
        local_11c = *pfVar6 + *(float *)(AllocTempVector()::s_vecTemp + iVar10);
        *(float *)(AllocTempVector()::s_vecTemp + iVar7) = local_11c;
        local_118 = pfVar6[1] + *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 4);
        *(float *)(AllocTempVector()::s_vecTemp + iVar7 + 4) = local_118;
        local_114 = pfVar6[2] + *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 8);
        *(float *)(AllocTempVector()::s_vecTemp + iVar7 + 8) = local_114;
      }
      local_f4 = local_150 + local_114;
      local_114 = local_15c + local_114;
      local_fc = local_11c;
      local_f8 = local_118;
      CalcClosestPointOnLine
                ((Vector *)&local_170,(Vector *)&local_11c,(Vector *)&local_fc,(Vector *)&local_14c,
                 (float *)0x0);
      local_140 = local_170 - local_14c;
      local_13c = local_16c - local_148;
      local_138 = local_168 - local_144;
      lVar13 = (longdouble)VectorNormalize((Vector *)&local_140);
      if ((float)lVar13 < fVar14) {
        local_16c = local_13c * fVar14 + local_148;
        local_168 = local_138 * fVar14 + local_144;
        local_170 = fVar14 * local_140 + local_14c;
      }
      TransformAnglesFromPlayerSpace((QAngle *)&local_134,(CBasePlayer *)this);
      if (*(int *)(g_debug_physcannon._28_4_ + 0x30) != 0) {
        local_fc = 2.0;
        local_f8 = 2.0;
        local_f4 = 2.0;
        local_11c = -2.0;
        local_118 = -2.0;
        local_114 = -2.0;
        NDebugOverlay::Box((Vector *)&local_170,(Vector *)&local_11c,(Vector *)&local_fc,0,0xff,0,1,
                           0.0);
        local_1c0 = (int *)0x0;
        local_fc = fVar14 + 5.0;
        uVar1 = *(uint *)(this + 0x2068);
        local_11c = -local_fc;
        if (((uVar1 != 0xffffffff) &&
            (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
          local_1c0 = *(int **)(puVar11 + 4);
        }
        local_118 = local_11c;
        local_114 = local_11c;
        local_f8 = local_fc;
        local_f4 = local_fc;
        pVVar9 = (Vector *)(**(code **)(*local_1c0 + 0x288))();
        NDebugOverlay::Box(pVVar9,(Vector *)&local_11c,(Vector *)&local_fc,0xff,0,0,1,0.0);
      }
      if (((byte)param_1[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
      }
      Pickup_GetPreferredCarryAngles
                (this_00,param_1,(matrix3x4_t *)(param_1 + 0x28c),(QAngle *)&local_134);
      if (this[0x2078] != (CGrabController)0x0) {
        pfVar6 = (float *)(**(code **)(*(int *)param_1 + 0x238))();
        local_128 = *pfVar6;
        local_124 = pfVar6[1];
        local_120 = pfVar6[2];
        (**(code **)(*(int *)param_1 + 0x234))();
        local_128 = 0.0;
        piVar12 = (int *)&stack0xfffffdf8;
        if (((byte)param_1[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
        }
        fVar14 = *(float *)(param_1 + 0x2e8);
        iVar7 = (**(code **)(*(int *)(param_1 + 0x194) + 4))();
        if (local_128 < 0.0) {
          local_128 = local_128 * -1.0666667;
        }
        else {
          local_128 = local_128 * 0.033333335 *
                      ((*(float *)(iVar7 + 8) + fVar14 + 10.0) - local_114);
        }
        local_114 = (local_128 - 8.0) + local_114;
        local_128 = 0.0;
        AngleMatrix((QAngle *)&local_128,(Vector *)&local_11c,(matrix3x4_t *)&local_fc);
        TransformAnglesToWorldSpace((QAngle *)&local_11c,(matrix3x4_t *)(this + 0x206c));
        local_134 = local_11c;
        local_130 = local_118;
        local_12c = local_114;
      }
      piVar12[1] = (int)&local_fc;
      *piVar12 = (int)&local_134;
      piVar12[-1] = 0x4ee1cc;
      AngleMatrix((QAngle *)*piVar12,(matrix3x4_t *)piVar12[1]);
      piVar12[2] = (int)&local_128;
      piVar12[1] = (int)&local_fc;
      *piVar12 = (int)(this + 0x10);
      piVar12[-1] = 0x4ee1e2;
      VectorRotate((float *)*piVar12,(matrix3x4_t *)piVar12[1],(float *)piVar12[2]);
      piVar12[2] = (int)&local_134;
      local_11c = local_170 - local_128;
      piVar12[1] = (int)&local_11c;
      local_118 = local_16c - local_124;
      *piVar12 = (int)this;
      local_114 = local_168 - local_120;
      piVar12[-1] = 0x4ee249;
      SetTargetPosition((CGrabController *)*piVar12,(Vector *)piVar12[1],(QAngle *)piVar12[2]);
      return '\x01';
    }
  }
  return cVar4;
}

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)