L L4D2node

CBreakable::OnTakeDamage

0x006b40a0 · 1592 bytes · __thiscall

_ZN10CBreakable12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

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

{
  uint uVar1;
  int iVar2;
  char cVar3;
  int *piVar4;
  int iVar5;
  undefined *puVar6;
  CBaseEntity *pCVar7;
  longdouble lVar8;
  CBaseEntity *local_80;
  undefined4 local_7c;
  undefined4 local_78;
  undefined4 local_74;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  uint local_4c;
  uint local_48;
  undefined4 local_44;
  float local_40;
  undefined4 local_3c;
  undefined4 local_38;
  uint local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  if (*(int *)(DebugZombieBreakables._28_4_ + 0x30) == 0) {
    if ((*(uint *)(this + 0x148) & 0x1000) == 0) {
      if ((*(uint *)(this + 0x148) & 0x2000) != 0) {
        uVar1 = *(uint *)(param_1 + 0x34);
        if (uVar1 == 0xffffffff) {
          return 0;
        }
        puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
        if (puVar6 == (undefined *)0xfffffffc) {
          return 0;
        }
        if (*(uint *)(puVar6 + 8) != uVar1 >> 0xc) {
          return 0;
        }
        if (*(CBaseEntity **)(puVar6 + 4) == (CBaseEntity *)0x0) {
          return 0;
        }
        iVar5 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar6 + 4));
        if (iVar5 != 3) {
          return 0;
        }
        uVar1 = *(uint *)(param_1 + 0x34);
        if (((uVar1 == 0xffffffff) ||
            (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
           (*(uint *)(puVar6 + 8) != uVar1 >> 0xc)) {
          piVar4 = (int *)0x0;
        }
        else {
          piVar4 = (int *)0x0;
          if (*(int *)(puVar6 + 4) != 0) {
            piVar4 = (int *)__dynamic_cast(*(int *)(puVar6 + 4),&CBaseEntity::typeinfo,
                                           &INextBot::typeinfo,0xfffffffe);
            if (piVar4 != (int *)0x0) {
              piVar4 = (int *)(**(code **)(*piVar4 + 0xc4))(piVar4);
              if (piVar4 == (int *)0x0) {
                return 0;
              }
              cVar3 = (**(code **)(*piVar4 + 0x114))(piVar4,0);
              if (cVar3 != '\0') {
                return 0;
              }
              goto LAB_006b41f0;
            }
            piVar4 = *(int **)(puVar6 + 4);
          }
        }
        cVar3 = (**(code **)(*piVar4 + 0x16c))(piVar4);
        if (cVar3 != '\0') {
          uVar1 = *(uint *)(param_1 + 0x34);
          pCVar7 = (CBaseEntity *)0x0;
          if (((uVar1 != 0xffffffff) &&
              (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc))
             && (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
            pCVar7 = *(CBaseEntity **)(puVar6 + 4);
          }
          iVar5 = CBaseEntity::GetTeamNumber(pCVar7);
          if (iVar5 != 3) {
            return 0;
          }
        }
      }
    }
    else {
      uVar1 = *(uint *)(param_1 + 0x34);
      if (uVar1 == 0xffffffff) {
        return 0;
      }
      puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
      if (puVar6 == (undefined *)0xfffffffc) {
        return 0;
      }
      if (*(uint *)(puVar6 + 8) != uVar1 >> 0xc) {
        return 0;
      }
      piVar4 = *(int **)(puVar6 + 4);
      if (piVar4 == (int *)0x0) {
        return 0;
      }
      cVar3 = (**(code **)(*piVar4 + 0x16c))(piVar4);
      if (cVar3 == '\0') {
        return 0;
      }
      uVar1 = *(uint *)(param_1 + 0x30);
      if (uVar1 == 0xffffffff) {
        return 0;
      }
      puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
      if (puVar6 == (undefined *)0xfffffffc) {
        return 0;
      }
      if (*(uint *)(puVar6 + 8) != uVar1 >> 0xc) {
        return 0;
      }
      pCVar7 = *(CBaseEntity **)(puVar6 + 4);
      if (pCVar7 == (CBaseEntity *)0x0) {
        return 0;
      }
      if ((((*(char **)(pCVar7 + 0x7c) != "weapon_tank_claw") &&
           (cVar3 = CBaseEntity::ClassMatchesComplex(pCVar7,"weapon_tank_claw"), cVar3 == '\0')) &&
          (*(char **)(pCVar7 + 0x7c) != "tank_rock")) &&
         (cVar3 = CBaseEntity::ClassMatchesComplex(pCVar7,"tank_rock"), cVar3 == '\0')) {
        return 0;
      }
    }
  }
LAB_006b41f0:
  cVar3 = CDirector::IsFinale(TheDirector);
  if (((cVar3 == '\0') && (**(char **)(TheDirector + 0x640) == '\0')) &&
     (*(char *)(*(int *)(TheDirector + 0x644) + 8) == '\0')) {
    local_48 = *(uint *)(param_1 + 0x34);
    if (local_48 == 0xffffffff) {
LAB_006b46c0:
      local_48 = 0xffffffff;
      goto LAB_006b4208;
    }
    puVar6 = g_pEntityList + (local_48 & 0xfff) * 0x10;
    if (((puVar6 == (undefined *)0xfffffffc) || (*(uint *)(puVar6 + 8) != local_48 >> 0xc)) ||
       (*(CBaseEntity **)(puVar6 + 4) == (CBaseEntity *)0x0)) goto LAB_006b4208;
    iVar5 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar6 + 4));
    if (iVar5 == 3) {
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      iVar5 = CNavMesh::GetNearestNavArea
                        (TheNavMesh,(Vector *)(this + 0x2e0),false,10000.0,false,true,false);
      if (((iVar5 != 0) && ((*(byte *)(iVar5 + 300) & 0x40) != 0)) &&
         (cVar3 = (**(code **)(*(int *)this + 0x3ac))(this,0x11), cVar3 == '\0')) {
        local_48 = *(uint *)(param_1 + 0x34);
        if (local_48 == 0xffffffff) goto LAB_006b46c0;
        puVar6 = g_pEntityList + (local_48 & 0xfff) * 0x10;
        if (((puVar6 == (undefined *)0xfffffffc) || (*(uint *)(puVar6 + 8) != local_48 >> 0xc)) ||
           (pCVar7 = *(CBaseEntity **)(puVar6 + 4), pCVar7 == (CBaseEntity *)0x0))
        goto LAB_006b4208;
        cVar3 = (**(code **)(*(int *)pCVar7 + 0x16c))(pCVar7);
        if (cVar3 != '\0') {
          iVar5 = CBaseEntity::GetTeamNumber(pCVar7);
          if (iVar5 != 3) {
            return 0;
          }
          iVar5 = (**(code **)(*(int *)pCVar7 + 0x544))(pCVar7);
          if (iVar5 != 8) {
            return 0;
          }
        }
      }
    }
  }
  local_48 = *(uint *)(param_1 + 0x34);
LAB_006b4208:
  local_7c = *(undefined4 *)param_1;
  local_3c = *(undefined4 *)(param_1 + 0x40);
  local_44 = *(undefined4 *)(param_1 + 0x38);
  local_40 = *(float *)(param_1 + 0x3c);
  local_78 = *(undefined4 *)(param_1 + 4);
  local_38 = *(undefined4 *)(param_1 + 0x44);
  local_74 = *(undefined4 *)(param_1 + 8);
  local_70 = *(undefined4 *)(param_1 + 0xc);
  local_6c = *(undefined4 *)(param_1 + 0x10);
  local_68 = *(undefined4 *)(param_1 + 0x14);
  local_64 = *(undefined4 *)(param_1 + 0x18);
  local_60 = *(undefined4 *)(param_1 + 0x1c);
  local_5c = *(undefined4 *)(param_1 + 0x20);
  local_58 = *(undefined4 *)(param_1 + 0x24);
  local_54 = *(undefined4 *)(param_1 + 0x28);
  local_50 = *(undefined4 *)(param_1 + 0x2c);
  local_4c = *(uint *)(param_1 + 0x30);
  local_34 = *(uint *)(param_1 + 0x48);
  local_24 = *(undefined4 *)(param_1 + 0x58);
  local_30 = *(undefined4 *)(param_1 + 0x4c);
  local_2c = *(undefined4 *)(param_1 + 0x50);
  local_28 = *(undefined4 *)(param_1 + 0x54);
  local_20 = *(undefined4 *)(param_1 + 0x5c);
  if ((this[0x105] != (CBreakable)0x0) && ((float)*(int *)(this + 0x474) <= local_40)) {
    cVar3 = (**(code **)(*(int *)this + 0x118))(this,(CTakeDamageInfo *)&local_7c);
    if (cVar3 == '\0') {
      this[0x478] = (CBreakable)0x0;
      return 1;
    }
    (**(code **)(*(int *)this + 0x288))(this);
    local_80 = (CBaseEntity *)0x0;
    if (((local_4c != 0xffffffff) &&
        (puVar6 = g_pEntityList + (local_4c & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar6 + 8) == local_4c >> 0xc)) {
      local_80 = *(CBaseEntity **)(puVar6 + 4);
    }
    if (((byte)local_80[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(local_80);
    }
    if (*(int *)(this + 0x44c) != 7) {
      lVar8 = (longdouble)
              GetBreakableDamage((CTakeDamageInfo *)&local_7c,
                                 (IBreakableWithPropData *)(this + 0x440));
      iVar5 = *(int *)(this + 0x100);
      local_40 = (float)lVar8;
      CBaseEntity::OnTakeDamage((CBaseEntity *)this,(CTakeDamageInfo *)&local_7c);
      iVar2 = *(int *)(this + 0x100);
      if (iVar5 != iVar2) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        *(int *)(this + 0x100) = iVar5;
      }
      uVar1 = *(uint *)(param_1 + 0x34);
      pCVar7 = (CBaseEntity *)0x0;
      if (((uVar1 != 0xffffffff) &&
          (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
        pCVar7 = *(CBaseEntity **)(puVar6 + 4);
      }
      cVar3 = UpdateHealth(this,iVar2,pCVar7);
      if (cVar3 == '\0') {
        return 1;
      }
      if (this[0x105] != (CBreakable)0x2) {
        return 1;
      }
      if ((local_34 & 8) == 0) {
        DamageSound(this);
        return 1;
      }
      return 1;
    }
  }
  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)