L L4D2node

CollisionBSPData_LoadPhysLevel

0x00122d00 · 983 bytes · __cdecl

_Z30CollisionBSPData_LoadPhysLevelP17CCollisionBSPData

Decompiled

undefined (1 param)

/* CollisionBSPData_LoadPhysLevel(CCollisionBSPData*) */

void CollisionBSPData_LoadPhysLevel(CCollisionBSPData *param_1)

{
  int *piVar1;
  uint uVar2;
  undefined4 *puVar3;
  int iVar4;
  int *piVar5;
  undefined4 uVar6;
  void *pvVar7;
  int iVar8;
  uint uVar9;
  int in_GS_OFFSET;
  longdouble lVar10;
  int local_154;
  CMapLoadHelper local_140 [288];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  *(undefined4 *)(param_1 + 0x268) = 0;
  CMapLoadHelper::CMapLoadHelper(local_140,0x3e);
                    /* try { // try from 00122d43 to 001230d9 has its CatchHandler @ 001230e4 */
  iVar4 = CMapLoadHelper::LumpSize(local_140);
  if (((iVar4 != 0) && (g_pPhysics2ResourceManager != (int *)0x0)) &&
     (g_pPhysics2Collision != (undefined4 *)0x0)) {
    piVar5 = (int *)CMapLoadHelper::LumpBase(local_140);
    if ((*(int *)(phys2_dump_exclude_list._28_4_ + 0x30) != 0) &&
       (Msg("Exclude list: %d models\n",piVar5[0xf]), 0 < piVar5[0xf])) {
      iVar4 = 0;
      do {
        piVar1 = (int *)((int)piVar5 + iVar4 * 4 + piVar5[0xe] + 0x38);
        Msg(&DAT_002c6892,(int)piVar1 + *piVar1);
        iVar4 = iVar4 + 1;
      } while (iVar4 < piVar5[0xf]);
    }
    *(undefined4 *)(param_1 + 0x26c) = 0;
    uVar6 = (**(code **)(*g_pPhysics2ResourceManager + 0x28))(g_pPhysics2ResourceManager,piVar5);
    puVar3 = g_pPhysics2Collision;
    *(undefined4 *)(param_1 + 0x268) = uVar6;
    (**(code **)*puVar3)(puVar3,uVar6);
    if (((4 < *piVar5) && (*(int *)(phys2_cmodels._28_4_ + 0x30) != 0)) &&
       (uVar2 = piVar5[0xd], uVar2 != 0)) {
      DevMsg("Phys2: loading %u CModels\n",uVar2);
      pvVar7 = (void *)Hunk_AllocName(uVar2 * 0x44,"arrPhysics2CModels",true);
      *(void **)(param_1 + 0x274) = pvVar7;
      *(uint *)(param_1 + 0x278) = uVar2;
      memset(pvVar7,0,uVar2 * 0x44);
      *(uint *)(param_1 + 0x270) = uVar2;
      uVar9 = 0xffffffff;
      if (uVar2 < 0x1fc00001) {
        uVar9 = uVar2 * 4;
      }
      pvVar7 = operator_new__(uVar9);
      *(void **)(param_1 + 0x27c) = pvVar7;
      uVar9 = 0;
      local_154 = 0;
      do {
        iVar4 = uVar9 * 4;
        piVar1 = (int *)((int)piVar5 + uVar9 * 8 + piVar5[0xc] + 0x30);
        iVar8 = 0;
        if (*piVar1 != 0) {
          iVar8 = (int)piVar1 + *piVar1;
        }
        uVar6 = (**(code **)(*g_pPhysics2ResourceManager + 0x14))
                          (g_pPhysics2ResourceManager,((piVar1[1] << 0x1d) >> 0x1f) + 6,iVar8);
        *(undefined4 *)((int)pvVar7 + iVar4) = uVar6;
        if (*(int *)(*(int *)(param_1 + 0x27c) + iVar4) == 0) {
          Warning("Cannot load CModel %d / %d\n",uVar9,uVar2);
        }
        else {
          if (((int)uVar9 < 0) || (*(int *)(param_1 + 0x278) <= (int)uVar9)) {
            Error("Cannot load corrupted map.\n");
            *(undefined2 *)(*(int *)(param_1 + 0x274) + 2 + local_154) = 1;
            if ((-1 < (int)uVar9) && ((int)uVar9 < *(int *)(param_1 + 0x278))) goto LAB_001230a3;
LAB_00122f52:
            Error("Cannot load corrupted map.\n");
            *(int *)(*(int *)(param_1 + 0x274) + 8 + local_154) = *(int *)(param_1 + 0x27c) + iVar4;
            if (-1 < (int)uVar9) goto LAB_00122f7a;
LAB_00122f82:
            Error("Cannot load corrupted map.\n");
          }
          else {
            *(undefined2 *)(*(int *)(param_1 + 0x274) + 2 + local_154) = 1;
            if (*(int *)(param_1 + 0x278) <= (int)uVar9) goto LAB_00122f52;
LAB_001230a3:
            *(int *)(*(int *)(param_1 + 0x274) + 8 + local_154) = *(int *)(param_1 + 0x27c) + iVar4;
LAB_00122f7a:
            if (*(int *)(param_1 + 0x278) <= (int)uVar9) goto LAB_00122f82;
          }
          iVar8 = *(int *)(param_1 + 0x274);
          lVar10 = (longdouble)
                   (**(code **)(**(int **)(*(int *)(param_1 + 0x27c) + iVar4) + 0x44))
                             (*(int **)(*(int *)(param_1 + 0x27c) + iVar4));
          *(float *)(local_154 + iVar8 + 0x10) = (float)lVar10;
        }
        local_154 = local_154 + 0x44;
        uVar9 = uVar9 + 1;
        if (uVar2 == uVar9) break;
        pvVar7 = *(void **)(param_1 + 0x27c);
      } while( true );
    }
  }
  CMapLoadHelper::~CMapLoadHelper(local_140);
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)