L L4D2node

CBaseCombatCharacter::OnTakeDamage

0x005f2790 · 730 bytes · __thiscall

_ZN20CBaseCombatCharacter12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

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

{
  CBaseCombatCharacter CVar1;
  uint uVar2;
  int *piVar3;
  char cVar4;
  undefined4 uVar5;
  int iVar6;
  undefined *puVar7;
  int iVar8;
  CBaseCombatCharacter *pCVar9;
  longdouble lVar10;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  if (this[0x105] == (CBaseCombatCharacter)0x0) {
    return 0;
  }
  *(int *)(this + 0x1840) = *(int *)(this + 0x1840) + 1;
  if (((byte)param_1[0x49] & 1) == 0) {
    uVar2 = *(uint *)(param_1 + 0x34);
  }
  else {
    local_28 = *(undefined4 *)(param_1 + 0xc);
    local_24 = *(undefined4 *)(param_1 + 0x10);
    local_20 = *(undefined4 *)(param_1 + 0x14);
    (**(code **)(*(int *)g_pEffects + 0x10))(g_pEffects,(Vector *)&local_28,2,2,0);
    iVar6 = (**(code **)(*random_valve + 8))(random_valve,10,0xf);
    local_28 = *(undefined4 *)(param_1 + 0xc);
    local_24 = *(undefined4 *)(param_1 + 0x10);
    local_20 = *(undefined4 *)(param_1 + 0x14);
    UTIL_Smoke((Vector *)&local_28,(float)iVar6,10.0);
    uVar2 = *(uint *)(param_1 + 0x34);
  }
  if ((((uVar2 == 0xffffffff) ||
       (puVar7 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar7 + 8) != uVar2 >> 0xc)) ||
     (*(CBaseEntity **)(puVar7 + 4) == (CBaseEntity *)0x0)) {
LAB_005f27e9:
    CVar1 = this[0x104];
  }
  else {
    iVar6 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar7 + 4));
    iVar8 = 0;
    *(uint *)(this + 0x19e0) = *(uint *)(this + 0x19e0) | 1 << ((byte)iVar6 & 0x1f);
    pCVar9 = this;
    do {
      if (iVar6 == *(int *)(pCVar9 + 0x19e4)) {
LAB_005f29ca:
        pCVar9 = this + iVar8 * 0xc + 0x19e0;
        lVar10 = (longdouble)IntervalTimer::Now();
        if ((float)lVar10 != *(float *)(pCVar9 + 0xc)) {
          (**(code **)(*(int *)(pCVar9 + 8) + 4))(pCVar9 + 8,pCVar9 + 0xc);
          *(float *)(pCVar9 + 0xc) = (float)lVar10;
        }
        goto LAB_005f27e9;
      }
      if (*(int *)(pCVar9 + 0x19e4) == -1) {
        *(int *)(this + iVar8 * 0xc + 0x19e4) = iVar6;
        goto LAB_005f29ca;
      }
      iVar8 = iVar8 + 1;
      pCVar9 = pCVar9 + 0xc;
    } while (iVar8 != 4);
    CVar1 = this[0x104];
  }
  if (CVar1 == (CBaseCombatCharacter)0x0) {
    uVar5 = (**(code **)(*(int *)this + 0x494))(this,param_1);
    if (*(int *)(this + 0x100) < 1) {
      piVar3 = *(int **)(this + 0x238);
      if (piVar3 != (int *)0x0) {
        (**(code **)(*piVar3 + 0x34))(piVar3,0);
      }
      (**(code **)(*(int *)this + 0x130))(this,param_1);
      cVar4 = (**(code **)(*(int *)this + 0x4cc))(this,param_1);
      if ((cVar4 != '\0') &&
         (cVar4 = (**(code **)(*(int *)this + 0x4d4))(this,param_1), cVar4 != '\0')) {
        return uVar5;
      }
      (**(code **)(*(int *)this + 0x4d8))(this);
    }
  }
  else if (CVar1 == (CBaseCombatCharacter)0x1) {
    uVar5 = (**(code **)(*(int *)this + 0x498))(this,param_1);
  }
  else {
    uVar5 = (**(code **)(*(int *)this + 0x49c))(this,param_1);
    if (((0 < *(int *)(this + 0x100)) ||
        (cVar4 = (**(code **)(*g_pGameRules + 0x48))(g_pGameRules,*(undefined4 *)(param_1 + 0x48)),
        cVar4 == '\0')) ||
       (cVar4 = (**(code **)(*(int *)this + 0x4cc))(this,param_1), cVar4 == '\0')) {
      return uVar5;
    }
    (**(code **)(*(int *)this + 0x4d4))(this,param_1);
    uVar5 = 0;
  }
  return uVar5;
}

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)