L L4D2node

CClaw::OnHit

0x00535470 · 2307 bytes · __thiscall

_ZN5CClaw5OnHitER10CGameTraceRK6Vectorb

Decompiled

undefined (4 params)

/* CClaw::OnHit(CGameTrace&, Vector const&, bool) */

undefined4 __thiscall CClaw::OnHit(CClaw *this,CGameTrace *param_1,Vector *param_2,bool param_3)

{
  float fVar1;
  CBaseEntity *this_00;
  CBaseEdict *this_01;
  code *pcVar2;
  char cVar3;
  CBaseEntity *this_02;
  CBaseEntity *this_03;
  CBaseEntity *this_04;
  int iVar4;
  int *piVar5;
  CBasePropDoor *this_05;
  longdouble lVar6;
  float local_b4;
  Vector local_a8 [12];
  undefined **local_9c;
  float local_98;
  float local_94;
  float local_7c;
  float 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;
  int local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  uint local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined1 local_24;
  undefined1 local_23;
  
  this_02 = (CBaseEntity *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
  if (this_02 == (CBaseEntity *)0x0) {
    return 0;
  }
  cVar3 = (**(code **)(*(int *)this_02 + 0x558))();
  if (cVar3 != '\0') {
    return 0;
  }
  this_00 = *(CBaseEntity **)(param_1 + 0x4c);
  if (this_00 == (CBaseEntity *)0x0) {
    return 0;
  }
  piVar5 = (int *)&stack0xffffff24;
  if (param_3) {
    cVar3 = (**(code **)(*(int *)this_00 + 0x16c))();
    this_03 = (CBaseEntity *)0x0;
    if (cVar3 != '\0') {
      this_03 = this_00;
    }
    this_04 = (CBaseEntity *)(**(code **)(*(int *)this_00 + 0x144))();
    if ((((*(char **)(this_00 + 0x7c) == "func_door*") ||
         (cVar3 = CBaseEntity::ClassMatchesComplex(this_00,"func_door*"), cVar3 != '\0')) ||
        (*(char **)(this_00 + 0x7c) == "prop_door*")) ||
       (cVar3 = CBaseEntity::ClassMatchesComplex(this_00,"prop_door*"), cVar3 != '\0')) {
      piVar5 = (int *)__dynamic_cast();
      if (piVar5 == (int *)0x0) {
        this_05 = (CBasePropDoor *)__dynamic_cast();
        if (this_05 != (CBasePropDoor *)0x0) {
          iVar4 = (**(code **)(*(int *)this_02 + 0x52c))();
          if (((iVar4 == 0) ||
              (iVar4 = (**(code **)(*(int *)this_02 + 0x52c))(), (*(byte *)(iVar4 + 0x12d) & 8) == 0
              )) && ((cVar3 = (**(code **)(*(int *)this_05 + 0x478))(), cVar3 != '\0' &&
                     ((this_05[0x1624] != (CBasePropDoor)0x0 ||
                      (cVar3 = (**(code **)(*(int *)this_05 + 0x484))(), cVar3 == '\0')))))) {
            piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))();
            if (piVar5 != (int *)0x0) {
              pcVar2 = *(code **)(*piVar5 + 0x30);
              (**(code **)(*engine + 0x40))();
              (*pcVar2)();
              (**(code **)(*gameeventmanager + 0x20))();
            }
            CBasePropDoor::OnInfectedAttack(this_05);
            return 0;
          }
          CBasePropDoor::OnInfectedAttack(this_05);
        }
      }
      else if ((char)piVar5[0x13f] == '\0') {
        (**(code **)(*piVar5 + 0x1ac))();
        return 0;
      }
      local_b4 = *(float *)(ZombieDoorPoundDamage._28_4_ + 0x2c) * 5.0;
    }
    else if (this_03 == (CBaseEntity *)0x0) {
      if (((this_04 == (CBaseEntity *)0x0) ||
          (iVar4 = (**(code **)(*(int *)this_04 + 0x544))(), iVar4 != 0)) ||
         (iVar4 = CBaseEntity::GetGender(this_04), iVar4 == 0x11)) {
        if (((*(char **)(this_00 + 0x7c) == "finale_trigger") ||
            (cVar3 = CBaseEntity::ClassMatchesComplex(this_00,"finale_trigger"), cVar3 != '\0')) ||
           ((*(char **)(this_00 + 0x7c) == "trigger_finale" ||
            (cVar3 = CBaseEntity::ClassMatchesComplex(this_00,"trigger_finale"), cVar3 != '\0')))) {
          iVar4 = CBaseEntity::GetTeamNumber(this_02);
          if ((iVar4 == 3) && (iVar4 = (**(code **)(*(int *)this_02 + 0x544))(), iVar4 == 8)) {
            lVar6 = (longdouble)(**(code **)(*(int *)this + 0x704))();
            local_b4 = (float)lVar6;
          }
          else {
            lVar6 = (longdouble)CDirector::GetZombieAttackDamage(TheDirector,(CTerrorPlayer *)0x0);
            local_b4 = (float)lVar6;
          }
        }
        else {
          lVar6 = (longdouble)CDirector::GetZombieBreakableDamage();
          local_b4 = (float)lVar6;
        }
        CBaseEntity::EmitSound(this_02,"Claw.Hit",0.0,(float *)0x0);
      }
      else {
        local_b4 = (float)*(int *)(this_04 + 0x100);
        CBaseEntity::EmitSound(this_02,"Claw.HitFlesh",0.0,(float *)0x0);
      }
    }
    else {
      iVar4 = CBaseEntity::GetTeamNumber(this_03);
      cVar3 = IsASurvivorTeam(iVar4);
      if (((cVar3 != '\0') && (cVar3 = (**(code **)(*(int *)this_03 + 0x7e8))(), cVar3 != '\0')) &&
         (iVar4 = (**(code **)(*(int *)this_02 + 0x544))(), iVar4 == 8)) {
        return 0;
      }
      iVar4 = CBaseEntity::GetTeamNumber(this_03);
      if (((iVar4 == 3) && (iVar4 = (**(code **)(*(int *)this_03 + 0x544))(), iVar4 == 7)) &&
         (iVar4 = (**(code **)(*(int *)this_02 + 0x544))(), iVar4 == 8)) {
        return 0;
      }
      lVar6 = (longdouble)(**(code **)(*(int *)this + 0x704))();
      local_b4 = (float)lVar6;
      fVar1 = *(float *)(ZombieAttackMovementPenalty._28_4_ + 0x2c);
      if (fVar1 != *(float *)(this_02 + 0x2854)) {
        if (this_02[0x6c] == (CBaseEntity)0x0) {
          this_01 = *(CBaseEdict **)(this_02 + 0x30);
          if (this_01 != (CBaseEdict *)0x0) {
            *(uint *)this_01 = *(uint *)this_01 | 0x101;
            iVar4 = CBaseEdict::GetChangeAccessor(this_01);
            *(undefined2 *)(iVar4 + 2) = 0;
          }
        }
        else {
          this_02[0x70] = (CBaseEntity)((byte)this_02[0x70] | 1);
        }
        *(float *)(this_02 + 0x2854) = fVar1;
      }
      (**(code **)(*(int *)this + 0x708))();
      iVar4 = CBaseEntity::GetTeamNumber(this_03);
      if ((iVar4 == 3) && (iVar4 = (**(code **)(*(int *)this_03 + 0x544))(), iVar4 != 8)) {
        CBasePlayer::EyeVectors
                  ((CBasePlayer *)this_02,(Vector *)&local_9c,(Vector *)0x0,(Vector *)0x0);
        VectorNormalize((Vector *)&local_9c);
        if (local_94 <= 0.1) {
          local_94 = 0.1;
        }
        local_74 = *(float *)(ClawForce._28_4_ + 0x2c);
        local_78 = local_98 * local_74;
        local_7c = (float)local_9c * local_74;
        local_74 = local_94 * local_74;
        CTerrorPlayer::SetShoveForce((CTerrorPlayer *)this_03,(Vector *)&local_7c);
      }
      else {
        CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_7c);
                    /* try { // try from 00535604 to 00535641 has its CatchHandler @ 00535db0 */
        CRecipientFilter::MakeReliable((CRecipientFilter *)&local_7c);
        CRecipientFilter::AddRecipient((CRecipientFilter *)&local_7c,(CBasePlayer *)this_02);
        UserMessageBegin((IRecipientFilter *)&local_7c,"Splatter");
        MessageWriteByte(1);
        MessageEnd();
        CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_7c);
      }
    }
    piVar5 = (int *)&stack0xffffff24;
    if (1.0 <= local_b4) {
      (**(code **)(*(int *)this + 0x700))();
      CTakeDamageInfo::CTakeDamageInfo((CTakeDamageInfo *)&local_7c,this_02,this_02,local_b4,0x80,0)
      ;
      (**(code **)(*(int *)this_02 + 0x478))();
      piVar5 = (int *)&stack0xffffff1c;
      CalculateMeleeDamageForce((CTakeDamageInfo *)&local_7c,local_a8,(Vector *)&local_9c,1.0);
      if (400.0 < *(float *)(this_00 + 0x23c)) {
        local_34 = local_34 | 0x800;
        local_7c = 0.0;
        local_78 = 0.0;
        local_74 = 0.0;
      }
      ClearMultiDamage();
      CBaseEntity::DispatchTraceAttack
                ((CTakeDamageInfo *)this_00,(Vector *)&local_7c,(CGameTrace *)param_2);
      ApplyMultiDamage();
    }
  }
  if ((ushort)(*(short *)(param_1 + 0x40) - 1U) < 0xff) {
    local_7c = *(float *)(param_1 + 0xc);
    local_34 = CONCAT22(local_34._2_2_,*(short *)(param_1 + 0x40));
    local_28 = *(undefined4 *)(param_1 + 0x50);
    local_64 = 0;
    local_78 = *(float *)(param_1 + 0x10);
    local_60 = 0;
    local_74 = *(float *)(param_1 + 0x14);
    local_70 = *(undefined4 *)param_1;
    local_5c = 0;
    local_6c = *(undefined4 *)(param_1 + 4);
    local_58 = 0;
    local_68 = *(undefined4 *)(param_1 + 8);
    local_54 = 0;
    local_50 = 0;
    local_4c = 0;
    local_44 = 0x3f800000;
    local_38 = 0;
    local_40 = 0;
    local_3c = 0;
    local_30 = 0;
    local_24 = 0;
    local_23 = 0;
    local_2c = 4;
    if (*(int *)(*(int *)(param_1 + 0x4c) + 0x30) == 0) {
      local_48 = 0;
    }
    else {
      local_48 = *(int *)(*(int *)(param_1 + 0x4c) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    *piVar5 = (int)&local_9c;
    piVar5[-1] = 0x5358c4;
    CRecipientFilter::CRecipientFilter((CRecipientFilter *)*piVar5);
    *piVar5 = (int)&local_9c;
    piVar5[1] = (int)&local_7c;
    local_9c = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 005358de to 005358e2 has its CatchHandler @ 00535dc8 */
    piVar5[-1] = 0x5358e3;
    CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)*piVar5,(Vector *)piVar5[1]);
    if (((byte)this_02[0x14d] & 8) != 0) {
      *piVar5 = (int)this_02;
                    /* try { // try from 005358ef to 00535943 has its CatchHandler @ 00535d94 */
      piVar5[-1] = 0x5358f4;
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)*piVar5);
    }
    local_58 = *(undefined4 *)(this_02 + 0x37c);
    local_54 = *(undefined4 *)(this_02 + 0x380);
    local_50 = *(undefined4 *)(this_02 + 900);
    piVar5[3] = (int)&local_7c;
    piVar5[2] = (int)"KnifeSlash";
    piVar5[1] = 0;
    *piVar5 = (int)&local_9c;
    local_4c = 1;
    piVar5[-1] = 0x535944;
    DispatchEffect((IRecipientFilter *)*piVar5,(float)piVar5[1],(char *)piVar5[2],
                   (CEffectData *)piVar5[3]);
    *piVar5 = (int)&local_9c;
    local_9c = &PTR__CPASFilter_00bfaf28;
    piVar5[-1] = 0x535956;
    CRecipientFilter::~CRecipientFilter((CRecipientFilter *)*piVar5);
  }
  return 0;
}

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)