L L4D2node

Mod_LoadTexinfo

0x001967e0 · 593 bytes · __cdecl

_Z15Mod_LoadTexinfoR14CMapLoadHelper

Decompiled

undefined (1 param)

/* Mod_LoadTexinfo(CMapLoadHelper&) */

void Mod_LoadTexinfo(CMapLoadHelper *param_1)

{
  int iVar1;
  int *piVar2;
  CMapLoadHelper *pCVar3;
  char *pcVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  int iVar8;
  undefined4 *puVar9;
  float fVar10;
  float *local_2c;
  uint local_28;
  float *local_24;
  int local_20;
  
  local_20 = *(int *)(param_1 + 0x10);
  uVar7 = *(uint *)param_1;
  if (uVar7 != (uVar7 / 0x48) * 0x48) {
    Host_Error("Mod_LoadTexinfo: funny lump size in %s",s_szMapPathName);
    uVar7 = *(uint *)param_1;
  }
  uVar7 = uVar7 / 0x48;
  pCVar3 = (CMapLoadHelper *)s_szMapPathName;
  if ((&s_MapLumpFiles)[*(int *)(param_1 + 0x18) * 7] != 0) {
    pCVar3 = param_1 + 0x1c;
  }
  pcVar4 = (char *)va("%s [%s]",pCVar3,"texinfo");
  iVar5 = Hunk_AllocName(uVar7 * 0x50,pcVar4,true);
  iVar1 = s_pMap;
  *(int *)(s_pMap + 0x5c) = iVar5;
  *(uint *)(iVar1 + 0x58) = uVar7;
  iVar1 = *(int *)(mat_loadtextures._28_4_ + 0x30);
  if (uVar7 == 0) {
    return;
  }
  local_2c = (float *)(iVar5 + 0x20);
  local_28 = 0;
  local_24 = local_2c;
  do {
    iVar8 = 0;
    do {
      iVar6 = 0;
      puVar9 = (undefined4 *)(local_20 + iVar8);
      do {
        *(undefined4 *)(iVar8 + iVar5 + iVar6 * 4) = *puVar9;
        *(undefined4 *)((int)local_24 + iVar6 * 4 + iVar8) = puVar9[8];
        iVar6 = iVar6 + 1;
        puVar9 = puVar9 + 1;
      } while (iVar6 != 4);
      iVar8 = iVar8 + 0x10;
    } while (iVar8 != 0x20);
    fVar10 = SQRT(*local_2c * *local_2c + local_2c[1] * local_2c[1] + local_2c[2] * local_2c[2]);
    *(float *)(iVar5 + 0x40) = fVar10;
    *(float *)(iVar5 + 0x44) = 1.0 / fVar10;
    *(short *)(iVar5 + 0x48) = (short)*(undefined4 *)(local_20 + 0x40);
    *(undefined2 *)(iVar5 + 0x4a) = 0;
    if (iVar1 == 0) {
LAB_00196a01:
      piVar2 = g_materialEmpty;
      *(int **)(iVar5 + 0x4c) = g_materialEmpty;
      (**(code **)(*piVar2 + 0x30))(piVar2);
    }
    else {
      iVar8 = *(int *)(local_20 + 0x44);
      if (iVar8 < 0) {
        DevMsg("Mod_LoadTexinfo: texdata < 0 (index==%i/%i)\n",local_28,uVar7);
        *(undefined4 *)(iVar5 + 0x4c) = 0;
        goto LAB_00196a01;
      }
      iVar6 = *(int *)(s_pMap + 100);
      pCVar3 = (CMapLoadHelper *)s_szMapPathName;
      if ((&s_MapLumpFiles)[*(int *)(param_1 + 0x18) * 7] != 0) {
        pCVar3 = param_1 + 0x1c;
      }
      if (*(int *)(s_pMap + 0x60) <= iVar8) {
        Sys_Error("Couldn\'t load corrupted map %s",pCVar3);
      }
      iVar8 = GL_LoadMaterial(*(char **)(iVar6 + iVar8 * 8),"World textures",false);
      *(int *)(iVar5 + 0x4c) = iVar8;
      if (iVar8 == 0) goto LAB_00196a01;
    }
    local_28 = local_28 + 1;
    local_20 = local_20 + 0x48;
    local_2c = local_2c + 0x14;
    if (uVar7 == local_28) {
      return;
    }
    local_24 = (float *)(iVar5 + 0x70);
    iVar5 = iVar5 + 0x50;
  } while( true );
}

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)