L L4D2node

CollisionBSPData_LoadLeafBrushes

0x001217a0 · 314 bytes · __cdecl

_Z32CollisionBSPData_LoadLeafBrushesP17CCollisionBSPData

Decompiled

undefined (1 param)

/* CollisionBSPData_LoadLeafBrushes(CCollisionBSPData*) */

void CollisionBSPData_LoadLeafBrushes(CCollisionBSPData *param_1)

{
  int iVar1;
  uint uVar2;
  undefined4 uVar3;
  uint uVar4;
  uint uVar5;
  int in_GS_OFFSET;
  CMapLoadHelper local_140 [288];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  CMapLoadHelper::CMapLoadHelper(local_140,0x11);
                    /* try { // try from 001217d9 to 001218cf has its CatchHandler @ 001218da */
  iVar1 = CMapLoadHelper::LumpBase(local_140);
  uVar2 = CMapLoadHelper::LumpSize(local_140);
  if ((uVar2 & 1) != 0) {
    Sys_Error("CMod_LoadLeafBrushes: funny lump size");
  }
  uVar2 = CMapLoadHelper::LumpSize(local_140);
  uVar2 = uVar2 >> 1;
  if (uVar2 == 0) {
    Sys_Error("Map with no planes");
  }
  else if (0x10000 < uVar2) {
    Sys_Error("Map has too many leafbrushes");
  }
  uVar3 = Hunk_AllocName(uVar2 * 2,"map_leafbrushes",false);
  *(undefined4 *)(param_1 + 0xac) = uVar3;
  *(uint *)(param_1 + 0xb0) = uVar2;
  *(uint *)(param_1 + 0xa8) = uVar2;
  uVar5 = 0;
  uVar4 = uVar2;
  if (uVar2 != 0) {
    while( true ) {
      if ((int)uVar4 <= (int)uVar5) {
        Error("Cannot load corrupted map.\n");
      }
      *(undefined2 *)(*(int *)(param_1 + 0xac) + uVar5 * 2) = *(undefined2 *)(iVar1 + uVar5 * 2);
      uVar5 = uVar5 + 1;
      if (uVar2 == uVar5) break;
      uVar4 = *(uint *)(param_1 + 0xb0);
    }
  }
  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)