L L4D2node

CTerrorGun::DoViewPunch

0x005663a0 · 547 bytes · __thiscall

_ZN10CTerrorGun11DoViewPunchEP13CTerrorPlayer

Decompiled

undefined (2 params)

/* CTerrorGun::DoViewPunch(CTerrorPlayer*) */

void __thiscall CTerrorGun::DoViewPunch(CTerrorGun *this,CTerrorPlayer *param_1)

{
  CBaseEdict *this_00;
  bool bVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  float *pfVar5;
  uint uVar6;
  float fVar7;
  float fVar8;
  float local_28;
  float local_24;
  float local_20;
  
  iVar2 = CTerrorWeapon::GetTerrorWeaponData((CTerrorWeapon *)this);
  uVar3 = *(uint *)(param_1 + 0x150);
  uVar6 = uVar3 & 1;
  if (((byte)param_1[0x14d] & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_1);
    uVar3 = *(uint *)(param_1 + 0x150);
  }
  fVar8 = *(float *)(iVar2 + 0xc04);
  fVar7 = *(float *)(iVar2 + 0xc08);
  if (*(int *)(ZombieGunHorizPunch._28_4_ + 0x30) == 0) {
    fVar7 = 0.0;
  }
  if (*(int *)(ZombieGunVerticalPunch._28_4_ + 0x30) == 0) {
    fVar8 = 0.0;
  }
  if (uVar6 == 0) {
    fVar8 = fVar8 + fVar8;
    fVar7 = fVar7 + fVar7;
  }
  else {
    bVar1 = 5.0 < SQRT(*(float *)(param_1 + 0x274) * *(float *)(param_1 + 0x274) +
                       *(float *)(param_1 + 0x278) * *(float *)(param_1 + 0x278));
    if ((uVar3 & 2) == 0) {
      if (bVar1) {
        fVar8 = fVar8 * 1.25;
        fVar7 = fVar7 * 1.25;
      }
    }
    else if (bVar1) {
      fVar8 = fVar8 * 0.9;
      fVar7 = fVar7 * 0.9;
    }
    else {
      fVar8 = fVar8 * 0.5;
      fVar7 = fVar7 * 0.5;
    }
  }
  if (*(int *)(param_1 + 0x284c) != 0) {
    fVar7 = -fVar7;
  }
  iVar4 = SharedRandomInt("HorizKickDir",0,100,0);
  if ((float)iVar4 < *(float *)(iVar2 + 0xc0c)) {
    iVar2 = *(int *)(param_1 + 0x284c);
    if (param_1[0x6c] == (CTerrorPlayer)0x0) {
      this_00 = *(CBaseEdict **)(param_1 + 0x30);
      if (this_00 != (CBaseEdict *)0x0) {
        *(uint *)this_00 = *(uint *)this_00 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(this_00);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
      *(uint *)(param_1 + 0x284c) = (uint)(iVar2 == 0);
    }
    else {
      param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
      *(uint *)(param_1 + 0x284c) = (uint)(iVar2 == 0);
    }
  }
  pfVar5 = (float *)CBasePlayer::GetPunchAngle((CBasePlayer *)param_1);
  local_28 = *pfVar5 - fVar8;
  local_20 = pfVar5[2];
  local_24 = pfVar5[1] - fVar7;
  CBasePlayer::SetPunchAngle((CBasePlayer *)param_1,(QAngle *)&local_28);
  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)