L L4D2node

CM_CreateDispPhysCollide

0x00125450 · 483 bytes · __cdecl

_Z24CM_CreateDispPhysCollideP11dphysdisp_ti

Decompiled

undefined (2 params)

/* CM_CreateDispPhysCollide(dphysdisp_t*, int) */

void CM_CreateDispPhysCollide(dphysdisp_t *param_1,int param_2)

{
  undefined4 *puVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  undefined1 *local_28;
  int local_24;
  undefined1 local_20;
  
  uVar3 = g_DispCollTreeCount;
  if (param_1 == (dphysdisp_t *)0x0) {
    g_VirtualTerrain._4_4_ = 0;
    goto LAB_0012550e;
  }
  g_VirtualTerrain._20_4_ = 0;
  if (g_DispCollTreeCount == 0) {
    uVar3 = 0;
    if (*(short *)param_1 != 0) {
LAB_00125485:
      Sys_Error(
               "LevelInit: Bad map data - displacement data does not match displacement collision data"
               );
      uVar3 = (uint)*(ushort *)param_1;
    }
  }
  else {
    CUtlVector<int,CUtlMemory<int,int>>::GrowVector
              ((CUtlVector<int,CUtlMemory<int,int>> *)(g_VirtualTerrain + 8),g_DispCollTreeCount);
    CUtlVector<int,CUtlMemory<int,int>>::ShiftElementsRight
              ((CUtlVector<int,CUtlMemory<int,int>> *)(g_VirtualTerrain + 8),0,uVar3);
    uVar3 = (uint)*(ushort *)param_1;
    if (uVar3 != g_DispCollTreeCount) goto LAB_00125485;
  }
  if (uVar3 == 0) {
    uVar3 = 0;
  }
  else {
    iVar6 = 0;
    uVar3 = 0;
    iVar4 = 0;
    do {
      while (*(short *)(param_1 + iVar4 * 2 + 2) != -1) {
        *(uint *)(g_VirtualTerrain._8_4_ + iVar6) = uVar3;
        iVar6 = iVar6 + 4;
        iVar2 = iVar4 * 2;
        iVar4 = iVar4 + 1;
        uVar3 = uVar3 + *(ushort *)(param_1 + iVar2 + 2);
        if ((int)(uint)*(ushort *)param_1 <= iVar4) goto LAB_001254eb;
      }
      *(undefined4 *)(g_VirtualTerrain._8_4_ + iVar6) = 0xffffffff;
      iVar4 = iVar4 + 1;
      iVar6 = iVar6 + 4;
    } while (iVar4 < (int)(uint)*(ushort *)param_1);
  }
LAB_001254eb:
  g_VirtualTerrain._4_4_ = operator_new__(uVar3);
  memcpy((void *)g_VirtualTerrain._4_4_,param_1 + (uint)*(ushort *)param_1 * 2 + 2,uVar3);
LAB_0012550e:
  uVar3 = g_DispCollTreeCount;
  DAT_00396768 = 0;
  if (g_DispCollTreeCount != 0) {
    CUtlVector<CPhysCollide*,CUtlMemory<CPhysCollide*,int>>::GrowVector
              ((CUtlVector<CPhysCollide*,CUtlMemory<CPhysCollide*,int>> *)&g_TerrainList,
               g_DispCollTreeCount);
    if ((0 < (int)(DAT_00396768 - uVar3)) && (0 < (int)uVar3)) {
      _V_memmove((void *)((int)g_TerrainList + uVar3 * 4),g_TerrainList,(DAT_00396768 - uVar3) * 4);
    }
    if (0 < (int)g_DispCollTreeCount) {
      iVar6 = 0;
      iVar4 = 0;
      do {
        if ((iVar6 + g_pDispCollTrees == 0) ||
           ((*(byte *)(iVar6 + g_pDispCollTrees + 0x2c) & 2) == 0)) {
          local_28 = g_VirtualTerrain;
          local_20 = param_2 < 1;
          puVar1 = (undefined4 *)((int)g_TerrainList + iVar4 * 4);
          local_24 = iVar4;
          uVar5 = (**(code **)(*physcollision + 0xc0))(physcollision,&local_28);
          *puVar1 = uVar5;
        }
        else {
          *(undefined4 *)((int)g_TerrainList + iVar4 * 4) = 0;
        }
        iVar4 = iVar4 + 1;
        iVar6 = iVar6 + 0xf4;
      } while (iVar4 < (int)g_DispCollTreeCount);
    }
  }
  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)