L L4D2node

Mod_LoadLeafs_Version_1

0x00198330 · 993 bytes · __cdecl

_Z23Mod_LoadLeafs_Version_1R14CMapLoadHelperS0_S0_

Decompiled

undefined (3 params)

/* Mod_LoadLeafs_Version_1(CMapLoadHelper&, CMapLoadHelper&, CMapLoadHelper&) */

void Mod_LoadLeafs_Version_1
               (CMapLoadHelper *param_1,CMapLoadHelper *param_2,CMapLoadHelper *param_3)

{
  undefined2 uVar1;
  short sVar2;
  short sVar3;
  int iVar4;
  uint uVar5;
  CMapLoadHelper *pCVar6;
  char *pcVar7;
  int *piVar8;
  undefined4 uVar9;
  int iVar10;
  void *pvVar11;
  undefined1 *puVar12;
  undefined2 *puVar13;
  int *piVar14;
  void *pvVar15;
  uint uVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  void *local_3c;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  piVar14 = *(int **)(param_1 + 0x10);
  uVar5 = *(uint *)param_1;
  if ((uVar5 & 0x1f) != 0) {
    Host_Error("Mod_LoadLeafs: funny lump size in %s",s_szMapPathName);
    uVar5 = *(uint *)param_1;
  }
  uVar5 = uVar5 >> 5;
  pCVar6 = (CMapLoadHelper *)s_szMapPathName;
  if ((&s_MapLumpFiles)[*(int *)(param_1 + 0x18) * 7] != 0) {
    pCVar6 = param_1 + 0x1c;
  }
  pcVar7 = (char *)va("%s [%s]",pCVar6,"leafs");
  piVar8 = (int *)Hunk_AllocName(uVar5 << 6,pcVar7,true);
  iVar10 = s_pMap;
  *(int **)(s_pMap + 0x10) = piVar8;
  *(uint *)(iVar10 + 0xc) = uVar5;
  if ((*(int *)(param_2 + 8) == 1) && (*(int *)param_3 != 0)) {
    uVar9 = Hunk_AllocName(*(int *)param_3,"LeafAmbient",true);
    *(undefined4 *)(iVar10 + 0xe4) = uVar9;
    iVar10 = s_pMap;
    uVar9 = Hunk_AllocName(*(int *)param_2,"LeafAmbientSamples",true);
    *(undefined4 *)(iVar10 + 0xe8) = uVar9;
    _V_memcpy(*(void **)(s_pMap + 0xe4),*(void **)(param_3 + 0x10),*(int *)param_3);
    _V_memcpy(*(void **)(s_pMap + 0xe8),*(void **)(param_2 + 0x10),*(int *)param_2);
  }
  else {
    if (*(int *)param_2 == 0) {
      local_3c = (void *)0x0;
    }
    else {
      local_3c = *(void **)(param_2 + 0x10);
    }
    uVar9 = Hunk_AllocName(uVar5 * 4,"LeafAmbient",true);
    *(undefined4 *)(iVar10 + 0xe4) = uVar9;
    iVar10 = s_pMap;
    uVar9 = Hunk_AllocName(uVar5 * 0x1c,"LeafAmbientSamples",true);
    local_28 = 0x3f000000;
    *(undefined4 *)(iVar10 + 0xe8) = uVar9;
    local_24 = 0x3f000000;
    local_20 = 0x3f000000;
    puVar13 = *(undefined2 **)(s_pMap + 0xe4);
    pvVar15 = *(void **)(s_pMap + 0xe8);
    VectorToColorRGBExp32((Vector *)&local_28,(ColorRGBExp32 *)&local_2c);
    if (uVar5 != 0) {
      uVar16 = 0;
      pvVar11 = local_3c;
      do {
        puVar13[1] = (short)uVar16;
        *puVar13 = 1;
        *(undefined1 *)((int)pvVar15 + 0x1a) = 0x80;
        *(undefined1 *)((int)pvVar15 + 0x19) = 0x80;
        *(undefined1 *)((int)pvVar15 + 0x18) = 0x80;
        *(undefined1 *)((int)pvVar15 + 0x1b) = 0;
        if (local_3c == (void *)0x0) {
          iVar10 = 0;
          do {
            *(undefined4 *)((int)pvVar15 + iVar10 * 4) = local_2c;
            iVar10 = iVar10 + 1;
          } while (iVar10 != 6);
        }
        else {
          _V_memcpy(pvVar15,pvVar11,0x18);
        }
        uVar16 = uVar16 + 1;
        puVar13 = puVar13 + 2;
        pvVar15 = (void *)((int)pvVar15 + 0x1c);
        pvVar11 = (void *)((int)pvVar11 + 0x18);
      } while (uVar5 != uVar16);
    }
  }
  puVar12 = param_1 + 0x1c;
  if ((&s_MapLumpFiles)[*(int *)(param_1 + 0x18) * 7] == 0) {
    puVar12 = s_szMapPathName;
  }
  if (uVar5 != 0) {
    uVar16 = 0;
    do {
      sVar2 = *(short *)((int)piVar14 + 0xe);
      iVar10 = piVar14[4];
      sVar3 = *(short *)((int)piVar14 + 0x12);
      iVar4 = piVar14[2];
      fVar18 = ((float)(int)*(short *)((int)piVar14 + 10) + (float)(int)(short)iVar10) * 0.5;
      fVar17 = ((float)(int)(short)piVar14[3] + (float)(int)sVar3) * 0.5;
      piVar8[5] = (int)fVar18;
      fVar19 = ((float)(int)(short)iVar4 + (float)(int)sVar2) * 0.5;
      piVar8[6] = (int)fVar17;
      piVar8[4] = (int)fVar19;
      piVar8[9] = (int)((float)(int)(short)iVar10 - fVar18);
      piVar8[10] = (int)((float)(int)sVar3 - fVar17);
      piVar8[8] = (int)((float)(int)sVar2 - fVar19);
      iVar10 = *piVar14;
      if (iVar10 < 0) {
        Sys_Error("Couldn\'t load corrupted map %s",puVar12);
      }
      *piVar8 = iVar10;
      uVar16 = uVar16 + 1;
      *(short *)(piVar8 + 0xc) = (short)piVar14[1];
      *(short *)(piVar8 + 3) = (short)(*(short *)((int)piVar14 + 6) << 7) >> 7;
      *(short *)((int)piVar8 + 0xe) = (short)(*(char *)((int)piVar14 + 7) >> 1);
      *(short *)(piVar8 + 0xd) = (short)piVar14[5];
      uVar1 = *(undefined2 *)((int)piVar14 + 0x16);
      piVar8[2] = 0;
      *(undefined2 *)((int)piVar8 + 0x36) = uVar1;
      *(undefined2 *)((int)piVar8 + 0x3e) = 0;
      *(short *)((int)piVar8 + 0x32) = (short)piVar14[7];
      piVar14 = piVar14 + 8;
      piVar8 = piVar8 + 0x10;
    } while (uVar5 != uVar16);
  }
  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)