L L4D2node

CVoxelHash::EnumerateElementsAlongRay_Ray

0x001e0570 · 833 bytes · __thiscall

_ZN10CVoxelHash29EnumerateElementsAlongRay_RayEiRK5Ray_tRK6VectorS5_P20IPartitionEnumerator

Decompiled

undefined (6 params)

/* CVoxelHash::EnumerateElementsAlongRay_Ray(int, Ray_t const&, Vector const&, Vector const&,
   IPartitionEnumerator*) */

bool __thiscall
CVoxelHash::EnumerateElementsAlongRay_Ray
          (CVoxelHash *this,int param_1,Ray_t *param_2,Vector *param_3,Vector *param_4,
          IPartitionEnumerator *param_5)

{
  uint uVar1;
  int iVar2;
  ushort uVar3;
  bool bVar4;
  int *piVar5;
  byte bVar6;
  uint uVar7;
  short local_c0 [2];
  short local_bc;
  short local_b8;
  float local_b4;
  float local_b0;
  float local_ac;
  float local_a8;
  float local_a4;
  float local_a0;
  undefined4 local_9c;
  CUtlHashFast<int,CUtlHashFastNoHash> local_98 [72];
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 uStack_48;
  undefined4 uStack_44;
  undefined4 uStack_40;
  undefined4 local_3c;
  undefined4 uStack_38;
  undefined4 uStack_34;
  undefined4 uStack_30;
  undefined4 local_2c;
  undefined4 uStack_28;
  undefined4 uStack_24;
  undefined4 uStack_20;
  
  bVar6 = (char)*(undefined4 *)(this + 0x104c) * '\x02' + 8;
  uVar7 = (int)(*(float *)param_2 - *(float *)this) >> (bVar6 & 0x1f) & 0x7ffU |
          ((int)(*(float *)(param_2 + 4) - *(float *)(this + 4)) >> (bVar6 & 0x1f) & 0x7ffU) << 0xb
          | ((int)(*(float *)(param_2 + 8) - *(float *)(this + 8)) >> (bVar6 & 0x1f)) << 0x16;
  iVar2 = *(int *)(this + 0x1048);
  uVar1 = (int)(*(float *)param_4 - *(float *)this) >> (bVar6 & 0x1f) & 0x7ffU |
          ((int)(*(float *)(param_4 + 4) - *(float *)(this + 4)) >> (bVar6 & 0x1f) & 0x7ffU) << 0xb
          | ((int)(*(float *)(param_4 + 8) - *(float *)(this + 8)) >> (bVar6 & 0x1f)) << 0x16;
  CUtlHashFast<int,CUtlHashFastNoHash>::CUtlHashFast(local_98);
  piVar5 = (int *)___tls_get_addr();
  local_9c = *(undefined4 *)(iVar2 + 0x3c + *piVar5 * 4);
  local_50 = *(undefined4 *)(iVar2 + 0x38);
  local_4c = *(undefined4 *)param_2;
  uStack_48 = *(undefined4 *)(param_2 + 4);
  uStack_44 = *(undefined4 *)(param_2 + 8);
  uStack_40 = *(undefined4 *)(param_2 + 0xc);
  local_3c = *(undefined4 *)(param_2 + 0x10);
  uStack_38 = *(undefined4 *)(param_2 + 0x14);
  uStack_34 = *(undefined4 *)(param_2 + 0x18);
  uStack_30 = *(undefined4 *)(param_2 + 0x1c);
  local_2c = *(undefined4 *)param_3;
  uStack_28 = *(undefined4 *)(param_3 + 4);
  uStack_24 = *(undefined4 *)(param_3 + 8);
  uStack_20 = *(undefined4 *)(param_3 + 0xc);
  if (uVar1 == uVar7) {
    bVar4 = EnumerateElementsInSingleVoxel<CIntersectRay>(this,uVar1,&local_9c,param_1,param_5);
  }
  else {
    LeafListRaySetup(this,param_2,param_4,param_3,uVar7,local_c0,&local_b4,&local_a8);
    while( true ) {
                    /* try { // try from 001e0717 to 001e08a1 has its CatchHandler @ 001e08c7 */
      bVar4 = EnumerateElementsInVoxel<CIntersectRay>(this,uVar7,&local_9c,param_1,param_5);
      if (((!bVar4) || (((1.0 <= local_b4 && (1.0 <= local_b0)) && (1.0 <= local_ac)))) ||
         (((((uint)local_b4 & 0x7f800000) == 0x7f800000 ||
           (((uint)local_b0 & 0x7f800000) == 0x7f800000)) ||
          (((uint)local_ac & 0x7f800000) == 0x7f800000)))) break;
      uVar3 = (ushort)(uVar7 >> 0x10);
      if (local_b0 <= local_b4) {
        if (local_ac <= local_b0) {
          local_ac = local_ac + local_a0;
          uVar7 = uVar7 & 0x3fffff | (uint)(ushort)((uVar3 >> 6) + local_b8) << 0x16;
        }
        else {
          local_b0 = local_b0 + local_a4;
          uVar7 = uVar7 & 0xffc007ff |
                  ((ushort)(((ushort)(uVar7 >> 0xb) & 0x7ff) + local_bc) & 0x7ff) << 0xb;
        }
      }
      else if (local_ac <= local_b4) {
        local_ac = local_ac + local_a0;
        uVar7 = uVar7 & 0x3fffff | (uint)(ushort)((uVar3 >> 6) + local_b8) << 0x16;
      }
      else {
        local_b4 = local_b4 + local_a8;
        uVar7 = uVar7 & 0xfffff800 | (ushort)(((ushort)uVar7 & 0x7ff) + local_c0[0]) & 0x7ff;
      }
    }
  }
  CUtlHashFast<int,CUtlHashFastNoHash>::~CUtlHashFast(local_98);
  return bVar4;
}

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)