L L4D2node

CStaticProp::InsertPropIntoKDTree

0x001e5df0 · 908 bytes · __thiscall

_ZN11CStaticProp20InsertPropIntoKDTreeEv

Decompiled

undefined (1 param)

/* CStaticProp::InsertPropIntoKDTree() */

void __thiscall CStaticProp::InsertPropIntoKDTree(CStaticProp *this)

{
  Vector *pVVar1;
  QAngle *pQVar2;
  float *pfVar3;
  char cVar4;
  undefined2 uVar5;
  int *piVar6;
  ushort *puVar7;
  char *pcVar8;
  int iVar9;
  int iVar10;
  int local_b4;
  Vector local_a0 [12];
  Vector local_94 [12];
  int local_88;
  int local_84;
  int local_80;
  Vector local_7c [12];
  Vector local_70 [12];
  float local_64;
  float local_60;
  float local_5c;
  undefined **local_58;
  int local_54;
  undefined4 local_50;
  matrix3x4_t local_4c [60];
  
  if (this[0x39] != (CStaticProp)0x0) {
    pVVar1 = (Vector *)(this + 0x10);
    pQVar2 = (QAngle *)(this + 0x1c);
    AngleMatrix(pQVar2,pVVar1,local_4c);
    TransformAABB(local_4c,(Vector *)(*(int *)(this + 0x28) + 0x118),
                  (Vector *)(*(int *)(this + 0x28) + 0x124),local_a0,local_94);
    if (this[0x39] != (CStaticProp)0x6) goto LAB_001e5e6b;
    cVar4 = CStaticPropMgr::GetHullListForProp
                      ((CStaticPropMgr *)s_StaticPropMgr,(CConvexHullList *)&local_88,
                       (uint)*(ushort *)(this + 0x4e));
    if (cVar4 == '\0') {
      if ((g_pPhysics2 != (int *)0x0) &&
         (iVar9 = (**(code **)(*g_pPhysics2 + 0x5c))(g_pPhysics2,0), 0 < iVar9)) {
        local_54 = (**(code **)(*g_pMDLCache + 0x34))
                             (g_pMDLCache,*(undefined2 *)(*(int *)(this + 0x28) + 0x134),1);
        local_58 = &PTR_GetPhysics2VCollide_002bf1f0;
        local_50 = 0;
        if (local_54 != 0) {
          (**(code **)(*physcollision + 0x60))
                    (physcollision,local_a0,local_94,&local_58,pVVar1,pQVar2);
        }
LAB_001e5e6b:
        AddPointToBounds(local_a0,(Vector *)(this + 0xa0),(Vector *)(this + 0xac));
        AddPointToBounds(local_94,(Vector *)(this + 0xa0),(Vector *)(this + 0xac));
        piVar6 = (int *)SpatialPartition();
        uVar5 = (**(code **)(*piVar6 + 0xc))(piVar6,this,0x65,local_a0,local_94);
        *(undefined2 *)(this + 0x2c) = uVar5;
        return;
      }
      puVar7 = (ushort *)CM_VCollideForModel(-1,*(model_t **)(this + 0x28));
      if ((puVar7 != (ushort *)0x0) && ((*puVar7 & 0x7fff) != 0)) {
        (**(code **)(*physcollision + 0x60))
                  (physcollision,local_a0,local_94,**(undefined4 **)(puVar7 + 2),pVVar1,pQVar2);
        goto LAB_001e5e6b;
      }
      pcVar8 = "unknown model";
      if (*(int *)(this + 0x28) != 0) {
        pcVar8 = (char *)(**(code **)(*(int *)modelloader + 0x10))
                                   (modelloader,*(int *)(this + 0x28));
      }
      DevMsg(2,"SOLID_VPHYSICS static prop with no vphysics model! (%s)\n",pcVar8);
    }
    else if (local_88 != 0) {
      ClearBounds(local_7c,local_70);
      if (0 < local_88) {
        local_b4 = 0;
        iVar9 = local_80;
        do {
          piVar6 = (int *)(iVar9 + local_b4 * 0x10);
          if (0 < *piVar6) {
            iVar10 = 0;
            do {
              iVar9 = piVar6[1] + iVar10;
              iVar10 = iVar10 + 1;
              pfVar3 = (float *)(local_84 + iVar9 * 0xc);
              local_64 = *pfVar3;
              local_60 = pfVar3[1];
              local_5c = pfVar3[2];
              VectorTransform(&local_64,local_4c,(float *)&local_58);
              AddPointToBounds((Vector *)&local_58,local_7c,local_70);
              piVar6 = (int *)(local_80 + local_b4 * 0x10);
              iVar9 = local_80;
            } while (iVar10 < *piVar6);
          }
          local_b4 = local_b4 + 1;
        } while (local_b4 < local_88);
      }
      goto LAB_001e5e6b;
    }
    this[0x39] = (CStaticProp)0x0;
  }
  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)