L L4D2node

Infected::OnTakeDamage

0x00a10c40 · 1294 bytes · __thiscall

_ZN8Infected12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

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

{
  float fVar1;
  float fVar2;
  float fVar3;
  uint uVar4;
  CBaseEdict *this_00;
  char cVar5;
  uint uVar6;
  undefined4 uVar7;
  int iVar8;
  int *piVar9;
  CBaseEntity *this_01;
  undefined *puVar10;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  uVar6 = *(uint *)(param_1 + 0x48);
  if ((uVar6 & 0x2000000) != 0) {
    iVar8 = (**(code **)(*(int *)this + 0x544))(this);
    if (iVar8 != 7) {
      uVar7 = 0;
      uVar6 = *(uint *)(param_1 + 0x30);
      if (((uVar6 != 0xffffffff) &&
          (puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar10 + 8) == uVar6 >> 0xc)) {
        uVar7 = *(undefined4 *)(puVar10 + 4);
      }
      (**(code **)(*(int *)(this + 0x1a3c) + 0x74))(this + 0x1a3c,uVar7);
    }
    uVar6 = *(uint *)(param_1 + 0x48);
  }
  if ((uVar6 & 0x1000000) != 0) {
    if ((float)*(int *)(this + 0x100) < *(float *)(param_1 + 0x3c) ||
        (float)*(int *)(this + 0x100) == *(float *)(param_1 + 0x3c)) {
      uVar7 = CBaseEntity::GetGender((CBaseEntity *)this);
      piVar9 = (int *)GetDamageCutoutHalfBodyWounds(uVar7);
      if (0 < piVar9[3]) {
        iVar8 = rand();
        RequestWound(this,*(int *)(*piVar9 + (iVar8 % piVar9[3]) * 4));
        fVar1 = *(float *)param_1;
        fVar2 = *(float *)(param_1 + 4);
        fVar3 = *(float *)(param_1 + 8);
        if (((fVar1 != *(float *)(this + 0x1cdc)) || (fVar2 != *(float *)(this + 0x1ce0))) ||
           (fVar3 != *(float *)(this + 0x1ce4))) {
          if (this[0x6c] == (Infected)0x0) {
            this_00 = *(CBaseEdict **)(this + 0x30);
            if (this_00 != (CBaseEdict *)0x0) {
              *(uint *)this_00 = *(uint *)this_00 | 0x101;
              iVar8 = CBaseEdict::GetChangeAccessor(this_00);
              *(undefined2 *)(iVar8 + 2) = 0;
            }
          }
          else {
            this[0x70] = (Infected)((byte)this[0x70] | 1);
          }
          *(float *)(this + 0x1cdc) = fVar1;
          *(float *)(this + 0x1ce0) = fVar2;
          *(float *)(this + 0x1ce4) = fVar3;
        }
      }
    }
    cVar5 = UTIL_IsLowViolence();
    if ((cVar5 == '\0') && (iVar8 = RandomInt(0,10), iVar8 < 5)) {
      local_28 = 0;
      local_24 = 0;
      local_20 = 0xbf800000;
      VectorAngles((Vector *)&local_28,(QAngle *)&local_40);
      local_34 = *(undefined4 *)(param_1 + 0xc);
      local_30 = *(undefined4 *)(param_1 + 0x10);
      local_2c = *(undefined4 *)(param_1 + 0x14);
      DispatchParticleEffect
                ("blood_impact_headshot_01",local_34,local_30,local_2c,local_40,local_3c,local_38,0,
                 0,0xffffffff);
    }
  }
  uVar6 = *(uint *)(this + 0x1c74);
  if (((((((uVar6 & 0x20) != 0) && ((*(uint *)(param_1 + 0x48) & 0x20200002) != 0)) &&
        ((*(uint *)(param_1 + 0x48) & 0x40) == 0)) &&
       ((uVar4 = *(uint *)(param_1 + 0x34), uVar4 != 0xffffffff &&
        (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)))) &&
      (*(uint *)(puVar10 + 8) == uVar4 >> 0xc)) && (*(int *)(puVar10 + 4) != 0)) {
    cVar5 = WasAttackedFromFront(this,param_1);
    if (cVar5 != '\0') {
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      local_20 = *(undefined4 *)(param_1 + 0x14);
      local_28 = *(undefined4 *)(param_1 + 0xc);
      local_24 = *(undefined4 *)(param_1 + 0x10);
      DispatchParticleEffect
                ("impact_armor",local_28,local_24,local_20,*(undefined4 *)(this + 0x37c),
                 *(undefined4 *)(this + 0x380),*(undefined4 *)(this + 900),0,0,0xffffffff);
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      uVar6 = *(uint *)(param_1 + 0x34);
      this_01 = (CBaseEntity *)0x0;
      if (((uVar6 != 0xffffffff) &&
          (puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar10 + 8) == uVar6 >> 0xc)) {
        this_01 = *(CBaseEntity **)(puVar10 + 4);
      }
      if (((byte)this_01[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(this_01);
      }
      if (((((byte)param_1[0x4b] & 0x20) == 0) ||
          (207936.0 <
           (*(float *)(this_01 + 0x2e4) - *(float *)(this + 0x2e4)) *
           (*(float *)(this_01 + 0x2e4) - *(float *)(this + 0x2e4)) +
           (*(float *)(this_01 + 0x2e0) - *(float *)(this + 0x2e0)) *
           (*(float *)(this_01 + 0x2e0) - *(float *)(this + 0x2e0)) +
           (*(float *)(this_01 + 0x2e8) - *(float *)(this + 0x2e8)) *
           (*(float *)(this_01 + 0x2e8) - *(float *)(this + 0x2e8)))) &&
         (*(float *)(param_1 + 0x3c) < 90.0)) {
        return 0;
      }
      goto LAB_00a10d00;
    }
    uVar6 = *(uint *)(this + 0x1c74);
  }
  if (((((uVar6 & 0x800) == 0) || (this[0x1d88] != (Infected)0x0)) ||
      (((*(uint *)(param_1 + 0x48) & 0x20200002) == 0 ||
       ((((*(uint *)(param_1 + 0x48) & 0x41000040) != 0 ||
         (uVar6 = *(uint *)(param_1 + 0x34), uVar6 == 0xffffffff)) ||
        (puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc))))))
     || ((*(uint *)(puVar10 + 8) != uVar6 >> 0xc || (*(int *)(puVar10 + 4) == 0)))) {
    uVar7 = CBaseCombatCharacter::OnTakeDamage((CBaseCombatCharacter *)this,param_1);
    return uVar7;
  }
LAB_00a10d00:
  cVar5 = IsStumbling(this);
  if (cVar5 == '\0') {
    piVar9 = (int *)(**(code **)(*(int *)this + 0x148))(this);
    uVar6 = *(uint *)(param_1 + 0x34);
    if (((uVar6 == 0xffffffff) ||
        (puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar10 + 8) != uVar6 >> 0xc)) {
      uVar7 = 0;
    }
    else {
      uVar7 = *(undefined4 *)(puVar10 + 4);
    }
    (**(code **)(*piVar9 + 0x74))(piVar9,uVar7);
    return 0;
  }
  return 0;
}

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)