L L4D2node

CPhysBox::OnTakeDamage

0x0079ec40 · 343 bytes · __thiscall

_ZN8CPhysBox12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* CPhysBox::OnTakeDamage(CTakeDamageInfo const&) */

undefined4 __thiscall CPhysBox::OnTakeDamage(CPhysBox *this,CTakeDamageInfo *param_1)

{
  uint uVar1;
  undefined4 uVar2;
  undefined *puVar3;
  CBaseEntity *pCVar4;
  
  if (((byte)this[0x14c] & 1) != 0) {
    return 0;
  }
  uVar2 = CBreakable::OnTakeDamage((CBreakable *)this,param_1);
  uVar1 = *(uint *)(param_1 + 0x30);
  if ((((uVar1 != 0xffffffff) &&
       (puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar3 + 4) != 0)) {
    uVar1 = *(uint *)(param_1 + 0x34);
    pCVar4 = (CBaseEntity *)0x0;
    if (((uVar1 != 0xffffffff) &&
        (puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) {
      pCVar4 = *(CBaseEntity **)(puVar3 + 4);
    }
    COutputEvent::FireOutput((COutputEvent *)(this + 0x524),pCVar4,(CBaseEntity *)this,0.0);
  }
  if (0 < *(int *)(this + 0x100)) {
    if (((*(float *)(this + 0x50c) != 0.0) &&
        (*(float *)(this + 0x50c) <=
         SQRT(*(float *)(param_1 + 8) * *(float *)(param_1 + 8) +
              *(float *)(param_1 + 4) * *(float *)(param_1 + 4) +
              *(float *)param_1 * *(float *)param_1))) && (*(int *)(this + 0x238) != 0)) {
      EnableMotion(this);
    }
    if ((0 < *(int *)(this + 0x508)) && (*(int *)(this + 0x100) < *(int *)(this + 0x508))) {
      EnableMotion(this);
      (**(code **)(*(int *)this + 0x2a0))(this,param_1);
    }
  }
  return uVar2;
}

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)