L L4D2node

CBreakableProp::Spawn

0x007ea4f0 · 1388 bytes · __thiscall

_ZN14CBreakableProp5SpawnEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBreakableProp::Spawn() */

void __thiscall CBreakableProp::Spawn(CBreakableProp *this)

{
  code *pcVar1;
  int iVar2;
  uint *puVar3;
  char cVar4;
  int iVar5;
  undefined4 uVar6;
  undefined *puVar7;
  uint uVar8;
  int *piVar9;
  CBreakableProp **ppCVar10;
  longdouble lVar11;
  CBreakableProp *local_20;
  int local_10;
  
  local_20 = (CBreakableProp *)0x7ea503;
  lVar11 = (longdouble)CBaseEntity::GetGlobalFadeScale((CBaseEntity *)this);
  *(undefined4 *)(this + 0x146c) = 0x3f800000;
  *(undefined4 *)(this + 0x1470) = 0x3f800000;
  *(undefined4 *)(this + 0x1474) = 0x3f800000;
  *(float *)(this + 0x1528) = (float)lVar11;
  *(undefined4 *)(this + 0x1478) = 0x3f800000;
  local_20 = (CBreakableProp *)0x7ea543;
  CBaseProp::Spawn((CBaseProp *)this);
  if (((byte)this[0x14c] & 1) != 0) {
    return;
  }
  piVar9 = *(int **)(this + 0x13e0);
  if (piVar9 == (int *)0x0) {
    local_20 = (CBreakableProp *)0x7eaa28;
    iVar5 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar5 == 0) {
      piVar9 = *(int **)(this + 0x13e0);
    }
    else {
      local_20 = (CBreakableProp *)0x7eaa34;
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      piVar9 = *(int **)(this + 0x13e0);
    }
    if (piVar9 != (int *)0x0) goto LAB_007ea566;
LAB_007eaa42:
    iVar5 = _DAT_00000000;
  }
  else {
LAB_007ea566:
    iVar5 = *piVar9;
    if (*piVar9 == 0) goto LAB_007eaa42;
  }
  if ((*(byte *)(iVar5 + 0x99) & 8) == 0) {
    local_20 = (CBreakableProp *)0x7ea593;
    CBaseEntity::SetGlobalFadeScale((CBaseEntity *)this,*(float *)(this + 0x1528));
    iVar5 = *(int *)(this + 0x14a0);
  }
  else {
    local_20 = (CBreakableProp *)0x7ea710;
    CBaseEntity::SetGlobalFadeScale((CBaseEntity *)this,0.0);
    iVar5 = *(int *)(this + 0x14a0);
    *(undefined4 *)(this + 0x1528) = 0;
  }
  ppCVar10 = (CBreakableProp **)&stack0xffffffe4;
  if (iVar5 == 0) {
    local_20 = (CBreakableProp *)0x7ea741;
    (**(code **)(*(int *)(this + 0x13f4) + 0x54))();
    ppCVar10 = &local_20;
                    /* try { // try from 007ea758 to 007ea75a has its CatchHandler @ 007eaa92 */
    if ((local_10 != 0) &&
       (local_20 = this + 0x13f4, iVar5 = (**(code **)(*(int *)(this + 0x13f4) + 100))(),
       ppCVar10 = &local_20, iVar5 != 0)) {
      local_20 = this + 0x13f4;
      uVar6 = (**(code **)(*(int *)(this + 0x13f4) + 100))();
      *(undefined4 *)(this + 0x14a0) = uVar6;
      ppCVar10 = &local_20;
    }
  }
  if (*(int *)(this + 0x100) == 0) {
LAB_007ea865:
    if (this[0x105] != (CBreakableProp)0x1) {
      iVar5 = *(int *)this;
      *ppCVar10 = this;
      ppCVar10[1] = this + 0x105;
      pcVar1 = *(code **)(iVar5 + 0x224);
      ppCVar10[-1] = (CBreakableProp *)0x7ea887;
      (*pcVar1)();
      this[0x105] = (CBreakableProp)0x1;
    }
  }
  else {
    if (*(int *)(this + 0x14a0) == 0) {
      iVar5 = *(int *)this;
      ppCVar10[1] = (CBreakableProp *)0x6;
      *ppCVar10 = this;
      pcVar1 = *(code **)(iVar5 + 0x440);
      ppCVar10[-1] = (CBreakableProp *)0x7ea793;
      cVar4 = (*pcVar1)();
      if (cVar4 == '\0') {
        iVar5 = *(int *)this;
        ppCVar10[1] = (CBreakableProp *)0x7;
        *ppCVar10 = this;
        pcVar1 = *(code **)(iVar5 + 0x440);
        ppCVar10[-1] = (CBreakableProp *)0x7ea7ae;
        cVar4 = (*pcVar1)();
        if (cVar4 == '\0') {
          iVar5 = *(int *)this;
          ppCVar10[1] = (CBreakableProp *)0x1;
          *ppCVar10 = this;
          pcVar1 = *(code **)(iVar5 + 0x440);
          ppCVar10[-1] = (CBreakableProp *)0x7ea7c9;
          cVar4 = (*pcVar1)();
          if (cVar4 == '\0') {
            iVar5 = *(int *)this;
            ppCVar10[1] = (CBreakableProp *)0x9;
            *ppCVar10 = this;
            pcVar1 = *(code **)(iVar5 + 0x440);
            ppCVar10[-1] = (CBreakableProp *)0x7ea7e4;
            cVar4 = (*pcVar1)();
            if (cVar4 == '\0') {
              iVar5 = *(int *)this;
              ppCVar10[1] = (CBreakableProp *)0xb;
              *ppCVar10 = this;
              pcVar1 = *(code **)(iVar5 + 0x440);
              ppCVar10[-1] = (CBreakableProp *)0x7ea7ff;
              cVar4 = (*pcVar1)();
              if (cVar4 == '\0') {
                iVar5 = *(int *)this;
                ppCVar10[1] = (CBreakableProp *)0x10;
                *ppCVar10 = this;
                pcVar1 = *(code **)(iVar5 + 0x440);
                ppCVar10[-1] = (CBreakableProp *)0x7ea81a;
                cVar4 = (*pcVar1)();
                if (cVar4 == '\0') {
                  iVar5 = *(int *)this;
                  ppCVar10[1] = (CBreakableProp *)0xa;
                  *ppCVar10 = this;
                  pcVar1 = *(code **)(iVar5 + 0x440);
                  ppCVar10[-1] = (CBreakableProp *)0x7ea835;
                  cVar4 = (*pcVar1)();
                  if (cVar4 == '\0') {
                    if (*(int *)(this + 0x100) != 0) {
                      iVar5 = *(int *)this;
                      *ppCVar10 = this;
                      ppCVar10[1] = this + 0x100;
                      pcVar1 = *(code **)(iVar5 + 0x214);
                      ppCVar10[-1] = (CBreakableProp *)0x7ea85b;
                      (*pcVar1)();
                      *(undefined4 *)(this + 0x100) = 0;
                    }
                    goto LAB_007ea865;
                  }
                }
              }
            }
          }
        }
      }
    }
    if (this[0x105] != (CBreakableProp)0x2) {
      iVar5 = *(int *)this;
      *ppCVar10 = this;
      ppCVar10[1] = this + 0x105;
      pcVar1 = *(code **)(iVar5 + 0x224);
      ppCVar10[-1] = (CBreakableProp *)0x7ea5db;
      (*pcVar1)();
      this[0x105] = (CBreakableProp)0x2;
    }
    iVar5 = *g_pGameRules;
    *ppCVar10 = (CBreakableProp *)g_pGameRules;
    pcVar1 = *(code **)(iVar5 + 0xfc);
    ppCVar10[-1] = (CBreakableProp *)0x7ea5f2;
    iVar5 = (*pcVar1)();
    if (iVar5 == 2) {
      iVar5 = *(int *)this;
      ppCVar10[1] = (CBreakableProp *)0x6;
      *ppCVar10 = this;
      pcVar1 = *(code **)(iVar5 + 0x440);
      ppCVar10[-1] = (CBreakableProp *)0x7eaa03;
      cVar4 = (*pcVar1)();
      if (cVar4 == '\0') {
        iVar5 = *(int *)this;
        ppCVar10[1] = (CBreakableProp *)0x7;
        *ppCVar10 = this;
        pcVar1 = *(code **)(iVar5 + 0x440);
        ppCVar10[-1] = (CBreakableProp *)0x7eaa69;
        cVar4 = (*pcVar1)();
        if (cVar4 == '\0') {
          iVar5 = *(int *)this;
          ppCVar10[1] = (CBreakableProp *)0xb;
          *ppCVar10 = this;
          pcVar1 = *(code **)(iVar5 + 0x440);
          ppCVar10[-1] = (CBreakableProp *)0x7eaa80;
          cVar4 = (*pcVar1)();
          if (cVar4 == '\0') goto LAB_007ea5fb;
        }
      }
      ppCVar10[1] = (CBreakableProp *)0x10000;
      *ppCVar10 = this;
      ppCVar10[-1] = (CBreakableProp *)0x7eaa17;
      CBaseEntity::AddFlag((CBaseEntity *)*ppCVar10,(int)ppCVar10[1]);
    }
  }
LAB_007ea5fb:
  iVar5 = 1;
  if (0 < *(int *)(this + 0x100)) {
    iVar5 = *(int *)(this + 0x100);
  }
  if (iVar5 != *(int *)(this + 0xfc)) {
    iVar2 = *(int *)this;
    *ppCVar10 = this;
    ppCVar10[1] = this + 0xfc;
    pcVar1 = *(code **)(iVar2 + 0x20c);
    ppCVar10[-1] = (CBreakableProp *)0x7ea628;
    (*pcVar1)();
    *(int *)(this + 0xfc) = iVar5;
  }
  *(undefined4 *)(this + 0x145c) = *(undefined4 *)(gpGlobals + 0x18);
  if (*(float *)(this + 0x1444) == 0.0) {
    *(undefined4 *)(this + 0x1444) = 0x3dcccccd;
  }
  *(undefined4 *)(this + 0x144c) = 0xc0a00000;
  iVar5 = *(int *)this;
  *(undefined4 *)(this + 0x1450) = 0;
  *(undefined4 *)(this + 0x1454) = 0;
  ppCVar10[1] = (CBreakableProp *)0x18d;
  *ppCVar10 = this;
  pcVar1 = *(code **)(iVar5 + 0x340);
  ppCVar10[-1] = (CBreakableProp *)0x7ea683;
  iVar5 = (*pcVar1)();
  if (iVar5 == -1) {
    iVar5 = *(int *)this;
    ppCVar10[1] = (CBreakableProp *)0x18c;
    *ppCVar10 = this;
    pcVar1 = *(code **)(iVar5 + 0x340);
    ppCVar10[-1] = (CBreakableProp *)0x7ea96b;
    iVar5 = (*pcVar1)();
    this[0x14af] = (CBreakableProp)((iVar5 == -1) * '\x02');
  }
  else {
    this[0x14af] = (CBreakableProp)0x3;
  }
  *(undefined4 *)(this + 0x153c) = 0xffffffff;
  *(undefined4 *)(this + 0x1464) = 0xffffffff;
  *(code **)(this + 0xd8) = BreakablePropTouch;
  *(undefined4 *)(this + 0xdc) = 0;
  if ((this[0x105] == (CBreakableProp)0x2) && ((float)*(int *)(this + 0x100) <= 20.0)) {
    uVar8 = *(uint *)(this + 0x180);
    if ((uVar8 != 0xffffffff) &&
       (((puVar7 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc &&
         (*(uint *)(puVar7 + 8) == uVar8 >> 0xc)) &&
        (piVar9 = *(int **)(puVar7 + 4), piVar9 != (int *)0x0)))) {
      iVar5 = *piVar9;
      *ppCVar10 = (CBreakableProp *)piVar9;
      pcVar1 = *(code **)(iVar5 + 0x2c8);
      ppCVar10[-1] = (CBreakableProp *)0x7ea9a6;
      uVar8 = (*pcVar1)();
      if (((uVar8 & 0x200) != 0) && (this[0x1548] != (CBreakableProp)0x1)) {
        if (this[0x6c] == (CBreakableProp)0x0) {
          puVar3 = *(uint **)(this + 0x30);
          if (puVar3 != (uint *)0x0) {
            *puVar3 = *puVar3 | 0x101;
            *ppCVar10 = (CBreakableProp *)puVar3;
            ppCVar10[-1] = (CBreakableProp *)0x7ea9db;
            iVar5 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*ppCVar10);
            *(undefined2 *)(iVar5 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBreakableProp)((byte)this[0x70] | 1);
        }
        this[0x1548] = (CBreakableProp)0x1;
      }
    }
    iVar5 = *(int *)this;
    ppCVar10[1] = (CBreakableProp *)0x11;
    *ppCVar10 = this;
    pcVar1 = *(code **)(iVar5 + 0x440);
    ppCVar10[-1] = (CBreakableProp *)0x7ea8f4;
    cVar4 = (*pcVar1)();
    if (cVar4 == '\0') {
      iVar5 = *(int *)this;
      ppCVar10[1] = (CBreakableProp *)0x12;
      *ppCVar10 = this;
      pcVar1 = *(code **)(iVar5 + 0x440);
      ppCVar10[-1] = (CBreakableProp *)0x7ea94b;
      cVar4 = (*pcVar1)();
      if (cVar4 == '\0') goto LAB_007ea6c8;
    }
    if (this[0x1548] != (CBreakableProp)0x1) {
      if (this[0x6c] == (CBreakableProp)0x0) {
        puVar3 = *(uint **)(this + 0x30);
        if (puVar3 != (uint *)0x0) {
          *puVar3 = *puVar3 | 0x101;
          *ppCVar10 = (CBreakableProp *)puVar3;
          ppCVar10[-1] = (CBreakableProp *)0x7ea920;
          iVar5 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*ppCVar10);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBreakableProp)((byte)this[0x70] | 1);
      }
      this[0x1548] = (CBreakableProp)0x1;
    }
  }
LAB_007ea6c8:
  iVar5 = *(int *)this;
  ppCVar10[1] = (CBreakableProp *)0x13;
  *ppCVar10 = this;
  pcVar1 = *(code **)(iVar5 + 0x440);
  ppCVar10[-1] = (CBreakableProp *)0x7ea6db;
  cVar4 = (*pcVar1)();
  if (cVar4 == '\0') {
    return;
  }
  ppCVar10[1] = this;
  *ppCVar10 = (CBreakableProp *)TheDirector;
  ppCVar10[-1] = (CBreakableProp *)0x7ea6f4;
  CDirector::RegisterForbiddenTarget((CDirector *)*ppCVar10,(CBaseEntity *)ppCVar10[1]);
  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)