L L4D2node

WitchBody::OnInjured

0x00a4ac90 · 1742 bytes · __thiscall

_ZN9WitchBody9OnInjuredERK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* WitchBody::OnInjured(CTakeDamageInfo const&) */

void __thiscall WitchBody::OnInjured(WitchBody *this,CTakeDamageInfo *param_1)

{
  float fVar1;
  CBaseEntity *pCVar2;
  code *pcVar3;
  char cVar4;
  uint uVar5;
  int *piVar6;
  int iVar7;
  int *piVar8;
  undefined4 uVar9;
  undefined *puVar10;
  int *piVar11;
  longdouble lVar12;
  undefined4 local_20;
  
  pCVar2 = *(CBaseEntity **)(this + 0x14);
  if (pCVar2[0x104] != (CBaseEntity)0x0) {
    return;
  }
  if ((*(uint *)(param_1 + 0x48) & 8) == 0) {
    if ((*(uint *)(param_1 + 0x48) & 2) != 0) {
      CBaseEntity::EmitSound(pCVar2,"Zombie.BulletImpact",0.0,(float *)0x0);
      lVar12 = (longdouble)CountdownTimer::Now();
      if (*(float *)(this + 0x88) <= (float)lVar12) {
        fVar1 = *(float *)(ZombieVocalizeShotInterval._28_4_ + 0x2c);
        lVar12 = (longdouble)CountdownTimer::Now();
        if ((float)lVar12 + fVar1 != *(float *)(this + 0x88)) {
          (**(code **)(*(int *)(this + 0x80) + 4))(this + 0x80,this + 0x88);
          *(float *)(this + 0x88) = (float)lVar12 + fVar1;
        }
        if (fVar1 != *(float *)(this + 0x84)) {
          (**(code **)(*(int *)(this + 0x80) + 4))(this + 0x80,this + 0x84);
          *(float *)(this + 0x84) = fVar1;
        }
        CBaseEntity::EmitSound(*(CBaseEntity **)(this + 0x14),"WitchZombie.Pain",0.0,(float *)0x0);
      }
    }
LAB_00a4acc4:
    uVar5 = *(uint *)(param_1 + 0x34);
  }
  else {
    if (((byte)pCVar2[0x153] & 8) == 0) {
      local_20 = 0;
      uVar5 = *(uint *)(param_1 + 0x34);
      if (((uVar5 != 0xffffffff) &&
          (puVar10 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar10 + 8) == uVar5 >> 0xc)) {
        local_20 = *(undefined4 *)(puVar10 + 4);
      }
      (**(code **)(*(int *)pCVar2 + 0x564))(pCVar2,0x461c3c00,local_20);
      CBaseEntity::EmitSound(*(CBaseEntity **)(this + 0x14),"Zombie.IgniteScream",0.0,(float *)0x0);
      lVar12 = (longdouble)
               RandomFloat(*(undefined4 *)(ZombieVocalizeBurnMinInterval._28_4_ + 0x2c),
                           *(undefined4 *)(ZombieVocalizeBurnMaxInterval._28_4_ + 0x2c));
      fVar1 = (float)lVar12;
      lVar12 = (longdouble)CountdownTimer::Now();
      if ((float)lVar12 + fVar1 != *(float *)(this + 0x88)) {
        (**(code **)(*(int *)(this + 0x80) + 4))(this + 0x80,this + 0x88);
        *(float *)(this + 0x88) = (float)lVar12 + fVar1;
      }
      if (fVar1 != *(float *)(this + 0x84)) {
        (**(code **)(*(int *)(this + 0x80) + 4))(this + 0x80,this + 0x84);
        *(float *)(this + 0x84) = fVar1;
      }
    }
    lVar12 = (longdouble)CountdownTimer::Now();
    if (*(float *)(this + 0x88) <= (float)lVar12) {
      lVar12 = (longdouble)
               RandomFloat(*(undefined4 *)(ZombieVocalizeBurnMinInterval._28_4_ + 0x2c),
                           *(undefined4 *)(ZombieVocalizeBurnMaxInterval._28_4_ + 0x2c));
      fVar1 = (float)lVar12;
      lVar12 = (longdouble)CountdownTimer::Now();
      if ((float)lVar12 + fVar1 != *(float *)(this + 0x88)) {
        (**(code **)(*(int *)(this + 0x80) + 4))(this + 0x80,this + 0x88);
        *(float *)(this + 0x88) = (float)lVar12 + fVar1;
      }
      if (fVar1 != *(float *)(this + 0x84)) {
        (**(code **)(*(int *)(this + 0x80) + 4))(this + 0x80,this + 0x84);
        *(float *)(this + 0x84) = fVar1;
      }
      CBaseEntity::EmitSound(*(CBaseEntity **)(this + 0x14),"WitchZombie.PainFire",0.0,(float *)0x0)
      ;
    }
    uVar5 = *(uint *)(param_1 + 0x34);
    if (uVar5 == 0xffffffff) goto LAB_00a4acf2;
    puVar10 = g_pEntityList + (uVar5 & 0xfff) * 0x10;
    if (((puVar10 != (undefined *)0xfffffffc) && (*(uint *)(puVar10 + 8) == uVar5 >> 0xc)) &&
       (piVar6 = *(int **)(puVar10 + 4), piVar6 != (int *)0x0)) {
      cVar4 = (**(code **)(*piVar6 + 0x16c))(piVar6);
      if ((cVar4 == '\0') ||
         (piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                    (gameeventmanager,"zombie_ignited",0,0), piVar8 == (int *)0x0))
      goto LAB_00a4acc4;
      pcVar3 = *(code **)(*piVar8 + 0x30);
      uVar9 = (**(code **)(*engine + 0x40))(engine,piVar6[0xc]);
      (*pcVar3)(piVar8,"userid",uVar9);
      if (*(int *)(*(int *)(this + 0x14) + 0x30) == 0) {
        iVar7 = 0;
      }
      else {
        iVar7 = *(int *)(*(int *)(this + 0x14) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      (**(code **)(*piVar8 + 0x30))(piVar8,"entityid",iVar7);
      (**(code **)(*piVar8 + 0x3c))(piVar8,"victimname","Witch");
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,0);
      uVar5 = *(uint *)(param_1 + 0x34);
    }
  }
  if ((((uVar5 != 0xffffffff) &&
       (puVar10 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar10 + 8) == uVar5 >> 0xc)) &&
     ((pCVar2 = *(CBaseEntity **)(puVar10 + 4), pCVar2 != (CBaseEntity *)0x0 &&
      (cVar4 = (**(code **)(*(int *)pCVar2 + 0x16c))(pCVar2), cVar4 != '\0')))) {
    iVar7 = CBaseEntity::GetTeamNumber(pCVar2);
    cVar4 = IsASurvivorTeam(iVar7);
    if (cVar4 != '\0') {
      *(float *)(pCVar2 + 0x3abc) = *(float *)(pCVar2 + 0x3abc) + *(float *)(param_1 + 0x3c);
    }
  }
LAB_00a4acf2:
  piVar6 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"infected_hurt",0,0);
  if (piVar6 != (int *)0x0) {
    uVar5 = *(uint *)(param_1 + 0x34);
    if (((uVar5 == 0xffffffff) ||
        (puVar10 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar10 + 8) != uVar5 >> 0xc ||
        ((piVar8 = *(int **)(puVar10 + 4), piVar8 == (int *)0x0 ||
         (cVar4 = (**(code **)(*piVar8 + 0x16c))(piVar8), cVar4 == '\0')))))) {
      (**(code **)(*piVar6 + 0x30))(piVar6,"attacker",0);
    }
    else {
      cVar4 = (**(code **)(*piVar8 + 0x16c))(piVar8);
      piVar11 = (int *)0x0;
      if (cVar4 != '\0') {
        piVar11 = piVar8;
      }
      pcVar3 = *(code **)(*piVar6 + 0x30);
      uVar9 = (**(code **)(*engine + 0x40))(engine,piVar11[0xc]);
      (*pcVar3)(piVar6,"attacker",uVar9);
    }
    if (((byte)param_1[0x48] & 0x40) == 0) {
      (**(code **)(*piVar6 + 0x30))
                (piVar6,"hitgroup",*(undefined4 *)(*(int *)(this + 0x14) + 0x1838));
    }
    else {
      (**(code **)(*piVar6 + 0x30))(piVar6,"hitgroup",0);
    }
    if (*(int *)(*(int *)(this + 0x14) + 0x30) == 0) {
      iVar7 = 0;
    }
    else {
      iVar7 = *(int *)(*(int *)(this + 0x14) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    (**(code **)(*piVar6 + 0x30))(piVar6,"entityid",iVar7);
    (**(code **)(*piVar6 + 0x30))(piVar6,"amount",(int)*(float *)(param_1 + 0x3c));
    (**(code **)(*piVar6 + 0x30))(piVar6,"type",*(undefined4 *)(param_1 + 0x48));
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar6,0);
    return;
  }
  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)