L L4D2node

CEnvShake::ApplyShake

0x0068a120 · 1130 bytes · __thiscall

_ZN9CEnvShake10ApplyShakeE14ShakeCommand_t

Decompiled

undefined (2 params)

/* CEnvShake::ApplyShake(ShakeCommand_t) */

void __thiscall CEnvShake::ApplyShake(CEnvShake *this,undefined4 param_2)

{
  undefined4 uVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  CBaseEntity *pCVar4;
  int *piVar5;
  char cVar6;
  int iVar7;
  uint uVar8;
  int iVar9;
  undefined4 uVar10;
  float fVar11;
  float fVar12;
  float local_1048;
  float local_1044;
  float local_1040;
  float local_103c;
  float local_1038;
  float local_1034;
  CFlaggedEntitiesEnum local_1030 [20];
  CBaseEntity *local_101c [1027];
  
  uVar8 = *(uint *)(this + 0x148);
  if ((uVar8 & 0x60) != 0x60) {
    uVar10 = 0;
    if ((uVar8 & 1) == 0) {
      uVar10 = *(undefined4 *)(this + 0x44c);
    }
    uVar1 = *(undefined4 *)(this + 0x448);
    uVar2 = *(undefined4 *)(this + 0x444);
    uVar3 = *(undefined4 *)(this + 0x440);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    UTIL_ScreenShake(this + 0x2e0,uVar3,uVar2,uVar1,uVar10,param_2,uVar8 >> 2 & 1,0);
    uVar8 = *(uint *)(this + 0x148);
  }
  if ((uVar8 & 0x10) != 0) {
    fVar11 = *(float *)(this + 0x444);
    fVar12 = *(float *)(this + 0x44c);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    CRopeKeyframe::ShakeRopes((Vector *)(this + 0x2e0),fVar12,fVar11);
    uVar8 = *(uint *)(this + 0x148);
  }
  if ((uVar8 & 8) != 0) {
    if (*(int *)(this + 0x468) == 0) {
      uVar10 = (**(code **)(*physenv + 0x78))(physenv,this + 0x46c);
      *(undefined4 *)(this + 0x468) = uVar10;
    }
    switch(param_2) {
    case 0:
    case 4:
    case 5:
      fVar11 = *(float *)(gpGlobals + 0xc);
      *(undefined4 *)(this + 0x454) = 0;
      *(float *)(this + 0x450) = *(float *)(this + 0x448) + fVar11;
      (**(code **)(**(int **)(this + 0x468) + 0x1c))(*(int **)(this + 0x468));
      CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc),(char *)0x0);
      *(undefined4 *)(this + 0x458) = *(undefined4 *)(this + 0x440);
      fVar11 = *(float *)(this + 0x44c);
      if (fVar11 == 0.0) {
        fVar12 = 512.0;
        fVar11 = 512.0;
      }
      else {
        fVar12 = 100.0;
        if (100.0 <= fVar11) {
          fVar12 = fVar11;
        }
      }
      if (((byte)this[0x14d] & 8) == 0) {
        local_103c = *(float *)(this + 0x2e0);
        local_1048 = local_103c - fVar11;
        local_1038 = *(float *)(this + 0x2e4);
        local_1044 = local_1038 - fVar11;
        local_1034 = *(float *)(this + 0x2e8);
        local_1040 = local_1034 - fVar12;
      }
      else {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        local_103c = *(float *)(this + 0x2e0);
        local_1048 = local_103c - fVar11;
        local_1038 = *(float *)(this + 0x2e4);
        local_1044 = local_1038 - fVar11;
        local_1034 = *(float *)(this + 0x2e8);
        local_1040 = local_1034 - fVar12;
        if ((*(uint *)(this + 0x14c) & 0x800) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          local_103c = *(float *)(this + 0x2e0);
          local_1038 = *(float *)(this + 0x2e4);
          local_1034 = *(float *)(this + 0x2e8);
        }
      }
      local_103c = local_103c + fVar11;
      local_1038 = local_1038 + fVar11;
      local_1034 = local_1034 + fVar12;
      CFlaggedEntitiesEnum::CFlaggedEntitiesEnum(local_1030,local_101c,0x400,0);
      iVar7 = UTIL_EntitiesInBox((Vector *)&local_1048,(Vector *)&local_103c,local_1030);
      if (0 < iVar7) {
        iVar9 = 0;
        do {
          pCVar4 = local_101c[iVar9];
          if (((pCVar4[0x186] == (CBaseEntity)0x6) &&
              (piVar5 = *(int **)(pCVar4 + 0x238), piVar5 != (int *)0x0)) &&
             (cVar6 = (**(code **)(*piVar5 + 0x2c))(piVar5), cVar6 != '\0')) {
            (**(code **)(**(int **)(this + 0x468) + 0xc))(*(int **)(this + 0x468),piVar5,0);
            (**(code **)(*piVar5 + 100))(piVar5);
          }
          iVar9 = iVar9 + 1;
        } while (iVar9 != iVar7);
      }
      break;
    case 1:
      (**(code **)(**(int **)(this + 0x468) + 0x1c))(*(int **)(this + 0x468));
      break;
    case 2:
      *(undefined4 *)(this + 0x458) = *(undefined4 *)(this + 0x440);
    case 3:
      (**(code **)(**(int **)(this + 0x468) + 0x20))(*(int **)(this + 0x468));
      return;
    }
  }
  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)