L L4D2node

CFourWheelVehiclePhysics::Think

0x006afa80 · 1717 bytes · __thiscall

_ZN24CFourWheelVehiclePhysics5ThinkEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CFourWheelVehiclePhysics::Think() */

CFourWheelVehiclePhysics __thiscall CFourWheelVehiclePhysics::Think(CFourWheelVehiclePhysics *this)

{
  undefined *puVar1;
  float fVar2;
  CFourWheelVehiclePhysics CVar3;
  char cVar4;
  float *pfVar5;
  int iVar6;
  uint uVar7;
  undefined4 uVar8;
  int iVar9;
  int *piVar10;
  undefined *puVar11;
  int *piVar12;
  undefined4 *puVar13;
  undefined4 *puVar14;
  int iVar15;
  int iVar16;
  int *piVar17;
  longdouble lVar18;
  float fVar19;
  Vector local_48 [12];
  undefined **local_3c [11];
  
  piVar17 = (int *)&stack0xffffff94;
  puVar13 = (undefined4 *)&stack0xffffff94;
  puVar14 = (undefined4 *)&stack0xffffff94;
  if (*(int **)(this + 0x24) == (int *)0x0) {
    return (CFourWheelVehiclePhysics)0x0;
  }
  pfVar5 = (float *)(**(code **)(**(int **)(this + 0x24) + 0xc))();
  iVar6 = (**(code **)(**(int **)(this + 0x24) + 0x10))();
  fVar19 = *pfVar5;
  *(undefined4 *)(this + 0x2c) = *(undefined4 *)(this + 0x28);
  *(int *)(this + 0x28) = (int)ABS(fVar19 * 0.056818184);
  *(int *)(this + 0x30) = (int)pfVar5[1];
  *(int *)(this + 0x3c) = (int)*(float *)(iVar6 + 0x244);
  (**(code **)(**(int **)(this + 0x24) + 8))();
  cVar4 = IsBoosting(this);
  iVar15 = gpGlobals;
  if ((cVar4 == '\0') || (this[0x136] != (CFourWheelVehiclePhysics)0x0)) {
    cVar4 = IsBoosting(this);
    if ((cVar4 == '\0') &&
       ((this[0x136] != (CFourWheelVehiclePhysics)0x0 &&
        (*(float *)(this + 300) <= *(float *)(gpGlobals + 0xc))))) {
      this[0x136] = (CFourWheelVehiclePhysics)0x0;
    }
  }
  else {
    this[0x136] = (CFourWheelVehiclePhysics)0x1;
    *(float *)(this + 300) = *(float *)(iVar15 + 0xc) + 2.75;
  }
  puVar11 = g_pEntityList;
  *(float *)(this + 0x34) = pfVar5[3];
  *(float *)(this + 0x38) = pfVar5[4];
  uVar7 = *(uint *)(this + 4);
  if ((uVar7 == 0xffffffff) ||
     (puVar1 = puVar11 + (uVar7 & 0xfff) * 0x10, puVar1 == (undefined *)0xfffffffc)) {
    iVar15 = 0;
    if (_DAT_00000238 != 0) goto LAB_006afbb2;
  }
  else {
    if (*(uint *)(puVar1 + 8) == uVar7 >> 0xc) {
      iVar15 = *(int *)(puVar1 + 4);
    }
    else {
      iVar15 = 0;
    }
    piVar17 = (int *)&stack0xffffff94;
    if (*(int *)(iVar15 + 0x238) != 0) {
      if (*(uint *)(puVar1 + 8) == uVar7 >> 0xc) {
        iVar15 = *(int *)(puVar1 + 4);
      }
      else {
        iVar15 = 0;
      }
LAB_006afbb2:
      iVar15 = (**(code **)(**(int **)(iVar15 + 0x238) + 0x120))();
      if (iVar15 == 0) {
        CVar3 = this[0x137];
        fVar19 = 10.0;
        if (CVar3 == (CFourWheelVehiclePhysics)0x0) {
          fVar19 = *pfVar5 * 0.15;
          if (fVar19 < 10.0) {
            fVar19 = ABS(*pfVar5) * 0.015000001;
            if (1.0 <= fVar19) {
              fVar19 = 1.0;
            }
            if (fVar19 <= 0.0) {
              fVar19 = 0.0;
            }
            fVar19 = fVar19 * -70.0 + 80.0;
          }
        }
        if ((pfVar5[5] <= fVar19) || (this[0x134] == (CFourWheelVehiclePhysics)0x0)) {
          puVar13 = (undefined4 *)&stack0xffffff94;
          if (CVar3 != (CFourWheelVehiclePhysics)0x0) {
            this[0x137] = (CFourWheelVehiclePhysics)0x0;
            (**(code **)(**(int **)(this + 8) + 0x114))();
            puVar13 = (undefined4 *)&stack0xffffff94;
          }
        }
        else {
          if (CVar3 == (CFourWheelVehiclePhysics)0x0) {
            uVar7 = *(uint *)(this + 4);
            piVar17 = (int *)0x0;
            this[0x137] = (CFourWheelVehiclePhysics)0x1;
            if (((uVar7 != 0xffffffff) &&
                (puVar11 = g_pEntityList + (uVar7 & 0xfff) * 0x10,
                puVar11 != (undefined *)0xfffffffc)) && (*(uint *)(puVar11 + 8) == uVar7 >> 0xc)) {
              piVar17 = *(int **)(puVar11 + 4);
            }
            (**(code **)(*piVar17 + 0x28c))();
            CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_3c);
            local_3c[0] = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 006aff84 to 006aff88 has its CatchHandler @ 006b0192 */
            CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_3c,local_48);
            local_3c[0] = &PTR__CPASAttenuationFilter_00c08ec8;
                    /* try { // try from 006aff9c to 006affbb has its CatchHandler @ 006b01b2 */
            (**(code **)(*piVar17 + 0x28c))();
            puVar14 = (undefined4 *)&stack0xffffff8c;
            CPASAttenuationFilter::Filter((CPASAttenuationFilter *)local_3c,local_48,0.8);
                    /* try { // try from 006affcc to 006affd1 has its CatchHandler @ 006b01a7 */
            (**(code **)(**(int **)(this + 8) + 0x110))();
            local_3c[0] = &PTR__CPASFilter_00bfaf28;
            CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_3c);
          }
          iVar15 = 0;
          do {
            if (*(int *)(hl2_episodic._28_4_ + 0x30) == 0) {
              puVar14[-1] = 0x6b0076;
              PlaceWheelDust((CFourWheelVehiclePhysics *)*puVar14,puVar14[1],*(bool *)(puVar14 + 2))
              ;
            }
            iVar15 = iVar15 + 1;
            puVar13 = puVar14;
          } while (iVar15 != 4);
        }
        if (((4 < *(int *)(this + 0x28)) && (*(char *)(iVar6 + 0x29d) != '\0')) &&
           (this[0x134] != (CFourWheelVehiclePhysics)0x0)) {
          iVar15 = 0;
          do {
            if (*(int *)(hl2_episodic._28_4_ + 0x30) == 0) {
              puVar13[-1] = 0x6b008b;
              PlaceWheelDust((CFourWheelVehiclePhysics *)*puVar13,puVar13[1],*(bool *)(puVar13 + 2))
              ;
            }
            iVar15 = iVar15 + 1;
          } while (iVar15 != 4);
        }
      }
      uVar7 = *(uint *)(this + 4);
      puVar11 = g_pEntityList;
      piVar17 = puVar13;
    }
  }
  iVar15 = *(int *)(this + 0x104);
  if (((uVar7 == 0xffffffff) ||
      (puVar11 = puVar11 + (uVar7 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar11 + 8) != uVar7 >> 0xc)) {
    uVar8 = 0;
  }
  else {
    uVar8 = *(undefined4 *)(puVar11 + 4);
  }
  *piVar17 = uVar8;
  piVar17[1] = iVar15;
  piVar17[-1] = 0x6afc0d;
  lVar18 = (longdouble)CBaseAnimating::GetPoseParameter((CBaseAnimating *)*piVar17,piVar17[1]);
  fVar19 = pfVar5[7];
  iVar15 = *(int *)(this + 0x104);
  fVar2 = *(float *)(iVar6 + 600);
  uVar7 = *(uint *)(this + 4);
  if (((uVar7 == 0xffffffff) ||
      (puVar11 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar11 + 8) != uVar7 >> 0xc)) {
    iVar6 = 0;
  }
  else {
    iVar6 = *(int *)(puVar11 + 4);
  }
  piVar10 = *(int **)(iVar6 + 0x13e0);
  if (piVar10 == (int *)0x0) {
    *piVar17 = iVar6;
    piVar17[-1] = 0x6b00e5;
    iVar16 = CBaseEntity::GetModel((CBaseEntity *)*piVar17);
    if (iVar16 == 0) {
      piVar10 = *(int **)(iVar6 + 0x13e0);
    }
    else {
      *piVar17 = iVar6;
      piVar17[-1] = 0x6b00fb;
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)*piVar17);
      piVar10 = *(int **)(iVar6 + 0x13e0);
    }
    piVar12 = (int *)0x0;
    if (piVar10 != (int *)0x0) goto LAB_006afc91;
  }
  else {
LAB_006afc91:
    piVar12 = (int *)0x0;
    if (*piVar10 != 0) {
      piVar12 = piVar10;
    }
  }
  piVar17[3] = (int)((float)lVar18 * 0.8 + (fVar19 / fVar2) * 0.2);
  *piVar17 = iVar6;
  piVar17[2] = iVar15;
  piVar17[1] = (int)piVar12;
  piVar17[-1] = 0x6afcb0;
  CBaseAnimating::SetPoseParameter
            ((CBaseAnimating *)*piVar17,(CStudioHdr *)piVar17[1],piVar17[2],(float)piVar17[3]);
  puVar11 = g_pEntityList;
  iVar15 = *(int *)(this + 0x108);
  uVar7 = *(uint *)(this + 4);
  fVar19 = *(float *)(this + 0x118) * *(float *)(this + 0x4c) * *(float *)(gpGlobals + 0x10) +
           *(float *)(this + 0x114);
  *(float *)(this + 0x114) = fVar19;
  if (((uVar7 == 0xffffffff) ||
      (puVar11 = puVar11 + (uVar7 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar11 + 8) != uVar7 >> 0xc)) {
    iVar6 = 0;
  }
  else {
    iVar6 = *(int *)(puVar11 + 4);
  }
  piVar10 = *(int **)(iVar6 + 0x13e0);
  if (piVar10 == (int *)0x0) {
    *piVar17 = iVar6;
    piVar17[-1] = 0x6b009d;
    iVar16 = CBaseEntity::GetModel((CBaseEntity *)*piVar17);
    if (iVar16 == 0) {
      piVar10 = *(int **)(iVar6 + 0x13e0);
    }
    else {
      *piVar17 = iVar6;
      piVar17[-1] = 0x6b00b7;
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)*piVar17);
      piVar10 = *(int **)(iVar6 + 0x13e0);
    }
    piVar12 = (int *)0x0;
    if (piVar10 != (int *)0x0) goto LAB_006afd1d;
  }
  else {
LAB_006afd1d:
    piVar12 = (int *)0x0;
    if (*piVar10 != 0) {
      piVar12 = piVar10;
    }
  }
  piVar17[3] = (int)fVar19;
  piVar17[2] = iVar15;
  piVar17[1] = (int)piVar12;
  *piVar17 = iVar6;
  piVar17[-1] = 0x6afd3c;
  CBaseAnimating::SetPoseParameter
            ((CBaseAnimating *)*piVar17,(CStudioHdr *)piVar17[1],piVar17[2],(float)piVar17[3]);
  if (this[0x134] == (CFourWheelVehiclePhysics)0x0) {
    return (CFourWheelVehiclePhysics)0x0;
  }
  iVar15 = *(int *)(this + 0x28);
  uVar7 = *(uint *)(this + 4);
  iVar6 = *(int *)(this + 0x10c);
  if (((uVar7 == 0xffffffff) ||
      (puVar11 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar11 + 8) != uVar7 >> 0xc)) {
    iVar16 = 0;
  }
  else {
    iVar16 = *(int *)(puVar11 + 4);
  }
  piVar10 = *(int **)(iVar16 + 0x13e0);
  if (piVar10 == (int *)0x0) {
    *piVar17 = iVar16;
    piVar17[-1] = 0x6b015a;
    iVar9 = CBaseEntity::GetModel((CBaseEntity *)*piVar17);
    if (iVar9 == 0) {
      piVar10 = *(int **)(iVar16 + 0x13e0);
    }
    else {
      *piVar17 = iVar16;
      piVar17[-1] = 0x6b0170;
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)*piVar17);
      piVar10 = *(int **)(iVar16 + 0x13e0);
    }
    piVar12 = (int *)0x0;
    if (piVar10 == (int *)0x0) goto LAB_006afe02;
  }
  piVar12 = (int *)0x0;
  if (*piVar10 != 0) {
    piVar12 = piVar10;
  }
LAB_006afe02:
  piVar17[2] = iVar6;
  *piVar17 = iVar16;
  piVar17[3] = (int)((float)iVar15 * 0.01);
  piVar17[1] = (int)piVar12;
  piVar17[-1] = 0x6afe18;
  CBaseAnimating::SetPoseParameter
            ((CBaseAnimating *)*piVar17,(CStudioHdr *)piVar17[1],piVar17[2],(float)piVar17[3]);
  return this[0x134];
}

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)