L L4D2node

CPhysicsProp::OnTakeDamage

0x007f99c0 · 2156 bytes · __thiscall

_ZN12CPhysicsProp12OnTakeDamageERK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* CPhysicsProp::OnTakeDamage(CTakeDamageInfo const&) */

undefined4 __thiscall CPhysicsProp::OnTakeDamage(CPhysicsProp *this,CTakeDamageInfo *param_1)

{
  float fVar1;
  float fVar2;
  float fVar3;
  uint uVar4;
  CBaseEntity *pCVar5;
  char cVar6;
  int iVar7;
  undefined4 uVar8;
  float *pfVar9;
  int *piVar10;
  undefined *puVar11;
  longdouble lVar12;
  CBaseEntity *local_150;
  float local_148;
  float local_144;
  float local_140;
  CTraceFilterSimple local_13c [16];
  float local_12c;
  float local_128;
  float local_124;
  float local_11c;
  float local_118;
  float local_114;
  undefined4 local_10c;
  undefined4 local_108;
  undefined4 local_104;
  undefined4 local_fc;
  undefined4 local_f8;
  undefined4 local_f4;
  undefined4 local_ec;
  undefined1 local_e8;
  undefined1 local_e7;
  Vector local_d0 [12];
  Vector local_c4 [72];
  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;
  uint 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;
  
  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_4c = *(undefined4 *)(param_1 + 0x30);
  local_48 = *(uint *)(param_1 + 0x34);
  local_44 = *(undefined4 *)(param_1 + 0x38);
  local_40 = *(float *)(param_1 + 0x3c);
  local_3c = *(undefined4 *)(param_1 + 0x40);
  local_34 = *(undefined4 *)(param_1 + 0x48);
  local_38 = *(undefined4 *)(param_1 + 0x44);
  local_24 = *(undefined4 *)(param_1 + 0x58);
  local_30 = *(undefined4 *)(param_1 + 0x4c);
  local_2c = *(undefined4 *)(param_1 + 0x50);
  local_28 = *(undefined4 *)(param_1 + 0x54);
  local_20 = *(undefined4 *)(param_1 + 0x5c);
  if (*(int *)(DebugZombieBreakables._28_4_ + 0x30) != 0) goto LAB_007f9a96;
  if (*(int *)(this + 0x1658) == 2) {
    if (local_48 == 0xffffffff) {
      return 0;
    }
    puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10;
    if (puVar11 == (undefined *)0xfffffffc) {
      return 0;
    }
    if (*(uint *)(puVar11 + 8) != local_48 >> 0xc) {
      return 0;
    }
    piVar10 = *(int **)(puVar11 + 4);
    if (piVar10 == (int *)0x0) {
      return 0;
    }
    cVar6 = (**(code **)(*piVar10 + 0x16c))(piVar10);
    if (cVar6 == '\0') {
      return 0;
    }
    uVar4 = *(uint *)(param_1 + 0x30);
    if (uVar4 == 0xffffffff) {
      return 0;
    }
    puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10;
    if (puVar11 == (undefined *)0xfffffffc) {
      return 0;
    }
    if (*(uint *)(puVar11 + 8) != uVar4 >> 0xc) {
      return 0;
    }
    pCVar5 = *(CBaseEntity **)(puVar11 + 4);
    if (pCVar5 == (CBaseEntity *)0x0) {
      return 0;
    }
    if ((((*(char **)(pCVar5 + 0x7c) != "weapon_tank_claw") &&
         (cVar6 = CBaseEntity::ClassMatchesComplex(pCVar5,"weapon_tank_claw"), cVar6 == '\0')) &&
        (*(char **)(pCVar5 + 0x7c) != "tank_rock")) &&
       (cVar6 = CBaseEntity::ClassMatchesComplex(pCVar5,"tank_rock"), cVar6 == '\0')) {
      return 0;
    }
  }
  else {
    if (*(int *)(this + 0x1658) != 1) goto LAB_007f9a96;
    if (local_48 == 0xffffffff) {
      return 0;
    }
    puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10;
    if (puVar11 == (undefined *)0xfffffffc) {
      return 0;
    }
    if (*(uint *)(puVar11 + 8) != local_48 >> 0xc) {
      return 0;
    }
    if (*(CBaseEntity **)(puVar11 + 4) == (CBaseEntity *)0x0) {
      return 0;
    }
    iVar7 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar11 + 4));
    if (iVar7 != 3) {
      return 0;
    }
    uVar4 = *(uint *)(param_1 + 0x34);
    if (((uVar4 == 0xffffffff) ||
        (puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar11 + 8) != uVar4 >> 0xc)) {
      piVar10 = (int *)0x0;
    }
    else {
      piVar10 = (int *)0x0;
      if (*(int *)(puVar11 + 4) != 0) {
        piVar10 = (int *)__dynamic_cast(*(int *)(puVar11 + 4),&CBaseEntity::typeinfo,
                                        &INextBot::typeinfo,0xfffffffe);
        if (piVar10 != (int *)0x0) {
          piVar10 = (int *)(**(code **)(*piVar10 + 0xc4))(piVar10);
          if (piVar10 == (int *)0x0) {
            return 0;
          }
          cVar6 = (**(code **)(*piVar10 + 0x114))(piVar10,0);
          if (cVar6 != '\0') {
            return 0;
          }
          goto LAB_007fa198;
        }
        piVar10 = *(int **)(puVar11 + 4);
      }
    }
    cVar6 = (**(code **)(*piVar10 + 0x16c))(piVar10);
    if (cVar6 != '\0') {
      local_150 = (CBaseEntity *)0x0;
      uVar4 = *(uint *)(param_1 + 0x34);
      if (((uVar4 != 0xffffffff) &&
          (puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar11 + 8) == uVar4 >> 0xc)) {
        local_150 = *(CBaseEntity **)(puVar11 + 4);
      }
      iVar7 = CBaseEntity::GetTeamNumber(local_150);
      if (iVar7 != 3) {
        return 0;
      }
    }
  }
LAB_007fa198:
  local_40 = (float)(*(int *)(this + 0x100) * 10);
LAB_007f9a96:
  cVar6 = (**(code **)(*(int *)this + 0x440))(this,0x15);
  if (cVar6 != '\0') {
    uVar4 = *(uint *)(param_1 + 0x30);
    if ((((uVar4 == 0xffffffff) ||
         (puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar11 + 8) != uVar4 >> 0xc)) ||
       (pCVar5 = *(CBaseEntity **)(puVar11 + 4), pCVar5 == (CBaseEntity *)0x0)) {
      uVar4 = *(uint *)(param_1 + 0x34);
      if (((uVar4 != 0xffffffff) &&
          (puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
         ((((*(uint *)(puVar11 + 8) == uVar4 >> 0xc &&
            ((pCVar5 = *(CBaseEntity **)(puVar11 + 4), pCVar5 != (CBaseEntity *)0x0 &&
             (cVar6 = (**(code **)(*(int *)pCVar5 + 0x16c))(pCVar5), cVar6 != '\0')))) &&
           (iVar7 = CBaseEntity::GetTeamNumber(pCVar5), iVar7 == 3)) &&
          (iVar7 = (**(code **)(*(int *)pCVar5 + 0x544))(pCVar5), iVar7 == 8)))) {
        lVar12 = (longdouble)IntervalTimer::Now();
        if ((float)lVar12 != *(float *)(this + 0x1684)) {
          (**(code **)(*(int *)(this + 0x1680) + 4))(this + 0x1680,this + 0x1684);
          *(float *)(this + 0x1684) = (float)lVar12;
        }
      }
    }
    else if ((((*(char **)(pCVar5 + 0x7c) == "weapon_tank_claw") ||
              (cVar6 = CBaseEntity::ClassMatchesComplex(pCVar5,"weapon_tank_claw"), cVar6 != '\0'))
             || (*(char **)(pCVar5 + 0x7c) == "tank_rock")) ||
            (cVar6 = CBaseEntity::ClassMatchesComplex(pCVar5,"tank_rock"), cVar6 != '\0')) {
      lVar12 = (longdouble)IntervalTimer::Now();
      if ((float)lVar12 != *(float *)(this + 0x1684)) {
        (**(code **)(*(int *)(this + 0x1680) + 4))(this + 0x1680,this + 0x1684);
        *(float *)(this + 0x1684) = (float)lVar12;
      }
    }
  }
  uVar8 = CBreakableProp::OnTakeDamage((CBreakableProp *)this,(CTakeDamageInfo *)&local_7c);
  if (((((byte)this[0x153] & 8) != 0) && ((*(uint *)(param_1 + 0x48) & 0x10000008) == 0x10000008))
     && (piVar10 = *(int **)(this + 0x238), piVar10 != (int *)0x0)) {
    (**(code **)(*piVar10 + 0xd4))(piVar10,&local_148,0);
    local_150 = (CBaseEntity *)0x100;
    if (*(int *)(hl2_episodic._28_4_ + 0x30) != 0) {
      local_150 = (CBaseEntity *)0x78;
      if (0 < *(int *)(this + 0x100)) {
        local_150 = (CBaseEntity *)0x100;
      }
    }
    pfVar9 = (float *)(**(code **)(*(int *)this + 0x288))(this);
    fVar1 = *pfVar9;
    fVar2 = pfVar9[1];
    fVar3 = pfVar9[2];
    pfVar9 = (float *)(**(code **)(*(int *)this + 0x288))(this);
    local_11c = (local_148 + fVar1) - *pfVar9;
    local_118 = (local_144 + fVar2) - pfVar9[1];
    local_114 = (local_140 + fVar3) - pfVar9[2];
    local_e8 = 1;
    local_ec = 0;
    local_f4 = 0;
    local_f8 = 0;
    local_fc = 0;
    local_e7 = local_118 * local_118 + local_11c * local_11c + local_114 * local_114 != 0.0;
    local_104 = 0;
    local_108 = 0;
    local_10c = 0;
    local_12c = *pfVar9;
    local_128 = pfVar9[1];
    local_124 = pfVar9[2];
    CTraceFilterSimple::CTraceFilterSimple
              (local_13c,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
    (**(code **)(*enginetrace + 0x14))(enginetrace,&local_12c,0x46004003,local_13c,local_d0);
    if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
      DebugDrawLine(local_d0,local_c4,0xff,0,0,true,-1.0);
    }
    CSoundEnt::InsertSound(8,local_c4,(int)local_150,1.0,(CBaseEntity *)this,2,(CBaseEntity *)0x0);
  }
  if ((*(float *)(this + 0x1654) != 0.0) &&
     (*(float *)(this + 0x1654) <=
      SQRT(*(float *)(param_1 + 4) * *(float *)(param_1 + 4) + *(float *)param_1 * *(float *)param_1
           + *(float *)(param_1 + 8) * *(float *)(param_1 + 8)))) {
    EnableMotion(this);
    *(undefined4 *)(this + 0x1654) = 0;
  }
  if (((0 < *(int *)(this + 0x1650)) && (*(int *)(this + 0x100) < *(int *)(this + 0x1650))) &&
     (*(undefined4 *)(this + 0x1650) = 0, *(int *)(this + 0x238) != 0)) {
    EnableMotion(this);
    (**(code **)(*(int *)this + 0x2a0))(this,param_1);
  }
  return uVar8;
}

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)