L L4D2node

CTerrorPlayer::PlayerUse

0x009dd370 · 1609 bytes · __thiscall

_ZN13CTerrorPlayer9PlayerUseEP11CBaseEntity

Decompiled

undefined (2 params)

/* CTerrorPlayer::PlayerUse(CBaseEntity*) */

void __thiscall CTerrorPlayer::PlayerUse(CTerrorPlayer *this,CBaseEntity *param_1)

{
  undefined4 uVar1;
  uint uVar2;
  code *pcVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  char cVar7;
  int iVar8;
  int *piVar9;
  int *piVar10;
  float *pfVar11;
  undefined *puVar12;
  uint uVar13;
  undefined4 auStackY_128 [2];
  float *local_f0;
  undefined **local_e8;
  float local_e4;
  float local_e0;
  float local_dc;
  float local_d8;
  float local_d4;
  float local_d0;
  float local_cc;
  float local_c8;
  float 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;
  float local_70;
  float local_6c;
  float local_68;
  undefined1 local_64 [64];
  int local_24;
  
  uVar13 = *(uint *)(this + 0x1cb4) >> 5;
  cVar7 = (**(code **)(*(int *)this + 300))();
  if (cVar7 != '\0') {
    iVar8 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    cVar7 = IsASurvivorTeam(iVar8);
    if (cVar7 != '\0') {
      uVar2 = *(uint *)(this + 0x1cb4);
      iVar8 = CBaseEntity::GetGroundEntity((CBaseEntity *)this);
      if ((((((iVar8 == 0) || ((uVar13 & 1) != 0)) || ((uVar2 & 0x823) != 0)) &&
           ((uVar2 = *(uint *)(this + 0x33ac), uVar2 != 0xffffffff &&
            (puVar12 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)))
           ) && (*(uint *)(puVar12 + 8) == uVar2 >> 0xc)) && (*(int *)(puVar12 + 4) != 0)) {
        SetPushEntity(this,(CBaseEntity *)0x0);
        return;
      }
      piVar10 = (int *)&stack0xfffffee4;
      if (((*(int *)(ZombiePush._28_4_ + 0x30) != 0) &&
          (piVar10 = (int *)&stack0xfffffee4, (uVar13 & 1) != 0)) &&
         ((piVar10 = (int *)&stack0xfffffee4, *(int *)(sv_turbophysics._28_4_ + 0x30) != 0 &&
          ((cVar7 = (**(code **)(*(int *)this + 0x840))(), piVar10 = (int *)&stack0xfffffee4,
           cVar7 != '\0' &&
           (cVar7 = (**(code **)(*(int *)this + 0x804))(), piVar10 = (int *)&stack0xfffffee4,
           cVar7 == '\0')))))) {
        CBasePlayer::EyeVectors((CBasePlayer *)this,(Vector *)&local_e4,(Vector *)0x0,(Vector *)0x0)
        ;
        uVar2 = *(uint *)(this + 0x33ac);
        piVar9 = (int *)&stack0xfffffee4;
        fVar4 = local_e4;
        fVar5 = local_e0;
        fVar6 = local_dc;
        if ((uVar2 != 0xffffffff) &&
           (((puVar12 = g_pEntityList + (uVar2 & 0xfff) * 0x10, piVar9 = (int *)&stack0xfffffee4,
             puVar12 != (undefined *)0xfffffffc &&
             (piVar9 = (int *)&stack0xfffffee4, *(uint *)(puVar12 + 8) == uVar2 >> 0xc)) &&
            (piVar9 = (int *)&stack0xfffffee4, *(int *)(puVar12 + 4) != 0)))) {
          (**(code **)(*(int *)this + 0x234))();
          uVar2 = *(uint *)(this + 0x33ac);
          piVar10 = (int *)0x0;
          piVar9 = (int *)&stack0xfffffee0;
          if (uVar2 != 0xffffffff) {
            puVar12 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
            if ((puVar12 == (undefined *)0xfffffffc) || (*(uint *)(puVar12 + 8) != uVar2 >> 0xc)) {
              piVar10 = (int *)0x0;
            }
            else {
              piVar10 = *(int **)(puVar12 + 4);
            }
          }
          pfVar11 = (float *)(**(code **)(*piVar10 + 0x288))();
          local_cc = *pfVar11 - local_70;
          local_c8 = pfVar11[1] - local_6c;
          local_c4 = pfVar11[2] - local_68;
          VectorNormalize((Vector *)&local_cc);
          fVar4 = local_cc;
          fVar5 = local_c8;
          fVar6 = local_c4;
          if (local_e0 * local_c8 + local_e4 * local_cc + local_dc * local_c4 < 0.0) {
            SetPushEntity(this,(CBaseEntity *)0x0);
            piVar9 = (int *)&stack0xfffffee0;
            fVar4 = local_e4;
            fVar5 = local_e0;
            fVar6 = local_dc;
          }
        }
        local_dc = fVar6;
        local_e0 = fVar5;
        local_e4 = fVar4;
        local_f0 = &local_cc;
        iVar8 = *(int *)this;
        *piVar9 = (int)&local_d8;
        piVar9[1] = (int)this;
        pcVar3 = *(code **)(iVar8 + 0x234);
        piVar9[-1] = 0x9dd6af;
        (*pcVar3)();
        local_e8 = &PTR_ShouldHitEntity_00d1b078;
        local_94 = 0;
        local_88 = 1;
        local_bc = local_e4 * 96.0;
        local_98 = 0;
        local_b8 = local_e0 * 96.0;
        local_9c = 0;
        local_b4 = local_dc * 96.0;
        local_8c = 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_d8;
        local_c8 = local_d4;
        local_c4 = local_d0;
        iVar8 = *enginetrace;
        piVar9[2] = (int)&local_e8;
        piVar9[-1] = (int)enginetrace;
        piVar9[3] = (int)&local_70;
        piVar9[1] = 0x200400b;
        *piVar9 = (int)local_f0;
        pcVar3 = *(code **)(iVar8 + 0x14);
        piVar9[-2] = 0x9dd7cc;
        (*pcVar3)();
        if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
          piVar9[5] = -0x40800000;
          piVar9[4] = 1;
          piVar9[3] = 0;
          piVar9[2] = 0;
          piVar9[1] = 0xff;
          *piVar9 = (int)local_64;
          piVar9[-1] = (int)&local_70;
          piVar9[-2] = 0x9dd80f;
          DebugDrawLine((Vector *)piVar9[-1],(Vector *)*piVar9,piVar9[1],piVar9[2],piVar9[3],
                        SUB41(piVar9[4],0),(float)piVar9[5]);
        }
        piVar10 = piVar9 + -1;
        if ((local_24 != 0) && (piVar10 = piVar9 + -1, *(int *)(local_24 + 0x238) != 0)) {
          uVar13 = *(uint *)(this + 0x33ac);
          if ((uVar13 == 0xffffffff) ||
             (((puVar12 = g_pEntityList + (uVar13 & 0xfff) * 0x10,
               puVar12 == (undefined *)0xfffffffc || (*(uint *)(puVar12 + 8) != uVar13 >> 0xc)) ||
              (local_24 != *(int *)(puVar12 + 4))))) {
            *piVar9 = local_24;
            piVar9[-1] = (int)this;
            piVar9[-2] = 0x9dd865;
            SetPushEntity((CTerrorPlayer *)piVar9[-1],(CBaseEntity *)*piVar9);
          }
          iVar8 = *(int *)this;
          piVar9[1] = 0x2c0;
          *piVar9 = 0x61;
          piVar9[-1] = (int)this;
          pcVar3 = *(code **)(iVar8 + 0x7fc);
          piVar9[-2] = 0x9dd880;
          (*pcVar3)();
          return;
        }
      }
      uVar2 = *(uint *)(this + 0x33ac);
      if (((uVar2 != 0xffffffff) &&
          (puVar12 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
         ((*(uint *)(puVar12 + 8) == uVar2 >> 0xc && (*(int *)(puVar12 + 4) != 0)))) {
        return;
      }
      if (((uVar13 & 1) != 0) && (param_1 == (CBaseEntity *)0x0)) {
        *piVar10 = (int)this;
        piVar10[-1] = 0x9dd4b1;
        piVar9 = (int *)GetActiveTerrorWeapon((CTerrorPlayer *)*piVar10);
        if (piVar9 != (int *)0x0) {
          iVar8 = *piVar9;
          *piVar10 = (int)piVar9;
          pcVar3 = *(code **)(iVar8 + 0x690);
          piVar10[-1] = 0x9dd4c2;
          cVar7 = (*pcVar3)();
          if (cVar7 != '\0') {
            iVar8 = *piVar9;
            *piVar10 = (int)piVar9;
            pcVar3 = *(code **)(iVar8 + 0x698);
            piVar10[-1] = 0x9dd4d1;
            cVar7 = (*pcVar3)();
            if (cVar7 != '\0') {
              return;
            }
          }
        }
        iVar8 = *(int *)this;
        piVar10[5] = 0;
        piVar10[4] = 0;
        piVar10[3] = 0;
        piVar10[2] = 0;
        uVar1 = *(undefined4 *)(player_use_radius._28_4_ + 0x2c);
        *piVar10 = (int)this;
        piVar10[1] = uVar1;
        pcVar3 = *(code **)(iVar8 + 0x6e0);
        piVar10[-1] = 0x9dd515;
        param_1 = (CBaseEntity *)(*pcVar3)();
        if (param_1 == (CBaseEntity *)0x0) {
          *piVar10 = *(undefined4 *)(this + 0x3110);
          piVar10[-1] = 0x9dd52e;
          cVar7 = Vocalizer::OnUse((Vocalizer *)*piVar10);
          if (cVar7 != '\0') {
            return;
          }
          piVar10[1] = 0;
          *piVar10 = (int)this;
          piVar10[-1] = 0x9dd546;
          SetPushEntity((CTerrorPlayer *)*piVar10,(CBaseEntity *)piVar10[1]);
          piVar10[1] = 0;
          *piVar10 = (int)this;
          piVar10[-1] = 0x9dd556;
          CBasePlayer::PlayerUse((CBasePlayer *)*piVar10,(CBaseEntity *)piVar10[1]);
          *piVar10 = (int)this;
          piVar10[-1] = 0x9dd55e;
          piVar9 = (int *)GetActiveTerrorWeapon((CTerrorPlayer *)*piVar10);
          if (piVar9 == (int *)0x0) {
            return;
          }
          iVar8 = *piVar9;
          *piVar10 = (int)piVar9;
          pcVar3 = *(code **)(iVar8 + 0x690);
          piVar10[-1] = 0x9dd573;
          cVar7 = (*pcVar3)();
          if (cVar7 == '\0') {
            return;
          }
          piVar10[1] = (int)piVar9;
          *piVar10 = (int)this;
          piVar10[-1] = 0x9dd587;
          CBaseCombatCharacter::SwitchToNextBestWeapon
                    ((CBaseCombatCharacter *)*piVar10,(CBaseCombatWeapon *)piVar10[1]);
          return;
        }
      }
      goto LAB_009dd3ab;
    }
  }
  iVar8 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  piVar10 = (int *)&stack0xfffffee4;
  if ((iVar8 == 3) && (piVar10 = (int *)&stack0xfffffee4, (uVar13 & 1) != 0)) {
    (**(code **)(*(int *)this + 0x914))();
    piVar10 = (int *)&stack0xfffffee4;
  }
LAB_009dd3ab:
  piVar10[1] = 0;
  *piVar10 = (int)this;
  piVar10[-1] = 0x9dd3bb;
  SetPushEntity((CTerrorPlayer *)*piVar10,(CBaseEntity *)piVar10[1]);
  *piVar10 = (int)this;
  piVar10[1] = (int)param_1;
  piVar10[-1] = 0x9dd3ca;
  CBasePlayer::PlayerUse((CBasePlayer *)*piVar10,(CBaseEntity *)piVar10[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)