L L4D2node

CDispCollTree::AABBTree_SweepAABB

0x000cecc0 · 2178 bytes · __thiscall

_ZN13CDispCollTree18AABBTree_SweepAABBERK5Ray_tRK6VectorP10CBaseTrace

Decompiled

undefined (4 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CDispCollTree::AABBTree_SweepAABB(Ray_t const&, Vector const&, CBaseTrace*) */

bool __thiscall
CDispCollTree::AABBTree_SweepAABB
          (CDispCollTree *this,Ray_t *param_1,Vector *param_2,CBaseTrace *param_3)

{
  short *psVar1;
  int *piVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  uint uVar10;
  char cVar11;
  ushort uVar12;
  int iVar13;
  int iVar14;
  memhandle_t__ *pmVar15;
  int iVar16;
  float *pfVar17;
  uint uVar18;
  int iVar19;
  int iVar20;
  bool bVar21;
  float fVar22;
  undefined1 auVar23 [16];
  float fVar24;
  undefined1 auVar25 [16];
  float fVar26;
  float fVar27;
  float fVar28;
  float fVar29;
  float fVar30;
  undefined1 auVar31 [16];
  float fVar32;
  float fVar33;
  float fVar34;
  float fVar35;
  undefined1 auVar36 [16];
  undefined1 auVar37 [16];
  undefined1 auVar38 [16];
  float fVar39;
  float fVar40;
  float fVar41;
  float fVar42;
  undefined1 auVar43 [16];
  undefined1 auVar44 [16];
  undefined1 auVar45 [16];
  undefined1 auVar46 [16];
  undefined4 local_654;
  undefined4 local_650;
  undefined4 local_64c;
  undefined4 local_648;
  undefined4 local_640;
  undefined4 local_63c;
  int local_638;
  undefined4 local_634;
  undefined4 local_630;
  undefined4 local_62c;
  undefined4 local_628;
  undefined4 local_624;
  int local_620;
  int local_58c [351];
  
  local_654 = 0;
  local_650 = 0;
  if (_exit == 0) {
    local_638 = 0;
  }
  else {
    (**(code **)(_exit + 0x50))
              (_exit,&local_654,0,0,0,0,"/data/src/engine/../public/dispcoll_common.cpp",0x37e,
               &AABBTree_SweepAABB(Ray_t_const&,Vector_const&,CBaseTrace*)::tm_fmt,"(%s)%s",
               "Unaccounted","Disp_AABBTree_SweepAABB");
    local_638 = _exit;
  }
  iVar14 = _DAT_0040b9d4;
  local_640 = local_654;
  local_63c = local_650;
                    /* try { // try from 000cf0be to 000cf10c has its CatchHandler @ 000cf5e2 */
  if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
     (iVar16 = ThreadGetCurrentId(), iVar14 == iVar16)) {
    if ((char *)*_DAT_0040b030 != "Disp_AABBTree_SweepAABB") {
      _DAT_0040b030 =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2a28ee,&DAT_00000001,0x2a054b);
    }
    CVProfNode::EnterScope();
    DAT_0040b02c = '\0';
  }
  if ((*(uint *)(this + 0x2c) & 4) == 0) {
    local_634 = *(undefined4 *)(param_1 + 0x10);
    local_630 = *(undefined4 *)(param_1 + 0x14);
    local_62c = *(undefined4 *)(param_1 + 0x18);
                    /* try { // try from 000cedd1 to 000cedd5 has its CatchHandler @ 000cf5e6 */
    VectorNormalize((Vector *)&local_634);
    fVar3 = *(float *)param_2;
    fVar4 = *(float *)(param_2 + 4);
    local_58c[0] = 0;
    iVar14 = *(int *)(this + 0x98);
    fVar5 = *(float *)(param_3 + 0x2c);
    fVar6 = *(float *)(param_2 + 8);
    fVar7 = *(float *)param_1;
    iVar20 = 0;
    fVar8 = *(float *)(param_1 + 4);
    fVar24 = _DAT_00343b58 + *(float *)(param_1 + 0x34);
    fVar9 = *(float *)(param_1 + 8);
    fVar22 = _DAT_00343b5c + *(float *)(param_1 + 0x38);
    fVar26 = g_Vec3DispCollEpsilons + *(float *)(param_1 + 0x30);
    iVar13 = 0;
    iVar16 = 0;
    while (iVar16 < iVar14) {
      iVar20 = iVar20 + 1;
      pfVar17 = (float *)(iVar16 * 0x60 + *(int *)(this + 0x90));
      fVar27 = ((pfVar17[4] - fVar8) - fVar24) * fVar4;
      fVar28 = ((pfVar17[5] - fVar8) - fVar24) * fVar4;
      fVar29 = ((pfVar17[6] - fVar8) - fVar24) * fVar4;
      fVar30 = ((pfVar17[7] - fVar8) - fVar24) * fVar4;
      auVar25._0_4_ = ((pfVar17[0x10] - fVar8) + fVar24) * fVar4;
      auVar25._4_4_ = ((pfVar17[0x11] - fVar8) + fVar24) * fVar4;
      auVar25._8_4_ = ((pfVar17[0x12] - fVar8) + fVar24) * fVar4;
      auVar25._12_4_ = ((pfVar17[0x13] - fVar8) + fVar24) * fVar4;
      fVar32 = ((*pfVar17 - fVar7) - fVar26) * fVar3;
      fVar33 = ((pfVar17[1] - fVar7) - fVar26) * fVar3;
      fVar34 = ((pfVar17[2] - fVar7) - fVar26) * fVar3;
      fVar35 = ((pfVar17[3] - fVar7) - fVar26) * fVar3;
      auVar38._0_4_ = ((pfVar17[0xc] - fVar7) + fVar26) * fVar3;
      auVar38._4_4_ = ((pfVar17[0xd] - fVar7) + fVar26) * fVar3;
      auVar38._8_4_ = ((pfVar17[0xe] - fVar7) + fVar26) * fVar3;
      auVar38._12_4_ = ((pfVar17[0xf] - fVar7) + fVar26) * fVar3;
      auVar43._4_4_ = fVar28;
      auVar43._0_4_ = fVar27;
      auVar43._8_4_ = fVar29;
      auVar43._12_4_ = fVar30;
      fVar39 = ((pfVar17[8] - fVar9) - fVar22) * fVar6;
      fVar40 = ((pfVar17[9] - fVar9) - fVar22) * fVar6;
      fVar41 = ((pfVar17[10] - fVar9) - fVar22) * fVar6;
      fVar42 = ((pfVar17[0xb] - fVar9) - fVar22) * fVar6;
      auVar44 = maxps(auVar43,auVar25);
      auVar23._0_4_ = ((pfVar17[0x14] - fVar9) + fVar22) * fVar6;
      auVar23._4_4_ = ((pfVar17[0x15] - fVar9) + fVar22) * fVar6;
      auVar23._8_4_ = ((pfVar17[0x16] - fVar9) + fVar22) * fVar6;
      auVar23._12_4_ = ((pfVar17[0x17] - fVar9) + fVar22) * fVar6;
      auVar37._4_4_ = fVar28;
      auVar37._0_4_ = fVar27;
      auVar37._8_4_ = fVar29;
      auVar37._12_4_ = fVar30;
      auVar25 = minps(auVar25,auVar37);
      auVar36._4_4_ = fVar33;
      auVar36._0_4_ = fVar32;
      auVar36._8_4_ = fVar34;
      auVar36._12_4_ = fVar35;
      auVar37 = maxps(auVar36,auVar38);
      auVar31._4_4_ = fVar33;
      auVar31._0_4_ = fVar32;
      auVar31._8_4_ = fVar34;
      auVar31._12_4_ = fVar35;
      auVar31 = minps(auVar38,auVar31);
      auVar45._4_4_ = fVar40;
      auVar45._0_4_ = fVar39;
      auVar45._8_4_ = fVar41;
      auVar45._12_4_ = fVar42;
      auVar46 = maxps(auVar45,auVar23);
      auVar38 = minps(auVar37,auVar44);
      auVar44._4_4_ = fVar40;
      auVar44._0_4_ = fVar39;
      auVar44._8_4_ = fVar41;
      auVar44._12_4_ = fVar42;
      auVar37 = minps(auVar23,auVar44);
      auVar31 = maxps(auVar31,auVar25);
      auVar44 = minps(auVar38,auVar46);
      auVar37 = maxps(auVar31,auVar37);
      auVar31 = minps(auVar44,Four_Ones);
      auVar37 = maxps(auVar37,Four_Zeros);
      auVar46._4_4_ = -(uint)(auVar37._4_4_ <= auVar31._4_4_);
      auVar46._0_4_ = -(uint)(auVar37._0_4_ <= auVar31._0_4_);
      auVar46._8_4_ = -(uint)(auVar37._8_4_ <= auVar31._8_4_);
      auVar46._12_4_ = -(uint)(auVar37._12_4_ <= auVar31._12_4_);
      uVar18 = movmskps(pfVar17,auVar46);
      if (uVar18 != 0) {
        iVar16 = iVar16 * 4;
        if ((uVar18 & 1) != 0) {
          iVar13 = iVar13 + 1;
          local_58c[iVar13] = iVar16 + 1;
        }
        if ((uVar18 & 2) != 0) {
          iVar13 = iVar13 + 1;
          local_58c[iVar13] = iVar16 + 2;
        }
        if ((uVar18 & 4) != 0) {
          iVar13 = iVar13 + 1;
          local_58c[iVar13] = iVar16 + 3;
        }
        if ((uVar18 & 8) != 0) {
          iVar13 = iVar13 + 1;
          local_58c[iVar13] = iVar16 + 4;
        }
      }
      if (iVar13 < iVar20) goto LAB_000cf04f;
      iVar16 = local_58c[iVar20];
    }
    if (iVar20 <= iVar13) {
      local_64c = 0;
      local_648 = 0;
      if (_exit == 0) {
        local_620 = 0;
      }
      else {
                    /* try { // try from 000cf1f4 to 000cf1f6 has its CatchHandler @ 000cf5e6 */
        (**(code **)(_exit + 0x50))
                  (_exit,&local_64c,0,0,0,0,"/data/src/engine/../public/dispcoll_common.cpp",0x395,
                   &AABBTree_SweepAABB(Ray_t_const&,Vector_const&,CBaseTrace*)::tm_fmt,"(%s)%s",
                   "Unaccounted","DispHullTest_Tris");
        local_620 = _exit;
      }
      iVar14 = _DAT_0040b9d4;
      local_628 = local_64c;
      local_624 = local_648;
                    /* try { // try from 000cf234 to 000cf27e has its CatchHandler @ 000cf5d6 */
      if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
         (iVar16 = ThreadGetCurrentId(), iVar14 == iVar16)) {
        if ((char *)*_DAT_0040b030 != "DispHullTest_Tris") {
          _DAT_0040b030 =
               (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2a2906,&DAT_00000001,0x2a054b);
        }
        CVProfNode::EnterScope();
        DAT_0040b02c = '\0';
      }
                    /* try { // try from 000cf294 to 000cf364 has its CatchHandler @ 000cf5da */
      iVar14 = CDataManagerBase::LockResource
                         ((CDataManagerBase *)&g_DispCollTriCache,*(memhandle_t__ **)(this + 0x24));
      if ((iVar14 == 0) || (*(int *)(iVar14 + 0xbc) != *(int *)(iVar14 + 0x88))) {
                    /* try { // try from 000cf41e to 000cf422 has its CatchHandler @ 000cf5da */
        uVar18 = ThreadGetCurrentId();
        if (uVar18 == s_CacheMutex) {
LAB_000cf43a:
          DAT_00343b64 = DAT_00343b64 + 1;
        }
        else {
          LOCK();
          bVar21 = s_CacheMutex == 0;
          uVar10 = uVar18;
          if (!bVar21) {
            uVar10 = s_CacheMutex;
          }
          s_CacheMutex = uVar10;
          UNLOCK();
          if (bVar21) goto LAB_000cf43a;
                    /* try { // try from 000cf4a6 to 000cf4aa has its CatchHandler @ 000cf5da */
          CThreadFastMutex::Lock(0x343b60,uVar18);
        }
                    /* try { // try from 000cf455 to 000cf459 has its CatchHandler @ 000cf564 */
        iVar14 = CDataManagerBase::LockResource
                           ((CDataManagerBase *)&g_DispCollTriCache,*(memhandle_t__ **)(this + 0x24)
                           );
        if ((iVar14 == 0) || (*(int *)(iVar14 + 0xbc) != *(int *)(iVar14 + 0x88))) {
                    /* try { // try from 000cf4bb to 000cf4f4 has its CatchHandler @ 000cf564 */
          Cache(this);
          CDataManagerBase::EnsureCapacity
                    ((CDataManagerBase *)&g_DispCollTriCache,
                     *(int *)(this + 0xbc) * 0x12 + *(int *)(this + 0xd0) * 0xc);
          (*(code *)*g_DispCollTriCache)(&g_DispCollTriCache);
                    /* try { // try from 000cf504 to 000cf53a has its CatchHandler @ 000cf5c1 */
          uVar12 = CDataManagerBase::CreateHandle((CDataManagerBase *)&g_DispCollTriCache,false);
          pmVar15 = (memhandle_t__ *)
                    CDataManagerBase::StoreResourceInHandle
                              ((CDataManagerBase *)&g_DispCollTriCache,uVar12,this,
                               *(int *)(this + 0xbc) * 0x12 + *(int *)(this + 0xd0) * 0xc);
          (*(code *)g_DispCollTriCache[2])(&g_DispCollTriCache);
          *(memhandle_t__ **)(this + 0x24) = pmVar15;
                    /* try { // try from 000cf55a to 000cf55e has its CatchHandler @ 000cf564 */
          CDataManagerBase::LockResource((CDataManagerBase *)&g_DispCollTriCache,pmVar15);
        }
        DAT_00343b64 = DAT_00343b64 + -1;
        if (DAT_00343b64 == 0) {
          LOCK();
          UNLOCK();
          s_CacheMutex = 0;
        }
      }
      do {
        piVar2 = local_58c + iVar20;
        iVar20 = iVar20 + 1;
        psVar1 = (short *)(*(int *)(this + 0xa0) + (*piVar2 - *(int *)(this + 0x98)) * 4);
        iVar14 = *(int *)(this + 0x80);
        iVar19 = (int)psVar1[1];
        iVar16 = (int)*psVar1;
        SweepAABBTriIntersect
                  (this,param_1,(Vector *)&local_634,iVar16,(CDispCollTri *)(iVar14 + iVar16 * 0x18)
                   ,param_3);
        SweepAABBTriIntersect
                  (this,param_1,(Vector *)&local_634,iVar19,(CDispCollTri *)(iVar14 + iVar19 * 0x18)
                   ,param_3);
      } while (iVar20 <= iVar13);
      CDataManagerBase::UnlockResource
                ((CDataManagerBase *)&g_DispCollTriCache,*(memhandle_t__ **)(this + 0x24));
      iVar14 = _DAT_0040b9d4;
      if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
         (iVar16 = ThreadGetCurrentId(), iVar14 == iVar16)) {
        cVar11 = CVProfNode::ExitScope();
        if (cVar11 != '\0') {
          _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
        }
        DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
      }
      if (local_620 != 0) {
        (**(code **)(local_620 + 0x54))(local_620,local_628,local_624,0,0,0);
      }
      bVar21 = *(float *)(param_3 + 0x2c) <= fVar5 && fVar5 != *(float *)(param_3 + 0x2c);
      goto LAB_000cf051;
    }
  }
LAB_000cf04f:
  bVar21 = false;
LAB_000cf051:
  iVar14 = _DAT_0040b9d4;
  if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
     (iVar16 = ThreadGetCurrentId(), iVar14 == iVar16)) {
    cVar11 = CVProfNode::ExitScope();
    if (cVar11 != '\0') {
      _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
    }
    DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
  }
  if (local_638 != 0) {
    (**(code **)(local_638 + 0x54))(local_638,local_640,local_63c,0,0,0);
  }
  return bVar21;
}

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)