L L4D2node

CCSPlayer::TraceAttack

0x00652de0 · 1556 bytes · __thiscall

_ZN9CCSPlayer11TraceAttackERK15CTakeDamageInfoRK6VectorP10CGameTrace

Decompiled

undefined (4 params)

/* CCSPlayer::TraceAttack(CTakeDamageInfo const&, Vector const&, CGameTrace*) */

void __thiscall
CCSPlayer::TraceAttack(CCSPlayer *this,CTakeDamageInfo *param_1,Vector *param_2,CGameTrace *param_3)

{
  int *piVar1;
  float fVar2;
  short sVar3;
  uint uVar4;
  CBaseEdict *this_00;
  CBaseEntity *this_01;
  bool bVar5;
  undefined4 uVar6;
  bool bVar7;
  bool bVar8;
  char cVar9;
  int iVar10;
  undefined *puVar11;
  undefined4 uVar12;
  longdouble lVar13;
  float fVar14;
  float local_7c;
  undefined4 local_78;
  float 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;
  uint local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  uVar4 = *(uint *)(param_1 + 0x34);
  if ((((uVar4 != 0xffffffff) &&
       (puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar11 + 8) == uVar4 >> 0xc)) &&
     ((this_01 = *(CBaseEntity **)(puVar11 + 4), this_01 != (CBaseEntity *)0x0 &&
      (cVar9 = (**(code **)(*(int *)this_01 + 0x16c))(this_01), cVar9 != '\0')))) {
    CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    CBaseEntity::GetTeamNumber(this_01);
  }
  if (this[0x105] != (CCSPlayer)0x2) {
    return;
  }
  *(undefined4 *)(this + 0x1838) = *(undefined4 *)(param_3 + 0x44);
  sVar3 = *(short *)(param_3 + 0x48);
  if ((int)sVar3 != *(int *)(this + 0x448)) {
    if (this[0x6c] == (CCSPlayer)0x0) {
      this_00 = *(CBaseEdict **)(this + 0x30);
      if (this_00 != (CBaseEdict *)0x0) {
        *(uint *)this_00 = *(uint *)this_00 | 0x101;
        iVar10 = CBaseEdict::GetChangeAccessor(this_00);
        *(undefined2 *)(iVar10 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x448) = (int)sVar3;
  }
  fVar2 = *(float *)(param_1 + 0x3c);
  fVar14 = fVar2;
  if ((*(uint *)(param_1 + 0x48) & 0x40) != 0) {
    if (*(int *)(this + 0x1f70) < 1) {
      bVar5 = false;
      iVar10 = CBasePlayer::GetPunchAngle((CBasePlayer *)this);
      local_78 = *(undefined4 *)(iVar10 + 4);
      local_7c = fVar2 * -0.1;
      if (fVar2 * -0.1 <= -4.0) {
        local_7c = -4.0;
      }
      local_74 = *(float *)(iVar10 + 8);
      CBasePlayer::SetPunchAngle((CBasePlayer *)this,(QAngle *)&local_7c);
      bVar7 = false;
      bVar8 = true;
      uVar12 = 0;
    }
    else {
      bVar5 = false;
      bVar7 = false;
      bVar8 = false;
      uVar12 = 0;
    }
    goto LAB_00652eb1;
  }
  uVar12 = *(undefined4 *)(param_3 + 0x44);
  uVar6 = 0;
  switch(uVar12) {
  case 1:
    if ((*(uint *)(param_1 + 0x48) & 0x20000000) == 0) {
      if (this[0x23e1] == (CCSPlayer)0x0) {
        fVar14 = fVar2 * 4.0;
        iVar10 = CBasePlayer::GetPunchAngle((CBasePlayer *)this);
        local_78 = *(undefined4 *)(iVar10 + 4);
        local_7c = -12.0;
        if (-12.0 <= fVar14 * -0.5) {
          local_7c = fVar14 * -0.5;
        }
        local_74 = *(float *)(iVar10 + 8);
        lVar13 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbf800000,0x3f800000);
        local_74 = (float)lVar13 * fVar14;
        if (-9.0 <= local_74) {
          if (9.0 < local_74) {
            local_74 = 9.0;
          }
        }
        else {
          local_74 = -9.0;
        }
        CBasePlayer::SetPunchAngle((CBasePlayer *)this,(QAngle *)&local_7c);
        bVar7 = false;
        bVar5 = true;
        bVar8 = true;
      }
      else {
        bVar7 = true;
        bVar5 = true;
        bVar8 = true;
        fVar14 = fVar2 * 4.0;
      }
      break;
    }
    goto LAB_0065336f;
  case 2:
    if (*(int *)(this + 0x1f70) < 1) {
      bVar5 = false;
      iVar10 = CBasePlayer::GetPunchAngle((CBasePlayer *)this);
      local_78 = *(undefined4 *)(iVar10 + 4);
      local_7c = fVar2 * -0.1;
      if (fVar2 * -0.1 <= -4.0) {
        local_7c = -4.0;
      }
      local_74 = *(float *)(iVar10 + 8);
      CBasePlayer::SetPunchAngle((CBasePlayer *)this,(QAngle *)&local_7c);
      bVar7 = false;
      bVar8 = true;
      uVar12 = uVar6;
      break;
    }
  default:
    bVar5 = false;
    bVar7 = false;
    bVar8 = true;
    uVar12 = uVar6;
    break;
  case 3:
    if (0 < *(int *)(this + 0x1f70)) {
      bVar5 = false;
      bVar7 = false;
      bVar8 = true;
      uVar12 = uVar6;
      fVar14 = fVar2 * 1.25;
      break;
    }
LAB_0065336f:
    bVar5 = false;
    iVar10 = CBasePlayer::GetPunchAngle((CBasePlayer *)this);
    local_7c = fVar2 * 1.25 * -0.1;
    local_78 = *(undefined4 *)(iVar10 + 4);
    if (local_7c <= -4.0) {
      local_7c = -4.0;
    }
    local_74 = *(float *)(iVar10 + 8);
    CBasePlayer::SetPunchAngle((CBasePlayer *)this,(QAngle *)&local_7c);
    bVar7 = false;
    bVar8 = true;
    uVar12 = uVar6;
    fVar14 = fVar2 * 1.25;
    break;
  case 6:
  case 7:
    bVar5 = false;
    bVar7 = false;
    bVar8 = true;
    uVar12 = uVar6;
    fVar14 = fVar2 * 0.75;
  }
LAB_00652eb1:
  lVar13 = (longdouble)(**(code **)(*(int *)this + 0x7ec))(this,param_1,fVar2,fVar14,uVar12);
  fVar2 = (float)lVar13;
  for (iVar10 = IPredictionSystem::g_pPredictionSystems; iVar10 != 0; iVar10 = *(int *)(iVar10 + 4))
  {
    *(int *)(iVar10 + 0x10) = *(int *)(iVar10 + 0x10) + 1;
  }
  if ((0.0 < fVar2) && (bVar8)) {
                    /* try { // try from 00653097 to 006530e8 has its CatchHandler @ 0065341f */
    (**(code **)(*(int *)this + 0x7f0))(this,fVar2,param_1,param_2,param_3);
  }
  if ((*(int *)(param_3 + 0x44) == 1) && (bVar7)) {
    (**(code **)(*(int *)g_pEffects + 0x10))(g_pEffects,param_3 + 0xc,1,1,param_3 + 0x18);
  }
  local_7c = *(float *)param_1;
  local_3c = *(undefined4 *)(param_1 + 0x40);
  local_38 = *(undefined4 *)(param_1 + 0x44);
  local_78 = *(undefined4 *)(param_1 + 4);
  local_74 = *(float *)(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 = *(undefined4 *)(param_1 + 0x34);
  local_44 = *(undefined4 *)(param_1 + 0x38);
  local_30 = *(undefined4 *)(param_1 + 0x4c);
  local_34 = *(uint *)(param_1 + 0x48);
  local_24 = *(undefined4 *)(param_1 + 0x58);
  local_2c = *(undefined4 *)(param_1 + 0x50);
  local_28 = *(undefined4 *)(param_1 + 0x54);
  local_20 = *(undefined4 *)(param_1 + 0x5c);
  if (bVar5) {
    local_34 = local_34 | 0x40000000;
  }
  local_40 = fVar2;
                    /* try { // try from 00652fc7 to 00652fcb has its CatchHandler @ 0065341f */
  AddMultiDamage((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this);
  iVar10 = IPredictionSystem::g_pPredictionSystems;
  if (IPredictionSystem::g_pPredictionSystems == 0) {
    return;
  }
  do {
    *(int *)(iVar10 + 0x10) = *(int *)(iVar10 + 0x10) + -1;
    piVar1 = (int *)(iVar10 + 4);
    iVar10 = *piVar1;
  } while (*piVar1 != 0);
  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)