L L4D2node

CBaseCombatCharacter::Event_Killed

0x005f3c20 · 1245 bytes · __thiscall

_ZN20CBaseCombatCharacter12Event_KilledERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

void __thiscall
CBaseCombatCharacter::Event_Killed(CBaseCombatCharacter *this,CTakeDamageInfo *param_1)

{
  int *piVar1;
  char cVar2;
  CBaseCombatCharacter *pCVar3;
  undefined4 *puVar4;
  undefined4 uVar5;
  CBaseEntity *pCVar6;
  undefined *puVar7;
  uint uVar8;
  longdouble lVar9;
  CBaseCombatCharacter *pCVar10;
  CTakeDamageInfo *pCVar11;
  int *local_44;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if (this[0x104] != (CBaseCombatCharacter)0x1) {
    (**(code **)(*(int *)this + 0x21c))(this,this + 0x104);
    this[0x104] = (CBaseCombatCharacter)0x1;
  }
  pCVar10 = this;
  pCVar11 = param_1;
  CalcDamageForceVector((CTakeDamageInfo *)&local_34);
  pCVar3 = (CBaseCombatCharacter *)CRagdollMagnet::FindBestMagnet((CBaseEntity *)this);
  if (pCVar3 != (CBaseCombatCharacter *)0x0) {
    pCVar11 = (CTakeDamageInfo *)this;
    CRagdollMagnet::GetForceVector((CBaseEntity *)&local_28);
    local_34 = local_34 + local_28;
    local_30 = local_30 + local_24;
    local_2c = local_2c + local_20;
    pCVar10 = pCVar3;
  }
  uVar8 = *(uint *)(this + 0x19d4);
  local_44 = (int *)0x0;
  if (((uVar8 != 0xffffffff) &&
      (puVar7 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar7 + 8) == uVar8 >> 0xc)) {
    local_44 = *(int **)(puVar7 + 4);
  }
  piVar1 = *(int **)(this + 0x238);
  if (piVar1 == (int *)0x0) {
    uVar5 = 0;
    if (((uVar8 != 0xffffffff) &&
        (puVar7 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar7 + 8) == uVar8 >> 0xc)) {
      uVar5 = *(undefined4 *)(puVar7 + 4);
    }
    (**(code **)(*(int *)this + 0x470))(this,uVar5,0,0);
  }
  else {
    lVar9 = (longdouble)(**(code **)(*piVar1 + 0x7c))(piVar1,pCVar10,pCVar11);
    uVar5 = 0;
    local_20 = (float)lVar9;
    local_28 = local_34 * local_20;
    local_24 = local_30 * local_20;
    local_20 = local_20 * local_2c;
    uVar8 = *(uint *)(this + 0x19d4);
    if (((uVar8 != 0xffffffff) &&
        (puVar7 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar7 + 8) == uVar8 >> 0xc)) {
      uVar5 = *(undefined4 *)(puVar7 + 4);
    }
    (**(code **)(*(int *)this + 0x470))(this,uVar5,0,&local_28);
  }
  if (((byte)this[0x148] & 8) != 0) {
    if ((((byte)this[0x14d] & 8) != 0) &&
       (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this), ((byte)this[0x14d] & 8) != 0)) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    CBaseEntity::Create("item_healthvial",(Vector *)(this + 0x2e0),(QAngle *)(this + 0x37c),
                        (CBaseEntity *)0x0);
  }
  CBaseEntity::EmitSound
            ((CBaseEntity *)this,"BaseCombatCharacter.StopWeaponSounds",0.0,(float *)0x0);
  uVar8 = *(uint *)(param_1 + 0x34);
  if ((((uVar8 != 0xffffffff) &&
       (puVar7 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar7 + 8) == uVar8 >> 0xc)) &&
     (piVar1 = *(int **)(puVar7 + 4), piVar1 != (int *)0x0)) {
    (**(code **)(*piVar1 + 0x134))(piVar1,this,param_1);
    uVar8 = *(uint *)(param_1 + 0x34);
    pCVar6 = (CBaseEntity *)0x0;
    if (((uVar8 != 0xffffffff) &&
        (puVar7 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar7 + 8) == uVar8 >> 0xc)) {
      pCVar6 = *(CBaseEntity **)(puVar7 + 4);
    }
    CEventQueue::AddEvent
              ((CEventQueue *)g_EventQueue,pCVar6,"KilledNPC",0.3,(CBaseEntity *)this,
               (CBaseEntity *)this,0);
  }
  CBaseEntity::SendOnKilledGameEvent((CBaseEntity *)this,param_1);
  cVar2 = (**(code **)(*(int *)this + 0x4cc))(this,param_1);
  if (cVar2 == '\0') {
    uVar8 = *(uint *)(param_1 + 0x48);
    if ((uVar8 & 0x4000000) != 0) {
      cVar2 = (**(code **)(*(int *)this + 0x350))(this);
      if (cVar2 != '\0') {
        uVar8 = *(uint *)(param_1 + 0x48) >> 8 & 1;
        uVar5 = DAT_01053d50;
        cVar2 = (**(code **)(*(int *)this + 0x39c))
                          (this,0,*(undefined4 *)(gpGlobals + 0xc),0,uVar8,vec3_origin,DAT_01053d4c,
                           DAT_01053d50,0,DAT_01053d50);
        if (local_44 != (int *)0x0) {
          (**(code **)(*local_44 + 0x39c))
                    (local_44,0,*(undefined4 *)(gpGlobals + 0xc),0,uVar8,vec3_origin,DAT_01053d4c,
                     uVar5,0);
        }
        if (cVar2 != '\0') goto LAB_005f3e60;
      }
      uVar8 = *(uint *)(param_1 + 0x48);
    }
    if ((uVar8 & 0x400000) == 0) {
      (**(code **)(*(int *)this + 0x4dc))(this,param_1,&local_34);
    }
  }
LAB_005f3e60:
  (**(code **)(*(int *)this + 0x534))(this);
  uVar8 = *(uint *)(this + 0x220);
  if (((uVar8 != 0xffffffff) &&
      (puVar7 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar7 + 8) == uVar8 >> 0xc &&
      (piVar1 = *(int **)(puVar7 + 4), piVar1 != (int *)0x0)))) {
    (**(code **)(*piVar1 + 0x104))(piVar1,this);
  }
  puVar4 = (undefined4 *)TheNextBots();
  (**(code **)*puVar4)(puVar4,this,param_1);
  return;
}

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)