L L4D2node

CBaseButton::OnTakeDamage

0x0063a520 · 908 bytes · __thiscall

_ZN11CBaseButton12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

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

{
  uint uVar1;
  undefined1 *puVar2;
  int iVar3;
  uint *puVar4;
  CBaseEntity *pCVar5;
  undefined *puVar6;
  undefined *puVar7;
  int *piVar8;
  int *piVar9;
  uint local_98;
  undefined **local_80 [8];
  undefined4 local_60;
  undefined1 *local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined1 local_3c;
  undefined1 local_3b;
  undefined1 local_3a;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined2 local_20;
  
  pCVar5 = (CBaseEntity *)0x0;
  uVar1 = *(uint *)(this + 0x494);
  if (((uVar1 != 0xffffffff) &&
      (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
    pCVar5 = *(CBaseEntity **)(puVar6 + 4);
  }
  COutputEvent::FireOutput((COutputEvent *)(this + 0x508),pCVar5,(CBaseEntity *)this,0.0);
  if ((((byte)this[0x149] & 2) == 0) && (*(int *)(this + 0x100) == 0)) {
    return 0;
  }
  iVar3 = ButtonResponseToTouch(this);
  if (iVar3 == 0) {
    return 0;
  }
  uVar1 = *(uint *)(param_1 + 0x34);
  if (((uVar1 == 0xffffffff) ||
      (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
     ((*(uint *)(puVar6 + 8) != uVar1 >> 0xc || (*(int **)(puVar6 + 4) == (int *)0x0)))) {
    *(undefined4 *)(this + 0x494) = 0xffffffff;
    return 0;
  }
  puVar4 = (uint *)(**(code **)(**(int **)(puVar6 + 4) + 0xc))();
  puVar6 = g_pEntityList;
  local_98 = *puVar4;
  *(uint *)(this + 0x494) = local_98;
  if (local_98 == 0xffffffff) {
    return 0;
  }
  puVar7 = puVar6 + (local_98 & 0xfff) * 0x10;
  if (puVar7 == (undefined *)0xfffffffc) {
    return 0;
  }
  uVar1 = *(uint *)(puVar7 + 8);
  if (uVar1 != local_98 >> 0xc) {
    return 0;
  }
  if (*(int *)(puVar7 + 4) == 0) {
    return 0;
  }
  if (this[0x4f4] != (CBaseButton)0x0) {
    return 0;
  }
  *(undefined4 *)(this + 0xd8) = 0;
  *(undefined4 *)(this + 0xdc) = 0;
  if (iVar3 != 2) {
    if (uVar1 == *(uint *)(puVar7 + 8)) {
      pCVar5 = *(CBaseEntity **)(puVar7 + 4);
    }
    else {
      pCVar5 = (CBaseEntity *)0x0;
    }
    COutputEvent::FireOutput((COutputEvent *)(this + 0x520),pCVar5,(CBaseEntity *)this,0.0);
    ButtonActivate(this);
    return 0;
  }
  if (*(int *)(this + 0x504) == 0) {
    piVar8 = (int *)(puVar6 + (local_98 & 0xfff) * 0x10 + 4);
    puVar2 = &stack0xffffff54;
  }
  else {
    (**(code **)(*(int *)this + 0x28c))();
    CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_80);
    local_80[0] = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 0063a71c to 0063a720 has its CatchHandler @ 0063a8ed */
    CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_80,(Vector *)&local_60);
    local_80[0] = &PTR__CPASAttenuationFilter_00c08ec8;
                    /* try { // try from 0063a731 to 0063a74d has its CatchHandler @ 0063a8c5 */
    (**(code **)(*(int *)this + 0x28c))();
    CPASAttenuationFilter::Filter((CPASAttenuationFilter *)local_80,(Vector *)&local_60,0.8);
    local_3c = 1;
    local_20 = 0xffff;
    local_58 = 0x3f800000;
    local_50 = 0;
    local_4c = 100;
    local_5c = &DAT_00d539c2;
    if (*(undefined1 **)(this + 0x504) != (undefined1 *)0x0) {
      local_5c = *(undefined1 **)(this + 0x504);
    }
    local_48 = 0;
    local_44 = 0;
    local_40 = 0;
    local_3b = 0;
    local_3a = 0;
    local_38 = 0xffffffff;
    local_34 = 0;
    local_30 = 0;
    local_2c = 0;
    local_28 = 0;
    local_24 = 0;
    local_60 = 2;
    local_54 = 0x4b;
    if (*(int *)(this + 0x30) == 0) {
      iVar3 = 0;
    }
    else {
      iVar3 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
                    /* try { // try from 0063a7fa to 0063a7fe has its CatchHandler @ 0063a8de */
    CBaseEntity::EmitSound((IRecipientFilter *)local_80,iVar3,(EmitSound_t *)&local_60);
    local_28 = 0;
    CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_34);
    local_24 = local_34;
    CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_34);
    local_80[0] = &PTR__CPASFilter_00bfaf28;
    CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_80);
    local_98 = *(uint *)(this + 0x494);
    iVar3 = 0;
    piVar9 = (int *)&stack0xffffff4c;
    if ((local_98 == 0xffffffff) ||
       (piVar8 = (int *)(g_pEntityList + (local_98 & 0xfff) * 0x10 + 4),
       piVar9 = (int *)&stack0xffffff4c, puVar2 = &stack0xffffff4c, piVar8 == (int *)0x0))
    goto LAB_0063a86a;
  }
  piVar9 = (int *)puVar2;
  if (piVar8[1] == local_98 >> 0xc) {
    iVar3 = *piVar8;
  }
  else {
    iVar3 = 0;
  }
LAB_0063a86a:
  piVar9[1] = iVar3;
  piVar9[3] = 0;
  piVar9[2] = (int)this;
  *piVar9 = (int)(this + 0x520);
  piVar9[-1] = 0x63a888;
  COutputEvent::FireOutput
            ((COutputEvent *)*piVar9,(CBaseEntity *)piVar9[1],(CBaseEntity *)piVar9[2],
             (float)piVar9[3]);
  *piVar9 = (int)this;
  piVar9[-1] = 0x63a890;
  ButtonReturn((CBaseButton *)*piVar9);
  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)