L L4D2node

CTriggerHurt::HurtEntity

0x00b20850 · 1430 bytes · __thiscall

_ZN12CTriggerHurt10HurtEntityEP11CBaseEntityf

Decompiled

undefined (3 params)

/* WARNING: Removing unreachable block (ram,0x00b2092f) */
/* WARNING: Removing unreachable block (ram,0x00b208e2) */
/* WARNING: Removing unreachable block (ram,0x00b20e14) */
/* WARNING: Removing unreachable block (ram,0x00b20e0d) */
/* CTriggerHurt::HurtEntity(CBaseEntity*, float) */

char __thiscall CTriggerHurt::HurtEntity(CTriggerHurt *this,CBaseEntity *param_1,float param_2)

{
  CTriggerHurt *pCVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  char cVar5;
  int iVar6;
  float *pfVar7;
  matrix3x4_t *pmVar8;
  undefined4 *puVar9;
  int iVar10;
  uint uVar11;
  char local_ad;
  float local_a0;
  float local_9c;
  float local_98;
  float local_94;
  float local_90;
  float local_8c;
  float local_88;
  float local_84;
  float local_80;
  float local_7c;
  float local_78;
  float local_74;
  float local_70;
  float local_6c;
  float local_68;
  
  if ((param_1[0x105] == (CBaseEntity)0x0) ||
     (local_ad = (**(code **)(*(int *)this + 0x34c))(this,param_1), local_ad == '\0')) {
    local_ad = '\0';
  }
  else {
    if (param_2 < 0.0) {
      (**(code **)(*(int *)param_1 + 0x128))(param_1,-param_2,*(undefined4 *)(this + 0x580));
    }
    else {
      pCVar1 = this + 0x194;
      if ((AllocTempVector()::s_vecTemp == '\0') &&
         (iVar6 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar6 != 0)) {
        __cxa_guard_release(&AllocTempVector()::s_vecTemp);
      }
      if ((AllocTempVector()::s_nIndex == '\0') &&
         (iVar6 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar6 != 0)) {
        AllocTempVector()::s_nIndex = 0;
        __cxa_guard_release(&AllocTempVector()::s_nIndex);
      }
      uVar11 = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
      LOCK();
      UNLOCK();
      iVar6 = uVar11 * 0xc;
      AllocTempVector()::s_nIndex = uVar11;
      if ((AllocTempVector()::s_vecTemp == '\0') &&
         (iVar10 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar10 != 0)) {
        __cxa_guard_release(&AllocTempVector()::s_vecTemp);
      }
      if ((AllocTempVector()::s_nIndex == '\0') &&
         (iVar10 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar10 != 0)) {
        AllocTempVector()::s_nIndex = 0;
        __cxa_guard_release(&AllocTempVector()::s_nIndex);
      }
      AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
      LOCK();
      UNLOCK();
      iVar10 = AllocTempVector()::s_nIndex * 0xc;
      *(float *)(AllocTempVector()::s_vecTemp + iVar10) =
           (*(float *)(this + 0x1a8) - *(float *)(this + 0x19c)) * 0.5 + *(float *)(this + 0x19c);
      *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 4) =
           (*(float *)(this + 0x1ac) - *(float *)(this + 0x1a0)) * 0.5 + *(float *)(this + 0x1a0);
      *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 8) =
           (*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4)) * 0.5 + *(float *)(this + 0x1a4);
      if (((((byte)this[0x1b4] & 0x40) == 0) && (((byte)this[0x1b6] & 0xfd) != 0)) &&
         ((pfVar7 = (float *)(**(code **)(*(int *)(this + 0x194) + 0x24))(pCVar1),
          vec3_angle != *pfVar7 || ((DAT_01053d40 != pfVar7[1] || (DAT_01053d44 != pfVar7[2])))))) {
        pmVar8 = (matrix3x4_t *)(**(code **)(*(int *)(this + 0x194) + 0x28))(pCVar1);
        VectorTransform((float *)(AllocTempVector()::s_vecTemp + iVar10),pmVar8,
                        (float *)(AllocTempVector()::s_vecTemp + iVar6));
      }
      else {
        pfVar7 = (float *)(**(code **)(*(int *)(this + 0x194) + 0x20))(pCVar1);
        *(float *)(AllocTempVector()::s_vecTemp + iVar6) =
             *pfVar7 + *(float *)(AllocTempVector()::s_vecTemp + iVar10);
        *(float *)(AllocTempVector()::s_vecTemp + iVar6 + 4) =
             pfVar7[1] + *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 4);
        *(float *)(AllocTempVector()::s_vecTemp + iVar6 + 8) =
             pfVar7[2] + *(float *)(AllocTempVector()::s_vecTemp + iVar10 + 8);
      }
      iVar6 = uVar11 * 0xc;
      local_a0 = *(float *)(AllocTempVector()::s_vecTemp + iVar6);
      local_9c = *(float *)(AllocTempVector()::s_vecTemp + iVar6 + 4);
      local_98 = *(float *)(AllocTempVector()::s_vecTemp + iVar6 + 8);
      CCollisionProperty::CalcNearestPoint
                ((CCollisionProperty *)(param_1 + 0x194),(Vector *)&local_a0,(Vector *)&local_94);
      CTakeDamageInfo::CTakeDamageInfo
                ((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this,(CBaseEntity *)this,param_2,
                 *(int *)(this + 0x580),0);
      local_70 = local_94;
      local_6c = local_90;
      local_68 = local_8c;
      if (this[0x588] == (CTriggerHurt)0x0) {
        fVar2 = *(float *)(this + 0x58c);
        if (fVar2 == vec3_origin) {
          if (DAT_01053d4c == *(float *)(this + 0x590)) {
            fVar3 = DAT_01053d4c;
            fVar4 = *(float *)(this + 0x594);
            if (*(float *)(this + 0x594) == DAT_01053d50) {
              local_88 = local_94 - local_a0;
              local_84 = local_90 - local_9c;
              local_80 = local_8c - local_98;
              GuessDamageForce((CTakeDamageInfo *)&local_7c,(Vector *)&local_88,(Vector *)&local_94,
                               1.0);
              fVar2 = local_7c;
              fVar3 = local_78;
              fVar4 = local_74;
            }
          }
          else {
            fVar3 = *(float *)(this + 0x590);
            fVar4 = *(float *)(this + 0x594);
          }
        }
        else {
          fVar3 = *(float *)(this + 0x590);
          fVar4 = *(float *)(this + 0x594);
        }
      }
      else {
        local_7c = vec3_origin;
        local_78 = DAT_01053d4c;
        local_74 = DAT_01053d50;
        fVar2 = local_7c;
        fVar3 = local_78;
        fVar4 = local_74;
      }
      local_74 = fVar4;
      local_78 = fVar3;
      local_7c = fVar2;
      CBaseEntity::TakeDamage(param_1,(CTakeDamageInfo *)&local_7c);
    }
    cVar5 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
    if (cVar5 == '\0') {
      COutputEvent::FireOutput((COutputEvent *)(this + 0x5a0),param_1,(CBaseEntity *)this,0.0);
    }
    else {
      COutputEvent::FireOutput((COutputEvent *)(this + 0x5b8),param_1,(CBaseEntity *)this,0.0);
    }
    local_7c = -NAN;
    puVar9 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
    local_7c = (float)*puVar9;
    CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>>::InsertBefore
              ((CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>> *)
               (this + 0x5d0),*(int *)(this + 0x5dc),(CHandle *)&local_7c);
  }
  return local_ad;
}

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)