L L4D2node

CBreakableSurface::Spawn

0x006b66e0 · 950 bytes · __thiscall

_ZN17CBreakableSurface5SpawnEv

Decompiled

undefined (1 param)

/* CBreakableSurface::Spawn() */

void __thiscall CBreakableSurface::Spawn(CBreakableSurface *this)

{
  code *pcVar1;
  CBaseEdict *pCVar2;
  char cVar3;
  undefined4 uVar4;
  int iVar5;
  float *pfVar6;
  int *piVar7;
  char *pcVar8;
  uint uVar9;
  undefined *puVar10;
  CBreakableSurface *pCVar11;
  char local_21;
  int *local_20 [4];
  
  CBreakable::Spawn((CBreakable *)this);
  CBaseEntity::SetCollisionGroup((CBaseEntity *)this,6);
  if (this[0x524] == (CBreakableSurface)0x0) {
    iVar5 = *(int *)(this + 0x964);
  }
  else {
    if (this[0x6c] == (CBreakableSurface)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBreakableSurface)((byte)this[0x70] | 1);
    }
    iVar5 = *(int *)(this + 0x964);
    this[0x524] = (CBreakableSurface)0x0;
  }
  if (iVar5 == 1) {
    pfVar6 = (float *)(**(code **)(*(int *)this + 0x288))(this);
    Warning("Rejecting func_breakablesurf at (%2.2f, %2.2f, %2.2f).  Has multiple faces that aren\'t NODRAW.\n"
            ,(double)*pfVar6,(double)pfVar6[1],(double)pfVar6[2]);
    UTIL_Remove((CBaseEntity *)this);
  }
  else if (iVar5 == 2) {
    pfVar6 = (float *)(**(code **)(*(int *)this + 0x288))(this);
    Warning("Rejecting func_breakablesurf at (%2.2f, %2.2f, %2.2f).  Drawn face isn\'t a quad.\n",
            (double)*pfVar6,(double)pfVar6[1],(double)pfVar6[2]);
    UTIL_Remove((CBaseEntity *)this);
  }
  pcVar1 = *(code **)(*modelinfo + 0x48);
  uVar4 = CBaseEntity::GetModel((CBaseEntity *)this);
  iVar5 = (*pcVar1)(modelinfo,uVar4);
  if (iVar5 != 1) {
    pfVar6 = (float *)(**(code **)(*(int *)this + 0x288))(this);
    Warning("Encountered func_breakablesurf at (%2.2f, %2.2f, %2.2f) that has a material applied to more than one surface!\n"
            ,(double)*pfVar6,(double)pfVar6[1],(double)pfVar6[2]);
    UTIL_Remove((CBaseEntity *)this);
  }
  pcVar1 = *(code **)(*modelinfo + 0x4c);
  uVar4 = CBaseEntity::GetModel((CBaseEntity *)this);
  (*pcVar1)(modelinfo,uVar4,1,local_20);
  piVar7 = (int *)(**(code **)(*local_20[0] + 0x2c))(local_20[0],"$crackmaterial",&local_21,0);
  if ((local_21 != '\0') && (cVar3 = CBaseEntity::IsPrecacheAllowed(), cVar3 != '\0')) {
    pcVar8 = (char *)(**(code **)(*piVar7 + 0x18))(piVar7);
    PrecacheMaterial(pcVar8);
  }
  pCVar11 = this + 0x968;
  do {
    if (*pCVar11 != (CBreakableSurface)0x1) {
      if (this[0x6c] == (CBreakableSurface)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBreakableSurface)((byte)this[0x70] | 1);
      }
      *pCVar11 = (CBreakableSurface)0x1;
    }
    pCVar11 = pCVar11 + 1;
  } while (pCVar11 != this + 0xa68);
  if (this[0xa68] != (CBreakableSurface)0x0) {
    if (this[0x6c] == (CBreakableSurface)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBreakableSurface)((byte)this[0x70] | 1);
    }
    this[0xa68] = (CBreakableSurface)0x0;
  }
  uVar9 = *(uint *)(this + 0x180);
  if (((((uVar9 != 0xffffffff) &&
        (puVar10 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar10 + 8) == uVar9 >> 0xc)) &&
      ((piVar7 = *(int **)(puVar10 + 4), piVar7 != (int *)0x0 &&
       (uVar9 = (**(code **)(*piVar7 + 0x2c8))(piVar7), (uVar9 & 0x200) != 0)))) &&
     (this[0xa68] != (CBreakableSurface)0x1)) {
    if (this[0x6c] == (CBreakableSurface)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBreakableSurface)((byte)this[0x70] | 1);
    }
    this[0xa68] = (CBreakableSurface)0x1;
  }
  if (((this[0x105] == (CBreakableSurface)0x2) && ((float)*(int *)(this + 0x100) <= 20.0)) &&
     (this[0xa68] != (CBreakableSurface)0x1)) {
    if (this[0x6c] == (CBreakableSurface)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBreakableSurface)((byte)this[0x70] | 1);
    }
    this[0xa68] = (CBreakableSurface)0x1;
    return;
  }
  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)