L L4D2node

CItemDefibrillator::GetTargetEntity

0x005416e0 · 367 bytes · __cdecl

_ZN18CItemDefibrillator15GetTargetEntityEP13CTerrorPlayerN17CBaseBackpackItem22BackpackItemActionTypeE

Decompiled

undefined (2 params)

/* CItemDefibrillator::GetTargetEntity(CTerrorPlayer*, CBaseBackpackItem::BackpackItemActionType) */

CBaseEntity * CItemDefibrillator::GetTargetEntity(undefined4 param_1,CBaseEntity *param_2)

{
  code *pcVar1;
  char cVar2;
  CBaseEntity *pCVar3;
  int iVar4;
  float fVar5;
  CBaseEntity *local_28;
  float local_20;
  
  fVar5 = *(float *)(player_use_radius._28_4_ + 0x2c);
  local_20 = fVar5 * fVar5;
  if (0 < DAT_01016aac) {
    iVar4 = 0;
    local_28 = (CBaseEntity *)0x0;
    do {
      pCVar3 = *(CBaseEntity **)(g_DeadSurvivors + iVar4 * 4);
      if (pCVar3 != (CBaseEntity *)0x0) {
        pcVar1 = *(code **)(*(int *)param_2 + 0x3cc);
        if (((byte)pCVar3[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(pCVar3);
        }
        cVar2 = (*pcVar1)(param_2,pCVar3 + 0x2e0);
        if (cVar2 != '\0') {
          if (((byte)param_2[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(param_2);
          }
          if (((byte)pCVar3[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(pCVar3);
          }
          fVar5 = (*(float *)(pCVar3 + 0x2e4) - *(float *)(param_2 + 0x2e4)) *
                  (*(float *)(pCVar3 + 0x2e4) - *(float *)(param_2 + 0x2e4)) +
                  (*(float *)(pCVar3 + 0x2e0) - *(float *)(param_2 + 0x2e0)) *
                  (*(float *)(pCVar3 + 0x2e0) - *(float *)(param_2 + 0x2e0)) +
                  (*(float *)(pCVar3 + 0x2e8) - *(float *)(param_2 + 0x2e8)) *
                  (*(float *)(pCVar3 + 0x2e8) - *(float *)(param_2 + 0x2e8));
          if (fVar5 < local_20) {
            local_28 = pCVar3;
            local_20 = fVar5;
          }
        }
      }
      iVar4 = iVar4 + 1;
    } while (iVar4 < DAT_01016aac);
    if (local_28 != (CBaseEntity *)0x0) {
      return local_28;
    }
    fVar5 = *(float *)(player_use_radius._28_4_ + 0x2c);
  }
  pCVar3 = (CBaseEntity *)(**(code **)(*(int *)param_2 + 0x6e0))(param_2,fVar5,0,0,0,0);
  return pCVar3;
}

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)