L L4D2node

CPropDoorRotatingBreakable::OnTakeDamage

0x007f7f20 · 2336 bytes · __thiscall

_ZN26CPropDoorRotatingBreakable12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

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

{
  float fVar1;
  CPropDoorRotatingBreakable CVar2;
  CPropDoorRotatingBreakable CVar3;
  CPropDoorRotatingBreakable CVar4;
  CBaseEntity *this_00;
  undefined4 uVar5;
  code *pcVar6;
  CBaseEdict *this_01;
  char cVar7;
  undefined4 uVar8;
  int iVar9;
  int iVar10;
  undefined4 uVar11;
  Vector *pVVar12;
  undefined4 uVar13;
  undefined1 *puVar14;
  undefined1 *puVar15;
  KeyValues *pKVar16;
  undefined4 uVar17;
  char *pcVar18;
  char *pcVar19;
  int iVar20;
  undefined *puVar21;
  int iVar22;
  int in_GS_OFFSET;
  longdouble lVar23;
  uint uVar24;
  CTakeDamageInfo *pCVar25;
  CPropDoorRotatingBreakable *pCVar26;
  int local_12c;
  undefined1 *local_110 [2];
  CTakeDamageInfo local_108 [12];
  undefined **local_fc [8];
  undefined4 local_dc;
  undefined4 local_d8;
  undefined4 local_d4;
  undefined4 local_d0;
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  undefined4 local_b8;
  undefined4 local_b4;
  undefined4 local_b0;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  float local_a0;
  undefined4 local_9c;
  undefined4 local_98;
  uint local_94;
  undefined4 local_90;
  undefined4 local_8c;
  undefined4 local_88;
  undefined4 local_84;
  undefined4 local_80;
  undefined **local_7c;
  undefined1 local_78;
  char local_77 [83];
  undefined4 local_24;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_dc = *(undefined4 *)param_1;
  iVar20 = *(int *)(this + 0x100);
  local_d8 = *(undefined4 *)(param_1 + 4);
  local_d4 = *(undefined4 *)(param_1 + 8);
  local_d0 = *(undefined4 *)(param_1 + 0xc);
  local_cc = *(undefined4 *)(param_1 + 0x10);
  local_c8 = *(undefined4 *)(param_1 + 0x14);
  local_c4 = *(undefined4 *)(param_1 + 0x18);
  local_c0 = *(undefined4 *)(param_1 + 0x1c);
  local_bc = *(undefined4 *)(param_1 + 0x20);
  local_b8 = *(undefined4 *)(param_1 + 0x24);
  local_b4 = *(undefined4 *)(param_1 + 0x28);
  local_b0 = *(undefined4 *)(param_1 + 0x2c);
  local_ac = *(undefined4 *)(param_1 + 0x30);
  local_90 = *(undefined4 *)(param_1 + 0x4c);
  local_a8 = *(undefined4 *)(param_1 + 0x34);
  local_9c = *(undefined4 *)(param_1 + 0x40);
  local_a0 = *(float *)(param_1 + 0x3c);
  local_8c = *(undefined4 *)(param_1 + 0x50);
  local_a4 = *(undefined4 *)(param_1 + 0x38);
  local_98 = *(undefined4 *)(param_1 + 0x44);
  local_88 = *(undefined4 *)(param_1 + 0x54);
  local_94 = *(uint *)(param_1 + 0x48);
  local_84 = *(undefined4 *)(param_1 + 0x58);
  local_80 = *(undefined4 *)(param_1 + 0x5c);
  if ((local_94 & 0x40) != 0) {
    if (local_a0 < 40.0) {
      if ((local_94 & 0x8000000) != 0) {
        local_a0 = (float)*(int *)(this + 0xfc);
      }
    }
    else {
      local_a0 = (float)*(int *)(this + 0xfc);
    }
  }
  uVar8 = 0;
  if (this[0x17d0] == (CPropDoorRotatingBreakable)0x0) goto LAB_007f804c;
  cVar7 = (**(code **)(*(int *)this + 0x440))(this,0x11);
  if ((cVar7 != '\0') &&
     (((((uVar24 = *(uint *)(param_1 + 0x34), uVar24 == 0xffffffff ||
         (puVar21 = g_pEntityList + (uVar24 & 0xfff) * 0x10, puVar21 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar21 + 8) != uVar24 >> 0xc)) ||
       ((this_00 = *(CBaseEntity **)(puVar21 + 4), this_00 == (CBaseEntity *)0x0 ||
        (cVar7 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar7 == '\0')))) ||
      ((iVar9 = CBaseEntity::GetTeamNumber(this_00), iVar9 != 3 ||
       (iVar9 = (**(code **)(*(int *)this_00 + 0x544))(this_00), iVar9 != 8)))))) {
    uVar8 = 0;
    goto LAB_007f804c;
  }
  uVar8 = CBreakableProp::OnTakeDamage((CBreakableProp *)this,(CTakeDamageInfo *)&local_dc);
  iVar9 = *(int *)(this + 0x100);
  if (((iVar9 < 1) || (iVar20 == iVar9)) || (iVar20 = *(int *)(this + 0x17e4), iVar20 < 1))
  goto LAB_007f804c;
  iVar10 = *(int *)(this + 0xfc) / (iVar20 + 1);
  iVar22 = *(int *)(this + 0xfc) - iVar10;
  if (iVar9 < iVar22) {
    iVar22 = iVar22 - iVar10;
    local_12c = -1;
    do {
      iVar22 = iVar22 - iVar10;
      local_12c = local_12c + 1;
    } while (iVar9 < iVar22 + iVar10);
    if (local_12c < iVar20) goto LAB_007f87e0;
    local_12c = iVar20 + -1;
  }
  else {
    local_12c = -1;
LAB_007f87e0:
    if (local_12c < 0) {
      local_12c = -1;
    }
  }
  if (*(int *)(this + 0x17d4) < local_12c) {
    this[0x17d1] = (CPropDoorRotatingBreakable)0x0;
    if (*(int *)(this + 0x15f4) == 0) {
      CBasePropDoor::UpdateAreaPortals((CBasePropDoor *)this,true);
    }
    uVar11 = CBaseAnimating::GetSequenceActivity((CBaseAnimating *)this,*(int *)(this + 0x494));
    fVar1 = *(float *)(this + 0x490);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    PhysBreakSound(this,*(undefined4 *)(this + 0x238),*(undefined4 *)(this + 0x2e0),
                   *(undefined4 *)(this + 0x2e4),*(undefined4 *)(this + 0x2e8));
    pVVar12 = (Vector *)(**(code **)(*(int *)this + 0x288))(this);
    CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_fc);
    local_fc[0] = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 007f8295 to 007f8299 has its CatchHandler @ 007f8858 */
    CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_fc,pVVar12);
    while (*(int *)(this + 0x17d4) < local_12c) {
      pCVar25 = param_1;
      pCVar26 = this;
      GetVelocityFromDamageForce(local_108,(CBaseEntity *)param_1);
      pcVar6 = *(code **)(*(int *)te + 0xa0);
      CVar2 = this[0x126];
      CVar3 = this[0x125];
      CVar4 = this[0x124];
      uVar17 = *(undefined4 *)(this + 0xd4);
      if ((((byte)this[0x14d] & 8) != 0) &&
         (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this), ((byte)this[0x14d] & 8) != 0)) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      uVar5 = *(undefined4 *)(this + 0x458);
                    /* try { // try from 007f82b1 to 007f83fa has its CatchHandler @ 007f888c */
      uVar13 = (**(code **)(*(int *)this + 0x1c))(this,pCVar25,pCVar26);
      (*pcVar6)(te,local_fc,0xbf800000,uVar13,uVar5,this + 0x2e0,this + 0x37c,local_108,1,uVar17,
                CVar4,CVar3,CVar2);
      iVar20 = *(int *)(this + 0x17d4);
      local_7c = &PTR_InitQuietTruncation_00cc5b10;
      local_78 = 1;
      local_77[0] = '\0';
      local_24 = 0;
      *(int *)(this + 0x17d4) = iVar20 + 1;
      puVar15 = *(undefined1 **)(*(int *)(this + 0x17d8) + (iVar20 + 1) * 4);
      puVar14 = &DAT_00d539c2;
      if (puVar15 != (undefined1 *)0x0) {
        puVar14 = puVar15;
      }
      CFmtStrN<80>::sprintf((CFmtStrN<80> *)&local_7c,"models/%s.mdl",puVar14);
      V_FixSlashes(local_77,'/');
      pcVar6 = *(code **)(*(int *)this + 0x70);
      AllocPooledString((char *)local_110);
      puVar15 = &DAT_00d539c2;
      if (local_110[0] != (undefined1 *)0x0) {
        puVar15 = local_110[0];
      }
      (*pcVar6)(this,puVar15);
      (**(code **)(*(int *)this + 0x298))(this);
      uVar24 = 0;
      CBaseEntity::VPhysicsInitShadow((CBaseEntity *)this,false,false,(solid_t *)0x0);
      pKVar16 = KeyValues::operator_new((KeyValues *)0x2c,uVar24);
                    /* try { // try from 007f841c to 007f8420 has its CatchHandler @ 007f8870 */
      KeyValues::KeyValues(pKVar16,"",(IKeyValuesSystem *)0x0,false);
      pcVar6 = *(code **)(*modelinfo + 0x54);
                    /* try { // try from 007f842e to 007f880f has its CatchHandler @ 007f888c */
      uVar17 = CBaseEntity::GetModel((CBaseEntity *)this);
      pcVar18 = (char *)(*pcVar6)(modelinfo,uVar17);
      pcVar6 = *(code **)(*modelinfo + 0x10);
      uVar17 = CBaseEntity::GetModel((CBaseEntity *)this);
      pcVar19 = (char *)(*pcVar6)(modelinfo,uVar17);
      cVar7 = KeyValues::LoadFromBuffer(pKVar16,pcVar19,pcVar18,(IBaseFileSystem *)0x0,(char *)0x0);
      if ((cVar7 != '\0') &&
         (pKVar16 = (KeyValues *)KeyValues::FindKey(pKVar16,"prop_data",false),
         pKVar16 != (KeyValues *)0x0)) {
        pcVar6 = *(code **)(*(int *)this + 0x3bc);
        lVar23 = (longdouble)(**(code **)(*(int *)this + 0x3cc))(this);
        lVar23 = (longdouble)KeyValues::GetFloat(pKVar16,"dmg.bullets",(float)lVar23);
        (*pcVar6)(this,(float)lVar23);
        pcVar6 = *(code **)(*(int *)this + 0x3c0);
        lVar23 = (longdouble)(**(code **)(*(int *)this + 0x3d0))(this);
        lVar23 = (longdouble)KeyValues::GetFloat(pKVar16,"dmg.club",(float)lVar23);
        (*pcVar6)(this,(float)lVar23);
        pcVar6 = *(code **)(*(int *)this + 0x3c4);
        lVar23 = (longdouble)(**(code **)(*(int *)this + 0x3d4))(this);
        lVar23 = (longdouble)KeyValues::GetFloat(pKVar16,"dmg.explosive",(float)lVar23);
        (*pcVar6)(this,(float)lVar23);
        pcVar6 = *(code **)(*(int *)this + 0x3c8);
        lVar23 = (longdouble)(**(code **)(*(int *)this + 0x3d8))(this);
        lVar23 = (longdouble)KeyValues::GetFloat(pKVar16,"dmg.fire",(float)lVar23);
        (*pcVar6)(this,(float)lVar23);
        uVar24 = CBaseEntity::BlocksLOS((CBaseEntity *)this);
        iVar20 = KeyValues::GetInt(pKVar16,"blocklos",uVar24 & 0xff);
        CBaseEntity::SetBlocksLOS((CBaseEntity *)this,iVar20 != 0);
        iVar20 = KeyValues::GetInt(pKVar16,"isdebris",0);
        if (iVar20 != 0) {
          CBaseEntity::SetCollisionGroup((CBaseEntity *)this,1);
        }
      }
      KeyValues::deleteThis();
    }
    iVar20 = (**(code **)(*(int *)this + 0x340))(this,uVar11);
    if ((-1 < iVar20) &&
       (CBaseAnimating::SetSequence((CBaseAnimating *)this,iVar20),
       fVar1 != *(float *)(this + 0x490))) {
      if (this[0x6c] == (CPropDoorRotatingBreakable)0x0) {
        this_01 = *(CBaseEdict **)(this + 0x30);
        if (this_01 != (CBaseEdict *)0x0) {
          *(uint *)this_01 = *(uint *)this_01 | 0x101;
          iVar20 = CBaseEdict::GetChangeAccessor(this_01);
          *(undefined2 *)(iVar20 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CPropDoorRotatingBreakable)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x490) = fVar1;
    }
    COutputEvent::FireOutput
              ((COutputEvent *)(this + 0x13fc),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
    local_fc[0] = &PTR__CPASFilter_00bfaf28;
    CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_fc);
  }
LAB_007f804c:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return uVar8;
}

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)