L L4D2node

CBreakableSurface::TraceAttack

0x006b95a0 · 3459 bytes · __thiscall

_ZN17CBreakableSurface11TraceAttackERK15CTakeDamageInfoRK6VectorP10CGameTrace

Decompiled

undefined (4 params)

/* CBreakableSurface::TraceAttack(CTakeDamageInfo const&, Vector const&, CGameTrace*) */

void __thiscall
CBreakableSurface::TraceAttack
          (CBreakableSurface *this,CTakeDamageInfo *param_1,Vector *param_2,CGameTrace *param_3)

{
  float fVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  undefined *puVar5;
  int iVar6;
  int iVar7;
  Vector *pVVar8;
  uint uVar9;
  int iVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  variant_t *this_00;
  CBaseEntity *pCVar15;
  uint local_e0;
  int local_d8;
  int local_d0;
  float local_c4;
  float local_c0;
  float local_bc;
  float local_b8;
  float local_b4 [3];
  float local_a8;
  float local_a4;
  float local_a0;
  undefined **local_9c;
  float local_98;
  float local_94;
  float local_7c;
  float local_78;
  float local_74;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined2 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined1 local_24;
  undefined1 local_23;
  
  iVar3 = *(int *)(this + 0x100);
  iVar7 = iVar3 - (int)*(float *)(param_1 + 0x3c);
  if (iVar3 != iVar7) {
    (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
    *(int *)(this + 0x100) = iVar7;
    iVar3 = iVar7;
  }
  pVVar8 = (Vector *)0x0;
  uVar9 = *(uint *)(param_1 + 0x34);
  if (((uVar9 != 0xffffffff) &&
      (puVar5 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar5 + 8) == uVar9 >> 0xc)) {
    pVVar8 = *(Vector **)(puVar5 + 4);
  }
  local_c4 = (float)iVar3;
  this_00 = (variant_t *)(this + 0x4a4);
  variant_t::Set(this_00,1,&local_c4);
  local_7c = *(float *)(this + 0x4a4);
  local_78 = *(float *)(this + 0x4a8);
  local_74 = *(float *)(this + 0x4ac);
  local_70 = *(undefined4 *)(this + 0x4b0);
  local_6c = *(undefined4 *)(this + 0x4b4);
  pCVar15 = (CBaseEntity *)&local_7c;
  CBaseEntityOutput::FireOutput();
  if (this[0x524] == (CBreakableSurface)0x0) {
    local_7c = *(float *)(param_3 + 0xc) - *(float *)param_3;
    local_78 = *(float *)(param_3 + 0x10) - *(float *)(param_3 + 4);
    local_74 = *(float *)(param_3 + 0x14) - *(float *)(param_3 + 8);
    Die((CBreakableSurface *)this_00,pCVar15,pVVar8);
  }
  if ((*(uint *)(param_1 + 0x48) & 0x82) == 0) {
    if ((*(uint *)(param_1 + 0x48) & 0x240) != 0) {
      if (*(int *)(this + 0x528) == 1) {
        uVar9 = *(uint *)(param_1 + 0x34);
        if ((((uVar9 == 0xffffffff) ||
             (puVar5 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc))
            || (*(uint *)(puVar5 + 8) != uVar9 >> 0xc)) ||
           (pCVar15 = *(CBaseEntity **)(puVar5 + 4), pCVar15 == (CBaseEntity *)0x0)) {
          PanePos(this,(Vector *)(param_3 + 0xc),&local_a8,(float *)&local_9c);
        }
        else {
          if (((byte)pCVar15[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(pCVar15);
          }
          PanePos(this,(Vector *)(pCVar15 + 0x2e0),&local_a8,(float *)&local_9c);
        }
        local_e0 = 4;
        local_d8 = (int)local_a8 + -4;
        iVar6 = (int)local_a8 + 3;
        iVar3 = (int)(float)local_9c + -4;
        iVar7 = (int)(float)local_9c + 3;
        if (local_d8 <= iVar6) {
          do {
            if (iVar3 <= iVar7) {
              uVar9 = 4;
              iVar10 = iVar3;
              do {
                while (iVar4 = (**(code **)(*random_valve + 8))(random_valve,2,5),
                      iVar4 <= (int)((((int)uVar9 >> 0x1f ^ uVar9) - ((int)uVar9 >> 0x1f)) +
                                    ((local_e0 ^ (int)local_e0 >> 0x1f) - ((int)local_e0 >> 0x1f))))
                {
                  iVar10 = iVar10 + 1;
                  uVar9 = uVar9 - 1;
                  if (iVar7 < iVar10) goto LAB_006b9d40;
                }
                uVar9 = uVar9 - 1;
                local_7c = *(float *)param_2 * 500.0;
                local_78 = *(float *)(param_2 + 4) * 500.0;
                iVar4 = iVar10 + 1;
                local_74 = *(float *)(param_2 + 8) * 500.0;
                ShatterPane(this,local_d8,iVar10,(Vector *)&local_7c,(Vector *)(param_3 + 0xc));
                iVar10 = iVar4;
              } while (iVar4 <= iVar7);
            }
LAB_006b9d40:
            local_d8 = local_d8 + 1;
            local_e0 = local_e0 - 1;
            if (iVar6 < local_d8) {
              return;
            }
          } while( true );
        }
      }
      else {
        local_7c = *(float *)(this + 0x50c);
        local_78 = *(float *)(this + 0x510);
        local_74 = *(float *)(this + 0x514);
        if (*(float *)(param_2 + 4) * local_78 + *(float *)param_2 * local_7c +
            *(float *)(param_2 + 8) * local_74 <= 0.0) {
          local_c0 = *(float *)(param_1 + 0x3c) * -3000.0;
        }
        else {
          local_c0 = *(float *)(param_1 + 0x3c) * 3000.0;
        }
        local_b8 = local_c0 * local_74;
        local_bc = local_c0 * local_78;
        local_c0 = local_c0 * local_7c;
        if (*(int *)(this + 0x52c) < *(int *)(this + 0x4fc) * *(int *)(this + 0x500)) {
          local_7c = -local_7c;
          local_78 = -local_78;
          local_74 = -local_74;
          if ((double)(*(int *)(this + 0x4fc) * *(int *)(this + 0x500)) * 0.1 <=
              (double)*(int *)(this + 0x52c)) {
            VectorAngles((Vector *)&local_7c,(QAngle *)local_b4);
            AngleVectors((QAngle *)local_b4,(Vector *)0x0,(Vector *)&local_a8,(Vector *)&local_9c);
            if (0 < *(int *)(this + 0x4fc)) {
              local_d0 = 0;
              do {
                if (0 < *(int *)(this + 0x500)) {
                  fVar14 = (float)local_d0;
                  iVar7 = 0;
                  iVar3 = 0;
LAB_006ba08a:
                  do {
                    iVar6 = iVar3;
                    cVar2 = IsBroken(this,local_d0,iVar6);
                    if (cVar2 == '\0') {
                      iVar7 = iVar7 + 1;
                    }
                    else if (iVar7 != 0) {
                      fVar1 = *(float *)(this + 0x508);
                      fVar12 = (float)(iVar6 - iVar7);
                      fVar13 = *(float *)(this + 0x504);
                      local_74 = local_a0 * fVar13 * fVar14 + *(float *)(this + 0x520) +
                                 local_94 * fVar1 * fVar12;
                      local_78 = local_a4 * fVar13 * fVar14 + *(float *)(this + 0x51c) +
                                 local_98 * fVar1 * fVar12;
                      fVar11 = (float)iVar7;
                      iVar7 = 0;
                      local_7c = local_a8 * fVar13 * fVar14 + *(float *)(this + 0x518) +
                                 (float)local_9c * fVar1 * fVar12;
                      CreateShards((Vector *)this,(QAngle *)&local_7c,(Vector *)local_b4,
                                   (Vector *)&local_c0,(float)(param_3 + 0xc),fVar13,
                                   (int)(fVar11 * fVar1));
                      iVar3 = iVar6 + 1;
                      if (*(int *)(this + 0x500) <= iVar6 + 1) break;
                      goto LAB_006ba08a;
                    }
                    iVar3 = iVar6 + 1;
                  } while (iVar6 + 1 < *(int *)(this + 0x500));
                  if (iVar7 != 0) {
                    fVar14 = *(float *)(this + 0x508);
                    fVar11 = (float)((iVar6 + 1) - iVar7);
                    fVar13 = (float)local_d0;
                    fVar1 = *(float *)(this + 0x504);
                    local_74 = local_a0 * fVar1 * fVar13 + *(float *)(this + 0x520) +
                               local_94 * fVar14 * fVar11;
                    local_78 = local_a4 * fVar1 * fVar13 + *(float *)(this + 0x51c) +
                               local_98 * fVar14 * fVar11;
                    local_7c = local_a8 * fVar1 * fVar13 + *(float *)(this + 0x518) +
                               (float)local_9c * fVar14 * fVar11;
                    CreateShards((Vector *)this,(QAngle *)&local_7c,(Vector *)local_b4,
                                 (Vector *)&local_c0,(float)(param_3 + 0xc),fVar1,
                                 (int)((float)iVar7 * fVar14));
                  }
                }
                local_d0 = local_d0 + 1;
              } while (local_d0 < *(int *)(this + 0x4fc));
            }
          }
          else {
            VectorAngles((Vector *)&local_7c,(QAngle *)&local_9c);
            CreateShards((Vector *)this,(QAngle *)(this + 0x518),(Vector *)&local_9c,
                         (Vector *)&local_c0,(float)(param_3 + 0xc),
                         (float)*(int *)(this + 0x4fc) * *(float *)(this + 0x504),
                         (int)((float)*(int *)(this + 0x500) * *(float *)(this + 0x508)));
          }
          BreakAllPanes(this);
        }
      }
    }
  }
  else {
    pVVar8 = (Vector *)(param_3 + 0xc);
    PanePos(this,pVVar8,local_b4,&local_a8);
    iVar7 = (int)local_b4[0];
    iVar3 = (int)local_a8;
    local_7c = *(float *)param_2 * 500.0;
    local_78 = *(float *)(param_2 + 4) * 500.0;
    local_74 = *(float *)(param_2 + 8) * 500.0;
    cVar2 = ShatterPane(this,iVar7,iVar3,(Vector *)&local_7c,pVVar8);
    if (cVar2 != '\0') {
      local_70 = 0;
      local_34 = 0;
      local_6c = 0;
      local_68 = 0;
      local_58 = 0;
      local_64 = *(undefined4 *)(param_3 + 0x18);
      local_54 = 0;
      local_50 = 0;
      local_60 = *(undefined4 *)(param_3 + 0x1c);
      local_4c = 0;
      local_5c = *(undefined4 *)(param_3 + 0x20);
      local_48 = 0;
      local_7c = *(float *)(param_3 + 0xc);
      local_44 = 0x3f800000;
      local_78 = *(float *)(param_3 + 0x10);
      local_38 = 0;
      local_74 = *(float *)(param_3 + 0x14);
      local_40 = 0;
      local_3c = 0;
      local_30 = 0;
      local_2c = 0;
      local_28 = 0;
      local_24 = 0;
      local_23 = 0;
      CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_9c);
      local_9c = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 006b9f8c to 006b9f90 has its CatchHandler @ 006ba359 */
      CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)&local_9c,(Vector *)&local_7c);
                    /* try { // try from 006b9fa2 to 006b9fcb has its CatchHandler @ 006ba337 */
      CRecipientFilter::SetIgnorePredictionCull((CRecipientFilter *)&local_9c,true);
      DispatchEffect((IRecipientFilter *)&local_9c,0.0,"GlassImpact",(CEffectData *)&local_7c);
      local_9c = &PTR__CPASFilter_00bfaf28;
      CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_9c);
    }
    if (*(int *)(this + 0x528) == 0) {
      if ((local_b4[0] - (float)iVar7 <= 0.8) || (*(int *)(this + 0x4fc) + -1 == iVar7)) {
        if ((local_b4[0] - (float)iVar7 < 0.2) && (iVar7 != 0)) {
          local_7c = *(float *)param_2 * 500.0;
          local_78 = *(float *)(param_2 + 4) * 500.0;
          local_74 = *(float *)(param_2 + 8) * 500.0;
          ShatterPane(this,iVar7 + -1,iVar3,(Vector *)&local_7c,pVVar8);
        }
      }
      else {
        local_7c = *(float *)param_2 * 500.0;
        local_78 = *(float *)(param_2 + 4) * 500.0;
        local_74 = *(float *)(param_2 + 8) * 500.0;
        ShatterPane(this,iVar7 + 1,iVar3,(Vector *)&local_7c,pVVar8);
      }
      if ((local_a8 - (float)iVar3 <= 0.8) || (*(int *)(this + 0x500) + -1 == iVar3)) {
        if ((local_a8 - (float)iVar3 < 0.2) && (iVar3 != 0)) {
          local_7c = *(float *)param_2 * 500.0;
          local_78 = *(float *)(param_2 + 4) * 500.0;
          local_74 = *(float *)(param_2 + 8) * 500.0;
          ShatterPane(this,iVar7,iVar3 + -1,(Vector *)&local_7c,pVVar8);
        }
      }
      else {
        local_7c = *(float *)param_2 * 500.0;
        local_78 = *(float *)(param_2 + 4) * 500.0;
        local_74 = *(float *)(param_2 + 8) * 500.0;
        ShatterPane(this,iVar7,iVar3 + 1,(Vector *)&local_7c,pVVar8);
      }
      iVar6 = (**(code **)(*random_valve + 8))(random_valve,0,1);
      if (iVar6 == 0) {
        local_7c = *(float *)param_2 * 1000.0;
        local_78 = *(float *)(param_2 + 4) * 1000.0;
        local_74 = *(float *)(param_2 + 8) * 1000.0;
        ShatterPane(this,iVar7,iVar3 + 1,(Vector *)&local_7c,pVVar8);
        iVar6 = (**(code **)(*random_valve + 8))(random_valve,0,1);
        if (iVar6 == 0) {
          local_7c = *(float *)param_2 * 1000.0;
          local_78 = *(float *)(param_2 + 4) * 1000.0;
          local_74 = *(float *)(param_2 + 8) * 1000.0;
          ShatterPane(this,iVar7,iVar3 + 2,(Vector *)&local_7c,pVVar8);
        }
      }
    }
  }
  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)