L L4D2node

CTerrorPlayer::GetFriendlyFireScale

0x009a2e90 · 1304 bytes · __thiscall

_ZNK13CTerrorPlayer20GetFriendlyFireScaleERK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* CTerrorPlayer::GetFriendlyFireScale(CTakeDamageInfo const&) const */

longdouble __thiscall
CTerrorPlayer::GetFriendlyFireScale(CTerrorPlayer *this,CTakeDamageInfo *param_1)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  float *pfVar4;
  CTerrorPlayer *pCVar5;
  undefined *puVar6;
  undefined1 *puVar7;
  CBaseEntity *this_00;
  float fVar8;
  float fVar9;
  float fVar10;
  int local_60;
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  this_00 = (CBaseEntity *)0x0;
  uVar1 = *(uint *)(param_1 + 0x34);
  if (((uVar1 != 0xffffffff) &&
      (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
    this_00 = *(CBaseEntity **)(puVar6 + 4);
  }
  if (((*(uint *)(param_1 + 0x48) & 8) == 0) || ((*(uint *)(param_1 + 0x48) & 2) != 0)) {
    if (this_00 != (CBaseEntity *)0x0) {
      iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      cVar2 = IsASurvivorTeam(iVar3);
      if (cVar2 != '\0') {
        iVar3 = CBaseEntity::GetTeamNumber(this_00);
        cVar2 = IsASurvivorTeam(iVar3);
        if (((cVar2 != '\0') || (iVar3 = CBaseEntity::GetTeamNumber(this_00), iVar3 == 1)) &&
           ((this_00 != (CBaseEntity *)this ||
            ((((byte)param_1[0x4a] & 0x80) != 0 || (*(int *)(param_1 + 0x4c) == 1)))))) {
          cVar2 = (**(code **)(*(int *)this_00 + 0x170))();
          if ((cVar2 == '\0') && (fVar8 = 0.0, *(int *)(SurvivorBotFriendlyFire._28_4_ + 0x30) == 0)
             ) goto LAB_009a2f33;
          puVar7 = &stack0xffffff84;
          if (*(int *)(FriendlyFireForgiveness._28_4_ + 0x30) != 0) {
            uVar1 = *(uint *)(param_1 + 0x34);
            local_60 = 0;
            if (((uVar1 != 0xffffffff) &&
                (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)
                ) && (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
              local_60 = *(int *)(puVar6 + 4);
            }
            uVar1 = *(uint *)(param_1 + 0x30);
            iVar3 = 0;
            if (((uVar1 != 0xffffffff) &&
                (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)
                ) && (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
              iVar3 = *(int *)(puVar6 + 4);
            }
            puVar7 = &stack0xffffff84;
            if (local_60 == iVar3) {
              CBasePlayer::EyeVectors
                        ((CBasePlayer *)this_00,(Vector *)&local_58,(Vector *)0x0,(Vector *)0x0);
              (**(code **)(*(int *)this_00 + 0x234))();
              puVar7 = &stack0xffffff80;
              pfVar4 = (float *)(**(code **)(*(int *)this + 0x288))();
              local_40 = *pfVar4;
              local_28 = local_58 + local_4c;
              local_3c = pfVar4[1];
              local_24 = local_54 + local_48;
              local_38 = pfVar4[2];
              local_20 = local_50 + local_44;
              CalcClosestPointOnLine
                        ((Vector *)&local_40,(Vector *)&local_4c,(Vector *)&local_28,
                         (Vector *)&local_34,(float *)0x0);
              if (((byte)this[0x14d] & 8) != 0) {
                CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
              }
              fVar8 = *(float *)(this + 0x2e8);
              iVar3 = (**(code **)(*(int *)(this + 0x194) + 8))();
              fVar9 = *(float *)(iVar3 + 8);
              if (((byte)this[0x14d] & 8) != 0) {
                CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
              }
              fVar10 = *(float *)(this + 0x2e8);
              iVar3 = (**(code **)(*(int *)(this + 0x194) + 4))();
              if ((local_2c <= fVar8 + fVar9) && (*(float *)(iVar3 + 8) + fVar10 <= local_2c)) {
                fVar10 = local_40 - local_34;
                fVar9 = local_3c - local_30;
                pfVar4 = (float *)(**(code **)(*(int *)(this + 0x194) + 8))();
                fVar8 = *pfVar4;
                pfVar4 = (float *)(**(code **)(*(int *)(this + 0x194) + 4))();
                fVar8 = (fVar8 - *pfVar4) * 0.5;
                if (fVar10 * fVar10 + fVar9 * fVar9 <= fVar8 * fVar8) goto LAB_009a3004;
              }
              fVar8 = 0.0;
              goto LAB_009a2f33;
            }
          }
LAB_009a3004:
          *(undefined4 *)(puVar7 + -4) = 0x9a3009;
          iVar3 = GetDifficulty();
          uVar1 = *(uint *)(param_1 + 0x48);
          if ((iVar3 == 3) || (((uVar1 & 0x40) != 0 && ((uVar1 & 0x800000) == 0)))) {
            fVar8 = 1.0;
          }
          else {
            fVar8 = 0.35;
          }
          if ((uVar1 & 0x200000) == 0) {
            *(undefined4 *)(puVar7 + -4) = 0x9a317a;
            iVar3 = GetDifficulty();
            if (iVar3 == 1) {
LAB_009a3055:
              fVar8 = fVar8 * *(float *)(survivor_friendly_fire_factor_normal._28_4_ + 0x2c);
            }
            else if (iVar3 < 2) {
              if (iVar3 == 0) goto LAB_009a311e;
            }
            else if (iVar3 == 2) {
              fVar8 = fVar8 * *(float *)(survivor_friendly_fire_factor_hard._28_4_ + 0x2c);
            }
            else if (iVar3 == 3) {
              fVar8 = fVar8 * *(float *)(survivor_friendly_fire_factor_expert._28_4_ + 0x2c);
            }
          }
          else {
            *(undefined4 *)(puVar7 + -4) = 0x9a3041;
            iVar3 = GetDifficulty();
            if (iVar3 == 0) {
LAB_009a311e:
              fVar8 = fVar8 * *(float *)(survivor_friendly_fire_factor_easy._28_4_ + 0x2c);
            }
            else if ((-1 < iVar3) && (iVar3 < 4)) goto LAB_009a3055;
          }
          if (*(int *)(param_1 + 0x4c) == 1) {
            uVar1 = *(uint *)(param_1 + 0x34);
            pCVar5 = (CTerrorPlayer *)0x0;
            if (((uVar1 != 0xffffffff) &&
                (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)
                ) && (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
              pCVar5 = *(CTerrorPlayer **)(puVar6 + 4);
            }
            if (this == pCVar5) {
              *(undefined4 *)(puVar7 + -4) = 0x9a33ae;
              cVar2 = CTerrorGameRules::HasPlayerControlledZombies();
              if (cVar2 == '\0') {
                fVar8 = fVar8 * *(float *)(grenadelauncher_ff_scale_self._28_4_ + 0x2c);
              }
              else {
                fVar8 = fVar8 * 0.65;
              }
            }
            else {
              fVar8 = fVar8 * *(float *)(grenadelauncher_ff_scale._28_4_ + 0x2c);
            }
          }
          if (((byte)param_1[0x4b] & 4) != 0) {
            fVar8 = fVar8 * 0.1;
          }
          goto LAB_009a2f33;
        }
      }
    }
  }
  else {
    iVar3 = GetDifficulty();
    if (iVar3 == 1) {
      fVar8 = *(float *)(SurvivorBurnFactorNormal._28_4_ + 0x2c);
      goto LAB_009a2f33;
    }
    if (iVar3 < 2) {
      if (iVar3 == 0) {
        fVar8 = *(float *)(SurvivorBurnFactorEasy._28_4_ + 0x2c);
        goto LAB_009a2f33;
      }
    }
    else {
      if (iVar3 == 2) {
        fVar8 = *(float *)(SurvivorBurnFactorHard._28_4_ + 0x2c);
        goto LAB_009a2f33;
      }
      if (iVar3 == 3) {
        fVar8 = *(float *)(SurvivorBurnFactorExpert._28_4_ + 0x2c);
        goto LAB_009a2f33;
      }
    }
  }
  fVar8 = 1.0;
LAB_009a2f33:
  return (longdouble)fVar8;
}

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)