L L4D2node

CTerrorPlayer::GetAdjustedDamage

0x009a33e0 · 1665 bytes · __thiscall

_ZN13CTerrorPlayer17GetAdjustedDamageERK15CTakeDamageInfoffb

Decompiled

undefined (5 params)

/* CTerrorPlayer::GetAdjustedDamage(CTakeDamageInfo const&, float, float, bool) */

longdouble __thiscall
CTerrorPlayer::GetAdjustedDamage
          (CTerrorPlayer *this,CTakeDamageInfo *param_1,float param_2,float param_3,bool param_4)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  CWeaponCSBase *this_00;
  int *piVar4;
  undefined4 uVar5;
  int iVar6;
  undefined *puVar7;
  undefined *puVar8;
  CBaseEntity *pCVar9;
  bool bVar10;
  longdouble lVar11;
  float fVar12;
  float fVar13;
  undefined4 local_7c;
  undefined4 local_78;
  undefined4 local_74;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  float local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  uVar1 = *(uint *)(param_1 + 0x34);
  if (((((uVar1 == 0xffffffff) ||
        (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) ||
      ((piVar4 = *(int **)(puVar7 + 4), piVar4 == (int *)0x0 ||
       (pCVar9 = (CBaseEntity *)(**(code **)(*piVar4 + 0x144))(piVar4), pCVar9 == (CBaseEntity *)0x0
       )))) || (cVar2 = (**(code **)(*(int *)pCVar9 + 0x16c))(pCVar9), cVar2 == '\0')) {
    pCVar9 = (CBaseEntity *)0x0;
  }
  puVar7 = g_pEntityList;
  uVar1 = *(uint *)(param_1 + 0x30);
  if (((uVar1 == 0xffffffff) ||
      (puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
     ((*(uint *)(puVar8 + 8) != uVar1 >> 0xc ||
      (((*(int *)(puVar8 + 4) == 0 ||
        (this_00 = (CWeaponCSBase *)
                   __dynamic_cast(*(int *)(puVar8 + 4),&CBaseEntity::typeinfo,
                                  &CWeaponCSBase::typeinfo,0), this_00 == (CWeaponCSBase *)0x0)) ||
       (pCVar9 == (CBaseEntity *)0x0)))))) {
    bVar10 = false;
    if (pCVar9 != (CBaseEntity *)0x0) goto LAB_009a36bb;
LAB_009a345f:
    iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if (iVar3 != 3) goto LAB_009a3470;
LAB_009a36f0:
    iVar3 = (**(code **)(*(int *)this + 0x544))(this);
    if ((iVar3 != 8) || (pCVar9 == (CBaseEntity *)0x0)) goto LAB_009a3470;
    piVar4 = (int *)CCSPlayer::GetActiveCSWeapon((CCSPlayer *)pCVar9);
    if (piVar4 != (int *)0x0) {
      uVar5 = (**(code **)(*piVar4 + 0x638))(piVar4);
      iVar3 = GetWeaponInfo(uVar5);
      if ((((iVar3 != 0) && (*(int *)(iVar3 + 0x894) == 3)) && (*(int *)(iVar3 + 0xbe8) == 2)) &&
         (((byte)param_1[0x4b] & 0x20) != 0)) {
        param_3 = param_2 * *(float *)(z_tank_autoshotgun_dmg_scale._28_4_ + 0x2c);
        goto LAB_009a3470;
      }
    }
    iVar3 = (**(code **)(*(int *)this + 0x148))(this);
  }
  else {
    uVar1 = *(uint *)(pCVar9 + 0x1d14);
    if (((uVar1 == 0xffffffff) ||
        (puVar7 = puVar7 + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar7 + 8) != uVar1 >> 0xc || (*(int *)(puVar7 + 4) == 0)))) {
      iVar3 = CWeaponCSBase::GetCSWpnData(this_00);
      bVar10 = true;
      if (*(int *)(iVar3 + 0x894) != 4) {
        iVar3 = CWeaponCSBase::GetCSWpnData(this_00);
        bVar10 = *(int *)(iVar3 + 0x894) == 2;
      }
    }
    else {
      bVar10 = false;
    }
LAB_009a36bb:
    iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    iVar6 = CBaseEntity::GetTeamNumber(pCVar9);
    if (iVar3 != iVar6) goto LAB_009a345f;
    param_3 = param_2;
    iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if (iVar3 == 3) goto LAB_009a36f0;
LAB_009a3470:
    iVar3 = (**(code **)(*(int *)this + 0x148))(this);
    param_2 = param_3;
  }
  param_3 = param_2;
  if (((((iVar3 == 0) && (bVar10)) && (param_4)) &&
      (((iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar3 == 3 &&
        (iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 == 3)) ||
       ((iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar3 == 3 &&
        (iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 == 1)))))) &&
     (param_3 = (float)*(int *)(this + 0x100), (float)*(int *)(this + 0x100) <= param_2)) {
    param_3 = param_2;
  }
  uVar1 = *(uint *)(this + 0x3ee0);
  if (((((uVar1 == 0xffffffff) ||
        (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) ||
      ((*(int *)(puVar7 + 4) == 0 || (uVar1 = *(uint *)(param_1 + 0x34), uVar1 == 0xffffffff)))) ||
     ((puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc ||
      ((*(uint *)(puVar7 + 8) != uVar1 >> 0xc ||
       (*(CBaseEntity **)(puVar7 + 4) == (CBaseEntity *)0x0)))))) {
LAB_009a34b4:
    iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if ((((iVar3 == 3) && (iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 == 5)) &&
        (uVar1 = *(uint *)(this + 0x3edc), uVar1 != 0xffffffff)) &&
       (((puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc &&
         (*(uint *)(puVar7 + 8) == uVar1 >> 0xc)) &&
        ((*(int *)(puVar7 + 4) != 0 && (pCVar9 != (CBaseEntity *)0x0)))))) {
      iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      iVar6 = CBaseEntity::GetTeamNumber(pCVar9);
      if ((iVar3 == iVar6) && (((byte)param_1[0x48] & 0x84) != 0)) goto LAB_009a387a;
    }
    uVar1 = *(uint *)(this + 0x3e48);
    if ((uVar1 == 0xffffffff) ||
       (((puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc ||
         (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) ||
        (pCVar9 = *(CBaseEntity **)(puVar7 + 4), pCVar9 == (CBaseEntity *)0x0)))) {
      local_7c = *(undefined4 *)param_1;
      local_78 = *(undefined4 *)(param_1 + 4);
      local_74 = *(undefined4 *)(param_1 + 8);
      local_70 = *(undefined4 *)(param_1 + 0xc);
      local_6c = *(undefined4 *)(param_1 + 0x10);
      local_68 = *(undefined4 *)(param_1 + 0x14);
      local_64 = *(undefined4 *)(param_1 + 0x18);
      local_60 = *(undefined4 *)(param_1 + 0x1c);
      local_5c = *(undefined4 *)(param_1 + 0x20);
      local_58 = *(undefined4 *)(param_1 + 0x24);
      local_54 = *(undefined4 *)(param_1 + 0x28);
      local_50 = *(undefined4 *)(param_1 + 0x2c);
      local_40 = param_3;
      local_4c = *(undefined4 *)(param_1 + 0x30);
      local_48 = *(undefined4 *)(param_1 + 0x34);
      local_44 = *(undefined4 *)(param_1 + 0x38);
      local_3c = *(undefined4 *)(param_1 + 0x40);
      local_38 = *(undefined4 *)(param_1 + 0x44);
      local_34 = *(undefined4 *)(param_1 + 0x48);
      local_30 = *(undefined4 *)(param_1 + 0x4c);
      local_2c = *(undefined4 *)(param_1 + 0x50);
      local_28 = *(undefined4 *)(param_1 + 0x54);
      local_24 = *(undefined4 *)(param_1 + 0x58);
      local_20 = *(undefined4 *)(param_1 + 0x5c);
      lVar11 = (longdouble)GetFriendlyFireScale(this,(CTakeDamageInfo *)&local_7c);
      fVar12 = (float)lVar11 * param_3;
      if (((*(int *)(param_1 + 0x4c) == 1) &&
          (iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar3 == 3)) &&
         (iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 == 8)) {
        fVar12 = fVar12 * *(float *)(z_tank_grenade_launcher_dmg_scale._28_4_ + 0x2c);
      }
      fVar13 = 1.0;
      if (1.0 <= fVar12) {
        fVar13 = fVar12;
      }
      fVar12 = (float)(~-(uint)(0.0 < fVar12) & (uint)fVar12 | (uint)fVar13 & -(uint)(0.0 < fVar12))
      ;
      goto LAB_009a387d;
    }
    uVar1 = *(uint *)(param_1 + 0x34);
    if ((((uVar1 == 0xffffffff) ||
         (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
        ((*(uint *)(puVar7 + 8) != uVar1 >> 0xc || (*(CBaseEntity **)(puVar7 + 4) != pCVar9)))) &&
       (((byte)param_1[0x48] & 8) == 0)) {
      CBaseEntity::TakeDamage(pCVar9,param_1);
      fVar12 = 0.0;
      goto LAB_009a387d;
    }
  }
  else {
    iVar3 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar7 + 4));
    cVar2 = IsASurvivorTeam(iVar3);
    if (cVar2 == '\0') goto LAB_009a34b4;
    if ((*(int *)(this + 0x1838) - 1U < 2) ||
       ((*(int *)(this + 0x1838) == 0 && (((byte)param_1[0x4b] & 4) != 0)))) {
      uVar1 = *(uint *)(this + 0x3ee0);
      if ((uVar1 == 0xffffffff) ||
         ((puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc ||
          (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)))) {
        pCVar9 = (CBaseEntity *)0x0;
      }
      else {
        pCVar9 = *(CBaseEntity **)(puVar7 + 4);
      }
      CBaseEntity::TakeDamage(pCVar9,param_1);
    }
  }
LAB_009a387a:
  fVar12 = 0.0;
LAB_009a387d:
  return (longdouble)fVar12;
}

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)