L L4D2node

TankAttack::TryToThrowRock

0x00ae15d0 · 2170 bytes · __thiscall

_ZN10TankAttack14TryToThrowRockEP4Tank

Decompiled

undefined (2 params)

/* TankAttack::TryToThrowRock(Tank*) */

void __thiscall TankAttack::TryToThrowRock(TankAttack *this,Tank *param_1)

{
  float fVar1;
  uint uVar2;
  code *pcVar3;
  char cVar4;
  int *piVar5;
  int *piVar6;
  int iVar7;
  float *pfVar8;
  undefined *puVar9;
  undefined4 uVar10;
  CBaseEntity *pCVar11;
  longdouble lVar12;
  longdouble lVar13;
  float fVar14;
  float fVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  double dVar19;
  double local_74;
  float local_54;
  undefined4 local_50;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if (*(int *)(ZombieAllowAIToUseAbilities._28_4_ + 0x30) == 0) {
    return;
  }
  cVar4 = CDirector::IsFinale(TheDirector);
  if ((cVar4 == '\0') &&
     (((iVar7 = GetDifficulty(), iVar7 == 0 || (iVar7 = GetDifficulty(), iVar7 == 1)) &&
      (lVar12 = (longdouble)IntervalTimer::Now(), (float)lVar12 - *(float *)(this + 0x484c) < 10.0))
     )) {
    return;
  }
  uVar2 = *(uint *)(param_1 + 0x30bc);
  if (uVar2 == 0xffffffff) {
    return;
  }
  puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
  if (puVar9 == (undefined *)0xfffffffc) {
    return;
  }
  if (*(uint *)(puVar9 + 8) != uVar2 >> 0xc) {
    return;
  }
  piVar6 = *(int **)(puVar9 + 4);
  if (piVar6 == (int *)0x0) {
    return;
  }
  lVar12 = (longdouble)CountdownTimer::Now();
  if ((float)lVar12 < *(float *)(this + 0x4864)) {
    cVar4 = (**(code **)(*piVar6 + 0x354))(piVar6);
    if (cVar4 == '\0') {
      return;
    }
    pCVar11 = (CBaseEntity *)0x0;
    uVar2 = *(uint *)(this + 0x34);
    if (((uVar2 != 0xffffffff) &&
        (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
      pCVar11 = *(CBaseEntity **)(puVar9 + 4);
    }
    if (((byte)pCVar11[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(pCVar11);
    }
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
    }
    fVar14 = SQRT((*(float *)(param_1 + 0x2e4) - *(float *)(pCVar11 + 0x2e4)) *
                  (*(float *)(param_1 + 0x2e4) - *(float *)(pCVar11 + 0x2e4)) +
                  (*(float *)(param_1 + 0x2e0) - *(float *)(pCVar11 + 0x2e0)) *
                  (*(float *)(param_1 + 0x2e0) - *(float *)(pCVar11 + 0x2e0)) +
                  (*(float *)(param_1 + 0x2e8) - *(float *)(pCVar11 + 0x2e8)) *
                  (*(float *)(param_1 + 0x2e8) - *(float *)(pCVar11 + 0x2e8)));
    fVar18 = fVar14 * *(float *)(TankThrowLoftRate._28_4_ + 0x2c);
    if (*(float *)(TankThrowMaxLoftAngle._28_4_ + 0x2c) <= fVar18) {
      fVar18 = *(float *)(TankThrowMaxLoftAngle._28_4_ + 0x2c);
    }
    iVar7 = GetDifficulty();
    if (iVar7 == 0) {
      if (((byte)param_1[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
      }
      pCVar11 = (CBaseEntity *)0x0;
      uVar2 = *(uint *)(this + 0x34);
      if (((uVar2 != 0xffffffff) &&
          (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
        pCVar11 = *(CBaseEntity **)(puVar9 + 4);
      }
      if (((byte)pCVar11[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar11);
      }
      local_40 = *(float *)(pCVar11 + 0x2e0) - *(float *)(param_1 + 0x2e0);
      local_3c = *(float *)(pCVar11 + 0x2e4) - *(float *)(param_1 + 0x2e4);
      local_38 = *(float *)(pCVar11 + 0x2e8) - *(float *)(param_1 + 0x2e8);
      VectorVectors((Vector *)&local_40,(Vector *)&local_34,(Vector *)&local_28);
      lVar12 = (longdouble)fcos((longdouble)*(float *)(this + 0x4878));
      lVar13 = (longdouble)fsin((longdouble)*(float *)(this + 0x4878));
      fVar15 = (float)lVar13;
      fVar16 = (float)lVar12;
      fVar1 = *(float *)(TankThrowAimError._28_4_ + 0x2c);
      fVar17 = (local_28 * fVar16 + local_34 * fVar15) * fVar1;
      local_54 = (local_24 * fVar16 + local_30 * fVar15) * fVar1;
      local_74 = (double)((fVar15 * local_2c + fVar16 * local_20) * fVar1);
    }
    else {
      pCVar11 = (CBaseEntity *)0x0;
      local_54 = fVar14 / *(float *)(ZombieTankThrowForce._28_4_ + 0x2c) +
                 *(float *)(TankThrowLeadTimeFactor._28_4_ + 0x2c);
      uVar2 = *(uint *)(this + 0x34);
      if (((uVar2 != 0xffffffff) &&
          (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
        pCVar11 = *(CBaseEntity **)(puVar9 + 4);
      }
      if (((byte)pCVar11[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity(pCVar11);
      }
      local_74 = 0.0;
      fVar17 = *(float *)(pCVar11 + 0x274) * local_54;
      local_54 = local_54 * *(float *)(pCVar11 + 0x278);
    }
    piVar6 = (int *)(**(code **)(*(int *)param_1 + 0x9b4))(param_1);
    pcVar3 = *(code **)(*piVar6 + 0xc0);
    dVar19 = tan((double)(fVar18 * 0.017453292));
    uVar2 = *(uint *)(this + 0x34);
    if (((uVar2 == 0xffffffff) ||
        (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar9 + 8) != uVar2 >> 0xc)) {
      piVar5 = (int *)0x0;
    }
    else {
      piVar5 = *(int **)(puVar9 + 4);
    }
    pfVar8 = (float *)(**(code **)(*piVar5 + 0x288))(piVar5);
    local_28 = fVar17 + *pfVar8;
    local_24 = local_54 + pfVar8[1];
    local_20 = (float)(dVar19 * (double)fVar14 + local_74) + pfVar8[2];
    (*pcVar3)(piVar6,&local_28,3,0x40800000,0,"Throw loft angle",1,0x3e800000);
  }
  else {
    if (param_1[0x1a90] != (Tank)0x0) {
      return;
    }
    piVar5 = (int *)(**(code **)(*(int *)param_1 + 0x9b0))(param_1);
    cVar4 = (**(code **)(*piVar5 + 0xf8))(piVar5);
    if (cVar4 == '\0') {
      return;
    }
    piVar5 = (int *)(**(code **)(*(int *)param_1 + 0x9b0))(param_1);
    cVar4 = (**(code **)(*piVar5 + 200))(piVar5);
    if (cVar4 != '\0') {
      return;
    }
    uVar2 = *(uint *)(this + 0x34);
    piVar5 = (int *)0x0;
    if (uVar2 != 0xffffffff) {
      puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
      if ((puVar9 == (undefined *)0xfffffffc) || (*(uint *)(puVar9 + 8) != uVar2 >> 0xc)) {
        piVar5 = (int *)0x0;
      }
      else {
        piVar5 = *(int **)(puVar9 + 4);
      }
    }
    cVar4 = (**(code **)(*piVar5 + 0x16c))(piVar5);
    if (cVar4 != '\0') {
      uVar2 = *(uint *)(this + 0x34);
      if ((((uVar2 == 0xffffffff) ||
           (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
          (*(uint *)(puVar9 + 8) != uVar2 >> 0xc)) ||
         ((piVar5 = *(int **)(puVar9 + 4), piVar5 == (int *)0x0 ||
          (cVar4 = (**(code **)(*piVar5 + 0x16c))(piVar5), cVar4 == '\0')))) {
        piVar5 = (int *)0x0;
      }
      cVar4 = (**(code **)(*piVar5 + 0x7e8))(piVar5);
      if (cVar4 != '\0') {
        return;
      }
    }
    local_50 = 0;
    uVar2 = *(uint *)(this + 0x34);
    if (((uVar2 != 0xffffffff) &&
        (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
      local_50 = *(undefined4 *)(puVar9 + 4);
    }
    cVar4 = (**(code **)(*(int *)(param_1 + 0x4028) + 0x114))
                      (param_1 + 0x4028,local_50,*(undefined4 *)(TankThrowAllowRange._28_4_ + 0x2c))
    ;
    if (cVar4 != '\0') {
      return;
    }
    piVar5 = (int *)(**(code **)(*(int *)param_1 + 0x9bc))(param_1);
    local_50 = 0;
    uVar2 = *(uint *)(this + 0x34);
    if (((uVar2 != 0xffffffff) &&
        (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
      local_50 = *(undefined4 *)(puVar9 + 4);
    }
    cVar4 = (**(code **)(*piVar5 + 0xf8))(piVar5,local_50,0);
    if (cVar4 == '\0') {
      return;
    }
    cVar4 = (**(code **)(*piVar6 + 0x32c))(piVar6);
    if (cVar4 == '\0') {
      return;
    }
    cVar4 = (**(code **)(*piVar6 + 0x33c))(piVar6);
    if (cVar4 == '\0') {
      return;
    }
    piVar6 = (int *)(**(code **)(*(int *)param_1 + 0x9bc))(param_1);
    uVar2 = *(uint *)(this + 0x34);
    if (((uVar2 == 0xffffffff) ||
        (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar9 + 8) != uVar2 >> 0xc)) {
      uVar10 = 0;
    }
    else {
      uVar10 = *(undefined4 *)(puVar9 + 4);
    }
    cVar4 = (**(code **)(*piVar6 + 0x100))(piVar6,uVar10,0x3f733333);
    if (cVar4 == '\0') {
      return;
    }
    (**(code **)(*(int *)param_1 + 0x940))(param_1);
    fVar18 = *(float *)(TankThrowMinInterval._28_4_ + 0x2c);
    lVar12 = (longdouble)CountdownTimer::Now();
    if ((float)lVar12 + fVar18 != *(float *)(this + 0x4864)) {
      (**(code **)(*(int *)(this + 0x485c) + 4))(this + 0x485c);
      *(float *)(this + 0x4864) = (float)lVar12 + fVar18;
    }
    if (fVar18 != *(float *)(this + 0x4860)) {
      (**(code **)(*(int *)(this + 0x485c) + 4))(this + 0x485c);
      *(float *)(this + 0x4860) = fVar18;
    }
    UpdateThrowAimError(this);
  }
  piVar6 = (int *)(**(code **)(*(int *)param_1 + 0x9b0))(param_1);
  (**(code **)(*piVar6 + 0x170))(piVar6,"Throwing rock");
  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)