L L4D2node

CollisionBSPData_LoadNodes

0x00122560 · 438 bytes · __cdecl

_Z26CollisionBSPData_LoadNodesP17CCollisionBSPData

Decompiled

undefined (1 param)

/* CollisionBSPData_LoadNodes(CCollisionBSPData*) */

void CollisionBSPData_LoadNodes(CCollisionBSPData *param_1)

{
  int *piVar1;
  int *piVar2;
  uint uVar3;
  undefined4 uVar4;
  int iVar5;
  int in_GS_OFFSET;
  uint local_150;
  CMapLoadHelper local_140 [288];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  CMapLoadHelper::CMapLoadHelper(local_140,5);
                    /* try { // try from 00122599 to 00122710 has its CatchHandler @ 0012271b */
  piVar2 = (int *)CMapLoadHelper::LumpBase(local_140);
  uVar3 = CMapLoadHelper::LumpSize(local_140);
  if ((uVar3 & 0x1f) != 0) {
    Sys_Error("CollisionBSPData_LoadNodes: funny lump size");
  }
  uVar3 = CMapLoadHelper::LumpSize(local_140);
  uVar3 = uVar3 >> 5;
  if (uVar3 == 0) {
    Sys_Error("Map has no nodes");
  }
  else if (0x10000 < uVar3) {
    Sys_Error("Map has too many nodes");
  }
  iVar5 = uVar3 + 6;
  uVar4 = Hunk_AllocName(iVar5 * 0xc,"map_nodes",true);
  *(undefined4 *)(param_1 + 0x8c) = uVar4;
  *(int *)(param_1 + 0x90) = iVar5;
  *(undefined4 *)param_1 = uVar4;
  local_150 = 0;
  *(uint *)(param_1 + 0x88) = uVar3;
  if (uVar3 != 0) {
    while( true ) {
      if (iVar5 <= (int)local_150) {
        Error("Cannot load corrupted map.\n");
      }
      iVar5 = *piVar2;
      piVar1 = (int *)(*(int *)(param_1 + 0x8c) + local_150 * 0xc);
      if ((iVar5 < 0) || (*(int *)(param_1 + 0x84) <= iVar5)) {
        Error("Cannot load corrupted map.\n");
      }
      local_150 = local_150 + 1;
      *piVar1 = *(int *)(param_1 + 0x80) + iVar5 * 0x14;
      piVar1[1] = piVar2[1];
      piVar1[2] = piVar2[2];
      if (uVar3 == local_150) break;
      iVar5 = *(int *)(param_1 + 0x90);
      piVar2 = piVar2 + 8;
    }
  }
  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)