L L4D2node

CBreakable::BreakTouch

0x006b3d80 · 763 bytes · __thiscall

_ZN10CBreakable10BreakTouchEP11CBaseEntity

Decompiled

undefined (2 params)

/* CBreakable::BreakTouch(CBaseEntity*) */

void __thiscall CBreakable::BreakTouch(CBreakable *this,CBaseEntity *param_1)

{
  float fVar1;
  float fVar2;
  int iVar3;
  code *pcVar4;
  char cVar5;
  uint uVar6;
  CBreakable *pCVar7;
  undefined4 *puVar8;
  int *piVar9;
  undefined1 local_94 [12];
  float local_88;
  float local_84;
  float local_80;
  float local_7c;
  float local_78;
  float local_74;
  
  piVar9 = (int *)&stack0xffffff44;
  cVar5 = (**(code **)(*(int *)param_1 + 0x16c))();
  if ((cVar5 != '\0') && (*(int *)(this + 0x44c) != 7)) {
    uVar6 = *(uint *)(this + 0x148);
    if ((uVar6 & 2) != 0) {
      (**(code **)(*(int *)param_1 + 600))();
      piVar9 = (int *)&stack0xffffff40;
      fVar1 = SQRT(local_7c * local_7c + local_74 * local_74 + local_78 * local_78) * 0.01;
      if ((float)*(int *)(this + 0x100) <= fVar1) {
        if (this[0x105] != (CBreakable)0x2) {
          (**(code **)(*(int *)this + 0x224))();
          this[0x105] = (CBreakable)0x2;
        }
        *(undefined4 *)(this + 0xd8) = 0;
        *(undefined4 *)(this + 0xdc) = 0;
        pcVar4 = *(code **)(*(int *)this + 0x124);
        CTakeDamageInfo::CTakeDamageInfo((CTakeDamageInfo *)&local_7c,param_1,param_1,fVar1,1,0);
        (*pcVar4)();
        CTakeDamageInfo::CTakeDamageInfo
                  ((CTakeDamageInfo *)&local_7c,param_1,param_1,fVar1 * 0.25,4,0);
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          if (((byte)this[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          }
        }
        if (((byte)param_1[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(param_1);
        }
        local_88 = *(float *)(param_1 + 0x2e0) - *(float *)(this + 0x2e0);
        local_84 = *(float *)(param_1 + 0x2e4) - *(float *)(this + 0x2e4);
        local_80 = *(float *)(param_1 + 0x2e8) - *(float *)(this + 0x2e8);
        CalculateMeleeDamageForce
                  ((CTakeDamageInfo *)&local_7c,(Vector *)&local_88,(Vector *)(this + 0x2e0),1.0);
        CBaseEntity::TakeDamage(param_1,(CTakeDamageInfo *)&local_7c);
      }
      uVar6 = *(uint *)(this + 0x148);
    }
    if ((uVar6 & 4) != 0) {
      *piVar9 = (int)param_1;
      piVar9[-1] = 0x6b3dd0;
      pCVar7 = (CBreakable *)CBaseEntity::GetGroundEntity((CBaseEntity *)*piVar9);
      if (pCVar7 == this) {
        *piVar9 = (int)this;
        piVar9[-1] = 0x6b3ddc;
        DamageSound((CBreakable *)*piVar9);
        iVar3 = *(int *)param_1;
        *piVar9 = (int)param_1;
        pcVar4 = *(code **)(iVar3 + 0xc);
        piVar9[-1] = 0x6b3de4;
        puVar8 = (undefined4 *)(*pcVar4)();
        *(undefined4 *)(this + 0x450) = *puVar8;
        piVar9[1] = (int)this;
        *piVar9 = (int)local_94;
        piVar9[5] = 0;
        piVar9[4] = 0;
        piVar9[2] = 0x325;
        piVar9[3] = 0;
        piVar9[-1] = 0x6b3e1e;
        CBaseEntity::ThinkSet((_func_void *)*piVar9,(float)piVar9[1],(char *)piVar9[2]);
        iVar3 = gpGlobals;
        *(undefined4 *)(this + 0xd8) = 0;
        *(undefined4 *)(this + 0xdc) = 0;
        piVar9[2] = 0;
        fVar1 = *(float *)(this + 0x470);
        fVar2 = *(float *)(iVar3 + 0xc);
        *piVar9 = (int)this;
        piVar9[1] = (int)(fVar1 + fVar2);
        piVar9[-1] = 0x6b3e5d;
        CBaseEntity::SetNextThink((CBaseEntity *)*piVar9,(float)piVar9[1],(char *)piVar9[2]);
      }
    }
  }
  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)