L L4D2node

CTerrorWeapon::DetermineHelpTarget

0x0053d140 · 1650 bytes · __thiscall

_ZN13CTerrorWeapon19DetermineHelpTargetEv

Decompiled

undefined (1 param)

/* CTerrorWeapon::DetermineHelpTarget() */

CBaseEntity * __thiscall CTerrorWeapon::DetermineHelpTarget(CTerrorWeapon *this)

{
  char cVar1;
  undefined1 uVar2;
  CBaseEntity *pCVar3;
  int iVar4;
  CBaseEntity *pCVar5;
  CBaseEntity *pCVar6;
  int iVar7;
  int iVar8;
  undefined4 *puVar9;
  uint uVar10;
  undefined *puVar11;
  undefined4 local_108;
  undefined4 local_104;
  undefined4 local_100;
  float local_fc;
  float local_f8;
  float local_f4;
  undefined **local_f0 [4];
  undefined4 local_e0 [3];
  undefined4 local_d4;
  undefined4 local_d0;
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  Vector local_64 [32];
  float local_44;
  char local_39;
  CBaseEntity *local_24;
  
  pCVar3 = (CBaseEntity *)GetPlayerOwner(this);
  iVar4 = CBaseEntity::GetTeamNumber(pCVar3);
  cVar1 = IsASurvivorTeam(iVar4);
  if (((cVar1 != '\0') && (cVar1 = (**(code **)(*(int *)pCVar3 + 0x7e8))(pCVar3), cVar1 == '\0')) &&
     ((uVar10 = *(uint *)(pCVar3 + 0x2e28), uVar10 == 0xffffffff ||
      (((puVar11 = g_pEntityList + (uVar10 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc ||
        (*(uint *)(puVar11 + 8) != uVar10 >> 0xc)) || (*(int *)(puVar11 + 4) == 0)))))) {
    g_DebugFindUseEntity = 1;
    pCVar5 = (CBaseEntity *)
             (**(code **)(*(int *)pCVar3 + 0x6e0))
                       (pCVar3,*(undefined4 *)(player_use_radius._28_4_ + 0x2c),0,0,0,0);
    g_DebugFindUseEntity = 0;
    if (pCVar5 != (CBaseEntity *)0x0) {
      cVar1 = (**(code **)(*(int *)pCVar5 + 0x16c))(pCVar5);
      if (cVar1 == '\0') {
        pCVar6 = (CBaseEntity *)(**(code **)(*(int *)pCVar5 + 0x188))(pCVar5);
        if (pCVar6 == (CBaseEntity *)0x0) {
          pCVar6 = (CBaseEntity *)
                   __dynamic_cast(pCVar5,&CBaseEntity::typeinfo,&CWeaponSpawn::typeinfo,0);
          if (pCVar6 == (CBaseEntity *)0x0) {
            pCVar3 = (CBaseEntity *)
                     __dynamic_cast(pCVar5,&CBaseEntity::typeinfo,&CPropHealthCabinet::typeinfo,0);
            if ((pCVar3 != (CBaseEntity *)0x0) &&
               (uVar10 = (**(code **)(*(int *)pCVar3 + 0xa4))(pCVar3), (uVar10 & 0x10) != 0)) {
              return pCVar3;
            }
            iVar4 = (**(code **)(*(int *)pCVar5 + 0xac))(pCVar5);
            if ((iVar4 != 0) &&
               (pCVar3 = (CBaseEntity *)(**(code **)(*(int *)pCVar5 + 0xac))(pCVar5),
               pCVar5 != pCVar3)) {
              return pCVar5;
            }
            uVar10 = (**(code **)(*(int *)pCVar5 + 0xa4))(pCVar5);
            if ((uVar10 & 0x800) == 0) {
              return (CBaseEntity *)0x0;
            }
            return pCVar5;
          }
          iVar4 = (**(code **)(*(int *)pCVar6 + 0x3cc))(pCVar6);
          iVar7 = GetWeaponInfo(iVar4);
          if ((iVar7 == 0) || (iVar8 = GetAmmoDef(), iVar8 == 0)) {
            iVar7 = -1;
          }
          else {
            puVar9 = (undefined4 *)GetAmmoDef();
            iVar7 = (**(code **)*puVar9)(puVar9,*(undefined4 *)(iVar7 + 0x850),pCVar3);
          }
          if ((iVar4 == 0) &&
             (uVar10 = (**(code **)(*(int *)pCVar5 + 0xb0))(pCVar5,pCVar3),
             (uVar10 & 0xfffffffb) == 0)) {
            return (CBaseEntity *)0x0;
          }
          uVar2 = 0;
          iVar8 = -1;
        }
        else {
          uVar2 = (**(code **)(*(int *)pCVar6 + 0x670))(pCVar6);
          iVar7 = *(int *)(pCVar6 + 0x14fc);
          iVar8 = *(int *)(pCVar6 + 0x1420);
          iVar4 = (**(code **)(*(int *)pCVar6 + 0x638))(pCVar6);
        }
        iVar4 = GetUseTypeForWeapon(pCVar3,iVar4,iVar8,iVar7,0,uVar2);
        if (iVar4 - 2U < 2) {
          return pCVar6;
        }
      }
      else {
        cVar1 = (**(code **)(*(int *)pCVar5 + 0x16c))();
        pCVar6 = (CBaseEntity *)0x0;
        if (cVar1 != '\0') {
          pCVar6 = pCVar5;
        }
        if (pCVar6[0x39f1] != (CBaseEntity)0x0) {
          return pCVar6;
        }
        iVar4 = CBaseEntity::GetTeamNumber(pCVar6);
        cVar1 = IsASurvivorTeam(iVar4);
        if ((((cVar1 != '\0') &&
             ((((uVar10 = *(uint *)(pCVar6 + 0x3e68), uVar10 == 0xffffffff ||
                (puVar11 = g_pEntityList + (uVar10 & 0xfff) * 0x10,
                puVar11 == (undefined *)0xfffffffc)) || (*(uint *)(puVar11 + 8) != uVar10 >> 0xc))
              || (*(int *)(puVar11 + 4) == 0)))) &&
            ((((uVar10 = *(uint *)(pCVar6 + 0x3e48), uVar10 == 0xffffffff ||
               (puVar11 = g_pEntityList + (uVar10 & 0xfff) * 0x10,
               puVar11 == (undefined *)0xfffffffc)) || (*(uint *)(puVar11 + 8) != uVar10 >> 0xc)) ||
             (*(int *)(puVar11 + 4) == 0)))) &&
           ((((uVar10 = *(uint *)(pCVar6 + 0x33c4), uVar10 == 0xffffffff ||
              (puVar11 = g_pEntityList + (uVar10 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc
              )) || ((*(uint *)(puVar11 + 8) != uVar10 >> 0xc ||
                     ((*(int *)(puVar11 + 4) == 0 || (pCVar6[0x39f1] != (CBaseEntity)0x0)))))) &&
            ((cVar1 = (**(code **)(*(int *)pCVar6 + 0x7e8))(pCVar6), cVar1 != '\0' &&
             ((((uVar10 = *(uint *)(pCVar6 + 0x2e24), uVar10 == 0xffffffff ||
                (puVar11 = g_pEntityList + (uVar10 & 0xfff) * 0x10,
                puVar11 == (undefined *)0xfffffffc)) || (*(uint *)(puVar11 + 8) != uVar10 >> 0xc))
              || (*(int *)(puVar11 + 4) == 0)))))))) {
          CBasePlayer::EyePositionAndVectors
                    ((CBasePlayer *)pCVar3,(Vector *)&local_108,(Vector *)&local_fc,(Vector *)0x0,
                     (Vector *)0x0);
          CTraceFilterSimpleList::CTraceFilterSimpleList((CTraceFilterSimpleList *)local_f0,4);
          local_f0[0] = &PTR_ShouldHitEntity_00c2e780;
                    /* try { // try from 0053d37d to 0053d4cc has its CatchHandler @ 0053d7d8 */
          CTraceFilterSimpleList::AddEntityToIgnore
                    ((CTraceFilterSimpleList *)local_f0,(IHandleEntity *)pCVar3);
          local_88 = 1;
          local_94 = 0;
          local_bc = local_fc * 96.0;
          local_98 = 0;
          local_9c = 0;
          local_8c = 0;
          local_b8 = local_f8 * 96.0;
          local_b4 = local_f4 * 96.0;
          local_a4 = 0;
          local_a8 = 0;
          local_ac = 0;
          local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
          local_cc = local_108;
          local_c8 = local_104;
          local_c4 = local_100;
          (**(code **)(*enginetrace + 0x14))
                    (enginetrace,&local_cc,0x200608b,(CTraceFilterSimpleList *)local_f0,local_70);
          if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
            DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
          }
          if (((0.0 < local_44) && (local_39 == '\0')) && (local_24 == pCVar6)) {
            local_f0[0] = &PTR_ShouldHitEntity_00c54590;
            local_d4 = 0;
            CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
            local_d0 = local_e0[0];
            CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
            return local_24;
          }
          local_f0[0] = &PTR_ShouldHitEntity_00c54590;
          local_d4 = 0;
          CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
          local_d0 = local_e0[0];
          CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
        }
      }
    }
  }
  return (CBaseEntity *)0x0;
}

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)