L L4D2node

PhysicsDamage::operator()

0x0050de00 · 2745 bytes · __thiscall

_ZN13PhysicsDamageclEP13CTerrorPlayer

Decompiled

undefined (2 params)

/* PhysicsDamage::TEMPNAMEPLACEHOLDERVALUE(CTerrorPlayer*) */

undefined4 __thiscall PhysicsDamage::operator()(PhysicsDamage *this,CTerrorPlayer *param_1)

{
  float fVar1;
  char cVar2;
  uint uVar3;
  CPhysicsProp *this_00;
  CTerrorPlayer *pCVar4;
  undefined4 uVar5;
  Vector *pVVar6;
  CBaseEntity *this_01;
  int iVar7;
  char *pcVar8;
  longdouble lVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float local_138;
  CBaseEntity *local_134;
  float local_11c;
  float local_118;
  float local_114;
  undefined4 local_110;
  undefined4 local_10c;
  undefined4 local_108;
  float local_104;
  float local_100;
  float local_fc;
  float local_f8;
  float local_f4;
  float local_f0;
  float local_ec;
  float local_e8;
  float local_e4;
  undefined **local_e0 [4];
  CGameTrace local_d0 [12];
  float local_c4;
  float local_c0;
  float local_bc;
  float local_a4;
  char local_9a;
  int local_84;
  CTakeDamageInfo local_7c [8];
  float local_74;
  
  cVar2 = (**(code **)(*(int *)param_1 + 300))(param_1);
  if (cVar2 == '\0') {
    return 1;
  }
  cVar2 = (**(code **)(*(int *)param_1 + 0x558))(param_1);
  if (cVar2 != '\0') {
    return 1;
  }
  if (param_1[0x186] == (CTerrorPlayer)0x8) {
    return 1;
  }
  CTraceFilterSimple::CTraceFilterSimple
            ((CTraceFilterSimple *)local_e0,(IHandleEntity *)param_1,0,
             (_func_bool_IHandleEntity_ptr_int *)0x0);
  local_e0[0] = &PTR_ShouldHitEntity_00c2af98;
  uVar3 = (**(code **)(*(int *)param_1 + 0x7a0))(param_1,0);
  if ((((byte)param_1[0x14d] & 8) != 0) &&
     (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1), ((byte)param_1[0x14d] & 8) != 0)) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  UTIL_TraceEntity((CBaseEntity *)param_1,(Vector *)(param_1 + 0x2e0),(Vector *)(param_1 + 0x2e0),
                   uVar3,(ITraceFilter *)local_e0,local_d0);
  if (local_a4 != 0.0) {
    return 1;
  }
  if (local_84 == 0) {
    return 1;
  }
  this_00 = (CPhysicsProp *)__dynamic_cast(local_84,&CBaseEntity::typeinfo,&CPhysicsProp::typeinfo);
  if (this_00 == (CPhysicsProp *)0x0) {
    return 1;
  }
  if (*(int *)(this_00 + 0x238) == 0) {
    return 1;
  }
  lVar9 = (longdouble)CPhysicsProp::GetMass(this_00);
  fVar12 = (float)lVar9;
  if (fVar12 == 1.0) {
    if (0 < *(int *)(gpGlobals + 0x14)) {
      iVar7 = 1;
      do {
        pCVar4 = (CTerrorPlayer *)UTIL_PlayerByIndex(iVar7);
        if ((((pCVar4 != (CTerrorPlayer *)0x0) &&
             (cVar2 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4), cVar2 != '\0')) &&
            (param_1 != pCVar4)) &&
           (cVar2 = (**(code **)(*(int *)pCVar4 + 0x6f8))(pCVar4,this_00), cVar2 != '\0')) {
          (**(code **)(*(int *)pCVar4 + 0x6f0))(pCVar4,this_00);
          (**(code **)(**(int **)(this_00 + 0x238) + 0xd4))
                    (*(int **)(this_00 + 0x238),&local_ec,local_7c);
          local_ec = local_ec * -0.5;
          local_e8 = local_e8 * -0.5;
          local_e4 = local_e4 * -0.5;
          (**(code **)(**(int **)(this_00 + 0x238) + 0xcc))
                    (*(int **)(this_00 + 0x238),&local_ec,local_7c);
          return 1;
        }
        iVar7 = iVar7 + 1;
      } while (iVar7 <= *(int *)(gpGlobals + 0x14));
    }
  }
  else if (20.0 < fVar12) {
    (**(code **)(**(int **)(this_00 + 0x238) + 0xd4))
              (*(int **)(this_00 + 0x238),(Vector *)&local_11c,&local_110);
    if (((byte)param_1[0x14d] & 0x10) != 0) {
      CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_1);
    }
    local_104 = local_11c - *(float *)(param_1 + 0x274);
    local_100 = local_118 - *(float *)(param_1 + 0x278);
    local_fc = local_114 - *(float *)(param_1 + 0x27c);
    lVar9 = (longdouble)VectorNormalize((Vector *)&local_11c);
    fVar1 = (float)lVar9;
    lVar9 = (longdouble)VectorNormalize((Vector *)&local_104);
    fVar14 = (float)lVar9;
    if (fVar1 <= (float)lVar9) {
      fVar14 = fVar1;
    }
    if (fVar12 <= 100.0) {
      iVar7 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
      cVar2 = IsASurvivorTeam(iVar7);
      if (((cVar2 != '\0') &&
          (this_01 = (CBaseEntity *)(**(code **)(*(int *)this_00 + 0x2c4))(this_00,0x3f800000),
          this_01 != (CBaseEntity *)0x0)) &&
         (cVar2 = (**(code **)(*(int *)this_01 + 0x16c))(this_01), cVar2 != '\0')) {
        iVar7 = CBaseEntity::GetTeamNumber(this_01);
        cVar2 = IsASurvivorTeam(iVar7);
        if (cVar2 != '\0') goto LAB_0050df99;
      }
    }
    local_134 = (CBaseEntity *)(**(code **)(*(int *)this_00 + 0x2c4))(this_00,0x41200000);
    if ((local_134 == (CBaseEntity *)0x0) ||
       (cVar2 = (**(code **)(*(int *)local_134 + 0x16c))(local_134), cVar2 == '\0')) {
      local_134 = (CBaseEntity *)0x0;
    }
    fVar11 = 20.0;
    if (20.0 <= fVar12) {
      fVar11 = fVar12;
    }
    if (1000.0 <= fVar11) {
      fVar11 = 1000.0;
    }
    if (fVar14 <= 100.0) {
      local_138 = 0.0;
      if (0.0 <= fVar14) {
        local_138 = fVar14;
      }
      if ((local_138 < 100.0) && (fVar11 < 900.0)) {
        if (*(int *)(sv_turbophysics_shadow._28_4_ + 0x30) != 0) {
          return 1;
        }
        cVar2 = MovePropAway((CBaseEntity *)this_00,(CBasePlayer *)param_1);
        if (cVar2 != '\0') {
          return 1;
        }
        if (((byte)this_00[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_00);
        }
        if (((byte)param_1[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
        }
        if ((*(float *)(param_1 + 0x2e4) - *(float *)(this_00 + 0x2e4)) * local_118 +
            (*(float *)(param_1 + 0x2e0) - *(float *)(this_00 + 0x2e0)) * local_11c +
            (*(float *)(param_1 + 0x2e8) - *(float *)(this_00 + 0x2e8)) * local_114 < 0.0) {
          return 1;
        }
        local_110 = 0;
        local_10c = 0;
        local_11c = local_11c * -40.0;
        local_108 = 0;
        local_118 = local_118 * -40.0;
        local_114 = local_114 * -40.0;
        (**(code **)(**(int **)(this_00 + 0x238) + 0xcc))
                  (*(int **)(this_00 + 0x238),(Vector *)&local_11c,&local_110);
        return 1;
      }
      cVar2 = (**(code **)(*(int *)param_1 + 0x7e8))(param_1);
      if ((cVar2 == '\0') && (local_138 < 50.0)) {
        if (((byte)param_1[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
        }
        fVar12 = *(float *)(param_1 + 0x2e0);
        fVar14 = *(float *)(param_1 + 0x2e4);
        fVar13 = *(float *)(param_1 + 0x2e8);
        local_f8 = fVar12;
        local_f4 = fVar14;
        local_f0 = fVar13;
        (**(code **)(*(int *)(this_00 + 0x194) + 0x3c))(this_00 + 0x194,&local_ec,local_7c);
        fVar10 = fVar13;
        if (fVar13 <= local_74 + 1.0) {
          do {
            local_f0 = fVar10;
            uVar3 = (**(code **)(*(int *)param_1 + 0x7a0))(param_1,0);
            UTIL_TraceEntity((CBaseEntity *)param_1,(Vector *)&local_f8,(Vector *)&local_f8,uVar3,
                             (IHandleEntity *)param_1,0,local_d0);
            if ((local_9a == '\0') && (0.0 < local_a4)) {
              uVar5 = (**(code **)(*(int *)param_1 + 0xb8))(param_1);
              UTIL_LogPrintf("(PHYSICS) %s was moved above a prop (%f %f %f) to (%f %f %f)\n",uVar5,
                             (double)fVar12,(double)fVar14,(double)fVar13,(double)local_c4,
                             (double)local_c0,(double)local_bc);
              CBaseEntity::SetAbsOrigin((CBaseEntity *)param_1,(Vector *)&local_c4);
              return 1;
            }
            fVar10 = fVar10 + 1.0;
          } while (fVar10 <= local_74 + 1.0);
        }
      }
    }
    else {
      (**(code **)(*(int *)param_1 + 0x7e8))(param_1);
      local_138 = 100.0;
    }
    fVar14 = 0.0;
    fVar12 = 1.0;
    if (100.0 < fVar11) {
      fVar14 = 0.5;
      fVar12 = fVar14;
    }
    fVar13 = (fVar11 + -1000.0) * 0.0010204081 + 1.0;
    fVar14 = ((local_138 + -100.0) * 0.01 + 1.0) * fVar12 + fVar14;
    fVar12 = fVar13 * 100.0 * fVar14;
    if (fVar12 <= 0.0) {
      return 1;
    }
    if (fVar1 < 50.0) {
      return 1;
    }
    pcVar8 = "nobody";
    if (local_134 != (CBaseEntity *)0x0) {
      pcVar8 = (char *)(**(code **)(*(int *)local_134 + 0xb8))(local_134);
    }
    uVar5 = (**(code **)(*(int *)param_1 + 0xb8))(param_1);
    UTIL_LogPrintf("(PHYSICS) %s was hit for %.1f damage by a physics obs of mass %.2f(%.2f), moving at a relative speed %.2f(%.2f), moved by %s\n"
                   ,uVar5,(double)fVar12,(double)fVar11,(double)fVar13,(double)local_138,
                   (double)fVar14,pcVar8);
    CTakeDamageInfo::CTakeDamageInfo(local_7c,(CBaseEntity *)this_00,local_134,fVar12,1,0);
    pVVar6 = (Vector *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
    CalculateMeleeDamageForce(local_7c,(Vector *)&local_104,pVVar6,fVar12);
    ClearMultiDamage();
    CBaseEntity::DispatchTraceAttack
              ((CTakeDamageInfo *)param_1,(Vector *)local_7c,(CGameTrace *)&local_104);
    ApplyMultiDamage();
    return 1;
  }
LAB_0050df99:
  MovePropAway((CBaseEntity *)this_00,(CBasePlayer *)param_1);
  return 1;
}

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)