L L4D2node

CollisionBSPData_LoadAreaPortals

0x001228a0 · 397 bytes · __cdecl

_Z32CollisionBSPData_LoadAreaPortalsP17CCollisionBSPData

Decompiled

undefined (1 param)

/* CollisionBSPData_LoadAreaPortals(CCollisionBSPData*) */

void CollisionBSPData_LoadAreaPortals(CCollisionBSPData *param_1)

{
  void *__src;
  uint uVar1;
  undefined4 uVar2;
  size_t __n;
  int iVar3;
  int iVar4;
  int in_GS_OFFSET;
  CMapLoadHelper local_140 [288];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  CMapLoadHelper::CMapLoadHelper(local_140,0x15);
                    /* try { // try from 001228d9 to 001229e6 has its CatchHandler @ 00122a28 */
  __src = (void *)CMapLoadHelper::LumpBase(local_140);
  uVar1 = CMapLoadHelper::LumpSize(local_140);
  if (uVar1 != (uVar1 / 0xc) * 0xc) {
    Sys_Error("CMod_LoadAreaPortals: funny lump size");
  }
  uVar1 = CMapLoadHelper::LumpSize(local_140);
  if (0x400 < uVar1 / 0xc) {
    Sys_Error("Map has too many area portals");
  }
  iVar4 = uVar1 / 0xc + 1;
  *(int *)(param_1 + 600) = iVar4;
  uVar2 = Hunk_AllocName(iVar4,"portalopen",false);
  *(undefined4 *)(param_1 + 0x25c) = uVar2;
  iVar3 = 0;
  *(int *)(param_1 + 0x260) = iVar4;
  if (0 < *(int *)(param_1 + 600)) {
    do {
      if (*(int *)(param_1 + 0x260) <= iVar3) {
        Error("Cannot load corrupted map.\n");
      }
      *(undefined1 *)(*(int *)(param_1 + 0x25c) + iVar3) = 0;
      iVar3 = iVar3 + 1;
    } while (iVar3 < *(int *)(param_1 + 600));
  }
  *(int *)(param_1 + 0x230) = iVar4;
  uVar2 = Hunk_AllocName(iVar4 * 0xc,"map_areaportals",true);
  *(undefined4 *)(param_1 + 0x234) = uVar2;
  *(int *)(param_1 + 0x238) = iVar4;
  __n = CMapLoadHelper::LumpSize(local_140);
  memcpy(*(void **)(param_1 + 0x234),__src,__n);
  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)